[rkward-cvs] SF.net SVN: rkward:[2914] trunk/rkward/rkward/windows

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Jun 30 15:22:16 UTC 2010


Revision: 2914
          http://rkward.svn.sourceforge.net/rkward/?rev=2914&view=rev
Author:   tfry
Date:     2010-06-30 15:22:16 +0000 (Wed, 30 Jun 2010)

Log Message:
-----------
Allow sorting, and add option to search in all loaded packages, only

Modified Paths:
--------------
    trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp
    trunk/rkward/rkward/windows/rkhelpsearchwindow.h

Modified: trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp	2010-06-29 15:39:12 UTC (rev 2913)
+++ trunk/rkward/rkward/windows/rkhelpsearchwindow.cpp	2010-06-30 15:22:16 UTC (rev 2914)
@@ -2,7 +2,7 @@
                           rkhelpsearchwindow  -  description
                              -------------------
     begin                : Fri Feb 25 2005
-    copyright            : (C) 2005, 2006, 2007, 2009 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007, 2009, 2010 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -31,6 +31,7 @@
 #include <QHBoxLayout>
 #include <QFocusEvent>
 #include <QVBoxLayout>
+#include <QSortFilterProxyModel>
 
 #include "../rbackend/rinterface.h"
 #include "../rbackend/rcommandreceiver.h"
@@ -99,7 +100,11 @@
 
 	packagesList = new QComboBox (this);
 	packagesList->setEditable (false);
-	packagesList->addItem (i18n("All"));
+	packagesList->addItem (i18n("All installed packages"));
+	packagesList->addItem (i18n("All loaded packages"));
+#if QT_VERSION >= 0x040400
+	packagesList->insertSeparator (2);
+#endif
 	fields_packages_layout->addWidget (packagesList);
 
 	QVBoxLayout* checkboxes_layout = new QVBoxLayout ();
@@ -117,9 +122,12 @@
 	selection_layout->addWidget (findButton);
 
 	results = new RKHelpSearchResultsModel (this);
+	QSortFilterProxyModel *proxy_model = new QSortFilterProxyModel (this);
+	proxy_model->setSourceModel (results);
 	results_view = new QTreeView (this);
 	results_view->setRootIsDecorated (false);
-	results_view->setModel (results);
+	results_view->setModel (proxy_model);
+	results_view->setSortingEnabled (true);
 	connect (results_view, SIGNAL (doubleClicked(const QModelIndex&)), this, SLOT (resultDoubleClicked(const QModelIndex&)));
 	main_layout->addWidget (results_view);
 
@@ -177,14 +185,18 @@
 		ignoreCase="FALSE";
 	}
 	
-	QString package = "NULL";
-	if (packagesList->currentIndex () != 0) {
-		package= "\"" +	packagesList->currentText () + "\"";
+	QString package = ", package=";
+	if (packagesList->currentIndex () == 0) {
+		package.append ("NULL");	// all installed packages; actually we could also use package.clear(), here.
+	} else if (packagesList->currentIndex () == 1) {
+		package.append (".packages()");	// all loaded packages
+	} else if (packagesList->currentIndex () > 1) {
+		package.append ("\"" + packagesList->currentText () + "\"");
 	}
 
 	QString fields = fieldsList->itemData (fieldsList->currentIndex ()).toString ();
 
-	QString s = ".rk.get.search.results (\"" + field->currentText () + "\",agrep=" + agrep + ", ignore.case=" + ignoreCase + ", package=" + package + ", fields=" + fields +")";
+	QString s = ".rk.get.search.results (\"" + field->currentText () + "\",agrep=" + agrep + ", ignore.case=" + ignoreCase + package + ", fields=" + fields +")";
 	
 	RKGlobals::rInterface ()->issueCommand (s, RCommand::App | RCommand::Sync | RCommand::GetStringVector, QString::null, this, HELP_SEARCH, 0);
 	setEnabled (false);

Modified: trunk/rkward/rkward/windows/rkhelpsearchwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkhelpsearchwindow.h	2010-06-29 15:39:12 UTC (rev 2913)
+++ trunk/rkward/rkward/windows/rkhelpsearchwindow.h	2010-06-30 15:22:16 UTC (rev 2914)
@@ -69,7 +69,7 @@
 	static RKHelpSearchWindow *main_help_search;
 };
 
-/** An item model meant for use by RKHelpSearchWindow. Since it is fairly specialized, it is unlikely to be of any use in any other context.
+/** An item model meant for use by RKHelpSearchWindow. Since it is fairly specialized, it is unlikely to be of any use in any other context. NOTE: This class is pretty useless, really, we should just switch to a QTree/TableWidget with predefined model, whenever we need to make the next big change to the RKHelpSearchWindow. */
 @author Thomas Friedrichsmeier */
 class RKHelpSearchResultsModel : public QAbstractTableModel {
 public:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list