Пример #1
0
VirtualClusterLineEdit::VirtualClusterLineEdit(QWidget* pParent,
					       const char* pTabName,
					       const char* pIdColumn,
					       const char* pNumberColumn,
					       const char* pNameColumn,
					       const char* pDescripColumn,
					       const char* pExtra,
					       const char* pName) :
    XLineEdit(pParent, pName)
{
    _valid  = false;
    _parsed = true;
    _strict = true;

    setTableAndColumnNames(pTabName, pIdColumn, pNumberColumn, pNameColumn, pDescripColumn);

    if (pExtra && QString(pExtra).stripWhiteSpace().length())
	_extraClause = pExtra;

    connect(this, SIGNAL(lostFocus()),		this, SLOT(sParse()));
    connect(this, SIGNAL(requestInfo()),	this, SLOT(sInfo()));
    connect(this, SIGNAL(requestList()),	this, SLOT(sList()));
    connect(this, SIGNAL(requestSearch()),	this, SLOT(sSearch()));

    setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    setMaximumWidth(100);

    clear();
    _titleSingular = tr("Object");
    _titlePlural = tr("Objects");
}
Пример #2
0
void VirtualClusterLineEdit::sEllipses()
{
    if (_x_preferences && _x_preferences->value("DefaultEllipsesAction") == "search")
	sSearch();
    else
	sList();
}
Пример #3
0
void ContactCluster::sEllipses()
{
    if (_x_preferences && _x_preferences->value("DefaultEllipsesAction") == "search")
	sSearch();
    else
	sList();
}
Пример #4
0
void VendorLineEdit::sEllipses()
{
  if(_x_preferences)
  {
    if(_x_preferences->value("DefaultEllipsesAction") == "search")
    {
      sSearch();
      return;
    }
  }

  sList();
}
Пример #5
0
/*
 *  Constructs a rptCustomerInformation as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  true to construct a modal dialog.
 */
rptCustomerInformation::rptCustomerInformation(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : QDialog(parent, name, modal, fl)
{
    setupUi(this);


    // signals and slots connections
    connect(_cust, SIGNAL(custNameChanged(const QString&)), _name, SLOT(setText(const QString&)));
    connect(_custList, SIGNAL(clicked()), _cust, SLOT(sSearch()));
    connect(_close, SIGNAL(clicked()), this, SLOT(reject()));
    connect(_print, SIGNAL(clicked()), this, SLOT(sPrint()));
    connect(_cust, SIGNAL(valid(bool)), _print, SLOT(setEnabled(bool)));
    init();
}
Пример #6
0
void ContactWidget::setListVisible(bool p)
{
  _first->disconnect();
  _middle->disconnect();
  _last->disconnect();
  _suffix->disconnect();
  _first->disconnect();
  _middle->disconnect();
  _last->disconnect();
  _suffix->disconnect();

  _list->setVisible(p);
  if (p)
  {
    connect(_first, SIGNAL(requestSearch()),	this, SLOT(sSearch()));
    connect(_middle, SIGNAL(requestSearch()),	this, SLOT(sSearch()));
    connect(_last, SIGNAL(requestSearch()),	this, SLOT(sSearch()));
    connect(_suffix, SIGNAL(requestSearch()),	this, SLOT(sSearch()));
    connect(_first, SIGNAL(requestList()),	this, SLOT(sList()));
    connect(_middle, SIGNAL(requestList()),	this, SLOT(sList()));
    connect(_last, SIGNAL(requestList()),	this, SLOT(sList()));
    connect(_suffix, SIGNAL(requestList()),	this, SLOT(sList()));
  }
}
Пример #7
0
void ItemLineEdit::sEllipses()
{
    if(_x_preferences)
    {
        if(_x_preferences->value("DefaultEllipsesAction") == "search")
        {
            sSearch();
            return;
        }
        else if(_x_preferences->value("DefaultEllipsesAction") == "alias")
        {
            sAlias();
            return;
        }
    }

    sList();
}
Пример #8
0
VendorLineEdit::VendorLineEdit(QWidget *pParent, const char *name) :
  XLineEdit(pParent, name)
{
  setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
  setMaximumWidth(100);

  setAcceptDrops(TRUE);
  setAlignment(Qt::AlignVCenter | Qt::AlignRight);

  _id       = -1;
  _valid    = FALSE;
  _parsed   = TRUE;
  _dragging = FALSE;
  _type     = __allVendors;

  connect(this, SIGNAL(lostFocus()), this, SLOT(sParse()));
  connect(this, SIGNAL(requestSearch()), this, SLOT(sSearch()));
  connect(this, SIGNAL(requestList()), this, SLOT(sList()));
}
Пример #9
0
//  Routines for CLineEdit - a customer and prospect validating QLineEdit
CLineEdit::CLineEdit(QWidget *pParent, const char *name) :
  XLineEdit(pParent, name)
{
  setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
  setMaximumWidth(100);

  setAcceptDrops(TRUE);

  _id       = -1;
  _valid    = FALSE;
  _parsed   = TRUE;
  _dragging = FALSE;
  _type     = AllCustomers;
  _autoFocus = true;

  connect(this, SIGNAL(lostFocus()), this, SLOT(sParse()));
  connect(this, SIGNAL(requestSearch()), this, SLOT(sSearch()));
  connect(this, SIGNAL(requestList()), this, SLOT(sList()));
}
Пример #10
0
ItemLineEdit::ItemLineEdit(QWidget *pParent, const char *name) : XLineEdit(pParent, name)
{
  setAcceptDrops(TRUE);
  
  _type = cUndefined;
  _useQuery = FALSE;
  _useValidationQuery = FALSE;
  _itemNumber = "";
  _uom = "";
  _itemType = "";
  _id = -1;
  _parsed = TRUE;
  _valid = FALSE;
  _configured = FALSE;

  connect(this, SIGNAL(lostFocus()), this, SLOT(sParse()));
  connect(this, SIGNAL(requestList()), this, SLOT(sList()));
  connect(this, SIGNAL(requestSearch()), this, SLOT(sSearch()));
  connect(this, SIGNAL(requestAlias()), this, SLOT(sAlias()));
}
Пример #11
0
        view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        view->setHeaderHidden(true);
        view->setRootIsDecorated(false);
        _completer->setPopup(view);
        _completer->setCaseSensitivity(Qt::CaseInsensitive);
        _completer->setCompletionColumn(1);
        _completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
        connect(this, SIGNAL(textEdited(QString)), this, SLOT(sHandleCompleter()));
        connect(_completer, SIGNAL(highlighted(QString)), this, SLOT(setText(QString)));
        connect(_completer, SIGNAL(highlighted(const QModelIndex &)), this, SLOT(completerHighlighted(const QModelIndex &)));
      }
    }

    // Set up actions
    connect(_listAct, SIGNAL(triggered()), this, SLOT(sList()));
    connect(_searchAct, SIGNAL(triggered()), this, SLOT(sSearch()));

    _infoAct = new QAction(tr("Info..."), this);
    _infoAct->setShortcut(QKeySequence(tr("Ctrl+Shift+I")));
    _infoAct->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    _infoAct->setToolTip(tr("View record information"));
    _infoAct->setEnabled(false);
    connect(_infoAct, SIGNAL(triggered()), this, SLOT(sInfo()));
    addAction(_infoAct);

    _openAct = new QAction(tr("Open..."), this);
    _openAct->setShortcut(QKeySequence(tr("Ctrl+Shift+O")));
    _openAct->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    _openAct->setToolTip(tr("Open record detail"));
    _openAct->setEnabled(false);
    connect(_openAct, SIGNAL(triggered()), this, SLOT(sOpen()));
