summaryrefslogtreecommitdiffstats
path: root/khotkeys/update
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /khotkeys/update
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'khotkeys/update')
-rw-r--r--khotkeys/update/Makefile.am11
-rw-r--r--khotkeys/update/update.cpp62
2 files changed, 73 insertions, 0 deletions
diff --git a/khotkeys/update/Makefile.am b/khotkeys/update/Makefile.am
new file mode 100644
index 000000000..ae28dde38
--- /dev/null
+++ b/khotkeys/update/Makefile.am
@@ -0,0 +1,11 @@
+kconf_PROGRAMS = khotkeys_update
+kconfdir = $(libdir)/kconf_update_bin
+
+khotkeys_update_SOURCES = update.cpp
+
+khotkeys_update_LDADD = ../shared/libkhotkeys_shared.la $(LIB_KDECORE) $(KDE_RPATH)
+khotkeys_update_LDFLAGS = $(all_libraries)
+
+INCLUDES = -I$(srcdir)/../shared $(all_includes)
+
+METASOURCES = AUTO
diff --git a/khotkeys/update/update.cpp b/khotkeys/update/update.cpp
new file mode 100644
index 000000000..ac96a9709
--- /dev/null
+++ b/khotkeys/update/update.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+
+ KHotKeys
+
+ Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
+
+ Distributed under the terms of the GNU General Public License version 2.
+
+****************************************************************************/
+
+#define _UPDATE_CPP_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kstandarddirs.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <dcopclient.h>
+
+#include <settings.h>
+
+using namespace KHotKeys;
+
+static const KCmdLineOptions options[] =
+ {
+ // no need for I18N_NOOP(), this is not supposed to be used directly
+ { "id <id>", "Id of the script to add to khotkeysrc.", 0 },
+ KCmdLineLastOption
+ };
+
+int main( int argc, char* argv[] )
+ {
+ KCmdLineArgs::init( argc, argv, "khotkeys_update", "KHotKeys Update",
+ "KHotKeys update utility", "1.0" );
+ KCmdLineArgs::addCmdLineOptions( options );
+ KApplication app( false, true ); // X11 connection is necessary for KKey* stuff :-/
+ KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
+ QCString id = args->getOption( "id" );
+ QString file = locate( "data", "khotkeys/" + id + ".khotkeys" );
+ if( file.isEmpty())
+ {
+ kdWarning() << "File " << id << " not found!" << endl;
+ return 1;
+ }
+ init_global_data( false, &app );
+ Settings settings;
+ settings.read_settings( true );
+ KConfig cfg( file, true );
+ if( !settings.import( cfg, false ))
+ {
+ kdWarning() << "Import of " << id << " failed!" << endl;
+ return 2;
+ }
+ settings.write_settings();
+ QByteArray data;
+ kapp->dcopClient()->send( "khotkeys*", "khotkeys", "reread_configuration()", data );
+ return 0;
+ }