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 #ifndef CPPHONENOTES_H |
|
18 #define CPPHONENOTES_H |
|
19 |
|
20 #include <QObject> |
|
21 #include <QString> |
|
22 #include <QQueue> |
|
23 #include <hbmessagebox.h> |
|
24 #include <psetcalldivertingwrapper.h> |
|
25 #include "cptelephonyutilsdefs.h" |
|
26 |
|
27 class CpSettingsWrapper; |
|
28 class HbInputDialog; |
|
29 class QValidator; |
|
30 |
|
31 using namespace CpTelephonyUtils; |
|
32 |
|
33 class CPTELEPHONYUTILS_EXPORT CpPhoneNotes: public QObject |
|
34 { |
|
35 Q_OBJECT |
|
36 |
|
37 public: |
|
38 |
|
39 static CpPhoneNotes* instance(); |
|
40 |
|
41 private: |
|
42 |
|
43 CpPhoneNotes(); |
|
44 |
|
45 ~CpPhoneNotes(); |
|
46 |
|
47 Q_DISABLE_COPY(CpPhoneNotes) |
|
48 |
|
49 signals: |
|
50 |
|
51 /** |
|
52 This signal is emitted when the device progress dialog is cancelled by |
|
53 user pressing the "cancel" button or by the application itself. |
|
54 @param noteId On return contains unique note identifier. |
|
55 */ |
|
56 void progressNoteCanceled(); |
|
57 |
|
58 /** |
|
59 This signal is emitted when the user coplete password query. |
|
60 @param password On return contains user given password. |
|
61 @param ok True if the user pressed OK, false if the user |
|
62 pressed Cancel. |
|
63 */ |
|
64 void passwordQueryCompleted( |
|
65 QString password, |
|
66 bool okPressed); |
|
67 |
|
68 public slots: // Slots: |
|
69 |
|
70 /** |
|
71 Shows global progress note. Note showing may be delayed if other note |
|
72 showing is ongoing. |
|
73 @param noteId On return contains unique note identifier. |
|
74 @param text Text to show on a note. |
|
75 */ |
|
76 void showGlobalProgressNote(int ¬eId, const QString& text); |
|
77 |
|
78 /** |
|
79 Shows global note. Note showing may be delayed if other note |
|
80 showing is ongoing. |
|
81 @param noteId On return contains unique note identifier. |
|
82 @param text Text to show on a note. |
|
83 @param noteType Note type. |
|
84 */ |
|
85 void showGlobalNote(int ¬eId, const QString& text, |
|
86 HbMessageBox::MessageBoxType noteType); |
|
87 |
|
88 /** |
|
89 Shows global error note. Note showing may be delayed if other note |
|
90 showing is ongoing. |
|
91 @param noteId On return contains unique note identifier. |
|
92 @param errorCode Code specifying error situation. |
|
93 */ |
|
94 void showGlobalErrorNote(int ¬eId, int errorCode); |
|
95 |
|
96 /** |
|
97 Shows the basic service list. |
|
98 @param title Heading to be used for the list. |
|
99 @param basicServiceGroupIds Basic services to be listed. |
|
100 */ |
|
101 void showBasicServiceList( |
|
102 const QString &title, |
|
103 const QList<unsigned char> &basicServiceGroupIds); |
|
104 |
|
105 /** |
|
106 Shows detailed call divert information about the selected divert service |
|
107 group. |
|
108 @param divertStatus Divert status information. |
|
109 */ |
|
110 void showCallDivertDetails( |
|
111 const PSCallDivertingStatus &divertStatus); |
|
112 |
|
113 /** |
|
114 Shows password query dialog with OK & Cancel buttons and returns user |
|
115 given password unless user has canceled query. Only valid password is |
|
116 accepted. |
|
117 @param title Title for the query dialog. |
|
118 @param validator Password validator. |
|
119 @param maxPasswordLength Maximum length for the password. |
|
120 */ |
|
121 void showPasswordQueryDialog( |
|
122 const QString &title, |
|
123 const QValidator &validator, |
|
124 int maxPasswordLength); |
|
125 |
|
126 /** |
|
127 Cancels specified note. |
|
128 @param noteId Note identifier. |
|
129 */ |
|
130 void cancelNote(int noteId); |
|
131 |
|
132 /** |
|
133 Retuns true if note is currently shown. |
|
134 */ |
|
135 bool noteShowing(); |
|
136 |
|
137 /** |
|
138 Slot for HbDialog finished singal. |
|
139 */ |
|
140 void finishedPasswordQueryDialog(HbAction* action); |
|
141 |
|
142 private: |
|
143 |
|
144 /** |
|
145 Resolves basic service group name by identifier. |
|
146 @param basicServiceGroupId Group identifier. |
|
147 @return Group name. |
|
148 */ |
|
149 QString basicServiceGroupName(BasicServiceGroups basicServiceGroupId) const; |
|
150 |
|
151 /** |
|
152 Formats phone number according to locale specific rules. |
|
153 @param number Unformatted phone number. |
|
154 @return Formatted number. |
|
155 */ |
|
156 QString formatPhoneNumber(QString number) const; |
|
157 |
|
158 /** |
|
159 Launches next note in the queue if not busy with showing other |
|
160 note currently. |
|
161 */ |
|
162 void launchNextNoteIfReady(); |
|
163 |
|
164 private slots: |
|
165 |
|
166 /** |
|
167 Handler method for notes' about to close signal. |
|
168 */ |
|
169 void activeNoteAboutToClose(); |
|
170 |
|
171 /** |
|
172 Handler method for notes' canceled signal. |
|
173 */ |
|
174 void handleProgressNoteCanceled(); |
|
175 |
|
176 /** |
|
177 Used for dynamic enable/disable of password dialog's OK button according |
|
178 to validity of the currently inputted password. |
|
179 */ |
|
180 void passwordTextChanged(); |
|
181 |
|
182 private: // Data: |
|
183 |
|
184 /** |
|
185 Cenrep settings wrapper. |
|
186 */ |
|
187 CpSettingsWrapper *m_cpSettingsWrapper; |
|
188 |
|
189 /** |
|
190 Notes waiting to be shown. |
|
191 */ |
|
192 QQueue<QObject*> *m_notesQueue; |
|
193 |
|
194 /** |
|
195 Indicates whether note controller is busy with some note showing. |
|
196 */ |
|
197 bool m_isNoteShowingOngoing; |
|
198 |
|
199 /** |
|
200 Password query dialog. Own. |
|
201 */ |
|
202 HbInputDialog *m_passwordDialog; |
|
203 |
|
204 /** |
|
205 Password validator. Not own. |
|
206 */ |
|
207 const QValidator *m_passwordValidator; |
|
208 }; |
|
209 #endif // CPPHONENOTES_H |
|