* clearer name for check order button
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 13 Dec 2008 21:37:38 +0000 (21:37 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Sat, 13 Dec 2008 21:37:38 +0000 (21:37 +0000)
* preselect new customers
* fix customer preselection on dlg create

git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@214 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

doc/prog_protocol.html
src/customer.cpp
src/customer.h
src/overview.cpp
src/smoke_de.ts
src/smoke_de_SAX.ts
src/smoke_en.ts

index 33e0663..77309f5 100644 (file)
@@ -432,7 +432,7 @@ The "mail" attribute is optional - it is only reported for customers that have a
 
 <h3>Setting Customer Details</h3>
 
-The <tt>setcustomer</tt> transaction is used to set details of the customer. The request contains a customer XML object as listed above, but without the mail attribute. The response is empty.
+The <tt>setcustomer</tt> transaction is used to set details of the customer. The request contains a customer XML object as listed above, but without the mail attribute. The response contains the ID of the customer.
 
 <h3>Deleting and Merging Customers</h3>
 
index 09290b1..5fcc512 100644 (file)
@@ -185,8 +185,10 @@ void MCustomer::save()
        cse.appendChild(el);
        doc.appendChild(cse);
        //request
-       m_req->request("setcustomer",doc.toByteArray());
-       //TODO: do something useful with the result
+       if(!m_req->request("setcustomer",doc.toByteArray()))return;
+       //check result code
+       if(m_req->responseStatus()!=MWebRequest::Ok)return;
+       m_id=m_req->responseBody().trimmed().toInt();
 }
 
 /*********************************************************/
@@ -243,18 +245,17 @@ MCustomerListDialog::MCustomerListDialog(MWebRequest*r,QWidget*par,bool isselect
        }
        
        //update data
-       updateList();
-       if(presel>-1){
-               for(int i=0;i<m_proxymodel->rowCount();i++){
-                       QModelIndex idx=m_proxymodel->index(0,i);
-                       if(m_proxymodel->data(idx,Qt::UserRole).toInt()==presel)
-                               m_listview->setCurrentIndex(idx);
-               }
-       }
+       updateList(presel);
 }
 
-void MCustomerListDialog::updateList()
+void MCustomerListDialog::updateList(int nid)
 {
+       //check for current selection
+       if(nid<0){
+               QModelIndex idx=m_listview->currentIndex();
+               if(idx.isValid())
+                       nid=m_proxymodel->data(idx,Qt::UserRole).toInt();
+       }
        //go to server
        m_list=m_req->getAllCustomers();
        //update widget
@@ -267,6 +268,17 @@ void MCustomerListDialog::updateList()
                m_listmodel->setData(idx,i,Qt::UserRole);
        }
        m_listmodel->sort(0);
+       //reset current
+       if(nid>=0)
+       for(int i=0;i<m_proxymodel->rowCount();i++){
+               QModelIndex idx=m_proxymodel->index(i,0);
+               int j=m_proxymodel->data(idx,Qt::UserRole).toInt();
+               if(j<0 || j>=m_list.size())continue;
+               if(nid==m_list[j].customerID()){
+                       m_listview->setCurrentIndex(idx);
+                       break;
+               }
+       }
 }
 
 MCustomer MCustomerListDialog::getCustomer()
@@ -284,7 +296,7 @@ void MCustomerListDialog::newCustomer()
 {
        MCustomerDialog cd(MCustomer(m_req),this);
        if(cd.exec()==QDialog::Accepted)
-               updateList();
+               updateList(cd.getCustomer().customerID());
 }
 void MCustomerListDialog::editCustomer()
 {
index a63b1f5..4bf7282 100644 (file)
@@ -120,7 +120,7 @@ class MCustomerListDialog:public QDialog
                MWebRequest*m_req;
                
                /**updates internal list*/
-               void updateList();
+               void updateList(int id=-1);
 };
 
 class QLineEdit;
index 645717f..19bf76e 100644 (file)
@@ -185,7 +185,7 @@ MOverview::MOverview(MWebRequest*mw,QString pk)
        frm->setFrameShape(QFrame::HLine);
        vl->addLayout(hl=new QHBoxLayout,0);
        hl->addStretch(10);
