sieveeditorscriptmanagerwidget.h 2.11 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
   Copyright (C) 2013-2020 Laurent Montel <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3

Laurent Montel's avatar
Laurent Montel committed
4
5
6
7
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
Laurent Montel's avatar
Laurent Montel committed
8

Laurent Montel's avatar
Laurent Montel committed
9
10
11
12
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.
Laurent Montel's avatar
Laurent Montel committed
13

Laurent Montel's avatar
Laurent Montel committed
14
15
16
17
   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
Laurent Montel's avatar
Laurent Montel committed
18
19
20
21
22
23
*/

#ifndef SIEVEEDITORSCRIPTMANAGERWIDGET_H
#define SIEVEEDITORSCRIPTMANAGERWIDGET_H

#include <QWidget>
Laurent Montel's avatar
Laurent Montel committed
24
#include <QUrl>
Laurent Montel's avatar
Laurent Montel committed
25
#include <KSieveUi/ManageSieveWidget>
Laurent Montel's avatar
Laurent Montel committed
26

Laurent Montel's avatar
Laurent Montel committed
27
class SieveEditorManageSieveWidget;
Laurent Montel's avatar
Laurent Montel committed
28
class QTreeWidgetItem;
Laurent Montel's avatar
Laurent Montel committed
29
namespace KSieveUi {
Laurent Montel's avatar
Laurent Montel committed
30
}
Laurent Montel's avatar
Laurent Montel committed
31
32
33
34
class SieveEditorScriptManagerWidget : public QWidget
{
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
35
    explicit SieveEditorScriptManagerWidget(QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
36
37
    ~SieveEditorScriptManagerWidget();

38
    void updateServerList();
Laurent Montel's avatar
Laurent Montel committed
39
    void editScript();
Laurent Montel's avatar
Laurent Montel committed
40
    void desactivateScript();
Laurent Montel's avatar
Laurent Montel committed
41
    void refreshList();
42

Laurent Montel's avatar
Laurent Montel committed
43
Q_SIGNALS:
44
    void createScriptPage(const KSieveUi::ManageSieveWidget::ScriptInfo &info, bool isNewScript);
Laurent Montel's avatar
Laurent Montel committed
45
    void updateButtons(bool newScriptAction, bool editScriptAction, bool deleteScriptAction, bool desactivateScriptAction);
Laurent Montel's avatar
Laurent Montel committed
46
    void scriptDeleted(const QUrl &url);
Laurent Montel's avatar
Laurent Montel committed
47
    void serverSieveFound(bool hasServerSieve);
48
    void scriptRenamed(const QUrl &oldUrl, const QUrl &newUrl);
Laurent Montel's avatar
Laurent Montel committed
49

Laurent Montel's avatar
Laurent Montel committed
50
public Q_SLOTS:
51
52
    void slotCreateNewScript();
    void slotDeleteScript();
Laurent Montel's avatar
Laurent Montel committed
53
    void slotRefreshList();
54

Laurent Montel's avatar
Laurent Montel committed
55
private:
Laurent Montel's avatar
Laurent Montel committed
56
57
    void slotNewScript(const KSieveUi::ManageSieveWidget::ScriptInfo &info);
    void slotEditScript(const KSieveUi::ManageSieveWidget::ScriptInfo &info);
Laurent Montel's avatar
Laurent Montel committed
58
    void slotUpdateButtons(QTreeWidgetItem *item);
59

Laurent Montel's avatar
Laurent Montel committed
60
private:
Laurent Montel's avatar
Laurent Montel committed
61
    SieveEditorManageSieveWidget *mTreeView = nullptr;
Laurent Montel's avatar
Laurent Montel committed
62
63
64
};

#endif // SIEVEEDITORSCRIPTMANAGERWIDGET_H