2 // contacteditwidget.cpp - Vendor contact display
5 // (C) 2012 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- -------------------------------------------------------------
11 // JLH 09/24/2012 Created this file
14 #include "contacteditwidget.h"
16 ContactEditWidget::ContactEditWidget(QWidget * parent/*= 0*/): QWidget(parent),
17 field1(new QComboBox),
18 field2(new QLineEdit),
19 field3(new QLineEdit),
20 field4(new QLineEdit),
21 field5(new QLineEdit),
22 field6(new QLineEdit),
23 field7(new QLineEdit),
26 QFormLayout * form = new QFormLayout;
28 field1->setEditable(true);
29 form->addRow(tr("Type:"), field1);
30 form->addRow(tr("Name:"), field2);
31 form->addRow(tr("Email:"), field3);
32 form->addRow(tr("Address:"), field4);
33 form->addRow(tr("Phone 1:"), field5);
34 form->addRow(tr("Phone 2:"), field6);
35 form->addRow(tr("Fax:"), field7);
39 connect(field1, SIGNAL(editTextChanged(const QString &)), this, SLOT(NewItem(const QString &)));
40 connect(field1, SIGNAL(highlighted(int)), this, SLOT(ExistingItem(int)));
44 // Here we make some assumptions:
45 // - If the user types something in, they probably are creating a new category.
46 // - If the user selects something, they probably want to use an existing one.
48 void ContactEditWidget::NewItem(const QString &)
50 newContactType = true;
54 void ContactEditWidget::ExistingItem(int)
56 newContactType = false;