author | John Kern <johnk@symbian.org> |
Thu, 09 Sep 2010 20:03:34 -0700 | |
changeset 47 | c6e75ec74fc8 |
parent 34 | 93c5a58496b6 |
child 49 | d9d4ea56179a |
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> |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
4 |
#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
|
5 |
#include "dbtools.h" |
24
2e833c2a6782
Added csv file to sis exports; improved csv file location in main.cpp
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
21
diff
changeset
|
6 |
#include <QDebug> |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
7 |
|
33
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
8 |
// 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
|
9 |
// 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
|
10 |
void disableContextMenu() |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
11 |
{ |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
12 |
QWidgetList widgets = QApplication::allWidgets(); |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
13 |
QWidget* wid=0; |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
14 |
foreach(wid,widgets) |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
15 |
{ |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
16 |
wid->setContextMenuPolicy(Qt::NoContextMenu); |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
17 |
} |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
18 |
} |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
19 |
|
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
20 |
|
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
21 |
int main(int argc, char *argv[]) |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
22 |
{ |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
23 |
QApplication a(argc, argv); |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
24 |
MainWindow w; |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
25 |
|
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
|
26 |
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
|
27 |
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
|
28 |
|
2e833c2a6782
Added csv file to sis exports; improved csv file location in main.cpp
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
21
diff
changeset
|
29 |
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
|
30 |
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
|
31 |
|
33
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
32 |
disableContextMenu(); |
f6cf541961ad
tech tip: workaround for Action on Options menu
John Kern <johnk@symbian.org>
parents:
27
diff
changeset
|
33 |
|
34
93c5a58496b6
add graphics view which presents contacts details
John Kern <johnk@symbian.org>
parents:
33
diff
changeset
|
34 |
w.setWindowTitle("Qt Study App"); |
19
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
35 |
#if defined(Q_WS_S60) |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
36 |
w.showMaximized(); |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
37 |
#else |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
38 |
w.show(); |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
39 |
#endif |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
40 |
|
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
41 |
return a.exec(); |
e4b6ee329501
WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
42 |
} |