#include <QBoxLayout>
#include <QComboBox>
+#include <QInputDialog>
#include <QLabel>
-// #include <QMenu>
#include <QMessageBox>
#include <QPushButton>
#include <QSettings>
vl->addSpacing(15);
vl->addWidget(p=new QPushButton(tr("Details...")),0);
connect(p,SIGNAL(clicked()),this,SLOT(orderDetails()));
- p->setEnabled(req->hasRole("getorder"));
+ p->setEnabled(req->hasRight(req->RGetOrder));
vl->addSpacing(15);
vl->addWidget(p=new QPushButton(tr("Find by Ticket...")),0);
connect(p,SIGNAL(clicked()),this,SLOT(orderByTicket()));
p->setEnabled(req->hasRight(req->RGetOrdersByCustomer));
vl->addWidget(p=new QPushButton(tr("Find by Order ID...")),0);
connect(p,SIGNAL(clicked()),this,SLOT(orderByOrder()));
- p->setEnabled(req->hasRole("getorder"));
+ p->setEnabled(req->hasRight(req->RGetOrder));
vl->addStretch(10);
}
void MOrdersTab::orderDetails()
-{/*TODO
+{
//get selected order
int id;
QModelIndexList ilst=ordertable->selectionModel()->selectedIndexes();
id=ordermodel->data(idx,Qt::UserRole).toInt();
if(id<0)return;
//open order window
- MOrderWindow *om=new MOrderWindow(this,req,MOrder(req,id));
+ MTGetOrder go=req->queryGetOrder(id);
+ if(go.hasError()){
+ QMessageBox::warning(this,tr("Warning"),tr("Error while retrieving order: %1").arg(go.errorString()));
+ return;
+ }
+ MOrderWindow *om=new MOrderWindow(this,go.getorder().value());
om->setAttribute(Qt::WA_DeleteOnClose);
- om->show();*/
+ om->show();
}
void MOrdersTab::orderByTicket()
}
void MOrdersTab::orderByOrder()
-{/*TODO
+{
//ask for OrderID
bool ok;
int oid=QInputDialog::getInteger(this,tr("Enter Order ID"),tr("Please enter the ID of the order you want to display:"),0,0,2147483647,1,&ok);
if(!ok)return;
//display
- MOrder ord(req,oid);
- if(!ord.isValid()){
+ MTGetOrder go=req->queryGetOrder(oid);
+ if(go.hasError()){
+ QMessageBox::warning(this,tr("Warning"),tr("Error while retrieving order: %1").arg(go.errorString()));
+ return;
+ }
+ if(go.getorder().isNull()){
QMessageBox::warning(this,tr("Warning"),tr("This order does not exist."));
return;
}
- MOrderWindow *ow=new MOrderWindow(this,req,ord);
- ow->show();*/
+ MOrderWindow *om=new MOrderWindow(this,go.getorder().value());
+ om->setAttribute(Qt::WA_DeleteOnClose);
+ om->show();
}