31 Class constructor. |
31 Class constructor. |
32 */ |
32 */ |
33 NmMailboxServiceInterface::NmMailboxServiceInterface(QObject *parent, |
33 NmMailboxServiceInterface::NmMailboxServiceInterface(QObject *parent, |
34 NmUiEngine &uiEngine, |
34 NmUiEngine &uiEngine, |
35 NmApplication *application) |
35 NmApplication *application) |
36 #ifndef NM_WINS_ENV |
|
37 : XQServiceProvider(emailFullServiceNameMailbox, parent), |
36 : XQServiceProvider(emailFullServiceNameMailbox, parent), |
38 #else |
|
39 : QObject(parent), |
|
40 #endif |
|
41 mUiEngine(uiEngine), |
37 mUiEngine(uiEngine), |
42 mApplication(application), |
38 mApplication(application), |
43 mAsyncReqId(0) |
39 mAsyncReqId(0) |
44 { |
40 { |
45 #ifndef NM_WINS_ENV |
|
46 publishAll(); |
41 publishAll(); |
47 #endif |
|
48 } |
42 } |
49 |
43 |
50 |
44 |
51 /*! |
45 /*! |
52 Class desctructor. |
46 Class desctructor. |
82 // Get standard folder inbox id. |
75 // Get standard folder inbox id. |
83 const NmId inboxId = mUiEngine.standardFolderId(mailboxNmId, NmFolderInbox); |
76 const NmId inboxId = mUiEngine.standardFolderId(mailboxNmId, NmFolderInbox); |
84 |
77 |
85 // Bring the application to the foreground. |
78 // Bring the application to the foreground. |
86 XQServiceUtil::toBackground(false); |
79 XQServiceUtil::toBackground(false); |
87 HbMainWindow *mainWindow = mApplication->mainWindow(); |
80 if (mApplication) { |
88 mainWindow->show(); |
81 HbMainWindow *mainWindow = mApplication->mainWindow(); |
|
82 mainWindow->show(); |
89 |
83 |
90 // Launch the message list view. |
84 // Launch the message list view. |
91 NmUiStartParam *startParam = |
85 NmUiStartParam *startParam = |
92 new NmUiStartParam(NmUiViewMessageList, |
86 new NmUiStartParam(NmUiViewMessageList, |
93 mailboxNmId, |
87 mailboxNmId, |
94 inboxId, // folder id |
88 inboxId, // folder id |
95 0, // message id |
89 0, // message id |
96 NmUiEditorCreateNew, // editor start mode |
90 NmUiEditorCreateNew, // editor start mode |
97 NULL, // address list |
91 NULL, // address list |
98 NULL, // attachment list |
92 NULL, // attachment list |
99 true); // start as service |
93 true); // start as service |
100 mApplication->enterNmUiView(startParam); |
94 mApplication->enterNmUiView(startParam); |
101 |
95 } |
|
96 |
102 completeRequest(mAsyncReqId, 0); |
97 completeRequest(mAsyncReqId, 0); |
103 } |
98 } |
104 else { |
99 else { |
105 // No mailbox found with the given ID. |
100 // No mailbox found with the given ID. |
106 |
101 |
115 if (XQServiceUtil::isService()) { |
110 if (XQServiceUtil::isService()) { |
116 connect(this, SIGNAL(returnValueDelivered()), |
111 connect(this, SIGNAL(returnValueDelivered()), |
117 mApplication, SLOT(delayedExitApplication())); |
112 mApplication, SLOT(delayedExitApplication())); |
118 } |
113 } |
119 } |
114 } |
120 #endif |
|
121 } |
115 } |
122 |
116 |
123 |
117 |
124 /*! |
118 /*! |
125 Resolves whether a mailbox with the given ID exists or not. |
119 Resolves whether a mailbox with the given ID exists or not. |
141 // Try to find the mailbox with the given ID. |
135 // Try to find the mailbox with the given ID. |
142 for (int i = 0; i < mailboxCount; ++i) { |
136 for (int i = 0; i < mailboxCount; ++i) { |
143 modelIndex = mailboxListModel.index(i, 0); |
137 modelIndex = mailboxListModel.index(i, 0); |
144 mailbox = mailboxListModel.data(modelIndex); |
138 mailbox = mailboxListModel.data(modelIndex); |
145 mailboxMetaData = mailbox.value<NmMailboxMetaData*>(); |
139 mailboxMetaData = mailbox.value<NmMailboxMetaData*>(); |
146 currentId = mailboxMetaData->id(); |
140 if (mailboxMetaData) { |
|
141 currentId = mailboxMetaData->id(); |
|
142 } |
147 |
143 |
148 if (currentId.id() == mailboxId.id()) { |
144 if (currentId.id() == mailboxId.id()) { |
149 // Found a mailbox with the matching ID. |
145 // Found a mailbox with the matching ID. |
150 return true; |
146 return true; |
151 } |
147 } |