-       hl->addWidget(p=new QPushButton(tr("Order Items")));
+       hl->addWidget(p=new QPushButton(tr("Check Order")));
        p->setEnabled(req->hasRole("checkorder"));
        connect(p,SIGNAL(clicked()),this,SLOT(cartOrder()));
        hl->addWidget(p=new QPushButton(tr("Clear")));
index bd722b4..bdbcf7d 100644 (file)
 <context>
     <name>MCustomerDialog</name>
     <message>
-        <location filename="customer.cpp" line="360"/>
+        <location filename="customer.cpp" line="374"/>
         <source>Customer %1</source>
         <translation>Kunde %1</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="362"/>
+        <location filename="customer.cpp" line="376"/>
         <source>New Customer</source>
         <translation>Neuer Kunde</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="368"/>
+        <location filename="customer.cpp" line="382"/>
         <source>Name:</source>
         <translation>Name:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="370"/>
+        <location filename="customer.cpp" line="384"/>
         <source>Address:</source>
         <translation>Rechnungsadresse:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="373"/>
+        <location filename="customer.cpp" line="387"/>
         <source>Contact Information:</source>
         <translation>Kontaktinformationen:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="377"/>
+        <location filename="customer.cpp" line="391"/>
         <source>Web-Login/eMail:</source>
         <translation>Web-Login/eMail:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="380"/>
+        <location filename="customer.cpp" line="394"/>
         <source>Comment:</source>
         <translation>Kommentar:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="388"/>
+        <location filename="customer.cpp" line="402"/>
         <source>Save</source>
         <translation>Speichern</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="391"/>
+        <location filename="customer.cpp" line="405"/>
         <source>Cancel</source>
         <translation>Abbrechen</translation>
     </message>
 <context>
     <name>MCustomerListDialog</name>
     <message>
-        <location filename="customer.cpp" line="199"/>
+        <location filename="customer.cpp" line="201"/>
         <source>Select a Customer</source>
         <translation>Kunde auswählen</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="201"/>
+        <location filename="customer.cpp" line="203"/>
         <source>Customers</source>
         <translation>Kunden</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="220"/>
+        <location filename="customer.cpp" line="224"/>
         <source>Details...</source>
         <translation>Details...</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="222"/>
+        <location filename="customer.cpp" line="226"/>
         <source>Create new...</source>
         <translation>Neu...</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="225"/>
+        <location filename="customer.cpp" line="229"/>
         <source>Delete...</source>
         <translation>Löschen...</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="233"/>
+        <location filename="customer.cpp" line="237"/>
         <source>Select</source>
         <translation>Auswählen</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="236"/>
+        <location filename="customer.cpp" line="240"/>
         <source>Cancel</source>
         <translation>Abbrechen</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="239"/>
+        <location filename="customer.cpp" line="243"/>
         <source>Close</source>
         <translation>Schließen</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="310"/>
+        <location filename="customer.cpp" line="324"/>
         <source>Delete Customer</source>
         <translation>Kunden Löschen</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="313"/>
+        <location filename="customer.cpp" line="327"/>
         <source>Really delete this customer (%1)?</source>
         <translation>Diesen Kunden (%1) wirklich löschen?</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="316"/>
+        <location filename="customer.cpp" line="330"/>
         <source>merge with other entry:</source>
         <translation>mit anderem Eintrag vereinen:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="328"/>
+        <location filename="customer.cpp" line="342"/>
         <source>&amp;Yes</source>
         <translation>&amp;Ja</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="330"/>
+        <location filename="customer.cpp" line="344"/>
         <source>&amp;No</source>
         <translation>&amp;Nein</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="346"/>
+        <location filename="customer.cpp" line="360"/>
         <source>Error</source>
         <translation>Fehler</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="342"/>
+        <location filename="customer.cpp" line="356"/>
         <source>Failed to delete customer.</source>
         <translation>Kann Kunden nicht löschen.</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="346"/>
