|
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 <cpsettingformentryitemdataimpl.h> |
|
18 #include "cpnetworkplugin.h" |
|
19 #include "cpnetworkpluginview.h" |
|
20 #include "cppluginlogging.h" |
|
21 |
|
22 |
|
23 /*! |
|
24 CpNetworkPlugin::CpNetworkPlugin |
|
25 */ |
|
26 CpNetworkPlugin::CpNetworkPlugin() : |
|
27 QObject(NULL), |
|
28 m_localisation(NULL), |
|
29 m_networkStatus(NULL) |
|
30 { |
|
31 INSTALL_TRACE_MSG_HANDLER; |
|
32 DPRINT << ": IN"; |
|
33 |
|
34 // Create guarded objects |
|
35 m_localisation.reset(new CpPhoneLocalisation); |
|
36 m_networkStatus.reset(new CpNetworkStatus); |
|
37 |
|
38 // Install required translations |
|
39 m_localisation->installTranslator( |
|
40 CpPhoneLocalisation:: |
|
41 TranslationFileCommon); |
|
42 |
|
43 DPRINT << ": OUT"; |
|
44 } |
|
45 |
|
46 |
|
47 /*! |
|
48 CpNetworkPlugin::~CpNetworkPlugin |
|
49 */ |
|
50 CpNetworkPlugin::~CpNetworkPlugin() |
|
51 { |
|
52 DPRINT; |
|
53 UNINSTALL_TRACE_MSG_HANDLER; |
|
54 } |
|
55 |
|
56 |
|
57 /*! |
|
58 CpNetworkPlugin::createSettingFormItemData |
|
59 */ |
|
60 QList<CpSettingFormItemData*> CpNetworkPlugin::createSettingFormItemData( |
|
61 CpItemDataHelper &itemDataHelper) const |
|
62 { |
|
63 DPRINT << ": IN"; |
|
64 QList<CpSettingFormItemData*> ret; |
|
65 ret.append(new CpSettingFormEntryItemDataImpl<CpNetworkPluginView>( |
|
66 itemDataHelper, |
|
67 hbTrId("txt_cp_dblist_mobile_network"), |
|
68 m_networkStatus->statusText(), |
|
69 m_networkStatus->statusIcon())); |
|
70 |
|
71 m_networkStatus->setSettingFormItemData(ret.first()); |
|
72 |
|
73 DPRINT << ": OUT"; |
|
74 return ret; |
|
75 } |
|
76 |
|
77 /*! |
|
78 CpNetworkPlugin::createSettingView |
|
79 */ |
|
80 CpBaseSettingView *CpNetworkPlugin::createSettingView(const QVariant &hint) const |
|
81 { |
|
82 DPRINT << ": IN"; |
|
83 |
|
84 CpItemDataHelper *itemDataHelper(NULL); |
|
85 QScopedPointer<CpSettingFormEntryItemDataImpl<CpNetworkPluginView> > |
|
86 data(new CpSettingFormEntryItemDataImpl<CpNetworkPluginView>( |
|
87 *itemDataHelper, |
|
88 hbTrId("txt_cp_dblist_mobile_network"), |
|
89 m_networkStatus->statusText())); |
|
90 CpBaseSettingView *view = data->createSettingView(); |
|
91 |
|
92 CpNetworkPluginView *networkPluginView = qobject_cast<CpNetworkPluginView*>(view); |
|
93 QVariantHash hash = hint.value<QVariantHash>(); |
|
94 if ((hash.value("command").toString().compare("searchAvailableNetworks",Qt::CaseInsensitive) == 0) && |
|
95 networkPluginView){ |
|
96 networkPluginView->searchAvailableNetworks(); |
|
97 } |
|
98 |
|
99 DPRINT << ": OUT"; |
|
100 return view; |
|
101 } |
|
102 |
|
103 Q_EXPORT_PLUGIN2(CpNetworkPlugin, CpNetworkPlugin); |
|
104 |