File indexing completed on 2025-01-05 04:47:09

0001 /*
0002     SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akonadiwidgets_export.h"
0010 #include <QWidget>
0011 
0012 #include <memory>
0013 
0014 class QAbstractItemDelegate;
0015 class QAbstractItemView;
0016 class QPushButton;
0017 
0018 namespace Akonadi
0019 {
0020 class AgentInstance;
0021 class ManageAccountWidgetPrivate;
0022 
0023 class AKONADIWIDGETS_EXPORT ManageAccountWidget : public QWidget
0024 {
0025     Q_OBJECT
0026 public:
0027     explicit ManageAccountWidget(QWidget *parent);
0028     ~ManageAccountWidget() override;
0029 
0030     /**
0031      * Sets the text of the label above the list of accounts.
0032      * Example: "Incoming accounts:" in an email client, or "Calendars:" in an organizer.
0033      */
0034     void setDescriptionLabelText(const QString &text);
0035 
0036     void setSpecialCollectionIdentifier(const QString &identifier);
0037 
0038     [[nodiscard]] QStringList mimeTypeFilter() const;
0039     void setMimeTypeFilter(const QStringList &mimeTypeFilter);
0040 
0041     [[nodiscard]] QStringList capabilityFilter() const;
0042     void setCapabilityFilter(const QStringList &capabilityFilter);
0043 
0044     [[nodiscard]] QStringList excludeCapabilities() const;
0045     void setExcludeCapabilities(const QStringList &excludeCapabilities);
0046 
0047     void setItemDelegate(QAbstractItemDelegate *delegate);
0048 
0049     [[nodiscard]] QAbstractItemView *view() const;
0050 
0051     [[nodiscard]] QPushButton *addAccountButton() const;
0052     void disconnectAddAccountButton();
0053 
0054 protected:
0055     bool eventFilter(QObject *obj, QEvent *event) override;
0056 
0057 public Q_SLOTS:
0058     void slotAddAccount();
0059 
0060 private Q_SLOTS:
0061     AKONADIWIDGETS_NO_EXPORT void slotAccountSelected(const Akonadi::AgentInstance &current);
0062     AKONADIWIDGETS_NO_EXPORT void slotRemoveSelectedAccount();
0063     AKONADIWIDGETS_NO_EXPORT void slotRestartSelectedAccount();
0064     AKONADIWIDGETS_NO_EXPORT void slotModifySelectedAccount();
0065 
0066 private:
0067     AKONADIWIDGETS_NO_EXPORT void slotSearchAgentType(const QString &str);
0068 
0069 private:
0070     std::unique_ptr<ManageAccountWidgetPrivate> const d;
0071 };
0072 }