+        <location filename="customer.cpp" line="360"/>
         <source>Failed to delete customer: %1</source>
         <translation>Kann Kunden nicht löschen: %1</translation>
     </message>
@@ -1775,8 +1775,8 @@ At least %1 Bits of random are required.</source>
     </message>
     <message>
         <location filename="overview.cpp" line="188"/>
-        <source>Order Items</source>
-        <translation>Bestellung anlegen</translation>
+        <source>Check Order</source>
+        <translation>Bestellung prüfen</translation>
     </message>
     <message>
         <location filename="overview.cpp" line="195"/>
index 7e7b5e8..30759c6 100644 (file)
 <context>
     <name>MCustomerDialog</name>
     <message>
-        <location filename="customer.cpp" line="360"/>
+        <location filename="customer.cpp" line="374"/>
         <source>Customer %1</source>
         <translation>Gunde %1</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="362"/>
+        <location filename="customer.cpp" line="376"/>
         <source>New Customer</source>
         <translation>Neier Gunde</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="368"/>
+        <location filename="customer.cpp" line="382"/>
         <source>Name:</source>
         <translation>Dor Name:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="370"/>
+        <location filename="customer.cpp" line="384"/>
         <source>Address:</source>
         <translation>De Adresse:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="373"/>
+        <location filename="customer.cpp" line="387"/>
         <source>Contact Information:</source>
         <translation>Wie mor den erreischen gann:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="377"/>
+        <location filename="customer.cpp" line="391"/>
         <source>Web-Login/eMail:</source>
         <translation>Wie er sisch im Web anmelden gann:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="380"/>
+        <location filename="customer.cpp" line="394"/>
         <source>Comment:</source>
         <translation>Gommendar:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="388"/>
+        <location filename="customer.cpp" line="402"/>
         <source>Save</source>
         <translation>Schbeichorn</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="391"/>
+        <location filename="customer.cpp" line="405"/>
         <source>Cancel</source>
         <translation>Doch ni&apos; machen</translation>
     </message>
 <context>
     <name>MCustomerListDialog</name>
     <message>
-        <location filename="customer.cpp" line="199"/>
+        <location filename="customer.cpp" line="201"/>
         <source>Select a Customer</source>
         <translation>Gunde auswählen</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="201"/>
+        <location filename="customer.cpp" line="203"/>
         <source>Customers</source>
         <translation>Gunden</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="220"/>
+        <location filename="customer.cpp" line="224"/>
         <source>Details...</source>
         <translation>Dedails anzeichen...</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="222"/>
+        <location filename="customer.cpp" line="226"/>
         <source>Create new...</source>
         <translation>Neuen anlechen...</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="225"/>
+        <location filename="customer.cpp" line="229"/>
         <source>Delete...</source>
         <translation>Wechschmeißen...</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="233"/>
+        <location filename="customer.cpp" line="237"/>
         <source>Select</source>
         <translation>Auswählen</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="236"/>
+        <location filename="customer.cpp" line="240"/>
         <source>Cancel</source>
         <translation>Mach ma ni&apos;</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="239"/>
+        <location filename="customer.cpp" line="243"/>
         <source>Close</source>
         <translation>Zumachn</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="310"/>
+        <location filename="customer.cpp" line="324"/>
         <source>Delete Customer</source>
         <translation>Gunden Löschn</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="313"/>
+        <location filename="customer.cpp" line="327"/>
         <source>Really delete this customer (%1)?</source>
         <translation>Willsde den Gunden wirschlich löschen? Has&apos;de Dir das och gud üborleschd? Das ist dor %1.</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="316"/>
+        <location filename="customer.cpp" line="330"/>
         <source>merge with other entry:</source>
         <translation>Mid &apos;nem andorn Eindrag zusamm&apos;lechn:</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="328"/>
+        <location filename="customer.cpp" line="342"/>
         <source>&amp;Yes</source>
         <translation>&amp;Nu glar!</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="330"/>
+        <location filename="customer.cpp" line="344"/>
         <source>&amp;No</source>
         <translation>Nee &amp;Lass ma!</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="346"/>
