summarylogtreecommitdiffstats
path: root/port_to_kf5.patch
blob: 46675d9eab470f46fba028656a4a874ea558022e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
diff -Naur a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt	2011-11-13 21:55:57.000000000 +0800
+++ b/CMakeLists.txt	2015-12-03 08:51:27.892172082 +0800
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 2.8)
 project(kcm_imchooser)
 set(MAJOR_VERSION "0")
 set(MINOR_VERSION "1")
@@ -12,8 +12,16 @@
     set(VERSION_STRING_FULL "${VERSION_STRING}-${SUFFIX_VERSION}")
 endif(NOT SUFFIX_VERSION)
 
-find_package(KDE4 REQUIRED)
-include(KDE4Defaults)
+find_package(ECM 0.0.11 REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
+
+include(KDEInstallDirs)
+include(KDECMakeSettings)
+include(KDECompilerSettings)
+include(FeatureSummary)
+
+find_package(Qt5 REQUIRED COMPONENTS Widgets)
+find_package(KF5 REQUIRED COMPONENTS KDELibs4Support KIO DBusAddons)
 
 set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_C_FLAGS}")
 set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_CXX_FLAGS}")
diff -Naur a/src/kcontrol/CMakeLists.txt b/src/kcontrol/CMakeLists.txt
--- a/src/kcontrol/CMakeLists.txt	2011-11-13 21:55:57.000000000 +0800
+++ b/src/kcontrol/CMakeLists.txt	2015-12-03 08:51:27.895505493 +0800
@@ -1,6 +1,3 @@
-add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
-include_directories(${KDE4_INCLUDES} ${QT_INCLUDES})
-
 set(kcm_SRCS
     main.cpp
     module.cpp
@@ -11,13 +8,12 @@
 
 find_package(Gettext REQUIRED)
 
-kde4_add_ui_files(kcm_SRCS module.ui)
+ki18n_wrap_ui(kcm_SRCS module.ui)
 
-kde4_add_plugin(kcm_imchooser ${kcm_SRCS})
+add_library(kcm_imchooser MODULE ${kcm_SRCS})
 
 target_link_libraries(kcm_imchooser
-    ${KDE4_KDEUI_LIBRARY}
-    ${KDE4_KIO_LIBRARY}
+    KF5::KDELibs4Support
 )
 
 install(TARGETS kcm_imchooser DESTINATION ${PLUGIN_INSTALL_DIR})
diff -Naur a/src/kcontrol/kcm_imchooser.desktop b/src/kcontrol/kcm_imchooser.desktop
--- a/src/kcontrol/kcm_imchooser.desktop	2011-11-13 21:55:57.000000000 +0800
+++ b/src/kcontrol/kcm_imchooser.desktop	2015-12-03 08:51:27.895505493 +0800
@@ -1,13 +1,15 @@
 [Desktop Entry]
-Exec=kcmshell4 kcm_imchooser
+Exec=kcmshell5 kcm_imchooser
 Icon=draw-freehand
 Type=Service
 X-KDE-ServiceTypes=KCModule
 X-KDE-Library=kcm_imchooser
 X-KDE-ParentApp=kcontrol
 
-X-KDE-System-Settings-Parent-Category=locale
+X-KDE-System-Settings-Parent-Category=regionalsettings
 Name=Input Method Chooser
+Name[zh_CN]=输入法选择器
 Comment=Choose your input method
+Comment[zh_CN]=选择你的输入法
 
 Categories=Qt;KDE;X-KDE-settings-components;
diff -Naur a/src/kcontrol/main.cpp b/src/kcontrol/main.cpp
--- a/src/kcontrol/main.cpp	2011-11-13 21:55:57.000000000 +0800
+++ b/src/kcontrol/main.cpp	2015-12-03 09:06:36.926300550 +0800
@@ -26,3 +26,4 @@
                  registerPlugin<IMChooser::Module>();)
 K_EXPORT_PLUGIN(KcmIMChooserFactory("kcm_imchooser"))
 
+#include <main.moc>
\ No newline at end of file
diff -Naur a/src/kcontrol/module.cpp b/src/kcontrol/module.cpp
--- a/src/kcontrol/module.cpp	2011-11-13 21:55:57.000000000 +0800
+++ b/src/kcontrol/module.cpp	2015-12-03 09:06:59.976677775 +0800
@@ -29,6 +29,16 @@
 #include <KMessageBox>
 #include <KIconButton>
 #include <KFileDialog>
+//kdelibs4support
+#include <KGlobal>
+#include <KIcon>
+#include <KDialog>
+#include <KUrl>
+
+#include <QStandardPaths>
+
+#define TRANSLATION_DOMAIN "kcm_imchooser"
+#include <klocalizedstring.h>
 
 #include "ui_module.h"
 #include "module.h"
@@ -41,7 +51,7 @@
 namespace IMChooser
 {
 Module::Module(QWidget *parent, const QVariantList &args) :
-    KCModule(KcmIMChooserFactory::componentData(), parent, args),
+    KCModule(parent, args),
     ui(new Ui::Module),
     m_model(new IMProfileModel(this)),
     m_listView(0),
@@ -111,11 +121,11 @@
         saveProfile(profile);
     }
 
-    QDir kdedir(KGlobal::mainComponent().dirs()->localkdedir());
+    QDir kdedir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/plasma-workspace");
     if (!kdedir.exists("env"))
         kdedir.mkpath("env");
 
-    QFile envScript(KGlobal::mainComponent().dirs()->localkdedir() + "env/" + "imchooser-env.sh");
+    QFile envScript(kdedir.path() + "/env/imchooser-env.sh");
     if (!envScript.open(QIODevice::WriteOnly | QIODevice::Text))
         return;
 
diff -Naur a/src/kded/CMakeLists.txt b/src/kded/CMakeLists.txt
--- a/src/kded/CMakeLists.txt	2011-11-13 21:55:57.000000000 +0800
+++ b/src/kded/CMakeLists.txt	2015-12-03 08:51:27.895505493 +0800
@@ -3,9 +3,9 @@
 
 set(kded_imchooserstarter_PART_SRCS  imchooserstarter.cpp )
 
-kde4_add_plugin(kded_imchooserstarter  ${kded_imchooserstarter_PART_SRCS})
+add_library(kded_imchooserstarter MODULE ${kded_imchooserstarter_PART_SRCS})
 
-target_link_libraries(kded_imchooserstarter  ${KDE4_KIO_LIBS})
+target_link_libraries(kded_imchooserstarter KF5::KDELibs4Support KF5::DBusAddons)
 
 install(TARGETS kded_imchooserstarter  DESTINATION ${PLUGIN_INSTALL_DIR} )
 install( FILES imchooserstarter.desktop  DESTINATION  ${SERVICES_INSTALL_DIR}/kded )
\ No newline at end of file
diff -Naur a/src/kded/imchooserstarter.cpp b/src/kded/imchooserstarter.cpp
--- a/src/kded/imchooserstarter.cpp	2011-11-13 21:55:57.000000000 +0800
+++ b/src/kded/imchooserstarter.cpp	2015-12-03 08:51:27.895505493 +0800
@@ -29,6 +29,7 @@
 K_PLUGIN_FACTORY(IMChooserFactory, registerPlugin<IMChooserStarter>();)
 K_EXPORT_PLUGIN(IMChooserFactory("kded_imchooserstarter"))
 
+#include "imchooserstarter.moc"
 
 IMChooserStarter::IMChooserStarter(QObject *parent, const QList<QVariant> &)
     : KDEDModule(parent)