Пример #12
0
void ItemLineEdit::sParse()
{
  if (!_parsed)
  {
    _parsed = TRUE;

    if (text().length() == 0)
    {
      setId(-1);
      return;
    }
    else if (_useValidationQuery)
    {
      XSqlQuery item;
      item.prepare("SELECT item_id FROM item WHERE (item_number = :searchString OR item_upccode = :searchString);");
      item.bindValue(":searchString", text().trimmed().toUpper());
      item.exec();
      if (item.first())
      {
        int itemid = item.value("item_id").toInt();
        item.prepare(_validationSql);
        item.bindValue(":item_id", itemid);
        item.exec();
        if (item.size() > 1)
        {
          ParameterList params;
          params.append("search", text().trimmed().toUpper());
          params.append("searchNumber");
          params.append("searchUpc");
          sSearch(params);
          return;
        }
        else if (item.first())
        {
          setId(itemid);
          return;
        }
      }
    }
    else if (_useQuery)
    {
      XSqlQuery item;
      item.prepare(_sql);
      item.exec();
      if (item.first())
      {
        do
        {
          if (item.value("item_number").toString().startsWith(text().trimmed().toUpper()))
          {
            setId(item.value("item_id").toInt());
            return;
          }
        }
        while (item.next());
      }
    }
    else
    {
      XSqlQuery item;

      QString pre( "SELECT DISTINCT item_id, item_number AS number, "
                   "(item_descrip1 || ' ' || item_descrip2) AS name, "
                   "item_upccode AS description " );

      QStringList clauses;
      clauses = _extraClauses;
      clauses << "(item_number ~* :searchString OR item_upccode ~* :searchString)";
      item.prepare(buildItemLineEditQuery(pre, clauses, QString::null, _type).replace(";"," ORDER BY item_number LIMIT 1;"));
      item.bindValue(":searchString", QString(text().trimmed().toUpper()).prepend("^"));
      item.exec();
      if (item.first())
      {
        setId(item.value("item_id").toInt());
        return;
      }
    }
    setId(-1);
  }
}
Пример #13
0
void ItemLineEdit::sSearch()
{
  ParameterList params;
  sSearch(params);
}
Пример #14
0
void ItemLineEdit::setItemNumber(const QString& pNumber)
{
  XSqlQuery item;
  bool      found = FALSE;

  _parsed = TRUE;

  if (pNumber == text())
    return;

  if (!pNumber.isEmpty())
  {
    if (_useValidationQuery)
    {
      item.prepare(_validationSql);
      item.bindValue(":item_number", pNumber);
      item.exec();
      if (item.first())
        found = TRUE;
    }
    else if (_useQuery)
    {
      item.prepare(_sql);
      item.exec();
      found = (item.findFirst("item_number", pNumber) != -1);
    }
    else if (pNumber != QString::Null())
    {
      QString pre( "SELECT DISTINCT item_id, item_number, item_descrip1, item_descrip2,"
                   "                uom_name, item_type, item_config, item_upccode");

      QStringList clauses;
      clauses = _extraClauses;
      clauses << "(item_number=:item_number OR item_upccode=:item_number)";

      item.prepare(buildItemLineEditQuery(pre, clauses, QString::null, _type));
      item.bindValue(":item_number", pNumber);
      item.exec();
      
      if (item.size() > 1)
      { 
        ParameterList params;
        params.append("search", pNumber);
        params.append("searchNumber");
        params.append("searchUpc");
        sSearch(params);
        return;
      }
      else
        found = item.first();
    }
  }
  if (found)
  {
    _itemNumber = pNumber;
    _uom        = item.value("uom_name").toString();
    _itemType   = item.value("item_type").toString();
    _configured = item.value("item_config").toBool();
    _id         = item.value("item_id").toInt();
    _upc        = item.value("item_upccode").toInt();
    _valid      = TRUE;

    setText(item.value("item_number").toString());

    emit aliasChanged("");
    emit typeChanged(_itemType);
    emit descrip1Changed(item.value("item_descrip1").toString());
    emit descrip2Changed(item.value("item_descrip2").toString());
    emit uomChanged(item.value("uom_name").toString());
    emit configured(item.value("item_config").toBool());
    emit upcChanged(item.value("item_upccode").toString());
    
    emit valid(TRUE);
  }
  else
  {
    _itemNumber = "";
    _uom        = "";
    _itemType   = "";
    _id         = -1;
    _valid      = FALSE;
    _upc        = "";

    setText("");

    emit aliasChanged("");
    emit typeChanged("");
    emit descrip1Changed("");
    emit descrip2Changed("");
    emit uomChanged("");
    emit configured(FALSE);
    emit upcChanged("");

    emit valid(FALSE);
  }
}
Пример #15
0
void ItemLineEdit::sParse()
{
  if (DEBUG)
    qDebug("%s::sParse() entered with parsed %d, text [%s], "
           "_useValidationQuery %d, _useQuery %d",
           qPrintable(objectName()), _parsed, qPrintable(text()),
           _useValidationQuery, _useQuery);
  if (!_parsed)
  {
    _parsed = TRUE;

    if (text().length() == 0)
    {
      setId(-1);
      return;
    }
    else if (_useValidationQuery)
    {
      XSqlQuery item;
      if (completer())
        item.prepare("SELECT item_id"
                     "  FROM item"
                     " WHERE ((POSITION(:searchString IN item_number) = 1)"
                     "     OR (POSITION(:searchString IN item_upccode) = 1));");
      else
        item.prepare("SELECT item_id"
                     "  FROM item"
                     " WHERE (item_number = :searchString"
                     "     OR item_upccode = :searchString);");

      item.bindValue(":searchString", text().trimmed().toUpper());
      item.exec();
      while (item.next())
      {
        int itemid = item.value("item_id").toInt();
        XSqlQuery oneq;
        oneq.prepare(_validationSql);
        oneq.bindValue(":item_id", itemid);
        oneq.exec();
        if (oneq.size() > 1)
        {
          ParameterList params;
          params.append("search", text().trimmed().toUpper());
          params.append("searchNumber");
          params.append("searchUpc");
          sSearch(params);
          return;
        }
        else if (oneq.first())
        {
          setId(itemid);
          return;
        }
      }
    }
    else if (_useQuery)
    {
      XSqlQuery item;
      item.prepare(_sql);
      item.exec();
      if (item.first())
      {
        do
        {
          if (item.value("item_number").toString().startsWith(text().trimmed().toUpper()) ||
              item.value("item_upccode").toString().startsWith(text().trimmed().toUpper()))
          {
            setId(item.value("item_id").toInt());
            return;
          }
        }
        while (item.next());
      }
    }
    else
    {
      XSqlQuery item;

      QString pre( "SELECT DISTINCT item_id, item_number AS number, "
                   "(item_descrip1 || ' ' || item_descrip2) AS name, "
                   "item_upccode AS description " );

      QStringList clauses;
      clauses = _extraClauses;
      clauses << "((POSITION(:searchString IN item_number) = 1)"
              " OR (POSITION(:searchString IN item_upccode) = 1))";
      item.prepare(buildItemLineEditQuery(pre, clauses, QString::null, _type, true)
                               .replace(";"," ORDER BY item_number LIMIT 1;"));
      item.bindValue(":searchString", QString(text().trimmed().toUpper()));
      item.exec();
      if (item.first())
      {
        setId(item.value("item_id").toInt());
        return;
      }
    }
    setId(-1);
  }
}
Пример #16
0
void dspCountTagEditList::sFillList()
{
  QString sql( "SELECT *, "
               "       CASE WHEN (xtindentrole = 1) THEN NULL "
               "<? if exists(\"varianceValue\") ?>"
               "            WHEN (ABS(variancecost) >  <? value(\"varianceValue\") ?>) THEN 'error'"
               "<? elseif exists(\"variancePercent\") ?>"
               "            WHEN (ABS(varianceprcnt) >  <? value(\"variancePercent\") ?>) THEN 'error'"
               "<? else ?>"
               "            ELSE NULL"
               "<? endif ?> END AS qtforegroundrole,"
               "       CASE WHEN (xtindentrole = 1) THEN NULL "
               "            WHEN (qohafter IS NOT NULL) THEN 'emphasis'"
               "       END AS qohafter_qtforegroundrole,"
               "       CASE WHEN (xtindentrole = 0) THEN NULL ELSE '' END AS invcnt_priority_qtdisplayrole,"
               "       'qty' AS qoh_xtnumericrole,"
               "       'qty' AS qohafter_xtnumericrole,"
               "       'curr' AS variancecost_xtnumericrole "
               " FROM ("
               "SELECT invcnt_id, -1 AS cntslip_id, invcnt_priority,"
               "       COALESCE(invcnt_tagnumber, 'Misc.') AS tagnumber,"
               "       invcnt_tagdate AS tagdate,"
               "       item_number, warehous_code,"
	       "       CASE WHEN (location_id IS NOT NULL) THEN"
	       "                 location_name"
	       "             ELSE <? value(\"all\") ?>  END AS loc_specific, "
               "       CASE WHEN (invcnt_location_id IS NOT NULL)"
               "                 THEN (SELECT SUM(itemloc_qty)"
               "                         FROM itemloc"
               "                        WHERE ((itemloc_itemsite_id=itemsite_id)"
               "                          AND  (itemloc_location_id=invcnt_location_id)) )"
               "            ELSE itemsite_qtyonhand"
               "       END AS qoh,"
               "       COALESCE(invcnt_qoh_after, (SELECT SUM(cntslip_qty)"
               "                                   FROM cntslip"
               "                                   WHERE (cntslip_cnttag_id=invcnt_id) )"
               "               ) AS qohafter,"
               "       (invcnt_qoh_after - itemsite_qtyonhand) AS variance,"
               "       CASE WHEN (invcnt_qoh_after IS NULL) THEN NULL"
               "            WHEN ((itemsite_qtyonhand = 0) AND (invcnt_qoh_after > 0)) THEN 1"
               "            WHEN ((itemsite_qtyonhand = 0) AND (invcnt_qoh_after < 0)) THEN -1"
               "            WHEN ((itemsite_qtyonhand = 0) AND (invcnt_qoh_after = 0)) THEN 0"
               "            ELSE ((1 - (invcnt_qoh_after / itemsite_qtyonhand)) * -1)"
               "       END  * 100 AS varianceprcnt,"
               "       (stdcost(item_id) * (invcnt_qoh_after - itemsite_qtyonhand)) AS variancecost,"
               "       item_number AS orderby,"
               "       0 AS xtindentrole "
               "FROM invcnt LEFT OUTER JOIN location ON (invcnt_location_id=location_id),"
	       "     item, warehous, itemsite "
               "WHERE ( (invcnt_itemsite_id=itemsite_id)"
               " AND (itemsite_item_id=item_id)"
               " AND (itemsite_warehous_id=warehous_id)"
               " AND (NOT invcnt_posted)"
	       " <? if exists(\"warehous_id\") ?>"
	       " AND (itemsite_warehous_id=<? value(\"warehous_id\") ?>)"
	       " <? endif ?>"
	       " <? if exists(\"classcode_id\") ?>"
	       " AND (item_classcode_id=<? value(\"classcode_id\") ?>)"
	       " <? elseif exists(\"classcode_pattern\") ?>"
	       " AND (item_classcode_id IN (SELECT classcode_id FROM classcode WHERE (classcode_code ~ <? value(\"classcode_pattern\") ?>)))"
	       " <? elseif exists(\"plancode_id\") ?>"
	       " AND (itemsite_plancode_id=<? value(\"plancode_id\") ?>)"
	       " <? elseif exists(\"plancode_pattern\") ?>"
	       " AND (itemsite_plancode_id IN (SELECT plancode_id FROM plancode WHERE (plancode_code ~ <? value(\"plancode_pattern\") ?>)))"
	       " <? endif ?>"
	       " <? if exists(\"showSlips\") ?>"
	       " ) "
	       "UNION "
	       "SELECT invcnt_id, cntslip_id, invcnt_priority,"
               "       cntslip_number AS tagnumber,"
	       "       cntslip_entered AS tagdate,"
	       "       CASE WHEN (cntslip_posted) THEN <? value(\"posted\") ?>"
	       "            ELSE <? value(\"unposted\") ?>"
	       "       END AS item_number,"
	       "       '' AS warehous_code, "
	       "       '' AS loc_specific, "
	       "       NULL AS qoh,"
	       "       cntslip_qty AS qohafter,"
	       "       NULL AS variance, NULL AS varianceprcnt, 0 AS variancecost,"
	       "       item_number AS orderby,"
               "       1 AS xtindentrole "
	       "FROM cntslip, invcnt, itemsite, item "
	       "WHERE ( (cntslip_cnttag_id=invcnt_id)"
	       " AND (invcnt_itemsite_id=itemsite_id)"
	       " AND (itemsite_item_id=item_id)"
	       " AND (NOT invcnt_posted)"
	       " <? if exists(\"warehous_id\") ?>"
	       " AND (itemsite_warehous_id=<? value(\"warehous_id\") ?>)"
	       " <? endif ?>"
	       " <? if exists(\"classcode_id\") ?>"
	       " AND (item_classcode_id=<? value(\"classcode_id\") ?>)"
	       " <? elseif exists(\"classcode_pattern\") ?>"
	       " AND (item_classcode_id IN (SELECT classcode_id FROM classcode WHERE (classcode_code ~ <? value(\"classcode_pattern\") ?>)))"
	       " <? elseif exists(\"plancode_id\") ?>"
	       " AND (itemsite_plancode_id=<? value(\"plancode_id\") ?>)"
	       " <? elseif exists(\"plancode_pattern\") ?>"
	       " AND (itemsite_plancode_id IN (SELECT plancode_id FROM plancode WHERE (plancode_code ~ <? value(\"plancode_pattern\") ?>)))"
	       " <? endif ?>"
	       " <? endif ?>"
	       " ) "
               " ) AS dummy "
	       "ORDER BY invcnt_priority DESC, orderby, invcnt_id, cntslip_id;" );

  ParameterList params;
  setParams(params);
  params.append("all",	    tr("All"));
  params.append("posted",   tr("Posted"));
  params.append("unposted", tr("Unposted"));
  if (_showSlips->isChecked())
    params.append("showSlips");
  if (_highlightValue->isChecked())
    params.append("varianceValue",   _varianceValue->localValue());
  else if (_highlightPercent->isChecked())
    params.append("variancePercent", _variancePercent->toDouble());

  MetaSQLQuery mql(sql);
  q = mql.toQuery(params);
  _cnttag->populate(q, true);
  if (q.lastError().type() != QSqlError::NoError)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  
  _cnttag->expandAll();

  if (_searchFor->text().trimmed().length())
    sSearch(_searchFor->text());
}
Пример #17
0
void AddressCluster::init()
{
    _list = new QPushButton(tr("..."), this);
    _list->setObjectName("_list");
    _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

#ifndef Q_OS_MAC
    _list->setMaximumWidth(25);
#else
    _list->setMinimumWidth(60);
    _list->setMinimumHeight(32);
#endif

    _titleSingular = tr("Address");
    _titlePlural   = tr("Addresses");
    _query = "SELECT * FROM address ";
    _searchAcctId = -1;

    // handle differences between VirtualCluster and AddressCluster
    _grid->removeWidget(_label);
    _grid->removeWidget(_description);
    delete _description;
    _description = 0;

    _addrChange    = new XLineEdit(this);
    _number        = new XLineEdit(this);
    _addrLit       = new QLabel(tr("Street\nAddress:"), this);
    _addr1         = new XLineEdit(this);
    _addr2         = new XLineEdit(this);
    _addr3         = new XLineEdit(this);
    _cityLit       = new QLabel(tr("City:"), this);
    _city          = new XLineEdit(this);
    _stateLit      = new QLabel(tr("State:"));
    _state         = new XComboBox(this, "_state");
    _postalcodeLit = new QLabel(tr("Postal:"));
    _postalcode    = new XLineEdit(this);
    _countryLit    = new QLabel(tr("Country:"));
    _country       = new XComboBox(this, "_country");
    _active        = new QCheckBox(tr("Active"), this);
    _mapper        = new XDataWidgetMapper(this);

    _addrChange->hide();
#if defined Q_OS_MAC   
    _city->setMinimumWidth(110);
#else
    _city->setMinimumWidth(85);
#endif
    if (! DEBUG)
      _number->hide();
    _addrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _cityLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _stateLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _state->setEditable(true);
    _state->setAllowNull(true);
    _country->setMaximumWidth(250);
    _country->setEditable(! (_x_metrics &&
                             _x_metrics->boolean("StrictAddressCountry")));
    if (DEBUG)
      qDebug("%s::_country.isEditable() = %d",
             (objectName().isEmpty() ? "AddressCluster":qPrintable(objectName())),
             _country->isEditable());

    _postalcodeLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _countryLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    _grid->setMargin(0);
    _grid->setSpacing(2);
    _grid->addWidget(_label,         0, 0, 1, -1);
    _grid->addWidget(_addrLit,       1, 0, 3, 1);
    _grid->addWidget(_addr1,         1, 1, 1, -1);
    _grid->addWidget(_addr2,         2, 1, 1, -1);
    _grid->addWidget(_addr3,         3, 1, 1, -1);
    _grid->addWidget(_cityLit,       5, 0);
    _grid->addWidget(_city,          5, 1);
    _grid->addWidget(_stateLit,      5, 2);
    _grid->addWidget(_state,         5, 3);
    _grid->addWidget(_postalcodeLit, 5, 4);
    _grid->addWidget(_postalcode,    5, 5, 1, 2);
    _grid->addWidget(_countryLit,    4, 0);
    _grid->addWidget(_country,       4, 1, 1, 3);
    _grid->addWidget(_active,        4, 4);

    QHBoxLayout* hbox = new QHBoxLayout;
    hbox->addWidget(_list);
    _grid->addLayout(hbox, 4, 5, 1, -1, Qt::AlignRight);

    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 3);
    _grid->setColumnStretch(2, 0);
    _grid->setColumnStretch(3, 1);
    _grid->setColumnStretch(4, 0);
    _grid->setColumnStretch(5, 2);

