19
|
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 |
#include "mainview.h"
|
|
18 |
#include <hbmenu.h>
|
|
19 |
#include <hbaction.h>
|
|
20 |
#include <qcoreapplication.h>
|
|
21 |
#include <cppluginlauncher.h>
|
|
22 |
#include <QStringList>
|
|
23 |
#include <cpbasesettingview.h>
|
|
24 |
#include <hbmessagebox.h>
|
|
25 |
#include <xqaiwrequest.h>
|
|
26 |
#include <XQServiceRequest.h>
|
|
27 |
|
|
28 |
MainView::MainView(QGraphicsItem *parent/* = 0*/)
|
|
29 |
: HbView(parent)
|
|
30 |
{
|
|
31 |
init();
|
|
32 |
}
|
|
33 |
|
|
34 |
MainView::~MainView()
|
|
35 |
{
|
|
36 |
|
|
37 |
}
|
|
38 |
|
|
39 |
void MainView::init()
|
|
40 |
{
|
|
41 |
setTitle(tr("CpPlugin Launcher"));
|
|
42 |
|
|
43 |
HbMenu *menu = new HbMenu();
|
|
44 |
setMenu(menu);
|
|
45 |
|
|
46 |
HbAction *action = menu->addAction(tr("Launch View(in process)"));
|
|
47 |
connect(action, SIGNAL(triggered()), this, SLOT(launchInProcessProfileView()));
|
|
48 |
|
|
49 |
action = menu->addAction(tr("Launch View(QtHighway)"));
|
|
50 |
connect(action, SIGNAL(triggered()), this, SLOT(launchQtHighwayProfileView()));
|
|
51 |
}
|
|
52 |
|
|
53 |
void MainView::launchInProcessProfileView()
|
|
54 |
{
|
|
55 |
CpBaseSettingView *settingView = CpPluginLauncher::launchSettingView("cppersonalizationplugin.dll","profile_view");
|
|
56 |
if (settingView) {
|
|
57 |
connect(settingView,SIGNAL(returnValueDelivered(QVariant)),this,SLOT(handleReturnValue(QVariant)));
|
|
58 |
}
|
|
59 |
}
|
|
60 |
|
|
61 |
void MainView::launchQtHighwayProfileView()
|
|
62 |
{
|
|
63 |
XQAiwRequest *request = mAppMgr.create("com.nokia.symbian.ICpPluginLauncher", "launchSettingView(QString,QVariant)", true);
|
|
64 |
|
|
65 |
if (!request)
|
|
66 |
{
|
|
67 |
return;
|
|
68 |
}
|
|
69 |
else
|
|
70 |
{
|
|
71 |
connect(request, SIGNAL(requestOk(QVariant)), SLOT(handleReturnValue(QVariant)));
|
|
72 |
connect(request, SIGNAL(requestError(int,QString)), SLOT(handleError(int,QString)));
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
// Set arguments for request
|
|
77 |
QList<QVariant> args;
|
|
78 |
args << QVariant( "cppersonalizationplugin.dll" );
|
|
79 |
args << QVariant ( "profile_view" );
|
|
80 |
request->setArguments(args);
|
|
81 |
|
|
82 |
// Make the request
|
|
83 |
if (!request->send())
|
|
84 |
{
|
|
85 |
//report error
|
|
86 |
}
|
|
87 |
|
|
88 |
delete request;
|
|
89 |
}
|
|
90 |
|
|
91 |
void MainView::handleReturnValue(const QVariant &returnValue)
|
|
92 |
{
|
|
93 |
HbMessageBox::information( QString("Return value:") + returnValue.toString());
|
|
94 |
}
|
|
95 |
|
|
96 |
void MainView::handleError(int errorCode,const QString &errorMessage)
|
|
97 |
{
|
|
98 |
HbMessageBox::information( QString("handle error:") + errorMessage);
|
|
99 |
}
|
|
100 |
|
|
101 |
//End of File
|