[kde-doc-english] [kmousetool/frameworks] /: Initial port to KF5

Christoph Feck cfeck at kde.org
Sat Dec 20 18:13:10 UTC 2014


Git commit 925b9f5bfae150fc8f37f7bbf63c6d546142930c by Christoph Feck.
Committed on 20/12/2014 at 18:13.
Pushed by cfeck into branch 'frameworks'.

Initial port to KF5

M  +25   -17   CMakeLists.txt
M  +2    -2    doc/CMakeLists.txt
M  +1    -1    doc/index.docbook
M  +1    -1    doc/man-kmousetool.1.docbook
M  +3    -1    kmousetool/CMakeLists.txt
M  +8    -7    kmousetool/kmousetool.cpp
M  +4    -4    kmousetool/kmousetool.h
M  +4    -3    kmousetool/main.cpp

http://commits.kde.org/kmousetool/925b9f5bfae150fc8f37f7bbf63c6d546142930c

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6019354..9f38652 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,27 +1,35 @@
 project(kmousetool)
 
-find_package(KDE4 REQUIRED)
-include (KDE4Defaults)
-include (MacroLibrary)
+cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
+set (QT_MIN_VERSION "5.3.0")
+
+find_package (ECM 1.3.0 REQUIRED NO_MODULE)
+set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+
+include(CheckIncludeFiles)
+include(KDEInstallDirs)
+include(ECMInstallIcons)
+include(KDECMakeSettings)
+include(KDECompilerSettings)
+include(FeatureSummary)
+
+find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets)
+
+find_package (KF5 REQUIRED
+    KDELibs4Support
+    Notifications
+)
+
+find_package(Phonon4Qt5 REQUIRED NO_MODULE)
 
-add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
 add_definitions( -DQT_NO_CAST_FROM_ASCII )
 add_definitions( -DQT_NO_CAST_TO_ASCII )
 add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
 
-include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
-
-if(Q_WS_X11)
-  macro_log_feature(X11_XTest_FOUND "libXtst" "X11 Testing Resource extension library" "http://xorg.freedesktop.org" TRUE "" "Needed to build kmousetool.")
+include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
 
-  if(X11_XTest_FOUND)
+find_package(X11 REQUIRED)
+if(X11_XTest_FOUND)
     add_subdirectory( doc )
     add_subdirectory( kmousetool )
-  endif(X11_XTest_FOUND)
-else(Q_WS_X11)
-  message(FATAL_ERROR "kmousetool needs an X11-based system.")
-endif(Q_WS_X11)
-
-if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
-    macro_display_feature_log()
-endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
+endif(X11_XTest_FOUND)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 8328d7d..19fa059 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,5 +1,5 @@
 ########### install files ###############
 
 #
-kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmousetool)
-kde4_create_manpage(man-kmousetool.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR})
+kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmousetool)
+kdoctools_create_manpage(man-kmousetool.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR})
diff --git a/doc/index.docbook b/doc/index.docbook
index 6028057..8294ad3 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
-<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
+<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
   <!ENTITY kmousetool '<application>KMouseTool</application>'>
   <!ENTITY kappname "&kmousetool;">
   <!ENTITY package "kdeaccessibility">
diff --git a/doc/man-kmousetool.1.docbook b/doc/man-kmousetool.1.docbook
index 6204f73..c573f9f 100644
--- a/doc/man-kmousetool.1.docbook
+++ b/doc/man-kmousetool.1.docbook
@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
-<!DOCTYPE refentry PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
+<!DOCTYPE refentry PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
 <!ENTITY kmousetool '<application>KMouseTool</application>'>
 <!ENTITY % English "INCLUDE">
 ]>
diff --git a/kmousetool/CMakeLists.txt b/kmousetool/CMakeLists.txt
index 02be6e9..bb8f857 100644
--- a/kmousetool/CMakeLists.txt
+++ b/kmousetool/CMakeLists.txt
@@ -6,13 +6,15 @@ add_subdirectory( pics )
 
 ########### next target ###############
 
+include_directories(${PHONON_INCLUDE_DIR})
+
 set(kmousetool_SRCS mtstroke.cpp kmousetool.cpp main.cpp )
 
 kde4_add_ui_files(kmousetool_SRCS kmousetoolui.ui )
 
 kde4_add_executable(kmousetool ${kmousetool_SRCS})
 
-target_link_libraries(kmousetool ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${X11_XTest_LIB} ${X11_Xext_LIB} ${X11_LIBRARIES})
+target_link_libraries(kmousetool KF5::KDELibs4Support ${PHONON_LIBRARIES} KF5::Notifications Qt5::Core Qt5::Gui Qt5::Widgets ${X11_XTest_LIB} ${X11_Xext_LIB} ${X11_LIBRARIES})
 
 install(TARGETS kmousetool  ${INSTALL_TARGETS_DEFAULT_ARGS} )
 
