| author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> | 
| Fri, 17 Sep 2010 08:28:39 +0300 | |
| changeset 70 | a15d9966050f | 
| parent 52 | 12db4185673b | 
| permissions | -rw-r--r-- | 
| 31 | 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 | * class to manage differnt messaging views. | |
| 16 | * | |
| 17 | */ | |
| 18 | ||
| 19 | #ifndef MSGVIEWMANAGER_H_ | |
| 20 | #define MSGVIEWMANAGER_H_ | |
| 21 | ||
| 22 | #include <QObject> | |
| 43 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 23 | #include <QVariantList> | 
| 31 | 24 | #include <QVariant> | 
| 25 | ||
| 26 | class HbMainWindow; | |
| 27 | class MsgUnifiedEditorView; | |
| 28 | class MsgListView; | |
| 29 | class MsgConversationBaseView; | |
| 30 | class UnifiedViewer; | |
| 31 | class MsgBaseView; | |
| 32 | class DraftsListView; | |
| 33 | class MsgSettingsView; | |
| 34 | class HbAction; | |
| 35 | class HbView; | |
| 36 | ||
| 37 | class MsgViewManager: public QObject | |
| 38 | {
 | |
| 39 | Q_OBJECT | |
| 40 | ||
| 41 | public: | |
| 42 | /** | |
| 43 | * constructor | |
| 44 | */ | |
| 43 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 45 | MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 46 | QObject* parent = 0,int activityMsgId = -1); | 
| 31 | 47 | |
| 48 | /** | |
| 49 | * Destructor. | |
| 50 | */ | |
| 51 | ~MsgViewManager(); | |
| 52 | ||
| 53 | /** | |
| 54 | * call back function will be called from MsgServiceInterface. | |
| 55 | */ | |
| 56 | void send(const qint32 contactId, const QString phoneNumber, const QString displayName); | |
| 57 | ||
| 58 | /** | |
| 59 | * call back function called from MsgServiceInterface to set service request flag. | |
| 60 | */ | |
| 61 | void setServiceRequest(bool request); | |
| 62 | ||
| 63 | /** | |
| 64 | * call back function called MsgServiceInterface. | |
| 65 | */ | |
| 66 | void open(qint64 conversationId); | |
| 67 | ||
| 68 | /** | |
| 69 | * call back function called MsgServiceInterface. | |
| 70 | */ | |
| 71 | void send(QVariant data); | |
| 72 | ||
| 73 | /** | |
| 74 | * depricated api. will be removed in future. | |
| 75 | */ | |
| 76 | void openEditor(QString number, QString name); | |
| 77 | ||
| 78 | /** | |
| 79 | * call back function will be called from MsgServiceInterface. | |
| 80 | */ | |
| 81 | void send(const QString phoneNumber, const QString alias, const QString bodyText); | |
| 82 | ||
| 83 | /** | |
| 84 | * Opens the viewer to view the message. | |
| 85 | * @param msgId message id of the message. | |
| 86 | */ | |
| 87 | void view(int msgId); | |
| 88 | ||
| 34 
84197e66a4bd
Revision: 201021
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
31diff
changeset | 89 | /** | 
| 
84197e66a4bd
Revision: 201021
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
31diff
changeset | 90 | * Returns the current active view. | 
| 
84197e66a4bd
Revision: 201021
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
31diff
changeset | 91 | */ | 
| 
84197e66a4bd
Revision: 201021
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
31diff
changeset | 92 | int currentView(); | 
| 43 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 93 | |
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 94 | /** | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 95 | * Saves the content of editor or Cv to draft. | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 96 | */ | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 97 | int saveContentToDraft(); | 
| 70 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 98 | |
| 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 99 | /** | 
| 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 100 | * Handles the HW key events. | 
| 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 101 | * @param key key type. | 
| 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 102 | * @return true if key event handled else false. | 
| 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 103 | */ | 
| 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 104 | bool handleKeyEvent(int key); | 
| 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 105 | |
| 31 | 106 | private: | 
| 107 | /** | |
| 108 | * swiches back to last view after service request is complete. | |
| 109 | */ | |
| 110 | void switchToLastSavedView(); | |
| 111 | ||
| 112 | /** | |
| 113 | * find conversation id corresponding to given phone no. | |
| 114 | * @param phoneNum | |
| 115 | */ | |
| 116 | qint64 findConversationId(const QString phoneNum); | |
| 117 | ||
| 118 | /** | |
| 119 | * helper method to complete back action. | |
| 120 | */ | |
| 121 | void completeServiceRequest(); | |
| 122 | ||
| 123 | /* | |
| 124 | * switch to clv. | |
| 125 | */ | |
| 126 | void switchToClv(const QVariantList& data); | |
| 127 | ||
| 128 | /* | |
| 129 | * switch to cv. | |
| 130 | */ | |
| 131 | void switchToCv(const QVariantList& data); | |
| 132 | ||
| 133 | /* | |
| 134 | * switch to dlv. | |
| 135 | */ | |
| 136 | void switchToDlv(const QVariantList& data); | |
| 137 | ||
| 138 | /* | |
| 139 | * switch to unieditor. | |
| 140 | */ | |
| 141 | void switchToUniEditor(const QVariantList& data); | |
| 142 | ||
| 143 | /* | |
| 144 | * switch to univiewer. | |
| 145 | */ | |
| 146 | void switchToUniViewer(const QVariantList& data); | |
| 147 | ||
| 148 | /* | |
| 149 | * switch to settings. | |
| 150 | */ | |
| 151 | void switchToMsgSettings(const QVariantList& data); | |
| 152 | ||
| 153 | /* | |
| 154 | * handle other cases. | |
| 155 | */ | |
| 156 | void handleDefault(const QVariantList& data); | |
| 157 | ||
| 158 | /** | |
| 159 | * handle sms and mms messge | |
| 160 | * @param msgId message id | |
| 161 | */ | |
| 162 | void handleSmsMmsMsg(int msgId); | |
| 163 | ||
| 164 | /** | |
| 165 | * handle ringtone message | |
| 166 | * @param msgId message id | |
| 167 | */ | |
| 168 | void handleRingtoneMsg(int msgId); | |
| 169 | ||
| 170 | /** | |
| 171 | * handle provisioning message | |
| 172 | * @param msgId message id | |
| 173 | */ | |
| 174 | void handleProvisoningMsg(int msgId); | |
| 175 | ||
| 176 | /** | |
| 177 | * Appends the views to be deleted into a QList to be deleted when view is ready | |
| 178 | */ | |
| 179 | void appendViewToBeDeleted(HbView* view); | |
| 43 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 180 | |
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 181 | /** | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 182 | * Save the editor data to be populated | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 183 | * @param editorData QVariantList | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 184 | */ | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 185 | void populateUniEditorAfterViewReady(const QVariantList& editorData); | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 186 | |
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 187 | /** | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 188 | * opens unieditor as activity. | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 189 | * @param activityMsgId activity msg id. | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 190 | */ | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 191 | void openUniEditorActivity(int activityMsgId); | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 192 | |
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 193 | /** | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 194 | * find contact id corresponding to given phone no. | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 195 | * @param phoneNum | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 196 | */ | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 197 | qint32 findContactId(const QString address); | 
| 31 | 198 | |
| 199 | private slots: | |
| 200 | /** | |
| 201 | * this slot is called on mainwindows back action. | |
| 202 | */ | |
| 203 | void onBackAction(); | |
| 204 | ||
| 205 | /** | |
| 206 | * This slot is called when switchView signal is emitted from a view. | |
| 207 | */ | |
| 208 | void switchView(const QVariantList& data); | |
| 209 | ||
| 210 | /** | |
| 211 | * This slot is called when viewReady signal is emitted from main window. | |
| 212 | */ | |
| 213 | void setViewInteractive(); | |
| 214 | ||
| 215 | /** | |
| 216 | * Slot to delete previous view instances on view switch | |
| 217 | */ | |
| 218 | void deletePreviousView(); | |
| 219 | ||
| 220 | /** | |
| 221 | * This slot is called when delete message dialog is launched. | |
| 222 | * @param action selected action (yes or no). | |
| 223 | */ | |
| 224 | void onDialogDeleteMsg(HbAction* action); | |
| 225 | ||
| 226 | /** | |
| 227 | * This slot is called when save tone dialog is launched. | |
| 228 | * @param action selected action (yes or no). | |
| 229 | */ | |
| 230 | void onDialogSaveTone(HbAction* action); | |
| 43 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 231 | |
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 232 | /** | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 233 | * When this slot is called the saved editor data is set to the editor | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 234 | */ | 
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 235 | void populateUniEditorView(); | 
| 31 | 236 | |
| 237 | private: | |
| 238 | /** | |
| 239 | * main window reference not owned. | |
| 240 | */ | |
| 241 | HbMainWindow* mMainWindow; | |
| 242 | ||
| 243 | /** | |
| 244 | * different views. | |
| 245 | */ | |
| 246 | MsgUnifiedEditorView* mUniEditor; | |
| 247 | MsgListView* mListView; | |
| 248 | MsgConversationBaseView* mConversationView; | |
| 249 | UnifiedViewer* mUniViewer; | |
| 250 | DraftsListView* mDraftsListView; | |
| 251 | MsgSettingsView* mSettingsView; | |
| 70 
a15d9966050f
Revision: 201035
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
52diff
changeset | 252 | |
| 31 | 253 | HbAction* mBackAction; | 
| 254 | ||
| 255 | int mPreviousView; | |
| 256 | int mCurrentView; | |
| 257 | int mViewAtServiceRequest; | |
| 258 | bool mServiceRequest; | |
| 259 | qint64 mConversationId; | |
| 260 | bool mViewServiceRequest; | |
| 261 | QList<HbView*> mViewTobeDeleted; | |
| 262 | HbView* mDummyview; | |
| 263 | int mMessageId; | |
| 43 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 264 | |
| 
35b64624a9e7
Revision: 201023
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
34diff
changeset | 265 | QVariantList mEditorData; | 
| 52 
12db4185673b
Revision: 201031
 Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> parents: 
43diff
changeset | 266 | QVariantList mViewerData; | 
| 31 | 267 | }; | 
| 268 | ||
| 269 | #endif /* MSGVIEWMANAGER_H_ */ |