|
1 /* |
|
2 * Copyright (c) 2010 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: This is for Positioning Settings plugin in ControlPanel |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "possettingsplugin.h" |
|
19 #include "possettingsview.h" |
|
20 #include "possettingspluginhelper.h" |
|
21 #include "apilogger.h" |
|
22 |
|
23 #include <QTCore> |
|
24 #include <QDebug> |
|
25 #include <QTranslator> |
|
26 #include <cpsettingformentryitemdataimpl.h> |
|
27 |
|
28 |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // PosSettingsPlugin::PosSettingsPlugin |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 PosSettingsPlugin::PosSettingsPlugin():mTranslator(0) |
|
35 { |
|
36 #ifndef QT_NO_DEBUG_OUTPUT |
|
37 ApiLogger::OpenLogFile(); |
|
38 qInstallMsgHandler(ApiLogger::MyOutputHandler); |
|
39 #endif |
|
40 |
|
41 qDebug() << "+ PosSettingsPluginHelper::PosSettingsPlugin()"; |
|
42 mTranslator = new QTranslator(); |
|
43 |
|
44 QString lang = QLocale::system().name(); |
|
45 QString path = "z:/resource/qt/translations/"; |
|
46 bool loaded = false; |
|
47 loaded = mTranslator->load(path + QString("lilocationmw_") + lang); |
|
48 if (loaded == false) |
|
49 { |
|
50 loaded = mTranslator->load("possettings", ":/translations"); |
|
51 } |
|
52 if (loaded) |
|
53 { |
|
54 qApp->installTranslator(mTranslator); |
|
55 } |
|
56 qDebug() << "- PosSettingsPluginHelper::PosSettingsPlugin()"; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // PosSettingsPlugin::~PosSettingsPlugin |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 PosSettingsPlugin::~PosSettingsPlugin() |
|
64 { |
|
65 qDebug() << "+ PosSettingsPluginHelper::~PosSettingsPlugin()"; |
|
66 if (mTranslator) |
|
67 { |
|
68 if (mTranslator->isEmpty() == false) |
|
69 qApp->removeTranslator(mTranslator); |
|
70 delete mTranslator; |
|
71 } |
|
72 qDebug() << "- PosSettingsPluginHelper::~PosSettingsPlugin()"; |
|
73 #ifndef QT_NO_DEBUG_OUTPUT |
|
74 qInstallMsgHandler(0); |
|
75 ApiLogger::CloseLogFile(); |
|
76 #endif |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // PosSettingsPlugin::createSettingFormItemData |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 QList<CpSettingFormItemData*> PosSettingsPlugin::createSettingFormItemData( |
|
84 CpItemDataHelper &itemDataHelper) const |
|
85 { |
|
86 qDebug() << "+ PosSettingsPluginHelper::createSettingFormItemData()"; |
|
87 PosSettingsPluginHelper helper; |
|
88 QList<CpSettingFormItemData*> formItemDataList; |
|
89 if (!helper.isFeatureFlagEnabled() && helper.isPositionPsyAvailable()) |
|
90 { |
|
91 CpSettingFormItemData *itemData = new CpSettingFormEntryItemDataImpl< |
|
92 PosSettingsView> (itemDataHelper, hbTrId( |
|
93 "txt_cp_dblist_positioning"), hbTrId( |
|
94 "txt_cp_dblist_positioning_val_change_positioning_s")); |
|
95 formItemDataList.append(itemData); |
|
96 } |
|
97 qDebug() << "- PosSettingsPluginHelper::createSettingFormItemData()"; |
|
98 return formItemDataList; |
|
99 } |
|
100 |
|
101 Q_EXPORT_PLUGIN2(possettingsplugin, PosSettingsPlugin) |
|
102 |