Documents::Documents(QWidget *pParent) : QWidget(pParent) { setupUi(this); _source = Uninitialized; _sourceid = -1; _doc->addColumn(tr("Type"), _itemColumn, Qt::AlignLeft, true, "target_type" ); _doc->addColumn(tr("Number"), _itemColumn, Qt::AlignLeft, true, "target_number" ); _doc->addColumn(tr("Name"), -1, Qt::AlignLeft, true, "name" ); _doc->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "description"); _doc->addColumn(tr("Relationship"), _itemColumn, Qt::AlignLeft,true, "purpose"); connect(_attachDoc, SIGNAL(clicked()), this, SLOT(sAttachDoc())); connect(_editDoc, SIGNAL(clicked()), this, SLOT(sEditDoc())); connect(_viewDoc, SIGNAL(clicked()), this, SLOT(sViewDoc())); connect(_detachDoc, SIGNAL(clicked()), this, SLOT(sDetachDoc())); connect(_doc, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(sEditDoc())); if (_x_privileges) { QMenu * newDocMenu = new QMenu; QAction* imgAct = new QAction(tr("Image"), this); imgAct->setEnabled(_x_privileges->check("MaintainImages")); connect(imgAct, SIGNAL(triggered()), this, SLOT(sNewImage())); newDocMenu->addAction(imgAct); QAction* incdtAct = new QAction(tr("Incident"), this); incdtAct->setEnabled(_x_privileges->check("AddIncidents")); connect(incdtAct, SIGNAL(triggered()), this, SLOT(sNewIncdt())); newDocMenu->addAction(incdtAct); QAction* todoAct = new QAction(tr("To Do"), this); todoAct->setEnabled(_x_privileges->check("MaintainPersonalTodoList") || _x_privileges->check("MaintainOtherTodoLists")); connect(todoAct, SIGNAL(triggered()), this, SLOT(sNewToDo())); newDocMenu->addAction(todoAct); QAction* oppAct = new QAction(tr("Opportunity"), this); oppAct->setEnabled(_x_privileges->check("MaintainOpportunities")); connect(oppAct, SIGNAL(triggered()), this, SLOT(sNewOpp())); newDocMenu->addAction(oppAct); QAction* projAct = new QAction(tr("Project"), this); projAct->setEnabled(_x_privileges->check("MaintainProjects")); connect(projAct, SIGNAL(triggered()), this, SLOT(sNewProj())); newDocMenu->addAction(projAct); _newDoc->setMenu(newDocMenu); } }
Documents::Documents(QWidget *pParent) : QWidget(pParent) { setupUi(this); _source = Uninitialized; _sourceid = -1; _readOnly = false; _doc->addColumn(tr("Type"), _itemColumn, Qt::AlignLeft, true, "target_type" ); _doc->addColumn(tr("Number"), _itemColumn, Qt::AlignLeft, true, "target_number" ); _doc->addColumn(tr("Name"), -1, Qt::AlignLeft, true, "name" ); _doc->addColumn(tr("Description"), -1, Qt::AlignLeft, true, "description"); _doc->addColumn(tr("Relationship"), _itemColumn, Qt::AlignLeft,true, "purpose"); _doc->addColumn(tr("Can View"), _ynColumn, Qt::AlignCenter, false, "canview"); _doc->addColumn(tr("Can Edit"), _ynColumn, Qt::AlignCenter, false, "canedit"); connect(_attachDoc, SIGNAL(clicked()), this, SLOT(sAttachDoc())); connect(_editDoc, SIGNAL(clicked()), this, SLOT(sEditDoc())); connect(_viewDoc, SIGNAL(clicked()), this, SLOT(sViewDoc())); connect(_detachDoc, SIGNAL(clicked()), this, SLOT(sDetachDoc())); connect(_doc, SIGNAL(valid(bool)), this, SLOT(handleSelection())); connect(_doc, SIGNAL(itemSelected(int)), this, SLOT(handleItemSelected())); handleSelection(); if (_x_privileges) { QMenu * newDocMenu = new QMenu; QAction* imgAct = new QAction(tr("Image"), this); imgAct->setEnabled(_x_privileges->check("MaintainImages")); connect(imgAct, SIGNAL(triggered()), this, SLOT(sNewImage())); newDocMenu->addAction(imgAct); QAction* incdtAct = new QAction(tr("Incident"), this); incdtAct->setEnabled(_x_privileges->check("MaintainPersonalIncidents") || _x_privileges->check("MaintainAllIncidents")); connect(incdtAct, SIGNAL(triggered()), this, SLOT(sNewIncdt())); newDocMenu->addAction(incdtAct); QAction* todoAct = new QAction(tr("To Do"), this); todoAct->setEnabled(_x_privileges->check("MaintainPersonalToDoItems") || _x_privileges->check("MaintainAllToDoItems")); connect(todoAct, SIGNAL(triggered()), this, SLOT(sNewToDo())); newDocMenu->addAction(todoAct); QAction* oppAct = new QAction(tr("Opportunity"), this); oppAct->setEnabled(_x_privileges->check("MaintainPersonalOpportunities") || _x_privileges->check("MaintainAllOpportunities")); connect(oppAct, SIGNAL(triggered()), this, SLOT(sNewOpp())); newDocMenu->addAction(oppAct); QAction* projAct = new QAction(tr("Project"), this); projAct->setEnabled(_x_privileges->check("MaintainPersonalProjects") || _x_privileges->check("MaintainAllProjects")); connect(projAct, SIGNAL(triggered()), this, SLOT(sNewProj())); newDocMenu->addAction(projAct); _newDoc->setMenu(newDocMenu); } }