| author | John Kern <johnk@symbian.org> |
| Thu, 16 Sep 2010 10:59:11 -0700 | |
| changeset 49 | d9d4ea56179a |
| parent 34 | 93c5a58496b6 |
| permissions | -rwxr-xr-x |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
1 |
#include <QtGui/QApplication> |
|
24
2e833c2a6782
Added csv file to sis exports; improved csv file location in main.cpp
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
21
diff
changeset
|
2 |
#include <QDesktopServices> |
|
2e833c2a6782
Added csv file to sis exports; improved csv file location in main.cpp
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
21
diff
changeset
|
3 |
#include <QDir> |
|
49
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
4 |
#include <QDebug> |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
5 |
#include <QLabel> |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
6 |
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
7 |
#ifdef USE_ORANGE_FW |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
8 |
#include <OLApplication.h> |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
9 |
#include <OLPixmapWidget.h> |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
10 |
#include "mainview.h" |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
11 |
#include "contactlist.h" |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
12 |
#else |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
13 |
#include "mainwindow.h" |
|
21
3bfc3227045d
CSV reader works, kind of. contacts.csv file added to project, must live in c:\ at the moment
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
19
diff
changeset
|
14 |
#include "dbtools.h" |
|
49
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
15 |
#endif |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
16 |
|
|
33
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
17 |
// Tech Tip: By default, Actions is added to the Options menu. The |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
18 |
// idea is to support context menus on non-touch mobiles. |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
19 |
void disableContextMenu() |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
20 |
{
|
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
21 |
QWidgetList widgets = QApplication::allWidgets(); |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
22 |
QWidget* wid=0; |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
23 |
foreach(wid,widgets) |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
24 |
{
|
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
25 |
wid->setContextMenuPolicy(Qt::NoContextMenu); |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
26 |
} |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
27 |
} |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
28 |
|
|
49
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
29 |
#ifdef USE_ORANGE_FW |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
30 |
int main(int argc, char *argv[]) |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
31 |
{
|
|
49
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
32 |
OLApplication a(argc, argv); |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
33 |
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
34 |
MainView *mainView = new MainView(NULL); |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
35 |
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
36 |
disableContextMenu(); |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
37 |
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
38 |
a.setWindowTitle("(OL)Contact App");
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
39 |
mainView->resize(a.viewSize()); |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
40 |
// QLabel* test = new QLabel("main base view", mainView);
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
41 |
// Q_UNUSED(test); |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
42 |
ContactList *cl = new ContactList(mainView); |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
43 |
Q_UNUSED(cl) |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
44 |
mainView->connect(&a, SIGNAL(appStarted()), mainView, SLOT(startApp())); |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
45 |
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
46 |
return a.exec(); |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
47 |
} |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
48 |
#else |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
49 |
int main(int argc, char *argv[]) |
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
50 |
{
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
51 |
|
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
52 |
QApplication a(argc, argv); |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
53 |
MainWindow w; |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
54 |
|
|
49
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
55 |
|
|
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
56 |
|
|
21
3bfc3227045d
CSV reader works, kind of. contacts.csv file added to project, must live in c:\ at the moment
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
19
diff
changeset
|
57 |
DBTools dbt; |
|
27
afa910b5ae81
ok I did say to use QDesktopServices but treating contacts.csv is simpler
John Kern <johnk@symbian.org>
parents:
24
diff
changeset
|
58 |
QString dbLocation(":/contacts.csv");
|
|
24
2e833c2a6782
Added csv file to sis exports; improved csv file location in main.cpp
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
21
diff
changeset
|
59 |
|
|
2e833c2a6782
Added csv file to sis exports; improved csv file location in main.cpp
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
21
diff
changeset
|
60 |
qDebug() << "dbLocation=" << dbLocation << endl; |
|
2e833c2a6782
Added csv file to sis exports; improved csv file location in main.cpp
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
21
diff
changeset
|
61 |
dbt.importCSV(dbLocation); |
|
21
3bfc3227045d
CSV reader works, kind of. contacts.csv file added to project, must live in c:\ at the moment
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
19
diff
changeset
|
62 |
|
|
33
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
63 |
disableContextMenu(); |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
64 |
|
|
49
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
65 |
w.setWindowTitle("Contact App");
|
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
66 |
#if defined(Q_WS_S60) |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
67 |
w.showMaximized(); |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
68 |
#else |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
69 |
w.show(); |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
70 |
#endif |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
71 |
return a.exec(); |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
72 |
} |
|
49
d9d4ea56179a
added a listview to support orange lab fw
John Kern <johnk@symbian.org>
parents:
34
diff
changeset
|
73 |
#endif |