14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <hbapplication.h> |
18 #include <hbapplication.h> |
|
19 #include <hbmainwindow.h> |
19 #include <QTranslator> |
20 #include <QTranslator> |
20 #include <QLocale> |
21 #include <QLocale> |
21 #include "cntservicemainwindow.h" |
22 #include "cntserviceproviderold.h" |
22 #include "cntservicehandler.h" |
23 #include "cntserviceproviderold2.h" |
|
24 #include "cntserviceproviderfetch.h" |
|
25 #include "cntserviceproviderold2.h" |
|
26 #include "cntserviceproviderviewing.h" |
|
27 #include "cntserviceprovideredit.h" |
|
28 #include "cntservices.h" |
|
29 #include "cntserviceviewmanager.h" |
|
30 #include "cntviewnavigator.h" |
|
31 #include "cntkeygrabber.h" |
|
32 #include "cntdebug.h" |
|
33 #include <cntviewparams.h> |
23 |
34 |
24 int main(int argc, char **argv) |
35 int main(int argc, char **argv) |
25 { |
36 { |
|
37 qInstallMsgHandler(MSG_HANDLER); |
|
38 |
26 HbApplication a( argc, argv ); |
39 HbApplication a( argc, argv ); |
27 |
40 |
28 QTranslator translator; |
41 QTranslator translator; |
29 QString lang = QLocale::system().name(); |
42 QString lang = QLocale::system().name(); |
30 QString path = "z:/resource/qt/translations/"; |
43 QString path = "z:/resource/qt/translations/"; |
31 translator.load(path + "contacts_" + lang); |
44 translator.load(path + "contacts_" + lang); |
32 a.installTranslator(&translator); |
45 a.installTranslator(&translator); |
33 |
46 |
34 CntServiceHandler *handler = new CntServiceHandler(); |
47 HbMainWindow mainWindow; |
35 CntServiceMainWindow mainWindow(handler); |
48 CntKeyGrabber *keyGrabber = new CntKeyGrabber(&mainWindow, &mainWindow); |
|
49 |
|
50 CntViewNavigator* navigator = new CntViewNavigator( &mainWindow ); |
|
51 navigator->addException( serviceEditView, noView ); |
|
52 navigator->addEffect( serviceContactCardView, historyView ); |
|
53 navigator->addEffect( historyView, serviceContactCardView ); |
|
54 |
|
55 // This object actually executes the services |
|
56 CntServices* services = new CntServices(); |
|
57 services->setParent( &mainWindow ); // for ownership |
|
58 |
|
59 CntServiceViewManager* viewManager = new CntServiceViewManager( |
|
60 &mainWindow, |
|
61 *services ); // as CntAbstractServiceProvider |
|
62 viewManager->setViewNavigator( navigator ); |
|
63 |
|
64 services->setViewManager( *viewManager ); |
|
65 |
|
66 // These objects talk with QT Highway (send/receive) |
|
67 CntServiceProviderOld* serviceProviderOld = new CntServiceProviderOld( *services, &mainWindow ); // com.nokia.services.phonebookservices.Fetch |
|
68 CntServiceProviderOld2* serviceProviderOld2 = new CntServiceProviderOld2( *services, &mainWindow ); // phonebookservices.Fetch |
|
69 CntServiceProviderFetch* serviceProviderFetch = new CntServiceProviderFetch( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactFetch |
|
70 CntServiceProviderViewing* serviceProviderViewing = new CntServiceProviderViewing( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactView |
|
71 CntServiceProviderEdit* serviceProviderEdit = new CntServiceProviderEdit( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactEdit |
36 |
72 |
37 mainWindow.show(); |
73 mainWindow.show(); |
38 |
74 |
39 return a.exec(); |
75 return a.exec(); |
40 } |
76 } |