Example #1
0
// ### TODO ###
// переработать алгоритм
void LineEdit::addOperator(CalcObject *co)
{
    if(co->getOperator().at(0) == '(')
    {
        postfix.push(co);
        return;
    }

    if(co->isUnary())
    {
        Number n = m_numbers.pop();
        n = co->calc(n);
        m_numbers.push(n);
        setText(n.toString());
        emit numberChanged(n);

#ifndef QT_NO_DEBUG
        qDebug() << m_numbers;
        qDebug() << postfix;
#endif
        return;
    }

#ifndef QT_NO_DEBUG
    qDebug() << "m_waitOperand: " << m_waitOperand;
#endif

    if(m_waitOperand)   // пользователь просто меняет знак операции
    {
        if(!postfix.isEmpty())
            postfix.pop();
        postfix.push(co);
        m_operator = co->getOperator();
        repaint();
        return;
    }

    p_calc(co);

    m_waitOperand = true;    
    setText(getNumber().toString());
    emit numberChanged(getNumber());
    repaint();

#ifndef QT_NO_DEBUG
    qDebug() << m_numbers;
    qDebug() << postfix;
#endif
}
void Round::setNumber(int number)
{
	if(number == this->number())
		return;
	setValue(RoundProperties::NumberAttribute,QVariant::fromValue<int>(number));
	emit numberChanged(number);
}
printShippingForm::printShippingForm(QWidget* parent, const char * name, Qt::WindowFlags fl)
    : XDialog(parent, name, fl)
{
  setupUi(this);

  // programatically hiding -- see issue # 5853.
  _shipchrg->hide();
  _shipchrgLit->hide();

  connect(_buttonBox, SIGNAL(accepted()), this, SLOT(sPrint()));
  connect(_shipformNumOfCopies, SIGNAL(valueChanged(int)), this, SLOT(sHandleShippingFormCopies(int)));
  connect(_shipformWatermarks, SIGNAL(itemSelected(int)), this, SLOT(sEditShippingFormWatermark()));
  connect(_shipment,	SIGNAL(newId(int)),	this, SLOT(sHandleShipment()));
  connect(_order,	SIGNAL(numberChanged(QString,QString)),	this, SLOT(sHandleOrder()));

  _captive = FALSE;
  _order->setAllowedTypes(OrderLineEdit::Sales | OrderLineEdit::Transfer);
  _order->setLabel("");
  _shipment->setStatus(ShipmentClusterLineEdit::AllStatus);
  _shipment->setStrict(true);

  _shipformWatermarks->addColumn( tr("Copy #"),      _dateColumn, Qt::AlignCenter );
  _shipformWatermarks->addColumn( tr("Watermark"),   -1,          Qt::AlignLeft   );
  _shipformWatermarks->addColumn( tr("Show Prices"), _dateColumn, Qt::AlignCenter );
  _shipformNumOfCopies->setValue(_metrics->value("ShippingFormCopies").toInt());

  if (_shipformNumOfCopies->value())
  {
    for (int counter = 0; counter < _shipformWatermarks->topLevelItemCount(); counter++)
    {
    _shipformWatermarks->topLevelItem(counter)->setText(1, _metrics->value(QString("ShippingFormWatermark%1").arg(counter)));
    _shipformWatermarks->topLevelItem(counter)->setText(2, ((_metrics->boolean(QString("ShippingFormShowPrices%1").arg(counter))) ? tr("Yes") : tr("No")));
    }
  }
}
Example #4
0
void PhoneDetails::getNumber()
{
    QString res;
    bool bOK = true;
    if (cmbCountry->currentItem() > 0){
        res = "+";
        int i = cmbCountry->currentItem() - 1;
        const ext_info *c;
        for (c = countries; i && *c->szName; c++, i--);
        res += QString::number(c->nCode);
        res += " ";
    }else{
        bOK = false;
    }
    if (edtAreaCode->text().length() > 0){
        res += "(";
        res += edtAreaCode->text();
        res += ") ";
    }else{
        bOK = false;
    }
    if (edtNumber->text().length() > 0){
        res += edtNumber->text();
    }else{
        bOK = false;
    }
    if (edtExtension->isVisible() && (edtExtension->text().length() > 0)){
        res += " - ";
        res += edtExtension->text();
    }
    emit numberChanged(res, bOK);
}
Example #5
0
void PhoneDetails::getNumber()
{
    QString res;
    bool bOK = true;
    if (cmbCountry->currentItem() > 0){
        res = "+";
        res += QString::number(getComboValue(cmbCountry, countries));
        res += " ";
    }else{
        bOK = false;
    }
    if (edtAreaCode->text().length() > 0){
        res += "(";
        res += edtAreaCode->text();
        res += ") ";
    }else{
        bOK = false;
    }
    if (edtNumber->text().length() > 0){
        res += edtNumber->text();
    }else{
        bOK = false;
    }
    if (edtExtension->isVisible() && (edtExtension->text().length() > 0)){
        res += " - ";
        res += edtExtension->text();
    }
    emit numberChanged(res, bOK);
}
Example #6
0
void AMScan::setNumber(int number) {
    if(number_ != number) {
        number_ = number;
        setModified(true);
        emit numberChanged(number_);
    }
}
Example #7
0
void SoLineEdit::setId(int pId)
{
  if (pId == _id)
    return;

  XSqlQuery sohead;
  sohead.prepare( "SELECT cohead_number, cohead_cust_id, cohead_billtoname "
                  "FROM cohead, cust "
                  "WHERE ( (cohead_cust_id=cust_id)"
                  " AND (cohead_id=:sohead_id) );" );
  sohead.bindValue(":sohead_id", pId);
  sohead.exec();
  if (sohead.first())
  {
    _id     = pId;
    _number = sohead.value("cohead_number").toInt();
    _custid = sohead.value("cohead_cust_id").toInt();
    _valid  = TRUE;

    emit numberChanged(sohead.value("cohead_number").toString());
    emit custNameChanged(sohead.value("cohead_billtoname").toString());

    setText(sohead.value("cohead_number").toString());
  }
  else
  {
    _id     = -1;
    _number = -1;
    _custid = -1;
    _valid  = FALSE;

    emit numberChanged("");
    emit custNameChanged("");
    setText("");
  }

  emit newId(_id);
  emit custidChanged(_custid);
  emit numberChanged(_number);
  emit valid(_valid);

  _parsed = TRUE;
}
Example #8
0
void Thread::run()
{
    for(int i=0;i<100000000;i++)
    {
        QMutex mutex;
        mutex.lock();
        if(this->stop) break;
        mutex.unlock();

        emit numberChanged(i);
        this->msleep(100);
    }
}
Example #9
0
void LineEdit::insertNumber(Number n)
{
    if(m_waitOperand)
        m_waitOperand = false;
    else
        m_numbers.pop();
    m_numbers.push(n);
    setText(n.toString());
    emit numberChanged(n);

#ifndef QT_NO_DEBUG
    qDebug() << m_numbers;
#endif
}
Example #10
0
void PagerDetails::getNumber()
{
    bool bOK = true;
    QString res;
    if (edtNumber->text().length() > 0){
        res = edtNumber->text();
    }else{
        bOK = false;
    }
    if (edtGateway->text().length() > 0){
        res += "@";
        res += edtGateway->text();
    }else{
        bOK = false;
    }
    emit numberChanged(res, bOK);
}
Example #11
0
void E1Dialer::activeCallCount( int c )
{
    if( m_activeCallCount != c ) {
        if( m_activeCallCount == 0 || c == 0 )
            m_input->setText( QString() );// active calls exist changed, clear
                                        // if no active calls, person dials number, callscreen shows, back to dialer, no number dispayed
                                       // if on a call, go to dialer, dial dtmf, go to callscreen, end call, back to dialer, no number displayed
        m_activeCallCount = c;
        m_callscreenBar->setVisible( c != 0 );
        if( m_activeCallCount != 0 ) {
            if(isVisible())
                m_textButton->setText(" ");
        } else {
            if( m_input->text().isEmpty() )
                numberChanged( QString() ); // manually force and update if text doesn't change
        }
    }
}
Example #12
0
void Widget::mouseReleaseEvent(QMouseEvent *event)
{
	qreal angle;
	qreal longEnough = 3;
	if ((vecBegin - vecEnd).manhattanLength() >= longEnough)
		// The direction is set by user
		angle = (qreal)atan2(vecEnd.y()-vecBegin.y(), vecEnd.x()-vecBegin.x());
	else
		// The direction is default
		if (randomDefDir)
			angle = (2*M_PI / 360) * (rand() % 360);
		else
			angle = (2*M_PI / 360) * (defDir - 90);
	model->add(vecBegin.x(), vecBegin.y(), angle);
	vecBegin = QPoint(-1, -1);
	repaint();
	numberChanged(model->getNumber());
}
Example #13
0
void ToLineEdit::setId(int pId)
{
  if (pId == _id)
    return;

  XSqlQuery tohead;
  tohead.prepare( "SELECT tohead_number, tohead_src_warehous_id,"
		  "       tohead_dest_warehous_id "
                  "FROM tohead "
                  "WHERE (tohead_id=:tohead_id);" );
  tohead.bindValue(":tohead_id", pId);
  tohead.exec();
  if (tohead.first())
  {
    _id     = pId;
    _number = tohead.value("tohead_number").toInt();
    _srcwhs = tohead.value("tohead_src_warehous_id").toInt();
    _dstwhs = tohead.value("tohead_dest_warehous_id").toInt();
    _valid  = TRUE;

    setText(tohead.value("tohead_number").toString());
  }
  else
  {
    _id     = -1;
    _number = -1;
    _srcwhs = -1;
    _dstwhs = -1;
    _valid  = false;

    setText("");
  }

  emit newId(_id);
  emit numberChanged(_number);
  emit newSrcwhs(_srcwhs);
  emit newDstwhs(_dstwhs);
  emit valid(_valid);

  _parsed = TRUE;
}
Example #14
0
/*
 * нужно переработать класс (но сохранить интерфейсы)
 * Сейчас одни и те же действия выполняются в каждой функции отдельно.
 * Либо отвести для этих целей отдельную функцию, либо переработать сам
 * алгоритм (последнее, скорее всего, затронет интерфейсы).
 *
 * Обязанность за ввод числа в стек и вывод на экран может
 * принять на себя insertNumber()
 *
 * Очищать m_numbers, если postfix пустой
 */
