Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 2bdcbba3 authored by Laurent Montel's avatar Laurent Montel 😁

Add clear button

parent b87980cd
......@@ -36,6 +36,7 @@
#include <QFileDialog>
#include <KLocalizedString>
#include <kmessagebox.h>
#include <KStandardAction>
#include <QVBoxLayout>
#include <QIcon>
......@@ -44,6 +45,8 @@
#include <QSpinBox>
#include <QStringList>
#include <QGroupBox>
#include <QAction>
#include <QMenu>
#include <errno.h>
#include <KSharedConfig>
......@@ -79,7 +82,7 @@ FilterLogDialog::FilterLogDialog(QWidget *parent)
pageVBoxLayout->setMargin(0);
mainLayout->addWidget(page);
mTextEdit = new KPIMTextEdit::PlainTextEditorWidget(page);
mTextEdit = new KPIMTextEdit::PlainTextEditorWidget(new FilterLogTextEdit(this),page);
pageVBoxLayout->addWidget(mTextEdit);
mTextEdit->setReadOnly(true);
......@@ -363,3 +366,21 @@ void FilterLogDialog::slotUser2()
}
}
}
FilterLogTextEdit::FilterLogTextEdit(QWidget *parent)
: KPIMTextEdit::PlainTextEditor(parent)
{
}
void FilterLogTextEdit::addExtraMenuEntry(QMenu *menu, QPoint pos)
{
Q_UNUSED(pos);
if (!document()->isEmpty()) {
QAction *sep = new QAction(menu);
sep->setSeparator(true);
menu->addAction(sep);
QAction *clearAllAction = KStandardAction::clear(this, &FilterLogTextEdit::clear, menu);
menu->addAction(clearAllAction);
}
}
......@@ -31,6 +31,8 @@
#include <QDialog>
#include <KPIMTextEdit/PlainTextEditor>
class QCheckBox;
class QSpinBox;
class QGroupBox;
......@@ -45,6 +47,18 @@ class QPushButton;
namespace KPIMTextEdit {
class PlainTextEditorWidget;
}
class FilterLogTextEdit : public KPIMTextEdit::PlainTextEditor
{
Q_OBJECT
public:
explicit FilterLogTextEdit(QWidget *parent = nullptr);
~FilterLogTextEdit() = default;
protected:
void addExtraMenuEntry(QMenu *menu, QPoint pos) override;
};
class FilterLogDialog : public QDialog
{
Q_OBJECT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment