KMbox

mbox.h
1 /*
2  SPDX-FileCopyrightText: 2009 Bertjan Broeksema <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KMBOX_MBOX_H
8 #define KMBOX_MBOX_H
9 
10 #include "kmbox_export.h"
11 #include "mboxentry.h"
12 
13 #include <kmime/kmime_message.h>
14 
15 namespace KMBox {
16 class MBoxPrivate;
17 
24 class KMBOX_EXPORT MBox
25 {
26 public:
30  enum LockType {
31  ProcmailLockfile,
32  MuttDotlock,
33  MuttDotlockPrivileged,
34  None
35  };
36 
40  MBox();
41 
47  ~MBox();
48 
59  Q_REQUIRED_RESULT MBoxEntry appendMessage(const KMime::Message::Ptr &message);
60 
68  Q_REQUIRED_RESULT MBoxEntry::List entries(const MBoxEntry::List &deletedEntries = MBoxEntry::List()) const;
69 
73  Q_REQUIRED_RESULT QString fileName() const;
74 
87  Q_REQUIRED_RESULT bool load(const QString &fileName);
88 
101  Q_REQUIRED_RESULT bool lock();
102 
106  Q_REQUIRED_RESULT bool locked() const;
107 
126  Q_REQUIRED_RESULT bool purge(const MBoxEntry::List &deletedEntries, QVector<MBoxEntry::Pair> *movedEntries = nullptr);
127 
140  KMime::Message *readMessage(const MBoxEntry &entry);
141 
153  Q_REQUIRED_RESULT QByteArray readMessageHeaders(const MBoxEntry &entry);
154 
166  Q_REQUIRED_RESULT QByteArray readRawMessage(const MBoxEntry &entry);
167 
179  Q_REQUIRED_RESULT bool save(const QString &fileName = QString());
180 
190  Q_REQUIRED_RESULT bool setLockType(LockType ltype);
191 
199  void setLockFile(const QString &lockFile);
200 
208  void setUnlockTimeout(int msec);
209 
217  Q_REQUIRED_RESULT bool unlock();
233  void setReadOnly(bool ro = true);
234 
243  Q_REQUIRED_RESULT bool isReadOnly() const;
244 
245 private:
246  //@cond PRIVATE
247  Q_DISABLE_COPY(MBox)
248  friend class MBoxPrivate;
249  MBoxPrivate *const d;
250  //@endcond
251 };
252 }
253 
254 #endif // KMBOX_MBOX_H
A class to access mail storages in MBox format.
Definition: mbox.h:24
LockType
Describes the type of locking that will be used.
Definition: mbox.h:30
A class that encapsulates an entry of a MBox.
Definition: mboxentry.h:24
Definition: mbox.h:15
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 2 2020 23:08:05 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.