void lemon::disableUi() { m_view->setDisabled(true); QAction *action = actionCollection()->action("enterCode"); action->setDisabled(true); if (m_view->canStartSelling()) { action = actionCollection()->action("startOperation"); action->setDisabled(true); } action = actionCollection()->action("searchItem"); action->setDisabled(true); action = actionCollection()->action("deleteSelectedItem"); action->setDisabled(true); action = actionCollection()->action("finishTransaction"); action->setDisabled(true); action = actionCollection()->action("cancelTransaction"); action->setDisabled(true); action = actionCollection()->action("balance"); action->setDisabled(true); action = actionCollection()->action("payFocus"); action->setDisabled(true); action = actionCollection()->action("cancelTicket"); action->setDisabled(true); action = actionCollection()->action("showProductsGrid"); action->setDisabled(true); action = actionCollection()->action("cashIn"); action->setDisabled(true); action = actionCollection()->action("cashOut"); action->setDisabled(true); action = actionCollection()->action("cashAvailable"); action->setDisabled(true); action = actionCollection()->action("reprintTicket"); action->setDisabled(true); action = actionCollection()->action("showPriceChecker"); action->setDisabled(true); action = actionCollection()->action("endOfDay"); action->setDisabled(true); action = actionCollection()->action("login"); action->setEnabled(true); //enable login! disableConfig(); }
//For a frameless window: KMainWindow(0, Qt::FramelessWindowHint) lemon::lemon() : KXmlGuiWindow(0,Qt::FramelessWindowHint), m_view(new lemonView(this)) { setObjectName(QLatin1String("lemon")); setAcceptDrops(false); // tell the KMainWindow that this is indeed the main widget setCentralWidget(m_view); // then, setup our actions setupActions(); // Add typical actions and save size/toolbars/statusbar statusBar()->show(); //add some info labels to status bar labelUserInfo = new QLabel("::user::"); labelDate = new QLabel(" ::Date:: "); labelTime = new QLabel(" ::Time:: "); labelTransaction = new QLabel(""); QLabel *imageUser = new QLabel("user"); QLabel *imageDate = new QLabel("date"); QLabel *imageTime = new QLabel("time"); QLabel *imageTransaction = new QLabel("trans"); imageUser->setPixmap(DesktopIcon("user-identity", 16)); imageDate->setPixmap(DesktopIcon("view-pim-calendar", 16)); imageTime->setPixmap(DesktopIcon("chronometer", 16)); imageTransaction->setPixmap(DesktopIcon("wallet-open", 16)); updateDate(); statusBar()->addWidget(imageUser); statusBar()->addWidget(labelUserInfo); statusBar()->addWidget(imageDate); statusBar()->addWidget(labelDate); statusBar()->addWidget(imageTime); statusBar()->addWidget(labelTime); statusBar()->addWidget(imageTransaction); statusBar()->addWidget(labelTransaction); connect(m_view, SIGNAL(signalLoggedUser()), SLOT(updateUserName()) ); connect(m_view, SIGNAL(signalNoLoggedUser()), SLOT(updateUserName()) ); connect(m_view, SIGNAL(signalUpdateClock() ), SLOT(updateClock()) ); QTimer::singleShot(500, this, SLOT(hideMenuBar())); // apply the saved mainwindow settings, if any, and ask the mainwindow // to automatically save settings if changed: window size, toolbar // position, icon size, etc. setAutoSaveSettings(); connect(m_view,SIGNAL(signalChangeStatusbar(const QString&)),this,SLOT(changeStatusbar(const QString&))); connect(m_view,SIGNAL(signalChangeCaption(const QString&)),this, SLOT(changeCaption(const QString&))); connect(m_view, SIGNAL(signalAdminLoggedOn()), this, SLOT(enableConfig())); connect(m_view, SIGNAL(signalAdminLoggedOff()), this, SLOT(disableConfig())); connect(m_view, SIGNAL(signalSupervisorLoggedOn()), this, SLOT(enableConfig())); //new connect(m_view, SIGNAL(signalSupervisorLoggedOff()), this, SLOT(disableConfig())); //new connect(m_view, SIGNAL(signalNoLoggedUser()), this, SLOT(disableUi())); connect(m_view, SIGNAL(signalLoggedUser()), this, SLOT(reactOnLogOn())); connect(m_view, SIGNAL(signalStartedOperation()), this, SLOT(reactOnStartedOp()) ); connect(m_view, SIGNAL(signalUpdateTransactionInfo()), this, SLOT(updateTransaction())); connect(m_view, SIGNAL(signalShowProdGrid()), this, SLOT(triggerGridAction())); connect(m_view, SIGNAL(signalShowDbConfig()), this, SLOT(showDBConfigDialog())); connect(m_view, SIGNAL(signalEnableUI()), this, SLOT(enableUi()) ); connect(m_view, SIGNAL(signalDisableUI()), this, SLOT(disableUi()) ); connect(m_view, SIGNAL(signalEnableStartOperationAction()), this, SLOT(enableStartOp()) ); loadStyle(); disableConfig(); disableUi(); }
void lemon::disableUi() { m_view->frame->setDisabled(true); m_view->frameLeft->setDisabled(true); QAction *action = actionCollection()->action("enterCode"); action->setDisabled(true); if (m_view->canStartSelling()) { action = actionCollection()->action("startOperation"); action->setDisabled(true); } action = actionCollection()->action("searchItem"); action->setDisabled(true); action = actionCollection()->action("deleteSelectedItem"); action->setDisabled(true); action = actionCollection()->action("finishTransaction"); action->setDisabled(true); action = actionCollection()->action("cancelTransaction"); action->setDisabled(true); action = actionCollection()->action("balance"); action->setDisabled(true); action = actionCollection()->action("payFocus"); action->setDisabled(true); action = actionCollection()->action("cancelTicket"); action->setDisabled(true); action = actionCollection()->action("showProductsGrid"); action->setDisabled(true); action = actionCollection()->action("cashIn"); action->setDisabled(true); action = actionCollection()->action("cashOut"); action->setDisabled(true); action = actionCollection()->action("cashAvailable"); action->setDisabled(true); action = actionCollection()->action("reprintTicket"); action->setDisabled(true); action = actionCollection()->action("showPriceChecker"); action->setDisabled(true); action = actionCollection()->action("endOfDay"); action->setDisabled(true); action = actionCollection()->action("specialOrder"); action->setDisabled(true); action = actionCollection()->action("specialOrderComplete"); action->setDisabled(true); action = actionCollection()->action("occasionalDiscount"); action->setDisabled(true); action = actionCollection()->action("suspendSale"); action->setDisabled(true); action = actionCollection()->action("resumeSale"); action->setDisabled(true); action = actionCollection()->action("makeReservation"); action->setDisabled(true); action = actionCollection()->action("resumeReservation"); action->setDisabled(true); action = actionCollection()->action("showCredits"); action->setDisabled(true); action = actionCollection()->action("login"); action->setEnabled(true); //enable login! disableConfig(); }