#include <QTextEdit>
#include <QLabel>
-MCustomer::MCustomer()
+MCustomer::MCustomer(MWebRequest*r)
{
- m_req=0;
+ m_req=r;
m_id=-1;
m_iscomplete=false;
}
void MCustomer::getUpdate()
{
if(m_id<0)return;
+ if(m_req==0){
+ qDebug("Warning: trying to call MCustomer::getUpdate without MWebRequest!");
+ return;
+ }
if(!m_req->request("getcustomer",QString::number(m_id).toAscii()))return;
QDomDocument doc;
if(!doc.setContent(m_req->responseBody()))return;
void MCustomer::save()
{
+ if(m_req==0){
+ qDebug("Warning: trying to call MCustomer::save without MWebRequest!");
+ return;
+ }
//create XML
QDomDocument doc;
QDomElement cse=doc.createElement("Customer");
void MCustomerListDialog::newCustomer()
{
- MCustomerDialog cd(MCustomer(),this);
+ MCustomerDialog cd(MCustomer(m_req),this);
if(cd.exec()==QDialog::Accepted)
updateList();
}
{
public:
/**creates an empty/invalid customer*/
- MCustomer();
+ MCustomer(MWebRequest*r=0);
/**creates a customer from XML*/
MCustomer(MWebRequest*,const QDomElement&);
/**copies a customer*/