khotkeys: make sure the kded service is controlled only by the Service Manager in TCC.

Also make sure any changes to Input Action is immediately notified to
the kded service.
This resolves issue #537.

1. Fix kded service startup settings.
In TCC --> Regional & Accessibility --> Input Actions --> General
Settings tab, there was a checkbox to "disable the daemon". This was
either quitting or relaunching khotkeys as a standalone application,
overlapping any choice set in the TCC -> TDE Components --> Service
Manager page.
khotkeys is now launched as a kded service, therefore the aforemention
checkbox is no longer required. If a user choose to manually launch
khotkeys as a standalone application, they can disable it by simply
terminating the application (either by killing it or quitting through
DCOP).

2. Notify Input Actions changes to the kded service
If Input Actions are changed, the changes will be notified to either the
kded service or the standalone khotkeys application, depending on which
of the two is running.

3. the kcm_khotkeys_init library has been removed since it is no longer
   necessary.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/534/head
Michele Calgaro 2 months ago committed by TDE Gitea
parent 02fe8ba51a
commit 8da4fdbdbc

@ -395,7 +395,6 @@ MouseButton=2
Timeout=1000
[Main]
Autostart=true
Disabled=false
Version=2
ImportId=trinity2b1

@ -47,12 +47,3 @@ tde_add_kpart( kcm_khotkeys AUTOMOC
LINK ui-static
DESTINATION ${PLUGIN_INSTALL_DIR}
)
##### kcm_khotkeys_init (module) ################
tde_add_kpart( kcm_khotkeys_init AUTOMOC
SOURCES init.cpp
LINK tdecore-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
)

@ -1,6 +1,6 @@
SUBDIRS = ui
kde_module_LTLIBRARIES = kcm_khotkeys.la kcm_khotkeys_init.la
kde_module_LTLIBRARIES = kcm_khotkeys.la
kcm_khotkeys_la_SOURCES = \
menuedit.cpp window_trigger_widget.cpp tab_widget.cpp main_buttons_widget.cpp \
@ -15,11 +15,6 @@ kcm_khotkeys_la_SOURCES = \
kcm_khotkeys_la_LIBADD = ui/libui.la $(LIB_TDEUI) $(LIB_ARTS)
kcm_khotkeys_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
kcm_khotkeys_init_la_SOURCES = init.cpp
kcm_khotkeys_init_la_LIBADD = $(LIB_TDECORE)
kcm_khotkeys_init_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
noinst_HEADERS = menuedit.h window_trigger_widget.h \
tab_widget.h main_buttons_widget.h actions_listview_widget.h menuentry_widget.h \
general_tab.h action_group_tab.h kcmkhotkeys.h windowdef_list_widget.h \

