File indexing completed on 2024-11-24 04:39:33

0001 /*
0002   SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akonadi-contact-widgets_export.h"
0010 
0011 #include <KJob>
0012 
0013 #include <memory>
0014 
0015 namespace Akonadi
0016 {
0017 class OpenEmailAddressJobPrivate;
0018 
0019 /**
0020  * @short A job to open the contact editor for a contact with a given email address.
0021  *
0022  * The job will check whether a contact with the given email address already
0023  * exists in Akonadi. If not, it will add a new contact with the email address
0024  * to Akonadi and then opens the contact editor.
0025  */
0026 class AKONADI_CONTACT_WIDGETS_EXPORT OpenEmailAddressJob : public KJob
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     /**
0032      * Creates a new open email address job.
0033      *
0034      * @param email The email address to open.
0035      * @param parentWidget The widget that will be used as parent for dialog.
0036      * @param parent The parent object.
0037      */
0038     explicit OpenEmailAddressJob(const QString &email, QWidget *parentWidget, QObject *parent = nullptr);
0039 
0040     /**
0041      * Destroys the open email address job.
0042      */
0043     ~OpenEmailAddressJob() override;
0044 
0045     /**
0046      * Starts the job.
0047      */
0048     void start() override;
0049 
0050 private:
0051     //@cond PRIVATE
0052     friend class OpenEmailAddressJobPrivate;
0053     std::unique_ptr<OpenEmailAddressJobPrivate> const d;
0054     //@endcond
0055 };
0056 }