summaryrefslogtreecommitdiffstats
path: root/src/messaging/modestengine_maemo_p.h
diff options
context:
space:
mode:
authorMarko Minkkinen <marko.minkkinen@digia.com>2010-03-25 18:49:21 +0200
committerDon Sanders <don.sanders@nokia.com>2010-03-29 16:29:02 +1000
commit89c0c2ce7b8b5331c5223ec5d4e4357cef55cdd7 (patch)
tree5278e71e896fcce07a4352be74f27dc98bfc95e8 /src/messaging/modestengine_maemo_p.h
parent5ea7e184fb0472332cae9f05cb9d86e21adf02df (diff)
Latest fixes + first working support library for auto tests
Fixes: MOBILITY-688 Synchronous query messages function not implemented
Diffstat (limited to 'src/messaging/modestengine_maemo_p.h')
-rw-r--r--src/messaging/modestengine_maemo_p.h48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/messaging/modestengine_maemo_p.h b/src/messaging/modestengine_maemo_p.h
index ce94f239af..901964f1bd 100644
--- a/src/messaging/modestengine_maemo_p.h
+++ b/src/messaging/modestengine_maemo_p.h
@@ -42,18 +42,21 @@
#ifndef MODESTENGINE_MAEMO_H
#define MODESTENGINE_MAEMO_H
-#include <QMap>
-#include <QString>
-#include <QDBusArgument>
-
#include "qmessagemanager.h"
#include "qmessagefilter_p.h"
+#include "qmessageservice.h"
+
#include "gconf/gconf-client.h"
#include "libosso.h"
+
+#include <QMap>
+#include <QString>
+#include <QDBusArgument>
#include <QDBusPendingCallWatcher>
#include <QFileInfoList>
#include <QThread>
#include <QMutex>
+#include <QEventLoop>
class QDBusInterface;
class QFileSystemWatcher;
@@ -85,6 +88,7 @@ struct MessageQueryInfo
int handledFiltersCount;
QMessageIdList ids;
QString realAccountId;
+ bool isQuery;
};
struct ModestUnreadMessageDBusStruct
@@ -164,6 +168,13 @@ struct MessagingModestMessage
QList<MessagingModestMimePart> mimeParts;
};
+struct EmailMessageNotification
+{
+ QString messageId;
+ int event;
+};
+
+
struct INotifyEvent
{
int watchDescriptor;
@@ -191,12 +202,13 @@ public:
QStringList files() const;
int addDirectory(const QString& path, uint eventsToWatch = 0);
QStringList directories() const;
+ void clear();
private slots:
void notifySlot();
signals:
- void fileChanged(int watchDescriptor, const QString& filePath, uint events);
+ void fileChanged(int watchDescriptor, QString filePath, uint events);
private: //Data
int m_inotifyFileDescriptor;
@@ -219,6 +231,7 @@ public:
enum NotificationType
{
+ None = 0,
Added,
Updated,
Removed
@@ -242,7 +255,7 @@ public:
int countFolders(const QMessageFolderFilter &filter) const;
QMessageFolder folder(const QMessageFolderId &id) const;
- QMessage message(const QMessageId &id) const;
+ QMessage message(const QMessageId &id, bool useCache = true) const;
bool addMessage(QMessage &message);
bool updateMessage(QMessage &message);
bool removeMessage(const QMessageId &id, QMessageManager::RemovalOption option);
@@ -254,6 +267,14 @@ public:
const QMessageSortOrder &sortOrder, uint limit, uint offset) const;
bool countMessages(QMessageService& messageService, const QMessageFilter &filter);
+ QMessageIdList queryMessagesSync(const QMessageFilter &filter, const QMessageSortOrder &sortOrder,
+ uint limit, uint offset, bool &isFiltered, bool &isSorted) const;
+ QMessageIdList queryMessagesSync(const QMessageFilter &filter, const QString &body,
+ QMessageDataComparator::MatchFlags matchFlags,
+ const QMessageSortOrder &sortOrder, uint limit, uint offset,
+ bool &isFiltered, bool &isSorted) const;
+ int countMessagesSync(const QMessageFilter &filter) const;
+
bool sendEmail(QMessage &message);
bool composeEmail(const QMessage &message);
bool showMessage(const QMessageId &id);
@@ -333,6 +354,8 @@ private:
uint getModestPriority(QMessage &message);
ModestStringMap getModestHeaders(QMessage &message);
+ int findNotificationFromLatestNotifications(const QMessageId& messageId) const;
+
private slots:
void searchMessagesHeadersReceivedSlot(QDBusMessage msg);
void searchMessagesHeadersFetchedSlot(QDBusMessage msg);
@@ -340,9 +363,10 @@ private slots:
void messageReadChangedSlot(QDBusMessage msg);
void pendingGetUnreadMessagesFinishedSlot(QDBusPendingCallWatcher* pendingCallWatcher);
void pendingSearchFinishedSlot(QDBusPendingCallWatcher* pendingCallWatcher);
- void fileChangedSlot(int watchDescriptor, const QString& filePath, uint events);
+ void fileChangedSlot(int watchDescriptor, QString filePath, uint events);
void sendEmailCallEnded(QDBusPendingCallWatcher *watcher);
void addMessageCallEnded(QDBusPendingCallWatcher *watcher);
+ void stateChanged(QMessageService::State newState);
private: //Data
GConfClient *m_gconfclient;
@@ -364,7 +388,17 @@ private: //Data
QMap<QString, QDateTime> accountsLatestTimestamp;
+ mutable QList<EmailMessageNotification> m_latestNotifications;
+
mutable QMap<QString, QMessage> m_messageCache;
+
+ // Following variables are used for sync queries
+ mutable QMessageService m_service;
+ mutable QEventLoop m_eventLoop;
+ mutable QMessageIdList m_ids;
+ mutable int m_count;
+ mutable bool m_isSorted;
+ mutable bool m_isFiltered;
};
QTM_END_NAMESPACE