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

0001 /*
0002     SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kimap_export.h"
0010 
0011 #include "job.h"
0012 
0013 namespace KIMAP
0014 {
0015 class Session;
0016 struct Response;
0017 class CreateJobPrivate;
0018 
0019 /**
0020  * Creates a new mailbox
0021  *
0022  * This job can only be run when the session is in the
0023  * authenticated (or selected) state.
0024  *
0025  * This job will fail if the mailbox already exists.
0026  *
0027  * If the server supports ACLs, the user must have the
0028  * Acl::CreateMailbox permission on the parent
0029  * mailbox.  Note that what is meant by "parent mailbox"
0030  * depends on the server: . and / are typical hierarchy
0031  * delimiters.
0032  */
0033 class KIMAP_EXPORT CreateJob : public Job
0034 {
0035     Q_OBJECT
0036     Q_DECLARE_PRIVATE(CreateJob)
0037 
0038     friend class SessionPrivate;
0039 
0040 public:
0041     explicit CreateJob(Session *session);
0042     ~CreateJob() override;
0043 
0044     /**
0045      * Set the name of the new mailbox
0046      *
0047      * @param mailBox  an (unquoted) identifier that does not correspond
0048      *                 to an existing mailbox name
0049      */
0050     void setMailBox(const QString &mailBox);
0051     /**
0052      * The name of the mailbox that will be created
0053      */
0054     [[nodiscard]] QString mailBox() const;
0055 
0056 protected:
0057     void doStart() override;
0058     void handleResponse(const Response &response) override;
0059 };
0060 
0061 }