author | John Kern <johnk@symbian.org> |
Fri, 13 Aug 2010 15:33:51 -0700 | |
changeset 30 | 33e489bb7487 |
parent 25 | adbe71832e2b |
child 34 | 93c5a58496b6 |
permissions | -rwxr-xr-x |
23 | 1 |
#include <QComboBox> |
30 | 2 |
#include <QMenuBar> |
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
3 |
#include <QMessageBox> |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
4 |
|
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
5 |
#include <QDebug> |
23 | 6 |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
7 |
#include "mainwindow.h" |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
8 |
#include "ui_mainwindow.h" |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
9 |
#include "contactsengine.h" |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
10 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
11 |
MainWindow::MainWindow(QWidget *parent) : |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
12 |
QMainWindow(parent), |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
13 |
ui(new Ui::MainWindow) |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
14 |
{ |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
15 |
ui->setupUi(this); |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
16 |
this->ce = new ContactsEngine(this); |
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
17 |
|
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
18 |
connect(this->ce, SIGNAL(errorOccurred(QString)), |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
19 |
this,SLOT(errorOccurred(QString))); |
23 | 20 |
|
21 |
connect(ui->comboBox, SIGNAL( activated ( const QString & )), |
|
22 |
this->ce, SLOT(setManager(const QString &) )); |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
23 |
|
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
24 |
this->ce->createManager(); |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
25 |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
26 |
ui->comboBox->addItems(this->ce->dataSources()); |
23 | 27 |
ui->listView->setModel(this->ce); |
30 | 28 |
|
29 |
this->createMenus(); |
|
30 |
} |
|
31 |
||
32 |
void MainWindow::createMenus() |
|
33 |
{ |
|
34 |
verAction = new QAction(tr("&Version"),this); |
|
35 |
menuBar()->addAction(verAction); |
|
36 |
connect(verAction, SIGNAL(triggered()),this, SLOT(displayVersion())); |
|
37 |
||
38 |
exitAction = new QAction(tr("&Exit"),this); |
|
39 |
menuBar()->addAction(exitAction); |
|
40 |
connect(exitAction, SIGNAL(triggered()),this, SLOT(close())); |
|
41 |
} |
|
42 |
||
43 |
void MainWindow::displayVersion() |
|
44 |
{ |
|
45 |
QMessageBox::information(this,"Qt Version", qVersion()); |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
46 |
} |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
47 |
|
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
48 |
void MainWindow::errorOccurred(QString errMsg) |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
49 |
{ |
30 | 50 |
QMessageBox::information(this,"Err Routed",errMsg); |
25
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
51 |
qDebug() << errMsg << endl; |
adbe71832e2b
runs on-device now; testing on 5800
John Kern <johnk@symbian.org>
parents:
23
diff
changeset
|
52 |
} |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
53 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
54 |
MainWindow::~MainWindow() |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
55 |
{ |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
56 |
delete ui; |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
57 |
} |