void incident::sPopulateTodoMenu(QMenu *pMenu) { QAction *menuItem; bool newPriv = (cNew == _mode || cEdit == _mode) && (_privileges->check("MaintainPersonalToDoItems") || _privileges->check("MaintainAllToDoItems") ); bool editPriv = (cNew == _mode || cEdit == _mode) && ( (omfgThis->username() == _todoList->currentItem()->rawValue("todoitem_username") && _privileges->check("MaintainPersonalToDoItems")) || (omfgThis->username() == _todoList->currentItem()->rawValue("todoitem_owner_username") && _privileges->check("MaintainPersonalToDoItems")) || (_privileges->check("MaintainAllToDoItems")) ); bool viewPriv = (omfgThis->username() == _todoList->currentItem()->rawValue("todoitem_username") && _privileges->check("ViewPersonalToDoItems")) || (omfgThis->username() == _todoList->currentItem()->rawValue("todoitem_owner_username") && _privileges->check("ViewPersonalToDoItems")) || (omfgThis->username() == _todoList->currentItem()->rawValue("todoitem_username") && _privileges->check("MaintainPersonalToDoItems")) || (omfgThis->username() == _todoList->currentItem()->rawValue("todoitem_owner_username") && _privileges->check("MaintainPersonalToDoItems")) || (_privileges->check("ViewAllToDoItems")) || (_privileges->check("MaintainAllToDoItems")); menuItem = pMenu->addAction(tr("New..."), this, SLOT(sNewTodoItem())); menuItem->setEnabled(newPriv); menuItem = pMenu->addAction(tr("Edit..."), this, SLOT(sEditTodoItem())); menuItem->setEnabled(editPriv); menuItem = pMenu->addAction(tr("View..."), this, SLOT(sViewTodoItem())); menuItem->setEnabled(viewPriv); menuItem = pMenu->addAction(tr("Delete"), this, SLOT(sDeleteTodoItem())); menuItem->setEnabled(editPriv); }
void dspIncidentsByCRMAccount::sPopulateMenu(QMenu *pMenu) { int menuItem; if (_list->altId() == 1) { menuItem = pMenu->insertItem(tr("Edit CRM Account..."), this, SLOT(sEditCRMAccount()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("MaintainCRMAccounts")); menuItem = pMenu->insertItem(tr("View CRM Account..."), this, SLOT(sViewCRMAccount()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("ViewCRMAccounts") || _privileges->check("MaintainCRMAccounts")); } else if (_list->altId() == 2) { menuItem = pMenu->insertItem(tr("Edit Incident..."), this, SLOT(sEditIncident()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("MaintainIncidents")); menuItem = pMenu->insertItem(tr("View Incident..."), this, SLOT(sViewIncident()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("ViewIncidents") || _privileges->check("MaintainIncidents")); } else if (_list->altId() == 3) { menuItem = pMenu->insertItem(tr("Edit To-Do Item..."), this, SLOT(sEditTodoItem()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("MaintainOtherTodoLists")); menuItem = pMenu->insertItem(tr("View To-Do Item..."), this, SLOT(sViewTodoItem()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("ViewOtherTodoLists")); } }
void incident::sPopulateTodoMenu(QMenu *pMenu) { int menuItem; bool newPriv = (cNew == _mode || cEdit == _mode) && (_privileges->check("MaintainPersonalTodoList") || _privileges->check("MaintainOtherTodoLists") ); bool editPriv = (cNew == _mode || cEdit == _mode) && ( (_myUsrId == _todoList->altId() && _privileges->check("MaintainPersonalTodoList")) || (_myUsrId != _todoList->altId() && _privileges->check("MaintainOtherTodoLists")) ); bool viewPriv = (_myUsrId == _todoList->altId() && _privileges->check("ViewPersonalTodoList")) || (_myUsrId != _todoList->altId() && _privileges->check("ViewOtherTodoLists")); menuItem = pMenu->insertItem(tr("New..."), this, SLOT(sNewTodoItem()), 0); pMenu->setItemEnabled(menuItem, newPriv); menuItem = pMenu->insertItem(tr("Edit..."), this, SLOT(sEditTodoItem()), 0); pMenu->setItemEnabled(menuItem, editPriv); menuItem = pMenu->insertItem(tr("View..."), this, SLOT(sViewTodoItem()), 0); pMenu->setItemEnabled(menuItem, viewPriv); menuItem = pMenu->insertItem(tr("Delete"), this, SLOT(sDeleteTodoItem()), 0); pMenu->setItemEnabled(menuItem, editPriv); }
void dspIncidentsByCRMAccount::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem*, int) { QAction *menuItem; if (list()->altId() == 1) { menuItem = pMenu->addAction(tr("Edit CRM Account..."), this, SLOT(sEditCRMAccount())); menuItem->setEnabled(_privileges->check("MaintainCRMAccounts")); menuItem = pMenu->addAction(tr("View CRM Account..."), this, SLOT(sViewCRMAccount())); menuItem->setEnabled( _privileges->check("ViewCRMAccounts") || _privileges->check("MaintainCRMAccounts")); } else if (list()->altId() == 2) { menuItem = pMenu->addAction(tr("Edit Incident..."), this, SLOT(sEditIncident())); menuItem->setEnabled(_privileges->check("MaintainIncidents")); menuItem = pMenu->addAction(tr("View Incident..."), this, SLOT(sViewIncident())); menuItem->setEnabled( _privileges->check("ViewIncidents") || _privileges->check("MaintainIncidents")); } else if (list()->altId() == 3) { menuItem = pMenu->addAction(tr("Edit To-Do Item..."), this, SLOT(sEditTodoItem())); menuItem->setEnabled(_privileges->check("MaintainOtherTodoLists")); menuItem = pMenu->addAction(tr("View To-Do Item..."), this, SLOT(sViewTodoItem())); menuItem->setEnabled(_privileges->check("ViewOtherTodoLists")); } }
void incident::sPopulateTodoMenu(QMenu *pMenu) { int menuItem; bool newPriv = (cNew == _mode || cEdit == _mode) && (_privileges->check("MaintainPersonalTodoList") || _privileges->check("MaintainOtherTodoLists") ); bool editPriv = (cNew == _mode || cEdit == _mode) && ( (omfgThis->username() == _todoList->currentItem()->text("todoitem_username") && _privileges->check("MaintainPersonalTodoList")) || (omfgThis->username() != _todoList->currentItem()->text("todoitem_username") && _privileges->check("MaintainOtherTodoLists")) ); bool viewPriv = (omfgThis->username() == _todoList->currentItem()->text("todoitem_username") && _privileges->check("ViewPersonalTodoList")) || (omfgThis->username() != _todoList->currentItem()->text("todoitem_username") && _privileges->check("ViewOtherTodoLists")); menuItem = pMenu->insertItem(tr("New..."), this, SLOT(sNewTodoItem()), 0); pMenu->setItemEnabled(menuItem, newPriv); menuItem = pMenu->insertItem(tr("Edit..."), this, SLOT(sEditTodoItem()), 0); pMenu->setItemEnabled(menuItem, editPriv); menuItem = pMenu->insertItem(tr("View..."), this, SLOT(sViewTodoItem()), 0); pMenu->setItemEnabled(menuItem, viewPriv); menuItem = pMenu->insertItem(tr("Delete"), this, SLOT(sDeleteTodoItem()), 0); pMenu->setItemEnabled(menuItem, editPriv); }
incident::incident(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { _statusCodes << "N" << "F" << "C" << "A" << "R" << "L"; setupUi(this); _incdtid = -1; _saved = false; _aropenid = -1; if(!_privileges->check("EditOwner")) _owner->setEnabled(false); connect(_assignedTo, SIGNAL(newId(int)), this, SLOT(sAssigned())); connect(_cancel, SIGNAL(clicked()), this, SLOT(sCancel())); connect(_cntct, SIGNAL(changed()), this, SLOT(sContactChanged())); connect(_crmacct, SIGNAL(newId(int)), this, SLOT(sCRMAcctChanged(int))); connect(_deleteTodoItem, SIGNAL(clicked()), this, SLOT(sDeleteTodoItem())); connect(_editTodoItem, SIGNAL(clicked()), this, SLOT(sEditTodoItem())); connect(_item, SIGNAL(newId(int)), _lotserial, SLOT(setItemId(int))); connect(_newTodoItem, SIGNAL(clicked()), this, SLOT(sNewTodoItem())); //connect(_return, SIGNAL(clicked()), this, SLOT(sReturn())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_todoList, SIGNAL(itemSelected(int)), _editTodoItem, SLOT(animateClick())); connect(_todoList, SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)), this, SLOT(sPopulateTodoMenu(QMenu*))); connect(_todoList, SIGNAL(valid(bool)), this, SLOT(sHandleTodoPrivs())); connect(_viewAR, SIGNAL(clicked()), this, SLOT(sViewAR())); connect(_viewTodoItem, SIGNAL(clicked()), this, SLOT(sViewTodoItem())); _severity->setType(XComboBox::IncidentSeverity); _priority->setType(XComboBox::IncidentPriority); _resolution->setType(XComboBox::IncidentResolution); _category->setType(XComboBox::IncidentCategory); _lotserial->setStrict(false); _incdthist->addColumn(tr("Username"), _userColumn, Qt::AlignLeft, true, "incdthist_username"); _incdthist->addColumn(tr("Date/Time"),_timeDateColumn, Qt::AlignLeft, true, "incdthist_timestamp"); _incdthist->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "incdthist_descrip"); _todoList->addColumn(tr("Priority"), _userColumn, Qt::AlignRight, true, "incdtpriority_name"); _todoList->addColumn(tr("User"), _userColumn, Qt::AlignLeft, true, "todoitem_username"); _todoList->addColumn(tr("Name"), 100, Qt::AlignLeft, true, "todoitem_name"); _todoList->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "todoitem_description"); _todoList->addColumn(tr("Status"), _statusColumn, Qt::AlignLeft, true, "todoitem_status"); _todoList->addColumn(tr("Due Date"), _dateColumn, Qt::AlignLeft, true, "todoitem_due_date"); _owner->setUsername(omfgThis->username()); _owner->setType(UsernameLineEdit::UsersActive); _assignedTo->setType(UsernameLineEdit::UsersActive); if (_metrics->boolean("LotSerialControl")) { connect(_item, SIGNAL(valid(bool)), _lotserial, SLOT(setEnabled(bool))); connect(_item, SIGNAL(newId(int)), _lotserial, SLOT(setItemId(int))); } else _lotserial->setVisible(false); // because this causes a pop-behind situation we are hiding for now. //_return->hide(); }
/* * Constructs a opportunity as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * */ opportunity::opportunity(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); if(!_privileges->check("EditOwner")) _owner->setEnabled(false); // signals and slots connections connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_deleteTodoItem, SIGNAL(clicked()), this, SLOT(sDeleteTodoItem())); connect(_editTodoItem, SIGNAL(clicked()), this, SLOT(sEditTodoItem())); connect(_newTodoItem, SIGNAL(clicked()), this, SLOT(sNewTodoItem())); connect(_todoList, SIGNAL(itemSelected(int)), _editTodoItem, SLOT(animateClick())); connect(_todoList, SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)), this, SLOT(sPopulateTodoMenu(QMenu*))); connect(_todoList, SIGNAL(valid(bool)), this, SLOT(sHandleTodoPrivs())); connect(_viewTodoItem, SIGNAL(clicked()), this, SLOT(sViewTodoItem())); connect(_charass, SIGNAL(itemSelected(int)), _editCharacteristic, SLOT(animateClick())); connect(_newCharacteristic, SIGNAL(clicked()), this, SLOT(sNewCharacteristic())); connect(_editCharacteristic, SIGNAL(clicked()), this, SLOT(sEditCharacteristic())); connect(_deleteCharacteristic, SIGNAL(clicked()), this, SLOT(sDeleteCharacteristic())); _probability->setValidator(0); _opheadid = -1; _todoList->addColumn(tr("Priority"), _userColumn, Qt::AlignRight, true, "incdtpriority_name"); _todoList->addColumn(tr("User"), _userColumn, Qt::AlignLeft, true, "usr_username" ); _todoList->addColumn(tr("Name"), 100, Qt::AlignLeft, true, "todoitem_name" ); _todoList->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "todoitem_description" ); _todoList->addColumn(tr("Status"), _statusColumn, Qt::AlignLeft, true, "todoitem_status" ); _todoList->addColumn(tr("Due Date"), _dateColumn, Qt::AlignLeft, true, "todoitem_due_date" ); _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft, true, "char_name" ); _charass->addColumn(tr("Value"), -1, Qt::AlignLeft, true, "charass_value" ); _charass->addColumn(tr("Default"), _ynColumn, Qt::AlignCenter,true, "charass_default" ); q.prepare("SELECT usr_id " "FROM usr " "WHERE (usr_username=CURRENT_USER);"); q.exec(); if (q.first()) { _myUsrId = q.value("usr_id").toInt(); _owner->setId(_myUsrId); } else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); close(); } _saved = false; }
void dspTodoByUserAndIncident::sPopulateMenu(QMenu *pMenu) { int menuItem; menuItem = pMenu->insertItem(tr("Edit..."), this, SLOT(sEditTodoItem()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("MaintainOtherTodoLists")); menuItem = pMenu->insertItem(tr("View..."), this, SLOT(sViewTodoItem()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("ViewOtherTodoLists")); if (_todoitem->altId() > 0) { pMenu->insertSeparator(); menuItem = pMenu->insertItem(tr("Edit Incident"), this, SLOT(sEditIncident()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("MaintainIncidents")); menuItem = pMenu->insertItem(tr("View Incident"), this, SLOT(sViewIncident()), 0); pMenu->setItemEnabled(menuItem, _privileges->check("ViewIncidents") || _privileges->check("MaintainIncidents")); } }
void dspTodoByUserAndIncident::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem*, int) { QAction *menuItem; menuItem = pMenu->addAction(tr("Edit..."), this, SLOT(sEditTodoItem())); menuItem->setEnabled(_privileges->check("MaintainOtherTodoLists")); menuItem = pMenu->addAction(tr("View..."), this, SLOT(sViewTodoItem())); menuItem->setEnabled(_privileges->check("ViewOtherTodoLists")); if (list()->altId() > 0) { pMenu->addSeparator(); menuItem = pMenu->addAction(tr("Edit Incident"), this, SLOT(sEditIncident())); menuItem->setEnabled(_privileges->check("MaintainIncidents")); menuItem = pMenu->addAction(tr("View Incident"), this, SLOT(sViewIncident())); menuItem->setEnabled(_privileges->check("ViewIncidents") || _privileges->check("MaintainIncidents")); } }
/* * Constructs a incident as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * */ incident::incident(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { _statusCodes << "N" << "F" << "C" << "A" << "R" << "L"; setupUi(this); // signals and slots connections connect(_cancel, SIGNAL(clicked()), this, SLOT(sCancel())); connect(_crmacct, SIGNAL(newId(int)), this, SLOT(sCRMAcctChanged(int))); connect(_deleteTodoItem, SIGNAL(clicked()), this, SLOT(sDeleteTodoItem())); connect(_editTodoItem, SIGNAL(clicked()), this, SLOT(sEditTodoItem())); connect(_item, SIGNAL(newId(int)), _lotserial, SLOT(setItemId(int))); connect(_newTodoItem, SIGNAL(clicked()), this, SLOT(sNewTodoItem())); connect(_save, SIGNAL(clicked()), this, SLOT(sSave())); connect(_todoList, SIGNAL(itemSelected(int)), _editTodoItem, SLOT(animateClick())); connect(_todoList, SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)), this, SLOT(sPopulateTodoMenu(QMenu*))); connect(_todoList, SIGNAL(valid(bool)), this, SLOT(sHandleTodoPrivs())); connect(_viewTodoItem, SIGNAL(clicked()), this, SLOT(sViewTodoItem())); connect(_return, SIGNAL(clicked()), this, SLOT(sReturn())); _incdtid = -1; _severity->setType(XComboBox::IncidentSeverity); _priority->setType(XComboBox::IncidentPriority); _resolution->setType(XComboBox::IncidentResolution); _category->setType(XComboBox::IncidentCategory); _lotserial->setStrict(false); _incdthist->addColumn(tr("Username"), _userColumn, Qt::AlignLeft, true, "incdthist_username"); _incdthist->addColumn(tr("Date/Time"),_timeDateColumn, Qt::AlignLeft, true, "incdthist_timestamp"); _incdthist->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "incdthist_descrip"); _todoList->addColumn(tr("Seq"), 25, Qt::AlignRight, true, "todoitem_seq"); _todoList->addColumn(tr("User"), _userColumn, Qt::AlignLeft, true, "usr_username"); _todoList->addColumn(tr("Name"), 100, Qt::AlignLeft, true, "todoitem_name"); _todoList->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "todoitem_notes"); _todoList->addColumn(tr("Status"), _statusColumn, Qt::AlignLeft, true, "todoitem_status"); _todoList->addColumn(tr("Due Date"), _dateColumn, Qt::AlignLeft, true, "todoitem_due_date"); q.prepare("SELECT usr_id " "FROM usr " "WHERE (usr_username=CURRENT_USER);"); q.exec(); if (q.first()) { _myUsrId = q.value("usr_id").toInt(); } else if (q.lastError().type() != QSqlError::None) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); close(); } if (_metrics->boolean("LotSerialControl")) { connect(_item, SIGNAL(valid(bool)), _lotserial, SLOT(setEnabled(bool))); connect(_item, SIGNAL(newId(int)), _lotserial, SLOT(setItemId(int))); } else _lotserial->setVisible(false); // because this causes a pop-behind situation we are hiding for now. _return->hide(); _saved = false; }
opportunity::opportunity(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) : XDialog(parent, name, modal, fl) { setupUi(this); if(!_privileges->check("EditOwner")) _owner->setEnabled(false); connect(_crmacct, SIGNAL(newId(int)), this, SLOT(sHandleCrmacct(int))); connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sSave())); connect(_deleteTodoItem, SIGNAL(clicked()), this, SLOT(sDeleteTodoItem())); connect(_viewTodoItem, SIGNAL(clicked()), this, SLOT(sViewTodoItem())); connect(_editTodoItem, SIGNAL(clicked()), this, SLOT(sEditTodoItem())); connect(_newTodoItem, SIGNAL(clicked()), this, SLOT(sNewTodoItem())); connect(_todoList, SIGNAL(itemSelected(int)), _editTodoItem, SLOT(animateClick())); connect(_todoList, SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)), this, SLOT(sPopulateTodoMenu(QMenu*))); connect(_todoList, SIGNAL(valid(bool)), this, SLOT(sHandleTodoPrivs())); connect(_deleteSale, SIGNAL(clicked()), this, SLOT(sDeleteSale())); connect(_viewSale, SIGNAL(clicked()), this, SLOT(sViewSale())); connect(_editSale, SIGNAL(clicked()), this, SLOT(sEditSale())); connect(_convertQuote, SIGNAL(clicked()), this, SLOT(sConvertQuote())); connect(_printSale, SIGNAL(clicked()), this, SLOT(sPrintSale())); connect(_salesList, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*)), this, SLOT(sPopulateSalesMenu(QMenu*))); connect(_salesList, SIGNAL(valid(bool)), this, SLOT(sHandleSalesPrivs())); connect(omfgThis, SIGNAL(quotesUpdated(int, bool)), this, SLOT(sFillSalesList())); connect(omfgThis, SIGNAL(salesOrdersUpdated(int, bool)), this, SLOT(sFillSalesList())); connect(_charass, SIGNAL(itemSelected(int)), _editCharacteristic, SLOT(animateClick())); connect(_newCharacteristic, SIGNAL(clicked()), this, SLOT(sNewCharacteristic())); connect(_editCharacteristic, SIGNAL(clicked()), this, SLOT(sEditCharacteristic())); connect(_deleteCharacteristic, SIGNAL(clicked()), this, SLOT(sDeleteCharacteristic())); connect(_assignedTo, SIGNAL(newId(int)), this, SLOT(sHandleAssigned())); _probability->setValidator(0); _opheadid = -1; _custid = -1; _prospectid = -1; _todoList->addColumn(tr("Active"), _statusColumn, Qt::AlignRight, true, "todoitem_active"); _todoList->addColumn(tr("Priority"), _userColumn, Qt::AlignRight, true, "incdtpriority_name"); _todoList->addColumn(tr("Owner"), _userColumn, Qt::AlignLeft, false, "todoitem_owner_username"); _todoList->addColumn(tr("Assigned"), _userColumn, Qt::AlignLeft, true, "todoitem_username" ); _todoList->addColumn(tr("Name"), 100, Qt::AlignLeft, true, "todoitem_name" ); _todoList->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "todoitem_description" ); _todoList->addColumn(tr("Status"), _statusColumn, Qt::AlignLeft, true, "todoitem_status" ); _todoList->addColumn(tr("Due Date"), _dateColumn, Qt::AlignLeft, true, "todoitem_due_date" ); _salesList->addColumn(tr("Doc #"), _orderColumn, Qt::AlignLeft, true, "sale_number" ); _salesList->addColumn(tr("Type"), -1, Qt::AlignLeft, true, "sale_type" ); _salesList->addColumn(tr("Date"), _dateColumn, Qt::AlignLeft, true, "sale_date" ); _salesList->addColumn(tr("Ext. Price"), _priceColumn, Qt::AlignRight, true, "sale_extprice"); _charass->addColumn(tr("Characteristic"), _itemColumn, Qt::AlignLeft, true, "char_name" ); _charass->addColumn(tr("Value"), -1, Qt::AlignLeft, true, "charass_value" ); _charass->addColumn(tr("Default"), _ynColumn, Qt::AlignCenter,true, "charass_default" ); _owner->setUsername(omfgThis->username()); _owner->setType(UsernameLineEdit::UsersActive); _assignedTo->setType(UsernameLineEdit::UsersActive); _saved = false; }