]> Shamusworld >> Repos - schematic/blob - src/contacteditwidget.cpp
Move DB access to NoteDialog class, new AlertDialog class.
[schematic] / src / contacteditwidget.cpp
1 //
2 // contacteditwidget.cpp - Vendor contact display
3 //
4 // by James Hammons
5 // (C) 2012 Underground Software
6 //
7 // JLH = James Hammons <jlhamm@acm.org>
8 //
9 // Who  When        What
10 // ---  ----------  -------------------------------------------------------------
11 // JLH  09/24/2012  Created this file
12 //
13
14 #include "contacteditwidget.h"
15
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),
24         newContactType(false)
25 {
26         QFormLayout * form = new QFormLayout;
27
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);
36
37         setLayout(form);
38
39         connect(field1, SIGNAL(editTextChanged(const QString &)), this, SLOT(NewItem(const QString &)));
40         connect(field1, SIGNAL(highlighted(int)), this, SLOT(ExistingItem(int)));
41 }
42
43
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.
47
48 void ContactEditWidget::NewItem(const QString &)
49 {
50         newContactType = true;
51 }
52
53
54 void ContactEditWidget::ExistingItem(int)
55 {
56         newContactType = false;
57 }
58