@ -26,9 +26,6 @@ namespace KHotKeys
General_settings_tab::General_settings_tab( TQWidget* parent_P, const char* name_P )
: General_settings_tab_ui( parent_P, name_P )
{
// KHotKeys::Module::changed()
connect( disable_daemon_checkbox, TQ_SIGNAL( clicked()),
module, TQ_SLOT( changed()));
}
void General_settings_tab::import_clicked()
@ -36,16 +33,6 @@ void General_settings_tab::import_clicked()
module->import();
}
void General_settings_tab::write_data() const
{
module->set_daemon_disabled( disable_daemon_checkbox->isChecked());
}
void General_settings_tab::read_data()
{
disable_daemon_checkbox->setChecked( module->daemon_disabled());
}
void General_settings_tab::clear_data()
{
// "global" tab, not action specific, do nothing

@ -22,8 +22,6 @@ class General_settings_tab
TQ_OBJECT
public:
General_settings_tab( TQWidget* parent = NULL, const char* name = NULL );
void read_data();
void write_data() const;
public slots:
void clear_data();
protected slots:

@ -1,40 +0,0 @@
/****************************************************************************
KHotKeys
Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
Distributed under the terms of the GNU General Public License version 2.
****************************************************************************/
#define _INIT_CPP_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <dcopref.h>
#include <tdeapplication.h>
#include <tdeconfig.h>
#include <kdebug.h>
#include <stdlib.h>
extern "C"
{
TDE_EXPORT void init_khotkeys()
{
TDEConfig cfg( "khotkeysrc", true );
cfg.setGroup( "Main" );
if( !cfg.readBoolEntry( "Autostart", false ))
{
return;
}
DCOPRef ref( "kded", "kded" );
if( !ref.call( "loadModule", TQCString( "khotkeys" )))
{
kdWarning( 1217 ) << "Loading of khotkeys module failed." << endl;
kapp->tdeinitExec( "khotkeys" );
}
}
}

@ -122,24 +122,33 @@ void Module::save()
tab_widget->save_current_action_changes();
settings.actions = _actions_root;
settings.write_settings();
if( daemon_disabled())
if(kapp->dcopClient()->isApplicationRegistered( "khotkeys" ))
{
// khotkeys running as a standalone application
TQByteArray data;
kapp->dcopClient()->send( "khotkeys*", "khotkeys", "quit()", data );
kdDebug( 1217 ) << "disabling khotkeys daemon" << endl;
kdDebug( 1217 ) << "telling khotkeys standalone application to reread configuration" << endl;
kapp->dcopClient()->send( "khotkeys", "khotkeys", "reread_configuration()", data );
}
else
{
if( !kapp->dcopClient()->isApplicationRegistered( "khotkeys" ))
TQCString replyType;
TQByteArray replyData;
if (kapp->dcopClient()->call("kded", "kded", "loadedModules()",
TQByteArray(), replyType, replyData))
{
kdDebug( 1217 ) << "launching new khotkeys daemon" << endl;
TDEApplication::tdeinitExec( "khotkeys" );
}
else
{
TQByteArray data;
kapp->dcopClient()->send( "khotkeys*", "khotkeys", "reread_configuration()", data );
kdDebug( 1217 ) << "telling khotkeys daemon to reread configuration" << endl;
if (replyType == "QCStringList")
{
TQDataStream reply(replyData, IO_ReadOnly);
QCStringList modules;
reply >> modules;
if (modules.contains("khotkeys"))
{
// khotkeys running as a kded service
TQByteArray data;
kdDebug( 1217 ) << "telling khotkeys kded daemon to reread configuration" << endl;
kapp->dcopClient()->send( "kded", "khotkeys", "reread_configuration()", data );
}
}
}
}
emit TDECModule::changed( false );

@ -51,8 +51,6 @@ class Module
int gesture_timeout() const;
void set_gestures_exclude( Windowdef_list* windows );
const Windowdef_list* gestures_exclude() const;
void set_daemon_disabled( bool disable );
bool daemon_disabled() const;
void import();
TDEShortcut voice_shortcut() const;
void set_voice_shortcut( const TDEShortcut&) ;
@ -139,19 +137,6 @@ const Windowdef_list* Module::gestures_exclude() const
return settings.gestures_exclude;
}
inline
void Module::set_daemon_disabled( bool disabled_P )
{
settings.daemon_disabled = disabled_P;
}
inline
bool Module::daemon_disabled() const
{
return settings.daemon_disabled;
}
inline
void Module::set_voice_shortcut( const TDEShortcut& cut)
{

@ -5,8 +5,6 @@ Type=Application
X-DocPath=kcontrol/khotkeys/index.html
X-TDE-ModuleType=Library
X-TDE-Library=khotkeys
X-TDE-Init-Library=khotkeys_init
X-TDE-Init=khotkeys
X-TDE-StartupNotify=false
Categories=Qt;TDE;X-TDE-settings-accessibility;

@ -191,16 +191,34 @@ void khotkeys_send_reread_config()
TQByteArray data;
if( !kapp->dcopClient()->isAttached())
kapp->dcopClient()->attach();
if( !kapp->dcopClient()->isApplicationRegistered( "khotkeys" ))
if(kapp->dcopClient()->isApplicationRegistered( "khotkeys" ))
{
kdDebug( 1217 ) << "launching new khotkeys daemon" << endl;
TDEApplication::tdeinitExec( "khotkeys" );
// khotkeys running as a standalone application
TQByteArray data;
kdDebug( 1217 ) << "telling khotkeys standalone application to reread configuration" << endl;
kapp->dcopClient()->send( "khotkeys", "khotkeys", "reread_configuration()", data );
}
else
{
TQByteArray data;
kapp->dcopClient()->send( "khotkeys*", "khotkeys", "reread_configuration()", data );
kdDebug( 1217 ) << "telling khotkeys daemon to reread configuration" << endl;
TQCString replyType;
TQByteArray replyData;
if (kapp->dcopClient()->call("kded", "kded", "loadedModules()",
TQByteArray(), replyType, replyData))
{
if (replyType == "QCStringList")
{
TQDataStream reply(replyData, IO_ReadOnly);
QCStringList modules;
reply >> modules;
if (modules.contains("khotkeys"))
{
// khotkeys running as a kded service
TQByteArray data;
kdDebug( 1217 ) << "telling khotkeys kded daemon to reread configuration" << endl;
kapp->dcopClient()->send( "kded", "khotkeys", "reread_configuration()", data );
}
}
}
}
}
@ -303,7 +321,6 @@ TQString khotkeys_change_menu_entry_shortcut( const TQString& entry_P,
return "";
}
entry->reparent( khotkeys_get_menu_root( settings.actions ));
settings.daemon_disabled = false; // #91782
settings.write_settings();
khotkeys_send_reread_config();
return shortcut;

