selectimapfolderwidget.h 1.29 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
2
   SPDX-FileCopyrightText: 2016-2020 Laurent Montel <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3

4
   SPDX-License-Identifier: GPL-2.0-or-later
Laurent Montel's avatar
Laurent Montel committed
5
6
7
8
9
10
*/

#ifndef SELECTIMAPFOLDERWIDGET_H
#define SELECTIMAPFOLDERWIDGET_H

#include <QWidget>
11
#include <QTreeView>
Laurent Montel's avatar
Laurent Montel committed
12

13
14
#include <KSieveUi/SieveImapAccountSettings>

15
class QStandardItemModel;
Laurent Montel's avatar
Laurent Montel committed
16
class QLineEdit;
Laurent Montel's avatar
Laurent Montel committed
17
class SelectImapFolderTreeView;
Laurent Montel's avatar
Laurent Montel committed
18
class QSortFilterProxyModel;
Laurent Montel's avatar
Laurent Montel committed
19

Laurent Montel's avatar
Laurent Montel committed
20
21
22
23
class SelectImapFolderWidget : public QWidget
{
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
24
    explicit SelectImapFolderWidget(const KSieveUi::SieveImapAccountSettings &account, QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
25
    ~SelectImapFolderWidget();
26

Laurent Montel's avatar
Laurent Montel committed
27
    QString selectedFolderName() const;
Laurent Montel's avatar
Laurent Montel committed
28
    void createFolder();
Laurent Montel's avatar
Laurent Montel committed
29

30
Q_SIGNALS:
Laurent Montel's avatar
Laurent Montel committed
31
    void folderSelected();
32
    void folderIsSelected(bool selected);
33

Laurent Montel's avatar
Laurent Montel committed
34
private:
Laurent Montel's avatar
Laurent Montel committed
35
    void slotModelLoaded(QStandardItemModel *model, bool success);
Laurent Montel's avatar
Laurent Montel committed
36
37
    void slotDoubleClicked(const QModelIndex &index);
    void slotSearchPattern(const QString &pattern);
38
    void slotCurrentChanged(const QModelIndex &current, const QModelIndex &previous);
Laurent Montel's avatar
Laurent Montel committed
39
    void slotRefreshImap();
Laurent Montel's avatar
Laurent Montel committed
40

41
    const KSieveUi::SieveImapAccountSettings mAccount;
Laurent Montel's avatar
Laurent Montel committed
42
43
44
45
    QLineEdit *mSearchLineEdit = nullptr;
    SelectImapFolderTreeView *mTreeView = nullptr;
    QStandardItemModel *mModel = nullptr;
    QSortFilterProxyModel *mFilter = nullptr;
Laurent Montel's avatar
Laurent Montel committed
46
47
48
};

#endif // SELECTIMAPFOLDERWIDGET_H