+        <location filename="customer.cpp" line="360"/>
         <source>Error</source>
         <translation>Gans doller falschor Fehler</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="342"/>
+        <location filename="customer.cpp" line="356"/>
         <source>Failed to delete customer.</source>
         <translation>Gann den Gunden ni löschen. Gomm&apos;se morchen nochma&apos;.</translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="346"/>
+        <location filename="customer.cpp" line="360"/>
         <source>Failed to delete customer: %1</source>
         <translation>Gann den Gunden &quot;%1&quot; ni löschen. Gomm&apos;se morchen nochma&apos;.</translation>
     </message>
@@ -1774,8 +1774,8 @@ At least %1 Bits of random are required.</source>
     </message>
     <message>
         <location filename="overview.cpp" line="188"/>
-        <source>Order Items</source>
-        <translation>Ne Beschdellung anlegn.</translation>
+        <source>Check Order</source>
+        <translation type="unfinished">Ne Beschdellung anlegn.</translation>
     </message>
     <message>
         <location filename="overview.cpp" line="195"/>
index 8d68cf8..ce3a786 100644 (file)
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS><TS version="1.1" language="en">
-<defaultcodec></defaultcodec>
 <context>
     <name>MCheckDialog</name>
     <message>
 <context>
     <name>MCustomerDialog</name>
     <message>
-        <location filename="customer.cpp" line="360"/>
+        <location filename="customer.cpp" line="374"/>
         <source>Customer %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="362"/>
+        <location filename="customer.cpp" line="376"/>
         <source>New Customer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="368"/>
+        <location filename="customer.cpp" line="382"/>
         <source>Name:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="370"/>
+        <location filename="customer.cpp" line="384"/>
         <source>Address:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="373"/>
+        <location filename="customer.cpp" line="387"/>
         <source>Contact Information:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="377"/>
+        <location filename="customer.cpp" line="391"/>
         <source>Web-Login/eMail:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="380"/>
+        <location filename="customer.cpp" line="394"/>
         <source>Comment:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="388"/>
+        <location filename="customer.cpp" line="402"/>
         <source>Save</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="391"/>
+        <location filename="customer.cpp" line="405"/>
         <source>Cancel</source>
         <translation type="unfinished"></translation>
     </message>
 <context>
     <name>MCustomerListDialog</name>
     <message>
-        <location filename="customer.cpp" line="199"/>
+        <location filename="customer.cpp" line="201"/>
         <source>Select a Customer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="201"/>
+        <location filename="customer.cpp" line="203"/>
         <source>Customers</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="220"/>
+        <location filename="customer.cpp" line="224"/>
         <source>Details...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="222"/>
+        <location filename="customer.cpp" line="226"/>
         <source>Create new...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="225"/>
+        <location filename="customer.cpp" line="229"/>
         <source>Delete...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="233"/>
+        <location filename="customer.cpp" line="237"/>
         <source>Select</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="236"/>
+        <location filename="customer.cpp" line="240"/>
         <source>Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="239"/>
+        <location filename="customer.cpp" line="243"/>
         <source>Close</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="310"/>
+        <location filename="customer.cpp" line="324"/>
         <source>Delete Customer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="313"/>
+        <location filename="customer.cpp" line="327"/>
         <source>Really delete this customer (%1)?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="316"/>
+        <location filename="customer.cpp" line="330"/>
         <source>merge with other entry:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="328"/>
+        <location filename="customer.cpp" line="342"/>
         <source>&amp;Yes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="330"/>
+        <location filename="customer.cpp" line="344"/>
         <source>&amp;No</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="346"/>
+        <location filename="customer.cpp" line="360"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="342"/>
+        <location filename="customer.cpp" line="356"/>
         <source>Failed to delete customer.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="customer.cpp" line="346"/>
+        <location filename="customer.cpp" line="360"/>
         <source>Failed to delete customer: %1</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1490,7 +1489,7 @@ At least %1 Bits of random are required.</source>
     </message>
     <message>
         <location filename="overview.cpp" line="188"/>
-        <source>Order Items</source>
+        <source>Check Order</source>
         <translation type="unfinished"></translation>
     </message>
     <message>