#if defined Q_OS_MAC
    setMinimumSize(_grid->columnCount() * 60, 132);
#endif

    connect(_list,      SIGNAL(clicked()), this, SLOT(sEllipses()));
    connect(_addr1,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_addr2,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_addr3,     SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_city,      SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_state, SIGNAL(editTextChanged(const QString&)), this, SIGNAL(changed()));
    connect(_state,                      SIGNAL(newID(int)), this, SIGNAL(changed()));
    connect(_postalcode,SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_country,SIGNAL(editTextChanged(const QString&)),this, SLOT(setCountry(const QString&)));
    connect(_country,                    SIGNAL(newID(int)), this, SIGNAL(changed()));
    connect(_country,                    SIGNAL(newID(int)), this, SLOT(populateStateComboBox()));

    connect(_addr1, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_addr2, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_addr3, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_city, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_postalcode, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_addr1, SIGNAL(requestSearch()), this, SLOT(sSearch()));
    connect(_addr2, SIGNAL(requestSearch()), this, SLOT(sSearch()));
    connect(_addr3, SIGNAL(requestSearch()), this, SLOT(sSearch()));
    connect(_city,  SIGNAL(requestSearch()), this, SLOT(sSearch()));
    connect(_postalcode,  SIGNAL(requestSearch()), this, SLOT(sSearch()));

    connect(_addr1,     SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));
    connect(_addr2,     SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));
    connect(_addr3,     SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));
    connect(_city,      SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));
    connect(_postalcode,SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged()));

    setFocusProxy(_addr1);
    setFocusPolicy(Qt::StrongFocus);
    setLabel("");
    setActiveVisible(false);
    silentSetId(-1);
    _list->show();
    _mode = Edit;
}
Пример #18
0
HTREEITEM CTreeFileCtrl::SetSelectedPath(const CString& sPath, BOOL bExpanded)
{
  CString sSearch(sPath);
  int nSearchLength = sSearch.GetLength();
  if (nSearchLength == 0)
  {
    TRACE(_T("Cannot select a empty path\n"));
    return NULL;
  }

  //Remove trailing "\" from the path
  if (nSearchLength > 3 && sSearch.GetAt(nSearchLength-1) == _T('\\'))
    sSearch = sSearch.Left(nSearchLength-1);
  
  //Remove initial part of path if the root folder is setup
  int nRootLength = m_sRootFolder.GetLength();
  if (nRootLength)
  {
    if (sSearch.Find(m_sRootFolder) != 0)
    {
      TRACE(_T("Could not select the path %s as the root has been configued as %s\n"), sPath, m_sRootFolder);
      return NULL;
    }
    sSearch = sSearch.Right(sSearch.GetLength() - 1 - nRootLength);
  }

  if (sSearch.IsEmpty())
    return NULL;

  SetRedraw(FALSE);

  HTREEITEM hItemFound = TVI_ROOT;
  int nFound = sSearch.Find(_T('\\'));
  BOOL bDriveMatch = m_sRootFolder.IsEmpty();
  while (nFound != -1)
  {
    CString sMatch;
    if (bDriveMatch)
    {
      sMatch = sSearch.Left(nFound + 1);
      bDriveMatch = FALSE;
    }
    else
      sMatch = sSearch.Left(nFound);
    hItemFound = FindSibling(hItemFound, sMatch);
    if (hItemFound == NULL)
      break;
    else
      Expand(hItemFound, TVE_EXPAND);

    sSearch = sSearch.Right(sSearch.GetLength() - nFound - 1);
    nFound = sSearch.Find(_T('\\'));
  };

  //The last item 
  if (hItemFound)
  {
    if (sSearch.GetLength())
      hItemFound = FindSibling(hItemFound, sSearch);
    SelectItem(hItemFound);

    if (bExpanded)
      Expand(hItemFound, TVE_EXPAND);
  }

  SetRedraw(TRUE);

  return hItemFound;
}
Пример #19
0
void dspCountTagEditList::sFillList()
{
  _cnttag->clear();

  QString sql( "SELECT invcnt_id, -1 AS cntslip_id, formatBoolYN(invcnt_priority) AS priority,"
               "       CASE WHEN (invcnt_tagnumber IS NULL) THEN 'Misc.'"
               "            ELSE invcnt_tagnumber"
               "       END AS tagnumber,"
               "       TEXT('') AS cntslip_number,"
               "       formatDate(invcnt_tagdate) AS tagdate,"
               "       item_number, warehous_code,"
	       "       CASE WHEN (location_id IS NOT NULL) THEN"
	       "                 location_name"
	       "             ELSE <? value(\"all\") ?>  END AS loc_specific, "
               "       CASE WHEN (invcnt_location_id IS NOT NULL)"
               "                 THEN (SELECT formatQty(SUM(itemloc_qty))"
               "                         FROM itemloc"
               "                        WHERE ((itemloc_itemsite_id=itemsite_id)"
               "                          AND  (itemloc_location_id=invcnt_location_id)) )"
               "            ELSE formatQty(itemsite_qtyonhand)"
               "       END AS qoh,"
               "       CASE WHEN (invcnt_qoh_after IS NOT NULL) THEN formatQty(invcnt_qoh_after)"
	       "            WHEN ( ( SELECT SUM(cntslip_qty)"
               "                     FROM cntslip"
               "                     WHERE (cntslip_cnttag_id=invcnt_id) ) IS NOT NULL ) THEN ( SELECT formatQty(SUM(cntslip_qty))"
               "                                                                                FROM cntslip"
               "                                                                                WHERE (cntslip_cnttag_id=invcnt_id) )"
               "            ELSE ''"
               "       END AS qohafter,"
               "       CASE WHEN (invcnt_qoh_after IS NULL) THEN ''"
               "            ELSE formatQty(invcnt_qoh_after - itemsite_qtyonhand)"
               "       END AS variance,"
               "       CASE WHEN (invcnt_qoh_after IS NULL) THEN ''"
               "            WHEN ((itemsite_qtyonhand = 0) AND (invcnt_qoh_after > 0)) THEN formatScrap(1)"
               "            WHEN ((itemsite_qtyonhand = 0) AND (invcnt_qoh_after < 0)) THEN formatScrap(-1)"
               "            WHEN ((itemsite_qtyonhand = 0) AND (invcnt_qoh_after = 0)) THEN formatScrap(0)"
               "            ELSE (formatScrap((1 - (invcnt_qoh_after / itemsite_qtyonhand)) * -1))"
               "       END AS varianceprcnt,"
               "       (stdcost(item_id) * (invcnt_qoh_after - itemsite_qtyonhand)) AS variancecost,"
               "       item_number AS orderby,"
               "       CASE WHEN (invcnt_qoh_after IS NULL) THEN FALSE"
               "            ELSE TRUE"
               "       END AS hascount "
               "FROM invcnt LEFT OUTER JOIN location ON (invcnt_location_id=location_id),"
	       "     item, warehous, itemsite "
               "WHERE ( (invcnt_itemsite_id=itemsite_id)"
               " AND (itemsite_item_id=item_id)"
               " AND (itemsite_warehous_id=warehous_id)"
               " AND (NOT invcnt_posted)"
	       " <? if exists(\"warehous_id\") ?>"
	       " AND (itemsite_warehous_id=<? value(\"warehous_id\") ?>)"
	       " <? endif ?>"
	       " <? if exists(\"classcode_id\") ?>"
	       " AND (item_classcode_id=<? value(\"classcode_id\") ?>)"
	       " <? elseif exists(\"classcode_pattern\") ?>"
	       " AND (item_classcode_id IN (SELECT classcode_id FROM classcode WHERE (classcode_code ~ <? value(\"classcode_pattern\") ?>)))"
	       " <? elseif exists(\"plancode_id\") ?>"
	       " AND (itemsite_plancode_id=<? value(\"plancode_id\") ?>)"
	       " <? elseif exists(\"plancode_pattern\") ?>"
	       " AND (itemsite_plancode_id IN (SELECT plancode_id FROM plancode WHERE (plancode_code ~ <? value(\"plancode_pattern\") ?>)))"
	       " <? endif ?>"
	       " <? if exists(\"showSlips\") ?>"
	       " ) "
	       "UNION "
	       "SELECT invcnt_id, cntslip_id, formatBoolYN(invcnt_priority) AS priority,"
	       "       '' AS tagnumber, cntslip_number,"
	       "       formatDate(cntslip_entered) AS tagdate,"
	       "       CASE WHEN (cntslip_posted) THEN <? value(\"posted\") ?>"
	       "            ELSE <? value(\"unposted\") ?>"
	       "       END AS item_number,"
	       "       '' AS warehous_code, "
	       "       '' AS loc_specific, "
	       "       '' AS qoh,"
	       "       formatQty(cntslip_qty) AS qohafter,"
	       "       '' AS variance, '' AS varianceprcnt, 0 AS variancecost,"
	       "       item_number AS orderby,"
	       "       FALSE AS hascount "
	       "FROM cntslip, invcnt, itemsite, item "
	       "WHERE ( (cntslip_cnttag_id=invcnt_id)"
	       " AND (invcnt_itemsite_id=itemsite_id)"
	       " AND (itemsite_item_id=item_id)"
	       " AND (NOT invcnt_posted)"
	       " <? if exists(\"warehous_id\") ?>"
	       " AND (itemsite_warehous_id=<? value(\"warehous_id\") ?>)"
	       " <? endif ?>"
	       " <? if exists(\"classcode_id\") ?>"
	       " AND (item_classcode_id=<? value(\"classcode_id\") ?>)"
	       " <? elseif exists(\"classcode_pattern\") ?>"
	       " AND (item_classcode_id IN (SELECT classcode_id FROM classcode WHERE (classcode_code ~ <? value(\"classcode_pattern\") ?>)))"
	       " <? elseif exists(\"plancode_id\") ?>"
	       " AND (itemsite_plancode_id=<? value(\"plancode_id\") ?>)"
	       " <? elseif exists(\"plancode_pattern\") ?>"
	       " AND (itemsite_plancode_id IN (SELECT plancode_id FROM plancode WHERE (plancode_code ~ <? value(\"plancode_pattern\") ?>)))"
	       " <? endif ?>"
	       " <? endif ?>"
	       " ) "
	       "ORDER BY priority DESC, orderby, invcnt_id, cntslip_id;" );

  ParameterList params;
  setParams(params);
  params.append("all",	    tr("All"));
  params.append("posted",   tr("Posted"));
  params.append("unposted", tr("Unposted"));
  if (_showSlips->isChecked())
    params.append("showSlips");

  MetaSQLQuery mql(sql);
  q = mql.toQuery(params);

  if (q.first())
  {
    XTreeWidgetItem *countTag = NULL;
    int             invcntid  = -1;

    do
    {
      if (q.value("cntslip_id").toInt() == -1)
      {
        if (invcntid != q.value("invcnt_id").toInt())
        {
          invcntid = q.value("invcnt_id").toInt();
          countTag = new XTreeWidgetItem( _cnttag, countTag,
                                        q.value("invcnt_id").toInt(), q.value("cntslip_id").toInt(),
                                        q.value("priority"), q.value("tagnumber"),
                                        q.value("tagdate"), q.value("item_number"),
                                        q.value("warehous_code"),
					q.value("loc_specific"),
					q.value("qoh"),
                                        q.value("qohafter"), q.value("variance"),
                                        q.value("varianceprcnt"), formatCost(q.value("variancecost").toDouble()) );

          if ( ( (_highlightValue->isChecked()) && (_varianceValue->text().length()) &&
                 (fabs(q.value("variancecost").toDouble()) > _varianceValue->toDouble()) ) ||
               ( (_highlightPercent->isChecked()) && (_variancePercent->text().length()) &&
                 (fabs(q.value("varianceprcnt").toDouble()) > _variancePercent->toDouble()) ) )
            countTag->setTextColor("red");

          if (!q.value("hascount").toBool())
            countTag->setTextColor(7, "blue");
        }
      }
      else if (countTag)
        new XTreeWidgetItem( countTag, q.value("invcnt_id").toInt(), q.value("cntslip_id").toInt(),
                           "", q.value("cntslip_number"),
                           q.value("tagdate"), q.value("item_number"),
                           "", "", "",
                           q.value("qohafter"), "" );
    }
    while (q.next());
  }
  if (q.lastError().type() != QSqlError::None)
  {
    systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }
  
  _cnttag->expandAll();

  if (_searchFor->text().stripWhiteSpace().length())
    sSearch(_searchFor->text());
}
Пример #20
0
VirtualClusterLineEdit::VirtualClusterLineEdit(QWidget* pParent,
					       const char* pTabName,
					       const char* pIdColumn,
					       const char* pNumberColumn,
					       const char* pNameColumn,
					       const char* pDescripColumn,
					       const char* pExtra,
                                               const char* pName,
                                               const char* pActiveColumn) :
    XLineEdit(pParent, pName)
{
    if (DEBUG)
      qDebug("VirtualClusterLineEdit(%p, %s, %s, %s, %s, %s, %s, %s, %s)",
             pParent ? pParent : 0,         pTabName ? pTabName : "",
             pIdColumn ? pIdColumn : "",     pNumberColumn ? pNumberColumn : "",
             pNameColumn ? pNameColumn : "",
             pDescripColumn ? pDescripColumn : "",
             pExtra ? pExtra : "",           pName ? pName : "",
             pActiveColumn ? pActiveColumn : "");

    setObjectName(pName ? pName : "VirtualClusterLineEdit");

    _valid  = false;
    _parsed = true;
    _strict = true;
    _completer = 0;
    _showInactive = false;

    setTableAndColumnNames(pTabName, pIdColumn, pNumberColumn, pNameColumn, pDescripColumn, pActiveColumn);

    if (pExtra && QString(pExtra).trimmed().length())
	_extraClause = pExtra;

    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);

    clear();
    _titleSingular = tr("Object");
    _titlePlural = tr("Objects");

    // Completer set up
    if (_x_metrics)
    {
      if (!_x_metrics->boolean("DisableAutoComplete"))
      {
        QSqlQueryModel* hints = new QSqlQueryModel(this);
        _completer = new QCompleter(hints,this);
        _completer->setWidget(this);
        QTreeView* view = new QTreeView(this);
        view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        view->setHeaderHidden(true);
        view->setRootIsDecorated(false);
        _completer->setPopup(view);
        _completer->setCaseSensitivity(Qt::CaseInsensitive);
        _completer->setCompletionColumn(1);
        _completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
        connect(this, SIGNAL(textEdited(QString)), this, SLOT(sHandleCompleter()));
        connect(_completer, SIGNAL(highlighted(QString)), this, SLOT(setText(QString)));
      }
    }

    // Set up actions
    connect(_listAct, SIGNAL(triggered()), this, SLOT(sList()));
    connect(_searchAct, SIGNAL(triggered()), this, SLOT(sSearch()));

    _infoAct = new QAction(tr("Info..."), this);
    _infoAct->setShortcut(QKeySequence(tr("Ctrl+Shift+I")));
    _infoAct->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    _infoAct->setToolTip(tr("View record information"));
    _infoAct->setEnabled(false);
    connect(_infoAct, SIGNAL(triggered()), this, SLOT(sInfo()));
    addAction(_infoAct);

    _openAct = new QAction(tr("Open..."), this);
    _openAct->setShortcut(QKeySequence(tr("Ctrl+Shift+O")));
    _openAct->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    _openAct->setToolTip(tr("Open record detail"));
    _openAct->setEnabled(false);
    connect(_openAct, SIGNAL(triggered()), this, SLOT(sOpen()));
    addAction(_openAct);

    _newAct = new QAction(tr("New..."), this);
    _newAct->setShortcut(QKeySequence(tr("Ctrl+Shift+N")));
    _newAct->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    _newAct->setToolTip(tr("Create new record"));
    _newAct->setEnabled(false);
    connect(_newAct, SIGNAL(triggered()), this, SLOT(sNew()));
    addAction(_newAct);

    connect(this, SIGNAL(valid(bool)), _infoAct, SLOT(setEnabled(bool)));

    _menuLabel = new QLabel(this);
    // Menu set up

    _menu = 0;
    _menuLabel->setPixmap(QPixmap(":/widgets/images/magnifier.png"));
    _menuLabel->installEventFilter(this);

    int height = minimumSizeHint().height();
    QString sheet = QLatin1String("QLineEdit{ padding-right: ");
    sheet += QString::number(_menuLabel->pixmap()->width() + 6);
    sheet += QLatin1String(";}");
    setStyleSheet(sheet);
    // Little hack. Somehow style sheet makes widget short. Put back height.
    setMinimumHeight(height);

    // Set default menu with standard actions
    QMenu* menu = new QMenu;
    menu->addAction(_listAct);
    menu->addAction(_searchAct);
    menu->addSeparator();
    menu->addAction(_infoAct);
    setMenu(menu);

    connect(this, SIGNAL(valid(bool)), this, SLOT(sUpdateMenu()));
    connect(menu, SIGNAL(aboutToShow()), this, SLOT(sUpdateMenu()));
  }
