[rkward/frameworks] rkward: KMenu -> QMenu

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Nov 26 20:21:08 UTC 2015


Git commit 0498ea8ab249cf25b7e2c97cdd24ea0a7e9da9dd by Thomas Friedrichsmeier.
Committed on 26/11/2015 at 20:19.
Pushed by tfry into branch 'frameworks'.

KMenu -> QMenu
KFileDialog -> QFileDialog (the easy cases, only)

M  +3    -2    rkward/rbackend/rinterface.cpp
M  +2    -1    rkward/rkconsole.cpp
M  +1    -0    rkward/rkward.cpp
M  +3    -5    rkward/settings/rksettingsmoduler.cpp
M  +1    -1    rkward/windows/rkcommandeditorwindow.cpp
M  +4    -4    rkward/windows/rktoolwindowbar.cpp
M  +3    -3    rkward/windows/rkworkplaceview.cpp

http://commits.kde.org/rkward/0498ea8ab249cf25b7e2c97cdd24ea0a7e9da9dd

diff --git a/rkward/rbackend/rinterface.cpp b/rkward/rbackend/rinterface.cpp
index 2878eda..d85e9dc 100644
--- a/rkward/rbackend/rinterface.cpp
+++ b/rkward/rbackend/rinterface.cpp
@@ -66,6 +66,7 @@ RKWindowCatcher *window_catcher;
 #include <qvalidator.h>
 
 #include <stdlib.h>
+#include <QFileDialog>
 
 // flush new pieces of output after this period of time:
 #define FLUSH_INTERVAL 100
