Commit 30597d4d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

continue to implement menu

parent aab49d70
Pipeline #47511 passed with stage
in 45 minutes and 58 seconds
......@@ -9,6 +9,7 @@
#include "remotecontentinfo.h"
#include "remotecontentmanager.h"
#include <KLocalizedString>
#include <KMessageBox>
#include <QListWidget>
#include <QMenu>
#include <QVBoxLayout>
......@@ -37,9 +38,32 @@ void RemoteContentConfigureWidget::slotCustomContextMenuRequested(const QPoint &
{
QListWidgetItem *item = mListWidget->itemAt(pos);
QMenu menu(this);
menu.addAction(QIcon::fromTheme(QStringLiteral("list-add")), i18n("Add..."), this, &RemoteContentConfigureWidget::slotAdd);
if (item) {
menu.addSeparator();
menu.addAction(QIcon::fromTheme(QStringLiteral("document-edit")), i18n("Modify..."), this, [this, item]() {
modifyRule(item);
});
menu.addSeparator();
menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("Remove Rule"), this, [this, item]() {
if (KMessageBox::Yes == KMessageBox::warningYesNo(this, i18n("Do you want to delete this rule?"), i18n("Delete Rule"))) {
delete item;
}
});
}
menu.exec(QCursor::pos());
}
void RemoteContentConfigureWidget::modifyRule(QListWidgetItem *rulesItem)
{
//TODO
}
void RemoteContentConfigureWidget::slotAdd()
{
//TODO
}
void RemoteContentConfigureWidget::saveSettings()
{
QVector<RemoteContentInfo> lst;
......
......@@ -11,6 +11,7 @@
#include "messageviewer_private_export.h"
class QListWidget;
class QListWidgetItem;
namespace MessageViewer {
class MESSAGEVIEWER_TESTS_EXPORT RemoteContentConfigureWidget : public QWidget
{
......@@ -21,6 +22,8 @@ public:
void saveSettings();
private:
void slotCustomContextMenuRequested(const QPoint &);
void modifyRule(QListWidgetItem *rulesItem);
void slotAdd();
void readSettings();
QListWidget *mListWidget = nullptr;
};
......
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