[rkward/frameworks] /: Assorted KF5 porting

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Nov 19 14:40:20 UTC 2015


Git commit d63cd09cf1b9818d6203d5463e94bbfffe95c246 by Thomas Friedrichsmeier.
Committed on 19/11/2015 at 14:40.
Pushed by tfry into branch 'frameworks'.

Assorted KF5 porting

M  +1    -1    CMakeLists.txt
M  +1    -1    rkward/agents/CMakeLists.txt
M  +1    -1    rkward/agents/rkprintagent.h
M  +12   -6    rkward/dialogs/rkerrordialog.cpp
M  +1    -1    rkward/dialogs/rkimportdialog.cpp
M  +22   -28   rkward/dialogs/rkloadlibsdialog.cpp
M  +3    -2    rkward/dialogs/rkloadlibsdialog.h
M  +3    -3    rkward/dialogs/rkrecoverdialog.cpp
M  +2    -2    rkward/dialogs/rkrecoverdialog.h
M  +1    -1    rkward/misc/CMakeLists.txt
M  +1    -1    rkward/misc/rkdummypart.cpp
M  +6    -2    rkward/misc/rkstandardactions.cpp
M  +1    -1    rkward/plugin/CMakeLists.txt
M  +3    -3    rkward/plugin/rkmatrixinput.cpp
M  +4    -4    rkward/plugin/rkoptionset.cpp
M  +1    -1    rkward/scriptbackends/CMakeLists.txt
M  +2    -0    rkward/scriptbackends/qtscripti18n.h
M  +1    -1    rkward/windows/CMakeLists.txt
M  +35   -45   rkward/windows/rkcommandeditorwindow.cpp
M  +1    -1    rkward/windows/rkcommandeditorwindow.h
M  +1    -0    rkward/windows/rkcommandlog.cpp
M  +7    -6    rkward/windows/rkfilebrowser.cpp
M  +3    -2    rkward/windows/rkfilebrowser.h
M  +1    -3    rkward/windows/rkhtmlwindow.cpp
M  +1    -1    rkward/windows/rkhtmlwindow.h
M  +1    -1    rkward/windows/rkmdiwindow.cpp
M  +5    -5    rkward/windows/rktoolwindowbar.cpp
M  +1    -1    rkward/windows/rktoplevelwindowgui.cpp
M  +3    -2    rkward/windows/rkworkplace.cpp
M  +1    -0    rkward/windows/rkworkplace.h
M  +4    -2    rkward/windows/rkworkplaceview.cpp

http://commits.kde.org/rkward/d63cd09cf1b9818d6203d5463e94bbfffe95c246

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 305ca7a..7c7f495 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@ INCLUDE(ECMInstallIcons)
 INCLUDE(FeatureSummary)
 
 FIND_PACKAGE(Qt5 5.2 CONFIG REQUIRED COMPONENTS Widgets Core Xml Network WebKit Script)
-FIND_PACKAGE(KF5 5.0 REQUIRED COMPONENTS CoreAddons DocTools I18n XmlGui TextEditor WidgetsAddons KDELibs4Support WebKit)
+FIND_PACKAGE(KF5 5.0 REQUIRED COMPONENTS CoreAddons DocTools I18n XmlGui TextEditor WidgetsAddons KDELibs4Support WebKit Parts)
 
 IF(FORCE_PRETTY_MAKEFILE)
 	SET(CMAKE_VERBOSE_MAKEFILE OFF)
diff --git a/rkward/agents/CMakeLists.txt b/rkward/agents/CMakeLists.txt
index 2630a45..d71d948 100644
--- a/rkward/agents/CMakeLists.txt
+++ b/rkward/agents/CMakeLists.txt
@@ -14,4 +14,4 @@ SET(agents_STAT_SRCS
    )
 
 ADD_LIBRARY(agents STATIC ${agents_STAT_SRCS})
-TARGET_LINK_LIBRARIES(agents Qt5::Widgets KF5::KDELibs4Support)
\ No newline at end of file
+TARGET_LINK_LIBRARIES(agents Qt5::Widgets KF5::TextEditor KF5::KDELibs4Support)
\ No newline at end of file
diff --git a/rkward/agents/rkprintagent.h b/rkward/agents/rkprintagent.h
index 27eb342..2a8dd24 100644
--- a/rkward/agents/rkprintagent.h
+++ b/rkward/agents/rkprintagent.h
@@ -19,7 +19,7 @@
 #define RKPRINTAGENT_H
 
 #include <QObject>
-#include <kparts/part.h>
+#include <kparts/readonlypart.h>
 
 /** The main purpose of this class is to cope with the lack of kprinter in KDE 4. Tries
  *  to offer a KDE print dialog for an existing postscript file. */
diff --git a/rkward/dialogs/rkerrordialog.cpp b/rkward/dialogs/rkerrordialog.cpp
index ef6dc2d..b1b81ff 100644
--- a/rkward/dialogs/rkerrordialog.cpp
+++ b/rkward/dialogs/rkerrordialog.cpp
@@ -22,11 +22,13 @@
 #include <kmessagebox.h>
 #include <kvbox.h>
 #include <ktoolinvocation.h>
+#include <kicon.h>
 
 #include <QLabel>
 #include <QTextEdit>
 #include <QTemporaryFile>
 #include <QTextStream>
+#include <QPushButton>
 
 #include "../rbackend/rinterface.h"
 #include "../rbackend/rksessionvars.h"
@@ -99,16 +101,20 @@ void RKErrorDialog::reportableErrorMessage (QWidget* parent_widget, const QStrin
 	// adjusted from KMessageBox::detailedError
 	KDialog *dialog = new KDialog (parent_widget, Qt::Dialog);
 	dialog->setCaption (caption);
-	if (details.isEmpty ()) dialog->setButtons (KDialog::Ok | KDialog::No);
-	else dialog->setButtons (KDialog::Ok | KDialog::No | KDialog::Details);
-	dialog->setButtonText (KDialog::No, i18n ("Report As Bug"));
+	QDialogButtonBox *buttonbox = new QDialogButtonBox (dialog);
+	if (details.isEmpty ()) buttonbox->setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::No);
+	else {
+		buttonbox->setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::No | QDialogButtonBox::Help);
+		buttonbox->button (QDialogButtonBox::Help)->setText (i18n ("Show Details"));
+	}
+	buttonbox->button (QDialogButtonBox::No)->setText (i18n ("Report As Bug"));
 	dialog->setObjectName ("error");
