From: konrad Date: Fri, 1 Jan 2010 18:23:50 +0000 (+0000) Subject: got rid of old customer object X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=0eef882fcb5f046185e76678c8bf186b56a707dc;p=web%2Fkonrad%2Fsmoke.git got rid of old customer object git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@393 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/src/dialogs/customerdlg.cpp b/src/dialogs/customerdlg.cpp index 91a17f1..58e772a 100644 --- a/src/dialogs/customerdlg.cpp +++ b/src/dialogs/customerdlg.cpp @@ -131,7 +131,7 @@ MOCustomerInfo MCustomerListDialog::getCustomer() void MCustomerListDialog::newCustomer() { - MCustomerDialog cd(MCustomer(),this); + MCustomerDialog cd(MOCustomer(),this); if(cd.exec()==QDialog::Accepted) updateList(cd.getCustomer().id()); } @@ -197,7 +197,7 @@ void MCustomerListDialog::deleteCustomer() /****************************************************************/ -MCustomerDialog::MCustomerDialog(MCustomer c,QWidget*par) +MCustomerDialog::MCustomerDialog(MOCustomer c,QWidget*par) :QDialog(par),m_cust(c) { if(m_cust.isValid()) @@ -237,7 +237,7 @@ MCustomerDialog::MCustomerDialog(MCustomer c,QWidget*par) connect(p,SIGNAL(clicked()),this,SLOT(reject())); } -MCustomer MCustomerDialog::getCustomer() +MOCustomer MCustomerDialog::getCustomer() { //copy data from input fields m_cust.setname(m_name->text()); diff --git a/src/dialogs/customerdlg.h b/src/dialogs/customerdlg.h index abf04d6..524ec69 100644 --- a/src/dialogs/customerdlg.h +++ b/src/dialogs/customerdlg.h @@ -18,6 +18,7 @@ #include #include "MOCustomerInfo.h" +#include "MOCustomer.h" class QListView; class QStandardItemModel; @@ -58,24 +59,23 @@ class QLineEdit; class QTextEdit; class QLabel; -#include"customer.h" /**edit a specific customer*/ class MCustomerDialog:public QDialog { Q_OBJECT public: /**creates a new customer dialog*/ - MCustomerDialog(MCustomer,QWidget*); + MCustomerDialog(MOCustomer,QWidget*); /**returns the customer as currently entered*/ - MCustomer getCustomer(); + MOCustomer getCustomer(); private slots: /**internal: save data*/ void save(); private: - MCustomer m_cust; + MOCustomer m_cust; QLineEdit*m_name; QTextEdit*m_addr,*m_cont,*m_comm; QLabel*m_mail; diff --git a/src/iface/customer.h b/src/iface/customer.h deleted file mode 100644 index edde9d7..0000000 --- a/src/iface/customer.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// C++ Interface: customer -// -// Description: -// -// -// Author: Konrad Rosenbaum , (C) 2008 -// -// Copyright: See README/COPYING files that come with this distribution -// -// - -#ifndef MAGICSMOKE_CUSTOMER_H -#define MAGICSMOKE_CUSTOMER_H - -#include - -#include "MOCustomer.h" - -/**this class expands on MOCustomer to add some convenience methods*/ -class MCustomer:public MOCustomer -{ - public: - /**creates an empty/invalid customer*/ - MCustomer(){} - /**fetches customer from the Database*/ - MCustomer(qint64); - /**copies a customer*/ - MCustomer(const MCustomer&c):MOCustomer(c){} - MCustomer(const MOCustomer&c):MOCustomer(c){} - - /**copies a customer*/ - MCustomer& operator=(const MCustomer&c){MOCustomer::operator=(c);return *this;} - MCustomer& operator=(const MOCustomer&c){MOCustomer::operator=(c);return *this;} - - /**returns whether the customer is valid*/ - bool isValid(); - - /**returns the address of the customer*/ - QString address(int i=0); -}; - -#endif diff --git a/src/iface/iface.pri b/src/iface/iface.pri index c9dc8e7..6dfac48 100644 --- a/src/iface/iface.pri +++ b/src/iface/iface.pri @@ -1,12 +1,9 @@ HEADERS += \ iface/msinterface.h \ - iface/sslexception.h \ - iface/customer.h - + iface/sslexception.h SOURCES += \ iface/msinterface.cpp \ - iface/sslexception.cpp \ - iface/customer.cpp + iface/sslexception.cpp INCLUDEPATH += ./iface \ No newline at end of file diff --git a/src/mwin/carttab.cpp b/src/mwin/carttab.cpp index 5eeda29..b02fedb 100644 --- a/src/mwin/carttab.cpp +++ b/src/mwin/carttab.cpp @@ -130,7 +130,7 @@ void MCartTab::initCart() cartmodel->clear(); cartmodel->setHorizontalHeaderLabels(QStringList()<setText(""); //clear address/comment cartaddr->setPlainText(""); diff --git a/src/mwin/carttab.h b/src/mwin/carttab.h index a0bb3a9..4200e70 100644 --- a/src/mwin/carttab.h +++ b/src/mwin/carttab.h @@ -19,7 +19,7 @@ #include #include -#include "customer.h" +#include "MOCustomer.h" class QAction; class QCheckBox; @@ -94,7 +94,7 @@ class MCartTab:public QWidget QTextEdit *cartaddr,*cartcomment; QComboBox*cartship; //cart - MCustomer customer; + MOCustomer customer; }; /**Helper class for shopping cart: allow editing amount, but nothing else*/ diff --git a/src/mwin/overview.h b/src/mwin/overview.h index fe9db3b..5b722e5 100644 --- a/src/mwin/overview.h +++ b/src/mwin/overview.h @@ -19,8 +19,6 @@ #include #include -#include "customer.h" - class QAction; class QCheckBox; class QComboBox; diff --git a/src/iface/customer.cpp b/src/wext/MOCustomer.cpp similarity index 80% rename from src/iface/customer.cpp rename to src/wext/MOCustomer.cpp index 4ddff1f..93dec4d 100644 --- a/src/iface/customer.cpp +++ b/src/wext/MOCustomer.cpp @@ -10,23 +10,17 @@ // // -#include "customer.h" +#include "MOCustomer.h" #include "msinterface.h" -MCustomer::MCustomer(qint64 i) +MOCustomer::MOCustomer(qint64 i) { MTGetCustomer gc=req->queryGetCustomer(i); if(gc.stage()==gc.Success) operator=(gc.getcustomer().value()); } -bool MCustomer::isValid() -{ - //TODO: reconsider isValid - return id()>-1; -} - -QString MCustomer::address(int i) +QString MOCustomer::address(int i) { if(i<0)return ""; QListadrs=addresses(); @@ -36,7 +30,6 @@ QString MCustomer::address(int i) if(adr.name().isNull())ret=name(); else ret=adr.name().value(); ret+="\n"; -// if(!adr.company().isNull())ret+=adr.company().value()+"\n"; if(!adr.addr1().isNull())ret+=adr.addr1().value()+"\n"; if(!adr.addr2().isNull())ret+=adr.addr2().value()+"\n"; if(!adr.city().isNull())ret+=adr.city().value()+"\n"; diff --git a/src/wext/MOCustomerInfo.h b/src/wext/MOCustomerInfo.h index 34c1bcc..cbf0a4e 100644 --- a/src/wext/MOCustomerInfo.h +++ b/src/wext/MOCustomerInfo.h @@ -10,8 +10,8 @@ // // -#ifndef MAGICSMOKE_MOCUSTOMER_H -#define MAGICSMOKE_MOCUSTOMER_H +#ifndef MAGICSMOKE_MOCUSTOMERI_H +#define MAGICSMOKE_MOCUSTOMERI_H #include "MOCustomerInfoAbstract.h" class MOCustomerInfo:public MOCustomerInfoAbstract diff --git a/src/wext/wext.pri b/src/wext/wext.pri index b47c22b..0e85fd6 100644 --- a/src/wext/wext.pri +++ b/src/wext/wext.pri @@ -7,11 +7,13 @@ HEADERS += \ wext/MORole.h \ wext/MOTicket.h \ wext/MOAddress.h \ - wext/MOEvent.h + wext/MOEvent.h \ + wext/MOCustomer.h SOURCES += \ wext/MOCustomerInfo.cpp \ wext/MOOrder.cpp \ wext/MOTicket.cpp \ wext/MOAddress.cpp \ - wext/MOEvent.cpp \ No newline at end of file + wext/MOEvent.cpp \ + wext/MOCustomer.cpp \ No newline at end of file diff --git a/wob/customer.wolf b/wob/customer.wolf index c8aad6c..152e3a0 100644 --- a/wob/customer.wolf +++ b/wob/customer.wolf @@ -122,6 +122,7 @@ +