~ubuntu-branches/ubuntu/quantal/qtmobility/quantal

« back to all changes in this revision

Viewing changes to src/messaging/maemohelpers_p.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-16 16:18:07 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20101116161807-k2dzt2nyse975r3l
Tags: 1.1.0-0ubuntu1
* New upstream release
* Syncronise with Debian, no remaining changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
**
9
9
** $QT_BEGIN_LICENSE:LGPL$
10
10
** Commercial Usage
11
 
** Licensees holding valid Qt Commercial licenses may use this file in
12
 
** accordance with the Qt Solutions Commercial License Agreement provided
13
 
** with the Software or, alternatively, in accordance with the terms
 
11
** Licensees holding valid Qt Commercial licenses may use this file in 
 
12
** accordance with the Qt Commercial License Agreement provided with
 
13
** the Software or, alternatively, in accordance with the terms
14
14
** contained in a written agreement between you and Nokia.
15
15
**
16
16
** GNU Lesser General Public License Usage
33
33
** ensure the GNU General Public License version 3.0 requirements will be
34
34
** met: http://www.gnu.org/copyleft/gpl.html.
35
35
**
36
 
** Please note Third Party Software included with Qt Solutions may impose
37
 
** additional restrictions and it is the user's responsibility to ensure
38
 
** that they have met the licensing requirements of the GPL, LGPL, or Qt
39
 
** Solutions Commercial license and the relevant license of the Third
40
 
** Party Software they are using.
41
 
**
42
36
** If you are unsure which license is appropriate for your use, please
43
37
** contact the sales department at qt-sales@nokia.com.
44
38
** $QT_END_LICENSE$
48
42
#ifndef QMESSAGINGMAEMOHELPERPRIVATE_H
49
43
#define QMESSAGINGMAEMOHELPERPRIVATE_H
50
44
 
 
45
#include <QString>
 
46
#include <QMutex>
 
47
#include <QCache>
 
48
 
51
49
#include <qmessageglobal.h>
 
50
#include <qmessage.h>
52
51
#include <qmessageid.h>
53
52
#include <qmessagesortorder.h>
54
53
#include <qmessageaccountid.h>
58
57
 
59
58
QTM_BEGIN_NAMESPACE
60
59
 
 
60
static const int maxMessageCacheSize = 100000;
 
61
 
61
62
class QMessageAccountFilter;
62
63
class QMessageAccountSortOrder;
63
64
class QMessageFolderFilter;
88
89
    static void handleNestedFiltersFromFolderFilter(QMessageFolderFilter &filter);
89
90
    static void handleNestedFiltersFromMessageFilter(QMessageFilter &filter);
90
91
 
 
92
    static bool preFilter(QMessageFilter &filter, QMessage::Type type);
 
93
 
91
94
private:
92
95
   static bool accountLessThan(const QMessageAccountId accountId1, const QMessageAccountId accountId2);
93
96
   static bool folderLessThan(const QMessageFolderId folderId1, const QMessageFolderId folderId2);
99
102
    QMessageSortOrder* m_MessageSortOrder;
100
103
};
101
104
 
 
105
class MessageCache
 
106
{
 
107
public:
 
108
    static MessageCache* instance();
 
109
 
 
110
    MessageCache();
 
111
    ~MessageCache();
 
112
 
 
113
    bool insert(const QMessage &message);
 
114
    bool update(const QMessage &message);
 
115
    bool remove(const QMessageId &id);
 
116
    QMessage message(const QMessageId &id);
 
117
 
 
118
    QMessageIdList messageIds();
 
119
 
 
120
    bool isFull() const;
 
121
    int count() const;
 
122
 
 
123
    bool insertObject(QMessage *message);
 
124
    QMessage* messageObject(const QMessageId &id);
 
125
    void lock();
 
126
    void unlock();
 
127
 
 
128
private:
 
129
    QCache<QString, QMessage> m_messageCache;
 
130
    QMutex m_mutex;
 
131
};
 
132
 
 
133
 
102
134
QTM_END_NAMESPACE
103
135
 
104
136
#endif // QMESSAGINGMAEMOHELPERPRIVATE_H