File indexing completed on 2025-01-19 04:47:01

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QTreeView>
0010 #include <QWidget>
0011 
0012 #include <KSieveCore/SieveImapAccountSettings>
0013 
0014 class QStandardItemModel;
0015 class QLineEdit;
0016 class SelectImapFolderTreeView;
0017 class QSortFilterProxyModel;
0018 
0019 class SelectImapFolderWidget : public QWidget
0020 {
0021     Q_OBJECT
0022 public:
0023     explicit SelectImapFolderWidget(const KSieveCore::SieveImapAccountSettings &account, QWidget *parent = nullptr);
0024     ~SelectImapFolderWidget() override;
0025 
0026     [[nodiscard]] QString selectedFolderName() const;
0027     void createFolder();
0028 
0029 Q_SIGNALS:
0030     void folderSelected();
0031     void folderIsSelected(bool selected);
0032 
0033 private:
0034     void slotModelLoaded(QStandardItemModel *model, bool success);
0035     void slotDoubleClicked(const QModelIndex &index);
0036     void slotSearchPattern(const QString &pattern);
0037     void slotCurrentChanged(const QModelIndex &current, const QModelIndex &previous);
0038     void slotRefreshImap();
0039 
0040     const KSieveCore::SieveImapAccountSettings mAccount;
0041     QLineEdit *const mSearchLineEdit;
0042     SelectImapFolderTreeView *const mTreeView;
0043     QStandardItemModel *mModel = nullptr;
0044     QSortFilterProxyModel *mFilter = nullptr;
0045 };