From 11f19f36b664e8755ff06f70ca12554e7a66acf6 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 26 Jan 2015 08:26:44 +0900 Subject: [PATCH] Open searched results with mouse or keyboard in TDEFileReplace. This resolves bug 2322. Signed-off-by: Michele Calgaro --- tdefilereplace/tdefilereplaceview.cpp | 44 ++++++++++++++++++++------- tdefilereplace/tdefilereplaceview.h | 5 +-- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/tdefilereplace/tdefilereplaceview.cpp b/tdefilereplace/tdefilereplaceview.cpp index c4d6c1bc..48a8343b 100644 --- a/tdefilereplace/tdefilereplaceview.cpp +++ b/tdefilereplace/tdefilereplaceview.cpp @@ -50,14 +50,26 @@ TDEFileReplaceView::TDEFileReplaceView(RCOptions* info, TQWidget *parent,const c initGUI(); - // connect events - connect(m_lvResults, TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotMouseButtonClicked(int, TQListViewItem *, const TQPoint &))); - connect(m_lvResults_2, TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), this, TQT_SLOT(slotMouseButtonClicked(int, TQListViewItem *, const TQPoint &))); - connect(m_lvStrings, TQT_SIGNAL(doubleClicked(TQListViewItem *)), this, TQT_SLOT(slotStringsEdit())); - connect(m_lvStrings_2, TQT_SIGNAL(doubleClicked(TQListViewItem *)), this, TQT_SLOT(slotStringsEdit())); + // result listview: connect events + connect(m_lvResults, TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), + this, TQT_SLOT(slotResultMouseButtonClicked(int, TQListViewItem *, const TQPoint &))); + connect(m_lvResults, TQT_SIGNAL(returnPressed(TQListViewItem *)), + this, TQT_SLOT(slotResultReturnPressed(TQListViewItem *))); + connect(m_lvResults, TQT_SIGNAL(executed(TQListViewItem *)), + this, TQT_SLOT(executed(TQListViewItem *))); + connect(m_lvResults_2, TQT_SIGNAL(mouseButtonClicked(int, TQListViewItem *, const TQPoint &, int)), + this, TQT_SLOT(slotResultMouseButtonClicked(int, TQListViewItem *, const TQPoint &))); + connect(m_lvResults_2, TQT_SIGNAL(returnPressed(TQListViewItem *)), + this, TQT_SLOT(slotResultReturnPressed(TQListViewItem *))); + connect(m_lvResults_2, TQT_SIGNAL(executed(TQListViewItem *)), + this, TQT_SLOT(slotResultReturnPressed(TQListViewItem *))); // connect header events connect(m_lvResults->header(), TQT_SIGNAL(clicked(int)), this,TQT_SLOT(slotResultHeaderClicked(int))); connect(m_lvResults_2->header(), TQT_SIGNAL(clicked(int)), this,TQT_SLOT(slotResultHeaderClicked(int))); + + // string listview: connect events + connect(m_lvStrings, TQT_SIGNAL(doubleClicked(TQListViewItem *)), this, TQT_SLOT(slotStringsEdit())); + connect(m_lvStrings_2, TQT_SIGNAL(doubleClicked(TQListViewItem *)), this, TQT_SLOT(slotStringsEdit())); whatsThis(); } @@ -173,17 +185,27 @@ TDEListView* TDEFileReplaceView::getStringsView() } //PUBLIC SLOTS -void TDEFileReplaceView::slotMouseButtonClicked (int button, TQListViewItem *lvi, const TQPoint &pos) +void TDEFileReplaceView::slotResultMouseButtonClicked(int button, TQListViewItem *lvi, const TQPoint &pos) { if (lvi == 0) // No item selected return; - // RIGHT BUTTON if (button == Qt::RightButton) - { - m_lviCurrent = static_cast(lvi); - m_menuResult->popup(pos); - } + { + // Right mouse button: open popup menub + m_lviCurrent = static_cast(lvi); + m_menuResult->popup(pos); + } +} + +void TDEFileReplaceView::slotResultReturnPressed (TQListViewItem *lvi) +{ + if (lvi == 0) // No item selected + return; + + // Left mouse button: open item in default view + m_lviCurrent = static_cast(lvi); + slotResultOpen(); } void TDEFileReplaceView::slotResultProperties() diff --git a/tdefilereplace/tdefilereplaceview.h b/tdefilereplace/tdefilereplaceview.h index b542563e..6081347a 100644 --- a/tdefilereplace/tdefilereplaceview.h +++ b/tdefilereplace/tdefilereplaceview.h @@ -2,7 +2,7 @@ tdefilereplaceview.h - description ------------------- begin : sam oct 16 15:28:00 CEST 1999 - copyright : (C) 1999 by François Dupoux + copyright : (C) 1999 by Fran�ois Dupoux (C) 2004 Emiliano Gulmini ***************************************************************************/ @@ -76,7 +76,8 @@ class TDEFileReplaceView : public TDEFileReplaceViewWdg //void emitSearchingOnlyMode(bool b) { emit searchingOnlyMode(b); } public slots: - void slotMouseButtonClicked (int button, TQListViewItem *lvi, const TQPoint &pos); + void slotResultMouseButtonClicked(int button, TQListViewItem *lvi, const TQPoint &pos); + void slotResultReturnPressed(TQListViewItem *lvi); void slotResultProperties(); void slotResultOpen(); void slotResultOpenWith();