1 /****************************************************************************
5 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
7 Distributed under the terms of the GNU General Public License version 2.
9 ****************************************************************************/
13 #include <config-workspace.h>
15 #include <kapplication.h>
16 #include <kcmdlineargs.h>
17 #include <kstandarddirs.h>
20 #include <QtDBus/QtDBus>
22 #include "khotkeysiface.h"
26 using namespace KHotKeys
;
28 int main( int argc
, char* argv
[] )
30 KCmdLineArgs::init( argc
, argv
, "khotkeys_update", 0, ki18n("KHotKeys Update"), "1.0" ,
31 ki18n("KHotKeys update utility"));
33 KCmdLineOptions options
;
34 options
.add("id <id>", ki18n("Id of the script to add to khotkeysrc."));
35 KCmdLineArgs::addCmdLineOptions( options
);
36 KApplication
app( true ); // X11 connection is necessary for KKey* stuff :-/
37 KCmdLineArgs
* args
= KCmdLineArgs::parsedArgs();
38 QString id
= args
->getOption( "id" );
39 QString file
= KStandardDirs::locate( "data", "khotkeys/" + id
+ ".khotkeys" );
42 kWarning() << "File " << id
<< " not found!" ;
45 init_global_data( false, &app
);
47 settings
.read_settings( true );
49 if( !settings
.import( cfg
, false ))
51 kWarning() << "Import of " << id
<< " failed!" ;
54 settings
.write_settings();
55 QDBusConnection bus
= QDBusConnection::sessionBus();
56 if( bus
.interface()->isServiceRegistered( "org.kde.khotkeys" ))
58 org::kde::khotkeys
iface("org.kde.khotkeys", "/KHotKeys", bus
);
59 iface
.reread_configuration();
60 kDebug( 1217 ) << "telling khotkeys daemon to reread configuration";