-	dialog->setDefaultButton (KDialog::Ok);
-	dialog->setEscapeButton (KDialog::Ok);
+	buttonbox->button (QDialogButtonBox::Ok)->setDefault (true);
+	buttonbox->button (QDialogButtonBox::Ok)->setShortcut (Qt::Key_Escape);
 	KMessageBox::Options options = KMessageBox::Notify | KMessageBox::AllowLink;
 	dialog->setModal (true);
 
-	int ret = KMessageBox::createKMessageBox (dialog, QMessageBox::Critical, user_message, QStringList(), QString(), 0, options, details);
+	int ret = KMessageBox::createKMessageBox (dialog, buttonbox, QMessageBox::Critical, user_message, QStringList(), QString(), 0, options, details);
 
 	if (ret == KDialog::No) {
 		reportBug (parent_widget, (message_code.isEmpty () ? QString () : i18n ("Message code: %1\n", message_code)) + user_message);
diff --git a/rkward/dialogs/rkimportdialog.cpp b/rkward/dialogs/rkimportdialog.cpp
index 1444830..6cfd727 100644
--- a/rkward/dialogs/rkimportdialog.cpp
+++ b/rkward/dialogs/rkimportdialog.cpp
@@ -36,7 +36,7 @@ RKImportDialogFormatSelector::RKImportDialogFormatSelector () : KHBox () {
 	combo = new QComboBox (this);
 }
 
-RKImportDialog::RKImportDialog (const QString &context_id, QWidget *parent) : KFileDialog (KUrl (), QString (), parent, format_selector=new RKImportDialogFormatSelector ()) {
+RKImportDialog::RKImportDialog (const QString &context_id, QWidget *parent) : KFileDialog (QUrl (), QString (), parent, format_selector=new RKImportDialogFormatSelector ()) {
 	RK_TRACE (DIALOGS);
 
 	setModal (false);
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 9480579..fbdf0de 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -61,8 +61,8 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool
 
 	setFaceType (KPageDialog::Tabbed);
 	setModal (modal);
-	setCaption (i18n ("Configure Packages"));
-	setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel);
+	setWindowTitle (i18n ("Configure Packages"));
+	setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
 
 	LoadUnloadWidget *luwidget = new LoadUnloadWidget (this);
 	addChild (luwidget, i18n ("Load / Unload R packages"));
@@ -76,7 +76,7 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool
 	connect (this, SIGNAL (currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, SLOT (slotPageChanged()));
 	QTimer::singleShot (0, this, SLOT (slotPageChanged()));
 	num_child_widgets = 4;
-	accepted = false;
+	was_accepted = false;
 
 	RKGlobals::rInterface ()->issueCommand (".libPaths ()", RCommand::App | RCommand::GetStringVector, QString (), this, GET_CURRENT_LIBLOCS_COMMAND, chain);
 }
@@ -84,16 +84,16 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool
 RKLoadLibsDialog::~RKLoadLibsDialog () {
 	RK_TRACE (DIALOGS);
 
-	if (accepted) KPageDialog::accept ();
+	if (was_accepted) KPageDialog::accept ();
 	else KPageDialog::reject ();
 }
 
 KPageWidgetItem* RKLoadLibsDialog::addChild (QWidget *child_page, const QString &caption) {
 	RK_TRACE (DIALOGS);
 
-	connect (this, SIGNAL (okClicked()), child_page, SLOT (ok()));
-	connect (this, SIGNAL (applyClicked()), child_page, SLOT (apply()));
-	connect (this, SIGNAL (cancelClicked()), child_page, SLOT (cancel()));
+	connect (this, SIGNAL (accepted()), child_page, SLOT (ok()));
+	connect (button (QDialogButtonBox::Apply), SIGNAL (clicked(bool)), child_page, SLOT (apply()));
+	connect (this, SIGNAL(rejected()), child_page, SLOT (cancel()));
 	connect (child_page, SIGNAL (destroyed()), this, SLOT (childDeleted()));
 	return addPage (child_page, caption);
 }
@@ -147,32 +147,26 @@ void RKLoadLibsDialog::childDeleted () {
 	tryDestruct ();
 }
 
-void RKLoadLibsDialog::slotButtonClicked (int button) {
-	RK_TRACE (DIALOGS);
-
-	switch (button) {
-	case KDialog::Ok:
-		accepted = true;
-		hide ();
-		emit (okClicked ()); // will self-destruct via childDeleted ()
-		break;
-	case KDialog::Cancel:
-		accepted = false;
-		hide ();
-		emit (cancelClicked ()); // will self-destruct via childDeleted ()
-		break;
-	case KDialog::Apply:
-		emit (applyClicked ());
-		break;
-	}
-}
-
 void RKLoadLibsDialog::closeEvent (QCloseEvent *e) {
 	RK_TRACE (DIALOGS);
 	e->accept ();
 
 	// do as if cancel button was clicked:
-	slotButtonClicked (KDialog::Cancel);
+	reject ();
+}
+
+void RKLoadLibsDialog::accept () {
+	was_accepted = true;
+	hide ();
+	// will self-destruct once all children are done
+	emit (accepted());
+}
+
+void RKLoadLibsDialog::reject () {
+	was_accepted = false;
+	hide ();
+	// will self-destruct once all children are done
+	emit (rejected());
 }
 
 void RKLoadLibsDialog::rCommandDone (RCommand *command) {
diff --git a/rkward/dialogs/rkloadlibsdialog.h b/rkward/dialogs/rkloadlibsdialog.h
index b6aade3..a59162f 100644
--- a/rkward/dialogs/rkloadlibsdialog.h
+++ b/rkward/dialogs/rkloadlibsdialog.h
@@ -66,6 +66,8 @@ public:
 	static void showInstallPackagesModal (QWidget *parent, RCommandChain *chain, const QString &package_name);
 	static void showPluginmapConfig (QWidget *parent=0, RCommandChain *chain=0);
 	QStringList currentLibraryLocations ()  const { return library_locations; };
+	void accept () override;
+	void reject () override;
 signals:
 	void downloadComplete ();
 	void installationComplete ();
@@ -78,7 +80,6 @@ protected:
 	void closeEvent (QCloseEvent *e);
 protected slots:
 /** overloaded to catch button presses. */
-	void slotButtonClicked (int button);
 	void childDeleted ();
 	void processExited (int exitCode, QProcess::ExitStatus exitStatus);
 	void installationProcessOutput ();
@@ -102,7 +103,7 @@ friend class InstallPackagesWidget;
 
 	QString auto_install_package;
 	int num_child_widgets;
-	bool accepted;
+	bool was_accepted;
 
 	QProcess* installation_process;
 };
diff --git a/rkward/dialogs/rkrecoverdialog.cpp b/rkward/dialogs/rkrecoverdialog.cpp
index cfe166d..432cbe0 100644
--- a/rkward/dialogs/rkrecoverdialog.cpp
+++ b/rkward/dialogs/rkrecoverdialog.cpp
@@ -92,7 +92,7 @@ QString RKRecoverDialog::saveFileFor (const QString& recovery_file) {
 }
 
 //static
-KUrl RKRecoverDialog::checkRecoverCrashedWorkspace () {
+QUrl RKRecoverDialog::checkRecoverCrashedWorkspace () {
 	RK_TRACE (DIALOGS);
 
 	QDir dir (RKSettingsModuleGeneral::filesPath ());
@@ -114,9 +114,9 @@ KUrl RKRecoverDialog::checkRecoverCrashedWorkspace () {
 			matches[i] = new_name;
 		}
 
-		if (dialog.result () == QDialog::Accepted) return (KUrl::fromLocalFile (dir.absoluteFilePath (matches.first ())));
+		if (dialog.result () == QDialog::Accepted) return (QUrl::fromLocalFile (dir.absoluteFilePath (matches.first ())));
 	}
 
-	return KUrl ();
+	return QUrl ();
 }
 
diff --git a/rkward/dialogs/rkrecoverdialog.h b/rkward/dialogs/rkrecoverdialog.h
index 09aa3a5..6f021f3 100644
--- a/rkward/dialogs/rkrecoverdialog.h
+++ b/rkward/dialogs/rkrecoverdialog.h
@@ -27,8 +27,8 @@ class RKRecoverDialog : public KDialog {
 	Q_OBJECT
 public:
 /** Check whether a crash recovery file is available. If so, display a dialog, offering to load the recovery file.
- at returns The url of the recovery file, if user selected to load it. An empty KUrl otherwise. */
-	static KUrl checkRecoverCrashedWorkspace ();
+ at returns The url of the recovery file, if user selected to load it. An empty QUrl otherwise. */
+	static QUrl checkRecoverCrashedWorkspace ();
 protected:
 	RKRecoverDialog (const QStringList &recovery_files);
 	~RKRecoverDialog ();
diff --git a/rkward/misc/CMakeLists.txt b/rkward/misc/CMakeLists.txt
index 2d1f169..dd4e078 100644
--- a/rkward/misc/CMakeLists.txt
+++ b/rkward/misc/CMakeLists.txt
@@ -31,7 +31,7 @@ SET(misc_STAT_SRCS
    )
 
 ADD_LIBRARY(misc STATIC ${misc_STAT_SRCS})
-
+TARGET_LINK_LIBRARIES(misc Qt5::Widgets KF5::KDELibs4Support)
 
 ########### install files ###############
 
diff --git a/rkward/misc/rkdummypart.cpp b/rkward/misc/rkdummypart.cpp
index 90b2847..f3e929e 100644
--- a/rkward/misc/rkdummypart.cpp
+++ b/rkward/misc/rkdummypart.cpp
@@ -17,7 +17,7 @@
 
 #include "rkdummypart.h"
 
-#include <kglobal.h>
+#include <QGuiApplication>
 
 #include "../debug.h"
 
diff --git a/rkward/misc/rkstandardactions.cpp b/rkward/misc/rkstandardactions.cpp
index 0d63d46..3646157 100644
--- a/rkward/misc/rkstandardactions.cpp
+++ b/rkward/misc/rkstandardactions.cpp
@@ -57,7 +57,9 @@ QAction* RKStandardActions::runCurrent (RKMDIWindow *window, const QObject *rece
 		ret->setText (i18n ("Run selection"));
 	}
 	ret->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRunLine));
-	ret->setShortcut (KShortcut (Qt::ControlModifier + Qt::Key_Return, Qt::ControlModifier + Qt::Key_Enter));
+	window->standardActionCollection ()->setDefaultShortcuts (ret, QList<QKeySequence>() << Qt::ControlModifier + Qt::Key_Return << Qt::ControlModifier + Qt::Key_Enter);
+	ret->setShortcut (Qt::ControlModifier + Qt::Key_Return);  // KF5 TODO: Not needed for KF5 >= 5.2
+
 	return ret;
 }
 
