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

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_SELECTJOB_H
0021 #define KIMAP2_SELECTJOB_H
0022 
0023 #include "kimap2_export.h"
0024 
0025 #include "job.h"
0026 
0027 namespace KIMAP2
0028 {
0029 
0030 class Session;
0031 struct Message;
0032 class SelectJobPrivate;
0033 
0034 class KIMAP2_EXPORT SelectJob : public Job
0035 {
0036     Q_OBJECT
0037     Q_DECLARE_PRIVATE(SelectJob)
0038 
0039     friend class SessionPrivate;
0040 
0041 public:
0042     explicit SelectJob(Session *session);
0043     virtual ~SelectJob();
0044 
0045     void setMailBox(const QString &mailBox);
0046     QString mailBox() const;
0047 
0048     void setOpenReadOnly(bool readOnly);
0049     bool isOpenReadOnly() const;
0050 
0051     QList<QByteArray> flags() const;
0052     QList<QByteArray> permanentFlags() const;
0053 
0054     int messageCount() const;
0055     int recentCount() const;
0056     int firstUnseenIndex() const;
0057 
0058     qint64 uidValidity() const;
0059     qint64 nextUid() const;
0060 
0061     /**
0062      * @return Highest mod-sequence value of all messages in the mailbox or 0
0063      * if the server does not have CONDSTORE capability (RFC4551) or does not
0064      * support persistent storage of mod-sequences.
0065      *
0066      * @since 4.12
0067      */
0068     quint64 highestModSequence() const;
0069 
0070     /**
0071      * Whether to append CONDSTORE parameter to the SELECT command.
0072      *
0073      * This option is false by default and can be enabled only when server
0074      * has CONDSTORE capability (RFC4551), otherwise the SELECT command will
0075      * fail.
0076      *
0077      * @since 4.12
0078      */
0079     void setCondstoreEnabled(bool enable);
0080 
0081     /**
0082      * Returns whether the CONDSTORE parameter will be appended to SELECT command
0083      *
0084      * @since 4.12
0085      */
0086     bool condstoreEnabled() const;
0087 
0088 protected:
0089     void doStart() Q_DECL_OVERRIDE;
0090     void handleResponse(const Message &response) Q_DECL_OVERRIDE;
0091 };
0092 
0093 }
0094 
0095 #endif