00001 /**************************************************************************** 00002 ** ui.h extension file, included from the uic-generated form implementation. 00003 ** 00004 ** If you wish to add, delete or rename functions or slots use 00005 ** Qt Designer which will update this file, preserving your code. Create an 00006 ** init() function in place of a constructor, and a destroy() function in 00007 ** place of a destructor. 00008 *****************************************************************************/ 00009 00010 static QMap< QString, int > widStack ; 00011 00012 void LabKiosk::init() 00013 { 00014 int i = moduleStack->addWidget( (QWidget *)( new LabWelcome( moduleStack, "Welcome" ) ), -1 ) ; 00015 moduleStack->raiseWidget( i ) ; 00016 widStack["Welcome"] = i ; 00017 } 00018 void LabKiosk::KioskExit() 00019 { 00020 QWidget * currWid = moduleStack->visibleWidget() ; 00021 moduleStack->raiseWidget( widStack["Welcome"] ) ; 00022 if ( QMessageBox::question( this, tr( "Leave LAB Kiosk" ), 00023 tr( "Are you really sure you want to quit\n" 00024 "L.A.B. Kiosk Program ?" ), 00025 tr( "No" ), tr( "Yes" ), 0, 0, 0 ) == 1 ) { 00026 QApplication::exit( 0 ) ; 00027 } else { 00028 moduleStack->raiseWidget( currWid ) ; 00029 } 00030 } 00031 00032 00033 void LabKiosk::EvalAction() 00034 { 00035 QString want = QObject::sender()->name() ; 00036 QString swant = "" ; 00037 if ( want.contains( "contact" ) ) { 00038 swant = "contactMgr" ; 00039 want = want.replace( "contact", "" ) ; 00040 QlabContactManager * wid = 0 ; 00041 QMap<QString, QlabContactManager::ContactType> cmap ; 00042 cmap["Customer"] = QlabContactManager::Customer ; 00043 cmap["Vendor"] = QlabContactManager::Vendor ; 00044 cmap["Prospect"] = QlabContactManager::Prospect ; 00045 cmap["User"] = QlabContactManager::User; 00046 cmap["People"] = QlabContactManager::People ; 00047 00048 if ( widStack.find( swant ) != widStack.end() ) { 00049 wid = (QlabContactManager *)moduleStack->widget( widStack[swant] ) ; 00050 } else { 00051 wid = new QlabContactManager( moduleStack, "ContactMgr" ) ; 00052 int id = moduleStack->addWidget( (QWidget *)wid, -1 ) ; 00053 widStack.replace( swant, id ) ; 00054 wid->setDefaultFilter( QString( "contact_xtype='%1'" ) 00055 .arg( want ) ) ; 00056 } 00057 wid->setContactType( cmap[want] ) ; 00058 } else if ( want.contains( "prod" ) ) { 00059 if ( want == "prodMgr" ) { 00060 swant = "ProductManager" ; 00061 QlabProductManager * wid = 0 ; 00062 if ( widStack.find( "ProductManager" ) != widStack.end() ) { 00063 wid = (QlabProductManager *)moduleStack->widget( widStack["ProductManager"] ) ; 00064 } else { 00065 wid = new QlabProductManager( moduleStack, "ProductManager" ) ; 00066 int id = moduleStack->addWidget( (QWidget *)wid, -1 ) ; 00067 widStack.replace( "ProductManager", id ) ; 00068 00069 } 00070 } 00071 } else if ( want.contains( "cashbox" ) ) { 00072 if ( want == "cashboxDaily" ) { 00073 swant = "CashboxDaily" ; 00074 qDebug( swant ) ; 00075 QlabCashDailyReport * wid = 0 ; 00076 if ( widStack.find( swant ) != widStack.end() ) { 00077 wid = (QlabCashDailyReport *)moduleStack->widget( widStack[swant] ) ; 00078 wid->setDate( QDate::currentDate() ) ; 00079 } else { 00080 wid = new QlabCashDailyReport( moduleStack, "CashboxDaily" ) ; 00081 int id = moduleStack->addWidget( (QWidget *)wid, -1 ) ; 00082 wid->setDate( QDate::currentDate() ) ; 00083 widStack.replace( swant, id ) ; 00084 } 00085 } 00086 } 00087 00088 moduleStack->raiseWidget( widStack[swant] ) ; 00089 }