phonebookui/phonebookservices/src/main.cpp
branchRCL_3
changeset 62 5b6f26637ad3
equal deleted inserted replaced
58:d4f567ce2e7c 62:5b6f26637ad3
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <hbapplication.h>
       
    19 #include <hbmainwindow.h>
       
    20 #include <QTranslator>
       
    21 #include <QLocale>
       
    22 #include "cntserviceproviderold.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>
       
    34 
       
    35 int main(int argc, char **argv)
       
    36 {
       
    37     qInstallMsgHandler(MSG_HANDLER);
       
    38     
       
    39     HbApplication a( argc, argv );
       
    40 
       
    41     QTranslator translator;
       
    42     QString lang = QLocale::system().name();
       
    43     QString path = "z:/resource/qt/translations/";
       
    44     translator.load(path + "contacts_" + lang);
       
    45     a.installTranslator(&translator);
       
    46 
       
    47     HbMainWindow mainWindow;
       
    48     CntKeyGrabber *keyGrabber = new CntKeyGrabber(&mainWindow, &mainWindow);
       
    49 
       
    50     CntViewNavigator* navigator = new CntViewNavigator( &mainWindow );
       
    51     navigator->addEffect( serviceContactCardView, historyView );
       
    52     navigator->addEffect( historyView, serviceContactCardView );
       
    53     navigator->addEffect( serviceGroupMemberView, groupActionsView );
       
    54     navigator->addEffect( groupActionsView, serviceGroupMemberView );
       
    55     navigator->addRoot( serviceGroupMemberView );
       
    56 
       
    57     // This object actually executes the services
       
    58     CntServices* services = new CntServices();
       
    59     services->setParent( &mainWindow ); // for ownership
       
    60 
       
    61     CntServiceViewManager* viewManager = new CntServiceViewManager(
       
    62         &mainWindow,
       
    63         *services ); // as CntAbstractServiceProvider
       
    64     viewManager->setViewNavigator( navigator );
       
    65 
       
    66     //services->setViewManager( *viewManager );
       
    67     services->setEngine( viewManager->engine() );
       
    68 
       
    69     // These objects talk with QT Highway (send/receive)
       
    70     CntServiceProviderOld* serviceProviderOld = new CntServiceProviderOld( *services, &mainWindow ); // com.nokia.services.phonebookservices.Fetch
       
    71     CntServiceProviderOld2* serviceProviderOld2 = new CntServiceProviderOld2( *services, &mainWindow ); // phonebookservices.Fetch
       
    72     CntServiceProviderFetch* serviceProviderFetch = new CntServiceProviderFetch( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactFetch
       
    73     CntServiceProviderViewing* serviceProviderViewing = new CntServiceProviderViewing( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactView
       
    74     CntServiceProviderEdit* serviceProviderEdit = new CntServiceProviderEdit( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactEdit
       
    75 
       
    76     mainWindow.show();
       
    77 
       
    78     return a.exec();
       
    79 }
       
    80