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 // System includes |
|
19 #include <QGraphicsLayout> |
|
20 #include <centralrepository.h> |
|
21 #include <xqsettingsmanager.h> |
|
22 #include <xqsettingskey.h> |
|
23 // User includes |
|
24 #include "ftudatetimewizard.h" |
|
25 #include "ftudatetimeview.h" |
|
26 #include "ftudatetimeprivatecrkeys.h" |
|
27 |
|
28 static const char* dateTimeTitle = "Date and Time"; |
|
29 static const char* dateTimeInfoText = "Set your Date Time and Location"; |
|
30 static const char* dateTimeStripIcon = |
|
31 ":/images/ftudatetimewizard_menustrip_icon.svg"; |
|
32 static const char* dateTimeTocIcon = ":/images/ftudatetimewizard_toc_icon.svg"; |
|
33 |
|
34 /*! |
|
35 \class FtuDateTimeWizard |
|
36 This is the FTU Date time plugin wizard |
|
37 */ |
|
38 |
|
39 /*! |
|
40 Constructor. |
|
41 */ |
|
42 FtuDateTimeWizard::FtuDateTimeWizard() |
|
43 { |
|
44 // Set up wizard settings |
|
45 mWizardSettings.mMenustripDefaultIcon = QFileInfo(dateTimeStripIcon); |
|
46 mWizardSettings.mMenustripPressedIcon = QFileInfo(dateTimeStripIcon); |
|
47 mWizardSettings.mMenustripFocussedIcon = QFileInfo(dateTimeStripIcon); |
|
48 mWizardSettings.mMenustripLabel = tr(dateTimeTitle); |
|
49 |
|
50 mWizardSettings.mTocDefaultIcon = QFileInfo(dateTimeTocIcon); |
|
51 mWizardSettings.mTocPressedIcon = QFileInfo(dateTimeTocIcon); |
|
52 mWizardSettings.mTocFocussedIcon = QFileInfo(dateTimeTocIcon); |
|
53 mWizardSettings.mTocLabel = tr(dateTimeTitle); |
|
54 } |
|
55 |
|
56 /*! |
|
57 Destructor. |
|
58 */ |
|
59 FtuDateTimeWizard::~FtuDateTimeWizard() |
|
60 { |
|
61 //delete mWizardSettings; |
|
62 } |
|
63 |
|
64 /*! |
|
65 Initialises the wizard.This is called by the FTU framework |
|
66 */ |
|
67 void FtuDateTimeWizard::initializeWizard(qint32 cenrepOwnerId, int wizardIdx) |
|
68 { |
|
69 Q_UNUSED(cenrepOwnerId) |
|
70 Q_UNUSED(wizardIdx) |
|
71 |
|
72 //Check if valid Nitz info is received |
|
73 XQSettingsManager *settingsManager = new XQSettingsManager(); |
|
74 XQSettingsKey *validNitzCenrepKey = |
|
75 new XQSettingsKey(XQSettingsKey::TargetCentralRepository, KCRUidNitz, KValidNitz); |
|
76 // Read the initial values from the cenrep |
|
77 int validNitz = settingsManager->readItemValue(*validNitzCenrepKey).toInt(); |
|
78 |
|
79 //Clean up |
|
80 delete validNitzCenrepKey; |
|
81 delete settingsManager; |
|
82 |
|
83 // The plugin will be loaded only if valid Nitz info is not received |
|
84 if(validNitz == 0) { |
|
85 // Set up view |
|
86 if (mFtuDateTimeView == NULL) { |
|
87 mFtuDateTimeView = new FtuDateTimeView(); |
|
88 mFtuDateTimeView->setAutomaticTimeUpdateOff(false); |
|
89 } |
|
90 // If our main view is not created, signal with false. |
|
91 emit wizardInitialized(this, ((mFtuDateTimeView) ? true: false)); |
|
92 } |
|
93 else { |
|
94 emit wizardInitialized(this, false); |
|
95 } |
|
96 } |
|
97 |
|
98 /*! |
|
99 Activates the wizard. |
|
100 Is called by the FTU framework when wizard becomes the current wizard |
|
101 */ |
|
102 void FtuDateTimeWizard::activateWizard() |
|
103 { |
|
104 mFtuDateTimeView->constructView(); |
|
105 // Signal info text to FTU framework |
|
106 emit |
|
107 infoTextUpdated(this, tr(dateTimeInfoText)); |
|
108 |
|
109 // Signal view change |
|
110 emit viewChanged(this, mFtuDateTimeView); |
|
111 } |
|
112 |
|
113 /*! |
|
114 Deactivates the wizard.Is called by FTU framework when wizard is no longer displayed. |
|
115 Frees up resources that need not persist between wizard plugin activations. |
|
116 */ |
|
117 void FtuDateTimeWizard::deactivateWizard() |
|
118 { |
|
119 // Destroy everything but the initial view and data that takes a long time |
|
120 // to reacquire when the plugin is later re-activated. |
|
121 } |
|
122 |
|
123 /*! |
|
124 Notifies the FTU FW how the wizard is been shutdown. |
|
125 Its called by FTU framework before the wizard plugin destructor is called. |
|
126 /param reason for the ShutDown |
|
127 */ |
|
128 bool FtuDateTimeWizard::shutdownWizard(FtuWizard::ShutdownReason reason) |
|
129 { |
|
130 // Destroy all views |
|
131 Q_UNUSED(reason); |
|
132 return true; |
|
133 } |
|
134 |
|
135 /*! |
|
136 Relayoutes the views for new size. |
|
137 /param geometry |
|
138 */ |
|
139 void FtuDateTimeWizard::resizeWizard(const QRectF& geometry) |
|
140 { |
|
141 Q_UNUSED(geometry) |
|
142 // Relayout view for new size |
|
143 } |
|
144 |
|
145 /*! |
|
146 Returns the settings for FTU framework. |
|
147 */ |
|
148 const FtuWizardSetting& FtuDateTimeWizard::wizardSettings() |
|
149 { |
|
150 return mWizardSettings; |
|
151 } |
|
152 |
|
153 /*! |
|
154 Handles the back event. |
|
155 */ |
|
156 bool FtuDateTimeWizard::handleBackEvent() |
|
157 { |
|
158 return false; |
|
159 } |
|
160 |
|
161 /*! |
|
162 Returns the wizard completed date. |
|
163 */ |
|
164 QDate FtuDateTimeWizard::wizardCompletedDate() |
|
165 { |
|
166 return (mFtuDateTimeView->getWizardCompletedDate()); |
|
167 } |
|
168 |
|
169 // End of file --Don't remove this. |
|