# HG changeset patch # User John Kern # Date 1284659951 25200 # Node ID d9d4ea56179ad9d84ac29e610f9c08c3cec85059 # Parent 863c77d1582827f78628c01ac27da7677514e213 added a listview to support orange lab fw diff -r 863c77d15828 -r d9d4ea56179a contactengine/ContactList.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contactengine/ContactList.ui Thu Sep 16 10:59:11 2010 -0700 @@ -0,0 +1,41 @@ + + + Form + + + + 0 + 0 + 337 + 529 + + + + Form + + + + + 10 + 20 + 256 + 401 + + + + Qt::Vertical + + + + + 0 + 83 + + + + + + + + + diff -r 863c77d15828 -r d9d4ea56179a contactengine/contactengine.pro --- a/contactengine/contactengine.pro Fri Sep 10 09:00:20 2010 -0700 +++ b/contactengine/contactengine.pro Thu Sep 16 10:59:11 2010 -0700 @@ -1,52 +1,62 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2010-08-03T16:15:24 -# -#------------------------------------------------- - -QT += core gui sql svg - -TARGET = contactengine -TEMPLATE = app - -CONFIG += debug - -SOURCES += main.cpp\ - mainwindow.cpp \ - contactsengine.cpp \ - dbtools.cpp \ - detailsgv.cpp - -HEADERS += mainwindow.h \ - contactsengine.h \ - database.h \ - dbtools.h \ - database.h \ - detailsgv.h - - -FORMS += mainwindow.ui - -CONFIG += mobility -MOBILITY = contacts - -unix:INCLUDEPATH += /home/johnk/libs/include/QtContacts /home/johnk/libs/include/ -unix:LIBS += -L/home/johnk/libs/lib -lQtContacts - -databasefiles.sources = contacts.csv -databasefiles.path = . - -DEPLOYMENT += databasefiles - -symbian { - TARGET.UID3 = 0xec200759 - TARGET.CAPABILITY += ReadUserData WriteUserData - TARGET.EPOCSTACKSIZE = 0x14000 - TARGET.EPOCHEAPSIZE = 0x020000 0x800000 -} - -RESOURCES += \ - resouce.qrc - -OTHER_FILES += \ - readme.txt +#------------------------------------------------- +# +# Project created by QtCreator 2010-08-03T16:15:24 +# +#------------------------------------------------- + +QT += core gui sql svg + +TARGET = contactengine +TEMPLATE = app + +CONFIG += debug + +include( apptemplatesrc/apptemplate.pri) + +DEPENDPATH += apptemplatesrc + +DEFINES += USE_ORANGE_FW + +SOURCES += main.cpp\ + mainwindow.cpp \ + contactsengine.cpp \ + dbtools.cpp \ + detailsgv.cpp \ + mainview.cpp \ + contactlist.cpp + +HEADERS += mainwindow.h \ + contactsengine.h \ + database.h \ + dbtools.h \ + database.h \ + detailsgv.h \ + mainview.h \ + contactlist.h + +FORMS += mainwindow.ui \ + ContactList.ui + +CONFIG += mobility +MOBILITY = contacts messaging + +unix:INCLUDEPATH += /home/johnk/libs/include/QtContacts /home/johnk/libs/include/ +unix:LIBS += -L/home/johnk/libs/lib -lQtContacts + +databasefiles.sources = contacts.csv +databasefiles.path = . + +DEPLOYMENT += databasefiles + +symbian { + TARGET.UID3 = 0xec200759 + TARGET.CAPABILITY += ReadUserData WriteUserData ReadDeviceData WriteDeviceData + TARGET.EPOCSTACKSIZE = 0x14000 + TARGET.EPOCHEAPSIZE = 0x020000 0x800000 +} + +RESOURCES += \ + resouce.qrc + +OTHER_FILES += \ + readme.txt diff -r 863c77d15828 -r d9d4ea56179a contactengine/contactlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contactengine/contactlist.cpp Thu Sep 16 10:59:11 2010 -0700 @@ -0,0 +1,59 @@ +#include +#include +#include "contactlist.h" + +ContactList::ContactList(QWidget *parent) : + QWidget(parent), + ui(new Ui::Form) +{ + ui->setupUi(this); + + this->ce = new ContactsEngine(this); + + connect(this->ce, SIGNAL(errorOccurred(QString)), + this,SLOT(errorOccurred(QString))); + + this->ce->createManager(); + + connect(ui->comboBox, SIGNAL( activated ( const QString & )), + this->ce, SLOT(setManager(const QString &) )); + + + ui->comboBox->addItems(this->ce->dataSources()); + ui->listView->setModel(this->ce); + +} + + +void ContactList::errorOccurred(QString err) +{ + QMessageBox::information(this, "foo", err); +} + +// just should all contacts. +void ContactList::showAllContacts() +{ + OLApplication* app = dynamic_cast(qApp); + app->showBanner("(all) NYI", false); +} + +// source the list of contacts by proximity to the phone. +void ContactList::sortByGeo() +{ + OLApplication* app = dynamic_cast(qApp); + app->showBanner("(geo) NYI", false); +} + +// show all contacts at a particular event. +void ContactList::showEvents() +{ + OLApplication* app = dynamic_cast(qApp); + app->showBanner("(events) NYI", false); +} + +// show call log +void ContactList::showLogs() +{ + OLApplication* app = dynamic_cast(qApp); + app->showBanner("(logs) NYI", false); +} diff -r 863c77d15828 -r d9d4ea56179a contactengine/contactlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contactengine/contactlist.h Thu Sep 16 10:59:11 2010 -0700 @@ -0,0 +1,34 @@ +#ifndef CONTACTLIST_H +#define CONTACTLIST_H + +#include + +#include "contactsengine.h" +#include "ui_ContactList.h" + +class ContactList : public QWidget +{ + Q_OBJECT +public: + explicit ContactList(QWidget *parent = 0); + +signals: + +public slots: + // just should all contacts. + void showAllContacts(); + // source the list of contacts by proximity to the phone. + void sortByGeo(); + // show all contacts at a particular event. + void showEvents(); + // show call log + void showLogs(); + + void errorOccurred(QString); + +private: + Ui::Form *ui; + ContactsEngine *ce; +}; + +#endif // CONTACTLIST_H diff -r 863c77d15828 -r d9d4ea56179a contactengine/main.cpp --- a/contactengine/main.cpp Fri Sep 10 09:00:20 2010 -0700 +++ b/contactengine/main.cpp Thu Sep 16 10:59:11 2010 -0700 @@ -1,9 +1,18 @@ #include #include #include +#include +#include + +#ifdef USE_ORANGE_FW +#include +#include +#include "mainview.h" +#include "contactlist.h" +#else #include "mainwindow.h" #include "dbtools.h" -#include +#endif // Tech Tip: By default, Actions is added to the Options menu. The // idea is to support context menus on non-touch mobiles. @@ -17,12 +26,34 @@ } } - +#ifdef USE_ORANGE_FW int main(int argc, char *argv[]) { + OLApplication a(argc, argv); + + MainView *mainView = new MainView(NULL); + + disableContextMenu(); + + a.setWindowTitle("(OL)Contact App"); + mainView->resize(a.viewSize()); +// QLabel* test = new QLabel("main base view", mainView); +// Q_UNUSED(test); + ContactList *cl = new ContactList(mainView); + Q_UNUSED(cl) + mainView->connect(&a, SIGNAL(appStarted()), mainView, SLOT(startApp())); + + return a.exec(); +} +#else +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); MainWindow w; + + DBTools dbt; QString dbLocation(":/contacts.csv"); @@ -31,12 +62,12 @@ disableContextMenu(); - w.setWindowTitle("Qt Study App"); + w.setWindowTitle("Contact App"); #if defined(Q_WS_S60) w.showMaximized(); #else w.show(); #endif - return a.exec(); } +#endif diff -r 863c77d15828 -r d9d4ea56179a contactengine/mainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contactengine/mainview.cpp Thu Sep 16 10:59:11 2010 -0700 @@ -0,0 +1,78 @@ +#include +#include + +#include +#include +#include +#include "mainview.h" + + +#include "mainwindow.h" + +MainView::MainView(QWidget *parent) : + QWidget(parent) +{ + // setup toolbar + OLButton* btn = 0; + btn = addToolbarButton(":/images/icn_addmenu.png", "call"); + connect(btn, SIGNAL(clicked()), this, SLOT(showAllContacts())); + + btn = addToolbarButton(":/images/icn_addview.png", "SMS"); + connect(btn, SIGNAL(clicked()), this, SLOT(sortByGeo())); +} + + OLButton* MainView::addToolbarButton(const QString& icon, const QString& text) + { + OLWidgetList wgtList; + OLApplication* app = dynamic_cast(qApp); + OLButton* btn = new OLButton(); + QVBoxLayout* btnLayout = new QVBoxLayout(btn); + btnLayout->setMargin(0); + btnLayout->setSpacing(5); + btnLayout->setAlignment(Qt::AlignCenter); + OLPixmapWidget* btnIcon = new OLPixmapWidget(icon); + QLabel* btnText = new QLabel(text); + btnText->setStyleSheet("font-size: 10px;"); + btnLayout->addWidget(btnIcon, 0, Qt::AlignHCenter); + btnLayout->addWidget(btnText, 0, Qt::AlignHCenter); + wgtList.append(btnText); + btn->setLayout(btnLayout); + app->addToolbarButton(btn, wgtList); + + return btn; + } + +void MainView::startApp() +{ + OLApplication* app = dynamic_cast(qApp); + QSize viewSize = app->viewSize(); + app->setView(this, OLApplication::systemdefault, true); +} + +// just should all contacts. +void MainView::showAllContacts() +{ + OLApplication* app = dynamic_cast(qApp); + app->showBanner("(all) NYI", false); +} + +// source the list of contacts by proximity to the phone. +void MainView::sortByGeo() +{ + OLApplication* app = dynamic_cast(qApp); + app->showBanner("(geo) NYI", false); +} + +// show all contacts at a particular event. +void MainView::showEvents() +{ + OLApplication* app = dynamic_cast(qApp); + app->showBanner("(events) NYI", false); +} + +// show call log +void MainView::showLogs() +{ + OLApplication* app = dynamic_cast(qApp); + app->showBanner("(logs) NYI", false); +} diff -r 863c77d15828 -r d9d4ea56179a contactengine/mainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contactengine/mainview.h Thu Sep 16 10:59:11 2010 -0700 @@ -0,0 +1,40 @@ +#ifndef MAINVIEW_H +#define MAINVIEW_H + +#include + +#include + + + +// Use this class with the Orange Labs FW. Since the FW is full screen +// it handles many issues QMainWindow does for a standard Qt app. + +class MainView : public QWidget +{ + Q_OBJECT +public: + explicit MainView(QWidget *parent = 0); + +signals: + +public slots: + void startApp(); + + // just should all contacts. + void showAllContacts(); + // source the list of contacts by proximity to the phone. + void sortByGeo(); + // show all contacts at a particular event. + void showEvents(); + // show call log + void showLogs(); + +private: + OLButton* addToolbarButton(const QString& icon, const QString& text); + +private: + int m_count; +}; + +#endif // MAINVIEW_H diff -r 863c77d15828 -r d9d4ea56179a contactengine/mainwindow.h --- a/contactengine/mainwindow.h Fri Sep 10 09:00:20 2010 -0700 +++ b/contactengine/mainwindow.h Thu Sep 16 10:59:11 2010 -0700 @@ -9,6 +9,9 @@ class MainWindow; } +// If you are building this as a stand alone app (ie, not using the Orange Labs FW), +// use this class. + class MainWindow : public QMainWindow { Q_OBJECT diff -r 863c77d15828 -r d9d4ea56179a contactengine/resouce.qrc --- a/contactengine/resouce.qrc Fri Sep 10 09:00:20 2010 -0700 +++ b/contactengine/resouce.qrc Thu Sep 16 10:59:11 2010 -0700 @@ -2,5 +2,9 @@ contacts.csv images/johnny_automatic_marching_band_1.svg + images/icn_removeview.png + images/icn_addmenu.png + images/icn_addstackview.png + images/icn_addview.png