File indexing completed on 2024-05-12 05:17:25

0001 /*
0002     Copyright (c) 2009 Kevin Ottens <ervin@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or modify it
0005     under the terms of the GNU Library General Public License as published by
0006     the Free Software Foundation; either version 2 of the License, or (at your
0007     option) any later version.
0008 
0009     This library is distributed in the hope that it will be useful, but WITHOUT
0010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
0012     License for more details.
0013 
0014     You should have received a copy of the GNU Library General Public License
0015     along with this library; see the file COPYING.LIB.  If not, write to the
0016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017     02110-1301, USA.
0018 */
0019 
0020 #ifndef KIMAP2_STOREJOB_H
0021 #define KIMAP2_STOREJOB_H
0022 
0023 #include "kimap2_export.h"
0024 
0025 #include "job.h"
0026 #include "imapset.h"
0027 
0028 namespace KIMAP2
0029 {
0030 
0031 class Session;
0032 struct Message;
0033 class StoreJobPrivate;
0034 
0035 typedef QList<QByteArray> MessageFlags;
0036 
0037 class KIMAP2_EXPORT StoreJob : public Job
0038 {
0039     Q_OBJECT
0040     Q_DECLARE_PRIVATE(StoreJob)
0041 
0042     friend class SessionPrivate;
0043 
0044 public:
0045     enum StoreMode {
0046         SetFlags,
0047         AppendFlags,
0048         RemoveFlags
0049     };
0050 
0051     explicit StoreJob(Session *session);
0052     virtual ~StoreJob();
0053 
0054     void setSequenceSet(const ImapSet &set);
0055     ImapSet sequenceSet() const;
0056 
0057     void setUidBased(bool uidBased);
0058     bool isUidBased() const;
0059 
0060     void setFlags(const MessageFlags &flags);
0061     MessageFlags flags() const;
0062 
0063     void setGMLabels(const MessageFlags &gmLabels);
0064     MessageFlags gmLabels() const;
0065 
0066     void setMode(StoreMode mode);
0067     StoreMode mode() const;
0068 
0069     QMap<int, MessageFlags> resultingFlags() const;
0070 
0071 protected:
0072     void doStart() Q_DECL_OVERRIDE;
0073     void handleResponse(const Message &response) Q_DECL_OVERRIDE;
0074 };
0075 
0076 }
0077 
0078 #endif