phonebookui/phonebookservices/src/main.cpp
author hgs
Fri, 23 Jul 2010 12:43:48 +0300
changeset 53 e6aff7b69165
parent 50 77bc263e1626
child 54 47627ab5d7a4
permissions -rw-r--r--
201029
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include <hbapplication.h>
53
hgs
parents: 50
diff changeset
    19
#include <hbmainwindow.h>
24
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <QTranslator>
40
b46a585f6909 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    21
#include <QLocale>
50
hgs
parents: 40
diff changeset
    22
#include "cntserviceproviderold.h"
hgs
parents: 40
diff changeset
    23
#include "cntserviceproviderold2.h"
hgs
parents: 40
diff changeset
    24
#include "cntserviceproviderfetch.h"
hgs
parents: 40
diff changeset
    25
#include "cntserviceproviderold2.h"
hgs
parents: 40
diff changeset
    26
#include "cntserviceproviderviewing.h"
hgs
parents: 40
diff changeset
    27
#include "cntserviceprovideredit.h"
hgs
parents: 40
diff changeset
    28
#include "cntservices.h"
hgs
parents: 40
diff changeset
    29
#include "cntserviceviewmanager.h"
hgs
parents: 40
diff changeset
    30
#include "cntviewnavigator.h"
53
hgs
parents: 50
diff changeset
    31
#include "cntdebug.h"
50
hgs
parents: 40
diff changeset
    32
#include <cntviewparams.h>
24
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
int main(int argc, char **argv)
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
{
53
hgs
parents: 50
diff changeset
    36
    qInstallMsgHandler(MSG_HANDLER);
hgs
parents: 50
diff changeset
    37
    
24
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
    HbApplication a( argc, argv );
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
    QTranslator translator;
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
    QString lang = QLocale::system().name();
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
    QString path = "z:/resource/qt/translations/";
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
    translator.load(path + "contacts_" + lang);
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
    a.installTranslator(&translator);
50
hgs
parents: 40
diff changeset
    45
53
hgs
parents: 50
diff changeset
    46
    HbMainWindow mainWindow;
50
hgs
parents: 40
diff changeset
    47
hgs
parents: 40
diff changeset
    48
    CntViewNavigator* navigator = new CntViewNavigator( &mainWindow );
hgs
parents: 40
diff changeset
    49
    navigator->addException( serviceEditView, noView );
53
hgs
parents: 50
diff changeset
    50
    navigator->addEffect( serviceContactCardView, historyView );
hgs
parents: 50
diff changeset
    51
    navigator->addEffect( historyView, serviceContactCardView );
50
hgs
parents: 40
diff changeset
    52
hgs
parents: 40
diff changeset
    53
    // This object actually executes the services
hgs
parents: 40
diff changeset
    54
    CntServices* services = new CntServices();
hgs
parents: 40
diff changeset
    55
    services->setParent( &mainWindow ); // for ownership
hgs
parents: 40
diff changeset
    56
hgs
parents: 40
diff changeset
    57
    CntServiceViewManager* viewManager = new CntServiceViewManager(
hgs
parents: 40
diff changeset
    58
        &mainWindow,
hgs
parents: 40
diff changeset
    59
        *services ); // as CntAbstractServiceProvider
hgs
parents: 40
diff changeset
    60
    viewManager->setViewNavigator( navigator );
hgs
parents: 40
diff changeset
    61
hgs
parents: 40
diff changeset
    62
    services->setViewManager( *viewManager );
hgs
parents: 40
diff changeset
    63
hgs
parents: 40
diff changeset
    64
    // These objects talk with QT Highway (send/receive)
hgs
parents: 40
diff changeset
    65
    CntServiceProviderOld* serviceProviderOld = new CntServiceProviderOld( *services, &mainWindow ); // com.nokia.services.phonebookservices.Fetch
hgs
parents: 40
diff changeset
    66
    CntServiceProviderOld2* serviceProviderOld2 = new CntServiceProviderOld2( *services, &mainWindow ); // phonebookservices.Fetch
hgs
parents: 40
diff changeset
    67
    CntServiceProviderFetch* serviceProviderFetch = new CntServiceProviderFetch( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactFetch
hgs
parents: 40
diff changeset
    68
    CntServiceProviderViewing* serviceProviderViewing = new CntServiceProviderViewing( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactView
hgs
parents: 40
diff changeset
    69
    CntServiceProviderEdit* serviceProviderEdit = new CntServiceProviderEdit( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactEdit
24
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    mainWindow.show();
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    return a.exec();
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
}
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75