@@ -67,7 +69,9 @@ QAction* RKStandardActions::runAll (RKMDIWindow *window, const QObject *receiver
 	QAction* ret = window->standardActionCollection ()->addAction ("run_all", receiver, member);
 	ret->setText (i18n ("Run all"));
 	ret->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRunAll));
-	ret->setShortcut (KShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Return, Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Enter));
+	window->standardActionCollection ()->setDefaultShortcuts (ret, QList<QKeySequence>() << Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Return << Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Enter);
+	ret->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Return);  // KF5 TODO: Not needed for KF5 >= 5.2
+
 	return ret;
 }
 
diff --git a/rkward/plugin/CMakeLists.txt b/rkward/plugin/CMakeLists.txt
index 710883c..57bc817 100644
--- a/rkward/plugin/CMakeLists.txt
+++ b/rkward/plugin/CMakeLists.txt
@@ -32,7 +32,7 @@ SET(plugin_STAT_SRCS
    )
 
 ADD_LIBRARY(plugin STATIC ${plugin_STAT_SRCS})
-TARGET_LINK_LIBRARIES(plugin Qt5::Widgets Qt5::Script KF5::KDELibs4Support)
+TARGET_LINK_LIBRARIES(plugin Qt5::Widgets Qt5::Script KF5::TextEditor KF5::KDELibs4Support)
 
 ########### install files ###############
 
