Libksieve

sievescriptlistbox.h
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ksieveui_private_export.h"
10#include <QGroupBox>
11#include <QListWidgetItem>
12
13class QListWidget;
14class QPushButton;
16
17namespace KSieveUi
18{
19class SieveEditorGraphicalModeWidget;
20class SieveScriptPage;
21class SieveScriptListItem : public QListWidgetItem
22{
23public:
24 SieveScriptListItem(const QString &text, QListWidget *parent);
25 ~SieveScriptListItem() override;
26
27 void setDescription(const QString &desc);
28 [[nodiscard]] QString description() const;
29
30 [[nodiscard]] SieveScriptPage *scriptPage() const;
31 void setScriptPage(SieveScriptPage *page);
32
33 [[nodiscard]] QString generatedScript(QStringList &required) const;
34
35private:
36 QString mDescription;
37 SieveScriptPage *mScriptPage = nullptr;
38};
39
40class KSIEVEUI_TESTS_EXPORT SieveScriptListBox : public QGroupBox
41{
42 Q_OBJECT
43public:
44 explicit SieveScriptListBox(const QString &title, QWidget *parent = nullptr);
45 ~SieveScriptListBox() override;
46
47 void setSieveEditorGraphicalModeWidget(SieveEditorGraphicalModeWidget *graphicalModeWidget);
48 [[nodiscard]] QString generatedScript(QStringList &required) const;
49 void loadScript(const QString &doc, QString &error);
50
51Q_SIGNALS:
52 void addNewPage(KSieveUi::SieveScriptPage *);
53 void removePage(QWidget *);
54 void activatePage(QWidget *);
55 void enableButtonOk(bool);
56 void valueChanged();
57
58private:
59 void slotCustomMenuRequested(const QPoint &pos);
60 void slotNew();
61 void slotDelete();
62 void slotRename();
63 void updateButtons();
64 void slotEditDescription();
65 void slotItemClicked(QListWidgetItem *);
66 void slotTop();
67 void slotBottom();
68 void slotDown();
69 void slotUp();
70
71 enum ParseSieveScriptTypeBlock {
72 TypeUnknown = 0,
73 TypeBlockIf,
74 TypeBlockElsif,
75 TypeBlockElse,
76 TypeBlockInclude,
77 TypeBlockGlobal,
78 TypeBlockAction,
79 TypeBlockForeachBlock
80 };
81
82 void loadBlock(QXmlStreamReader &n, SieveScriptPage *currentPage, ParseSieveScriptTypeBlock typeBlock, QString &error);
83 void clear();
84 [[nodiscard]] SieveScriptPage *createNewScript(const QString &newName, const QString &description = QString());
85 [[nodiscard]] QString createUniqName();
86 SieveEditorGraphicalModeWidget *mSieveGraphicalModeWidget = nullptr;
87 QListWidget *const mSieveListScript;
88 QPushButton *mBtnNew = nullptr;
89 QPushButton *mBtnDelete = nullptr;
90 QPushButton *mBtnRename = nullptr;
91 QPushButton *mBtnDescription = nullptr;
92 QPushButton *mBtnTop = nullptr;
93 QPushButton *mBtnUp = nullptr;
94 QPushButton *mBtnDown = nullptr;
95 QPushButton *mBtnBottom = nullptr;
96 int mScriptNumber = 0;
97};
98}
QString text() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.