void dspCashReceipts::sHandleButtons(bool valid) { int menuItem = -1; QMenu * editMenu = new QMenu; QMenu * viewMenu = new QMenu; _reverse->setVisible(!_applications->isChecked()); if (valid && _arapply->id() > -1) { // Handle Edit Button // Cash Receipt if (_arapply->currentItem()->rawValue("voided").toBool()) { _post->hide(); _reverse->hide(); } else if (!_arapply->currentItem()->rawValue("posted").toBool()) { editMenu->insertItem(tr("Cash Receipt..."), this, SLOT(sEditCashrcpt()), 0); editMenu->setItemEnabled(menuItem, _privileges->check("MaintainCashReceipts")); _post->show(); _reverse->setVisible(!_applications->isChecked()); _reverse->setEnabled(false); _post->setEnabled(_privileges->check("PostCashReceipts")); } else { _post->show(); _reverse->setVisible(!_applications->isChecked()); _post->setEnabled(false); _reverse->setEnabled(_privileges->check("ReversePostedCashReceipt") && _cashreceipts->isChecked() && !_arapply->altId()); } if (_arapply->currentItem()->id("target") > -1) { editMenu->insertItem(tr("Receivable Item..."), this, SLOT(sEditAropen()), 0); editMenu->setItemEnabled(menuItem, _privileges->check("EditAROpenItem")); } // Handle View Button // Cash Receipt viewMenu->insertItem(tr("Cash Receipt..."), this, SLOT(sViewCashrcpt()), 0); viewMenu->setItemEnabled(menuItem, _privileges->check("ViewCashReceipts") || _privileges->check("MaintainCashReceipts")); // Open Item if (_arapply->currentItem()->id("target") > -1) { viewMenu->insertItem(tr("Receivable Item..."), this, SLOT(sViewAropen()), 0); viewMenu->setItemEnabled(menuItem, _privileges->check("ViewAROpenItems") || _privileges->check("EditAROpenItem")); } _edit->setMenu(editMenu); _edit->setEnabled(!editMenu->isEmpty()); _view->setMenu(viewMenu); _view->setEnabled(!viewMenu->isEmpty()); } else { _edit->setEnabled(false); _view->setEnabled(false); _post->setEnabled(false); _reverse->setEnabled(false); } }
todoList::todoList(QWidget* parent, const char* name, Qt::WFlags fl) : XWidget(parent, name, fl) { setupUi(this); QSqlDatabase db = QSqlDatabase::database(); _parameterWidget->setType(tr("CRM Account"), "crmAccountId", ParameterWidget::Crmacct); _parameterWidget->setType(tr("Assigned"), "assigned_username", ParameterWidget::User, db.userName()); _parameterWidget->setType(tr("Owner"), "owner_username", ParameterWidget::User); _parameterWidget->setType(tr("Assigned Pattern"), "assigned_usr_pattern", ParameterWidget::Text); _parameterWidget->setType(tr("Owner Pattern"), "owner_usr_pattern", ParameterWidget::Text); _parameterWidget->setType(tr("Start Date Before"), "startStartDate", ParameterWidget::Date); _parameterWidget->setType(tr("Start Date After"), "startEndDate", ParameterWidget::Date); _parameterWidget->setType(tr("Due Date Before"), "dueStartDate", ParameterWidget::Date); _parameterWidget->setType(tr("Due Date After"), "dueEndDate", ParameterWidget::Date); _parameterWidget->applyDefaultFilterSet(); _crmAccount->hide(); q.exec("SELECT current_user;"); if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); close(); } connect(_parameterWidget, SIGNAL(updated()), this, SLOT(sFillList())); connect(_query, SIGNAL(clicked()), this, SLOT(sFillList())); connect(_autoUpdate, SIGNAL(toggled(bool)), this, SLOT(sHandleAutoUpdate(bool))); connect(_close, SIGNAL(clicked()), this, SLOT(sClose())); connect(_completed, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_todolist, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_incidents, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_projects, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_print, SIGNAL(clicked()), this, SLOT(sPrint())); connect(_todoList, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick())); connect(_todoList, SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)), this, SLOT(sPopulateMenu(QMenu*))); connect(_todoList, SIGNAL(itemSelectionChanged()), this, SLOT(handlePrivs())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_view, SIGNAL(clicked()), this, SLOT(sView())); _todoList->addColumn(tr("Type"), _userColumn, Qt::AlignCenter, true, "type"); _todoList->addColumn(tr("Seq"), _seqColumn, Qt::AlignRight, false, "seq"); _todoList->addColumn(tr("Priority"), _userColumn, Qt::AlignLeft, true, "priority"); _todoList->addColumn(tr("Assigned To"),_userColumn, Qt::AlignLeft, true, "usr"); _todoList->addColumn(tr("Name"), 100, Qt::AlignLeft, true, "name"); _todoList->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "descrip"); _todoList->addColumn(tr("Status"), _statusColumn, Qt::AlignLeft, true, "status"); _todoList->addColumn(tr("Start Date"),_dateColumn, Qt::AlignLeft, false, "start"); _todoList->addColumn(tr("Due Date"), _dateColumn, Qt::AlignLeft, true, "due"); _todoList->addColumn(tr("Parent#"), _orderColumn, Qt::AlignLeft, true, "number"); _todoList->addColumn(tr("Customer#"),_orderColumn, Qt::AlignLeft, false, "cust"); _todoList->addColumn(tr("Account#"), _orderColumn, Qt::AlignLeft, false, "crmacct_number"); _todoList->addColumn(tr("Account Name"), 100, Qt::AlignLeft, true, "crmacct_name"); _todoList->addColumn(tr("Owner"), _userColumn, Qt::AlignLeft, false,"owner"); int menuItem; QMenu * todoMenu = new QMenu; menuItem = todoMenu->insertItem(tr("Incident"), this, SLOT(sNewIncdt())); if (!_privileges->check("MaintainIncidents")) todoMenu->setItemEnabled(menuItem, FALSE); menuItem = todoMenu->insertItem(tr("To-Do Item"), this, SLOT(sNew())); if (!_privileges->check("MaintainPersonalTodoList") && !_privileges->check("MaintainOtherTodoLists")) todoMenu->setItemEnabled(menuItem, FALSE); _new->setMenu(todoMenu); if (_preferences->boolean("XCheckBox/forgetful")) _incidents->setChecked(true); handlePrivs(); sHandleAutoUpdate(_autoUpdate->isChecked()); }
todoList::todoList(QWidget* parent, const char* name, Qt::WFlags fl) : XWidget(parent, name, fl) { setupUi(this); _crmAccount->hide(); _dueDates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE); _dueDates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE); _startDates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE); _startDates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE); _usrGroup->setEnabled(_privileges->check("MaintainOtherTodoLists")); q.exec("SELECT current_user;"); if (q.first()) _usr->setUsername(q.value("current_user").toString()); else if (q.lastError().type() != QSqlError::NoError) { systemError(this, q.lastError().databaseText(), __FILE__, __LINE__); close(); } connect(_autoUpdate, SIGNAL(toggled(bool)), this, SLOT(sHandleAutoUpdate(bool))); connect(_close, SIGNAL(clicked()), this, SLOT(sClose())); connect(_completed, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_dueDates, SIGNAL(updated()), this, SLOT(sFillList())); connect(_startDates, SIGNAL(updated()), this, SLOT(sFillList())); connect(_todolist, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_incidents, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_projects, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_new, SIGNAL(clicked()), this, SLOT(sNew())); connect(_print, SIGNAL(clicked()), this, SLOT(sPrint())); connect(_todoList, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick())); connect(_todoList, SIGNAL(populateMenu(QMenu*, QTreeWidgetItem*, int)), this, SLOT(sPopulateMenu(QMenu*))); connect(_todoList, SIGNAL(itemSelectionChanged()), this, SLOT(handlePrivs())); connect(_all, SIGNAL(clicked()), this, SLOT(sFillList())); connect(_all, SIGNAL(clicked()), this, SLOT(handlePrivs())); connect(_selected, SIGNAL(clicked()), this, SLOT(sFillList())); connect(_selected, SIGNAL(clicked()), this, SLOT(handlePrivs())); connect(_usr, SIGNAL(newId(int)), this, SLOT(sFillList())); connect(_usr, SIGNAL(newId(int)), this, SLOT(handlePrivs())); connect(_pattern, SIGNAL(editingFinished()), this, SLOT(sFillList())); connect(_pattern, SIGNAL(editingFinished()), this, SLOT(handlePrivs())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_view, SIGNAL(clicked()), this, SLOT(sView())); connect(_duedateGroup, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_startdateGroup, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_assignedTo, SIGNAL(toggled(bool)), this, SLOT(sFillList())); connect(_ownedBy, SIGNAL(toggled(bool)), this, SLOT(sFillList())); _todoList->addColumn(tr("Type"), _userColumn, Qt::AlignCenter, true, "type"); _todoList->addColumn(tr("Seq"), _seqColumn, Qt::AlignRight, false, "seq"); _todoList->addColumn(tr("Priority"), _userColumn, Qt::AlignLeft, true, "priority"); _todoList->addColumn(tr("Assigned To"),_userColumn, Qt::AlignLeft, true, "usr"); _todoList->addColumn(tr("Name"), 100, Qt::AlignLeft, true, "name"); _todoList->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "descrip"); _todoList->addColumn(tr("Status"), _statusColumn, Qt::AlignLeft, true, "status"); _todoList->addColumn(tr("Start Date"),_dateColumn, Qt::AlignLeft, false, "start"); _todoList->addColumn(tr("Due Date"), _dateColumn, Qt::AlignLeft, true, "due"); _todoList->addColumn(tr("Parent#"), _orderColumn, Qt::AlignLeft, true, "number"); _todoList->addColumn(tr("Customer#"),_orderColumn, Qt::AlignLeft, false, "cust"); _todoList->addColumn(tr("Account#"), _orderColumn, Qt::AlignLeft, false, "crmacct_number"); _todoList->addColumn(tr("Account Name"), 100, Qt::AlignLeft, true, "crmacct_name"); _todoList->addColumn(tr("Owner"), _userColumn, Qt::AlignLeft, false,"owner"); int menuItem; QMenu * todoMenu = new QMenu; menuItem = todoMenu->insertItem(tr("Incident"), this, SLOT(sNewIncdt())); if (!_privileges->check("MaintainIncidents")) todoMenu->setItemEnabled(menuItem, FALSE); menuItem = todoMenu->insertItem(tr("To-Do Item"), this, SLOT(sNew())); if (!_privileges->check("MaintainPersonalTodoList") && !_privileges->check("MaintainOtherTodoLists")) todoMenu->setItemEnabled(menuItem, FALSE); _new->setMenu(todoMenu); if (_preferences->boolean("XCheckBox/forgetful")) _incidents->setChecked(true); handlePrivs(); sHandleAutoUpdate(_autoUpdate->isChecked()); }