phonebookui/phonebookservices/src/main.cpp
author hgs
Tue, 21 Sep 2010 17:07:25 +0300
changeset 72 6abfb1094884
parent 66 554fe4dbbb59
child 81 640d30f4fb64
permissions -rw-r--r--
201037
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>
66
hgs
parents: 61
diff changeset
    22
#include <QScopedPointer>
50
hgs
parents: 40
diff changeset
    23
#include "cntserviceproviderold.h"
hgs
parents: 40
diff changeset
    24
#include "cntserviceproviderold2.h"
hgs
parents: 40
diff changeset
    25
#include "cntserviceproviderfetch.h"
hgs
parents: 40
diff changeset
    26
#include "cntserviceproviderold2.h"
hgs
parents: 40
diff changeset
    27
#include "cntserviceproviderviewing.h"
hgs
parents: 40
diff changeset
    28
#include "cntserviceprovideredit.h"
hgs
parents: 40
diff changeset
    29
#include "cntservices.h"
hgs
parents: 40
diff changeset
    30
#include "cntserviceviewmanager.h"
hgs
parents: 40
diff changeset
    31
#include "cntviewnavigator.h"
54
hgs
parents: 53
diff changeset
    32
#include "cntkeygrabber.h"
53
hgs
parents: 50
diff changeset
    33
#include "cntdebug.h"
50
hgs
parents: 40
diff changeset
    34
#include <cntviewparams.h>
24
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
int main(int argc, char **argv)
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
{
66
hgs
parents: 61
diff changeset
    38
#if defined (TRACES) || defined (TRACE2FILE)
53
hgs
parents: 50
diff changeset
    39
    qInstallMsgHandler(MSG_HANDLER);
66
hgs
parents: 61
diff changeset
    40
#endif
53
hgs
parents: 50
diff changeset
    41
    
24
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
    HbApplication a( argc, argv );
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
    QTranslator translator;
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
    QString lang = QLocale::system().name();
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
    QString path = "z:/resource/qt/translations/";
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
    translator.load(path + "contacts_" + lang);
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
    a.installTranslator(&translator);
50
hgs
parents: 40
diff changeset
    49
53
hgs
parents: 50
diff changeset
    50
    HbMainWindow mainWindow;
54
hgs
parents: 53
diff changeset
    51
    CntKeyGrabber *keyGrabber = new CntKeyGrabber(&mainWindow, &mainWindow);
50
hgs
parents: 40
diff changeset
    52
hgs
parents: 40
diff changeset
    53
    CntViewNavigator* navigator = new CntViewNavigator( &mainWindow );
72
hgs
parents: 66
diff changeset
    54
    navigator->addException( serviceEditView, noView );
53
hgs
parents: 50
diff changeset
    55
    navigator->addEffect( serviceContactCardView, historyView );
hgs
parents: 50
diff changeset
    56
    navigator->addEffect( historyView, serviceContactCardView );
61
hgs
parents: 54
diff changeset
    57
    navigator->addEffect( serviceGroupMemberView, groupActionsView );
hgs
parents: 54
diff changeset
    58
    navigator->addEffect( groupActionsView, serviceGroupMemberView );
hgs
parents: 54
diff changeset
    59
    navigator->addRoot( serviceGroupMemberView );
50
hgs
parents: 40
diff changeset
    60
hgs
parents: 40
diff changeset
    61
    // This object actually executes the services
hgs
parents: 40
diff changeset
    62
    CntServices* services = new CntServices();
hgs
parents: 40
diff changeset
    63
    services->setParent( &mainWindow ); // for ownership
hgs
parents: 40
diff changeset
    64
66
hgs
parents: 61
diff changeset
    65
    QScopedPointer<CntServiceViewManager> viewManager(new CntServiceViewManager(
50
hgs
parents: 40
diff changeset
    66
        &mainWindow,
66
hgs
parents: 61
diff changeset
    67
        *services )); // as CntAbstractServiceProvider
50
hgs
parents: 40
diff changeset
    68
    viewManager->setViewNavigator( navigator );
hgs
parents: 40
diff changeset
    69
61
hgs
parents: 54
diff changeset
    70
    services->setEngine( viewManager->engine() );
50
hgs
parents: 40
diff changeset
    71
hgs
parents: 40
diff changeset
    72
    // These objects talk with QT Highway (send/receive)
hgs
parents: 40
diff changeset
    73
    CntServiceProviderOld* serviceProviderOld = new CntServiceProviderOld( *services, &mainWindow ); // com.nokia.services.phonebookservices.Fetch
hgs
parents: 40
diff changeset
    74
    CntServiceProviderOld2* serviceProviderOld2 = new CntServiceProviderOld2( *services, &mainWindow ); // phonebookservices.Fetch
hgs
parents: 40
diff changeset
    75
    CntServiceProviderFetch* serviceProviderFetch = new CntServiceProviderFetch( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactFetch
hgs
parents: 40
diff changeset
    76
    CntServiceProviderViewing* serviceProviderViewing = new CntServiceProviderViewing( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactView
hgs
parents: 40
diff changeset
    77
    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
    78
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
    mainWindow.show();
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    return a.exec();
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
}
0ba2181d7c28 Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83