qtmobility/src/messaging/modestengine_maemo_p.h
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
--- a/qtmobility/src/messaging/modestengine_maemo_p.h	Fri Jun 11 14:26:25 2010 +0300
+++ b/qtmobility/src/messaging/modestengine_maemo_p.h	Wed Jun 23 19:08:38 2010 +0300
@@ -120,6 +120,35 @@
 };
 
 typedef enum {
+    MessagingModestFolderTypeUnknown,
+    MessagingModestFolderTypeNormal,
+    MessagingModestFolderTypeInbox,
+    MessagingModestFolderTypeOutbox,
+    MessagingModestFolderTypeTrash,
+    MessagingModestFolderTypeJunk,
+    MessagingModestFolderTypeSent,
+    MessagingModestFolderTypeRoot,
+    MessagingModestFolderTypeNotes,
+    MessagingModestFolderTypeDrafts,
+    MessagingModestFolderTypeContacts,
+    MessagingModestFolderTypeCalendar,
+    MessagingModestFolderTypeArchive,
+    MessagingModestFolderTypeMerge,
+    MessagingModestFolderTypeNum
+} MessagingModestFolderType;
+
+struct MessagingModestFolder
+{
+    QString id;
+    QString modestId;
+    QString parentAccountId;
+    QString parentFolderId;
+    MessagingModestFolderType type;
+    QString name;
+    QString localizedName;
+};
+
+typedef enum {
     MessagingModestMessageNotDefined  = 0,
     MessagingModestMessageAnswered    = 1<<0,
     MessagingModestMessageDeleted     = 1<<1,
@@ -135,10 +164,9 @@
 
 typedef enum {
     MessagingModestMessagePriorityNotDefined = 0,
-    MessagingModestMessageHighPriority       = 1<<9|1<<10,
+    MessagingModestMessageHighPriority       = 0<<9|1<<10,
     MessagingModestMessageNormalPriority     = 0<<9|0<<10,
-    MessagingModestMessageLowPriority        = 0<<9|1<<10,
-    MessagingModestMessageSuspendedPriority  = 1<<9|0<<10
+    MessagingModestMessageLowPriority        = 1<<9|0<<10,
 } MessagingModestMessagePriority;
 
 struct MessagingModestMimePart
@@ -280,6 +308,9 @@
     void unregisterNotificationFilter(QMessageManager::NotificationFilterId notificationFilterId);
     QByteArray getMimePart (const QMessageId &id, const QString &attachmentId);
 
+    bool retrieveBody(QMessageService& messageService, const QMessageId &id);
+    bool retrieve(QMessageService& messageService, const QMessageId &messageId, const QMessageContentContainerId &id, QMessage *msg = 0);
+
     void clearHeaderCache();
 
 private:
@@ -289,6 +320,9 @@
     QFileInfoList accountFolders(QMessageAccountId& accountId) const;
     QString localRootFolder() const;
     QString accountRootFolder(QMessageAccountId& accountId) const;
+    void foldersFromModest(QList<MessagingModestFolder>& folders) const;
+    bool startObservingModestFolder(const QMessageFolderId& folderId) const;
+    bool stopObservingModestFolder(const QMessageFolderId& folderId) const;
     EmailProtocol accountEmailProtocol(QMessageAccountId& accountId) const;
     QString accountEmailProtocolAsString(const QMessageAccountId& accountId) const;
     QString accountUsername(QMessageAccountId& accountId) const;
@@ -355,9 +389,12 @@
     uint getModestPriority(QMessage &message);
     ModestStringMap getModestHeaders(QMessage &message);
 
+    bool accountExists(const QMessageAccountId& accountId) const;
+
 private slots:
     void searchMessagesHeadersReceivedSlot(QDBusMessage msg);
     void searchMessagesHeadersFetchedSlot(QDBusMessage msg);
+    void mimePartDownloadFinishedSlot(QDBusMessage msg);
     void folderUpdatedSlot(QDBusMessage msg);
     void messageReadChangedSlot(QDBusMessage msg);
     void pendingGetUnreadMessagesFinishedSlot(QDBusPendingCallWatcher* pendingCallWatcher);
@@ -367,6 +404,7 @@
     void addMessageCallEnded(QDBusPendingCallWatcher *watcher);
     void stateChanged(QMessageService::State newState);
     void returnQueryResultsSlot();
+    void modestFolderContentsChangedSlot(QDBusMessage msg);
 
 private: //Data
     GConfClient *m_gconfclient;
@@ -390,8 +428,13 @@
 
     mutable QStringList m_latestAddOrRemoveNotifications;
 
+    mutable QMap<QString, MessagingModestFolder> m_folderCache;
     mutable QMap<QString, QMessage> m_messageCache;
 
+    mutable QMap<int, QMessageServicePrivate*> m_pending_downloads;
+
+    mutable QMessageFolderIdList m_observed_folders;
+
     // Following variables are used for sync queries
     mutable QMessageService m_service;
     mutable QEventLoop      m_eventLoop;
@@ -416,6 +459,7 @@
 Q_DECLARE_METATYPE(QtMobility::ModestAccountsUnreadMessagesDBusStruct);
 Q_DECLARE_METATYPE(QtMobility::ModestMessage);
 Q_DECLARE_METATYPE(QtMobility::MessagingModestMimePart);
+Q_DECLARE_METATYPE(QtMobility::MessagingModestFolder);
 
 #endif // MODESTENGINE_MAEMO_H