void userPreferences::sWarehouseToggled(QTreeWidgetItem *selected) { if(!selected) return; if (selected->text(0) == tr("Yes")) q.prepare( "DELETE FROM evntnot " "WHERE ( (evntnot_username=:username)" " AND (evntnot_evnttype_id=:evnttype_id)" " AND (evntnot_warehous_id=:warehous_id) );" ); else q.prepare( "INSERT INTO evntnot " "(evntnot_username, evntnot_evnttype_id, evntnot_warehous_id) " "VALUES " "(:username, :evnttype_id, :warehous_id);" ); if (_currentUser->isChecked()) q.bindValue(":username", omfgThis->username()); else q.bindValue(":username", _user->currentText()); q.bindValue(":evnttype_id", _event->id()); q.bindValue(":warehous_id", ((XTreeWidgetItem *)selected)->id()); q.exec(); if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } sFillWarehouseList(); }
void userPreferences::sAllWarehousesToggled(int pEvnttypeid) { if(!_warehouses->topLevelItemCount() > 0) return; if (_warehouses->topLevelItem(0)->text(0) == tr("Yes")) q.prepare( "DELETE FROM evntnot " "WHERE ( (evntnot_username=:username)" " AND (evntnot_evnttype_id=:evnttype_id) );" ); else q.prepare( "DELETE FROM evntnot " "WHERE ( (evntnot_username=:username)" " AND (evntnot_evnttype_id=:evnttype_id) ); " "INSERT INTO evntnot " "(evntnot_username, evntnot_evnttype_id, evntnot_warehous_id) " "SELECT :username, :evnttype_id, warehous_id " "FROM warehous;" ); if (_currentUser->isChecked()) q.bindValue(":username", omfgThis->username()); else q.bindValue(":username", _user->currentText()); q.bindValue(":evnttype_id", pEvnttypeid); q.exec(); if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); return; } sFillWarehouseList(); }
userPreferences::userPreferences(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : QDialog(parent, name, modal, fl) { setupUi(this); if(!_privleges->check("MaintainPreferencesOthers")) _selectedUser->setEnabled(false); connect(_backgroundList,SIGNAL(clicked()), this, SLOT(sBackgroundList())); connect(_close, SIGNAL(clicked()), this, SLOT(sClose())); connect(_neo, SIGNAL(toggled(bool)), this, SLOT(sStyleChanged())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_selectedUser, SIGNAL(toggled(bool)), this, SLOT(sPopulate())); connect(_user, SIGNAL(newID(int)), this, SLOT(sPopulate())); //hot key signals and slots connections connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_close, SIGNAL(clicked()), this, SLOT(sClose())); connect(_hotkey, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool))); connect(_hotkey, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool))); connect(_hotkey, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick())); _hotkey->addColumn(tr("Keystroke"), _itemColumn, Qt::AlignLeft ); _hotkey->addColumn(tr("Action"), -1, Qt::AlignLeft ); _hotkey->addColumn("key", 0, Qt::AlignLeft ); connect(_warehouses, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(sWarehouseToggled(QTreeWidgetItem*))); connect(_event, SIGNAL(itemSelected(int)), this, SLOT(sAllWarehousesToggled(int))); connect(_event, SIGNAL(itemSelectionChanged()), this, SLOT(sFillWarehouseList())); _event->addColumn(tr("Module"), 50, Qt::AlignCenter ); _event->addColumn(tr("Name"), 150, Qt::AlignLeft ); _event->addColumn(tr("Description"), -1, Qt::AlignLeft ); _event->populate( "SELECT evnttype_id, evnttype_module, evnttype_name, evnttype_descrip " "FROM evnttype " "ORDER BY evnttype_module, evnttype_name" ); _warehouses->addColumn(tr("Notify"), 50, Qt::AlignCenter ); _warehouses->addColumn(tr("Whs."), _whsColumn, Qt::AlignCenter ); _warehouses->addColumn(tr("Warehouse"), -1, Qt::AlignLeft ); _warehouses->populate( "SELECT warehous_id, TEXT('-'), warehous_code, warehous_descrip " "FROM warehous " "ORDER BY warehous_code" ); _dirty = FALSE; #ifndef Q_WS_MAC _backgroundList->setMaximumWidth(25); #endif _user->setType(XComboBox::Users); _userGroup->setEnabled(_privleges->check("MaintainUsers")); _ellipsesAction->append(1, tr("List")); _ellipsesAction->append(2, tr("Search")); sPopulate(); }
void userPreferences::sPopulate() { if (_currentUser->isChecked()) { _pref = _preferences; _username->setText(omfgThis->username()); } else { if(_altPref) delete _altPref; _altPref = new Preferences(_user->currentText()); _pref = _altPref; _username->setText(_user->currentText()); } _username->setEnabled(FALSE); _currentpassword->setEnabled(_currentUser->isChecked()); _newpassword->setEnabled(_currentUser->isChecked()); _retypepassword->setEnabled(_currentUser->isChecked()); if (_pref->value("BackgroundImageid").toInt() > 0) { _backgroundImage->setChecked(TRUE); setBackgroundImage(_pref->value("BackgroundImageid").toInt()); } else { _noBackgroundImage->setChecked(TRUE); _backgroundImageid = -1; } if (_pref->value("PreferredWarehouse").toInt() == -1) _noWarehouse->setChecked(TRUE); else { _selectedWarehouse->setChecked(TRUE); _warehouse->setId(_pref->value("PreferredWarehouse").toInt()); } if (_pref->value("InterfaceWindowOption") == "Workspace") _interfaceWorkspace->setChecked(true); else _interfaceTopLevel->setChecked(true); if (_pref->boolean("CopyListsPlainText")) _plainText->setChecked(true); else _richText->setChecked(true); //_rememberCheckBoxes->setChecked(! _pref->boolean("XCheckBox/forgetful")); _inventoryMenu->setChecked(_pref->boolean("ShowIMMenu")); _productsMenu->setChecked(_pref->boolean("ShowPDMenu")); _scheduleMenu->setChecked(_pref->boolean("ShowMSMenu")); _manufactureMenu->setChecked(_pref->boolean("ShowWOMenu")); _crmMenu2->setChecked(_pref->boolean("ShowCRMMenu")); _purchaseMenu->setChecked(_pref->boolean("ShowPOMenu")); _salesMenu->setChecked(_pref->boolean("ShowSOMenu")); _accountingMenu->setChecked(_pref->boolean("ShowGLMenu")); _inventoryToolbar->setChecked(_pref->boolean("ShowIMToolbar")); _productsToolbar->setChecked(_pref->boolean("ShowPDToolbar")); _scheduleToolbar->setChecked(_pref->boolean("ShowMSToolbar")); _manufactureToolbar->setChecked(_pref->boolean("ShowWOToolbar")); _crmToolbar2->setChecked(_pref->boolean("ShowCRMToolbar")); _purchaseToolbar->setChecked(_pref->boolean("ShowPOToolbar")); _salesToolbar->setChecked(_pref->boolean("ShowSOToolbar")); _accountingToolbar->setChecked(_pref->boolean("ShowGLToolbar")); _listNumericItemsFirst->setChecked(_pref->boolean("ListNumericItemNumbersFirst")); _ignoreTranslation->setChecked(_pref->boolean("IngoreMissingTranslationFiles")); _idleTimeout->setValue(_pref->value("IdleTimeout").toInt()); _emailEvents->setChecked(_pref->boolean("EmailEvents")); _alarmEvent->setChecked(_pref->boolean("AlarmEventDefault")); _alarmEmail->setChecked(_pref->boolean("AlarmEmailDefault")); _alarmSysmsg->setChecked(_pref->boolean("AlarmSysmsgDefault")); if(_pref->value("DefaultEllipsesAction") == "search") _ellipsesAction->setId(2); else _ellipsesAction->setId(1); //Hide for PostBooks if (_metrics->value("Application") == "PostBooks") { _scheduleMenu->hide(); _scheduleToolbar->hide(); } if (!_metrics->boolean("MultiWhs")) _warehouseGroup->hide(); _debug->setChecked(_pref->boolean("EnableScriptDebug")); sFillList(); sFillWarehouseList(); }
void userPreferences::sPopulate() { if (_currentUser->isChecked()) _pref = Preferences(omfgThis->username()); else _pref = Preferences(_user->currentText()); if (_pref.value("BackgroundImageid").toInt() > 0) { _backgroundImage->setChecked(TRUE); setBackgroundImage(_pref.value("BackgroundImageid").toInt()); } else { _noBackgroundImage->setChecked(TRUE); _backgroundImageid = -1; } if (_pref.value("PreferredWarehouse").toInt() == -1) _noWarehouse->setChecked(TRUE); else { _selectedWarehouse->setChecked(TRUE); _warehouse->setId(_pref.value("PreferredWarehouse").toInt()); } if (_pref.value("InterfaceWindowOption") == "TopLevel") _interfaceTopLevel->setChecked(true); else _interfaceWorkspace->setChecked(true); _rememberCheckBoxes->setChecked(! _pref.boolean("XCheckBox/forgetful")); _itemCache->setChecked(_pref.boolean("UseItemCache")); _customerCache->setChecked(_pref.boolean("UseCustCache")); _standard->setChecked(_pref.boolean("UseOldMenu")); sStyleChanged(); //New Menus _inventoryMenu->setChecked(_pref.boolean("ShowIMMenu")); _productsMenu->setChecked(_pref.boolean("ShowPDMenu")); _scheduleMenu->setChecked(_pref.boolean("ShowMSMenu")); _manufactureMenu->setChecked(_pref.boolean("ShowWOMenu")); _crmMenu2->setChecked(_pref.boolean("ShowCRMMenu")); _purchaseMenu->setChecked(_pref.boolean("ShowPOMenu")); _salesMenu->setChecked(_pref.boolean("ShowSOMenu")); _accountingMenu->setChecked(_pref.boolean("ShowGLMenu")); _inventoryToolbar->setChecked(_pref.boolean("ShowIMToolbar")); _productsToolbar->setChecked(_pref.boolean("ShowPDToolbar")); _scheduleToolbar->setChecked(_pref.boolean("ShowMSToolbar")); _manufactureToolbar->setChecked(_pref.boolean("ShowWOToolbar")); _crmToolbar2->setChecked(_pref.boolean("ShowCRMToolbar")); _purchaseToolbar->setChecked(_pref.boolean("ShowPOToolbar")); _salesToolbar->setChecked(_pref.boolean("ShowSOToolbar")); _accountingToolbar->setChecked(_pref.boolean("ShowGLToolbar")); //Old Menus _imMenu->setChecked(_pref.boolean("ShowIMMenu")); _pdMenu->setChecked(_pref.boolean("ShowPDMenu")); _msMenu->setChecked(_pref.boolean("ShowMSMenu")); _cpMenu->setChecked(_pref.boolean("ShowCPMenu")); _woMenu->setChecked(_pref.boolean("ShowWOMenu")); _crmMenu->setChecked(_pref.boolean("ShowCRMMenu")); _poMenu->setChecked(_pref.boolean("ShowPOMenu")); _soMenu->setChecked(_pref.boolean("ShowSOMenu")); _srMenu->setChecked(_pref.boolean("ShowSRMenu")); _saMenu->setChecked(_pref.boolean("ShowSAMenu")); _pmMenu->setChecked(_pref.boolean("ShowPMMenu")); _arMenu->setChecked(_pref.boolean("ShowARMenu")); _apMenu->setChecked(_pref.boolean("ShowAPMenu")); _glMenu->setChecked(_pref.boolean("ShowGLMenu")); _imToolbar->setChecked(_pref.boolean("ShowIMToolbar")); _pdToolbar->setChecked(_pref.boolean("ShowPDToolbar")); _msToolbar->setChecked(_pref.boolean("ShowMSToolbar")); _cpToolbar->setChecked(_pref.boolean("ShowCPToolbar")); _woToolbar->setChecked(_pref.boolean("ShowWOToolbar")); _crmToolbar->setChecked(_pref.boolean("ShowCRMToolbar")); _poToolbar->setChecked(_pref.boolean("ShowPOToolbar")); _soToolbar->setChecked(_pref.boolean("ShowSOToolbar")); _srToolbar->setChecked(_pref.boolean("ShowSRToolbar")); _saToolbar->setChecked(_pref.boolean("ShowSAToolbar")); _pmToolbar->setChecked(_pref.boolean("ShowPMToolbar")); _arToolbar->setChecked(_pref.boolean("ShowARToolbar")); _apToolbar->setChecked(_pref.boolean("ShowAPToolbar")); _glToolbar->setChecked(_pref.boolean("ShowGLToolbar")); _fixedWidthFonts->setChecked(_pref.boolean("UsedFixedWidthFonts")); _listNumericItemsFirst->setChecked(_pref.boolean("ListNumericItemNumbersFirst")); _showSoitemAvailability->setChecked(_pref.boolean("ShowSOItemAvailability")); _idleTimeout->setValue(_pref.value("IdleTimeout").toInt()); if(_pref.value("DefaultEllipsesAction") == "search") _ellipsesAction->setId(2); else _ellipsesAction->setId(1); //Hide for PostBooks if (_metrics->value("Application") != "OpenMFG") { _scheduleMenu->hide(); _scheduleToolbar->hide(); _msMenu->hide(); _msToolbar->hide(); _cpMenu->hide(); _cpToolbar->hide(); } if (!_metrics->boolean("MultiWhs")) _warehouseGroup->hide(); sFillList(); sFillWarehouseList(); }
userPreferences::userPreferences(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); _pref = _preferences; _altPref = 0; if(!_privileges->check("MaintainPreferencesOthers")) _selectedUser->setEnabled(false); QPushButton* apply = _buttonBox->button(QDialogButtonBox::Apply); connect(apply, SIGNAL(clicked()), this, SLOT(sApply())); connect(_buttonBox, SIGNAL(rejected()), this, SLOT(sClose())); connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave())); connect(_backgroundList,SIGNAL(clicked()), this, SLOT(sBackgroundList())); connect(_selectedUser, SIGNAL(toggled(bool)), this, SLOT(sPopulate())); connect(_user, SIGNAL(newID(int)), this, SLOT(sPopulate())); //hot key signals and slots connections connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_hotkey, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool))); connect(_hotkey, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool))); connect(_hotkey, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick())); _hotkey->addColumn(tr("Keystroke"), _itemColumn, Qt::AlignLeft ); _hotkey->addColumn(tr("Action"), -1, Qt::AlignLeft ); _hotkey->addColumn("key", 0, Qt::AlignLeft ); connect(_warehouses, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(sWarehouseToggled(QTreeWidgetItem*))); connect(_event, SIGNAL(itemSelected(int)), this, SLOT(sAllWarehousesToggled(int))); connect(_event, SIGNAL(itemSelectionChanged()), this, SLOT(sFillWarehouseList())); connect(_translations, SIGNAL(clicked()), this, SLOT(sTranslations())); connect(_dictionaries, SIGNAL(clicked()), this, SLOT(sDictionaries())); _event->addColumn(tr("Module"), 50, Qt::AlignCenter, true, "evnttype_module" ); _event->addColumn(tr("Name"), 150, Qt::AlignLeft, true, "evnttype_name" ); _event->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "evnttype_descrip" ); _event->populate( "SELECT evnttype_id, evnttype_module, evnttype_name, evnttype_descrip " "FROM evnttype " "ORDER BY evnttype_module, evnttype_name" ); _warehouses->addColumn(tr("Notify"), 50, Qt::AlignCenter, true, "notify" ); _warehouses->addColumn(tr("Site"), _whsColumn, Qt::AlignCenter, true, "warehous_code" ); _warehouses->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "warehous_descrip" ); _warehouses->populate( "SELECT warehous_id, TEXT('-') AS notify, warehous_code, warehous_descrip " "FROM whsinfo " "ORDER BY warehous_code" ); _dirty = FALSE; #ifndef Q_WS_MAC _backgroundList->setMaximumWidth(25); #endif _user->setType(XComboBox::Users); _ellipsesAction->append(1, tr("List")); _ellipsesAction->append(2, tr("Search")); if (!_metrics->boolean("EnableBatchManager")) { _alarmEmail->setVisible(false); _emailEvents->setVisible(false); } _translations->setEnabled(_privileges->check("MaintainTranslations")); _dictionaries->setEnabled(_privileges->check("MaintainDictionaries")); sPopulate(); adjustSize(); }