@ -103,7 +103,6 @@ void Tab_widget::save_current_action_changes()
if( current_type == NONE ) // info, global settings
{
static_cast< Gestures_settings_tab* >( pages[ TAB_GESTURES_SETTINGS ] )->write_data(); // saves
static_cast< General_settings_tab* >( pages[ TAB_GENERAL_SETTINGS ] )->write_data(); // saves
static_cast< Voice_settings_tab* >( pages[ TAB_VOICE_SETTINGS ] )->write_data(); // saves
}
else if( current_type == GROUP )
@ -235,7 +234,6 @@ void Tab_widget::load_current_action()
{
static_cast< Gestures_settings_tab* >( pages[ TAB_GESTURES_SETTINGS ] )->read_data(); // loads
static_cast< Voice_settings_tab* >( pages[ TAB_VOICE_SETTINGS ] )->read_data(); // loads
static_cast< General_settings_tab* >( pages[ TAB_GENERAL_SETTINGS ] )->read_data(); // loads
}
else if( current_type == GROUP )
{

@ -16,14 +16,6 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox">
<property name="name">
<cstring>disable_daemon_checkbox</cstring>
</property>
<property name="text">
<string>Disable KHotKeys daemon</string>
</property>
</widget>
<widget class="TQLayoutWidget">
<property name="name">
<cstring>layout1</cstring>

@ -103,8 +103,6 @@ bool Settings::read_settings( TDEConfig& cfg_P, bool include_disabled_P, ImportT
}
if( import_P != ImportNone )
return true; // don't read global settings
cfg_P.setGroup( "Main" ); // main group
daemon_disabled = cfg_P.readBoolEntry( "Disabled", false );
cfg_P.setGroup( "Gestures" );
gestures_disabled_globally = cfg_P.readBoolEntry( "Disabled", true );
gesture_mouse_button = cfg_P.readNumEntry( "MouseButton", 2 );
@ -132,9 +130,6 @@ void Settings::write_settings()
cfg.writeEntry( "AlreadyImported", already_imported );
cfg.setGroup( "Data" );
int cnt = write_actions_recursively_v2( cfg, actions, true );
cfg.setGroup( "Main" );
cfg.writeEntry( "Autostart", cnt != 0 && !daemon_disabled );
cfg.writeEntry( "Disabled", daemon_disabled );
cfg.setGroup( "Gestures" );
cfg.writeEntry( "Disabled", gestures_disabled_globally );
cfg.writeEntry( "MouseButton", gesture_mouse_button );
@ -155,7 +150,6 @@ void Settings::write_settings()
// return value means the number of enabled actions written in the cfg file
// i.e. 'Autostart' for value > 0 should be on
int Settings::write_actions_recursively_v2( TDEConfig& cfg_P, Action_data_group* parent_P, bool enabled_P )
{
int enabled_cnt = 0;

@ -37,7 +37,6 @@ class TDE_EXPORT Settings
bool gestures_disabled_globally;
int gesture_mouse_button;
int gesture_timeout;
bool daemon_disabled;
Windowdef_list* gestures_exclude;
TDEShortcut voice_shortcut;
protected:

Loading…
Cancel
Save