[rkward/frameworks] rkward: Assorted KF5 porting

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Nov 18 14:33:19 UTC 2015


Git commit 1b0c0610585f2e68eb0bde0f1bbfe7ce00632a5b by Thomas Friedrichsmeier.
Committed on 18/11/2015 at 14:31.
Pushed by tfry into branch 'frameworks'.

Assorted KF5 porting

M  +1    -3    rkward/misc/rkdummypart.cpp
M  +1    -1    rkward/plugin/CMakeLists.txt
M  +2    -2    rkward/plugin/rkcomponentmap.cpp
M  +1    -1    rkward/plugin/rkcomponentproperties.cpp
M  +4    -4    rkward/plugin/rkinput.cpp
M  +1    -1    rkward/plugin/rkinput.h
M  +1    -1    rkward/plugin/rkvarselector.cpp
M  +6    -0    rkward/plugin/rkvarslot.cpp
M  +1    -1    rkward/plugin/rkvarslot.h
M  +1    -1    rkward/rkconsole.cpp
M  +1    -1    rkward/windows/rkcommandeditorwindow.cpp
M  +1    -1    rkward/windows/rkcommandlog.cpp
M  +1    -1    rkward/windows/rkhtmlwindow.cpp
M  +1    -1    rkward/windows/rkmdiwindow.cpp
M  +1    -1    rkward/windows/rkwindowcatcher.cpp

http://commits.kde.org/rkward/1b0c0610585f2e68eb0bde0f1bbfe7ce00632a5b

diff --git a/rkward/misc/rkdummypart.cpp b/rkward/misc/rkdummypart.cpp
index 47c1038..90b2847 100644
--- a/rkward/misc/rkdummypart.cpp
+++ b/rkward/misc/rkdummypart.cpp
@@ -24,9 +24,7 @@
 RKDummyPart::RKDummyPart (QObject *parent, QWidget *widget) : KParts::Part (parent) {
 	RK_TRACE (MISC);
 	setWidget (widget);
-
-	setComponentData (KGlobal::mainComponent ());
-
+	setComponentName (QCoreApplication::applicationName (), QGuiApplication::applicationDisplayName ());
 	setXMLFile ("rkdummypart.rc");
 }
 
diff --git a/rkward/plugin/CMakeLists.txt b/rkward/plugin/CMakeLists.txt
index 46edaf4..710883c 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 KF5::KDELibs4Support)
+TARGET_LINK_LIBRARIES(plugin Qt5::Widgets Qt5::Script KF5::KDELibs4Support)
 
 ########### install files ###############
 
diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp
index 8a8101c..4244015 100644
--- a/rkward/plugin/rkcomponentmap.cpp
+++ b/rkward/plugin/rkcomponentmap.cpp
@@ -347,7 +347,7 @@ void RKComponentMap::initialize () {
 RKComponentMap::RKComponentMap () : QObject (), RKComponentGUIXML ("global"), KXMLGUIClient () {
 	RK_TRACE (PLUGIN);
 
-	setComponentData (KGlobal::mainComponent ());
+	setComponentName (QCoreApplication::applicationName (), QGuiApplication::applicationDisplayName ());
 	actionCollection ()->setConfigGroup ("Plugin Shortcuts");
 	contexts.insert ("global", this);
 }
@@ -719,7 +719,7 @@ void RKComponentMap::addedEntry (const QString &id, RKComponentHandle *handle) {
 	handle->setAccessible (true);
 	QAction *action = actionCollection ()->addAction (id, this, SLOT (activateComponent()));
 	action->setText (handle->getLabel ());
-	action->setShortcutConfigurable (true);
+	actionCollection ()->setShortcutsConfigurable (action, true);
 }
 
 void RKComponentGUIXML::appendPluginToList (const QString& id, QStringList* list) {
diff --git a/rkward/plugin/rkcomponentproperties.cpp b/rkward/plugin/rkcomponentproperties.cpp
index 21e0aa7..d9ca053 100644
--- a/rkward/plugin/rkcomponentproperties.cpp
+++ b/rkward/plugin/rkcomponentproperties.cpp
@@ -1185,7 +1185,7 @@ QVariant RKComponentPropertyCode::value (const QString &modifier) {
 	if (modifier == "printout") return printout ();
 	if (!modifier.isEmpty ()) warnModifierNotRecognized (modifier);
 
-	return (preprocess () + calculate () + printout ());
+	return (QString (preprocess () + calculate () + printout ()));
 }
 
 /////////////////////////////////////////// Convert ////////////////////////////////////////////////
diff --git a/rkward/plugin/rkinput.cpp b/rkward/plugin/rkinput.cpp
index 66e3a08..a6191d9 100644
--- a/rkward/plugin/rkinput.cpp
+++ b/rkward/plugin/rkinput.cpp
@@ -21,6 +21,7 @@
 #include <qlineedit.h>
 #include <qlabel.h>
 #include <QVBoxLayout>
+#include <QEvent>
 
 #include <klocale.h>
 
@@ -81,12 +82,11 @@ RKInput::~RKInput () {
 	RK_TRACE (PLUGIN);
 }
 
-void RKInput::enabledChange (bool old) {
+void RKInput::changeEvent (QEvent *event) {
 	RK_TRACE (PLUGIN);
 
-	updateColor ();
-
-	RKComponent::enabledChange (old);
+	if (event->type () == QEvent::EnabledChange) updateColor ();
+	RKComponent::changeEvent (event);
 }
 
 void RKInput::updateColor () {
diff --git a/rkward/plugin/rkinput.h b/rkward/plugin/rkinput.h
index c934ec0..db2948e 100644
--- a/rkward/plugin/rkinput.h
+++ b/rkward/plugin/rkinput.h
@@ -48,7 +48,7 @@ public slots:
 	void requirednessChanged (RKComponentPropertyBase *);
 protected:
 /** Grey out input when disabled */
-	void enabledChange (bool old);
+	void changeEvent (QEvent *event) override;
 private:
 	void updateColor ();
 	bool updating;
diff --git a/rkward/plugin/rkvarselector.cpp b/rkward/plugin/rkvarselector.cpp
index f16e4cf..9e7942a 100644
--- a/rkward/plugin/rkvarselector.cpp
+++ b/rkward/plugin/rkvarselector.cpp
@@ -91,7 +91,7 @@ void RKVarSelector::showFilterWidget () {
 		filter_widget = list_view->getSettings ()->filterWidget (this);
 		filter_widget_placeholder->addWidget (filter_widget);
 	}
-	filter_widget->setShown (show_filter_action->isChecked ());
+	filter_widget->setVisible (show_filter_action->isChecked ());
 }
 
 void RKVarSelector::rootChanged () {
diff --git a/rkward/plugin/rkvarslot.cpp b/rkward/plugin/rkvarslot.cpp
index 3ad5788..8bc1e30 100644
--- a/rkward/plugin/rkvarslot.cpp
+++ b/rkward/plugin/rkvarslot.cpp
@@ -22,6 +22,7 @@
 #include <QTreeWidget>
 #include <QHeaderView>
 #include <qstringlist.h>
+#include <QEvent>
 #include <QGridLayout>
 #include <QVBoxLayout>
 
@@ -192,6 +193,11 @@ void RKVarSlot::updateLook () {
 	list->setPalette(palette);
 }
 
+void RKVarSlot::changeEvent (QEvent* event) {
+	if (event->type () == QEvent::EnabledChange) updateLook ();
+	RKComponent::changeEvent (event);
+}
+
 void RKVarSlot::addOrRemove (bool add) {
 	RK_TRACE (PLUGIN);
 	RK_DEBUG (PLUGIN, DL_DEBUG, "select press in varslot: mode %d, source %s, selected %s", add, qPrintable (fetchStringValue (source)), qPrintable (fetchStringValue (selected)));
diff --git a/rkward/plugin/rkvarslot.h b/rkward/plugin/rkvarslot.h
index 8804dfc..4808d14 100644
--- a/rkward/plugin/rkvarslot.h
+++ b/rkward/plugin/rkvarslot.h
@@ -54,7 +54,7 @@ public slots:
 	void availablePropertyChanged (RKComponentPropertyBase *);
 protected:
 /** Calls updateLook (), when enabledness changes */
-	void enabledChange (bool old) { updateLook (); QWidget::enabledChange (old); };
+	void changeEvent (QEvent *event) override;
 private:
 	void addOrRemove (bool add);
 	enum {
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 50cbe82..04cd042 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -993,7 +993,7 @@ void RKConsole::activate (bool with_focus) {
 RKConsolePart::RKConsolePart (RKConsole *console) : KParts::Part (0) {
 	RK_TRACE (APP);
 
-	setComponentData (KGlobal::mainComponent ());
+	setComponentName (QCoreApplication::applicationName (), QGuiApplication::applicationDisplayName ());
 
 	setWidget (console);
 
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 9fae879..1801e6b 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -70,7 +70,7 @@
 RKCommandEditorWindowPart::RKCommandEditorWindowPart (QWidget *parent) : KParts::Part (parent) {
 	RK_TRACE (COMMANDEDITOR);
 
-	setComponentData (KGlobal::mainComponent ());
+	setComponentName (QCoreApplication::applicationName (), QGuiApplication::applicationDisplayName ());
 	setWidget (parent);
 	setXMLFile ("rkcommandeditorwindowpart.rc");
 }
diff --git a/rkward/windows/rkcommandlog.cpp b/rkward/windows/rkcommandlog.cpp
index db26209..486f367 100644
--- a/rkward/windows/rkcommandlog.cpp
+++ b/rkward/windows/rkcommandlog.cpp
@@ -269,7 +269,7 @@ void RKCommandLogView::selectAll () {
 RKCommandLogPart::RKCommandLogPart (RKCommandLog *for_log) : KParts::Part (0) {
 	RK_TRACE (APP);
 
-	setComponentData (KGlobal::mainComponent ());
+	setComponentName (QCoreApplication::applicationName (), QGuiApplication::applicationDisplayName ());
 	setWidget (log = for_log);
 	setXMLFile ("rkcommandlogpart.rc");
 }
diff --git a/rkward/windows/rkhtmlwindow.cpp b/rkward/windows/rkhtmlwindow.cpp
index d3fcfc5..dd4b9cc 100644
--- a/rkward/windows/rkhtmlwindow.cpp
+++ b/rkward/windows/rkhtmlwindow.cpp
@@ -566,7 +566,7 @@ void RKHTMLWindow::restoreBrowserState (VisitedLocation* state) {
 
 RKHTMLWindowPart::RKHTMLWindowPart (RKHTMLWindow* window) : KParts::Part (window) {
 	RK_TRACE (APP);
-	setComponentData (KGlobal::mainComponent ());
+	setComponentName (QCoreApplication::applicationName (), QGuiApplication::applicationDisplayName ());
 	RKHTMLWindowPart::window = window;
 	setWidget (window);
 }
diff --git a/rkward/windows/rkmdiwindow.cpp b/rkward/windows/rkmdiwindow.cpp
index dd69f29..869f109 100644
--- a/rkward/windows/rkmdiwindow.cpp
+++ b/rkward/windows/rkmdiwindow.cpp
@@ -42,7 +42,7 @@
 RKMDIStandardActionClient::RKMDIStandardActionClient () : KXMLGUIClient () {
 	RK_TRACE (APP);
 
-	setComponentData (KGlobal::mainComponent ());
+	setComponentName (QCoreApplication::applicationName (), QGuiApplication::applicationDisplayName ());
 	setXMLFile ("rkstandardactions.rc", true);
 }
 
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index 5ead8ca..2d15236 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -627,7 +627,7 @@ void RKCaughtX11Window::rCommandDone (RCommand *command) {
 RKCaughtX11WindowPart::RKCaughtX11WindowPart (RKCaughtX11Window *window) : KParts::Part (0) {
 	RK_TRACE (MISC);
 
-	setComponentData (KGlobal::mainComponent ());
+	setComponentName (QCoreApplication::applicationName (), QGuiApplication::applicationDisplayName ());
 
 	setWidget (window);
 	RKCaughtX11WindowPart::window = window;



More information about the rkward-tracker mailing list