author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 23 Jun 2010 18:12:20 +0300 | |
changeset 45 | 6b911d05207e |
parent 37 | ba76fc04e6c2 |
child 50 | 377c906a8701 |
child 51 | f39ed5e045e0 |
permissions | -rw-r--r-- |
37 | 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 <hbdevicemessagebox.h> |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
19 |
#include <hbaction.h> |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
20 |
#include <cppluginlauncher.h> |
37 | 21 |
#include <hbinstance.h> |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
22 |
#include <hbview.h> |
37 | 23 |
#include <xqserviceutil.h> |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
24 |
#include <cpbasesettingview.h> |
37 | 25 |
|
26 |
#include "networkhandlingstarter_p.h" |
|
27 |
#include "networkhandlingstarterlogging.h" |
|
28 |
#include "cnetworklistener.h" |
|
29 |
||
30 |
/*! |
|
31 |
Constructor of NetworkHandlingStarterPrivate. |
|
32 |
*/ |
|
33 |
NetworkHandlingStarterPrivate::NetworkHandlingStarterPrivate(QObject *parent) : |
|
34 |
QObject(parent), m_note(NULL) |
|
35 |
{ |
|
36 |
DPRINT << ": IN"; |
|
37 |
||
38 |
QT_TRAP_THROWING(m_networkListener = CNetworkListener::NewL(*this)); |
|
39 |
||
40 |
DPRINT << ": OUT"; |
|
41 |
} |
|
42 |
||
43 |
/*! |
|
44 |
Destructor of NetworkHandlingStarterPrivate. |
|
45 |
*/ |
|
46 |
NetworkHandlingStarterPrivate::~NetworkHandlingStarterPrivate() |
|
47 |
{ |
|
48 |
DPRINT << ": IN"; |
|
49 |
||
50 |
delete m_networkListener; |
|
51 |
if (m_note) { |
|
52 |
delete m_note; |
|
53 |
} |
|
54 |
||
55 |
DPRINT << ": OUT"; |
|
56 |
} |
|
57 |
||
58 |
/*! |
|
59 |
NetworkHandlingStarterPrivate::ShowNote() |
|
60 |
*/ |
|
61 |
void NetworkHandlingStarterPrivate::ShowNote() |
|
62 |
{ |
|
63 |
DPRINT << ": IN"; |
|
64 |
||
65 |
if (m_note) { |
|
66 |
m_note->close(); |
|
67 |
delete m_note; |
|
68 |
m_note = NULL; |
|
69 |
} |
|
70 |
m_note = new HbDeviceMessageBox( |
|
71 |
hbTrId("txt_phone_info_network_lost_select_network"), |
|
72 |
HbMessageBox::MessageTypeQuestion); |
|
73 |
HbAction *primaryAction = new HbAction(hbTrId("txt_common_button_yes"), m_note); |
|
74 |
m_note->setAction(primaryAction, HbDeviceMessageBox::AcceptButtonRole); |
|
75 |
HbAction *secondaryAction = new HbAction(hbTrId("txt_common_button_no"), m_note); |
|
76 |
m_note->setAction(secondaryAction,HbDeviceMessageBox::RejectButtonRole); |
|
77 |
QObject::connect( |
|
78 |
primaryAction, SIGNAL(triggered()), |
|
79 |
this, SLOT(LaunchCpNetworkPluginView())); |
|
80 |
m_note->setTimeout(0); |
|
81 |
m_note->show(); |
|
82 |
||
83 |
DPRINT << ": OUT"; |
|
84 |
} |
|
85 |
||
86 |
/*! |
|
87 |
NetworkHandlingStarterPrivate::RemoveNote() |
|
88 |
*/ |
|
89 |
void NetworkHandlingStarterPrivate::RemoveNote() |
|
90 |
{ |
|
91 |
DPRINT << ": IN"; |
|
92 |
||
93 |
if (m_note) { |
|
94 |
m_note->close(); |
|
95 |
delete m_note; |
|
96 |
m_note = NULL; |
|
97 |
} |
|
98 |
||
99 |
DPRINT << ": OUT"; |
|
100 |
} |
|
101 |
||
102 |
/*! |
|
103 |
NetworkHandlingStarterPrivate::InitaliseCpNetworkPluginView() |
|
104 |
*/ |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
105 |
bool NetworkHandlingStarterPrivate::InitaliseCpNetworkPluginView() |
37 | 106 |
{ |
107 |
DPRINT << ": IN"; |
|
108 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
109 |
bool ok(false); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
110 |
CpBaseSettingView* view = CpPluginLauncher::launchSettingView("cpnetworkplugin"); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
111 |
if (view) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
112 |
if (QString(view->metaObject()->className()) == |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
113 |
QString("CpNetworkPluginView")) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
114 |
QObject::connect( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
115 |
view, SIGNAL(aboutToClose()), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
116 |
this, SLOT(ViewDone())); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
117 |
QObject::connect( |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
118 |
this, SIGNAL(SearchAvailableNetworks()), |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
119 |
view, SLOT(SearchAvailableNetworks())); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
120 |
ok = true; |
37 | 121 |
} |
122 |
} |
|
123 |
||
124 |
DPRINT << ": OUT"; |
|
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
125 |
return ok; |
37 | 126 |
} |
127 |
||
128 |
/*! |
|
129 |
NetworkHandlingStarterPrivate::LaunchCpNetworkPluginView() |
|
130 |
*/ |
|
131 |
void NetworkHandlingStarterPrivate::LaunchCpNetworkPluginView() |
|
132 |
{ |
|
133 |
DPRINT << ": IN"; |
|
134 |
||
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
135 |
if (InitaliseCpNetworkPluginView()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
136 |
DPRINT << ": Show network settings view"; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
137 |
HbMainWindow *mainWnd = MainWindow(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
138 |
if (mainWnd) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
139 |
mainWnd->show(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
140 |
XQServiceUtil::toBackground(false); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
141 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
142 |
emit SearchAvailableNetworks(); |
37 | 143 |
} |
144 |
||
145 |
DPRINT << ": OUT"; |
|
146 |
} |
|
147 |
||
148 |
/*! |
|
149 |
NetworkHandlingStarterPrivate::ViewDone() |
|
150 |
*/ |
|
151 |
void NetworkHandlingStarterPrivate::ViewDone() |
|
152 |
{ |
|
153 |
HbMainWindow *mainWnd = MainWindow(); |
|
154 |
if (mainWnd) { |
|
155 |
mainWnd->hide(); |
|
156 |
} |
|
157 |
XQServiceUtil::toBackground(true); |
|
158 |
} |
|
159 |
||
160 |
/*! |
|
161 |
NetworkHandlingStarterPrivate::MainWindow() |
|
162 |
*/ |
|
163 |
||
164 |
HbMainWindow * NetworkHandlingStarterPrivate::MainWindow() |
|
165 |
{ |
|
166 |
HbMainWindow *window(NULL); |
|
167 |
QList<HbMainWindow*> mainWindows = hbInstance->allMainWindows(); |
|
168 |
if (!mainWindows.isEmpty()) { |
|
169 |
window = mainWindows.front(); |
|
170 |
} |
|
171 |
return window; |
|
172 |
} |
|
173 |
||
174 |
// End of File. |