Example #1
0
void dspItemsByClassCode::sPopulateMenu(Q3PopupMenu *pMenu, Q3ListViewItem *selected)
{
  int menuItem;

  menuItem = pMenu->insertItem(tr("Edit Item Master..."), this, SLOT(sEdit()), 0);
  if (!_privleges->check("MaintainItemMasters"))
    pMenu->setItemEnabled(menuItem, FALSE);

  if (selected->text(2) == "M")
  {
    menuItem = pMenu->insertItem(tr("Edit Bill of Material..."), this, SLOT(sEditBOM()), 0);
    if (!_privleges->check("MaintainBOMs"))
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("View Bill of Material..."), this, SLOT(sViewBOM()), 0);
    if ( (!_privleges->check("MaintainBOMs")) && (!_privleges->check("ViewBOMs")) )
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("Edit Item Bill of Operations..."), this, SLOT(sEditBOO()), 0);
    if (!_privleges->check("MaintainBOOs"))
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("View Item Bill of Operations..."), this, SLOT(sViewBOO()), 0);
    if ( (!_privleges->check("MaintainBOOs")) && (!_privleges->check("ViewBOOs")) )
      pMenu->setItemEnabled(menuItem, FALSE);
  }
}
Example #2
0
void dspSingleLevelWhereUsed::sPopulateMenu(QMenu *menu, QTreeWidgetItem *, int)
{
  QAction *menuItem;

  menuItem = menu->addAction(tr("Edit Bill of Materials..."), this, SLOT(sEditBOM()));
  if (!_privileges->check("MaintainBOMs"))
    menuItem->setEnabled(false);

  menuItem = menu->addAction(tr("Edit Item Master..."), this, SLOT(sEditItem()));
  if (!_privileges->check("MaintainItemMasters"))
    menuItem->setEnabled(false);

  menuItem = menu->addAction(tr("View Item Inventory History..."), this, SLOT(sViewInventoryHistory()));
  if (!_privileges->check("ViewInventoryHistory"))
    menuItem->setEnabled(false);
}
Example #3
0
void dspSingleLevelWhereUsed::sPopulateMenu(QMenu *menu)
{
  int menuItem;

  menuItem = menu->insertItem(tr("Edit Bill of Materials..."), this, SLOT(sEditBOM()), 0);
  if (!_privileges->check("MaintainBOMs"))
    menu->setItemEnabled(menuItem, FALSE);

  menuItem = menu->insertItem(tr("Edit Item Master..."), this, SLOT(sEditItem()), 0);
  if (!_privileges->check("MaintainItemMasters"))
    menu->setItemEnabled(menuItem, FALSE);

  menuItem = menu->insertItem(tr("View Item Inventory History..."), this, SLOT(sViewInventoryHistory()), 0);
  if (!_privileges->check("ViewInventoryHistory"))
    menu->setItemEnabled(menuItem, FALSE);
}
Example #4
0
void dspItemsByClassCode::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *selected)
{
  XTreeWidgetItem * xselected = static_cast<XTreeWidgetItem*>(selected);
  int menuItem;

  menuItem = pMenu->insertItem(tr("Edit Item Master..."), this, SLOT(sEdit()), 0);
  if (!_privileges->check("MaintainItemMasters"))
    pMenu->setItemEnabled(menuItem, FALSE);

  if (xselected && (xselected->rawValue("type").toString() == "M"))
  {
    menuItem = pMenu->insertItem(tr("Edit Bill of Material..."), this, SLOT(sEditBOM()), 0);
    if (!_privileges->check("MaintainBOMs"))
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("View Bill of Material..."), this, SLOT(sViewBOM()), 0);
    if ( (!_privileges->check("MaintainBOMs")) && (!_privileges->check("ViewBOMs")) )
      pMenu->setItemEnabled(menuItem, FALSE);
  }
}
Example #5
0
void searchForItem::sPopulateMenu(QMenu *pMenu, QTreeWidgetItem *pSelected)
{
  int menuItem;

  bool hasBOM = false;
  q.prepare("SELECT (count(*) != 0) AS hasBOM"
            "  FROM bomhead"
            " WHERE (bomhead_item_id=:item_id); ");
  q.bindValue(":item_id", _item->id());
  q.exec();
  if(q.first())
    hasBOM = q.value("hasBOM").toBool();

  bool hasBOO = false;
  q.prepare("SELECT (count(*) != 0) AS hasBOO"
            "  FROM boohead"
            " WHERE (boohead_item_id=:item_id); ");
  q.bindValue(":item_id", _item->id());
  q.exec();
  if(q.first())
    hasBOO = q.value("hasBOO").toBool();

  menuItem = pMenu->insertItem(tr("View..."), this, SLOT(sView()), 0);

  menuItem = pMenu->insertItem(tr("Edit..."), this, SLOT(sEdit()), 0);
  if (!_privileges->check("MaintainItemMasters"))
    pMenu->setItemEnabled(menuItem, FALSE);

  if ((((XTreeWidgetItem *)pSelected)->text(2) == tr("Purchased")) ||
      (((XTreeWidgetItem *)pSelected)->text(2) == tr("Manufactured")) ||
      (((XTreeWidgetItem *)pSelected)->text(2) == tr("Job")) ||
      (((XTreeWidgetItem *)pSelected)->text(2) == tr("Breeder")) ||
      (((XTreeWidgetItem *)pSelected)->text(2) == tr("Kit")))
  {
    pMenu->insertSeparator();

    menuItem = pMenu->insertItem(tr("View BOM..."), this, SLOT(sViewBOM()), 0);
    if (!hasBOM || !_privileges->check("ViewBOMs"))
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("Edit BOM..."), this, SLOT(sEditBOM()), 0);
    if (!hasBOM || !_privileges->check("MaintainBOMs"))
      pMenu->setItemEnabled(menuItem, FALSE);
  }

  if ((((XTreeWidgetItem *)pSelected)->text(2) == tr("Purchased") ||
      (((XTreeWidgetItem *)pSelected)->text(2) == tr("Job")) ||
      (((XTreeWidgetItem *)pSelected)->text(2) == tr("Manufactured"))
      && _metrics->boolean("Routings")))
  {
    pMenu->insertSeparator();

    menuItem = pMenu->insertItem(tr("View BOO..."), this, SLOT(sViewBOO()), 0);
    if (!hasBOO || !_privileges->check("ViewBOOs"))
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("Edit BOO..."), this, SLOT(sEditBOO()), 0);
    if (!hasBOO || !_privileges->check("MaintainBOOs"))
      pMenu->setItemEnabled(menuItem, FALSE);
  }

  if (((XTreeWidgetItem *)pSelected)->text(2) == tr("Breeder"))
  {
    pMenu->insertSeparator();

    menuItem = pMenu->insertItem(tr("View Breeder BOM..."), this, SLOT(sViewBBOM()), 0);
    if (!_privileges->check("ViewBBOMs"))
      pMenu->setItemEnabled(menuItem, FALSE);

    menuItem = pMenu->insertItem(tr("Edit Breeder BOM..."), this, SLOT(sEditBBOM()), 0);
    if (!_privileges->check("MaintainBBOMs"))
      pMenu->setItemEnabled(menuItem, FALSE);
  }
}