From 7ea414a2abd06da7d22dc90d1ed8d3fe79ddca68 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Fri, 31 May 2019 23:40:00 +0900
Subject: kdcop: added popup menu to result list to conveniently copy the
 selected item (functionality was already available from Edit menu but not so
 user friendly).

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
---
 kdcop/kdcopwindow.cpp | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

(limited to 'kdcop/kdcopwindow.cpp')

diff --git a/kdcop/kdcopwindow.cpp b/kdcop/kdcopwindow.cpp
index 9d7769808..b096ddd47 100644
--- a/kdcop/kdcopwindow.cpp
+++ b/kdcop/kdcopwindow.cpp
@@ -46,6 +46,7 @@
 #include <tqvbox.h>
 #include <tqimage.h>
 #include <tqheader.h>
+#include <tqpopupmenu.h>
 
 #include <kdebug.h>
 #include <kkeydialog.h>
@@ -296,20 +297,10 @@ KDCOPWindow::KDCOPWindow(TQWidget *parent, const char * name)
 //	mainView->lv->addColumn(i18n("Function"));
 	mainView->lv->setDragAutoScroll( FALSE );
 	mainView->lv->setRootIsDecorated( TRUE );
-  connect
-    (
-     mainView->lv,
-     TQT_SIGNAL(doubleClicked(TQListViewItem *)),
-     TQT_SLOT(slotCallFunction(TQListViewItem *))
-    );
-
-  connect
-    (
-     mainView->lv,
-     TQT_SIGNAL(currentChanged(TQListViewItem *)),
-     TQT_SLOT(slotCurrentChanged(TQListViewItem *))
-    );
-
+  connect(mainView->lv, TQT_SIGNAL(doubleClicked(TQListViewItem *)), TQT_SLOT(slotCallFunction(TQListViewItem *)));
+  connect(mainView->lv, TQT_SIGNAL(currentChanged(TQListViewItem *)), TQT_SLOT(slotCurrentChanged(TQListViewItem *)));
+  connect(mainView->lb_replyData, TQT_SIGNAL(contextMenuRequested(TQListBoxItem*, const TQPoint&)),
+          TQT_SLOT(slotResultListContextMenu(TQListBoxItem*, const TQPoint&)));
 
   // set up the actions
   KStdAction::quit( TQT_TQOBJECT(this), TQT_SLOT( close() ), actionCollection() );
@@ -1105,8 +1096,10 @@ bool KDCOPWindow::demarshal
 	isValid = false;
   }
 
-      if (!ret.isEmpty())
-      	theList->insertStringList(ret);
+	if (!ret.isEmpty())
+	{
+		theList->insertStringList(ret);
+	}
 	return isValid;
 }
 
@@ -1238,4 +1231,11 @@ void KDCOPWindow::slotMode()
 	mainView->lv->setMode(langmode->currentText());
 }
 
+void KDCOPWindow::slotResultListContextMenu(TQListBoxItem *item, const TQPoint &point)
+{
+	TQPopupMenu* contextMenu = new TQPopupMenu(this);
+	contextMenu->insertItem(i18n("&Copy"), this, TQT_SLOT(slotCopy()));
+	contextMenu->exec(point);
+}
+
 #include "kdcopwindow.moc"
-- 
cgit v1.2.1