diff --git a/rkward/plugin/rkmatrixinput.cpp b/rkward/plugin/rkmatrixinput.cpp
index f521e60..5c5c353 100644
--- a/rkward/plugin/rkmatrixinput.cpp
+++ b/rkward/plugin/rkmatrixinput.cpp
@@ -141,7 +141,7 @@ QVariant RKMatrixInput::value (const QString& modifier) {
 		if (l.size () > row_count->intValue ()) l = l.mid (0, row_count->intValue ());
 		return l;
 	}
-	return ("Modifier '" + modifier + "' not recognized\n"); 
+	return (QString ("Modifier '" + modifier + "' not recognized\n"));
 }
 
 bool RKMatrixInput::expandStorageForColumn (int column) {
@@ -503,7 +503,7 @@ QVariant RKMatrixInputModel::data (const QModelIndex& index, int role) const {
 	if ((role == Qt::DisplayRole) || (role == Qt::EditRole)) {
 		return QVariant (value);
 	} else if (role == Qt::BackgroundRole) {
-		if (!matrix->is_valid && !matrix->isValueValid (value)) return QVariant (Qt::red);
+		if (!matrix->is_valid && !matrix->isValueValid (value)) return QVariant (QColor (Qt::red));
 	} else if ((role == Qt::ToolTipRole) || (role == Qt::StatusTipRole)) {
 		if (!matrix->is_valid && (value.isEmpty () && !matrix->allow_missings)) return QVariant (i18n ("Empty values are not allowed"));
 		if (!matrix->is_valid && !matrix->isValueValid (value)) return QVariant (i18n ("This value is not allowed, here"));
@@ -528,7 +528,7 @@ QVariant RKMatrixInputModel::headerData (int section, Qt::Orientation orientatio
 		return QVariant (QString::number (section + 1));
 	} else if (orientation == Qt::Horizontal) {
 		if (section < matrix->column_count->intValue ()) {
-			if ((role == Qt::BackgroundRole) && !matrix->isColumnValid (section)) return QVariant (Qt::red);
+			if ((role == Qt::BackgroundRole) && !matrix->isColumnValid (section)) return QVariant (QColor (Qt::red));
 			if (((role == Qt::ToolTipRole) || (role == Qt::StatusTipRole)) && !matrix->isColumnValid (section)) return QVariant (i18n ("This column contains illegal values in some of its cells"));
 		}
 	}
diff --git a/rkward/plugin/rkoptionset.cpp b/rkward/plugin/rkoptionset.cpp
index d0c28c6..2273f76 100644
--- a/rkward/plugin/rkoptionset.cpp
+++ b/rkward/plugin/rkoptionset.cpp
@@ -823,8 +823,8 @@ QVariant RKOptionSetDisplayModel::data (const QModelIndex& index, int role) cons
 		}
 	} else if (role == Qt::BackgroundRole) {
 		const RKOptionSet::RowInfo &ri = set->rows[row];
-		if (!ri.finished) return Qt::yellow;
-		if (!ri.valid) return Qt::red;
+		if (!ri.finished) return QColor (Qt::yellow);
+		if (!ri.valid) return QColor (Qt::red);
 	} else if ((role == Qt::ToolTipRole) || role == (Qt::StatusTipRole)) {
 		const RKOptionSet::RowInfo &ri = set->rows[row];
 		if (!ri.finished) return i18n ("This row has not yet been processed.");
@@ -844,8 +844,8 @@ QVariant RKOptionSetDisplayModel::headerData (int section, Qt::Orientation orien
 	if (orientation == Qt::Horizontal) {
 		if (role == Qt::DisplayRole) return (column_labels.value (section));
 		if (role == Qt::BackgroundRole) {
-			if (set->n_unfinished_rows > 0) return Qt::yellow;
-			if (!set->isValid ()) return Qt::red;
+			if (set->n_unfinished_rows > 0) return QColor (Qt::yellow);
+			if (!set->isValid ()) return QColor (Qt::red);
 		}
 		if ((role == Qt::ToolTipRole) || role == (Qt::StatusTipRole)) {
 			if (set->n_unfinished_rows > 0) return i18n ("Please wait while settings are being processed");
diff --git a/rkward/scriptbackends/CMakeLists.txt b/rkward/scriptbackends/CMakeLists.txt
index 8e2c47a..2c4f3bf 100644
--- a/rkward/scriptbackends/CMakeLists.txt
+++ b/rkward/scriptbackends/CMakeLists.txt
@@ -12,7 +12,7 @@ SET(scriptbackends_STAT_SRCS
    )
 
 ADD_LIBRARY(scriptbackends STATIC ${scriptbackends_STAT_SRCS})
-
+TARGET_LINK_LIBRARIES(scriptbackends Qt5::Script Qt5::Widgets Qt5::Xml KF5::KDELibs4Support)
 
 ########### install files ###############
 
diff --git a/rkward/scriptbackends/qtscripti18n.h b/rkward/scriptbackends/qtscripti18n.h
index 972c7e3..eab0eae 100644
--- a/rkward/scriptbackends/qtscripti18n.h
+++ b/rkward/scriptbackends/qtscripti18n.h
@@ -18,6 +18,8 @@
 #ifndef QTSCRIPTI18N_H
 #define QTSCRIPTI18N_H
 
+#include <QObject>
+
 #include "../misc/rkmessagecatalog.h"
 
 class QScriptEngine;
diff --git a/rkward/windows/CMakeLists.txt b/rkward/windows/CMakeLists.txt
index 98e5543..b3653b2 100644
--- a/rkward/windows/CMakeLists.txt
+++ b/rkward/windows/CMakeLists.txt
@@ -24,7 +24,7 @@ SET(windows_STAT_SRCS
 )
 
 ADD_LIBRARY(windows STATIC ${windows_STAT_SRCS})
-
+TARGET_LINK_LIBRARIES(windows Qt5::Widgets Qt5::Xml KF5::TextEditor KF5::WebKit KF5::KDELibs4Support)
 
 ########### install files ###############
 
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 1801e6b..3b7c7a2 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -18,10 +18,9 @@
 
 #include <kxmlguifactory.h>
 
-#include <ktexteditor/editorchooser.h>
+#include <ktexteditor/editor.h>
 #include <ktexteditor/modificationinterface.h>
 #include <ktexteditor/markinterface.h>
-#include <ktexteditor/sessionconfiginterface.h>
 
 #include <qlayout.h>
 #include <qapplication.h>
@@ -49,6 +48,7 @@
 #include <ktemporaryfile.h>
 #include <kio/deletejob.h>
 #include <kio/job.h>
+#include <kconfiggroup.h>
 
 #include "../misc/rkcommonfunctions.h"
 #include "../misc/rkstandardicons.h"
@@ -85,7 +85,7 @@ RKCommandEditorWindowPart::~RKCommandEditorWindowPart () {
 RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, bool use_r_highlighting, bool use_codehinting) : RKMDIWindow (parent, RKMDIWindow::CommandEditorWindow) {
 	RK_TRACE (COMMANDEDITOR);
 
-	KTextEditor::Editor* editor = KTextEditor::editor("katepart");
+	KTextEditor::Editor* editor = KTextEditor::Editor::instance ();
 	RK_ASSERT (editor);
 
 	m_doc = editor->createDocument (this);
@@ -97,7 +97,6 @@ RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, bool use_r_highli
 	if (em_iface) em_iface->setModifiedOnDiskWarning (true);
 	else RK_ASSERT (false);
 	m_view = m_doc->createView (this);
-	m_doc->editor ()->readConfig ();
 
 	setFocusProxy (m_view);
 	setFocusPolicy (Qt::StrongFocus);
@@ -164,19 +163,14 @@ RKCommandEditorWindow::~RKCommandEditorWindow () {
 
 	// NOTE: TODO: Ideally we'd only write out a changed config, but how to detect config changes?
 	// 	Alternatively, only for the last closed script window
-	m_doc->editor ()->writeConfig ();
+	// KF5 TODO: verify that the code below is no longer needed
+	//m_doc->editor ()->writeConfig ();
 	if (!url ().isEmpty ()) {
-		KTextEditor::SessionConfigInterface *iface = qobject_cast<KTextEditor::SessionConfigInterface*> (m_doc);
 		QString p_url = RKWorkplace::mainWorkplace ()->portableUrl (m_doc->url ());
-		if (iface) {
-			KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptDocumentSettings %1").arg (p_url));
-			iface->writeSessionConfig (conf);
-		}
-		iface = qobject_cast<KTextEditor::SessionConfigInterface*> (m_view);
-		if (iface) {
-			KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptViewSettings %1").arg (p_url));
-			iface->writeSessionConfig (conf);
-		}
+		KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptDocumentSettings %1").arg (p_url));
+		m_doc->writeSessionConfig (conf);
+		KConfigGroup viewconf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptViewSettings %1").arg (p_url));
+		m_view->writeSessionConfig (viewconf);
 	}
 
 	delete hinter;
@@ -216,7 +210,8 @@ void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
 	// NOTE: enter_and_submit is not currently added to the menu
 	QAction *action = ac->addAction ("enter_and_submit", this, SLOT (enterAndSubmit()));
 	action->setText (i18n ("Insert line break and run"));
-	action->setShortcuts (KShortcut (Qt::AltModifier + Qt::Key_Return, Qt::AltModifier + Qt::Key_Enter));
+	ac->setDefaultShortcuts (action, QList<QKeySequence>() << Qt::AltModifier + Qt::Key_Return << Qt::AltModifier + Qt::Key_Enter);
+	action->setShortcut (Qt::AltModifier + Qt::Key_Return); // KF5 TODO: This line needed only for KF5 < 5.2, according to documentation
 
 	action_help_function = RKStandardActions::functionHelp (this, this, SLOT (showHelp()));
 
@@ -233,9 +228,8 @@ void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
 
 	action_setwd_to_script = ac->addAction ("setwd_to_script", this, SLOT (setWDToScript()));
 	action_setwd_to_script->setText (i18n ("CD to script directory"));
-#if KDE_IS_VERSION(4,3,0)
-	action_setwd_to_script->setHelpText (i18n ("Change the working directory to the directory of this script"));
-#endif
+	action_setwd_to_script->setStatusTip (i18n ("Change the working directory to the directory of this script"));
+	action_setwd_to_script->setToolTip (action_setwd_to_script->statusTip ());
 	action_setwd_to_script->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionCDToScript));
 
 	file_save = findAction (m_view, "file_save");
@@ -278,7 +272,7 @@ void RKCommandEditorWindow::initBlocks () {
 		QColor shaded = colors[i];
 		shaded.setAlpha (30);
 		record.attribute = KTextEditor::Attribute::Ptr (new KTextEditor::Attribute ());
-		record.attribute->clearProperty (KTextEditor::Attribute::BackgroundFillWhitespace);
+		record.attribute->setBackgroundFillWhitespace (false);
 		record.attribute->setBackground (shaded);
 
 		QPixmap colorsquare (16, 16);
@@ -331,7 +325,7 @@ QString RKCommandEditorWindow::fullCaption () {
 	if (m_doc->url ().isEmpty ()) {
 		return (shortCaption ());
 	} else {
-		QString cap = m_doc->url ().pathOrUrl ();
+		QString cap = m_doc->url ().toDisplayString (QUrl::PreferLocalFile | QUrl::PrettyDecoded);
 		if (isModified ()) cap.append (i18n (" [modified]"));
 		return (cap);
 	}
@@ -362,32 +356,28 @@ void RKCommandEditorWindow::setReadOnly (bool ro) {
 	m_doc->setReadWrite (!ro);
 }
 
-bool RKCommandEditorWindow::openURL (const KUrl url, const QString& encoding, bool use_r_highlighting, bool read_only, bool delete_on_close){
+bool RKCommandEditorWindow::openURL (const QUrl url, const QString& encoding, bool use_r_highlighting, bool read_only, bool delete_on_close){
 	RK_TRACE (COMMANDEDITOR);
 
 	// encoding must be set *before* loading the file
 	if (!encoding.isEmpty ()) m_doc->setEncoding (encoding);
 	if (m_doc->openUrl (url)) {
+		// KF5 TODO: Check which parts of this are still needed in KF5, and which no longer work
 		if (!delete_on_close) {	// don't litter config with temporary files
-			KTextEditor::SessionConfigInterface *iface = qobject_cast<KTextEditor::SessionConfigInterface*> (m_doc);
 			QString p_url = RKWorkplace::mainWorkplace ()->portableUrl (m_doc->url ());
-			if (iface) {
-				KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptDocumentSettings %1").arg (p_url));
-				// HACK: Hmm. KTextEditor::Document's readSessionConfig() simply restores too much. Yes, I want to load bookmarks and stuff.
-				// I do not want to mess with encoding, or risk loading a different url, after the doc is already loaded!
-				if (!encoding.isEmpty () && (conf.readEntry ("Encoding", encoding) != encoding)) conf.writeEntry ("Encoding", encoding);
-				if (conf.readEntry ("URL", url) != url) conf.writeEntry ("URL", url);
-				/* HACK: What the...?! Somehow, at least on longer R scripts, stored Mode="Normal" in combination with R Highlighting
-				 * causes code folding to fail (KDE 4.8.4, http://sourceforge.net/p/rkward/bugs/122/).
-				 * Forcing Mode == Highlighting appears to help. */
-				if (use_r_highlighting) conf.writeEntry ("Mode", conf.readEntry ("Highlighting", "Normal"));
-				iface->readSessionConfig (conf);
-			}
-			iface = qobject_cast<KTextEditor::SessionConfigInterface*> (m_view);
-			if (iface) {
-				KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptViewSettings %1").arg (p_url));
-				iface->readSessionConfig (conf);
-			}
+			KConfigGroup conf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptDocumentSettings %1").arg (p_url));
+			// HACK: Hmm. KTextEditor::Document's readSessionConfig() simply restores too much. Yes, I want to load bookmarks and stuff.
+			// I do not want to mess with encoding, or risk loading a different url, after the doc is already loaded!
+			if (!encoding.isEmpty () && (conf.readEntry ("Encoding", encoding) != encoding)) conf.writeEntry ("Encoding", encoding);
+			if (conf.readEntry ("URL", url) != url) conf.writeEntry ("URL", url);
+			// HACK: What the...?! Somehow, at least on longer R scripts, stored Mode="Normal" in combination with R Highlighting
+			// causes code folding to fail (KDE 4.8.4, http://sourceforge.net/p/rkward/bugs/122/).
+			// Forcing Mode == Highlighting appears to help.
+			if (use_r_highlighting) conf.writeEntry ("Mode", conf.readEntry ("Highlighting", "Normal"));
+			m_doc->readSessionConfig (conf);
+
+			KConfigGroup viewconf (RKWorkplace::mainWorkplace ()->workspaceConfig (), QString ("SkriptViewSettings %1").arg (p_url));
+			m_view->readSessionConfig (viewconf);
 		}
 		if (use_r_highlighting) RKCommandHighlighter::setHighlighting (m_doc, RKCommandHighlighter::RScript);
 		else RKCommandHighlighter::setHighlighting (m_doc, RKCommandHighlighter::Automatic);
@@ -1072,12 +1062,12 @@ void RKCodeCompletionModel::completionInvoked (KTextEditor::View*, const KTextEd
 	updateCompletionList (command_editor->currentCompletionWord ());
 }
 
-void RKCodeCompletionModel::executeCompletionItem (KTextEditor::Document *document, const KTextEditor::Range &word, int row) const {
+void RKCodeCompletionModel::executeCompletionItem (KTextEditor::View *view, const KTextEditor::Range &word, const QModelIndex &index) const {
 	RK_TRACE (COMMANDEDITOR);
 
-	RK_ASSERT (names.size () > row);
+	RK_ASSERT (names.size () > index.row ());
 
-	document->replaceText (word, names[row]);
+	view->document ()->replaceText (word, names[index.row ()]);
 }
 
 QVariant RKCodeCompletionModel::data (const QModelIndex& index, int role) const {
@@ -1108,12 +1098,12 @@ KTextEditor::Document* RKCommandHighlighter::getDoc () {
 	if (_doc) return _doc;
 
 	RK_TRACE (COMMANDEDITOR);
-	KTextEditor::Editor* editor = KTextEditor::editor("katepart");
+	KTextEditor::Editor* editor = KTextEditor::Editor::instance ();
 	RK_ASSERT (editor);
 
 	_doc = editor->createDocument (RKWardMainWindow::getMain ());
 // NOTE: In KDE 4.4.5, a (dummy) view is needed to access highlighting attributes. According to a katepart error message, this will be fixed, eventually.
-// TODO: check whether this is fixed in some later version of KDE
+// KF5 TODO: check whether this is fixed
 	QWidget* view = _doc->createView (0);
 	view->hide ();
 	RK_ASSERT (_doc);
diff --git a/rkward/windows/rkcommandeditorwindow.h b/rkward/windows/rkcommandeditorwindow.h
index 8666a7a..6b49fa2 100644
--- a/rkward/windows/rkcommandeditorwindow.h
+++ b/rkward/windows/rkcommandeditorwindow.h
@@ -146,7 +146,7 @@ public:
 @param encoding encoding to use. If QString (), the default encoding is used.
 @param read_only Open the file in read-only mode
 @param delete_on_close File should be deleted when closing the window. Only respected with read_only=true. */
-	bool openURL (const KUrl url, const QString& encoding=QString (), bool use_r_highlighting=true, bool read_only=false, bool delete_on_close=false);
+	bool openURL (const QUrl url, const QString& encoding=QString (), bool use_r_highlighting=true, bool read_only=false, bool delete_on_close=false);
 /** returns, whether the document was modified since the last save */
 	bool isModified ();
 /** insert the given text into the document at the current cursor position. Additionally, focuses the view */
diff --git a/rkward/windows/rkcommandlog.cpp b/rkward/windows/rkcommandlog.cpp
index 486f367..2d77835 100644
--- a/rkward/windows/rkcommandlog.cpp
+++ b/rkward/windows/rkcommandlog.cpp
@@ -265,6 +265,7 @@ void RKCommandLogView::selectAll () {
 
 #include <kxmlguifactory.h>
 #include <QAction>
+#include <QGuiApplication>
 
 RKCommandLogPart::RKCommandLogPart (RKCommandLog *for_log) : KParts::Part (0) {
 	RK_TRACE (APP);
diff --git a/rkward/windows/rkfilebrowser.cpp b/rkward/windows/rkfilebrowser.cpp
index 97b831d..bbb1cf8 100644
--- a/rkward/windows/rkfilebrowser.cpp
+++ b/rkward/windows/rkfilebrowser.cpp
@@ -25,6 +25,7 @@
 #include <kactioncollection.h>
 #include <kconfiggroup.h>
 #include <kdeversion.h>
+#include <KSharedConfig>
 #if KDE_IS_VERSION(4,3,0)
 #	include <kfileitemactions.h>
 #	include <kfileitemlistproperties.h>
@@ -104,7 +105,7 @@ RKFileBrowserWidget::RKFileBrowserWidget (QWidget *parent) : KVBox (parent) {
 
 	dir = new KDirOperator (KUrl (), this);
 	dir->setPreviewWidget (0);
-	KConfigGroup config = KGlobal::config ()->group ("file browser window");
+	KConfigGroup config = KSharedConfig::openConfig ()->group ("file browser window");
 	dir->readConfig (config);
 	dir->setView (KFile::Default);
 	connect (RKWardMainWindow::getMain (), SIGNAL (aboutToQuitRKWard()), this, SLOT (saveConfig()));
@@ -123,9 +124,9 @@ RKFileBrowserWidget::RKFileBrowserWidget (QWidget *parent) : KVBox (parent) {
 	connect (dir, SIGNAL (contextMenuAboutToShow(KFileItem,QMenu*)), this, SLOT (contextMenuHook(KFileItem,QMenu*)));
 #endif
 
-	connect (dir, SIGNAL (urlEntered(KUrl)), this, SLOT (urlChangedInView(KUrl)));
+	connect (dir, SIGNAL (urlEntered(QUrl)), this, SLOT (urlChangedInView(QUrl)));
 	connect (urlbox, SIGNAL (returnPressed(QString)), this, SLOT (urlChangedInCombo(QString)));
-	connect (urlbox, SIGNAL (urlActivated(KUrl)), this, SLOT (urlChangedInCombo(KUrl)));
+	connect (urlbox, SIGNAL (urlActivated(QUrl)), this, SLOT (urlChangedInCombo(QUrl)));
 
 	connect (dir, SIGNAL (fileSelected(KFileItem)), this, SLOT (fileActivated(KFileItem)));
 
@@ -162,7 +163,7 @@ void RKFileBrowserWidget::contextMenuHook(const KFileItem& item, QMenu* menu) {
 void RKFileBrowserWidget::saveConfig () {
 	RK_TRACE (APP);
 
-	KConfigGroup config = KGlobal::config ()->group ("file browser window");
+	KConfigGroup config = KSharedConfig::openConfig ()->group ("file browser window");
 	dir->writeConfig (config);
 }
 
@@ -173,7 +174,7 @@ void RKFileBrowserWidget::setURL (const QString &url) {
 	dir->setUrl (url, true);
 }
 
-void RKFileBrowserWidget::urlChangedInView (const KUrl &url) {
+void RKFileBrowserWidget::urlChangedInView (const QUrl &url) {
 	RK_TRACE (APP);
 
 	urlbox->setUrl (url);
@@ -185,7 +186,7 @@ void RKFileBrowserWidget::urlChangedInCombo (const QString &url) {
 	dir->setUrl (url, true);
 }
 
-void RKFileBrowserWidget::urlChangedInCombo (const KUrl &url) {
+void RKFileBrowserWidget::urlChangedInCombo (const QUrl &url) {
 	RK_TRACE (APP);
 
 	dir->setUrl (url, true);
diff --git a/rkward/windows/rkfilebrowser.h b/rkward/windows/rkfilebrowser.h
index 9c608f0..9a1c979 100644
--- a/rkward/windows/rkfilebrowser.h
+++ b/rkward/windows/rkfilebrowser.h
@@ -23,6 +23,7 @@
 #include <kvbox.h>
 
 #include <QList>
+#include <QUrl>
 
 class KDirOperator;
 class RKFileBrowserWidget;
@@ -63,9 +64,9 @@ public:
 	void setURL (const QString &url);
 	bool eventFilter (QObject* o, QEvent* e);
 public slots:
-	void urlChangedInView (const KUrl &url);
+	void urlChangedInView (const QUrl &url);
 	void urlChangedInCombo (const QString &url);
-	void urlChangedInCombo (const KUrl &url);
+	void urlChangedInCombo (const QUrl &url);
 	void fileActivated (const KFileItem& item);
 	void saveConfig ();
 	void contextMenuHook (const KFileItem &item, QMenu *menu);
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index dd4b9cc..fca490b 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -16,11 +16,9 @@
  ***************************************************************************/
 #include "rkhtmlwindow.h"
 
-#include <khtmlview.h>
-#include <khtml_part.h>
 #include <klibloader.h>
 #include <klocale.h>
-#include <kiconloader.h>
+#include <kicon.h>
 #include <kmessagebox.h>
 #include <kparts/plugin.h>
 #include <kactioncollection.h>
diff --git a/rkward/windows/rkhtmlwindow.h b/rkward/windows/rkhtmlwindow.h
index 5104f14..ea3a598 100644
--- a/rkward/windows/rkhtmlwindow.h
+++ b/rkward/windows/rkhtmlwindow.h
@@ -23,13 +23,13 @@
 #include <kio/jobclasses.h>
 #include <kwebpage.h>
 
+#include <QDomElement>
 
 #include "../windows/rkmdiwindow.h"
 
 class KActionCollection;
 class KRecentFilesAction;
 class QAction;
-class QDomElement;
 class RKComponentHandle;
 class XMLHelper;
 class RKHTMLWindowPart;
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index 869f109..21023f3 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -23,7 +23,7 @@
 #include <QEvent>
 #include <QPaintEvent>
 
-#include <kparts/event.h>
+#include <kparts/partactivateevent.h>
 #include <kxmlguifactory.h>
 #include <kactioncollection.h>
 #include <klocale.h>
diff --git a/rkward/windows/rktoolwindowbar.cpp b/rkward/windows/rktoolwindowbar.cpp
index 9ddce14..0b77d0c 100644
--- a/rkward/windows/rktoolwindowbar.cpp
+++ b/rkward/windows/rktoolwindowbar.cpp
@@ -280,11 +280,11 @@ bool RKToolWindowBar::eventFilter (QObject *obj, QEvent *ev) {
 				connect (a, SIGNAL (triggered(bool)), this, SLOT (changeAttachment()));
 
 				KSelectAction *sel = new KSelectAction (i18n ("Position"), &menu);
-				sel->addAction (KIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveLeft)), i18n ("Left Sidebar"));
-				sel->addAction (KIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveRight)), i18n ("Right Sidebar"));
-				sel->addAction (KIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveUp)), i18n ("Top Sidebar"));
-				sel->addAction (KIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveDown)), i18n ("Bottom Sidebar"));
-				sel->addAction (KIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDelete)), i18n ("Not shown in sidebar"));
+				sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveLeft), i18n ("Left Sidebar"));
+				sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveRight), i18n ("Right Sidebar"));
+				sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveUp), i18n ("Top Sidebar"));
+				sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveDown), i18n ("Bottom Sidebar"));
+				sel->addAction (RKStandardIcons::getIcon (RKStandardIcons::ActionDelete), i18n ("Not shown in sidebar"));
 				connect (sel, SIGNAL (triggered(int)), this, SLOT (moveToolWindow(int)));
 				menu.addAction (sel);
 	
diff --git a/rkward/windows/rktoplevelwindowgui.cpp b/rkward/windows/rktoplevelwindowgui.cpp
index 972ba6d..04c29fe 100644
--- a/rkward/windows/rktoplevelwindowgui.cpp
+++ b/rkward/windows/rktoplevelwindowgui.cpp
@@ -148,7 +148,7 @@ void RKTopLevelWindowGUI::reportRKWardBug () {
 void RKTopLevelWindowGUI::showAboutApplication () {
 	RK_TRACE (APP);
 
-	KAboutApplicationDialog about (KCmdLineArgs::aboutData ());
+	KAboutApplicationDialog about (KAboutData::applicationData ());
 	about.exec ();
 }
 
diff --git a/rkward/windows/rkworkplace.cpp b/rkward/windows/rkworkplace.cpp
index d383d0a..5cfc933 100644
--- a/rkward/windows/rkworkplace.cpp
+++ b/rkward/windows/rkworkplace.cpp
@@ -28,6 +28,7 @@
 #include <krun.h>
 #include <kmimetype.h>
 #include <kstandarddirs.h>
+#include <KSharedConfig>
 
 #include <QFileInfo>
 #include <QCryptographicHash>
@@ -93,7 +94,7 @@ RKWorkplace::RKWorkplace (QWidget *parent) : QWidget (parent) {
 	tool_window_bars[RKToolWindowList::Right] = new RKToolWindowBar (KMultiTabBar::Right, hbox);
 	tool_window_bars[RKToolWindowList::Right]->setSplitter (horiz_splitter);
 
-	KConfigGroup toolbar_config = KGlobal::config ()->group ("ToolwindowBars");
+	KConfigGroup toolbar_config = KSharedConfig::openConfig ()->group ("ToolwindowBars");
 	for (int i = 0; i < TOOL_WINDOW_BAR_COUNT; ++i) tool_window_bars[i]->restoreSize (toolbar_config);
 
 	// now add it all to this widget
@@ -152,7 +153,7 @@ void RKWorkplace::setWorkspaceURL (const KUrl &url, bool keep_config) {
 void RKWorkplace::saveSettings () {
 	RK_TRACE (APP);
 
-	KConfigGroup toolbar_config = KGlobal::config ()->group ("ToolwindowBars");
+	KConfigGroup toolbar_config = KSharedConfig::openConfig ()->group ("ToolwindowBars");
 	for (int i = 0; i < TOOL_WINDOW_BAR_COUNT; ++i) tool_window_bars[i]->saveSize (toolbar_config);
 }
 
diff --git a/rkward/windows/rkworkplace.h b/rkward/windows/rkworkplace.h
index 272492e..9939448 100644
--- a/rkward/windows/rkworkplace.h
+++ b/rkward/windows/rkworkplace.h
@@ -24,6 +24,7 @@
 #include <QSplitter>
 
 #include <kurl.h>
+#include <kconfigbase.h>
 
 #include "rkmdiwindow.h"
 #include "rktoolwindowlist.h"
diff --git a/rkward/windows/rkworkplaceview.cpp b/rkward/windows/rkworkplaceview.cpp
index b404345..1c7c56e 100644
--- a/rkward/windows/rkworkplaceview.cpp
+++ b/rkward/windows/rkworkplaceview.cpp
@@ -82,11 +82,13 @@ void RKWorkplaceView::initActions (KActionCollection *ac, const char *id_left, c
 
 	action_page_left = (QAction *) ac->addAction (id_left, this, SLOT (pageLeft()));
 	action_page_left->setText (i18n ("Window Left"));
-	action_page_left->setShortcut (KShortcut (Qt::ControlModifier + Qt::Key_Less, Qt::ControlModifier + Qt::Key_Comma));
+	ac->setDefaultShortcuts (action_page_left, QList<QKeySequence>() << Qt::ControlModifier + Qt::Key_Less << Qt::ControlModifier + Qt::Key_Comma);
+	action_page_left->setShortcut (Qt::ControlModifier + Qt::Key_Less); // KF5 TODO: not needed for KF5 >= 5.2
 
 	action_page_right = (QAction *) ac->addAction (id_right, this, SLOT (pageRight()));
 	action_page_right->setText (i18n ("Window Right"));
-	action_page_right->setShortcut (KShortcut (Qt::ControlModifier + Qt::Key_Greater, Qt::ControlModifier + Qt::Key_Period));
+	ac->setDefaultShortcuts (action_page_right, QList<QKeySequence>() << Qt::ControlModifier + Qt::Key_Greater << Qt::ControlModifier + Qt::Key_Period);
+	action_page_right->setShortcut (Qt::ControlModifier + Qt::Key_Greater); // KF5 TODO: not needed for KF5 >= 5.2
 
 	updateActions ();
 }



More information about the rkward-tracker mailing list