author | hgs |
Tue, 05 Oct 2010 13:57:00 +0530 | |
changeset 81 | ce92091cbd61 |
parent 75 | 7ac58b2aae6f |
child 83 | 5aadd1120515 |
permissions | -rw-r--r-- |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* Definition file for class ClockMainView. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
* |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
// System includes |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <QGraphicsItem> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <HbInstance> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <HbLabel> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <HbAbstractViewItem> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <HbMenu> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <HbAction> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include <HbListView> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include <HbNotificationDialog> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <HbStyleLoader> |
57 | 29 |
#include <HbColorScheme> |
30 |
#include <HbApplication> // hbapplication |
|
31 |
#include <HbActivityManager> // activity manager |
|
75 | 32 |
#include <xqsettingsmanager.h> |
33 |
#include <xqsettingskey.h> |
|
34 |
#include <clockdomaincrkeys.h> |
|
81 | 35 |
#include <AfActivityStorage.h>//activity |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
// User includes |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#include "clockmainview.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
#include "clockdocloader.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
#include "clockappcontrollerif.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
#include "alarmclient.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
#include "clocksettingsview.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
#include "clockcommon.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
#include "clockalarmeditor.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
#include "settingsutility.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
#include "timezoneclient.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
#include "clockalarmlistitemprototype.h" |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
#include "clockalarmlistmodel.h" |
45 | 49 |
#include "clockwidget.h" |
57 | 50 |
#include "OstTraceDefinitions.h" |
51 |
#ifdef OST_TRACE_COMPILER_IN_USE |
|
52 |
#include "clockmainviewTraces.h" |
|
53 |
#endif |
|
54 |
||
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
\class ClockMainView |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
The main view of the clock application. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
Constructor. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
\param parent The parent of type QGraphicsWidget. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
ClockMainView::ClockMainView(QGraphicsItem *parent) |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
:HbView(parent), |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
mAlarmList(0), |
45 | 70 |
mSelectedItem(-1), |
71 |
mIsLongTop(false), |
|
72 |
mIsScreenShotCapruted(false) |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
{ |
57 | 74 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_CLOCKMAINVIEW_ENTRY ); |
45 | 75 |
// Nothing yet. |
57 | 76 |
OstTraceFunctionExit0( CLOCKMAINVIEW_CLOCKMAINVIEW_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
Destructor. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
ClockMainView::~ClockMainView() |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
83 |
{ |
57 | 84 |
OstTraceFunctionEntry0( DUP1_CLOCKMAINVIEW_CLOCKMAINVIEW_ENTRY ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
if (mDocLoader) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
86 |
delete mDocLoader; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
mDocLoader = 0; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
if (mAlarmListModel) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
delete mAlarmListModel; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
mAlarmListModel = 0; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
} |
75 | 93 |
if (mSettingsManager) { |
94 |
delete mSettingsManager; |
|
95 |
} |
|
96 |
// Delete cenrep key |
|
97 |
delete mClockTypeSettingsKey; |
|
98 |
||
45 | 99 |
HbStyleLoader::unregisterFilePath( |
100 |
":/style/clockalarmlistitemprototype.css"); |
|
101 |
HbStyleLoader::unregisterFilePath( |
|
102 |
":/style/clockalarmlistitemprototype.widgetml"); |
|
103 |
HbStyleLoader::unregisterFilePath( |
|
104 |
":/style/clockalarmlistitemprototype_color.css"); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
|
57 | 106 |
OstTraceFunctionExit0( DUP1_CLOCKMAINVIEW_CLOCKMAINVIEW_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
Called by the ClockViewManager after loading the view from the docml. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
The initializaion/setup of the view is done here. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
\param controller The ClockAppController object. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
\param docLoader Pointer to ClockDocLoader object. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
void ClockMainView::setupView( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
ClockAppControllerIf &controllerIf, ClockDocLoader *docLoader) |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
{ |
57 | 119 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_SETUPVIEW_ENTRY ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
mDocLoader = docLoader; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
mAppControllerIf = &controllerIf; |
81 | 122 |
//initialize the activity |
123 |
mActivityStorage = new AfActivityStorage(this); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
mTimezoneClient = controllerIf.timezoneClient(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
125 |
mSettingsUtility = controllerIf.settingsUtility(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
126 |
mAlarmClient = controllerIf.alarmClient(); |
57 | 127 |
|
128 |
// Fetch the color group of the labels from the theme. |
|
129 |
mLabelColorGroup = HbColorScheme::color("qtc_view_normal"); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
130 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
// Create the model. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
132 |
mAlarmListModel = new ClockAlarmListModel(*mAppControllerIf, this); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
connect( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
mAlarmListModel, SIGNAL(changeAlarmListDisplay()), |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
this, SLOT(handleAlarmListDisplay())); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
QList<AlarmInfo> alarmInfoList; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
// Get the list of pending clock alarms. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
mAlarmClient->getAlarmList(alarmInfoList); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
QList<AlarmInfo> displayInfoList; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
AlarmInfo alarmInfo; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
for (int index = 0; index < alarmInfoList.count(); ++index) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
alarmInfo = alarmInfoList[index]; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
if (Notified == alarmInfo.alarmState) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
continue; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
displayInfoList.append(alarmInfo); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
int alarmCount = displayInfoList.count(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
HbMainWindow *window = hbInstance->allMainWindows().first(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
bool loadSuccess = false; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
Qt::Orientation currentOrienation = window->orientation(); |
45 | 155 |
|
156 |
// Get the dividers. |
|
157 |
mHorizontalDivider = static_cast<HbLabel *> ( |
|
158 |
mDocLoader->findObject("horizontalDivider")); |
|
159 |
mVerticalDivider = static_cast<HbLabel *> ( |
|
160 |
mDocLoader->findObject("verticalDivider")); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
// Get the "No alarm set" label. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
mNoAlarmLabel = qobject_cast<HbLabel *> ( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
mDocLoader->findWidget(CLOCK_NOALARMLABEL)); |
57 | 165 |
mNoAlarmLabel->setTextColor(mLabelColorGroup); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
166 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
// Get the alarm's list. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
mAlarmList = qobject_cast<HbListView *> ( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
mDocLoader->findWidget(CLOCK_ALARMLIST)); |
70 | 170 |
mAlarmList->setItemPixmapCacheEnabled(true); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
connect( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
172 |
mAlarmList, SIGNAL(activated(const QModelIndex &)), |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
173 |
this, SLOT(handleActivated(const QModelIndex &))); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
174 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
175 |
connect( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
176 |
mAlarmList, |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)), |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
this, |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
SLOT(handleLongPress(HbAbstractViewItem*, const QPointF&))); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
|
45 | 181 |
HbStyleLoader::registerFilePath(":/style/clockalarmlistitemprototype.css"); |
182 |
HbStyleLoader::registerFilePath( |
|
183 |
":/style/clockalarmlistitemprototype.widgetml"); |
|
184 |
HbStyleLoader::registerFilePath( |
|
185 |
":/style/clockalarmlistitemprototype_color.css"); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
setmodel(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
// Load the correct section based on orientation. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
if (Qt::Vertical == currentOrienation) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
mDocLoader->load( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
CLOCK_MAIN_VIEW_DOCML, |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
CLOCK_MAIN_VIEW_PORTRAIT_SECTION, |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
&loadSuccess); |
45 | 194 |
mHorizontalDivider->setVisible(true); |
195 |
mVerticalDivider->setVisible(false); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
mDocLoader->load( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
198 |
CLOCK_MAIN_VIEW_DOCML, |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
CLOCK_MAIN_VIEW_LANDSCAPE_SECTION, |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
&loadSuccess); |
45 | 201 |
mHorizontalDivider->setVisible(false); |
202 |
mVerticalDivider->setVisible(true); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
204 |
if (loadSuccess) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
if (0 == alarmCount) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
hideAlarmList(true); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
207 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
hideAlarmList(false); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
mAlarmListModel->populateModel(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
210 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
|
45 | 213 |
mDayLabel = static_cast<HbLabel *> (mDocLoader->findObject("dateLabel")); |
57 | 214 |
mDayLabel->setTextColor(mLabelColorGroup); |
215 |
mPlaceLabel = static_cast<HbLabel *> (mDocLoader->findObject("placetext")); |
|
216 |
mPlaceLabel->setTextColor(mLabelColorGroup); |
|
81 | 217 |
mPlaceLabel->setAlignment(Qt::AlignLeft); |
218 |
mPlaceLabel->setTextWrapping(Hb::TextNoWrap); |
|
57 | 219 |
mDstIcon = static_cast<HbLabel *> (mDocLoader->findObject("dstIcon")); |
45 | 220 |
mClockWidget = static_cast<ClockWidget*> ( |
221 |
mDocLoader->findObject(CLOCK_WIDGET)); |
|
222 |
||
223 |
// Update the date info. |
|
224 |
updateDateLabel(); |
|
225 |
// Update the place info. |
|
226 |
updatePlaceLabel(mTimezoneClient->timeUpdateOn()); |
|
227 |
// Update clock widget display. |
|
228 |
updateClockWidget(); |
|
229 |
||
230 |
// Connect to orientation change and load appropriate section. |
|
231 |
connect( |
|
232 |
window, SIGNAL(orientationChanged(Qt::Orientation)), |
|
233 |
this, SLOT(checkOrientationAndLoadSection(Qt::Orientation))); |
|
234 |
||
81 | 235 |
|
45 | 236 |
|
81 | 237 |
// clean up any previous versions of this activity. |
45 | 238 |
// ignore return value as the first boot would always return a false |
239 |
// bool declared on for debugging purpose |
|
81 | 240 |
bool ok = removeActivity(); |
45 | 241 |
|
242 |
// connect for the aboutToQuit events on application Exit as to call saveActivity |
|
243 |
connect(qobject_cast<HbApplication*>(qApp), SIGNAL(aboutToQuit()), this, SLOT(saveActivity())); |
|
244 |
||
57 | 245 |
OstTraceFunctionExit0( CLOCKMAINVIEW_SETUPVIEW_EXIT ); |
45 | 246 |
} |
247 |
||
248 |
/*! |
|
249 |
To defer the connects and initialization. To be done after the view is drawn. |
|
250 |
Should be called in the slot of view ready. |
|
251 |
*/ |
|
252 |
void ClockMainView::setupAfterViewReady() |
|
253 |
{ |
|
57 | 254 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_SETUPAFTERVIEWREADY_ENTRY ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
// Get the toolbar/menu actions. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
mRefreshMainView = static_cast<HbAction *> ( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
mDocLoader->findObject("alarmsAction")); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
259 |
mRefreshMainView->setCheckable(true); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
mRefreshMainView->setChecked(true); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
connect( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
mRefreshMainView, SIGNAL(changed()), |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
this, SLOT(refreshMainView())); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
mDisplayWorldClockView = static_cast<HbAction *> ( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
mDocLoader->findObject("worldClockAction")); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
connect( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
mDisplayWorldClockView, SIGNAL(triggered()), |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
this, SLOT(displayWorldClockView())); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
mAddNewAlarm = static_cast<HbAction *> ( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
mDocLoader->findObject("newAlarmAction")); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
connect( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
mAddNewAlarm, SIGNAL(triggered()), |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
this, SLOT(addNewAlarm())); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
278 |
mSettingsAction = static_cast<HbAction *> ( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
mDocLoader->findObject("settingsAction")); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
connect( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
mSettingsAction, SIGNAL(triggered()), |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
282 |
this, SLOT(openSettings())); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
283 |
|
45 | 284 |
// Connect the necessary timezone client call backs. |
285 |
connect( |
|
286 |
mTimezoneClient, SIGNAL(timechanged()), |
|
287 |
this, SLOT(updateView())); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
connect( |
45 | 289 |
mTimezoneClient, SIGNAL(autoTimeUpdateChanged(int)), |
290 |
this, SLOT(updatePlaceLabel(int))); |
|
291 |
connect( |
|
292 |
mTimezoneClient, SIGNAL(cityUpdated()), |
|
293 |
this, SLOT(updatePlaceLabel())); |
|
294 |
||
75 | 295 |
// Connect for the clock type changes to refresh the view |
296 |
mSettingsManager = new XQSettingsManager(this); |
|
297 |
mClockTypeSettingsKey = new XQSettingsKey( |
|
298 |
XQSettingsKey::TargetCentralRepository, |
|
299 |
KCRUidClockApp, |
|
300 |
KClockType); |
|
301 |
mSettingsManager->startMonitoring(*mClockTypeSettingsKey); |
|
302 |
connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), |
|
303 |
this, SLOT(eventMonitor(XQSettingsKey, QVariant))); |
|
304 |
||
57 | 305 |
OstTraceFunctionExit0( CLOCKMAINVIEW_SETUPAFTERVIEWREADY_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
306 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
307 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
Slot which gets called for the status change of the alarm i.e for |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
310 |
active/inactive. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
311 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
312 |
\param row contains the row number of the alarm in the alarm list |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
313 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
void ClockMainView::handleAlarmStatusChanged(int row) |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
315 |
{ |
57 | 316 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_HANDLEALARMSTATUSCHANGED_ENTRY ); |
45 | 317 |
AlarmInfo alarmInfo; |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
319 |
// Get the data for the alarm. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
320 |
QList<QVariant> alarmData = |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
321 |
mAlarmListModel->sourceModel()->index(row, 0).data( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
322 |
AlarmDetails).toList(); |
45 | 323 |
int alarmId = alarmData.at(0).value<int>(); |
324 |
||
325 |
mAlarmClient->getAlarmInfo(alarmId, alarmInfo); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
326 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
327 |
mSelectedItem = row; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
328 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
329 |
if (-1 < mSelectedItem) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
330 |
QList<QVariant> alarmData = |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
331 |
mAlarmListModel->sourceModel()->index( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
332 |
mSelectedItem, 0).data(AlarmDetails).toList(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
333 |
int alarmId = alarmData.at(0).value<int>(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
334 |
QString displayNote; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
335 |
// Activate or deactivate the alarm depending on the alarm status. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
336 |
// Display the NotificationDialog with appropriate message. |
45 | 337 |
if (Snoozed == alarmInfo.alarmState && Enabled == alarmInfo.alarmStatus |
338 |
&& Once != alarmInfo.repeatType) { |
|
339 |
removeSnoozedAlarm(); |
|
340 |
displayNote.append(tr("Snoozed alarm removed")); |
|
341 |
}else if (Enabled == alarmInfo.alarmStatus) { |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
342 |
mAlarmClient->toggleAlarmStatus(alarmId, Disabled); |
45 | 343 |
displayNote.append( |
344 |
hbTrId("txt_clock_main_view_dpopinfo_alarm_deactivated")); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
345 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
346 |
mAlarmClient->toggleAlarmStatus(alarmId, Enabled); |
45 | 347 |
displayNote.append( |
348 |
hbTrId("txt_clock_main_view_dpopinfo_alarm_activated")); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
} |
45 | 350 |
|
351 |
HbNotificationDialog *dialog = new HbNotificationDialog(); |
|
352 |
dialog->setTitle(displayNote); |
|
353 |
dialog->setTimeout(HbPopup::ConfirmationNoteTimeout); |
|
354 |
dialog->show(); |
|
355 |
||
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
356 |
mSelectedItem = -1; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
357 |
} |
57 | 358 |
OstTraceFunctionExit0( CLOCKMAINVIEW_HANDLEALARMSTATUSCHANGED_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
359 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
360 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
361 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
362 |
Slot which gets called when `Alarm' action is triggered from the view |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
363 |
toolbar. This is responsible for reloading the content of the main view. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
364 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
void ClockMainView::refreshMainView() |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
366 |
{ |
57 | 367 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_REFRESHMAINVIEW_ENTRY ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
368 |
mRefreshMainView->setChecked(true); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
|
57 | 370 |
OstTraceFunctionExit0( CLOCKMAINVIEW_REFRESHMAINVIEW_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
371 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
372 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
373 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
374 |
Slot which gets called when `World clock' action is triggered from the view |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
375 |
toolbar. This is responsible for launching the world clock. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
376 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
377 |
void ClockMainView::displayWorldClockView() |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
378 |
{ |
57 | 379 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_DISPLAYWORLDCLOCKVIEW_ENTRY ); |
45 | 380 |
mAppControllerIf->switchToView(WorldClock); |
381 |
// no need to capture the screenshot here as it's done in ClockViewManager::showView |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
382 |
|
57 | 383 |
OstTraceFunctionExit0( CLOCKMAINVIEW_DISPLAYWORLDCLOCKVIEW_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
384 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
385 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
386 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
387 |
Slot which gets called when `New alarm' action is triggered from the view |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
388 |
toolbar. This is responsible for launching the editor to create a new alarm. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
389 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
390 |
void ClockMainView::addNewAlarm() |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
391 |
{ |
57 | 392 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_ADDNEWALARM_ENTRY ); |
45 | 393 |
ClockAlarmEditor *alarmEditor = new ClockAlarmEditor(*mAlarmClient); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
394 |
alarmEditor->showAlarmEditor(); |
45 | 395 |
// capture screenshot for future use, if application |
396 |
// is exited/Quit from alarmEditor |
|
397 |
captureScreenShot(true); |
|
57 | 398 |
OstTraceFunctionExit0( CLOCKMAINVIEW_ADDNEWALARM_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
399 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
400 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
401 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
402 |
Slot which gets called when `Settings' action is triggered from the view |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
menu. This is responsible for launching the settings view. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
void ClockMainView::openSettings() |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
406 |
{ |
57 | 407 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_OPENSETTINGS_ENTRY ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
408 |
// Create the settings view. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
409 |
ClockSettingsView *settingsView = new ClockSettingsView(this); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
410 |
settingsView->loadSettingsView(); |
45 | 411 |
// capture screenshot for future use, if application |
412 |
// is exited/Quit from alarmEditor |
|
413 |
captureScreenShot(true); |
|
57 | 414 |
OstTraceFunctionExit0( CLOCKMAINVIEW_OPENSETTINGS_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
415 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
416 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
417 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
This slot handles the 'activated' signal of the alarm list. Opens the |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
419 |
alarm editor to edit the alarm. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
420 |
\param index the modelIndex in the list which has been tapped. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
421 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
422 |
void ClockMainView::handleActivated(const QModelIndex &index) |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
423 |
{ |
57 | 424 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_HANDLEACTIVATED_ENTRY ); |
45 | 425 |
if(!mIsLongTop) {// Get the data for the alarm. |
426 |
int row = index.row(); |
|
427 |
QList<QVariant> alarmData = |
|
428 |
mAlarmListModel->sourceModel()->index(row, 0).data( |
|
429 |
AlarmDetails).toList(); |
|
430 |
int alarmId = alarmData.at(0).value<int>(); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
431 |
|
45 | 432 |
// Construct the alarm editor. |
433 |
ClockAlarmEditor *alarmEditor = new ClockAlarmEditor( |
|
434 |
*mAlarmClient, alarmId); |
|
435 |
alarmEditor->showAlarmEditor(); |
|
436 |
// capture screenshot for future use, if application |
|
437 |
// is exited/Quit from alarmEditor |
|
438 |
captureScreenShot(true); |
|
439 |
} |
|
57 | 440 |
OstTraceFunctionExit0( CLOCKMAINVIEW_HANDLEACTIVATED_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
441 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
442 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
443 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
444 |
This slot handles the 'longpressed' signal of the alarm list. Opens the |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
445 |
context menu. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
446 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
447 |
\param item The item in the list which has been long pressed. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
448 |
\param coords The position where mouse was pressed. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
449 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
450 |
void ClockMainView::handleLongPress( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
451 |
HbAbstractViewItem *item, const QPointF &coords) |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
452 |
{ |
57 | 453 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_HANDLELONGPRESS_ENTRY ); |
45 | 454 |
mIsLongTop = true; |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
455 |
AlarmInfo alarmInfo; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
456 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
457 |
// Save the item row number where the long press was made. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
458 |
mSelectedItem = item->modelIndex().row(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
459 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
460 |
// Get the data for the alarm. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
461 |
QList<QVariant> alarmData = |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
462 |
mAlarmListModel->sourceModel()-> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
463 |
index(mSelectedItem, 0).data(AlarmDetails).toList(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
464 |
int alarmId = alarmData.at(0).value<int>(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
465 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
466 |
mAlarmClient->getAlarmInfo(alarmId, alarmInfo); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
467 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
468 |
// On long press we display item specific context menu. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
469 |
HbMenu *itemContextMenu = new HbMenu(); |
45 | 470 |
connect( |
471 |
itemContextMenu,SIGNAL(aboutToClose()), |
|
472 |
this, SLOT(handleMenuClosed())); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
473 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
474 |
// Add the delete action to the context menu. |
45 | 475 |
mDeleteAction = itemContextMenu->addAction( |
476 |
hbTrId("txt_clk_main_view_menu_delete_alarm")); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
477 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
478 |
// Show the menu. |
45 | 479 |
itemContextMenu->open(this, SLOT(selectedMenuAction(HbAction*))); |
480 |
itemContextMenu->setPreferredPos(coords); |
|
481 |
itemContextMenu->setAttribute(Qt::WA_DeleteOnClose, true ); |
|
482 |
||
57 | 483 |
OstTraceFunctionExit0( CLOCKMAINVIEW_HANDLELONGPRESS_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
484 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
485 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
486 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
487 |
This slot handles the deletion of the alarm from the server. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
488 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
489 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
490 |
void ClockMainView::deleteAlarm() |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
491 |
{ |
57 | 492 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_DELETEALARM_ENTRY ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
493 |
if (-1 < mSelectedItem) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
494 |
// Get the data for the alarm. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
495 |
QList<QVariant> alarmData = mAlarmListModel->sourceModel()-> |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
496 |
index(mSelectedItem, 0).data(AlarmDetails).toList(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
497 |
int alarmId = alarmData.at(0).value<int>(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
498 |
mAlarmClient->deleteAlarm(alarmId); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
499 |
mSelectedItem = -1; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
500 |
} |
57 | 501 |
OstTraceFunctionExit0( CLOCKMAINVIEW_DELETEALARM_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
502 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
503 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
504 |
/*! |
45 | 505 |
Deltes the snoozed alarm. |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
506 |
*/ |
45 | 507 |
void ClockMainView::removeSnoozedAlarm() |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
508 |
{ |
57 | 509 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_REMOVESNOOZEDALARM_ENTRY ); |
45 | 510 |
if (-1 < mSelectedItem) { |
511 |
// Get the data for the alarm. |
|
512 |
QList<QVariant> alarmData = mAlarmListModel->sourceModel()-> |
|
513 |
index(mSelectedItem, 0).data(AlarmDetails).toList(); |
|
514 |
int alarmId = alarmData.at(0).value<int>(); |
|
515 |
mAlarmClient->deleteSnoozedAlarm(alarmId); |
|
516 |
mSelectedItem = -1; |
|
517 |
} |
|
57 | 518 |
OstTraceFunctionExit0( CLOCKMAINVIEW_REMOVESNOOZEDALARM_EXIT ); |
45 | 519 |
} |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
520 |
|
75 | 521 |
/*! |
522 |
Slot which is called when the value changes in cenrep. |
|
523 |
||
524 |
\param key The key which got changed in cenrep. |
|
525 |
\param value The new value of that key. |
|
526 |
*/ |
|
527 |
void ClockMainView::eventMonitor( |
|
528 |
const XQSettingsKey& key, const QVariant& value) |
|
529 |
{ |
|
530 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_EVENTMONITOR_ENTRY ); |
|
531 |
if (key.uid() == KCRUidClockApp && key.key() == KClockType) { |
|
532 |
// Update view |
|
533 |
updateView(); |
|
534 |
} |
|
535 |
OstTraceFunctionExit0( CLOCKMAINVIEW_EVENTMONITOR_EXIT ); |
|
536 |
} |
|
537 |
||
538 |
||
45 | 539 |
void ClockMainView::updateView() |
540 |
{ |
|
57 | 541 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATEVIEW_ENTRY ); |
45 | 542 |
// Update the place label. |
543 |
updatePlaceLabel(mTimezoneClient->timeUpdateOn()); |
|
544 |
// Update date label. |
|
545 |
updateDateLabel(); |
|
546 |
// Update clock widget. |
|
547 |
updateClockWidget(); |
|
81 | 548 |
captureScreenShot(false); |
57 | 549 |
OstTraceFunctionExit0( CLOCKMAINVIEW_UPDATEVIEW_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
550 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
551 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
552 |
/*! |
45 | 553 |
Slot which gets called for value change in auto time update in cenrep. |
554 |
||
555 |
\param autoTimeUpdate Value of auto time update. |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
556 |
*/ |
45 | 557 |
void ClockMainView::updatePlaceLabel(int autoTimeUpdate) |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
558 |
{ |
57 | 559 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATEPLACELABEL_ENTRY ); |
45 | 560 |
if (-1 == autoTimeUpdate) { |
561 |
autoTimeUpdate = mTimezoneClient->timeUpdateOn(); |
|
562 |
} |
|
563 |
||
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
564 |
// Get the current zone info. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
565 |
LocationInfo currentZoneInfo = mTimezoneClient->getCurrentZoneInfoL(); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
566 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
567 |
// Construct the GMT +/- X string. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
568 |
QString gmtOffset; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
569 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
570 |
int utcOffset = currentZoneInfo.zoneOffset; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
571 |
int offsetInHours (utcOffset/60); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
572 |
int offsetInMinutes (utcOffset%60); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
573 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
574 |
// Check wether the offset is +ve or -ve. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
575 |
if (0 < utcOffset) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
576 |
// We have a positive offset. Append the '+' character. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
577 |
gmtOffset += tr(" +"); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
578 |
} else if (0 > utcOffset) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
579 |
// We have a negative offset. Append the '-' character. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
580 |
gmtOffset += tr(" -"); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
581 |
offsetInHours = -offsetInHours; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
582 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
583 |
// We dont have an offset. We are at GMT zone. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
584 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
585 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
586 |
// Append the hour component. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
587 |
gmtOffset += QString::number(offsetInHours); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
588 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
589 |
// Get the time separator from settings and append it. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
590 |
QStringList timeSeparatorList; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
591 |
int index = mSettingsUtility->timeSeparator(timeSeparatorList); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
592 |
gmtOffset += timeSeparatorList.at(index); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
593 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
594 |
// Append the minute component. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
595 |
// If minute component is less less than 10, append a '00' |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
596 |
if (0 <= offsetInMinutes && offsetInMinutes < 10) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
597 |
gmtOffset += tr("00"); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
598 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
599 |
gmtOffset += QString::number(offsetInMinutes); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
600 |
} |
45 | 601 |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
602 |
// Append space. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
603 |
gmtOffset += tr(" "); |
45 | 604 |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
605 |
// Append GMT sting. |
55 | 606 |
gmtOffset += hbTrId("txt_clock_main_view_setlabel_gmt"); |
45 | 607 |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
608 |
// Append space. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
609 |
gmtOffset += tr(" "); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
610 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
611 |
// Append DST info. |
57 | 612 |
HbIcon *dstIcon = new HbIcon(""); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
613 |
if (currentZoneInfo.dstOn) { |
57 | 614 |
dstIcon->setIconName("qtg_mono_day_light_saving_time"); |
615 |
dstIcon->setColor(mLabelColorGroup); |
|
616 |
||
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
617 |
} |
57 | 618 |
mDstIcon->setIcon(*dstIcon); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
619 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
620 |
// Update the labels with the correct info. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
621 |
mPlaceLabel->clear(); |
45 | 622 |
if(autoTimeUpdate) { |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
623 |
mPlaceLabel->setPlainText( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
624 |
currentZoneInfo.countryName + tr(" ") + gmtOffset); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
625 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
626 |
mPlaceLabel->setPlainText( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
627 |
currentZoneInfo.cityName + tr(", ") |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
628 |
+ currentZoneInfo.countryName + tr(" ") + gmtOffset); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
629 |
} |
57 | 630 |
OstTraceFunctionExit0( CLOCKMAINVIEW_UPDATEPLACELABEL_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
631 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
632 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
633 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
634 |
Slot to either hide or show the alarmlist. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
635 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
636 |
void ClockMainView::handleAlarmListDisplay() |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
637 |
{ |
57 | 638 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_HANDLEALARMLISTDISPLAY_ENTRY ); |
45 | 639 |
// alarmEditor closed reset the captured screenshot, current view is main view now |
640 |
captureScreenShot(false); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
641 |
// Get the list of pending clock alarms from server. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
642 |
QList<AlarmInfo> alarmInfoList; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
643 |
QList<AlarmInfo> displayInfoList; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
644 |
AlarmInfo alarmInfo; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
645 |
mAlarmClient->getAlarmList(alarmInfoList); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
646 |
for (int index = 0; index < alarmInfoList.count(); ++index) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
647 |
alarmInfo = alarmInfoList[index]; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
648 |
if (Notified == alarmInfo.alarmState) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
649 |
continue; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
650 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
651 |
displayInfoList.append(alarmInfo); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
652 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
653 |
if (mHideAlarmList) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
654 |
hideAlarmList(false); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
655 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
656 |
if (0 == displayInfoList.count() && |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
657 |
0 == mAlarmListModel->sourceModel()->rowCount()) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
658 |
hideAlarmList(true); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
659 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
660 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
661 |
|
57 | 662 |
OstTraceFunctionExit0( CLOCKMAINVIEW_HANDLEALARMLISTDISPLAY_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
663 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
664 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
665 |
/*! |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
666 |
Slot to check the orientation & load the appropriate section. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
667 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
668 |
\param orientation contains the current orientation of the window. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
669 |
*/ |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
670 |
void ClockMainView::checkOrientationAndLoadSection( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
671 |
Qt::Orientation orientation) |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
672 |
{ |
57 | 673 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_CHECKORIENTATIONANDLOADSECTION_ENTRY ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
674 |
bool success; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
675 |
// If horizontal, load the landscape section. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
676 |
if (Qt::Horizontal == orientation) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
677 |
mDocLoader->load( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
678 |
CLOCK_MAIN_VIEW_DOCML, CLOCK_MAIN_VIEW_LANDSCAPE_SECTION, |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
679 |
&success); |
45 | 680 |
mHorizontalDivider->setVisible(false); |
681 |
mVerticalDivider->setVisible(true); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
682 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
683 |
mDocLoader->load( |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
684 |
CLOCK_MAIN_VIEW_DOCML, CLOCK_MAIN_VIEW_PORTRAIT_SECTION, |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
685 |
&success); |
45 | 686 |
mHorizontalDivider->setVisible(true); |
687 |
mVerticalDivider->setVisible(false); |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
688 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
689 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
690 |
if(success) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
691 |
QList<AlarmInfo> alarmInfoList; |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
692 |
// Get the list of all clock alarms. |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
693 |
mAlarmClient->getAlarmList(alarmInfoList); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
694 |
if (0 == alarmInfoList.count()) { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
695 |
hideAlarmList(true); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
696 |
} else { |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
697 |
hideAlarmList(false); |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
698 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
699 |
} |
57 | 700 |
OstTraceFunctionExit0( CLOCKMAINVIEW_CHECKORIENTATIONANDLOADSECTION_EXIT ); |
45 | 701 |
} |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
702 |
|
45 | 703 |
/*! |
704 |
Slot to handle context menu actions. |
|
705 |
*/ |
|
706 |
void ClockMainView::selectedMenuAction(HbAction *action) |
|
707 |
{ |
|
57 | 708 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_SELECTEDMENUACTION_ENTRY ); |
45 | 709 |
if (action == mDeleteAction) { |
710 |
deleteAlarm(); |
|
711 |
} |
|
57 | 712 |
OstTraceFunctionExit0( CLOCKMAINVIEW_SELECTEDMENUACTION_EXIT ); |
45 | 713 |
} |
714 |
||
715 |
/*! |
|
716 |
Slot to handle the context menu closed. |
|
717 |
*/ |
|
718 |
void ClockMainView::handleMenuClosed() |
|
719 |
{ |
|
57 | 720 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_HANDLEMENUCLOSED_ENTRY ); |
45 | 721 |
mIsLongTop = false; |
57 | 722 |
OstTraceFunctionExit0( CLOCKMAINVIEW_HANDLEMENUCLOSED_EXIT ); |
45 | 723 |
} |
724 |
/*! |
|
725 |
Sets the model to the alarm list. |
|
726 |
*/ |
|
727 |
void ClockMainView::setmodel() |
|
728 |
{ |
|
57 | 729 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_SETMODEL_ENTRY ); |
45 | 730 |
// Set the model. |
731 |
if (mAlarmList) { |
|
732 |
mAlarmList->setModel(mAlarmListModel->sourceModel()); |
|
733 |
ClockAlarmListItemPrototype *listItemPrototype = |
|
734 |
new ClockAlarmListItemPrototype(); |
|
735 |
connect( |
|
736 |
listItemPrototype, SIGNAL(alarmStatusHasChanged(int)), |
|
737 |
this, SLOT(handleAlarmStatusChanged(int))); |
|
738 |
mAlarmList->setItemPrototype(listItemPrototype); |
|
739 |
mAlarmList->setLayoutName("layout-alarmlist"); |
|
740 |
} |
|
741 |
||
57 | 742 |
OstTraceFunctionExit0( CLOCKMAINVIEW_SETMODEL_EXIT ); |
45 | 743 |
} |
744 |
||
745 |
/*! |
|
746 |
Hides the alarmlist in the main view. |
|
747 |
||
748 |
\param hide 'true' if alarm list is to be hidden. |
|
749 |
*/ |
|
750 |
void ClockMainView::hideAlarmList(bool hide) |
|
751 |
{ |
|
57 | 752 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_HIDEALARMLIST_ENTRY ); |
45 | 753 |
if (hide) { |
754 |
mNoAlarmLabel->show(); |
|
755 |
mAlarmList->hide(); |
|
756 |
mHideAlarmList = true; |
|
757 |
} else { |
|
758 |
mAlarmList->show(); |
|
759 |
mNoAlarmLabel->hide(); |
|
760 |
mHideAlarmList = false; |
|
761 |
} |
|
57 | 762 |
OstTraceFunctionExit0( CLOCKMAINVIEW_HIDEALARMLIST_EXIT ); |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
763 |
} |
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
764 |
|
45 | 765 |
/*! |
766 |
Updates the day and date in the day label. |
|
767 |
*/ |
|
768 |
void ClockMainView::updateDateLabel() |
|
769 |
{ |
|
57 | 770 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATEDATELABEL_ENTRY ); |
45 | 771 |
// Get the current datetime. |
772 |
QDateTime dateTime = QDateTime::currentDateTime(); |
|
773 |
// Get the day name. |
|
774 |
QString dayName = dateTime.toString("ddd"); |
|
775 |
// Get the date in correct format. |
|
776 |
QString currentDate = mSettingsUtility->date(); |
|
777 |
// Construct the day + date string. |
|
778 |
QString dayDateString; |
|
779 |
dayDateString+= dayName; |
|
780 |
dayDateString += " "; |
|
781 |
dayDateString += currentDate; |
|
782 |
||
783 |
mDayLabel->setPlainText(dayDateString); |
|
57 | 784 |
OstTraceFunctionExit0( CLOCKMAINVIEW_UPDATEDATELABEL_EXIT ); |
45 | 785 |
} |
786 |
||
787 |
/*! |
|
788 |
Updates the zone info in the place label. |
|
789 |
*/ |
|
790 |
/*void ClockMainView::updatePlaceLabel() |
|
791 |
{ |
|
792 |
updatePlaceLabel(mTimezoneClient->timeUpdateOn()); |
|
793 |
}*/ |
|
794 |
||
795 |
/*! |
|
796 |
Updates the clock widget display. |
|
797 |
*/ |
|
798 |
void ClockMainView::updateClockWidget() |
|
799 |
{ |
|
57 | 800 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATECLOCKWIDGET_ENTRY ); |
45 | 801 |
QStringList clockType; |
802 |
int index = mSettingsUtility->clockType(clockType); |
|
803 |
int zeroIndex(0); |
|
804 |
if(zeroIndex == index){ |
|
75 | 805 |
mClockWidget->setClockType(ClockWidget::ClockTypeAnalog); |
45 | 806 |
} else { |
75 | 807 |
mClockWidget->setClockType(ClockWidget::ClockTypeDigital); |
45 | 808 |
} |
809 |
||
810 |
QStringList timeFormat; |
|
811 |
||
812 |
if (zeroIndex == mSettingsUtility->timeFormat(timeFormat)) { |
|
813 |
mClockWidget->setTimeFormat(ClockWidget::TimeFormat24Hrs); |
|
814 |
} else { |
|
815 |
mClockWidget->setTimeFormat(ClockWidget::TimeFormat12Hrs); |
|
816 |
} |
|
817 |
||
818 |
mClockWidget->updateTime(); |
|
57 | 819 |
OstTraceFunctionExit0( CLOCKMAINVIEW_UPDATECLOCKWIDGET_EXIT ); |
45 | 820 |
} |
821 |
||
822 |
/*! |
|
823 |
CaptureScreenShot captures screen shot |
|
824 |
\param captureScreenShot bool to indicate if screenshot needs to be captured |
|
825 |
*/ |
|
826 |
void ClockMainView::captureScreenShot(bool captureScreenShot) |
|
827 |
{ |
|
57 | 828 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_CAPTURESCREENSHOT_ENTRY ); |
45 | 829 |
// check if screen shot needs to be captured |
830 |
if (captureScreenShot) { |
|
831 |
mScreenShot.clear(); |
|
832 |
mScreenShot.insert("screenshot", QPixmap::grabWidget(mainWindow(), mainWindow()->rect())); |
|
833 |
} |
|
834 |
mIsScreenShotCapruted = captureScreenShot; // set mIsScreenShotCapruted set validity of screenshot |
|
57 | 835 |
OstTraceFunctionExit0( CLOCKMAINVIEW_CAPTURESCREENSHOT_EXIT ); |
45 | 836 |
} |
837 |
||
838 |
/*! |
|
839 |
saveActivity saves main view as an activity |
|
840 |
*/ |
|
841 |
void ClockMainView::saveActivity() |
|
842 |
{ |
|
57 | 843 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_SAVEACTIVITY_ENTRY ); |
45 | 844 |
// check if a valid screenshot is already captured |
845 |
if (!mIsScreenShotCapruted) { |
|
846 |
mScreenShot.clear(); |
|
847 |
mScreenShot.insert("screenshot", QPixmap::grabWidget(mainWindow(), mainWindow()->rect())); |
|
848 |
} |
|
849 |
||
850 |
// save any data necessary to save the state |
|
851 |
QByteArray serializedActivity; |
|
852 |
QDataStream stream(&serializedActivity, QIODevice::WriteOnly | QIODevice::Append); |
|
853 |
stream << MainView; |
|
854 |
||
855 |
// add the activity to the activity manager |
|
81 | 856 |
bool ok = mActivityStorage->saveActivity(clockMainView, serializedActivity, mScreenShot); |
45 | 857 |
if ( !ok ) { |
858 |
qFatal("Add failed" ); |
|
859 |
} |
|
57 | 860 |
OstTraceFunctionExit0( CLOCKMAINVIEW_SAVEACTIVITY_EXIT ); |
45 | 861 |
} |
81 | 862 |
|
863 |
/*! |
|
864 |
Function to remove the activity |
|
865 |
*/ |
|
866 |
bool ClockMainView::removeActivity() |
|
867 |
{ |
|
868 |
OstTraceFunctionEntry0( CLOCKMAINVIEW_REMOVEACTIVITY_ENTRY ); |
|
869 |
OstTraceFunctionExit0( CLOCKMAINVIEW_REMOVEACTIVITY_EXIT ); |
|
870 |
return mActivityStorage->removeActivity(clockMainView); |
|
871 |
} |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
872 |
// End of file --Don't remove. |