Пример #21
0
GLCluster::GLCluster(QWidget *pParent, const char *name) :
  QWidget(pParent, name)
{
//  Create and place the component Widgets
  QHBoxLayout *_layoutMain = new QHBoxLayout(this);
  _layoutMain->setMargin(0);
  _layoutMain->setSpacing(5);
  QWidget * _layoutFieldsWidget = new QWidget(this);
  QHBoxLayout *_layoutFields = new QHBoxLayout(_layoutFieldsWidget);
  _layoutFields->setMargin(0);
  _layoutFields->setSpacing(2);

  _type = cUndefined;

  _company = 0;
  _profit = 0;
  _sub = 0;
  if (_x_metrics && !_x_metrics->boolean("AllowManualGLAccountEntry")) 
  {
    if (_x_metrics->value("GLCompanySize").toInt() > 0)
    {
      _company = new QLineEdit(_layoutFieldsWidget, "_company");
      _company->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
      _company->setMaximumWidth(40);
      _company->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
      _company->setReadOnly(TRUE);
      _company->setPaletteBackgroundColor(QColor("lightgrey"));
      _company->setFocusPolicy(Qt::NoFocus);
      _layoutFields->addWidget(_company);

      QLabel *_sep1Lit = new QLabel(tr("-"), _layoutFieldsWidget, "_sep1Lit");
      _sep1Lit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
      _layoutFields->addWidget(_sep1Lit);
    }

    if (_x_metrics->value("GLProfitSize").toInt() > 0)
    {
      _profit = new QLineEdit(_layoutFieldsWidget, "_profit");
      _profit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
      _profit->setMaximumWidth(40);
      _profit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
      _profit->setReadOnly(TRUE);
      _profit->setPaletteBackgroundColor(QColor("lightgrey"));
      _profit->setFocusPolicy(Qt::NoFocus);
      _layoutFields->addWidget(_profit);

      QLabel *_sep2Lit = new QLabel(tr("-"), _layoutFieldsWidget, "_sep2Lit");
      _sep2Lit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
      _layoutFields->addWidget(_sep2Lit);
    }
  }

  _main = new XLineEdit(_layoutFieldsWidget, "_main");
  _main->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
  _main->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
  if(!(_x_metrics && _x_metrics->boolean("AllowManualGLAccountEntry")))
  {
    _main->setReadOnly(TRUE);
    _main->setPaletteBackgroundColor(QColor("lightgrey"));
    _main->setFocusPolicy(Qt::NoFocus);
  }
  _layoutFields->addWidget(_main);

  if (_x_metrics && !_x_metrics->boolean("AllowManualGLAccountEntry"))
  {
    if (_x_metrics->value("GLSubaccountSize").toInt() > 0)
    {
      QLabel *_sep3Lit = new QLabel(tr("-"), _layoutFieldsWidget,  "_sep3Lit");
      _sep3Lit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
      _layoutFields->addWidget(_sep3Lit);

      _sub = new QLineEdit(_layoutFieldsWidget, "_sub");
      _sub->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
      _sub->setMaximumWidth(40);
      _sub->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
      _sub->setReadOnly(TRUE);
      _sub->setPaletteBackgroundColor(QColor("lightgrey"));
      _sub->setFocusPolicy(Qt::NoFocus);
      _layoutFields->addWidget(_sub);
    }
  }

  _layoutFieldsWidget->setLayout(_layoutFields);
  _layoutMain->addWidget(_layoutFieldsWidget);

  _account = new QLineEdit(this, "_account");
  _account->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
  _account->setReadOnly(TRUE);
  _account->setPaletteBackgroundColor(QColor("lightgrey"));
  _account->setFocusPolicy(Qt::NoFocus);
  _layoutMain->addWidget(_account);

  _list = new QPushButton(tr("..."), this, "_list");
#ifndef Q_WS_MAC
  _list->setMaximumWidth(25);
#endif
  _list->setFocusPolicy(Qt::NoFocus);
  _layoutMain->addWidget(_list);

  setLayout(_layoutMain);

//  Make some internal connections
  connect(_list, SIGNAL(clicked()), this, SLOT(sEllipses()));
  if(_x_metrics && _x_metrics->boolean("AllowManualGLAccountEntry"))
  {
    connect(_main, SIGNAL(lostFocus()), this, SLOT(sParse()));
    connect(_main, SIGNAL(textChanged(const QString &)), this, SLOT(sTextChanged(const QString &)));
    connect(_main, SIGNAL(requestList()), this, SLOT(sList()));
    connect(_main, SIGNAL(requestSearch()), this, SLOT(sSearch()));
  }