contactengine/main.cpp
author John Kern <johnk@symbian.org>
Mon, 16 Aug 2010 15:57:18 -0700
changeset 33 f6cf541961ad
parent 27 afa910b5ae81
child 34 93c5a58496b6
permissions -rwxr-xr-x
tech tip: workaround for Action on Options menu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
19
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    34
#if defined(Q_WS_S60)
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    35
    w.showMaximized();
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    36
#else
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    37
    w.show();
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    38
#endif
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    39
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    40
    return a.exec();
e4b6ee329501 WIP: first draft of contact engine
John Kern <johnk@symbian.org>
parents:
diff changeset
    41
}