qtmobility/src/messaging/modestengine_maemo_p.h
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
   118     bool isUnread;
   118     bool isUnread;
   119     long long timeStamp;
   119     long long timeStamp;
   120 };
   120 };
   121 
   121 
   122 typedef enum {
   122 typedef enum {
       
   123     MessagingModestFolderTypeUnknown,
       
   124     MessagingModestFolderTypeNormal,
       
   125     MessagingModestFolderTypeInbox,
       
   126     MessagingModestFolderTypeOutbox,
       
   127     MessagingModestFolderTypeTrash,
       
   128     MessagingModestFolderTypeJunk,
       
   129     MessagingModestFolderTypeSent,
       
   130     MessagingModestFolderTypeRoot,
       
   131     MessagingModestFolderTypeNotes,
       
   132     MessagingModestFolderTypeDrafts,
       
   133     MessagingModestFolderTypeContacts,
       
   134     MessagingModestFolderTypeCalendar,
       
   135     MessagingModestFolderTypeArchive,
       
   136     MessagingModestFolderTypeMerge,
       
   137     MessagingModestFolderTypeNum
       
   138 } MessagingModestFolderType;
       
   139 
       
   140 struct MessagingModestFolder
       
   141 {
       
   142     QString id;
       
   143     QString modestId;
       
   144     QString parentAccountId;
       
   145     QString parentFolderId;
       
   146     MessagingModestFolderType type;
       
   147     QString name;
       
   148     QString localizedName;
       
   149 };
       
   150 
       
   151 typedef enum {
   123     MessagingModestMessageNotDefined  = 0,
   152     MessagingModestMessageNotDefined  = 0,
   124     MessagingModestMessageAnswered    = 1<<0,
   153     MessagingModestMessageAnswered    = 1<<0,
   125     MessagingModestMessageDeleted     = 1<<1,
   154     MessagingModestMessageDeleted     = 1<<1,
   126     MessagingModestMessageDraft       = 1<<2,
   155     MessagingModestMessageDraft       = 1<<2,
   127     MessagingModestMessageFlagged     = 1<<3,
   156     MessagingModestMessageFlagged     = 1<<3,
   133     MessagingModestMessageHasPriority = 1<<9|1<<10
   162     MessagingModestMessageHasPriority = 1<<9|1<<10
   134 } MessagingModestMessageFlags;
   163 } MessagingModestMessageFlags;
   135 
   164 
   136 typedef enum {
   165 typedef enum {
   137     MessagingModestMessagePriorityNotDefined = 0,
   166     MessagingModestMessagePriorityNotDefined = 0,
   138     MessagingModestMessageHighPriority       = 1<<9|1<<10,
   167     MessagingModestMessageHighPriority       = 0<<9|1<<10,
   139     MessagingModestMessageNormalPriority     = 0<<9|0<<10,
   168     MessagingModestMessageNormalPriority     = 0<<9|0<<10,
   140     MessagingModestMessageLowPriority        = 0<<9|1<<10,
   169     MessagingModestMessageLowPriority        = 1<<9|0<<10,
   141     MessagingModestMessageSuspendedPriority  = 1<<9|0<<10
       
   142 } MessagingModestMessagePriority;
   170 } MessagingModestMessagePriority;
   143 
   171 
   144 struct MessagingModestMimePart
   172 struct MessagingModestMimePart
   145 {   
   173 {   
   146     QString mimeType;
   174     QString mimeType;
   278                                                                      const QMessageFilter& filter,
   306                                                                      const QMessageFilter& filter,
   279                                                                      QMessageManager::NotificationFilterId id = 0);
   307                                                                      QMessageManager::NotificationFilterId id = 0);
   280     void unregisterNotificationFilter(QMessageManager::NotificationFilterId notificationFilterId);
   308     void unregisterNotificationFilter(QMessageManager::NotificationFilterId notificationFilterId);
   281     QByteArray getMimePart (const QMessageId &id, const QString &attachmentId);
   309     QByteArray getMimePart (const QMessageId &id, const QString &attachmentId);
   282 
   310 
       
   311     bool retrieveBody(QMessageService& messageService, const QMessageId &id);
       
   312     bool retrieve(QMessageService& messageService, const QMessageId &messageId, const QMessageContentContainerId &id, QMessage *msg = 0);
       
   313 
   283     void clearHeaderCache();
   314     void clearHeaderCache();
   284 
   315 
   285 private:
   316 private:
   286     QFileInfoList localFolders() const;
   317     QFileInfoList localFolders() const;
   287     void appendLocalSubFolders(QFileInfoList& fileInfoList, int startIndex) const;
   318     void appendLocalSubFolders(QFileInfoList& fileInfoList, int startIndex) const;
   288     void appendIMAPSubFolders(QFileInfoList& fileInfoList, int startIndex) const;
   319     void appendIMAPSubFolders(QFileInfoList& fileInfoList, int startIndex) const;
   289     QFileInfoList accountFolders(QMessageAccountId& accountId) const;
   320     QFileInfoList accountFolders(QMessageAccountId& accountId) const;
   290     QString localRootFolder() const;
   321     QString localRootFolder() const;
   291     QString accountRootFolder(QMessageAccountId& accountId) const;
   322     QString accountRootFolder(QMessageAccountId& accountId) const;
       
   323     void foldersFromModest(QList<MessagingModestFolder>& folders) const;
       
   324     bool startObservingModestFolder(const QMessageFolderId& folderId) const;
       
   325     bool stopObservingModestFolder(const QMessageFolderId& folderId) const;
   292     EmailProtocol accountEmailProtocol(QMessageAccountId& accountId) const;
   326     EmailProtocol accountEmailProtocol(QMessageAccountId& accountId) const;
   293     QString accountEmailProtocolAsString(const QMessageAccountId& accountId) const;
   327     QString accountEmailProtocolAsString(const QMessageAccountId& accountId) const;
   294     QString accountUsername(QMessageAccountId& accountId) const;
   328     QString accountUsername(QMessageAccountId& accountId) const;
   295     QString accountHostname(QMessageAccountId& accountId) const;
   329     QString accountHostname(QMessageAccountId& accountId) const;
   296 
   330 
   353     ModestStringMapList getModestAttachments(QMessage &message);
   387     ModestStringMapList getModestAttachments(QMessage &message);
   354     ModestStringMapList getModestImages(QMessage &message);
   388     ModestStringMapList getModestImages(QMessage &message);
   355     uint getModestPriority(QMessage &message);
   389     uint getModestPriority(QMessage &message);
   356     ModestStringMap getModestHeaders(QMessage &message);
   390     ModestStringMap getModestHeaders(QMessage &message);
   357 
   391 
       
   392     bool accountExists(const QMessageAccountId& accountId) const;
       
   393 
   358 private slots:
   394 private slots:
   359     void searchMessagesHeadersReceivedSlot(QDBusMessage msg);
   395     void searchMessagesHeadersReceivedSlot(QDBusMessage msg);
   360     void searchMessagesHeadersFetchedSlot(QDBusMessage msg);
   396     void searchMessagesHeadersFetchedSlot(QDBusMessage msg);
       
   397     void mimePartDownloadFinishedSlot(QDBusMessage msg);
   361     void folderUpdatedSlot(QDBusMessage msg);
   398     void folderUpdatedSlot(QDBusMessage msg);
   362     void messageReadChangedSlot(QDBusMessage msg);
   399     void messageReadChangedSlot(QDBusMessage msg);
   363     void pendingGetUnreadMessagesFinishedSlot(QDBusPendingCallWatcher* pendingCallWatcher);
   400     void pendingGetUnreadMessagesFinishedSlot(QDBusPendingCallWatcher* pendingCallWatcher);
   364     void pendingSearchFinishedSlot(QDBusPendingCallWatcher* pendingCallWatcher);
   401     void pendingSearchFinishedSlot(QDBusPendingCallWatcher* pendingCallWatcher);
   365     void fileChangedSlot(int watchDescriptor, QString filePath, uint events);
   402     void fileChangedSlot(int watchDescriptor, QString filePath, uint events);
   366     void sendEmailCallEnded(QDBusPendingCallWatcher *watcher);
   403     void sendEmailCallEnded(QDBusPendingCallWatcher *watcher);
   367     void addMessageCallEnded(QDBusPendingCallWatcher *watcher);
   404     void addMessageCallEnded(QDBusPendingCallWatcher *watcher);
   368     void stateChanged(QMessageService::State newState);
   405     void stateChanged(QMessageService::State newState);
   369     void returnQueryResultsSlot();
   406     void returnQueryResultsSlot();
       
   407     void modestFolderContentsChangedSlot(QDBusMessage msg);
   370 
   408 
   371 private: //Data
   409 private: //Data
   372     GConfClient *m_gconfclient;
   410     GConfClient *m_gconfclient;
   373 
   411 
   374     QDBusInterface *m_ModestDBusInterface;
   412     QDBusInterface *m_ModestDBusInterface;
   388 
   426 
   389     QMap<QString, QDateTime> accountsLatestTimestamp;
   427     QMap<QString, QDateTime> accountsLatestTimestamp;
   390 
   428 
   391     mutable QStringList m_latestAddOrRemoveNotifications;
   429     mutable QStringList m_latestAddOrRemoveNotifications;
   392 
   430 
       
   431     mutable QMap<QString, MessagingModestFolder> m_folderCache;
   393     mutable QMap<QString, QMessage> m_messageCache;
   432     mutable QMap<QString, QMessage> m_messageCache;
       
   433 
       
   434     mutable QMap<int, QMessageServicePrivate*> m_pending_downloads;
       
   435 
       
   436     mutable QMessageFolderIdList m_observed_folders;
   394 
   437 
   395     // Following variables are used for sync queries
   438     // Following variables are used for sync queries
   396     mutable QMessageService m_service;
   439     mutable QMessageService m_service;
   397     mutable QEventLoop      m_eventLoop;
   440     mutable QEventLoop      m_eventLoop;
   398     mutable QMessageIdList  m_ids;
   441     mutable QMessageIdList  m_ids;
   414 Q_DECLARE_METATYPE(QtMobility::INotifyWatcher::FileNotification);
   457 Q_DECLARE_METATYPE(QtMobility::INotifyWatcher::FileNotification);
   415 Q_DECLARE_METATYPE(QtMobility::ModestUnreadMessageDBusStruct);
   458 Q_DECLARE_METATYPE(QtMobility::ModestUnreadMessageDBusStruct);
   416 Q_DECLARE_METATYPE(QtMobility::ModestAccountsUnreadMessagesDBusStruct);
   459 Q_DECLARE_METATYPE(QtMobility::ModestAccountsUnreadMessagesDBusStruct);
   417 Q_DECLARE_METATYPE(QtMobility::ModestMessage);
   460 Q_DECLARE_METATYPE(QtMobility::ModestMessage);
   418 Q_DECLARE_METATYPE(QtMobility::MessagingModestMimePart);
   461 Q_DECLARE_METATYPE(QtMobility::MessagingModestMimePart);
       
   462 Q_DECLARE_METATYPE(QtMobility::MessagingModestFolder);
   419 
   463 
   420 #endif // MODESTENGINE_MAEMO_H
   464 #endif // MODESTENGINE_MAEMO_H
   421 
   465