field4(new QLineEdit),
field5(new QLineEdit),
field6(new QLineEdit),
- field7(new QLineEdit)
+ field7(new QLineEdit),
+ newContactType(false)
{
QFormLayout * form = new QFormLayout;
+ field1->setEditable(true);
form->addRow(tr("Type:"), field1);
form->addRow(tr("Name:"), field2);
form->addRow(tr("Email:"), field3);
form->addRow(tr("Fax:"), field7);
setLayout(form);
+
+ connect(field1, SIGNAL(editTextChanged(const QString &)), this, SLOT(NewItem(const QString &)));
+ connect(field1, SIGNAL(highlighted(int)), this, SLOT(ExistingItem(int)));
+}
+
+
+// Here we make some assumptions:
+// - If the user types something in, they probably are creating a new category.
+// - If the user selects something, they probably want to use an existing one.
+
+void ContactEditWidget::NewItem(const QString &)
+{
+ newContactType = true;
+}
+
+
+void ContactEditWidget::ExistingItem(int)
+{
+ newContactType = false;
}