diff --git a/kmousetool/kmousetool.cpp b/kmousetool/kmousetool.cpp
index 61532c4..8ef259b 100644
--- a/kmousetool/kmousetool.cpp
+++ b/kmousetool/kmousetool.cpp
@@ -21,7 +21,6 @@
 
 #include "kmousetool.h"
 #include <X11/Xmd.h>
-#include "kmousetool.moc"
 #include "mtstroke.h"
 #include <kconfig.h>
 #include <X11/Intrinsic.h>     /* Intrinsics Definitions*/
@@ -52,12 +51,12 @@
 #include <knuminput.h>
 #include <kmenu.h>
 #include <kaboutapplicationdialog.h>
-#include <Phonon/MediaObject>
+#include <phonon/MediaObject>
 #include <netwm.h>
 #include <kapplication.h>
 #include <iostream>
 #include <QtCore/QAbstractEventDispatcher>
-#include <ktoolinvocation.h>
+#include <khelpclient.h>
 #include <kglobal.h>
 
 int currentXPosition;
@@ -102,7 +101,8 @@ void KMouseTool::init_vars()
     appfilename = KStandardDirs::locate("exe", QLatin1String( "kmousetool" ));
 
     // find the user's autostart directory
-    autostartdirname = KGlobalSettings::autostartPath();
+#pragma warning FIXME port to KF5
+    autostartdirname = QString(); //KGlobalSettings::autostartPath();
 
     QDesktopWidget *d = QApplication::desktop();
     int w = d->width();
@@ -266,7 +266,7 @@ KMouseTool::KMouseTool(QWidget *parent, const char *name)
     connect(trayIcon, SIGNAL(helpSelected()), this, SLOT(helpSelected()));
     connect(trayIcon, SIGNAL(quitSelected()), this, SLOT(quitSelected()));
 
-    aboutDlg = new KAboutApplicationDialog (KGlobal::mainComponent().aboutData());
+//    aboutDlg = new KAboutApplicationDialog (KGlobal::mainComponent().aboutData());
 }
 
 KMouseTool::~KMouseTool()
@@ -544,7 +544,7 @@ void KMouseTool::applySelected()
 // Buttons at the bottom of the dialog
 void KMouseTool::helpSelected()
 {
-    KToolInvocation::invokeHelp();
+    KHelpClient::invokeHelp();
 }
 
 void KMouseTool::closeSelected()
@@ -599,7 +599,8 @@ void KMouseTool::configureSelected()
 
 void KMouseTool::aboutSelected()
 {
-    aboutDlg->show();
+#pragma warning FIXME port to KF5
+//    aboutDlg->show();
 }
 
 
diff --git a/kmousetool/kmousetool.h b/kmousetool/kmousetool.h
index 8a55dc6..222ab8d 100644
--- a/kmousetool/kmousetool.h
+++ b/kmousetool/kmousetool.h
@@ -22,10 +22,10 @@
 #ifndef KMOUSETOOL_H
 #define KMOUSETOOL_H
 
-#include <QtCore/QDir>
-#include <QtGui/QLabel>
-#include <QtCore/QTimerEvent>
-#include <QtGui/QWidget>
+#include <QDir>
+#include <QLabel>
+#include <QTimerEvent>
+#include <QWidget>
 
 #include "version.h"
 
diff --git a/kmousetool/main.cpp b/kmousetool/main.cpp
index 67e6b45..b373219 100644
--- a/kmousetool/main.cpp
+++ b/kmousetool/main.cpp
@@ -18,13 +18,14 @@
  ***************************************************************************/
 
 #include <kcmdlineargs.h>
-#include <kaboutdata.h>
+#include <k4aboutdata.h>
 #include <klocale.h>
 #include <kstandarddirs.h>
 #include <kuniqueapplication.h>
 #include <QtDBus/QtDBus>
 #include <QtGui/QMessageBox>
 #include <kconfig.h>
+#include <kconfiggroup.h>
 #include <kglobal.h>
 
 #include "kmousetool.h"
@@ -34,8 +35,8 @@ static const char description[] = I18N_NOOP("KMouseTool");
 
 int main(int argc, char *argv[])
 {
-    KAboutData aboutData( "kmousetool", 0, ki18n("KMouseTool"),
-    KMOUSETOOL_VERSION, ki18n(description), KAboutData::License_GPL,
+    K4AboutData aboutData( "kmousetool", 0, ki18n("KMouseTool"),
+    KMOUSETOOL_VERSION, ki18n(description), K4AboutData::License_GPL,
     ki18n("(c) 2002-2003, Jeff Roush\n(c) 2003, Gunnar Schmidt"), KLocalizedString(), "http://www.mousetool.com", "gunnar at schmi-dt.de");
 
     aboutData.addAuthor(ki18n("Gunnar Schmidt"), ki18n("Current maintainer"), "gunnar at schmi-dt.de", "http://www.schmi-dt.de");


More information about the kde-doc-english mailing list