[pmg-devel] [PATCH pmg-gui 2/4] quarantine: contextmenu: refactor for use in other quarantines

Stoiko Ivanov s.ivanov at proxmox.com
Thu Oct 20 21:14:58 CEST 2022


Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
can/should probably be squashed with the next patch

 js/Makefile                 |  1 +
 js/QuarantineContextMenu.js | 32 ++++++++++++++++++++++++++++++++
 js/SpamContextMenu.js       | 14 +-------------
 3 files changed, 34 insertions(+), 13 deletions(-)
 create mode 100644 js/QuarantineContextMenu.js

diff --git a/js/Makefile b/js/Makefile
index 0b9f93b..b904598 100644
--- a/js/Makefile
+++ b/js/Makefile
@@ -19,6 +19,7 @@ JSSRC=							\
 	RuleInfo.js					\
 	RuleEditor.js					\
 	MainView.js					\
+	QuarantineContextMenu.js			\
 	QuarantineList.js				\
 	SpamInfoGrid.js					\
 	MailInfo.js					\
diff --git a/js/QuarantineContextMenu.js b/js/QuarantineContextMenu.js
new file mode 100644
index 0000000..4f7744e
--- /dev/null
+++ b/js/QuarantineContextMenu.js
@@ -0,0 +1,32 @@
+Ext.define('PMG.menu.QuarantineContextMenu', {
+    extend: 'Ext.menu.Menu',
+    xtype: 'pmgQuarantineMenu',
+
+    showSeparator: false,
+
+    controller: {
+	xclass: 'Ext.app.ViewController',
+	callCallback: function(btn) {
+	    let view = this.getView();
+	    if (Ext.isFunction(view.callback)) {
+		view.callback(btn.action);
+	    }
+	},
+    },
+
+    items: [
+	{
+	    text: gettext('Deliver'),
+	    iconCls: 'fa fa-fw fa-paper-plane-o',
+	    action: 'deliver',
+	    handler: 'callCallback',
+	},
+	{
+	    text: gettext('Delete'),
+	    iconCls: 'fa fa-fw fa-trash-o',
+	    action: 'delete',
+	    handler: 'callCallback',
+	},
+    ],
+});
+
diff --git a/js/SpamContextMenu.js b/js/SpamContextMenu.js
index 5fb4816..b089f0f 100644
--- a/js/SpamContextMenu.js
+++ b/js/SpamContextMenu.js
@@ -1,17 +1,5 @@
 Ext.define('PMG.menu.SpamContextMenu', {
-    extend: 'Ext.menu.Menu',
-
-    showSeparator: false,
-
-    controller: {
-	xclass: 'Ext.app.ViewController',
-	callCallback: function(btn) {
-	    let view = this.getView();
-	    if (Ext.isFunction(view.callback)) {
-		view.callback(btn.action);
-	    }
-	},
-    },
+    extend: 'PMG.menu.QuarantineContextMenu',
 
     items: [
 	{
-- 
2.30.2





More information about the pmg-devel mailing list