[rkward-cvs] SF.net SVN: rkward:[3495] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Mar 22 10:24:33 UTC 2011
Revision: 3495
http://rkward.svn.sourceforge.net/rkward/?rev=3495&view=rev
Author: tfry
Date: 2011-03-22 10:24:33 +0000 (Tue, 22 Mar 2011)
Log Message:
-----------
Add file item actions to the file browser's context menu.
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/windows/rkfilebrowser.cpp
trunk/rkward/rkward/windows/rkfilebrowser.h
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2011-03-22 10:04:03 UTC (rev 3494)
+++ trunk/rkward/ChangeLog 2011-03-22 10:24:33 UTC (rev 3495)
@@ -1,3 +1,4 @@
+- File browser context menu gains many more KDE standard actions (KDE 4.3 and above, only)
- Auxiliary binaries rkward.bin and rkward.rbackend are no longer installed into /usr[/local]/bin/ on Unix
- Fixed: Object name completion would abort early in the script editor with KDE 4.4
- Support function argument hinting for R primitives
Modified: trunk/rkward/rkward/windows/rkfilebrowser.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkfilebrowser.cpp 2011-03-22 10:04:03 UTC (rev 3494)
+++ trunk/rkward/rkward/windows/rkfilebrowser.cpp 2011-03-22 10:24:33 UTC (rev 3495)
@@ -2,7 +2,7 @@
rkfilebrowser - description
-------------------
begin : Thu Apr 26 2007
- copyright : (C) 2007, 2008, 2009, 2010 by Thomas Friedrichsmeier
+ copyright : (C) 2007, 2008, 2009, 2010, 2011 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -24,6 +24,11 @@
#include <ktoolbar.h>
#include <kactioncollection.h>
#include <kconfiggroup.h>
+#include <kdeversion.h>
+#if KDE_IS_VERSION(4,3,0)
+# include <kfileitemactions.h>
+# include <kfileitemlistproperties.h>
+#endif
#include <qdir.h>
#include <qlayout.h>
@@ -112,6 +117,11 @@
toolbar->addAction (dir->actionCollection ()->action ("detailed view"));
// toolbar->addAction (dir->actionCollection ()->action ("detailed tree view")); // should we have this as well? Trying to avoid crowding in the toolbar
+#if KDE_IS_VERSION(4, 3, 0)
+ fi_actions = new KFileItemActions (this);
+ connect (dir, SIGNAL (contextMenuAboutToShow(KFileItem,QMenu*)), this, SLOT (contextMenuHook(KFileItem,QMenu*)));
+#endif
+
connect (dir, SIGNAL (urlEntered (const KUrl &)), this, SLOT (urlChangedInView (const KUrl &)));
connect (urlbox, SIGNAL (returnPressed (const QString &)), this, SLOT (urlChangedInCombo (const QString &)));
connect (urlbox, SIGNAL (urlActivated (const KUrl&)), this, SLOT (urlChangedInCombo (const KUrl&)));
@@ -125,6 +135,17 @@
RK_TRACE (APP);
}
+void RKFileBrowserWidget::contextMenuHook(const KFileItem& item, QMenu* menu) {
+ RK_TRACE (APP);
+#if KDE_IS_VERSION(4,3,0)
+ QList<KFileItem> dummy;
+ dummy.append (item);
+ fi_actions->setItemListProperties (KFileItemListProperties (dummy));
+ fi_actions->addOpenWithActionsTo (menu, QString ());
+ fi_actions->addServiceActionsTo (menu);
+#endif
+}
+
// does not work in d-tor. Apparently it's too late, then
void RKFileBrowserWidget::saveConfig () {
RK_TRACE (APP);
Modified: trunk/rkward/rkward/windows/rkfilebrowser.h
===================================================================
--- trunk/rkward/rkward/windows/rkfilebrowser.h 2011-03-22 10:04:03 UTC (rev 3494)
+++ trunk/rkward/rkward/windows/rkfilebrowser.h 2011-03-22 10:24:33 UTC (rev 3495)
@@ -2,7 +2,7 @@
rkfilebrowser - description
-------------------
begin : Thu Apr 26 2007
- copyright : (C) 2007, 2010 by Thomas Friedrichsmeier
+ copyright : (C) 2007, 2010, 2011 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -26,6 +26,8 @@
class RKFileBrowserWidget;
class KUrlComboBox;
class KFileItem;
+class KFileItemActions;
+class QMenu;
/** The file browser (tool) window. In order to save some startup time, the file browser is not really created until it is first shown. Hence, this is mostly just a wrapper around RKFileBrowserWidget */
class RKFileBrowser : public RKMDIWindow {
@@ -63,9 +65,11 @@
void urlChangedInCombo (const KUrl &url);
void fileActivated (const KFileItem& item);
void saveConfig ();
+ void contextMenuHook (const KFileItem &item, QMenu *menu);
private:
KDirOperator *dir;
KUrlComboBox *urlbox;
+ KFileItemActions *fi_actions;
};
#endif
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