diff --git a/tdefilereplace/tdefilereplaceview.cpp b/tdefilereplace/tdefilereplaceview.cpp index cc9d1773..c4d6c1bc 100644 --- a/tdefilereplace/tdefilereplaceview.cpp +++ b/tdefilereplace/tdefilereplaceview.cpp @@ -43,7 +43,8 @@ using namespace whatthisNameSpace; -TDEFileReplaceView::TDEFileReplaceView(RCOptions* info, TQWidget *parent,const char *name):TDEFileReplaceViewWdg(parent,name) +TDEFileReplaceView::TDEFileReplaceView(RCOptions* info, TQWidget *parent,const char *name) : + TDEFileReplaceViewWdg(parent,name) { m_option = info; @@ -54,6 +55,9 @@ TDEFileReplaceView::TDEFileReplaceView(RCOptions* info, TQWidget *parent,const c 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())); + // 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))); whatsThis(); } @@ -308,6 +312,21 @@ void TDEFileReplaceView::slotResultTreeReduce() expand(lviRoot, false); } +void TDEFileReplaceView::slotResultHeaderClicked(int sortCol) +{ + TDEListView *lv = getResultsView(); + int oldSortCol = lv->columnSorted(); + + if (oldSortCol == -1 || sortCol != oldSortCol) + { + lv->setSorting(sortCol, true); + } + else + { + lv->setSorting(sortCol, lv->ascendingSort()); + } +} + void TDEFileReplaceView::slotStringsAdd() { KeyValueMap oldMap(m_option->m_mapStringsView); diff --git a/tdefilereplace/tdefilereplaceview.h b/tdefilereplace/tdefilereplaceview.h index cf738964..b542563e 100644 --- a/tdefilereplace/tdefilereplaceview.h +++ b/tdefilereplace/tdefilereplaceview.h @@ -58,13 +58,6 @@ class TDEFileReplaceView : public TDEFileReplaceViewWdg { Q_OBJECT - private: - TDEPopupMenu* m_menuResult; - RCOptions* m_option; - TDEListViewItem* m_lviCurrent; - TDEListView* m_rv, - * m_sv; - public://Constructors TDEFileReplaceView(RCOptions* info, TQWidget *parent,const char *name); @@ -92,6 +85,7 @@ class TDEFileReplaceView : public TDEFileReplaceViewWdg void slotResultDelete(); void slotResultTreeExpand(); void slotResultTreeReduce(); + void slotResultHeaderClicked(int sortCol); void slotStringsAdd(); void slotQuickStringsAdd(const TQString& quickSearch, const TQString& quickReplace); void slotStringsDeleteItem(); @@ -112,6 +106,12 @@ class TDEFileReplaceView : public TDEFileReplaceViewWdg /*signals: void resetActions(); void searchingOnlyMode(bool);*/ + + private: + TDEPopupMenu *m_menuResult; + RCOptions *m_option; + TDEListViewItem *m_lviCurrent; + TDEListView *m_rv, * m_sv; }; #endif // TDEFILEREPLACEVIEW_H