void LineEdit::addChar(QChar c)
{
    if(m_waitOperand)
    {
        setText(tr("0"));
        m_waitOperand = false;
    }
    else
        m_numbers.pop();

    QString t = text();
    if(t == tr("0")) t = "";
    t = t.append(c);
    m_numbers.push(Number::toNumber(t));
    setText(t);

    // возможно, появятся проблемы, когда будет несколько систем счисления
    emit numberChanged(getNumber());

#ifndef QT_NO_DEBUG
    qDebug() << m_numbers;
#endif
}
Example #15
0
void LineEdit::calculate()
{
    // не могу объяснить, зачем условие.. так работает
    if(m_waitOperand)
        m_numbers.push(Number::toNumber(text()));

#ifndef QT_NO_DEBUG
    qDebug() << m_numbers;
#endif

    Number n;

    while(!postfix.isEmpty())
    {
        CalcObject *c1 = postfix.pop();
        n = binaryOperation(c1);
        m_numbers.push(n);
    }

    clearAll();
    m_numbers.push(n);
    setText(n.toString());
    emit numberChanged(n);
}
 void ContactEdit::setNumber(QVariant newNumber)
 {qDebug()<<"setNumber called";
     numberFromModel=newNumber;
     emit numberChanged();
 }
Example #17
0
void PoLineEdit::setId(int pId)
{
  if ((_x_preferences) && (pId != -1))
  {
    if (_x_preferences->boolean("selectedSites"))
    {
      QString msql("SELECT poitem_id "
                  "FROM poitem, itemsite "
                  "WHERE ((poitem_pohead_id=<? value(\"pohead_id\") ?>) "
                  "  AND (poitem_itemsite_id=itemsite_id) "
                  "  AND (itemsite_warehous_id NOT IN ("
                  "       SELECT usrsite_warehous_id "
                  "       FROM usrsite "
                  "       WHERE (usrsite_username=current_user)))) "
                  "UNION "
                  "SELECT pohead_warehous_id "
                  "FROM pohead "
                  "WHERE ((pohead_id=<? value(\"pohead_id\") ?>) "
                  "  AND (pohead_warehous_id NOT IN ("
                  "       SELECT usrsite_warehous_id "
                  "       FROM usrsite "
                  "       WHERE (usrsite_username=current_user))));");
      MetaSQLQuery mql(msql);
      ParameterList params;
      params.append("pohead_id", pId);
      XSqlQuery chk = mql.toQuery(params);
      if (chk.first())
      {
              QMessageBox::critical(this, tr("Access Denied"),
                                    tr("You may not view or edit this Purchase Order as it references "
                                       "a warehouse for which you have not been granted privileges.")) ;
              setId(-1);
              return;
      }
    }
  }

  QString sql( "SELECT pohead_number, pohead_vend_id,"
               "       vend_name, vend_address1, vend_address2, vend_address3,"
               "       (vend_city || '  ' || vend_state || '  ' || vend_zip) AS citystatezip "
               "FROM pohead, vend "
               "WHERE ( (pohead_vend_id=vend_id)"
               " AND (pohead_id=:pohead_id)" );

  if (_type & (cPOUnposted | cPOOpen | cPOClosed))
  {
    bool qualifier = FALSE;

    sql += " AND (pohead_status IN (";

    if (_type & cPOUnposted)
    {
      qualifier = TRUE;
      sql += "'U'";
    }
    
    if (_type & cPOOpen)
    {
      if (qualifier)
        sql += ", ";
      else
        qualifier = TRUE;

      sql += "'O'";
    }

    if (_type & cPOClosed)
    {
      if (qualifier)
        sql += ", ";
      else
        qualifier = TRUE;

      sql += "'C'";
    }

    sql += "))";
  }

  sql += " );";
  XSqlQuery pohead;
  pohead.prepare(sql);
  pohead.bindValue(":pohead_id", pId);
  pohead.exec();
  if (pohead.first())
  {
    _id     = pId;
    _number = pohead.value("pohead_number").toInt();
    _vendid = pohead.value("pohead_vend_id").toInt();
    _valid  = TRUE;

    emit numberChanged(pohead.value("pohead_number").toString());
    emit vendNameChanged(pohead.value("vend_name").toString());
    emit vendAddress1Changed(pohead.value("vend_address1").toString());
    emit vendAddress2Changed(pohead.value("vend_address2").toString());
    emit vendAddress3Changed(pohead.value("vend_address3").toString());
    emit vendCityStateZipChanged(pohead.value("citystatezip").toString());
    setText(pohead.value("pohead_number").toString());
  }
  else
  {
    _id     = -1;
    _number = -1;
    _vendid = -1;
    _valid  = FALSE;

    emit numberChanged("");
    emit vendNameChanged("");
    emit vendAddress1Changed("");
    emit vendAddress2Changed("");
    emit vendAddress3Changed("");
    emit vendCityStateZipChanged("");
    setText("");
  }

  emit newId(_id);
  emit vendidChanged(_vendid);
  emit numberChanged(_number);
  emit valid(_valid);

  if (_mapper->model() &&
      _mapper->model()->data(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this))).toString() != text())
    _mapper->model()->setData(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this)), text());
              
  _parsed = TRUE;
}
Example #18
0
// очищаем только экран
void LineEdit::clearSlot()
{
    setText(tr("0"));
    m_waitOperand = true;
    emit numberChanged(0);
}
Example #19
0
void E1Dialer::setActive()
{
    if(isVisible())
        numberChanged(m_input->text());
}
Example #20
0
void OrderLineEdit::sParse()
{
  bool oldvalid = _valid;
  if (! _parsed)
  {
    QString stripped = text().trimmed().toUpper();
    if (stripped.length() == 0)
    {
      _parsed = true;
      setId(-1);
    }
    else
    {
      QString oldExtraClause = _extraClause;

      XSqlQuery countQ;
      countQ.prepare("SELECT COUNT(*) AS count FROM orderhead WHERE (TRUE) " +
		      _numClause +
		      (_extraClause.isEmpty() || !_strict ? "" : " AND " + _extraClause) +
		      QString(";"));
      countQ.bindValue(":number", text());
      countQ.exec();
      if (countQ.first())
      {
	int result = countQ.value("count").toInt();
	if (result <= 0)
	{
	  _id = -1;
	  XLineEdit::clear();
	}
	else if (result == 1)
	{
	  XSqlQuery numQ;
	  numQ.prepare(_query + _numClause +
		      (_extraClause.isEmpty() || !_strict ? "" : " AND " + _extraClause) +
		      QString(";"));
	  numQ.bindValue(":number", text());
	  numQ.exec();
	  if (numQ.first())
	  {
	    _valid = true;
	    setId(numQ.value("id").toInt(), numQ.value("name").toString());
	    _description	= numQ.value("description").toString();
	    _from		= numQ.value("orderhead_from").toString();
	    _to		= numQ.value("orderhead_to").toString();
	  }
	  else if (numQ.lastError().type() != QSqlError::NoError)
	    QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.")
					  .arg(__FILE__)
					  .arg(__LINE__),
				  numQ.lastError().databaseText());
	}
	else
	{
	  _extraClause += "AND (orderhead_number=" + text() + ")";
	  sEllipses();
	  _extraClause += "AND (orderhead_type='" + type() + "')";
	}
      }
      else if (countQ.lastError().type() != QSqlError::NoError)
      {
	QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.")
				      .arg(__FILE__)
				      .arg(__LINE__),
			      countQ.lastError().databaseText());
      }

      _extraClause = oldExtraClause;
    }
  }

  _parsed = true;
  if (_valid != oldvalid)
    emit valid(_valid);
  emit parsed();
  emit numberChanged(text(), _name);
}
Example #21
0
void OrderLineEdit::sNewId(const int p)
{
  emit newId(p, _name);
  emit numberChanged(text(), _name);
}
Example #22
0
void SoLineEdit::setId(int pId)
{
  if (pId == _id)
    return;

  if ((_x_preferences) && (pId != -1) && (_sitePrivs))
  {
    if (_x_preferences->boolean("selectedSites"))
    {
      QString sql("SELECT coitem_id "
                  "FROM coitem, itemsite "
                  "WHERE ((coitem_cohead_id=<? value(\"sohead_id\") ?>) "
                  "  AND (coitem_itemsite_id=itemsite_id) "
                  "  AND (itemsite_warehous_id NOT IN ("
                  "       SELECT usrsite_warehous_id "
                  "       FROM usrsite "
                  "       WHERE (usrsite_username=current_user)))) "
                  "UNION "
                  "SELECT cohead_warehous_id "
                  "FROM cohead "
                  "WHERE ((cohead_id=<? value(\"sohead_id\") ?>) "
                  "  AND (cohead_warehous_id NOT IN ("
                  "       SELECT usrsite_warehous_id "
                  "       FROM usrsite "
                  "       WHERE (usrsite_username=current_user))));");
      MetaSQLQuery mql(sql);
      ParameterList params;
      params.append("sohead_id", pId);
      XSqlQuery chk = mql.toQuery(params);
      if (chk.first())
      {
              QMessageBox::critical(this, tr("Access Denied"),
                                    tr("You may not view or edit this Sales Order as it references "
                                       "a warehouse for which you have not been granted privileges.")) ;
              setId(-1);
              return;
      }
    }
  }


  XSqlQuery sohead;
  sohead.prepare( "SELECT cohead_number, cohead_cust_id, cohead_billtoname "
                  "FROM cohead, cust "
                  "WHERE ( (cohead_cust_id=cust_id)"
                  " AND (cohead_id=:sohead_id) );" );
  sohead.bindValue(":sohead_id", pId);
  sohead.exec();
  if (sohead.first())
  {
    _id     = pId;
    _number = sohead.value("cohead_number").toInt();
    _custid = sohead.value("cohead_cust_id").toInt();
    _valid  = TRUE;

    emit numberChanged(sohead.value("cohead_number").toString());
    emit custNameChanged(sohead.value("cohead_billtoname").toString());

    setText(sohead.value("cohead_number").toString());
    
    if (_mapper->model() &&
        _mapper->model()->data(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this))).toString() != text())
      _mapper->model()->setData(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this)), text());
  }
  else
  {
    _id     = -1;
    _number = -1;
    _custid = -1;
    _valid  = FALSE;

    emit numberChanged("");
    emit custNameChanged("");
    setText("");
  }

  emit newId(_id);
  emit custidChanged(_custid);
  emit numberChanged(_number);
  emit valid(_valid);

  _parsed = TRUE;
}
Example #23
0
void PoLineEdit::setId(int pId)
{
  QString sql( "SELECT pohead_number, pohead_vend_id,"
               "       vend_name, vend_address1, vend_address2, vend_address3,"
               "       (vend_city || '  ' || vend_state || '  ' || vend_zip) AS citystatezip "
               "FROM pohead, vend "
               "WHERE ( (pohead_vend_id=vend_id)"
               " AND (pohead_id=:pohead_id)" );

  if (_type & (cPOUnposted | cPOOpen | cPOClosed))
  {
    bool qualifier = FALSE;

    sql += " AND (pohead_status IN (";

    if (_type & cPOUnposted)
    {
      qualifier = TRUE;
      sql += "'U'";
    }
    
    if (_type & cPOOpen)
    {
      if (qualifier)
        sql += ", ";
      else
        qualifier = TRUE;

      sql += "'O'";
    }

    if (_type & cPOClosed)
    {
      if (qualifier)
        sql += ", ";
      else
        qualifier = TRUE;

      sql += "'C'";
    }

    sql += "))";
  }

  sql += " );";
  XSqlQuery pohead;
  pohead.prepare(sql);
  pohead.bindValue(":pohead_id", pId);
  pohead.exec();
  if (pohead.first())
  {
    _id     = pId;
    _number = pohead.value("pohead_number").toInt();
    _vendid = pohead.value("pohead_vend_id").toInt();
    _valid  = TRUE;

    emit numberChanged(pohead.value("pohead_number").toString());
    emit vendNameChanged(pohead.value("vend_name").toString());
    emit vendAddress1Changed(pohead.value("vend_address1").toString());
    emit vendAddress2Changed(pohead.value("vend_address2").toString());
    emit vendAddress3Changed(pohead.value("vend_address3").toString());
    emit vendCityStateZipChanged(pohead.value("citystatezip").toString());
    setText(pohead.value("pohead_number").toString());
  }
  else
  {
    _id     = -1;
    _number = -1;
    _vendid = -1;
    _valid  = FALSE;

    emit numberChanged("");
    emit vendNameChanged("");
    emit vendAddress1Changed("");
    emit vendAddress2Changed("");
    emit vendAddress3Changed("");
    emit vendCityStateZipChanged("");
    setText("");
  }

  emit newId(_id);
  emit vendidChanged(_vendid);
  emit numberChanged(_number);
  emit valid(_valid);

  _parsed = TRUE;
}
Example #24
0
// define E1Dialer
E1Dialer::E1Dialer( E1Button *b, QWidget* parent, Qt::WFlags f )
    : QWidget( parent, f | Qt::FramelessWindowHint ), m_textButton(b), m_activeCallCount(0)
{
    QVBoxLayout* vlayout = new QVBoxLayout( this );
    vlayout->setSpacing( 7 );
    vlayout->setMargin( 7 );

    // dialer interface

    // callhistory, input, backspace
    QHBoxLayout* hlayout1 = new QHBoxLayout();
    vlayout->addLayout( hlayout1 );
    hlayout1->setSpacing( 10 );
    hlayout1->setMargin( 0 );

    E1Bar * historyBar = new E1Bar(this);
    QPalette pal = palette();
    pal.setColor(QPalette::Highlight, QColor(255, 126, 0));
    historyBar->setPalette(pal);
    historyBar->setFixedSize(30, 20);
    historyBar->setBorder(E1Bar::ButtonBorder);
    E1Button *historyButton = new E1Button;
    historyButton->setPixmap(QPixmap(":image/samples/e1_callhistory"));
    historyBar->addItem(historyButton);
    connect(historyButton, SIGNAL(clicked()), this, SLOT(historyClicked()));
    hlayout1->addWidget( historyBar );

    m_input = new QLineEdit( this );
    m_input->setStyle( new QWindowsStyle );
    m_input->setFixedSize( 152, 24 );
    hlayout1->addWidget( m_input );
    connect( m_input, SIGNAL(textChanged(QString)), this, SLOT(numberChanged(QString)) );

    E1Bar * backspaceBar = new E1Bar(this);
    backspaceBar->setPalette(pal);
    backspaceBar->setFixedSize(30, 20);
    backspaceBar->setBorder(E1Bar::ButtonBorder);
    E1Button *backspaceButton = new E1Button;
    backspaceButton->setPixmap(QPixmap(":image/samples/e1_erase"));
    backspaceBar->addItem(backspaceButton);
    connect(backspaceButton, SIGNAL(clicked()), this, SLOT(eraseClicked()));
    hlayout1->addWidget( backspaceBar );

    QHBoxLayout* sideLayout = new QHBoxLayout;
    sideLayout->setMargin( 0 );
    sideLayout->setSpacing( 0 );
    vlayout->addLayout( sideLayout );

    QVBoxLayout* buttonLayout = new QVBoxLayout;
    buttonLayout->setMargin(0);
    buttonLayout->setSpacing(15);
    sideLayout->addLayout( buttonLayout );

    m_callscreenBar = new E1Bar(this);
    m_callscreenBar->setVisible( false );
    m_callscreenBar->setBorder(E1Bar::ButtonBorder);
    E1Button *callscreen = new E1Button;
    callscreen->setFlag(E1Button::Expanding);
    callscreen->setPixmap(QPixmap(":image/samples/e1_dialer"));
    m_callscreenBar->addItem(callscreen);
    m_callscreenBar->setFixedSize(32, 96);
    sideLayout->addWidget(m_callscreenBar);
    QObject::connect(callscreen, SIGNAL(clicked()), this, SIGNAL(toCallScreen()));
    connect(DialerControl::instance(), SIGNAL(activeCount(int)), this, SLOT(activeCallCount(int)));

    // 1, 2, 3
    QHBoxLayout* hlayout2 = new QHBoxLayout();
    buttonLayout->addLayout( hlayout2 );
    hlayout2->setSpacing( 10 );
    hlayout2->setMargin( 0 );

    E1DialerButton* button = new E1DialerButton( this );
    button->setText( "1" );
    button->setFgPixmap( QPixmap(":image/samples/1" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout2->addWidget( button );
    hlayout2->addSpacing( 7 );

    button = new E1DialerButton( this );
    button->setText( "2" );
    button->setFgPixmap( QPixmap(":image/samples/2" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout2->addWidget( button );
    hlayout2->addSpacing( 7 );

    button = new E1DialerButton( this );
    button->setText( "3" );
    button->setFgPixmap( QPixmap(":image/samples/3" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout2->addWidget( button );

    // 4, 5, 6
    QHBoxLayout* hlayout3 = new QHBoxLayout();
    buttonLayout->addLayout( hlayout3 );
    hlayout3->setSpacing( 10 );
    hlayout3->setMargin( 0 );

    button = new E1DialerButton( this );
    button->setText( "4" );
    button->setFgPixmap( QPixmap(":image/samples/4" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout3->addWidget( button );
    hlayout3->addSpacing( 7 );

    button = new E1DialerButton( this );
    button->setText( "5" );
    button->setFgPixmap( QPixmap(":image/samples/5" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout3->addWidget( button );
    hlayout3->addSpacing( 7 );

    button = new E1DialerButton( this );
    button->setText( "6" );
    button->setFgPixmap( QPixmap(":image/samples/6" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout3->addWidget( button );

    // 7, 8, 9
    QHBoxLayout* hlayout4 = new QHBoxLayout();
    buttonLayout->addLayout( hlayout4 );
    hlayout4->setSpacing( 10 );
    hlayout4->setMargin( 0 );

    button = new E1DialerButton( this );
    button->setText( "7" );
    button->setFgPixmap( QPixmap(":image/samples/7" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout4->addWidget( button );
    hlayout4->addSpacing( 7 );

    button = new E1DialerButton( this );
    button->setText( "8" );
    button->setFgPixmap( QPixmap(":image/samples/8" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout4->addWidget( button );
    hlayout4->addSpacing( 7 );

    button = new E1DialerButton( this );
    button->setText( "9" );
    button->setFgPixmap( QPixmap(":image/samples/9" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout4->addWidget( button );

    // *, 0, hash
    QHBoxLayout* hlayout5 = new QHBoxLayout();
    buttonLayout->addLayout( hlayout5 );
    hlayout5->setSpacing( 10 );
    hlayout5->setMargin( 0 );

    button = new E1DialerButton( this );
    button->setText( "*" );
    button->setFgPixmap( QPixmap(":image/samples/star" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout5->addWidget( button );
    hlayout5->addSpacing( 7 );

    button = new E1DialerButton( this );
    button->setText( "0" );
    button->setFgPixmap( QPixmap(":image/samples/0" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout5->addWidget( button );
    hlayout5->addSpacing( 7 );

    button = new E1DialerButton( this );
    button->setText( "#" );
    button->setFgPixmap( QPixmap(":image/samples/hash" ) );
    connect( button, SIGNAL(clicked(QString)), this, SLOT(buttonClicked(QString)) );
    hlayout5->addWidget( button );

    connect( m_textButton, SIGNAL(clicked()), this, SLOT(textButtonClicked()) );
}