@@ -857,9 +858,9 @@ void RInterface::processRBackendRequest (RBackendRequest *request) {
 	} else if (type == RBackendRequest::ChooseFile) {
 		QString filename;
 		if (request->params["new"].toBool ()) {
-			filename = KFileDialog::getSaveFileName ();
+			filename = QFileDialog::getSaveFileName ();
 		} else {
-			filename = KFileDialog::getOpenFileName ();
+			filename = QFileDialog::getOpenFileName ();
 		}
 		request->params["result"] = QVariant (filename);
 	} else if (type == RBackendRequest::SetParamsFromBackend) {
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index bf678ba..b505424 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -47,6 +47,7 @@
 #include <kxmlguifactory.h>
 #include <kfiledialog.h>
 #include <kio/netaccess.h>
+#include <QFileDialog>
 
 #include "rkglobals.h"
 #include "rkward.h"
@@ -812,7 +813,7 @@ void RKConsole::userLoadHistory (const QUrl &_url) {
 
 	QUrl url = _url;
 	if (url.isEmpty ()) {
-		url = KFileDialog::getOpenUrl (QUrl (), i18n ("*.Rhistory|R history files (*.Rhistory)\n*|All files (*)"), this, i18n ("Select command history file to load"));
+		url = QFileDialog::getOpenFileUrl (this, i18n ("Select command history file to load"), QUrl (), i18n ("R history files (*.Rhistory);;All files (*)"));
 		if (url.isEmpty ()) return;
 	}
 
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index fb3ab8b..79e1bde 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -208,6 +208,7 @@ void RKWardMainWindow::doPostInit () {
 
 	show ();
 #ifdef Q_OS_WIN
+	// KF5 TODO: Still needed?
 	// detect and disable the buggy "native" file dialogs
 	KConfigGroup cg = KGlobal::config ().data ()->group ("KFileDialog Settings");
 	if (cg.readEntry ("Native", true)) {
diff --git a/rkward/settings/rksettingsmoduler.cpp b/rkward/settings/rksettingsmoduler.cpp
index 3bd11d0..894b5f8 100644
--- a/rkward/settings/rksettingsmoduler.cpp
+++ b/rkward/settings/rksettingsmoduler.cpp
@@ -21,7 +21,6 @@
 #include <kstandarddirs.h>
 #include <kinputdialog.h>
 #include <knuminput.h>
-#include <kfiledialog.h>
 
 #include <qlabel.h>
 #include <qcheckbox.h>
@@ -31,9 +30,7 @@
 #include <QGridLayout>
 #include <QPushButton>
 #include <QTextEdit>
-#ifdef Q_OS_WIN
-#	include <QFileDialog>
-#endif
+#include <QFileDialog>
 
 #include "rksettingsmodulegeneral.h"
 #include "../core/robject.h"
@@ -440,6 +437,7 @@ void RKSettingsModuleRPackages::settingChanged () {
 void RKSettingsModuleRPackages::addLibLoc (QStringList *string_list) {
 	RK_TRACE (SETTINGS);
 #ifdef Q_OS_WIN
+	// KF5 TODO: Still needed?
 	// TODO: Hang on Windows when trying to select any dir using (K|Q)FileDialog::getExistingDirectory (). KDE 4.10
 	QFileDialog dummy (this, i18n ("Add R Library Directory"));
 	dummy.setFileMode (QFileDialog::Directory);
@@ -449,7 +447,7 @@ void RKSettingsModuleRPackages::addLibLoc (QStringList *string_list) {
 		new_string = dummy.selectedFiles ().value (0);
 	}
 #else
-	QString new_string = KFileDialog::getExistingDirectory (QUrl (), this, i18n ("Add R Library Directory"));
+	QString new_string = QFileDialog::getExistingDirectory (this, i18n ("Add R Library Directory"));
 #endif
 	if (!new_string.isEmpty ()) {
 		(*string_list).append (new_string);
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index f28f4c6..7acab69 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -37,7 +37,7 @@
 #include <QClipboard>
 
 #include <klocale.h>
-#include <kmenu.h>
+#include <QMenu>
 #include <kmessagebox.h>
 #include <kfiledialog.h>
 #include <QAction>
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index 671f3e7..acff81a 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -20,7 +20,7 @@
 #include "rktoolwindowbar.h"
 
 #include <khbox.h>
-#include <kmenu.h>
+#include <QMenu>
 #include <klocale.h>
 #include <kparts/partmanager.h>
 #include <kselectaction.h>
@@ -274,7 +274,7 @@ bool RKToolWindowBar::eventFilter (QObject *obj, QEvent *ev) {
 			RKMDIWindow *widget = idToWidget (id_of_popup);
 			RK_ASSERT (widget);
 			if (widget) {
-				KMenu menu (this);
+				QMenu menu (this);
 
 				QAction *a = menu.addAction (RKStandardIcons::getIcon (widget->isAttached () ? RKStandardIcons::ActionDetachWindow : RKStandardIcons::ActionAttachWindow), widget->isAttached () ? i18n("Detach") : i18n("Attach"));
 				connect (a, &QAction::triggered, this, &RKToolWindowBar::changeAttachment);
@@ -301,14 +301,14 @@ bool RKToolWindowBar::eventFilter (QObject *obj, QEvent *ev) {
 void RKToolWindowBar::contextMenuEvent (QContextMenuEvent* event) {
 	RK_TRACE (APP);
 
-	KMenu menu (this);
+	QMenu menu (this);
 	foreach (const RKToolWindowList::ToolWindowRepresentation& rep, RKToolWindowList::registeredToolWindows ()) {
 		QAction *a = menu.addAction (rep.window->windowIcon (), rep.window->shortCaption ());
 		a->setCheckable (true);
 		a->setChecked (rep.window->tool_window_bar == this);
 		a->setData (rep.id);
 	}
-	connect (&menu, &KMenu::triggered, this, &RKToolWindowBar::addRemoveToolWindow);
+	connect (&menu, &QMenu::triggered, this, &RKToolWindowBar::addRemoveToolWindow);
 	menu.exec (event->globalPos ());
 
 	event->accept ();
diff --git a/rkward/windows/rkworkplaceview.cpp b/rkward/windows/rkworkplaceview.cpp
index 54d6ec0..28d856b 100644
--- a/rkward/windows/rkworkplaceview.cpp
+++ b/rkward/windows/rkworkplaceview.cpp
@@ -19,13 +19,13 @@
 
 #include <ktabbar.h>
 #include <klocale.h>
-#include <kshortcut.h>
+#include <QKeySequence>
 #include <kactioncollection.h>
 #include <QAction>
 #include <QIcon>
 #include <kdeversion.h>
 #include <kacceleratormanager.h>
-#include <kmenu.h>
+#include <QMenu>
 
 #include <qapplication.h>
 #include <qevent.h>
@@ -182,7 +182,7 @@ void RKWorkplaceView::showContextMenu (const QPoint &pos) {
 	int tab = tabBar ()->tabAt (pos);
 	if (tab < 0) return;	// no context menu for the empty area
 
-	KMenu* m = new KMenu (this);
+	QMenu* m = new QMenu (this);
 	QAction *action = KStandardAction::close (this, SLOT (contextMenuClosePage()), this);
 	action->setData (tab);
 	m->addAction (action);



More information about the rkward-tracker mailing list