From 5949b572bcc07683d90b97498fabb0adddf529e0 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 29 Aug 2023 22:57:16 +0300 Subject: [PATCH] khotkeys: drop it the only use case is to launch ksnapshot which can be done by plasma-desktop, some of the actions code is borked (notably window matching, global and menu actions were working) and I have no intention to fix it. even if fixed when a window (and thus possibly application) key is grabbed there is a chance the window (application) may want to grab the grabbed key and fail (i.e. grab conflict) so it shall be left to the application to set what keys shall be global (grabbed) hence the bits to start ksnapshot are moved to plasma-desktop Signed-off-by: Ivailo Monev --- CMakeLists.txt | 1 - ConfigureChecks.cmake | 2 +- khotkeys/CMakeLists.txt | 20 - khotkeys/ExtraDesktop.sh | 4 - khotkeys/Messages.sh | 4 - khotkeys/app/CMakeLists.txt | 35 - khotkeys/app/kded.cpp | 238 ------ khotkeys/app/kded.h | 103 --- khotkeys/app/khotkeys.desktop | 153 ---- khotkeys/data/CMakeLists.txt | 6 - khotkeys/data/defaults.khotkeys | 400 ---------- khotkeys/data/printscreen.khotkeys | 436 ----------- khotkeys/kcm_hotkeys/CMakeLists.txt | 90 --- khotkeys/kcm_hotkeys/action_group_widget.cpp | 81 -- khotkeys/kcm_hotkeys/action_group_widget.h | 78 -- .../actions/action_widget_base.cpp | 34 - .../kcm_hotkeys/actions/action_widget_base.h | 54 -- .../actions/command_url_action_widget.cpp | 76 -- .../actions/command_url_action_widget.h | 62 -- .../actions/command_url_action_widget.ui | 46 -- .../actions/dbus_action_widget.cpp | 136 ---- .../kcm_hotkeys/actions/dbus_action_widget.h | 68 -- .../kcm_hotkeys/actions/dbus_action_widget.ui | 117 --- .../actions/keyboard_input_action_widget.cpp | 150 ---- .../actions/keyboard_input_action_widget.h | 64 -- .../actions/keyboard_input_action_widget.ui | 69 -- .../actions/menuentry_action_widget.cpp | 123 --- .../actions/menuentry_action_widget.h | 70 -- .../actions/menuentry_action_widget.ui | 49 -- .../conditions/condition_type_menu.cpp | 44 -- .../conditions/condition_type_menu.h | 54 -- .../conditions/conditions_widget.cpp | 427 ----------- .../conditions/conditions_widget.h | 96 --- .../conditions/conditions_widget.ui | 53 -- .../kcm_hotkeys/global_settings_widget.cpp | 103 --- khotkeys/kcm_hotkeys/global_settings_widget.h | 73 -- .../kcm_hotkeys/global_settings_widget.ui | 64 -- .../window_definition_list_widget.cpp | 274 ------- .../window_definition_list_widget.h | 121 --- .../window_definition_list_widget.ui | 77 -- .../window_definition_widget.cpp | 204 ----- .../helper_widgets/window_definition_widget.h | 113 --- .../window_definition_widget.ui | 249 ------ .../helper_widgets/window_selector.cpp | 89 --- .../helper_widgets/window_selector.h | 36 - khotkeys/kcm_hotkeys/hotkeys_context_menu.cpp | 381 ---------- khotkeys/kcm_hotkeys/hotkeys_context_menu.h | 82 -- .../kcm_hotkeys/hotkeys_export_widget.cpp | 93 --- khotkeys/kcm_hotkeys/hotkeys_export_widget.h | 70 -- khotkeys/kcm_hotkeys/hotkeys_export_widget.ui | 165 ---- khotkeys/kcm_hotkeys/hotkeys_model.cpp | 712 ------------------ khotkeys/kcm_hotkeys/hotkeys_model.h | 171 ----- khotkeys/kcm_hotkeys/hotkeys_proxy_model.cpp | 82 -- khotkeys/kcm_hotkeys/hotkeys_proxy_model.h | 81 -- khotkeys/kcm_hotkeys/hotkeys_tree_view.cpp | 97 --- khotkeys/kcm_hotkeys/hotkeys_tree_view.h | 72 -- khotkeys/kcm_hotkeys/hotkeys_widget_base.cpp | 75 -- khotkeys/kcm_hotkeys/hotkeys_widget_base.h | 95 --- khotkeys/kcm_hotkeys/hotkeys_widget_base.ui | 46 -- khotkeys/kcm_hotkeys/hotkeys_widget_iface.cpp | 66 -- khotkeys/kcm_hotkeys/hotkeys_widget_iface.h | 73 -- khotkeys/kcm_hotkeys/kcm_hotkeys.cpp | 438 ----------- khotkeys/kcm_hotkeys/kcm_hotkeys.h | 97 --- khotkeys/kcm_hotkeys/kcm_hotkeys.ui | 85 --- khotkeys/kcm_hotkeys/kcm_module_factory.cpp | 35 - khotkeys/kcm_hotkeys/kcm_module_factory.h | 28 - khotkeys/kcm_hotkeys/khotkeys.desktop | 187 ----- .../kcm_hotkeys/simple_action_data_widget.cpp | 162 ---- .../kcm_hotkeys/simple_action_data_widget.h | 82 -- .../triggers/shortcut_trigger_widget.cpp | 100 --- .../triggers/shortcut_trigger_widget.h | 70 -- .../triggers/shortcut_trigger_widget.ui | 70 -- .../triggers/trigger_widget_base.cpp | 31 - .../triggers/trigger_widget_base.h | 57 -- .../triggers/window_trigger_widget.cpp | 141 ---- .../triggers/window_trigger_widget.h | 72 -- .../triggers/window_trigger_widget.ui | 60 -- khotkeys/libkhotkeysprivate/CMakeLists.txt | 82 -- .../action_data/action_data.cpp | 208 ----- .../action_data/action_data.h | 92 --- .../action_data/action_data_base.cpp | 199 ----- .../action_data/action_data_base.h | 191 ----- .../action_data/action_data_group.cpp | 194 ----- .../action_data/action_data_group.h | 145 ---- .../action_data/action_data_visitor.cpp | 61 -- .../action_data/action_data_visitor.h | 91 --- .../action_data/generic_action_data.cpp | 51 -- .../action_data/generic_action_data.h | 57 -- .../menuentry_shortcut_action_data.cpp | 65 -- .../menuentry_shortcut_action_data.h | 61 -- .../action_data/simple_action_data.cpp | 127 ---- .../action_data/simple_action_data.h | 143 ---- .../libkhotkeysprivate/actions/action.cpp | 55 -- .../actions/action_list.cpp | 69 -- .../actions/action_visitor.h | 64 -- khotkeys/libkhotkeysprivate/actions/actions.h | 381 ---------- .../actions/activate_window_action.cpp | 108 --- .../actions/command_url_action.cpp | 147 ---- .../actions/dbus_action.cpp | 189 ----- .../actions/keyboard_input_action.cpp | 205 ----- .../actions/menuentry_action.cpp | 120 --- .../conditions/active_window_condition.cpp | 119 --- .../conditions/active_window_condition.h | 64 -- .../conditions/and_condition.cpp | 78 -- .../conditions/condition.cpp | 122 --- .../libkhotkeysprivate/conditions/condition.h | 67 -- .../conditions/conditions.h | 70 -- .../conditions/conditions_list.cpp | 114 --- .../conditions/conditions_list.h | 59 -- .../conditions/conditions_list_base.cpp | 172 ----- .../conditions/conditions_list_base.h | 89 --- .../conditions/conditions_visitor.cpp | 31 - .../conditions/conditions_visitor.h | 51 -- .../conditions/existing_window_condition.cpp | 123 --- .../conditions/existing_window_condition.h | 76 -- .../conditions/not_condition.cpp | 78 -- .../conditions/or_condition.cpp | 73 -- khotkeys/libkhotkeysprivate/daemon/daemon.cpp | 158 ---- khotkeys/libkhotkeysprivate/daemon/daemon.h | 43 -- khotkeys/libkhotkeysprivate/input.h | 25 - .../libkhotkeysprivate/khotkeysglobal.cpp | 56 -- khotkeys/libkhotkeysprivate/khotkeysglobal.h | 47 -- khotkeys/libkhotkeysprivate/libkhotkeysfwd.h | 38 - khotkeys/libkhotkeysprivate/settings.cpp | 428 ----------- khotkeys/libkhotkeysprivate/settings.h | 203 ----- .../libkhotkeysprivate/settings_reader_v2.cpp | 498 ------------ .../libkhotkeysprivate/settings_reader_v2.h | 110 --- .../libkhotkeysprivate/settings_writer.cpp | 261 ------- khotkeys/libkhotkeysprivate/settings_writer.h | 90 --- .../libkhotkeysprivate/shortcuts_handler.cpp | 236 ------ .../libkhotkeysprivate/shortcuts_handler.h | 120 --- .../triggers/shortcut_trigger.cpp | 212 ------ .../libkhotkeysprivate/triggers/trigger.cpp | 63 -- .../triggers/trigger_list.cpp | 122 --- .../libkhotkeysprivate/triggers/triggers.cpp | 20 - .../libkhotkeysprivate/triggers/triggers.h | 308 -------- .../triggers/window_trigger.cpp | 270 ------- .../libkhotkeysprivate/windows_handler.cpp | 197 ----- khotkeys/libkhotkeysprivate/windows_handler.h | 71 -- .../window_selection_interface.cpp | 72 -- .../window_selection_interface.h | 62 -- .../windows_helper/window_selection_list.cpp | 111 --- .../windows_helper/window_selection_list.h | 50 -- .../windows_helper/window_selection_rules.cpp | 229 ------ .../windows_helper/window_selection_rules.h | 188 ----- khotkeys/test/CMakeLists.txt | 10 - khotkeys/test/kdedmodule_daemon_test.cpp | 75 -- khotkeys/test/kdedmodule_daemon_test.h | 23 - kmenuedit/CMakeLists.txt | 8 - kmenuedit/basictab.cpp | 55 -- kmenuedit/basictab.h | 5 +- kmenuedit/khotkeys.cpp | 115 --- kmenuedit/khotkeys.h | 39 - kmenuedit/kmenuedit.cpp | 3 - kmenuedit/main.cpp | 3 +- kmenuedit/menuinfo.cpp | 133 +--- kmenuedit/menuinfo.h | 12 +- kmenuedit/treeview.cpp | 5 - kmenuedit/treeview.h | 1 - plasma/shells/plasma-desktop/plasmaapp.cpp | 23 + plasma/shells/plasma-desktop/plasmaapp.h | 2 + 161 files changed, 31 insertions(+), 18182 deletions(-) delete mode 100644 khotkeys/CMakeLists.txt delete mode 100644 khotkeys/ExtraDesktop.sh delete mode 100644 khotkeys/Messages.sh delete mode 100644 khotkeys/app/CMakeLists.txt delete mode 100644 khotkeys/app/kded.cpp delete mode 100644 khotkeys/app/kded.h delete mode 100644 khotkeys/app/khotkeys.desktop delete mode 100644 khotkeys/data/CMakeLists.txt delete mode 100644 khotkeys/data/defaults.khotkeys delete mode 100644 khotkeys/data/printscreen.khotkeys delete mode 100644 khotkeys/kcm_hotkeys/CMakeLists.txt delete mode 100644 khotkeys/kcm_hotkeys/action_group_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/action_group_widget.h delete mode 100644 khotkeys/kcm_hotkeys/actions/action_widget_base.cpp delete mode 100644 khotkeys/kcm_hotkeys/actions/action_widget_base.h delete mode 100644 khotkeys/kcm_hotkeys/actions/command_url_action_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/actions/command_url_action_widget.h delete mode 100644 khotkeys/kcm_hotkeys/actions/command_url_action_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/actions/dbus_action_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/actions/dbus_action_widget.h delete mode 100644 khotkeys/kcm_hotkeys/actions/dbus_action_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.h delete mode 100644 khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/actions/menuentry_action_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/actions/menuentry_action_widget.h delete mode 100644 khotkeys/kcm_hotkeys/actions/menuentry_action_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/conditions/condition_type_menu.cpp delete mode 100644 khotkeys/kcm_hotkeys/conditions/condition_type_menu.h delete mode 100644 khotkeys/kcm_hotkeys/conditions/conditions_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/conditions/conditions_widget.h delete mode 100644 khotkeys/kcm_hotkeys/conditions/conditions_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/global_settings_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/global_settings_widget.h delete mode 100644 khotkeys/kcm_hotkeys/global_settings_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.h delete mode 100644 khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.h delete mode 100644 khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/helper_widgets/window_selector.cpp delete mode 100644 khotkeys/kcm_hotkeys/helper_widgets/window_selector.h delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_context_menu.cpp delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_context_menu.h delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_export_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_export_widget.h delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_export_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_model.cpp delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_model.h delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_proxy_model.cpp delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_proxy_model.h delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_tree_view.cpp delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_tree_view.h delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_widget_base.cpp delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_widget_base.h delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_widget_base.ui delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_widget_iface.cpp delete mode 100644 khotkeys/kcm_hotkeys/hotkeys_widget_iface.h delete mode 100644 khotkeys/kcm_hotkeys/kcm_hotkeys.cpp delete mode 100644 khotkeys/kcm_hotkeys/kcm_hotkeys.h delete mode 100644 khotkeys/kcm_hotkeys/kcm_hotkeys.ui delete mode 100644 khotkeys/kcm_hotkeys/kcm_module_factory.cpp delete mode 100644 khotkeys/kcm_hotkeys/kcm_module_factory.h delete mode 100644 khotkeys/kcm_hotkeys/khotkeys.desktop delete mode 100644 khotkeys/kcm_hotkeys/simple_action_data_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/simple_action_data_widget.h delete mode 100644 khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.h delete mode 100644 khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.ui delete mode 100644 khotkeys/kcm_hotkeys/triggers/trigger_widget_base.cpp delete mode 100644 khotkeys/kcm_hotkeys/triggers/trigger_widget_base.h delete mode 100644 khotkeys/kcm_hotkeys/triggers/window_trigger_widget.cpp delete mode 100644 khotkeys/kcm_hotkeys/triggers/window_trigger_widget.h delete mode 100644 khotkeys/kcm_hotkeys/triggers/window_trigger_widget.ui delete mode 100644 khotkeys/libkhotkeysprivate/CMakeLists.txt delete mode 100644 khotkeys/libkhotkeysprivate/action_data/action_data.cpp delete mode 100644 khotkeys/libkhotkeysprivate/action_data/action_data.h delete mode 100644 khotkeys/libkhotkeysprivate/action_data/action_data_base.cpp delete mode 100644 khotkeys/libkhotkeysprivate/action_data/action_data_base.h delete mode 100644 khotkeys/libkhotkeysprivate/action_data/action_data_group.cpp delete mode 100644 khotkeys/libkhotkeysprivate/action_data/action_data_group.h delete mode 100644 khotkeys/libkhotkeysprivate/action_data/action_data_visitor.cpp delete mode 100644 khotkeys/libkhotkeysprivate/action_data/action_data_visitor.h delete mode 100644 khotkeys/libkhotkeysprivate/action_data/generic_action_data.cpp delete mode 100644 khotkeys/libkhotkeysprivate/action_data/generic_action_data.h delete mode 100644 khotkeys/libkhotkeysprivate/action_data/menuentry_shortcut_action_data.cpp delete mode 100644 khotkeys/libkhotkeysprivate/action_data/menuentry_shortcut_action_data.h delete mode 100644 khotkeys/libkhotkeysprivate/action_data/simple_action_data.cpp delete mode 100644 khotkeys/libkhotkeysprivate/action_data/simple_action_data.h delete mode 100644 khotkeys/libkhotkeysprivate/actions/action.cpp delete mode 100644 khotkeys/libkhotkeysprivate/actions/action_list.cpp delete mode 100644 khotkeys/libkhotkeysprivate/actions/action_visitor.h delete mode 100644 khotkeys/libkhotkeysprivate/actions/actions.h delete mode 100644 khotkeys/libkhotkeysprivate/actions/activate_window_action.cpp delete mode 100644 khotkeys/libkhotkeysprivate/actions/command_url_action.cpp delete mode 100644 khotkeys/libkhotkeysprivate/actions/dbus_action.cpp delete mode 100644 khotkeys/libkhotkeysprivate/actions/keyboard_input_action.cpp delete mode 100644 khotkeys/libkhotkeysprivate/actions/menuentry_action.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/active_window_condition.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/active_window_condition.h delete mode 100644 khotkeys/libkhotkeysprivate/conditions/and_condition.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/condition.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/condition.h delete mode 100644 khotkeys/libkhotkeysprivate/conditions/conditions.h delete mode 100644 khotkeys/libkhotkeysprivate/conditions/conditions_list.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/conditions_list.h delete mode 100644 khotkeys/libkhotkeysprivate/conditions/conditions_list_base.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/conditions_list_base.h delete mode 100644 khotkeys/libkhotkeysprivate/conditions/conditions_visitor.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/conditions_visitor.h delete mode 100644 khotkeys/libkhotkeysprivate/conditions/existing_window_condition.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/existing_window_condition.h delete mode 100644 khotkeys/libkhotkeysprivate/conditions/not_condition.cpp delete mode 100644 khotkeys/libkhotkeysprivate/conditions/or_condition.cpp delete mode 100644 khotkeys/libkhotkeysprivate/daemon/daemon.cpp delete mode 100644 khotkeys/libkhotkeysprivate/daemon/daemon.h delete mode 100644 khotkeys/libkhotkeysprivate/input.h delete mode 100644 khotkeys/libkhotkeysprivate/khotkeysglobal.cpp delete mode 100644 khotkeys/libkhotkeysprivate/khotkeysglobal.h delete mode 100644 khotkeys/libkhotkeysprivate/libkhotkeysfwd.h delete mode 100644 khotkeys/libkhotkeysprivate/settings.cpp delete mode 100644 khotkeys/libkhotkeysprivate/settings.h delete mode 100644 khotkeys/libkhotkeysprivate/settings_reader_v2.cpp delete mode 100644 khotkeys/libkhotkeysprivate/settings_reader_v2.h delete mode 100644 khotkeys/libkhotkeysprivate/settings_writer.cpp delete mode 100644 khotkeys/libkhotkeysprivate/settings_writer.h delete mode 100644 khotkeys/libkhotkeysprivate/shortcuts_handler.cpp delete mode 100644 khotkeys/libkhotkeysprivate/shortcuts_handler.h delete mode 100644 khotkeys/libkhotkeysprivate/triggers/shortcut_trigger.cpp delete mode 100644 khotkeys/libkhotkeysprivate/triggers/trigger.cpp delete mode 100644 khotkeys/libkhotkeysprivate/triggers/trigger_list.cpp delete mode 100644 khotkeys/libkhotkeysprivate/triggers/triggers.cpp delete mode 100644 khotkeys/libkhotkeysprivate/triggers/triggers.h delete mode 100644 khotkeys/libkhotkeysprivate/triggers/window_trigger.cpp delete mode 100644 khotkeys/libkhotkeysprivate/windows_handler.cpp delete mode 100644 khotkeys/libkhotkeysprivate/windows_handler.h delete mode 100644 khotkeys/libkhotkeysprivate/windows_helper/window_selection_interface.cpp delete mode 100644 khotkeys/libkhotkeysprivate/windows_helper/window_selection_interface.h delete mode 100644 khotkeys/libkhotkeysprivate/windows_helper/window_selection_list.cpp delete mode 100644 khotkeys/libkhotkeysprivate/windows_helper/window_selection_list.h delete mode 100644 khotkeys/libkhotkeysprivate/windows_helper/window_selection_rules.cpp delete mode 100644 khotkeys/libkhotkeysprivate/windows_helper/window_selection_rules.h delete mode 100644 khotkeys/test/CMakeLists.txt delete mode 100644 khotkeys/test/kdedmodule_daemon_test.cpp delete mode 100644 khotkeys/test/kdedmodule_daemon_test.h delete mode 100644 kmenuedit/khotkeys.cpp delete mode 100644 kmenuedit/khotkeys.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a7722761..5f559440 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -292,7 +292,6 @@ if(Q_WS_X11 AND X11_Xinput_FOUND) endif(Q_WS_X11 AND X11_Xinput_FOUND) add_subdirectory(kcminit) -add_subdirectory(khotkeys) if (LightDM_FOUND) add_subdirectory(kgreeter) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index ce6e08d5..39d93b7b 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -18,7 +18,7 @@ check_function_exists(nice HAVE_NICE) check_include_files(malloc.h HAVE_MALLOC_H) kde4_bool_to_01(FONTCONFIG_FOUND HAVE_FONTCONFIG) # kcontrol/fonts kde4_bool_to_01(FREETYPE_FOUND HAVE_FREETYPE) # kcontrol/fonts -kde4_bool_to_01(X11_XTest_FOUND HAVE_XTEST) # khotkeys, kxkb +kde4_bool_to_01(X11_XTest_FOUND HAVE_XTEST) # kcontrol/keyboard kde4_bool_to_01(X11_Xcomposite_FOUND HAVE_XCOMPOSITE) # plasma, kwin kde4_bool_to_01(X11_Xcursor_FOUND HAVE_XCURSOR) # many uses kde4_bool_to_01(X11_Xdamage_FOUND HAVE_XDAMAGE) # kwin diff --git a/khotkeys/CMakeLists.txt b/khotkeys/CMakeLists.txt deleted file mode 100644 index 74238951..00000000 --- a/khotkeys/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/libkhotkeysprivate - ${CMAKE_CURRENT_BINARY_DIR}/libkhotkeysprivate - # for kworkspace_export.h - ${CMAKE_BINARY_DIR}/libs/kworkspace -) - -add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1217) - -# Convenience library -add_subdirectory( libkhotkeysprivate ) -# has to be before kcm_hotkeys -add_subdirectory( app ) -# kcm module to configure hotkeys -add_subdirectory( kcm_hotkeys ) -# kdedmodule and standalone demon for hotkeys -add_subdirectory( data ) -# add_subdirectory( test ) - diff --git a/khotkeys/ExtraDesktop.sh b/khotkeys/ExtraDesktop.sh deleted file mode 100644 index 07a5fd85..00000000 --- a/khotkeys/ExtraDesktop.sh +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -#This file outputs in a separate line each file with a .desktop syntax -#that needs to be translated but has a non .desktop extension -find -name \*.khotkeys -print diff --git a/khotkeys/Messages.sh b/khotkeys/Messages.sh deleted file mode 100644 index e6dd1c72..00000000 --- a/khotkeys/Messages.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11 -$XGETTEXT rc.cpp `find . -name \*.cpp -o -name \*.h` -o $podir/khotkeys.pot -rm -f rc.cpp diff --git a/khotkeys/app/CMakeLists.txt b/khotkeys/app/CMakeLists.txt deleted file mode 100644 index cf48115c..00000000 --- a/khotkeys/app/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -########### next target ############### - -set(kded_khotkeys_PART_SRCS - kded.cpp - ${CMAKE_CURRENT_BINARY_DIR}/org.kde.khotkeys.xml) - -qt4_generate_dbus_interface(kded.h org.kde.khotkeys.xml ) - -kde4_add_plugin(kded_khotkeys ${kded_khotkeys_PART_SRCS}) -target_link_libraries(kded_khotkeys - KDE4::kdeui - # I'm not sure if this is needed anymore. Check it - ${X11_XTest_LIB} - khotkeysprivate - kworkspace -) - -########### install files ############### - -install( - TARGETS kded_khotkeys - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) - -install( - FILES khotkeys.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kded -) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.khotkeys.xml - DESTINATION ${KDE4_DBUS_INTERFACES_INSTALL_DIR} -) - - diff --git a/khotkeys/app/kded.cpp b/khotkeys/app/kded.cpp deleted file mode 100644 index 1af188b8..00000000 --- a/khotkeys/app/kded.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#include "kded.h" - -#include "action_data/action_data_group.h" -#include "action_data/menuentry_shortcut_action_data.h" -#include "actions/actions.h" -#include "shortcuts_handler.h" - -#include -#include -#include -#include - -#include - -#define COMPONENT_NAME "khotkeys" - -K_PLUGIN_FACTORY(KHotKeysModuleFactory, - registerPlugin(); - ) -K_EXPORT_PLUGIN(KHotKeysModuleFactory(COMPONENT_NAME)) - -using namespace KHotKeys; - -// KhotKeysModule - -KHotKeysModule::KHotKeysModule(QObject* parent, const QList&) - : KDEDModule(parent) - , actions_root(NULL) - , _settings() - ,_initialized(false) - { - // initialize - kDebug() << "Installing the delayed initialization callback."; - QMetaObject::invokeMethod( this, "initialize", Qt::QueuedConnection); - } - - -void KHotKeysModule::initialize() - { - if (_initialized) - { - return; - } - - kDebug() << "Delayed initialization."; - _initialized = true; - - // Initialize the global data, grab keys - KHotKeys::init_global_data( true, this ); - - // If a shortcut was changed (global shortcuts kcm), save - connect( - keyboard_handler.data(), SIGNAL(shortcutChanged()), - this, SLOT(save())); - - // Read the configuration from file khotkeysrc - reread_configuration(); - - KGlobalAccel::cleanComponent(COMPONENT_NAME); - - if (_settings.update()) - { - save(); - } - - } - - -KHotKeysModule::~KHotKeysModule() - { - // actions_root belongs to _settings. - actions_root = NULL; - } - - -void KHotKeysModule::reread_configuration() - { - kDebug() << "Reloading the khotkeys configuration"; - - // Stop listening - actions_root = NULL; // Disables the dbus interface effectively - KHotKeys::khotkeys_set_active( false ); - - // Load the settings - _settings.reread_settings(true); - - actions_root = _settings.actions(); - KHotKeys::khotkeys_set_active( true ); - } - - - - -SimpleActionData* KHotKeysModule::menuentry_action(const QString &storageId) - { - ActionDataGroup *menuentries = _settings.get_system_group( - ActionDataGroup::SYSTEM_MENUENTRIES); - - // Now try to find the action - Q_FOREACH(ActionDataBase* element, menuentries->children()) - { - SimpleActionData *actionData = dynamic_cast(element); - - if (actionData && actionData->action()) - { - MenuEntryAction *action = dynamic_cast(actionData->action()); - if (action && action->service() && (action->service()->storageId() == storageId)) - { - return actionData; - } - } - } - - return NULL; - } - - -QString KHotKeysModule::get_menuentry_shortcut(const QString &storageId) - { - SimpleActionData* actionData = menuentry_action(storageId); - - // No action found - if (actionData == NULL) return ""; - - // The action must have a shortcut trigger. but don't assume to much - ShortcutTrigger* shortcutTrigger = dynamic_cast(actionData->trigger()); - - Q_ASSERT(shortcutTrigger); - if (shortcutTrigger == NULL) return ""; - - return shortcutTrigger->shortcut().primary().toString(); - } - - -QString KHotKeysModule::register_menuentry_shortcut( - const QString &storageId, - const QString &sequence) - { - kDebug() << storageId << "(" << sequence << ")"; - - // Check the service we got. If it is invalid there is no need to - // continue. - KService::Ptr wantedService = KService::serviceByStorageId(storageId); - if (wantedService.isNull()) - { - kError() << "Storage Id " << storageId << "not valid"; - return ""; - } - - // Look for the action - SimpleActionData* actionData = menuentry_action(storageId); - - // No action found. Create on if sequence is != "" - if (actionData == NULL) - { - kDebug() << "No action found"; - - // If the sequence is empty there is no need to create a action. - if (sequence.isEmpty()) return ""; - - kDebug() << "Creating a new action"; - - // Create the action - ActionDataGroup *menuentries = _settings.get_system_group( - ActionDataGroup::SYSTEM_MENUENTRIES); - - MenuEntryShortcutActionData *newAction = new MenuEntryShortcutActionData( - menuentries, - wantedService->name(), - storageId, - KShortcut(sequence), - storageId); - - newAction->enable(); - - _settings.write(); - - // Return the real shortcut - return newAction->trigger()->shortcut().primary().toString(); - } - // We found a action - else - { - if (sequence.isEmpty()) - { - kDebug() << "Deleting the action"; - actionData->aboutToBeErased(); - delete actionData; - _settings.write(); - return ""; - } - else - { - kDebug() << "Changing the action"; - // The action must have a shortcut trigger. but don't assume to much - ShortcutTrigger* shortcutTrigger = - dynamic_cast(actionData->trigger()); - Q_ASSERT(shortcutTrigger); - if (shortcutTrigger == NULL) return ""; - - // Change the actionData - shortcutTrigger->set_key_sequence(sequence); - _settings.write(); - - // Remove the resulting real shortcut - return shortcutTrigger->shortcut().primary().toString(); - } - } - - Q_ASSERT(false); - return ""; - } - - -void KHotKeysModule::quit() - { - deleteLater(); - } - - -void KHotKeysModule::save() - { - KHotKeys::khotkeys_set_active( false ); - _settings.write(); - KHotKeys::khotkeys_set_active( true ); - } - -#include "moc_kded.cpp" diff --git a/khotkeys/app/kded.h b/khotkeys/app/kded.h deleted file mode 100644 index 604819f3..00000000 --- a/khotkeys/app/kded.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef _KHOTKEYS_KDED_H_ -#define _KHOTKEYS_KDED_H_ - -#include -#include "settings.h" - -#include -#include -#include - -#include - -namespace KHotKeys - { - class ActionDataGroup; - class SimpleActionData; - } - -class KHotKeysModule - : public KDEDModule - { - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.khotkeys") - - public Q_SLOTS: - - Q_SCRIPTABLE void reread_configuration(); - - Q_SCRIPTABLE void quit(); - - /** - * Register an shortcut for service @serviceStorageId with the key - * sequence @seq. - * - * @param serviceStorageId the KService::storageId of the service - * @param sequence the key sequence to use - * - * @returns @c true if the key sequence was successfully set, @c if - * the sequence is not available. - */ - Q_SCRIPTABLE QString register_menuentry_shortcut(const QString &storageId, const QString &sequence); - - /** - * Get the currently active shortcut for service @p serviceStorageId. - * - * @param serviceStorageId the KService::storageId of the service - * - * @returns the active global shortcuts for that service - */ - Q_SCRIPTABLE QString get_menuentry_shortcut(const QString &storageId); - - private Q_SLOTS: - - //! Save - void save(); - - //! Initialize the module. Delayed initialization. - void initialize(); - - public: - - KHotKeysModule(QObject* parent, const QList&); - virtual ~KHotKeysModule(); - - private: - - //! The action list from _settings for convenience - KHotKeys::ActionDataGroup* actions_root; - - //! The current settings - KHotKeys::Settings _settings; - - //! Is the module initialized - bool _initialized; - - /** - * @name Some method in need for a better home - */ - //@{ - //! Get the group for the menuentries. Will create it if needed - KHotKeys::ActionDataGroup *menuentries_group(); - - //! Find a menuentry_action for the service with @storageId in group @group - KHotKeys::SimpleActionData *menuentry_action(const QString &storageId); - //@} - }; - -//*************************************************************************** -// Inline -//*************************************************************************** - - -#endif diff --git a/khotkeys/app/khotkeys.desktop b/khotkeys/app/khotkeys.desktop deleted file mode 100644 index f8fd536b..00000000 --- a/khotkeys/app/khotkeys.desktop +++ /dev/null @@ -1,153 +0,0 @@ -[Desktop Entry] -Name=Input Actions -Name[af]=Inset Aksies -Name[ar]=إجراءات الإدخال -Name[ast]=Aiciones d'entrada -Name[be]=Дзеянні уводу -Name[be@latin]=Uvodnyja aperacyi -Name[bg]=Входни действия -Name[bn_IN]=ইনপুট সংক্রান্ত কর্ম -Name[br]=Oberoù enkas -Name[bs]=Radnje unosa -Name[ca]=Accions d'entrada -Name[ca@valencia]=Accions d'entrada -Name[cs]=Vstupní činnosti -Name[csb]=Klawiszowé dzéjania -Name[da]=Input-handlinger -Name[de]=Tastenkombinationen -Name[el]=Ενέργειες εισόδου -Name[en_GB]=Input Actions -Name[eo]=Enir-agadoj -Name[es]=Acciones de Entrada -Name[et]=Sisestustoimingud -Name[eu]=Sarrerako ekintzak -Name[fa]=کنشهای ورودی -Name[fi]=Syöttötoiminnot -Name[fr]=Actions d'entrée -Name[fy]=Ynfieraksjes -Name[ga]=Gníomhartha Ionchurtha -Name[gl]=Accións de entrada -Name[gu]=ઇનપુટ ક્રિયાઓ -Name[he]=פעולות קלט -Name[hi]=इनपुट क्रियाएँ -Name[hne]=इनपुट काम -Name[hr]=Akcije prečaca -Name[hsb]=Zapodawanske akcije -Name[hu]=Beviteli műveletek -Name[ia]=Input Actions (Actiones de insertar) -Name[id]=Aksi Masukan -Name[is]=Inntaksaðgerðir -Name[it]=Azioni di immissione -Name[ja]=入力アクション -Name[ka]=შეტანის ქმედებები -Name[kk]=Енгізу әрекеттері -Name[km]=សកម្មភាព​បញ្ចូល -Name[kn]=ಆದಾನ ಕ್ರಿಯೆಗಳು -Name[ko]=입력 동작 -Name[lt]=Įvesties veiksmai -Name[lv]=Ievades darbības -Name[mai]=इनपुट क्रिया -Name[mk]=Влезни дејства -Name[ml]=ഇന്‍പുട്ട് പ്രവര്‍ത്തനങ്ങള്‍ -Name[mr]=इनपुट क्रिया -Name[ms]=Tindakan Input -Name[nb]=Input-handlinger -Name[nds]=Ingaavakschonen -Name[ne]=आगत कार्य -Name[nl]=Invoeracties -Name[nn]=Inn­handlingar -Name[pa]=ਇੰਪੁੱਟ ਐਕਸ਼ਨ -Name[pl]=Działania wejścia -Name[pt]=Acções de Entrada -Name[pt_BR]=Ações de entrada -Name[ro]=Acțiuni de intrare -Name[ru]=Действия -Name[se]=Sisačoallodoaimmat -Name[si]=ආදාන ක්‍රියා -Name[sk]=Vstupné akcie -Name[sl]=Vnosna dejanja -Name[sr]=Радње уноса -Name[sr@ijekavian]=Радње уноса -Name[sr@ijekavianlatin]=Radnje unosa -Name[sr@latin]=Radnje unosa -Name[sv]=Inmatningsåtgärder -Name[ta]=உள்ளீட்டு செயல்கள் -Name[te]=ఇన్‌పుట్ చర్యలు -Name[tg]=Тарзи вуруд -Name[th]=การกระทำเพื่อป้อนข้อมูล -Name[tr]=Girdi Eylemleri -Name[ug]=كىرگۈزۈش مەشغۇلاتى -Name[uk]=Ввід -Name[uz]=Kiritish amallari -Name[uz@cyrillic]=Киритиш амаллари -Name[vi]=Hành động nhập -Name[wa]=Accions en intrêye -Name[x-test]=xxInput Actionsxx -Name[zh_CN]=输入动作 -Name[zh_TW]=輸入動作 -Comment=Input Actions service performing configured actions on key presses -Comment[ar]=خدمة إجراءات الإدخال تنفذ الإجراءات المضبوطة عند ضغط المفاتيح -Comment[ast]=El serviciu d'Aiciones d'Entrada faciendo les aiciones configuraes según les tecles calcaes -Comment[bg]=Услугата за входни действия изпълнява зададени действия при натискане на клавиши комбинации -Comment[bs]=Servis radnji unosa, izvršava podešene radnje na pritiske tastera -Comment[ca]=Servei d'accions d'entrada que porta a terme accions configurades en prémer tecles -Comment[ca@valencia]=Servei d'accions d'entrada que porta a terme accions configurades en prémer tecles -Comment[cs]=Služba vstupních akcí jenž po stisknutí klávesy vykoná nakonfigurovanou akci -Comment[da]=Input-handlinger-tjeneste som udfører konfigurerede handlinger ved tastetryk -Comment[de]=„Tastenkombinationen“ führt benutzerdefinierte Aktionen auf Tastendruck aus. -Comment[el]=Υπηρεσία ενεργειών εισόδου εκτελεί διαμορφωμένες ενέργειες με το πάτημα πλήκτρων -Comment[en_GB]=Input Actions service performing configured actions on key presses -Comment[es]=El servicio de Acciones de Entrada realizando las acciones configuradas para la pulsación de teclas -Comment[et]=Sisestustoimingute teenus, mis võimaldab klahve vajutades ette võtta teatavaid määratud toiminguid -Comment[eu]=Sarrerako ekintzen zerbitzua, konfiguratutako ekintzak burutzen teklak sakatutakoan -Comment[fi]=Syöttötoimintopalvelut suoritetaan asetetuille toiminnoille näppäinpainalluksilla -Comment[fr]=Service des actions d'entrée exécutant les actions configurées lors d'appuis de touches du clavier -Comment[gl]=O servizo de accións de entrada responde á pulsación de teclas facendo as accións que se configuren -Comment[he]=שירות פעולות קלט מבצע פעולות מוגדרות בלחיצת מקש. -Comment[hr]=Usluga akcije prečaca izvršava podešene akcije na pritisak tipke -Comment[hu]=A Beviteli műveletek szolgáltatás beállított műveleteket hajt végre billentyűlenyomáskor -Comment[ia]=Servicio de Input Actions que il exeque actiones configurate sur pressiones de claves -Comment[id]=Layanan Aksi Masukan melakukan aksi yang diatur ketika tombol ditekan -Comment[is]=Inntaksaðgerðaþjónustan sér um að framkvæma forstilltar aðgerðir þegar ýtt er á skilgreinda lykla -Comment[it]=Il servizio azioni di immissione effettua particolari azioni quando certi tasti vengono premuti -Comment[ja]=入力アクションサービスはキー押下時の設定されたアクションを実行します -Comment[kk]=Енгізу әрекеттер қызметі перне басқанда баптап қойған әрекетті істейді -Comment[km]=បាន​កំណត់​រចនាសម្ព័ន្ធ​ការ​អនុវត្ត​សេវា​សកម្មភាព​បញ្ចូល នៅពេល​ចុច​គ្រាប់​ចុច -Comment[kn]=ಕೀಲಿ ಒತ್ತಿದಾಗ, ಆದಾನ ಕ್ರಿಯೆಗಳ(ಇನ್ಪುಟ್ ಎಕ್ಷನ್) ಸೇವೆಯು ಸಂರಚಿಸಿದ ಕ್ರಿಯೆಗಳನ್ನು ಮಾಡುತ್ತದೆ -Comment[ko]=키가 눌릴 때 실행할 동작을 설정합니다 -Comment[lt]=Įvesties veiksmų servisas, paspaudus atitinkamus klavišus vykdantis nurodytus veiksmus -Comment[lv]=Ievades darbību serviss izpilda konfigurētās darbības pie taustiņu nospiešanas -Comment[mr]=कळ दाबल्यावर होणाऱ्या संयोजीत क्रिया करणारी इनपुट क्रिया सेवा -Comment[nb]=Tjeneste for inndata-handlinger, som utfører definerte handlinger for tastetrykk -Comment[nds]=Ingaavakschonen mit fastleggt Tastendruckakschonen utföhren -Comment[nl]=Service voor invoeracties die ingestelde acties uitvoert bij toetsen indrukken -Comment[nn]=Teneste for innhandlingar som utfører dei oppsette handlingane ved tastetrykk -Comment[pa]=ਸਵਿੱਚ ਦੱਬਣ ਉੱਤੇ ਇੰਪੁੱਟ ਕਾਰਵਾਈ ਸਰਵਿਸ ਕਰਨ ਦੀ ਸੰਰਚਨਾ -Comment[pl]=Usługa wykonująca skonfigurowane działania po naciśnięciu klawiszy -Comment[pt]=Serviço de acções de entrada que efectua acções configuradas ao carregar nas teclas -Comment[pt_BR]=Serviço de ações de entrada que realiza ações configuradas ao pressionar as teclas -Comment[ro]=Serviciu de acțiuni de intrare care execută acțiunile configurate la apăsarea tastelor -Comment[ru]=Служба действий выполняет настроенные действия при нажатии клавиш -Comment[si]=ආදාන ක්‍රියා සේවාව යතුරු එබුම් මත වින්‍යාසගත කල ක්‍රියා සිදු කරමින් -Comment[sk]=Služba pre vstupné akcie, ktorá vykonáva nastavené akcie pri stlačení kláves -Comment[sl]=Storitev za vnosna dejanja, ki ob pritisku tipk izvede nastavljeno dejanje -Comment[sr]=Сервис радњи уноса, извршава подешене радње на притиске тастера -Comment[sr@ijekavian]=Сервис радњи уноса, извршава подешене радње на притиске тастера -Comment[sr@ijekavianlatin]=Servis radnji unosa, izvršava podešene radnje na pritiske tastera -Comment[sr@latin]=Servis radnji unosa, izvršava podešene radnje na pritiske tastera -Comment[sv]=Tjänst för inmatningsåtgärder som utför inställda åtgärder vid tangentnedtryckning -Comment[th]=บริการการกระทำเพื่อป้อนข้อมูลสำหรับเรียกการกระทำที่ได้ปรับแต่งไว้เมื่อมีการกดปุ่มพิมพ์ -Comment[tr]=Tuş basımları üzerinde önceden yapılandırılmış eylemleri gerçekleştiren Girdi Eylemleri hizmeti -Comment[ug]=كىرگۈزۈش مەشغۇلات مۇلازىمىتى كۇنۇپكا بېسىلغاندا ئالدىن سەپلەنگەن مەشغۇلاتنى ئىجرا قىلىدۇ -Comment[uk]=Служба «Ввід» виконує вказані дії у відповідь на натискання певних клавіш -Comment[vi]=Dịch vụ Hành động nhập thực hiện các hành động được cấu hình khi có phím nhấn -Comment[wa]=Siervice des faitindjes d' intrêye fijhant les faitindjes apontieyes cwand on tchôke les tapes -Comment[x-test]=xxInput Actions service performing configured actions on key pressesxx -Comment[zh_CN]=输入动作服务可在按下键位时执行预配置的动作 -Comment[zh_TW]=輸入動作服務,在按下按鍵時執行設定好的動作。 -Type=Service -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=khotkeys -X-KDE-DBus-ModuleName=khotkeys -X-KDE-Kded-autoload=true -OnlyShowIn=KDE; diff --git a/khotkeys/data/CMakeLists.txt b/khotkeys/data/CMakeLists.txt deleted file mode 100644 index 0ea0ce18..00000000 --- a/khotkeys/data/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -install( - FILES - defaults.khotkeys - printscreen.khotkeys - DESTINATION ${KDE4_DATA_INSTALL_DIR}/khotkeys -) diff --git a/khotkeys/data/defaults.khotkeys b/khotkeys/data/defaults.khotkeys deleted file mode 100644 index e639358c..00000000 --- a/khotkeys/data/defaults.khotkeys +++ /dev/null @@ -1,400 +0,0 @@ -[Data] -DataCount=1 - -[Data_1] -Comment=Comment -Comment[ar]=التعليق -Comment[ast]=Comentariu -Comment[bg]=Коментар -Comment[bn]=মন্তব্য -Comment[bs]=Komentar -Comment[ca]=Comentari -Comment[ca@valencia]=Comentari -Comment[cs]=Komentář -Comment[csb]=Dopòwiesc -Comment[da]=Kommentar -Comment[de]=Kommentar -Comment[el]=Σχόλιο -Comment[en_GB]=Comment -Comment[eo]=Komento -Comment[es]=Comentario -Comment[et]=Kommentaar -Comment[eu]=Iruzkina -Comment[fi]=Kommentti -Comment[fr]=Commentaire -Comment[fy]=Kommentaar -Comment[ga]=Nóta -Comment[gl]=Comentario -Comment[gu]=ટીપ્પણી -Comment[he]=הערה -Comment[hi]=टिप्पणी -Comment[hr]=Komentar -Comment[hu]=Megjegyzés -Comment[ia]=Commento -Comment[id]=Komentar -Comment[is]=Athugasemd -Comment[it]=Commento -Comment[ja]=コメント -Comment[kk]=Түсініктеме -Comment[km]=មតិយោបល់ -Comment[kn]=ಟಿಪ್ಪಣಿ -Comment[ko]=설명 -Comment[lt]=Komentaras -Comment[lv]=Komentārs -Comment[mai]=टिप्पणी -Comment[mk]=Коментар -Comment[ml]=അഭിപ്രായം -Comment[mr]=टीप -Comment[nb]=Kommentar -Comment[nds]=Kommentar -Comment[nl]=Toelichting -Comment[nn]=Merknad -Comment[pa]=ਟਿੱਪਣੀ -Comment[pl]=Komentarz -Comment[pt]=Comentário -Comment[pt_BR]=Comentário -Comment[ro]=Comentariu -Comment[ru]=Комментарий -Comment[si]=සටහන -Comment[sk]=Komentár -Comment[sl]=Opomba -Comment[sr]=Коментар -Comment[sr@ijekavian]=Коментар -Comment[sr@ijekavianlatin]=Komentar -Comment[sr@latin]=Komentar -Comment[sv]=Kommentar -Comment[tg]=Шарҳ -Comment[th]=คำอธิบาย -Comment[tr]=Açıklamalar -Comment[ug]=ئىزاھات -Comment[uk]=Коментар -Comment[vi]=Chú thích -Comment[wa]=Rawete -Comment[x-test]=xxCommentxx -Comment[zh_CN]=注释 -Comment[zh_TW]=註解 -DataCount=1 -Enabled=true -Name=KMenuEdit -Name[ar]=محرّر قوائم كدي -Name[ast]=KMenuEdit -Name[bg]=Редактор на системното меню -Name[bn]=KMenuEdit -Name[bs]=Uređivač K‑menija -Name[ca]=KMenuEdit -Name[ca@valencia]=KMenuEdit -Name[cs]=Editor nabídek -Name[csb]=Editora menu KDE -Name[da]=KMenuEdit -Name[de]=KMenuEdit -Name[el]=KMenuEdit -Name[en_GB]=KMenuEdit -Name[eo]=KMenuredaktilo -Name[es]=KMenuEdit -Name[et]=KMenuEdit -Name[eu]=KMenuEdit -Name[fi]=Valikkomuokkain -Name[fr]=KMenuEdit -Name[fy]=KMenuEdit -Name[ga]=KMenuEdit -Name[gl]=KMenuEdit -Name[gu]=KMenuEdit -Name[he]=עורך תפריט הK -Name[hi]=KMenuEdit -Name[hr]=Uređivač izbornika -Name[hu]=KMenuEdit -Name[ia]=KMenuEdit -Name[id]=KMenuEdit -Name[is]=Sýsla með aðalvalmynd -Name[it]=KMenuEdit -Name[ja]=KMenuEdit -Name[kk]=KMenuEdit -Name[km]=KMenuEdit -Name[kn]=KMenuEdit -Name[ko]=KMenuEdit -Name[lt]=KMenuEdit -Name[lv]=KMenuEdit -Name[mai]=केमेनूसंपादक -Name[mk]=KMenuEdit -Name[ml]=കെമെനുഎഡിറ്റ് -Name[mr]=के मेन्यू एडिट -Name[nb]=KMenuEdit -Name[nds]=KMenuEdit -Name[nl]=KMenuEdit -Name[nn]=KMenuEdit -Name[pa]=ਕੇ-ਮੇਨੂ ਐਡੀਟਰ -Name[pl]=Edytor menu -Name[pt]=KMenuEdit -Name[pt_BR]=KMenuEdit -Name[ro]=KMenuEdit -Name[ru]=KMenuEdit -Name[si]=KMenuEdit -Name[sk]=KMenuEdit -Name[sl]=KMenuEdit -Name[sr]=Уређивач К‑менија -Name[sr@ijekavian]=Уређивач К‑менија -Name[sr@ijekavianlatin]=Uređivač K‑menija -Name[sr@latin]=Uređivač K‑menija -Name[sv]=Menyeditor -Name[tg]=Таҳриргари меню -Name[th]=แก้ไขเมนู-K -Name[tr]=KMenuEdit -Name[ug]=KMenuEdit -Name[uk]=KMenuEdit -Name[vi]=KMenuEdit -Name[wa]=KMenuEdit -Name[x-test]=xxKMenuEditxx -Name[zh_CN]=KMenuEdit -Name[zh_TW]=選單編輯器 -SystemGroup=1 -Type=ACTION_DATA_GROUP - -[Data_1Conditions] -Comment= -ConditionsCount=0 - -[Data_1_1] -Comment=Comment -Comment[ar]=التعليق -Comment[ast]=Comentariu -Comment[bg]=Коментар -Comment[bn]=মন্তব্য -Comment[bs]=Komentar -Comment[ca]=Comentari -Comment[ca@valencia]=Comentari -Comment[cs]=Komentář -Comment[csb]=Dopòwiesc -Comment[da]=Kommentar -Comment[de]=Kommentar -Comment[el]=Σχόλιο -Comment[en_GB]=Comment -Comment[eo]=Komento -Comment[es]=Comentario -Comment[et]=Kommentaar -Comment[eu]=Iruzkina -Comment[fi]=Kommentti -Comment[fr]=Commentaire -Comment[fy]=Kommentaar -Comment[ga]=Nóta -Comment[gl]=Comentario -Comment[gu]=ટીપ્પણી -Comment[he]=הערה -Comment[hi]=टिप्पणी -Comment[hr]=Komentar -Comment[hu]=Megjegyzés -Comment[ia]=Commento -Comment[id]=Komentar -Comment[is]=Athugasemd -Comment[it]=Commento -Comment[ja]=コメント -Comment[kk]=Түсініктеме -Comment[km]=មតិយោបល់ -Comment[kn]=ಟಿಪ್ಪಣಿ -Comment[ko]=설명 -Comment[lt]=Komentaras -Comment[lv]=Komentārs -Comment[mai]=टिप्पणी -Comment[mk]=Коментар -Comment[ml]=അഭിപ്രായം -Comment[mr]=टीप -Comment[nb]=Kommentar -Comment[nds]=Kommentar -Comment[nl]=Toelichting -Comment[nn]=Merknad -Comment[pa]=ਟਿੱਪਣੀ -Comment[pl]=Komentarz -Comment[pt]=Comentário -Comment[pt_BR]=Comentário -Comment[ro]=Comentariu -Comment[ru]=Комментарий -Comment[si]=සටහන -Comment[sk]=Komentár -Comment[sl]=Opomba -Comment[sr]=Коментар -Comment[sr@ijekavian]=Коментар -Comment[sr@ijekavianlatin]=Komentar -Comment[sr@latin]=Komentar -Comment[sv]=Kommentar -Comment[tg]=Шарҳ -Comment[th]=คำอธิบาย -Comment[tr]=Açıklamalar -Comment[ug]=ئىزاھات -Comment[uk]=Коментар -Comment[vi]=Chú thích -Comment[wa]=Rawete -Comment[x-test]=xxCommentxx -Comment[zh_CN]=注释 -Comment[zh_TW]=註解 -Enabled=true -Name=Search -Name[ar]=ابحث -Name[ast]=Gueta -Name[bg]=Търсене -Name[bn]=অনুসন্ধান -Name[bs]=Pretraga -Name[ca]=Cerca -Name[ca@valencia]=Cerca -Name[cs]=Hledat -Name[csb]=Szëkba -Name[da]=Søg -Name[de]=Suchen -Name[el]=Αναζήτηση -Name[en_GB]=Search -Name[eo]=Serĉo -Name[es]=Búsqueda -Name[et]=Otsing -Name[eu]=Bilatu -Name[fi]=Haku -Name[fr]=Rechercher -Name[fy]=Sykje -Name[ga]=Cuardach -Name[gl]=Buscar -Name[gu]=શોધ -Name[he]=חפש -Name[hi]=खोज -Name[hr]=Pretraživanje -Name[hu]=Keresés -Name[ia]=Cerca -Name[id]=Cari -Name[is]=Leita -Name[it]=Ricerca -Name[ja]=検索 -Name[kk]=Іздеу -Name[km]=ការ​ស្វែងរក -Name[kn]=ಹುಡುಕು -Name[ko]=검색 -Name[lt]=Paieška -Name[lv]=Meklēšana -Name[mai]=खोजू -Name[mk]=Пребарување -Name[ml]=തെരച്ചില്‍ -Name[mr]=शोध -Name[nb]=Søk -Name[nds]=Söök -Name[nl]=Zoeken -Name[nn]=Søk -Name[pa]=ਖੋਜ -Name[pl]=Znajdź -Name[pt]=Pesquisa -Name[pt_BR]=Pesquisar -Name[ro]=Caută -Name[ru]=Поиск -Name[si]=සෙවුම -Name[sk]=Hľadať -Name[sl]=Poišči -Name[sr]=Претрага -Name[sr@ijekavian]=Претрага -Name[sr@ijekavianlatin]=Pretraga -Name[sr@latin]=Pretraga -Name[sv]=Sök -Name[tg]=Ҷустуҷӯи PHP -Name[th]=ค้นหา -Name[tr]=Ara -Name[ug]=ئىزدە -Name[uk]=Пошук -Name[wa]=Trover -Name[x-test]=xxSearchxx -Name[zh_CN]=搜索 -Name[zh_TW]=搜尋 -Type=SIMPLE_ACTION_DATA - -[Data_1_1Actions] -ActionsCount=1 - -[Data_1_1Actions0] -CommandURL=http://google.com -Type=COMMAND_URL - -[Data_1_1Conditions] -Comment= -ConditionsCount=0 - -[Data_1_1Triggers] -Comment=Simple_action -Comment[ar]=إجراء_بسيط -Comment[ast]=Aición cenciella -Comment[be@latin]=Prostaja_aperacyja -Comment[bg]=Обикновено_действие -Comment[bs]=Prosta_radnja -Comment[ca]=Acció_senzilla -Comment[ca@valencia]=Acció_senzilla -Comment[cs]=Jednoduchá činnost -Comment[csb]=Prosté_dzejanié -Comment[da]=Simple_action -Comment[de]=Einfache_Aktion -Comment[el]=Απλή_ενέργεια -Comment[en_GB]=Simple_action -Comment[eo]=Simpla ago -Comment[es]=Acción sencilla -Comment[et]=Lihtne toiming -Comment[eu]=Ekintza_sinplea -Comment[fi]=Yksinkertainen_toiminto -Comment[fr]=Action simple -Comment[fy]=Ienfâldige_aksje -Comment[ga]=Gníomh simplí -Comment[gl]=Acción_sinxela -Comment[gu]=સરળ_ક્રિયા -Comment[he]=פעולה פשוטה -Comment[hi]=सामान्य_क्रिया -Comment[hne]=सामान्य_काम -Comment[hr]=Jednostavna_akcija -Comment[hsb]=Jednora_akcija -Comment[hu]=Egyszerű_művelet -Comment[ia]=Simple_action -Comment[id]=Aksi_sederhana -Comment[is]=Einföld_aðgerð -Comment[it]=Azione_semplice -Comment[ja]=Simple_action -Comment[kk]=Қарапайым_әрекет -Comment[km]=Simple_action -Comment[kn]=ಸರಳ_ಕ್ರಿಯೆ -Comment[ko]=Simple_action -Comment[ku]=Simple_action -Comment[lt]=Paprastas_veiksmas -Comment[lv]=Vieknārša_darbība -Comment[mai]=सामान्य_क्रिया -Comment[mk]=Едноставно_дејство -Comment[ml]=ലഘു പ്രവൃത്തി -Comment[mr]=सामान्य_क्रिया -Comment[nb]=Enkel_handling -Comment[nds]=Eenfach_Akschoon -Comment[ne]=साधारण कार्य -Comment[nl]=Eenvoudige_handeling -Comment[nn]=Enkel_handling -Comment[pa]=Simple_action -Comment[pl]=Proste_działanie -Comment[pt]=Acção Simples -Comment[pt_BR]=Ação simples -Comment[ro]=Simple_action -Comment[ru]=Простое действие -Comment[se]=Oktageardánis_dáhpáhus -Comment[si]=සරල_ක්‍රියාව -Comment[sk]=Jednoduchá akcia -Comment[sl]=Preprosto_dejanje -Comment[sr]=Проста_радња -Comment[sr@ijekavian]=Проста_радња -Comment[sr@ijekavianlatin]=Prosta_radnja -Comment[sr@latin]=Prosta_radnja -Comment[sv]=Enkel åtgärd -Comment[ta]=Simple_action -Comment[te]=సాదారణ_చర్య -Comment[tg]=Амали оддӣ -Comment[th]=Simple_action -Comment[tr]=Basit_eylem -Comment[ug]=ئاددىي_ھەرىكەت -Comment[uk]=Simple_action -Comment[vi]=Hành động đơn giản -Comment[wa]=Simpe_accion -Comment[x-test]=xxSimple_actionxx -Comment[zh_CN]=简易_动作 -Comment[zh_TW]=簡易動作 -TriggersCount=1 - -[Data_1_1Triggers0] -Key=Search -Type=SHORTCUT -Uuid=d03619b6-9b3c-48cc-9d9c-a2aadb485550 - -[Main] -Version=3 -ImportId=defaults diff --git a/khotkeys/data/printscreen.khotkeys b/khotkeys/data/printscreen.khotkeys deleted file mode 100644 index 607c8051..00000000 --- a/khotkeys/data/printscreen.khotkeys +++ /dev/null @@ -1,436 +0,0 @@ -[Data] -DataCount=1 - -[Data_1] -Comment=This group contains actions that are set up by default. -Comment[ar]=المجموعة تحتوي إعدادات مبدئية -Comment[ast]=Esti grupu contién les aiciones predeterminaes. -Comment[be@latin]=Hety hurt źmiaščaje zmoŭčana ŭklučanyja aperacyi. -Comment[bg]=Тази група съдържа действия, които са зададени по подразбирани. -Comment[bs]=Ova grupa sadrži podrazumijevano postavljene radnje. -Comment[ca]=Aquest grup conté accions que estan configurades per omissió. -Comment[ca@valencia]=Este grup conté accions que estan configurades per omissió. -Comment[cs]=Tato skupina obsahuje činnosti, které jsou ve výchozím stavu nastaveny. -Comment[csb]=No karno zamëkô w se domëslné nastôwë dzéjaniów. -Comment[da]=Denne gruppe indeholder handlinger som er sat op som standard. -Comment[de]=Diese Gruppe enthält einige voreingestellte Aktionen. -Comment[el]=Η ομάδα αυτή περιέχει ενέργειες που είναι προκαθορισμένα καθορισμένες. -Comment[en_GB]=This group contains actions that are set up by default. -Comment[eo]=Ĉi tiu grupo enhavas agojn antaŭdifinitajn defaŭlte. -Comment[es]=Este grupo contiene las acciones predeterminadas. -Comment[et]=See grupp sisaldab vaikimisi määratud toiminguid. -Comment[eu]=Multzo honek lehenetsiz ezartzen diren ekintzak ditu. -Comment[fa]=این گروه شامل کنشهایی است که به طور پیش‌فرض برپا می‌شوند. -Comment[fi]=Tämä ryhmä sisältää oletuksena käytössä olevia toimintoja -Comment[fr]=Ce groupe contient les actions définies par défaut. -Comment[fy]=Dizze groep befettet aksjes dy standert ynsteld binne. -Comment[ga]=Tá gníomhartha réamhshocraithe sa ghrúpa seo. -Comment[gl]=Este grupo contén accións que están definidas por omisión. -Comment[gu]=આ સમૂહ મૂળભૂત રીત ગોઠવવામાં આવેલ ક્રિયાઓ ધરાવે છે. -Comment[he]=קבוצה זו כוללת פעולות המוגדרות כברירת מחדל -Comment[hi]=इस समूह में क्रियाएं हैं जो डिफ़ॉल्ट से सेट हैं -Comment[hne]=ए वाले समूह मं वो काम हे जउन हर डिफाल्ट से सेट हे -Comment[hr]=Ova grupa sadrži uobičajeno postavljene akcije. -Comment[hsb]=Tuta skupina wobsahuje standardowe akcije. -Comment[hu]=Ez a csoport az alapértelmezésben aktivált műveleteket tartalmazza. -Comment[ia]=Iste gruppo contine actiones que es fixate per definition. -Comment[id]=Grup ini berisi aksi yang diatur pada keadaan standar. -Comment[is]=Þessi hópur inniheldur aðgerðir sem eru sjálfgefið uppsettar. -Comment[it]=Questo gruppo contiene azioni attive in modo predefinito. -Comment[ja]=このグループには標準で設定されているアクションが含まれています。 -Comment[kk]=Бұл топты әдетте орнатылған әрекеттер құрайды. -Comment[km]=ក្រុម​នេះ​មាន​អំពើ​ដែល​រៀបចំ​ឡើង​តាម​លំនាំ​ដើម​ ។ -Comment[kn]=ಪೂರ್ವನಿಯೋಜಿತವಾಗಿ ಸಂಯೋಜಿಸಲಾದ ಕ್ರಿಯೆಗಳನ್ನು ಈ ಸಮೂಹವು ಒಳಗೊಂಡಿದೆ. -Comment[ko]=이 그룹은 기본값으로 설정되어 있는 동작을 포함합니다. -Comment[lt]=Šioje grupėje yra veiksmai, kurie yra iš anksto nustatyti. -Comment[lv]=Šī grupa satur noklusētās darbības. -Comment[mk]=Оваа група содржи дејства што се стандардно поставени. -Comment[ml]=സഹജമായി ക്രമീകരിച്ചിട്ടുള്ള പ്രവര്‍ത്തികള്‍ ഈ കൂട്ടത്തില്‍ ലഭ്യമാകുന്നു. -Comment[mr]=या समूह मध्ये मूलभूतरित्या स्थापीत क्रिया समाविष्टीत आहे. -Comment[nb]=Denne gruppa inneholder standardhandlinger. -Comment[nds]=Disse Koppel bargt vörinstellt Akschonen. -Comment[ne]=यो समूहले कार्य समाविष्ट गर्दछ जुन पूर्वनिर्धारित रूपमा सेट गरिएका छन् । -Comment[nl]=Deze groep bevat handelingen die standaard zijn ingesteld. -Comment[nn]=Denne gruppa inneheld handlingar som er sett opp som standard. -Comment[pa]=ਇਹ ਗਰੁੱਪ ਵਿੱਚ ਐਕਸ਼ਨ ਹਨ, ਜੋ ਕਿ ਡਿਫਾਲਟ ਰੂਪ ਵਿੱਚ ਸੈੱਟਅੱਪ ਕੀਤੇ ਜਾਂਦੇ ਹਨ। -Comment[pl]=Ta grupa zawiera działania, które są ustawione domyślnie. -Comment[pt]=Este grupo contém as acções que estão configuradas por omissão. -Comment[pt_BR]=Este grupo contém ações que, por padrão, estão configuradas. -Comment[ro]=Acest grup conține acțiuni stabilite implicit. -Comment[ru]=Группа действий по умолчанию. -Comment[se]=Dán joavkkus leat doaimmat mat leat heivehuvvon standárdan. -Comment[si]=මෙම කණ්ඩායම පෙරනිමියෙන් සැකසූ ක්‍රියාවන් දරයි. -Comment[sk]=Táto skupina obsahuje akcie, ktoré sú nastavené ako predvolené. -Comment[sl]=Ta skupina vsebuje privzeto nastavljena dejanja. -Comment[sr]=Ова група садржи подразумевано постављене радње. -Comment[sr@ijekavian]=Ова група садржи подразумијевано постављене радње. -Comment[sr@ijekavianlatin]=Ova grupa sadrži podrazumijevano postavljene radnje. -Comment[sr@latin]=Ova grupa sadrži podrazumevano postavljene radnje. -Comment[sv]=Gruppen innehåller åtgärder som normalt är förinställda. -Comment[ta]=This group contains actions that are set up by default. -Comment[te]=ఈ సమూహం అప్రమేయంగా అమర్చిన చర్యలను కలిగివుంటుంది. -Comment[tg]=Эта группа содержит действия, настроенные по умолчанию -Comment[th]=กลุ่มนี้จะมีการกระทำที่ได้ตั้งไว้แล้วโดยปริยาย -Comment[tr]=Bu grup öntanımlı olarak ayarlanan eylemleri içerir. -Comment[ug]=بۇ گۇرۇپپا كۆڭۈلدىكى بەلگىلەنگەن مەشغۇلاتنى ئۆز ئىچىگە ئالغان. -Comment[uk]=Ця група містить дії, які типово налаштовано. -Comment[vi]=Nhóm này chứa các hành động được thiết lập theo mặc định. -Comment[wa]=I gn a dins c' groupe ci des faitindjes k' i sont apontyî por vos. -Comment[x-test]=xxThis group contains actions that are set up by default.xx -Comment[zh_CN]=这个组包含默认设置的动作。 -Comment[zh_TW]=此群組包含了預先設定好的動作。 -DataCount=1 -Enabled=true -Name=Preset Actions -Name[af]=Voorafgestelde aksies -Name[ar]=الإجراءات مسبقة التعيين -Name[ast]=Aiciones predefiníes -Name[be]=Існуючыя дзеянні -Name[bg]=Фиксирани действия -Name[bn]=পূর্বনির্ধারিত অ্যাকশন -Name[bn_IN]=পূর্বনির্ধারিত কর্ম -Name[bs]=Predefinisane radnje -Name[ca]=Accions predefinides -Name[ca@valencia]=Accions predefinides -Name[cs]=Přednastavené činnosti -Name[csb]=Nastôwioné dzéjania -Name[da]=Forvalgte handlinger -Name[de]=Voreingestellte Aktionen -Name[el]=Προκαθορισμένες ενέργειες -Name[en_GB]=Preset Actions -Name[eo]=Antaŭdifinitaj agoj -Name[es]=Acciones predefinidas -Name[et]=Valmistoimingud -Name[eu]=Ekintza aurrezarriak -Name[fa]=پیش‌تنظیم کنشها -Name[fi]=Esiasetetut toiminnat -Name[fr]=Actions prédéfinies -Name[fy]=Foarynstelde aksjes -Name[ga]=Gníomhartha Réamhshocraithe -Name[gl]=Accións preconfiguradas -Name[gu]=ક્રિયાઓ ગોઠવો -Name[he]=פעולות מוגדרות מראש -Name[hi]=प्रीसेट क्रियाएँ -Name[hne]=प्रीसेट काम -Name[hr]=Pripremljene aktivnosti -Name[hsb]=Předdefinowane akcije -Name[hu]=Beállított műveletek -Name[ia]=Actiones de programmar (preset) -Name[id]=Aksi Penyetelan -Name[is]=Forskilgreindar aðgerðir -Name[it]=Azioni predefinite -Name[ja]=プリセットアクション -Name[kk]=Дайын әрекеттері -Name[km]=កំណត់​អំពើ​ជាមុន​ -Name[kn]=ಕ್ರಿಯೆಗಳನ್ನುಪೂರ್ವನಿಯೋಜಿಸು -Name[ko]=미리 정의된 동작 -Name[lt]=Iš anksto nustatyti veiksmai -Name[lv]=Noklusētās darbības -Name[mai]=प्रीसेट काजसभ -Name[mk]=Стандардни дејства -Name[ml]=മുമ്പു് ക്രമീകരിച്ചിട്ടുള്ള പ്രവൃത്തികള്‍ -Name[mr]=पूर्वनिश्चित क्रिया -Name[nb]=Forhåndsdefinerte handlinger -Name[nds]=Vörinstellt Akschonen -Name[ne]=कार्य प्रिसेट गर्नुहोस् -Name[nl]=Voorgedefinieerde handelingen -Name[nn]=Førehandsdefinerte handlingar -Name[pa]=ਪ੍ਰੀ-ਸੈੱਟ ਐਕਸ਼ਨ -Name[pl]=Wcześniej ustawione działania -Name[pt]=Acções Predefinidas -Name[pt_BR]=Ações predefinidas -Name[ro]=Acțiuni prestabilite -Name[ru]=Примеры действий -Name[se]=Ovdalgihtii meroštuvvon doaimmat -Name[si]=පවතින ක්‍රියාවන් -Name[sk]=Prednastavené akcie -Name[sl]=Predloge nastavitev dejanj -Name[sr]=Предефинисане радње -Name[sr@ijekavian]=Предефинисане радње -Name[sr@ijekavianlatin]=Predefinisane radnje -Name[sr@latin]=Predefinisane radnje -Name[sv]=Förinställda åtgärder -Name[ta]=முன்னமைக்கப்பட்ட செயல்கள் -Name[te]=ప్రస్తుత చర్యలు -Name[tg]=Амалҳои пештанзимшуда -Name[th]=การกระทำที่ตั้งไว้แล้ว -Name[tr]=Eylemleri Belirle -Name[ug]=ئالدىن تەڭشەلگەن مەشغۇلات -Name[uk]=Заздалегідь визначені дії -Name[vi]=Hành động định sẵn -Name[wa]=Accions prédefineyes -Name[x-test]=xxPreset Actionsxx -Name[zh_CN]=预设动作 -Name[zh_TW]=預先設定動作 -SystemGroup=0 -Type=ACTION_DATA_GROUP -AllowMerge=true - -[Data_1Conditions] -Comment= -ConditionsCount=0 - -[Data_1_1] -Comment=Launches KSnapShot when PrintScrn is pressed. -Comment[ar]=يطلق مصور الشاشة كيدي عند الضغط على زر PrintScrn -Comment[ast]=Llanza KSnapShot al calcar Impr Pant. -Comment[be@latin]=Uklučaje prahramu „KSnapShot” pa nacisku klavišy „PrintScrn”. -Comment[bg]=Стартиране на KSnapShot при натискане на клавиша "PrintScrn" -Comment[bn_IN]=PrintScrn টেপা হলে KSnapShot আরম্ভ করা হবে -Comment[bs]=Pokreće K‑snimak po pritisku na PrintScreen -Comment[ca]=Executa el KSnapShot quan es prem ImprPant. -Comment[ca@valencia]=Executa el KSnapShot quan es prem ImprPant. -Comment[cs]=Po stisku PrintScreen spustí KSnapshot. -Comment[csb]=Zrëszô KSnapShot, jeżlë je wcësniãté „Drëkùjë ekran“. -Comment[da]=Starter KSnapshot når der trykkes på PrintScreen. -Comment[de]=Startet KSnapShot, wenn „Bildschirm Drucken“ gedrückt worden ist. -Comment[el]=Εκτέλεση του KSnapShot όταν πατηθεί το PrintScrn. -Comment[en_GB]=Launches KSnapShot when PrintScrn is pressed. -Comment[eo]=Lanĉas KSnapShot (Ekranfotilon) kiam vi premas la "Presi Ekranon" klavon. -Comment[es]=Lanza KSnapShot cuando se pulsa Impr Pant. -Comment[et]=Käivitab PrintSrcni vajutamisel KSnapShoti. -Comment[eu]=KSnapShot abiarazten du InprPant sakatzean. -Comment[fa]=وقتی PrintScrn فشار داده می‌شود، KSnapShot را راه می‌اندازد. -Comment[fi]=Käynnistää KSnapShot-ohjelman kun painetaan PrintScrn-näppäintä -Comment[fr]=Lance KSnapShot lors de l'appui sur la touche « Impr. écran ». -Comment[fy]=Set útein mei KSnapShot as PrintScrn yndrukt wurdt. -Comment[ga]=Tosaigh KSnapShot nuair a bhrúitear PrintScrn. -Comment[gl]=Inicia KSnapShot cando se preme ImpPant. -Comment[gu]=જ્યારે PrintScrn દબાવાય છે ત્યારે KSnapShot શરૂ કરે છે -Comment[he]=הפעלת KSnapShot בעת הקשה על PrintScrn. -Comment[hi]=जब प्रिंटस्क्रीन बटन दबाया जाता है तो के-स्नैप-शॉट को चालू करता है. -Comment[hne]=जब प्रिंटस्क्रीन दबाय जाथे तब केस्नेपसाट ल चलाथे. -Comment[hr]=Pokreće KSnapShot kad je pritisnuta tipka PrintScrn. -Comment[hsb]=Startuje KSnapShot, hdyž so 'Druck/S-Abf' stłóči. -Comment[hu]=Elindítja a KSnapShotot a PrintScreen lenyomásakor. -Comment[ia]=Il lancea KSnapShot quando PrintScrn es pressate. -Comment[id]=Jalankan KSnapShot ketika PrintScrn ditekan. -Comment[is]=Ræsir KSnapShot þegar ýtt er á PrintScrn lykilinn. -Comment[it]=Avvia KSnapShot quando viene premuto il tasto Stamp. -Comment[ja]=PrintScrn を押して KSnapShot を起動します。 -Comment[kk]=PrintScrn басылғанда KSnapShot-ты жегеді. -Comment[km]=ចាប់ផ្ដើម​​កម្មវិធី KSnapShot នៅ​ពេល​​​ចុច​ប៊ូតុង PrintScrn ។ -Comment[kn]=PrintScrn ಒತ್ತಿದಾಗ KSnapShot ಅನ್ನು ಪ್ರಕ್ಷೇಪಿಸುತ್ತದೆ. -Comment[ko]=PrintScrn 키가 눌렸을 때 KSnapShot을 실행합니다. -Comment[lt]=Paleidžia KSnapShot nuspaudus Sp(PrintScrn) klavišą. -Comment[lv]=Palaiž KSnapShot ja nospiests PrintScrn. -Comment[ml]=PrintScrn അമര്‍ത്തിയാല്‍ കെസ്നാപ്ഷോട്ട് തുടങ്ങുന്നു. -Comment[mr]=PrintScrn दाबल्यावर केस्नँपशॉट चे प्रक्षेपण केले जाते. -Comment[nb]=Starter KSnapShot når PrintScrn trykkes. -Comment[nds]=Röppt "KSnapShot" op, wenn Een de "PrintScreen"-Tast drückt. -Comment[ne]=मुद्रण पर्दा थिच्दा केडीई स्न्यापसट सुरू हुन्छ । -Comment[nl]=KSnapShot starten wanneer PrintScreen wordt ingedrukt. -Comment[nn]=Startar KSnapShot ved trykk på «Print Screen»-tasten. -Comment[pa]=ਜਦੋਂ PrintScrn ਦੱਬਿਆ ਜਾਵੇ ਤਾਂ ਕੇ-ਸਨੈਪਸ਼ਾਟ ਚਲਾਓ -Comment[pl]=Uruchamia program Zrzut ekranu po naciśnięciu Print Scrn. -Comment[pt]=Lança o KSnapShot quando carregar no PrintScrn. -Comment[pt_BR]=Abre o KSnapShot quando a tecla PrintScreen é pressionada. -Comment[ro]=Lansează KSnapShot la apăsarea PrintScrn. -Comment[ru]=Запуск KSnapShot при нажатии кнопки PrintScreen. -Comment[se]=Álggaha KSnapShot go «Print Screen»-boallu deaddiluvvo. -Comment[si]=PrintScrn එබූ විට KSnapShot ක්‍රියාත්මක කරයි. -Comment[sk]=Spustí KSnapShot pri stlačení PrintScrn. -Comment[sl]=Po pritisku tipke Print Screen zažene KSnapShot. -Comment[sr]=Покреће К‑снимак по притиску на PrintScreen -Comment[sr@ijekavian]=Покреће К‑снимак по притиску на PrintScreen -Comment[sr@ijekavianlatin]=Pokreće K‑snimak po pritisku na PrintScreen -Comment[sr@latin]=Pokreće K‑snimak po pritisku na PrintScreen -Comment[sv]=Startar Ksnapshot när Prt Sc trycks ner. -Comment[ta]=Launches KSnapShot when PrintScrn is pressed. -Comment[te]=PrintScrn వత్తినప్పుడు KSnapShot దింపబడుతుంది. -Comment[tg]=Запускает KSnapShot при нажатии кнопки PrintScrn. -Comment[th]=เรียกโปรแกรมจับภาพหน้าจอ K เมื่อมีการกดปุ่มพิมพ์ PrintScrn -Comment[tr]=PrintScrn tuşuna basıldığında KSnapShot uygulamasını başlatır. -Comment[ug]=PrintScrn بېسىلغاندا KSnapShot نى ئىجرا قىلىدۇ. -Comment[uk]=Запускає KSnapShot при натисканні PrintScrn. -Comment[vi]=Chạy KSnapShot khi nút PrintScrn được bấm. -Comment[wa]=Enonde KWaitroûlêye cwant PrintScrn est tchôkî. -Comment[x-test]=xxLaunches KSnapShot when PrintScrn is pressed.xx -Comment[zh_CN]=按下 PrintScrn 时调用 KSnapshot。 -Comment[zh_TW]=按下 PrintScreen 鍵時叫出 KSnapShot。 -Enabled=true -Name=PrintScreen -Name[af]=Vang skermbeeld -Name[ar]=اطبع الشاشة -Name[as]=PrintScreen -Name[ast]=Imprentar pantalla -Name[be]=PrintScreen -Name[be@latin]=PrintScreen -Name[bg]=Печат на екрана -Name[bn]=PrintScreen -Name[bn_IN]=PrintScreen -Name[bs]=Snimak ekrana -Name[ca]=Impressió de pantalla -Name[ca@valencia]=Impressió de pantalla -Name[cs]=PrintScreen -Name[csb]=Drëkùjë ekran -Name[da]=PrintScreen -Name[de]=Bildschirm Drucken -Name[el]=PrintScreen -Name[en_GB]=PrintScreen -Name[eo]=EkranPreso -Name[es]=Imprimir pantalla -Name[et]=PrintScreen -Name[eu]=InprPant -Name[fa]=چاپ صفحه -Name[fi]=PrintScreen -Name[fr]=Copie d'écran -Name[fy]=print foarbyld -Name[ga]=PrintScreen -Name[gl]=Imprimir pantalla -Name[gu]=PrintScreen -Name[he]=הדפס מסך -Name[hi]=प्रिंट-स्क्रीन -Name[hne]=प्रिंट-स्क्रीन -Name[hr]=PrintScreen -Name[hsb]=Druck/S-Abf -Name[hu]=PrintScreen -Name[ia]=PrintScreen (Il imprime le schermo) -Name[id]=Cetak Layar -Name[is]=PrentaSkjá -Name[it]=Stamp -Name[ja]=PrintScreen -Name[kk]=PrintScreen -Name[km]=ថត​អេក្រង់​ -Name[kn]=ತೆರೆಯನ್ನು ಮುದ್ರಿಸು (PrintScreen) -Name[ko]=PrintScreen -Name[ku]=DîmenderaÇapkirinê -Name[lt]=Sp(PrintScreen) -Name[lv]=PrintScreen -Name[mai]=प्रिंट-स्क्रीन -Name[mk]=Печатење на екранот -Name[ml]=PrintScreen -Name[mr]=प्रिंटस्क्रीन -Name[nb]=Skriv ut skjermbildet -Name[nds]=Schirmfoto -Name[ne]=मुद्रण पर्दा -Name[nl]=PrintScreen -Name[nn]=Print Screen -Name[pa]=ਪਰਿੰਟ-ਸਕਰੀਨ -Name[pl]=Zrzut ekranu -Name[pt]=Imprimir o Ecrã -Name[pt_BR]=PrintScreen -Name[ro]=PrintScreen -Name[ru]=Снимок экрана -Name[se]=Print Screen -Name[si]=තිරය මුද්‍රණය -Name[sk]=PrintScreen -Name[sl]=PrintScreen -Name[sr]=Снимак екрана -Name[sr@ijekavian]=Снимак екрана -Name[sr@ijekavianlatin]=Snimak ekrana -Name[sr@latin]=Snimak ekrana -Name[sv]=Skriv ut skärmen -Name[ta]=திரைகாட்சி -Name[te]=తెరముద్ర -Name[tg]=PrintScreen -Name[th]=พิมพ์ภาพหน้าจอ -Name[tr]=PrintScreen -Name[ug]=PrintScreen -Name[uk]=PrintScreen -Name[vi]=In màn hình -Name[wa]=Imprimer l' waitroûle -Name[x-test]=xxPrintScreenxx -Name[zh_CN]=PrintScreen -Name[zh_TW]=PrintScreen -Type=COMMAND_URL_SHORTCUT_ACTION_DATA - -[Data_1_1Actions] -ActionsCount=1 - -[Data_1_1Actions0] -CommandURL=ksnapshot -Type=COMMAND_URL - -[Data_1_1Conditions] -Comment= -ConditionsCount=0 - -[Data_1_1Triggers] -Comment=Simple_action -Comment[ar]=إجراء_بسيط -Comment[ast]=Aición cenciella -Comment[be@latin]=Prostaja_aperacyja -Comment[bg]=Обикновено_действие -Comment[bs]=Prosta_radnja -Comment[ca]=Acció_senzilla -Comment[ca@valencia]=Acció_senzilla -Comment[cs]=Jednoduchá činnost -Comment[csb]=Prosté_dzejanié -Comment[da]=Simple_action -Comment[de]=Einfache_Aktion -Comment[el]=Απλή_ενέργεια -Comment[en_GB]=Simple_action -Comment[eo]=Simpla ago -Comment[es]=Acción sencilla -Comment[et]=Lihtne toiming -Comment[eu]=Ekintza_sinplea -Comment[fi]=Yksinkertainen_toiminto -Comment[fr]=Action simple -Comment[fy]=Ienfâldige_aksje -Comment[ga]=Gníomh simplí -Comment[gl]=Acción_sinxela -Comment[gu]=સરળ_ક્રિયા -Comment[he]=פעולה פשוטה -Comment[hi]=सामान्य_क्रिया -Comment[hne]=सामान्य_काम -Comment[hr]=Jednostavna_akcija -Comment[hsb]=Jednora_akcija -Comment[hu]=Egyszerű_művelet -Comment[ia]=Simple_action -Comment[id]=Aksi_sederhana -Comment[is]=Einföld_aðgerð -Comment[it]=Azione_semplice -Comment[ja]=Simple_action -Comment[kk]=Қарапайым_әрекет -Comment[km]=Simple_action -Comment[kn]=ಸರಳ_ಕ್ರಿಯೆ -Comment[ko]=Simple_action -Comment[ku]=Simple_action -Comment[lt]=Paprastas_veiksmas -Comment[lv]=Vieknārša_darbība -Comment[mai]=सामान्य_क्रिया -Comment[mk]=Едноставно_дејство -Comment[ml]=ലഘു പ്രവൃത്തി -Comment[mr]=सामान्य_क्रिया -Comment[nb]=Enkel_handling -Comment[nds]=Eenfach_Akschoon -Comment[ne]=साधारण कार्य -Comment[nl]=Eenvoudige_handeling -Comment[nn]=Enkel_handling -Comment[pa]=Simple_action -Comment[pl]=Proste_działanie -Comment[pt]=Acção Simples -Comment[pt_BR]=Ação simples -Comment[ro]=Simple_action -Comment[ru]=Простое действие -Comment[se]=Oktageardánis_dáhpáhus -Comment[si]=සරල_ක්‍රියාව -Comment[sk]=Jednoduchá akcia -Comment[sl]=Preprosto_dejanje -Comment[sr]=Проста_радња -Comment[sr@ijekavian]=Проста_радња -Comment[sr@ijekavianlatin]=Prosta_radnja -Comment[sr@latin]=Prosta_radnja -Comment[sv]=Enkel åtgärd -Comment[ta]=Simple_action -Comment[te]=సాదారణ_చర్య -Comment[tg]=Амали оддӣ -Comment[th]=Simple_action -Comment[tr]=Basit_eylem -Comment[ug]=ئاددىي_ھەرىكەت -Comment[uk]=Simple_action -Comment[vi]=Hành động đơn giản -Comment[wa]=Simpe_accion -Comment[x-test]=xxSimple_actionxx -Comment[zh_CN]=简易_动作 -Comment[zh_TW]=簡易動作 -TriggersCount=1 - -[Data_1_1Triggers0] -Key=Print -Type=SHORTCUT - -[Main] -Version=3 -ImportId=printscreen diff --git a/khotkeys/kcm_hotkeys/CMakeLists.txt b/khotkeys/kcm_hotkeys/CMakeLists.txt deleted file mode 100644 index 469e9c00..00000000 --- a/khotkeys/kcm_hotkeys/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -set( - kcm_hotkeys_PART_SRCS - kcm_hotkeys.cpp - kcm_module_factory.cpp - global_settings_widget.cpp - hotkeys_export_widget.cpp - hotkeys_model.cpp - hotkeys_proxy_model.cpp - hotkeys_tree_view.cpp - hotkeys_context_menu.cpp - - # HELPER WIDGETS - helper_widgets/window_selector.cpp - helper_widgets/window_definition_widget.cpp - helper_widgets/window_definition_list_widget.cpp - - # TRIGGER WIDGETS - triggers/trigger_widget_base.cpp - triggers/shortcut_trigger_widget.cpp - triggers/window_trigger_widget.cpp - - # ACTION WIDGETS - actions/action_widget_base.cpp - actions/command_url_action_widget.cpp - actions/dbus_action_widget.cpp - actions/menuentry_action_widget.cpp - actions/keyboard_input_action_widget.cpp - - # CONDITION WiDGETS - conditions/conditions_widget.cpp - conditions/condition_type_menu.cpp - - # ACTION_DATA WIDGETS - hotkeys_widget_iface.cpp - hotkeys_widget_base.cpp - action_group_widget.cpp - simple_action_data_widget.cpp - - # USER INTERFACES - global_settings_widget.ui - hotkeys_export_widget.ui - kcm_hotkeys.ui - - # HELPER WIDGETS - helper_widgets/window_definition_list_widget.ui - helper_widgets/window_definition_widget.ui - - # TRIGGER WIDGETS - triggers/window_trigger_widget.ui - triggers/shortcut_trigger_widget.ui - - # ACTION WIDGETS - actions/command_url_action_widget.ui - actions/dbus_action_widget.ui - actions/menuentry_action_widget.ui - actions/keyboard_input_action_widget.ui - - # CONDITION WiDGETS - conditions/conditions_widget.ui - - # ACTION_DATA WIDGETS - hotkeys_widget_base.ui -) - -qt4_add_dbus_interface( - kcm_hotkeys_PART_SRCS - ${CMAKE_CURRENT_BINARY_DIR}/../app/org.kde.khotkeys.xml - khotkeys_interface -) - -kde4_add_plugin(kcm_hotkeys ${kcm_hotkeys_PART_SRCS}) - -add_dependencies(kcm_hotkeys kded_khotkeys) - -target_link_libraries(kcm_hotkeys - KDE4::kio - ${QT_QTGUI_LIBRARY} - ${X11_X11_LIB} - khotkeysprivate -) - -install( - TARGETS kcm_hotkeys - DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} -) - -install( - FILES khotkeys.desktop - DESTINATION ${KDE4_SERVICES_INSTALL_DIR} -) diff --git a/khotkeys/kcm_hotkeys/action_group_widget.cpp b/khotkeys/kcm_hotkeys/action_group_widget.cpp deleted file mode 100644 index cf68c3bb..00000000 --- a/khotkeys/kcm_hotkeys/action_group_widget.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "action_group_widget.h" - -#include "conditions/conditions_widget.h" - -#include "action_data/action_data_group.h" - -ActionGroupWidget::ActionGroupWidget( QWidget *parent ) - : HotkeysWidgetBase(parent) - ,_conditions(new ConditionsWidget) - { - extend(_conditions, i18n("Conditions")); - connect(_conditions, SIGNAL(changed(bool)), - SLOT(slotChanged())); - } - - -ActionGroupWidget::~ActionGroupWidget() - { - _conditions = NULL; - } - - -void ActionGroupWidget::setActionData(KHotKeys::ActionDataGroup *group) - { - _data = group; - - // BUG: conditions copies twice from the original. Once in - // setConditionsList and once because of the copyFromObject call below. - Q_ASSERT(_conditions); - _conditions->setConditionsList(group->conditions()); - - Base::copyFromObject(); - } - - -void ActionGroupWidget::doCopyFromObject() - { - Q_ASSERT(data()); - Base::doCopyFromObject(); - - Q_ASSERT(_conditions); - _conditions->copyFromObject(); - } - - -void ActionGroupWidget::doCopyToObject() - { - Q_ASSERT(data()); - Base::doCopyToObject(); - - Q_ASSERT(_conditions); - _conditions->copyToObject(); - } - - -bool ActionGroupWidget::isChanged() const - { - return _conditions->hasChanges() || Base::isChanged(); - } - - -#include "moc_action_group_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/action_group_widget.h b/khotkeys/kcm_hotkeys/action_group_widget.h deleted file mode 100644 index 7b07b540..00000000 --- a/khotkeys/kcm_hotkeys/action_group_widget.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef ACTIONGROUPWIDGET_H -#define ACTIONGROUPWIDGET_H - -#include "hotkeys_widget_base.h" - - -class ConditionsWidget; - - -/** - * @author Michael Jansen - */ -class ActionGroupWidget : public HotkeysWidgetBase - { - Q_OBJECT - - typedef HotkeysWidgetBase Base; - -public: - - /** - * Default constructor - */ - ActionGroupWidget( QWidget *parent = 0 ); - - /** - * Destructor - */ - virtual ~ActionGroupWidget(); - - /** - * The associated action. - */ - KHotKeys::ActionDataBase *data() - { - return static_cast( _data ); - } - - const KHotKeys::ActionDataBase *data() const - { - return static_cast( _data ); - } - - //! Are there uncommited changes? - bool isChanged() const; - - void setActionData( KHotKeys::ActionDataGroup *group ); - -private: - - void doCopyFromObject(); - void doCopyToObject(); - - //! Widget to change the conditions - ConditionsWidget *_conditions; - -}; - -#endif /* #ifndef ACTIONGROUPWIDGET_HPP */ - diff --git a/khotkeys/kcm_hotkeys/actions/action_widget_base.cpp b/khotkeys/kcm_hotkeys/actions/action_widget_base.cpp deleted file mode 100644 index 5310d74b..00000000 --- a/khotkeys/kcm_hotkeys/actions/action_widget_base.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "action_widget_base.h" - - -ActionWidgetBase::ActionWidgetBase( KHotKeys::Action *action, QWidget *parent ) - : HotkeysWidgetIFace(parent) - ,_action(action) - {} - - -ActionWidgetBase::~ActionWidgetBase() - {} - - -#include "moc_action_widget_base.cpp" - diff --git a/khotkeys/kcm_hotkeys/actions/action_widget_base.h b/khotkeys/kcm_hotkeys/actions/action_widget_base.h deleted file mode 100644 index 65b47095..00000000 --- a/khotkeys/kcm_hotkeys/actions/action_widget_base.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef ACTION_WIDGET_BASE_H -#define ACTION_WIDGET_BASE_H - -#include "hotkeys_widget_iface.h" - -#include "libkhotkeysfwd.h" -#include "actions/actions.h" - - -/** - * @author Michael Jansen - */ -class ActionWidgetBase : public HotkeysWidgetIFace - { - Q_OBJECT - -public: - - /** - * Destructor - */ - virtual ~ActionWidgetBase(); - - virtual KHotKeys::Action * action() { return _action; } - virtual const KHotKeys::Action * action() const { return _action; } - -protected: - - ActionWidgetBase( KHotKeys::Action *action, QWidget *parent = 0 ); - - KHotKeys::Action *_action; - - }; - -#endif /* #ifndef ACTION_WIDGET_BASE_H */ - diff --git a/khotkeys/kcm_hotkeys/actions/command_url_action_widget.cpp b/khotkeys/kcm_hotkeys/actions/command_url_action_widget.cpp deleted file mode 100644 index 73484d57..00000000 --- a/khotkeys/kcm_hotkeys/actions/command_url_action_widget.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "command_url_action_widget.h" - -#include - - -CommandUrlActionWidget::CommandUrlActionWidget( - KHotKeys::CommandUrlAction *action, - QWidget *parent ) - : Base( action, parent ) - { - ui.setupUi(this); - - connect( - ui.command, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.command, "command" ); - } - - -CommandUrlActionWidget::~CommandUrlActionWidget() - { - } - - -KHotKeys::CommandUrlAction *CommandUrlActionWidget::action() - { - return static_cast(_action); - } - - -const KHotKeys::CommandUrlAction *CommandUrlActionWidget::action() const - { - return static_cast(_action); - } - - -void CommandUrlActionWidget::doCopyFromObject() - { - Q_ASSERT(action()); - ui.command->lineEdit()->setText( action()->command_url() ); - } - - -void CommandUrlActionWidget::doCopyToObject() - { - Q_ASSERT(action()); - action()->set_command_url( ui.command->lineEdit()->text() ); - } - - -bool CommandUrlActionWidget::isChanged() const - { - Q_ASSERT(action()); - return action()->command_url() != ui.command->lineEdit()->text(); - } - - -#include "moc_command_url_action_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/actions/command_url_action_widget.h b/khotkeys/kcm_hotkeys/actions/command_url_action_widget.h deleted file mode 100644 index 736bf7b0..00000000 --- a/khotkeys/kcm_hotkeys/actions/command_url_action_widget.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef COMMAND_URL_ACTION_WIDGET_H -#define COMMAND_URL_ACTION_WIDGET_H -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "action_widget_base.h" -#include "ui_command_url_action_widget.h" - - -/** - * @author Michael Jansen - */ -class CommandUrlActionWidget : public ActionWidgetBase - { - Q_OBJECT - - typedef ActionWidgetBase Base; - -public: - - /** - * Default constructor - */ - CommandUrlActionWidget( KHotKeys::CommandUrlAction *action, QWidget *parent = 0 ); - - /** - * Destructor - */ - virtual ~CommandUrlActionWidget(); - - KHotKeys::CommandUrlAction *action(); - const KHotKeys::CommandUrlAction *action() const; - - virtual bool isChanged() const; - -protected: - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - - Ui::CommandUrlActionWidget ui; - -}; - - -#endif /* #ifndef COMMAND_URL_ACTION_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/actions/command_url_action_widget.ui b/khotkeys/kcm_hotkeys/actions/command_url_action_widget.ui deleted file mode 100644 index 253040ad..00000000 --- a/khotkeys/kcm_hotkeys/actions/command_url_action_widget.ui +++ /dev/null @@ -1,46 +0,0 @@ - - CommandUrlActionWidget - - - - 0 - 0 - 400 - 300 - - - - - - - Command/URL: - - - - - - - - - - Qt::Vertical - - - - 20 - 6 - - - - - - - - - KUrlRequester - QFrame -
kurlrequester.h
-
-
- -
diff --git a/khotkeys/kcm_hotkeys/actions/dbus_action_widget.cpp b/khotkeys/kcm_hotkeys/actions/dbus_action_widget.cpp deleted file mode 100644 index 6e218e86..00000000 --- a/khotkeys/kcm_hotkeys/actions/dbus_action_widget.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "dbus_action_widget.h" - -#include -#include -#include - -DbusActionWidget::DbusActionWidget( - KHotKeys::DBusAction *action, - QWidget *parent ) - : Base(action, parent) - { - ui.setupUi(this); - - connect( - ui.application, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.application, "application" ); - connect( - ui.object, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.object, "object" ); - connect( - ui.function, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.function, "function" ); - connect( - ui.arguments, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.arguments, "arguments" ); - - connect( - ui.launchButton, SIGNAL(clicked()), - this, SLOT(launchDbusBrowser()) ); - connect( - ui.execButton, SIGNAL(clicked()), - this, SLOT(execCommand()) ); - } - - -DbusActionWidget::~DbusActionWidget() - { - } - - -KHotKeys::DBusAction *DbusActionWidget::action() - { - return static_cast(_action); - } - - -const KHotKeys::DBusAction *DbusActionWidget::action() const - { - return static_cast(_action); - } - - -void DbusActionWidget::doCopyFromObject() - { - Q_ASSERT(action()); - ui.application->setText( action()->remote_application() ); - ui.object->setText( action()->remote_object() ); - ui.function->setText( action()->called_function() ); - ui.arguments->setText( action()->arguments() ); - } - - -void DbusActionWidget::doCopyToObject() - { - Q_ASSERT(action()); - action()->set_remote_application( ui.application->text() ); - action()->set_remote_object( ui.object->text() ); - action()->set_called_function( ui.function->text() ); - action()->set_arguments( ui.arguments->text() ); - } - - -void DbusActionWidget::execCommand() const - { - KHotKeys::DBusAction action( - 0, - ui.application->text(), - ui.object->text(), - ui.function->text(), - ui.arguments->text() ); - - // TODO: Error handling - action.execute(); - } - - -bool DbusActionWidget::isChanged() const - { - Q_ASSERT(action()); - return ui.application->text() != action()->remote_application() - || ui.object->text() != action()->remote_object() - || ui.function->text() != action()->called_function() - || ui.arguments->text() != action()->arguments(); - } - - -void DbusActionWidget::launchDbusBrowser() const - { - QString qdbusviewerExe = KStandardDirs::findExe("qdbusviewer-katie"); - if (qdbusviewerExe.isEmpty()) { - qdbusviewerExe = KStandardDirs::findExe("qdbusviewer-qt4"); - } - if (qdbusviewerExe.isEmpty()) { - // no exe lookup, let it fail if not found - qdbusviewerExe = "qdbusviewer"; - } - if( KRun::runCommand( qdbusviewerExe, window()) == 0 ) - { - KMessageBox::sorry( window(), i18n( "Failed to run qdbusviewer" )); - } - } - - -#include "moc_dbus_action_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/actions/dbus_action_widget.h b/khotkeys/kcm_hotkeys/actions/dbus_action_widget.h deleted file mode 100644 index 51912d98..00000000 --- a/khotkeys/kcm_hotkeys/actions/dbus_action_widget.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef DBUS_ACTION_WIDGET_H -#define DBUS_ACTION_WIDGET_H -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "action_widget_base.h" -#include "ui_dbus_action_widget.h" - -#include "actions/actions.h" - - -/** - * @author Michael Jansen - */ -class DbusActionWidget : public ActionWidgetBase - { - Q_OBJECT - - typedef ActionWidgetBase Base; - -public: - - /** - * Default constructor - */ - DbusActionWidget( KHotKeys::DBusAction *action, QWidget *parent = 0 ); - - /** - * Destructor - */ - virtual ~DbusActionWidget(); - - KHotKeys::DBusAction *action(); - const KHotKeys::DBusAction *action() const; - - virtual bool isChanged() const; - -public Q_SLOTS: - - void launchDbusBrowser() const; - void execCommand() const; - -protected: - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - - Ui::DbusActionWidget ui; - -}; - -#endif /* #ifndef DBUS_ACTION_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/actions/dbus_action_widget.ui b/khotkeys/kcm_hotkeys/actions/dbus_action_widget.ui deleted file mode 100644 index d4c0215a..00000000 --- a/khotkeys/kcm_hotkeys/actions/dbus_action_widget.ui +++ /dev/null @@ -1,117 +0,0 @@ - - DbusActionWidget - - - - 0 - 0 - 539 - 248 - - - - - - - - - Remote application: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - application - - - - - - - Remote object: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - object - - - - - - - Function: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - function - - - - - - - Arguments: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - arguments - - - - - - - - - - - - - - - - - - - - - Call - - - - - - - Launch D-Bus Browser - - - - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
-
- - application - object - function - arguments - execButton - launchButton - - -
diff --git a/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.cpp b/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.cpp deleted file mode 100644 index 5ca36fc1..00000000 --- a/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright (C) 2009 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "keyboard_input_action_widget.h" - -#include - -KeyboardInputActionWidget::KeyboardInputActionWidget( - KHotKeys::KeyboardInputAction *action, - QWidget *parent) - : Base( action, parent ) - { - ui.setupUi(this); - - connect( - ui.input, SIGNAL(textChanged()), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.input, "input" ); - - connect( - ui.windowdef_list, SIGNAL(changed(bool)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.windowdef_list, "windowdef_list" ); - - connect( - ui.active_radio, SIGNAL(clicked(bool)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.active_radio, "active_radio" ); - - connect( - ui.action_radio, SIGNAL(clicked(bool)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.action_radio, "action_radio" ); - - connect( - ui.specific_radio, SIGNAL(clicked(bool)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.specific_radio, "specific_radio" ); - } - - - -KeyboardInputActionWidget::~KeyboardInputActionWidget() - { - } - - -KHotKeys::KeyboardInputAction *KeyboardInputActionWidget::action() - { - Q_ASSERT(dynamic_cast(_action)); - return static_cast(_action); - } - - -const KHotKeys::KeyboardInputAction *KeyboardInputActionWidget::action() const - { - Q_ASSERT(dynamic_cast(_action)); - return static_cast(_action); - } - - -void KeyboardInputActionWidget::doCopyFromObject() - { - Q_ASSERT(action()); - ui.input->setText(action()->input()); - ui.windowdef_list->setWindowDefinitions(action()->dest_window()); - ui.windowdef_list->copyFromObject(); - - switch (action()->destination()) - { - case KHotKeys::KeyboardInputAction::SpecificWindow: - ui.specific_radio->setChecked(true); - break; - - case KHotKeys::KeyboardInputAction::ActiveWindow: - ui.active_radio->setChecked(true); - break; - - case KHotKeys::KeyboardInputAction::ActionWindow: - ui.action_radio->setChecked(true); - break; - - default: - Q_ASSERT(false); - ui.action_radio->setChecked(true); - } - - } - - -void KeyboardInputActionWidget::doCopyToObject() - { - Q_ASSERT(action()); - action()->setInput(ui.input->toPlainText()); - if (ui.action_radio->isChecked()) - { - action()->setDestination(KHotKeys::KeyboardInputAction::ActionWindow); - action()->dest_window()->clear(); - } - else if (ui.active_radio->isChecked()) - { - action()->setDestination(KHotKeys::KeyboardInputAction::ActiveWindow); - action()->dest_window()->clear(); - } - else - { - action()->setDestination(KHotKeys::KeyboardInputAction::SpecificWindow); - ui.windowdef_list->copyToObject(); - } - } - - -bool KeyboardInputActionWidget::isChanged() const - { - Q_ASSERT(action()); - - if (ui.input->toPlainText() != action()->input()) return true; - - switch (action()->destination()) - { - case KHotKeys::KeyboardInputAction::ActionWindow: - return !ui.action_radio->isChecked(); - - case KHotKeys::KeyboardInputAction::ActiveWindow: - return !ui.active_radio->isChecked(); - - case KHotKeys::KeyboardInputAction::SpecificWindow: - return !ui.specific_radio->isChecked() - || ui.windowdef_list->isChanged(); - } - - return false; - } - -#include "moc_keyboard_input_action_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.h b/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.h deleted file mode 100644 index c3e79d1e..00000000 --- a/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef KEYBOARD_INPUT_ACTION_WIDGET_H -#define KEYBOARD_INPUT_ACTION_WIDGET_H -/* Copyright (C) 2009 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "action_widget_base.h" -#include "ui_keyboard_input_action_widget.h" - - -/** - * @author Michael Jansen - */ -class KeyboardInputActionWidget : public ActionWidgetBase - { - Q_OBJECT - - typedef ActionWidgetBase Base; - -public: - - /** - * Default constructor - */ - KeyboardInputActionWidget( - KHotKeys::KeyboardInputAction *action, - QWidget *parent = NULL); - - /** - * Destructor - */ - virtual ~KeyboardInputActionWidget(); - - KHotKeys::KeyboardInputAction *action(); - const KHotKeys::KeyboardInputAction *action() const; - - virtual bool isChanged() const; - -protected: - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - - Ui::KeyboardInputActionWidget ui; - -}; - - -#endif /* #ifndef KEYBOARD_INPUT_ACTION_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.ui b/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.ui deleted file mode 100644 index 70a134a1..00000000 --- a/khotkeys/kcm_hotkeys/actions/keyboard_input_action_widget.ui +++ /dev/null @@ -1,69 +0,0 @@ - - KeyboardInputActionWidget - - - - 0 - 0 - 477 - 489 - - - - - - - - - - Window - - - - - - - - Active window - - - - - - - Specific window - - - - - - - Action window - - - - - - - - - - - - - - - - KTextEdit - QTextEdit -
ktextedit.h
-
- - WindowDefinitionListWidget - QWidget -
helper_widgets/window_definition_list_widget.h
- 1 -
-
- -
diff --git a/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.cpp b/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.cpp deleted file mode 100644 index b593c653..00000000 --- a/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "menuentry_action_widget.h" - -#include -#include - - - -MenuentryActionWidget::MenuentryActionWidget( KHotKeys::MenuEntryAction *action, QWidget *parent ) - : ActionWidgetBase(action, parent ) - ,storage_id() - { - ui.setupUi(this); - - connect( - ui.applicationButton, SIGNAL(clicked()), - this, SLOT(selectApplicationClicked()) ); - - connect( - ui.application, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.application, "application" ); - } - - -MenuentryActionWidget::~MenuentryActionWidget() - {} - - -KHotKeys::MenuEntryAction *MenuentryActionWidget::action() - { - Q_ASSERT(dynamic_cast(_action)); - return static_cast(_action); - } - - -const KHotKeys::MenuEntryAction *MenuentryActionWidget::action() const - { - Q_ASSERT(dynamic_cast(_action)); - return static_cast(_action); - } - - -void MenuentryActionWidget::doCopyFromObject() - { - Q_ASSERT(action()); - KService::Ptr service = action()->service(); - - if (service) - { - ui.application->setText( service->name() ); - storage_id = service->storageId(); - } - else - { - ui.application->setText(QString()); - storage_id = QString(); - } - } - - -void MenuentryActionWidget::doCopyToObject() - { - Q_ASSERT(action()); - action()->set_service( KService::serviceByStorageId(storage_id)); - } - - -bool MenuentryActionWidget::isChanged() const - { - Q_ASSERT(action()); - - bool changed; - - // There could be no service set, so be careful! - if (action()->service()) - { - changed = ui.application->text() != action()->service()->name(); - } - else - { - // No service set. If the string is not empty something changed. - changed = ! ui.application->text().isEmpty(); - } - - return changed; - } - - -void MenuentryActionWidget::selectApplicationClicked() - { - KOpenWithDialog dlg; - dlg.exec(); - - KService::Ptr service = dlg.service(); - - if (service) - { - ui.application->setText( service->name() ); - storage_id = service->storageId(); - } - } - - -#include "moc_menuentry_action_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.h b/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.h deleted file mode 100644 index 3d6ee1ec..00000000 --- a/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef MENUENTRY_ACTION_WIDGET_H -#define MENUENTRY_ACTION_WIDGET_H - -#include "action_widget_base.h" -#include "ui_menuentry_action_widget.h" - -#include "libkhotkeysfwd.h" - - -/** - * @author Michael Jansen - */ -class MenuentryActionWidget : public ActionWidgetBase - { - Q_OBJECT - - typedef ActionWidgetBase Base; - -public: - - /** - * Default constructor - */ - MenuentryActionWidget( KHotKeys::MenuEntryAction *action, QWidget *parent = 0 ); - - /** - * Destructor - */ - virtual ~MenuentryActionWidget(); - - KHotKeys::MenuEntryAction *action(); - const KHotKeys::MenuEntryAction *action() const; - - virtual bool isChanged() const; - -public Q_SLOTS: - - void selectApplicationClicked(); - -protected: - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - - QString storage_id; - - Ui::MenuentryActionWidget ui; - - -}; - -#endif /* #ifndef MENUENTRY_ACTION_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.ui b/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.ui deleted file mode 100644 index c4e3159f..00000000 --- a/khotkeys/kcm_hotkeys/actions/menuentry_action_widget.ui +++ /dev/null @@ -1,49 +0,0 @@ - - MenuentryActionWidget - - - - 0 - 0 - 400 - 300 - - - - - - - Application: - - - - - - - true - - - - - - - Select Application ... - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
- - KPushButton - QPushButton -
kpushbutton.h
-
-
- -
diff --git a/khotkeys/kcm_hotkeys/conditions/condition_type_menu.cpp b/khotkeys/kcm_hotkeys/conditions/condition_type_menu.cpp deleted file mode 100644 index 1f8c513e..00000000 --- a/khotkeys/kcm_hotkeys/conditions/condition_type_menu.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2009 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "condition_type_menu.h" - -#include - - -ConditionTypeMenu::ConditionTypeMenu(QWidget *parent) - : QMenu(parent) - { - addAction(i18nc("Condition type", "Active Window ...")) - ->setData(ACTIVE_WINDOW); - addAction(i18nc("Condition type", "Existing Window ...")) - ->setData(EXISTING_WINDOW); - addAction(i18nc("Condition type", "And")) - ->setData(AND); - addAction(i18nc("Condition type", "Or")) - ->setData(OR); - addAction(i18nc("Condition type", "Not")) - ->setData(NOT); - } - - -ConditionTypeMenu::~ConditionTypeMenu() - {} - - -#include "moc_condition_type_menu.cpp" diff --git a/khotkeys/kcm_hotkeys/conditions/condition_type_menu.h b/khotkeys/kcm_hotkeys/conditions/condition_type_menu.h deleted file mode 100644 index de9141d4..00000000 --- a/khotkeys/kcm_hotkeys/conditions/condition_type_menu.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef CONDITION_TYPE_MENU_H -#define CONDITION_TYPE_MENU_H -/* Copyright (C) 2009 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include - - -/** - * @author Michael Jansen - */ -class ConditionTypeMenu : public QMenu - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - ConditionTypeMenu(QWidget *parent = NULL); - - /** - * Destructor - */ - virtual ~ConditionTypeMenu(); - - enum ConditionType{ - ACTIVE_WINDOW, - EXISTING_WINDOW, - AND, - OR, - NOT}; - -}; - - -#endif /* #ifndef CONDITION_TYPE_MENU_H */ diff --git a/khotkeys/kcm_hotkeys/conditions/conditions_widget.cpp b/khotkeys/kcm_hotkeys/conditions/conditions_widget.cpp deleted file mode 100644 index 4a242cbb..00000000 --- a/khotkeys/kcm_hotkeys/conditions/conditions_widget.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* Copyright (C) 2009 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions/conditions_widget.h" -#include "conditions/conditions_list_base.h" -#include "conditions/conditions_list.h" -#include "conditions/condition.h" -#include "conditions/conditions.h" -#include "conditions/conditions_visitor.h" -#include "conditions/existing_window_condition.h" -#include "conditions/active_window_condition.h" - -#include "windows_helper/window_selection_list.h" - -#include "helper_widgets/window_definition_list_widget.h" - -#include "condition_type_menu.h" - -#include - -#include - -class BuildTree : public KHotKeys::ConditionsVisitor - { -public: - - BuildTree(QTreeWidget *tree); - - void build(); - - virtual void visitConditionsListBase(KHotKeys::Condition_list_base *list); - virtual void visitConditionsList(KHotKeys::Condition_list *list); - virtual void visitCondition( KHotKeys::Condition *condition ); - - QMap _items; -private: - - QTreeWidget *_tree; - QStack _stack; - }; - - -BuildTree::BuildTree( QTreeWidget *tree ) - : _tree(tree) - { - _stack.push(_tree->invisibleRootItem()); - } - - -void BuildTree::visitCondition(KHotKeys::Condition *cond) - { - QTreeWidgetItem *item = new QTreeWidgetItem(_stack.top()); - item->setText(0, cond->description()); - _items.insert(item, cond); - } - - -void BuildTree::visitConditionsList(KHotKeys::Condition_list *list) - { - Q_ASSERT(_stack.count()==1); - - QTreeWidgetItem *parent = _stack.top(); - - QTreeWidgetItem *item = new QTreeWidgetItem(parent); - item->setText(0, i18nc("Add a new condition", "And")); - _items.insert(item, list); - _stack.push(item); - - for(KHotKeys::Condition_list_base::Iterator it = list->begin(); - it != list->end(); - ++it) - { - (*it)->visit(this); - } - - _tree->expandAll(); - } - - -void BuildTree::visitConditionsListBase(KHotKeys::Condition_list_base *list) - { - QTreeWidgetItem *parent = _stack.top(); - - QTreeWidgetItem *item = new QTreeWidgetItem(parent); - item->setText(0, list->description()); - _items.insert(item, list); - _stack.push(item); - - for(KHotKeys::Condition_list_base::Iterator it = list->begin(); - it != list->end(); - ++it) - { - // QTreeWidgetItem *child = new QTreeWidgetItem(item); - // child->setText(0, (*it)->description()); - // _items.insert(child, list); - (*it)->visit(this); - } - - _stack.pop(); - } - - -ConditionsWidget::ConditionsWidget(QWidget *parent) - : QWidget(parent) - ,_working(NULL) - ,_changed(false) - { - ui.setupUi(this); - - connect(ui.edit_button, SIGNAL(clicked(bool)), - SLOT(slotEdit())); - - connect(ui.delete_button, SIGNAL(clicked(bool)), - SLOT(slotDelete())); - - ui.new_button->setMenu(new ConditionTypeMenu(this)); - connect(ui.new_button->menu(), SIGNAL(triggered(QAction*)), - SLOT(slotNew(QAction*))); - } - - -ConditionsWidget::~ConditionsWidget() - { - delete _working; _working = NULL; - } - - -void ConditionsWidget::copyFromObject() - { - Q_ASSERT(_conditions_list); - - // Clear the tree and delete our old working copy - ui.tree->clear(); - if (_working) delete _working; - - // Create the working copy - _working = _conditions_list->copy(); - Q_ASSERT(_working->count() == _conditions_list->count()); - - kDebug() << _working->count(); - kDebug() << _conditions_list->count(); - - // Build the tree - BuildTree builder(ui.tree); - _working->visit(&builder); - _items = builder._items; - - _changed = false; - } - - -void ConditionsWidget::copyToObject() - { - kDebug(); - - Q_ASSERT(_conditions_list); - if (!_conditions_list) return; - - // Just copy the content from our working copy to the original - - // Remove the old content - qDeleteAll(*_conditions_list); - _conditions_list->clear(); - - for (KHotKeys::Condition_list::Iterator it = _working->begin(); - it != _working->end(); - ++it) - { - kDebug(); - _conditions_list->append((*it)->copy()); - } - - Q_ASSERT(_working->count() == _conditions_list->count()); - _changed = false; - } - - -void ConditionsWidget::emitChanged(bool chgd) - { - if (_changed == ( chgd || _changed )) - return; - - // Once changed always changed - _changed = chgd || _changed; - - emit changed(_changed); - } - - -bool ConditionsWidget::hasChanges() const - { - return _changed; - } - - -void ConditionsWidget::setConditionsList( KHotKeys::Condition_list *list) - { - Q_ASSERT(list); - _conditions_list = list; - } - - -void ConditionsWidget::slotDelete() - { - QTreeWidgetItem *citem = ui.tree->currentItem(); - - // If no item is selected just return - if (!citem) return; - - // TODO: Ask for confirmation before deleting - - // Get the currently select condition - KHotKeys::Condition *cond = _items.value(citem); - - // Do not allow deleting the root item - if (cond==_working) return; - - delete cond; - delete citem; - emitChanged(true); - } - - -void ConditionsWidget::slotEdit() - { - // Get the currently select condition - QTreeWidgetItem *citem = ui.tree->currentItem(); - - // If no item is selected just return - if (!citem) return; - - KHotKeys::Condition *cond = _items.value(citem); - - // Currently we only allow editing existing and active window conditions. - // TODO: Disable buttons according to active item - - KHotKeys::Existing_window_condition *ewcond = - dynamic_cast(cond); - if (ewcond) - { - WindowDefinitionListDialog dialog(ewcond->window()); - switch (dialog.exec()) - { - case QDialog::Accepted: - { - citem->setText(0, ewcond->description()); - emitChanged(true); - } - break; - - case QDialog::Rejected: - // Nothing to do - return; - - default: - Q_ASSERT(false); - return; - } - } - - KHotKeys::Active_window_condition *awcond = - dynamic_cast(cond); - if (awcond) - { - WindowDefinitionListDialog dialog(awcond->window()); - switch (dialog.exec()) - { - case QDialog::Accepted: - { - citem->setText(0, awcond->description()); - emitChanged(true); - } - break; - - case QDialog::Rejected: - // Nothing to do - return; - - default: - Q_ASSERT(false); - return; - } - } - - return; - } - - -void ConditionsWidget::slotNew(QAction* action) - { - QTreeWidgetItem *citem = ui.tree->currentItem(); - - KHotKeys::Condition *cond; - if (!citem) - { - // If no item is selected create the new condition as a top level - // condition - cond = _working; - citem = ui.tree->invisibleRootItem()->child(0); - Q_ASSERT(citem); - } - else - { - // Get the currently select condition - cond = _items.value(citem); - } - - // get the nearest list - KHotKeys::Condition_list_base *parent = dynamic_cast(cond); - - if (!parent) - { - parent = cond->parent(); - citem = citem->parent(); - } - - Q_ASSERT(parent); - - switch (action->data().toInt()) - { - case ConditionTypeMenu::ACTIVE_WINDOW: - { - KHotKeys::Windowdef_list *list = new KHotKeys::Windowdef_list(); - WindowDefinitionListDialog dialog(list); - switch (dialog.exec()) - { - case QDialog::Accepted: - { - KHotKeys::Active_window_condition *cond = - new KHotKeys::Active_window_condition(list, parent); - QTreeWidgetItem *item = new QTreeWidgetItem(citem); - item->setText(0, cond->description()); - _items.insert(item, cond); - } - break; - - case QDialog::Rejected: - delete list; - return; - - default: - Q_ASSERT(false); - delete list; - return; - } - } - break; - - case ConditionTypeMenu::EXISTING_WINDOW: - { - KHotKeys::Windowdef_list *list = new KHotKeys::Windowdef_list(); - WindowDefinitionListDialog dialog(list); - switch (dialog.exec()) - { - case QDialog::Accepted: - { - KHotKeys::Existing_window_condition *cond = - new KHotKeys::Existing_window_condition(list, parent); - QTreeWidgetItem *item = new QTreeWidgetItem(citem); - item->setText(0, cond->description()); - _items.insert(item, cond); - } - break; - - case QDialog::Rejected: - delete list; - return; - - default: - Q_ASSERT(false); - delete list; - return; - } - } - break; - - case ConditionTypeMenu::AND: - { - KHotKeys::And_condition *cond = new KHotKeys::And_condition(parent); - QTreeWidgetItem *item = new QTreeWidgetItem(citem); - item->setText(0, cond->description()); - _items.insert(item, cond); - } - break; - - case ConditionTypeMenu::OR: - { - KHotKeys::Or_condition *cond = new KHotKeys::Or_condition(parent); - QTreeWidgetItem *item = new QTreeWidgetItem(citem); - item->setText(0, cond->description()); - _items.insert(item, cond); - } - break; - - case ConditionTypeMenu::NOT: - { - KHotKeys::Not_condition *cond = new KHotKeys::Not_condition(parent); - QTreeWidgetItem *item = new QTreeWidgetItem(citem); - item->setText(0, cond->description()); - _items.insert(item, cond); - } - break; - - default: - Q_ASSERT(false); - break; - } - - emitChanged(true); - } - -#include "moc_conditions_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/conditions/conditions_widget.h b/khotkeys/kcm_hotkeys/conditions/conditions_widget.h deleted file mode 100644 index 2edef3a8..00000000 --- a/khotkeys/kcm_hotkeys/conditions/conditions_widget.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef CONDITIONS_WIDGET_H -#define CONDITIONS_WIDGET_H -/* Copyright (C) 2009 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - - -#include "ui_conditions_widget.h" - -#include -#include - -namespace KHotKeys { - class Condition_list; - class Condition; -} - - -/** - * @author Michael Jansen - */ -class ConditionsWidget : public QWidget - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - ConditionsWidget(QWidget *parent = NULL); - - /** - * Destructor - */ - virtual ~ConditionsWidget(); - - void copyFromObject(); - void copyToObject(); - - void setConditionsList(KHotKeys::Condition_list *list); - - //! Are there uncommited changes? - bool hasChanges() const; - -Q_SIGNALS: - - void changed(bool); - -private Q_SLOTS: - - void slotNew(QAction*); - void slotEdit(); - void slotDelete(); - -private: - - // Emit the changed(bool) signal if our changed status changes - void emitChanged(bool); - - //! The original - KHotKeys::Condition_list *_conditions_list; - - //! The working copy - KHotKeys::Condition_list *_working; - - //! User Interface Definition - Ui::ConditionsWidget ui; - - //! Are there uncommited changes? - bool _changed; - - //! Map between treewidgetitems and conditions - QMap _items; - -}; - - -#endif /* #ifndef CONDITIONS_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/conditions/conditions_widget.ui b/khotkeys/kcm_hotkeys/conditions/conditions_widget.ui deleted file mode 100644 index 41e17402..00000000 --- a/khotkeys/kcm_hotkeys/conditions/conditions_widget.ui +++ /dev/null @@ -1,53 +0,0 @@ - - ConditionsWidget - - - - 0 - 0 - 400 - 300 - - - - - - - true - - - - 1 - - - - - - - - - - New - - - - - - - Edit... - - - - - - - Delete - - - - - - - - - diff --git a/khotkeys/kcm_hotkeys/global_settings_widget.cpp b/khotkeys/kcm_hotkeys/global_settings_widget.cpp deleted file mode 100644 index 3b13f02f..00000000 --- a/khotkeys/kcm_hotkeys/global_settings_widget.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "global_settings_widget.h" - -#include "hotkeys_model.h" -#include "settings.h" - -#include -#include -#include -#include -#include - -GlobalSettingsWidget::GlobalSettingsWidget( QWidget *parent ) - : HotkeysWidgetIFace( parent ) - ,_model(NULL) - { - ui.setupUi(this); - - QString path = KGlobal::dirs()->findResource( "services", "kded/khotkeys.desktop"); - if ( KDesktopFile::isDesktopFile(path) ) - { - _config = KSharedConfig::openConfig( - path, - KConfig::NoGlobals, - "services" ); - } - - connect( - ui.enabled, SIGNAL(stateChanged(int)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.enabled, "enabled" ); - } - - -GlobalSettingsWidget::~GlobalSettingsWidget() - { - } - - -void GlobalSettingsWidget::doCopyFromObject() - { - if (_config) - { - KConfigGroup file(_config, "Desktop Entry"); - ui.enabled->setChecked(file.readEntry("X-KDE-Kded-autoload", false)); - } - } - - -void GlobalSettingsWidget::doCopyToObject() - { - if (_config) - { - KConfigGroup file(_config, "Desktop Entry"); - file.writeEntry("X-KDE-Kded-autoload", ui.enabled->checkState()==Qt::Checked); - _config->sync(); - } - } - - -bool GlobalSettingsWidget::isChanged() const - { - if (_config) - { - KConfigGroup file(_config, "Desktop Entry"); - bool enabled = file.readEntry("X-KDE-Kded-autoload", false); - - if (enabled!=ui.enabled->isChecked()) - { - return true; - } - } - - return false; - } - - -void GlobalSettingsWidget::setModel(KHotkeysModel *model) - { - _model = model; - doCopyFromObject(); - } - - -#include "moc_global_settings_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/global_settings_widget.h b/khotkeys/kcm_hotkeys/global_settings_widget.h deleted file mode 100644 index 8825f77d..00000000 --- a/khotkeys/kcm_hotkeys/global_settings_widget.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef GLOBAL_SETTINGS_WIDGET_H -#define GLOBAL_SETTINGS_WIDGET_H - -#include - -#include "hotkeys_widget_iface.h" - -#include - - -class KHotkeysModel; - - -/** - * @author Michael Jansen - */ -class GlobalSettingsWidget : public HotkeysWidgetIFace - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - GlobalSettingsWidget(QWidget *parent = NULL); - - /** - * Destructor - */ - ~GlobalSettingsWidget(); - - /** - * Set the model we configure - */ - void setModel(KHotkeysModel *); - -private Q_SLOTS: - - bool isChanged() const; - -protected: - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - -private: - - KSharedConfigPtr _config; - KHotkeysModel *_model; - Ui::GlobalSettingsWidget ui; - -}; - -#endif /* #ifndef GLOBAL_SETTINGS_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/global_settings_widget.ui b/khotkeys/kcm_hotkeys/global_settings_widget.ui deleted file mode 100644 index 1454b018..00000000 --- a/khotkeys/kcm_hotkeys/global_settings_widget.ui +++ /dev/null @@ -1,64 +0,0 @@ - - - GlobalSettingsWidget - - - - 0 - 0 - 641 - 354 - - - - - 0 - - - - - - 0 - 0 - - - - - 16777215 - 100 - - - - Input Actions Daemon - - - - - - Start the Input Actions daemon on login - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - enabled - - - diff --git a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.cpp b/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.cpp deleted file mode 100644 index b25e0d7d..00000000 --- a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* Copyright (C) 2009 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "window_definition_list_widget.h" -#include "window_definition_widget.h" -#include "windows_helper/window_selection_rules.h" - -#include "kdebug.h" - -WindowDefinitionListWidget::WindowDefinitionListWidget(QWidget *parent) - : HotkeysWidgetIFace(parent) - ,_windowdefs(NULL) - ,_working(NULL) - ,_changed(false) - { - ui.setupUi(this); - - connect( - ui.edit_button, SIGNAL(clicked(bool)), - SLOT(slotEdit(bool))); - - connect( - ui.delete_button, SIGNAL(clicked(bool)), - SLOT(slotDelete(bool))); - - connect( - ui.duplicate_button, SIGNAL(clicked(bool)), - SLOT(slotDuplicate(bool))); - - connect( - ui.new_button, SIGNAL(clicked(bool)), - SLOT(slotNew(bool))); - } - - -WindowDefinitionListWidget::WindowDefinitionListWidget(KHotKeys::Windowdef_list *windowdef, QWidget *parent) - : HotkeysWidgetIFace(parent) - ,_windowdefs(NULL) - ,_working(NULL) - ,_changed(false) - { - ui.setupUi(this); - - setWindowDefinitions(windowdef); - - connect( - ui.edit_button, SIGNAL(clicked(bool)), - SLOT(slotEdit(bool))); - - connect( - ui.delete_button, SIGNAL(clicked(bool)), - SLOT(slotDelete(bool))); - - connect( - ui.duplicate_button, SIGNAL(clicked(bool)), - SLOT(slotDuplicate(bool))); - - connect( - ui.new_button, SIGNAL(clicked(bool)), - SLOT(slotNew(bool))); - } - - -WindowDefinitionListWidget::~WindowDefinitionListWidget() - { - delete _working; - } - - -void WindowDefinitionListWidget::doCopyFromObject() - { - // We are asked to copy again from object. Recreate our working copy - if (_working) delete _working; - _working = _windowdefs->copy(); - - ui.comment->setText(_working->comment()); - - for ( KHotKeys::Windowdef_list::ConstIterator it(_working->constBegin()); - it != _working->constEnd(); - ++it) - { - new QListWidgetItem((*it)->description(), ui.list); - } - - emitChanged(false); - } - - -void WindowDefinitionListWidget::doCopyToObject() - { - // Delete the old content - qDeleteAll(*_windowdefs); - _windowdefs->clear(); - - _windowdefs->set_comment(ui.comment->text()); - - for (int i=0; i<_working->size(); ++i) - { - _windowdefs->append(_working->at(i)->copy()); - } - - // Reset our _changed state - _changed = false; - emitChanged(false); - } - - -void WindowDefinitionListWidget::emitChanged( bool chgd ) - { - if (_changed == chgd) - return; - - // emitChanged will never reset _changed to false because we have - // currently no way to compare the contents of _working and _windowdefs. - // That's why we say once changed -> always changed. - _changed = chgd || _changed; - - emit changed(_changed); - } - - - -bool WindowDefinitionListWidget::isChanged() const - { - return _changed; - } - - -void WindowDefinitionListWidget::slotDelete(bool) - { - // TODO: Deactivate buttons if nothing is selected - if (ui.list->currentRow() == -1) - return; - - Q_ASSERT(ui.list->currentRow() < _working->count()); - - KHotKeys::Windowdef *def = _working->at(ui.list->currentRow()); - KHotKeys::Windowdef_simple *sim = dynamic_cast(def); - Q_ASSERT(sim); - - // Remove it from the list - ui.list->takeItem(ui.list->currentRow()); - - // delete it - _working->removeAll(sim); - delete sim; - - emitChanged(true); - - return; - } - - -void WindowDefinitionListWidget::slotDuplicate(bool) - { - // TODO: Deactivate buttons if nothing is selected - if (ui.list->currentRow() == -1) - return; - - Q_ASSERT(ui.list->currentRow() < _working->count()); - - // Get the template - KHotKeys::Windowdef *def = _working->at(ui.list->currentRow()); - KHotKeys::Windowdef_simple *orig = dynamic_cast(def); - Q_ASSERT(orig); - - // Create a copy - KHotKeys::Windowdef_simple *sim = orig->copy(); - Q_ASSERT(sim); - - WindowDefinitionDialog dialog(sim, this); - switch (dialog.exec()) - { - case QDialog::Accepted: - // Update our list if necessary - new QListWidgetItem(sim->description(), ui.list); - _working->append(sim); - emitChanged(true); - break; - - case QDialog::Rejected: - // Nothing to do - delete sim; - break; - - default: - Q_ASSERT(false); - delete sim; - } - } - - -void WindowDefinitionListWidget::slotEdit(bool) - { - // TODO: Deactivate buttons if nothing is selected - if (ui.list->currentRow() == -1) - return; - - Q_ASSERT(ui.list->currentRow() < _working->count()); - - QListWidgetItem *item = ui.list->currentItem(); - KHotKeys::Windowdef *def = _working->at(ui.list->currentRow()); - KHotKeys::Windowdef_simple *sim = dynamic_cast(def); - - Q_ASSERT(sim); - if (!sim) return; - - WindowDefinitionDialog dialog(sim, this); - switch (dialog.exec()) - { - case QDialog::Accepted: - // Update our list if necessary - item->setText(sim->description()); - emitChanged(true); - break; - - case QDialog::Rejected: - // Nothing to do - break; - - default: - Q_ASSERT(false); - } - } - - -void WindowDefinitionListWidget::slotNew(bool) - { - KHotKeys::Windowdef_simple *sim = new KHotKeys::Windowdef_simple(); - - WindowDefinitionDialog dialog(sim, this); - switch (dialog.exec()) - { - case QDialog::Accepted: - // Update our list if necessary - new QListWidgetItem(sim->description(), ui.list); - _working->append(sim); - emitChanged(true); - break; - - case QDialog::Rejected: - // Nothing to do - delete sim; - break; - - default: - Q_ASSERT(false); - delete sim; - } - } - - -void WindowDefinitionListWidget::setWindowDefinitions(KHotKeys::Windowdef_list *list) - { - Q_ASSERT(list); - _windowdefs = list; - } - -#include "moc_window_definition_list_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.h b/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.h deleted file mode 100644 index 01f23751..00000000 --- a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef WINDOW_DEFINITION_LIST_WIDGET_H -#define WINDOW_DEFINITION_LIST_WIDGET_H -/* Copyright (C) 2009 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "hotkeys_widget_iface.h" - -#include "ui_window_definition_list_widget.h" -#include "windows_helper/window_selection_list.h" - -#include - -/** - * @author Michael Jansen - */ -class WindowDefinitionListWidget : public HotkeysWidgetIFace - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - WindowDefinitionListWidget( - KHotKeys::Windowdef_list *windowdef_list, - QWidget *parent = NULL); - - WindowDefinitionListWidget(QWidget *parent); - - /** - * Destructor - */ - virtual ~WindowDefinitionListWidget(); - - void setWindowDefinitions(KHotKeys::Windowdef_list *windowdef_list); - - bool isChanged() const; - -private: - - void emitChanged(bool); - -private Q_SLOTS: - - void slotDelete(bool); - void slotDuplicate(bool); - void slotEdit(bool); - void slotNew(bool); - -protected: - - void doCopyFromObject(); - void doCopyToObject(); - -private: - - // The Windowdefinition list - KHotKeys::Windowdef_list *_windowdefs; - KHotKeys::Windowdef_list *_working; - - // The User Interface - Ui::WindowDefinitionListWidget ui; - - // Unsaved changes? - bool _changed; -}; - - -class WindowDefinitionListDialog : public KDialog - { - Q_OBJECT - -public: - - WindowDefinitionListDialog( - KHotKeys::Windowdef_list *list, - QWidget *parent=NULL) - : KDialog(parent) - ,def(NULL) - { - def = new WindowDefinitionListWidget(list, this); - setMainWidget(def); - def->copyFromObject(); - } - - - ~WindowDefinitionListDialog() - { - def = NULL; - } - - - virtual void accept() - { - def->copyToObject(); - KDialog::accept(); - } - -private: - - WindowDefinitionListWidget *def; - }; - -#endif /* #ifndef WINDOW_DEFINITION_LIST_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.ui b/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.ui deleted file mode 100644 index 8edce8d2..00000000 --- a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_list_widget.ui +++ /dev/null @@ -1,77 +0,0 @@ - - - WindowDefinitionListWidget - - - - 0 - 0 - 500 - 308 - - - - - - - - - Comment: - - - - - - - - - - - - - - - - - - - &Edit... - - - - - - - &New... - - - - - - - &Duplicate... - - - - - - - &Delete - - - - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
-
- -
diff --git a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.cpp b/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.cpp deleted file mode 100644 index b78dd7af..00000000 --- a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "window_definition_widget.h" -#include "ui_window_definition_widget.h" - -#include "windows_handler.h" -#include "helper_widgets/window_selector.h" -#include "windows_helper/window_selection_rules.h" - -#include - - -WindowDefinitionWidget::WindowDefinitionWidget(KHotKeys::Windowdef_simple *windowdef, QWidget *parent) - : HotkeysWidgetIFace(parent) - ,ui(new Ui_WindowDefinitionWidget) - ,_windowdef(windowdef) - { - ui->setupUi(this); - connect(ui->window_class_combo, SIGNAL(currentIndexChanged(int)), - SLOT(slotWindowClassChanged(int))); - connect(ui->window_title_combo, SIGNAL(currentIndexChanged(int)), - SLOT(slotWindowTitleChanged(int))); - connect(ui->window_role_combo, SIGNAL(currentIndexChanged(int)), - SLOT(slotWindowRoleChanged(int))); - connect(ui->autodetect, SIGNAL(clicked()), - SLOT(slotAutoDetect())); - - // user changes -> isChanged for all others - connect( - ui->comment, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui->comment, "text" ); - - connect( - ui->window_class, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui->window_class, "window_class" ); - - connect( - ui->window_role, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui->window_role, "window_role" ); - - connect( - ui->window_title, SIGNAL(textChanged(QString)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui->window_title, "window_title" ); - - connect( - ui->type_dialog, SIGNAL(toggled(bool)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui->type_dialog, "window_type_dialog" ); - - connect( - ui->type_dock, SIGNAL(toggled(bool)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui->type_dock, "window_type_dock" ); - - connect( - ui->type_desktop, SIGNAL(toggled(bool)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui->type_desktop, "window_type_desktop" ); - - connect( - ui->type_normal, SIGNAL(toggled(bool)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui->type_normal, "window_type_normal" ); - } - - -WindowDefinitionWidget::~WindowDefinitionWidget() - { delete ui; } - - -void WindowDefinitionWidget::doCopyFromObject() - { - ui->comment->setText(_windowdef->comment()); - ui->window_class->setText(_windowdef->wclass()); - ui->window_class_combo->setCurrentIndex(_windowdef->wclass_match_type()); - ui->window_role->setText(_windowdef->role()); - ui->window_role_combo->setCurrentIndex(_windowdef->role_match_type()); - ui->window_title->setText(_windowdef->title()); - ui->window_title_combo->setCurrentIndex(_windowdef->title_match_type()); - ui->type_desktop->setChecked( - _windowdef->type_match(KHotKeys::Windowdef_simple::WINDOW_TYPE_DESKTOP)); - ui->type_dialog->setChecked( - _windowdef->type_match(KHotKeys::Windowdef_simple::WINDOW_TYPE_DIALOG)); - ui->type_dock->setChecked( - _windowdef->type_match(KHotKeys::Windowdef_simple::WINDOW_TYPE_DOCK)); - ui->type_normal->setChecked( - _windowdef->type_match(KHotKeys::Windowdef_simple::WINDOW_TYPE_NORMAL)); - } - - -void WindowDefinitionWidget::doCopyToObject() - { - _windowdef->set_comment(ui->comment->text()); - _windowdef->set_wclass(ui->window_class->text()); - _windowdef->set_wclass_match_type(static_cast(ui->window_class_combo->currentIndex())); - _windowdef->set_role(ui->window_role->text()); - _windowdef->set_role_match_type(static_cast(ui->window_role_combo->currentIndex())); - _windowdef->set_title(ui->window_title->text()); - _windowdef->set_title_match_type(static_cast(ui->window_title_combo->currentIndex())); - int types = 0; - if (ui->type_desktop->isChecked()) - types |= KHotKeys::Windowdef_simple::WINDOW_TYPE_DESKTOP; - if (ui->type_dialog->isChecked()) - types |= KHotKeys::Windowdef_simple::WINDOW_TYPE_DIALOG; - if (ui->type_dock->isChecked()) - types |= KHotKeys::Windowdef_simple::WINDOW_TYPE_DOCK; - if (ui->type_normal->isChecked()) - types |= KHotKeys::Windowdef_simple::WINDOW_TYPE_NORMAL; - _windowdef->set_window_types(types); - } - - -bool WindowDefinitionWidget::isChanged() const - { - if ( _windowdef->comment() != ui->comment->text() - || _windowdef->wclass() != ui->window_class->text() - || _windowdef->wclass_match_type() != ui->window_class_combo->currentIndex() - || _windowdef->role() != ui->window_role->text() - || _windowdef->role_match_type() != ui->window_role_combo->currentIndex() - || _windowdef->title() != ui->window_title->text() - || _windowdef->title_match_type() != ui->window_title_combo->currentIndex()) - { - return true; - } - - int types = 0; - if (ui->type_desktop->isChecked()) - types |= KHotKeys::Windowdef_simple::WINDOW_TYPE_DESKTOP; - if (ui->type_dialog->isChecked()) - types |= KHotKeys::Windowdef_simple::WINDOW_TYPE_DIALOG; - if (ui->type_dock->isChecked()) - types |= KHotKeys::Windowdef_simple::WINDOW_TYPE_DOCK; - if (ui->type_normal->isChecked()) - types |= KHotKeys::Windowdef_simple::WINDOW_TYPE_NORMAL; - kDebug() << _windowdef->window_types() << types; - return _windowdef->window_types() != types; - } - - -void WindowDefinitionWidget::slotAutoDetect() - { - KHotKeys::WindowSelector* sel = new KHotKeys::WindowSelector( this, SLOT(slotWindowSelected(WId))); - sel->select(); - } - - -void WindowDefinitionWidget::slotWindowClassChanged(int index) - { - ui->window_class->setEnabled(index!=0); - slotChanged("window_class"); - } - - -void WindowDefinitionWidget::slotWindowRoleChanged(int index) - { - ui->window_role->setEnabled(index!=0); - slotChanged("window_role"); - } - - -void WindowDefinitionWidget::slotWindowSelected(WId window) - { - if (window) - { - KHotKeys::Window_data data( window ); - ui->window_title->setText( data.title ); - ui->window_role->setText( data.role ); - ui->window_class->setText( data.wclass ); - ui->type_normal->setChecked( data.type == NET::Normal ); - ui->type_dialog->setChecked( data.type == NET::Dialog ); - ui->type_dock->setChecked( data.type == NET::Dock ); - ui->type_desktop->setChecked( data.type == NET::Desktop ); - } - } - - -void WindowDefinitionWidget::slotWindowTitleChanged(int index) - { - ui->window_title->setEnabled(index!=0); - slotChanged("window_title"); - } - - -#include "moc_window_definition_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.h b/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.h deleted file mode 100644 index bc3f38cb..00000000 --- a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef WINDOW_DEFINITION_H -#define WINDOW_DEFINITION_H -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "hotkeys_widget_iface.h" - -#include "qwindowdefs.h" -#include -#include - -QT_BEGIN_NAMESPACE -class Ui_WindowDefinitionWidget; -QT_END_NAMESPACE - -namespace KHotKeys { - class Windowdef_simple; -} - - -/** - * @author Michael Jansen - */ -class WindowDefinitionWidget : public HotkeysWidgetIFace - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - WindowDefinitionWidget(KHotKeys::Windowdef_simple *windowdef, QWidget *parent = NULL); - - /** - * Destructor - */ - virtual ~WindowDefinitionWidget(); - - bool isChanged() const; - -protected: - - void doCopyFromObject(); - void doCopyToObject(); - -private Q_SLOTS: - - void slotWindowClassChanged(int); - void slotWindowRoleChanged(int); - void slotWindowTitleChanged(int); - - void slotAutoDetect(); - void slotWindowSelected(WId); - -private: - - Ui_WindowDefinitionWidget *ui; - - KHotKeys::Windowdef_simple *_windowdef; -}; - - -class WindowDefinitionDialog : public KDialog - { - Q_OBJECT - -public: - - WindowDefinitionDialog( KHotKeys::Windowdef_simple *windowdef, QWidget *parent=NULL) - : KDialog(parent) - ,def(NULL) - { - def = new WindowDefinitionWidget(windowdef, this); - setMainWidget(def); - def->copyFromObject(); - } - - - ~WindowDefinitionDialog() - { - def = NULL; - } - - - virtual void accept() - { - def->copyToObject(); - KDialog::accept(); - } - -private: - - WindowDefinitionWidget *def; - }; - - -#endif /* #ifndef WINDOW_DEFINITION_H */ diff --git a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.ui b/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.ui deleted file mode 100644 index 897b99d8..00000000 --- a/khotkeys/kcm_hotkeys/helper_widgets/window_definition_widget.ui +++ /dev/null @@ -1,249 +0,0 @@ - - WindowDefinitionWidget - - - - 0 - 0 - 371 - 404 - - - - - - - Window Data - - - - - - - - Comment: - - - - - - - Window title: - - - - - - - - Is Not Important - - - - - Contains - - - - - Is - - - - - Matches Regular Expression - - - - - Does Not Contain - - - - - Is Not - - - - - Does Not Match Regular Expression - - - - - - - - Window class: - - - - - - - - Is Not Important - - - - - Contains - - - - - Is - - - - - Matches Regular Expression - - - - - Does Not Contain - - - - - Is Not - - - - - Does Not Match Regular Expression - - - - - - - - Window role: - - - - - - - - Is Not Important - - - - - Contains - - - - - Is - - - - - Matches Regular Expression - - - - - Does Not Contain - - - - - Is Not - - - - - Does Not Match Regular Expression - - - - - - - - false - - - - - - - false - - - - - - - false - - - - - - - - - - - - &Autodetect - - - - - - - - - - Window Types - - - - - - Normal - - - - - - - Desktop - - - - - - - Dialog - - - - - - - Dock - - - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
-
- -
diff --git a/khotkeys/kcm_hotkeys/helper_widgets/window_selector.cpp b/khotkeys/kcm_hotkeys/helper_widgets/window_selector.cpp deleted file mode 100644 index 74d11901..00000000 --- a/khotkeys/kcm_hotkeys/helper_widgets/window_selector.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 2003 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#define WINDOWSELECTOR_CPP - -#include "helper_widgets/window_selector.h" - -#include -#include - -#include - -#include -#include -#include - -namespace KHotKeys -{ - -WindowSelector::WindowSelector( QObject* receiver_P, const char* slot_P ) - { - connect( this, SIGNAL(selected_signal(WId)), receiver_P, slot_P ); - } - -void WindowSelector::select() - { - kapp->desktop()->grabMouse( QCursor( Qt::CrossCursor )); - kapp->installX11EventFilter( this ); - } - -bool WindowSelector::x11Event( XEvent* e ) - { - if( e->type != ButtonPress ) - return false; - kapp->desktop()->releaseMouse(); - if( e->xbutton.button == Button1 ) - { - WId window = findRealWindow( e->xbutton.subwindow ); - if( window ) - selected_signal( window ); - } - delete this; - return true; - } - -WId WindowSelector::findRealWindow( WId w, int depth ) - { - if( depth > 5 ) - return None; - static Atom wm_state = XInternAtom( QX11Info::display(), "WM_STATE", False ); - Atom type; - int format; - unsigned long nitems, after; - unsigned char* prop; - if( XGetWindowProperty( QX11Info::display(), w, wm_state, 0, 0, False, AnyPropertyType, - &type, &format, &nitems, &after, &prop ) == Success ) - { - if( prop != NULL ) - XFree( prop ); - if( type != None ) - return w; - } - Window root, parent; - Window* children; - unsigned int nchildren; - Window ret = None; - if( XQueryTree( QX11Info::display(), w, &root, &parent, &children, &nchildren ) != 0 ) - { - for( unsigned int i = 0; - i < nchildren && ret == None; - ++i ) - ret = findRealWindow( children[ i ], depth + 1 ); - if( children != NULL ) - XFree( children ); - } - return ret; -} - - -} // namespace KHotKeys - -#include "moc_window_selector.cpp" diff --git a/khotkeys/kcm_hotkeys/helper_widgets/window_selector.h b/khotkeys/kcm_hotkeys/helper_widgets/window_selector.h deleted file mode 100644 index e9f14662..00000000 --- a/khotkeys/kcm_hotkeys/helper_widgets/window_selector.h +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 2003 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef WINDOWSELECTOR_H -#define WINDOWSELECTOR_H - -#include - -namespace KHotKeys -{ - -class WindowSelector : public QWidget - { - Q_OBJECT - - public: - WindowSelector( QObject* receiver, const char* slot ); - void select(); - protected: - virtual bool x11Event( XEvent* e ); - Q_SIGNALS: - void selected_signal( WId w ); - private: - WId findRealWindow( WId w, int depth = 0 ); - }; - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/kcm_hotkeys/hotkeys_context_menu.cpp b/khotkeys/kcm_hotkeys/hotkeys_context_menu.cpp deleted file mode 100644 index 624f85a2..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_context_menu.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "hotkeys_tree_view.h" -#include "hotkeys_context_menu.h" -#include "hotkeys_export_widget.h" - -#include "hotkeys_model.h" - -#include "actions/actions.h" -#include "action_data/action_data_group.h" -#include "action_data/simple_action_data.h" - -#include -#include -#include -#include - -#include -#include - - -HotkeysTreeViewContextMenu::HotkeysTreeViewContextMenu( const QModelIndex &index, HotkeysTreeView *parent ) - : QMenu(parent) - ,_index(index) - ,_view(parent) - { - setTitle( i18n("Test") ); - - connect(this, SIGNAL(aboutToShow()), - SLOT(slotAboutToShow())); - } - - -HotkeysTreeViewContextMenu::HotkeysTreeViewContextMenu( HotkeysTreeView *parent ) - : QMenu(parent) - ,_index() - ,_view(parent) - { - setTitle( i18n("Test") ); - - connect(this, SIGNAL(aboutToShow()), - SLOT(slotAboutToShowForCurrent())); - } - - -HotkeysTreeViewContextMenu::~HotkeysTreeViewContextMenu() - {} - - -KHotKeys::Action * -HotkeysTreeViewContextMenu::createActionFromType( - int actionType, - KHotKeys::SimpleActionData* data - ) const - { - KHotKeys::Action *action = NULL; - switch (actionType) - { - case KHotKeys::Action::CommandUrlActionType: - action = new KHotKeys::CommandUrlAction( data ); - break; - - case KHotKeys::Action::DBusActionType: - action = new KHotKeys::DBusAction( data ); - break; - - case KHotKeys::Action::KeyboardInputActionType: - action = new KHotKeys::KeyboardInputAction( data ); - break; - - case KHotKeys::Action::MenuEntryActionType: - action = new KHotKeys::MenuEntryAction( data ); - break; - - default: - Q_ASSERT(false); - return NULL; - } - - data->set_action(action); - return action; - } - - -void HotkeysTreeViewContextMenu::slotAboutToShowForCurrent() - { - _index = _view->currentIndex(); - - slotAboutToShow(); - } - - -void HotkeysTreeViewContextMenu::slotAboutToShow() - { - clear(); - - if (_index.isValid()) - { - KHotKeys::ActionDataBase *element = _view->model()->indexToActionDataBase(_index); - KHotKeys::ActionDataGroup *group = _view->model()->indexToActionDataGroup(_index); - bool isGroup = group; // Is the current element a group - if (!isGroup) - { - group = element->parent(); - } - - // Create the create actions - createTriggerMenus(group->allowedTriggerTypes(), group->allowedActionTypes()); - - // It is not allowed to create a subgroup for a system group. - if (!group->is_system_group()) - { - addAction( i18n("New Group") , this, SLOT(newGroupAction()) ); - } - - // It is not allowed to delete a system group - if (!(isGroup && group->is_system_group())) - { - // Item related actions - addAction( i18n("Delete"), this, SLOT(deleteAction()) ); - } - } - else - { - createTriggerMenus(KHotKeys::Trigger::AllTypes, KHotKeys::Action::AllTypes); - addAction( i18n("New Group") , this, SLOT(newGroupAction()) ); - } - - addSeparator(); - addAction( i18n("Export Group..."), this, SLOT(exportAction()) ); - addAction( i18n("Import..."), this, SLOT(importAction()) ); - } - - -void HotkeysTreeViewContextMenu::createTriggerMenus( - KHotKeys::Trigger::TriggerTypes triggerTypes, - KHotKeys::Action::ActionTypes actionTypes) - { - QMenu *newMenu = new QMenu(i18nc("@title:menu create various trigger types", "New")); - - if (triggerTypes & KHotKeys::Trigger::ShortcutTriggerType) - { - QSignalMapper *mapper = new QSignalMapper(this); - - QMenu *menu = new QMenu( i18n("Global Shortcut") ); - populateTriggerMenu(menu, mapper, actionTypes); - newMenu->addMenu(menu); - - connect( - mapper, SIGNAL(mapped(int)), - this, SLOT(newGlobalShortcutActionAction(int)) ); - } - - if (triggerTypes & KHotKeys::Trigger::WindowTriggerType) - { - QSignalMapper *mapper = new QSignalMapper(this); - - QMenu *menu = new QMenu( i18n("Window Action") ); - populateTriggerMenu(menu, mapper, actionTypes); - newMenu->addMenu(menu); - - connect( - mapper, SIGNAL(mapped(int)), - this, SLOT(newWindowTriggerActionAction(int)) ); - } - - addMenu(newMenu); - } - - -void HotkeysTreeViewContextMenu::importAction() - { - KUrl url = KFileDialog::getOpenFileName(KUrl(), "*.khotkeys", this); - if (!url.isEmpty()) - { - KConfig config(url.path(), KConfig::SimpleConfig); - _view->model()->importInputActions(_index, config); - } - } - - -void HotkeysTreeViewContextMenu::exportAction() - { - KHotkeysExportDialog *widget = new KHotkeysExportDialog(this); - - KHotKeys::ActionDataGroup *group = _view->model()->indexToActionDataGroup(_index); - if (!group) - group = _view->model()->indexToActionDataBase(_index)->parent(); - - widget->setImportId(group->importId()); - widget->setAllowMerging(group->allowMerging()); - - if (widget->exec() == QDialog::Accepted) - { - KHotKeys::ActionState state; - switch (widget->state()) - { - case 0: - state = KHotKeys::Retain; - break; - - case 1: - state = KHotKeys::Enabled; - break; - - case 2: - state = KHotKeys::Disabled; - break; - - default: - // Unknown value alled to our ui file. Use disabled as a - // default. - Q_ASSERT(false); - state = KHotKeys::Disabled; - break; - } - - QString id = widget->importId(); - KUrl url = widget->url(); - bool allowMerging = widget->allowMerging(); - if (!url.isEmpty()) - { - KConfig config(url.path(), KConfig::SimpleConfig); - _view->model()->exportInputActions(_index, config, id, state, allowMerging); - } - } - delete widget; - } - - -void HotkeysTreeViewContextMenu::populateTriggerMenu( - QMenu *menu, - QSignalMapper *mapper, - KHotKeys::Action::ActionTypes types) - { - if (types & KHotKeys::Action::CommandUrlActionType) - { - mapper->setMapping( - menu->addAction( i18n("Command/URL"), mapper, SLOT(map()) ), - KHotKeys::Action::CommandUrlActionType ); - } - - if (types & KHotKeys::Action::DBusActionType) - { - mapper->setMapping( - menu->addAction( i18n("D-Bus Command"), mapper, SLOT(map()) ), - KHotKeys::Action::DBusActionType ); - } - - if (types & KHotKeys::Action::MenuEntryActionType) - { - mapper->setMapping( - menu->addAction( i18n("K-Menu Entry"), mapper, SLOT(map()) ), - KHotKeys::Action::MenuEntryActionType ); - } - - if (types & KHotKeys::Action::KeyboardInputActionType) - { - mapper->setMapping( - menu->addAction( i18n("Send Keyboard Input"), mapper, SLOT(map()) ), - KHotKeys::Action::KeyboardInputActionType ); - } - } - - -void HotkeysTreeViewContextMenu::newGlobalShortcutActionAction( int actionType ) - { - QModelIndex parent; // == root element - if (!_index.isValid() - || _view->model()->data( _index.sibling( _index.row(), KHotkeysModel::IsGroupColumn)).toBool()) - { - // if the index is invalid (root index) or represents an group use it. - parent = _index; - } - else - { - // It is an action. Take the parent. - parent = _index.parent(); - } - - KHotKeys::SimpleActionData *data = - new KHotKeys::SimpleActionData( 0, i18n("New Action"), i18n("Comment")); - data->set_trigger( new KHotKeys::ShortcutTrigger( data, KShortcut() ) ); - data->enable(); - - createActionFromType(actionType, data); - - QModelIndex newAct = _view->model()->insertActionData(data, parent); - _view->setCurrentIndex(newAct); - _view->edit(newAct); - _view->resizeColumnToContents(KHotkeysModel::NameColumn); - } - - -void HotkeysTreeViewContextMenu::newWindowTriggerActionAction( int actionType ) - { - QModelIndex parent; // == root element - if (!_index.isValid() - || _view->model()->data( _index.sibling( _index.row(), KHotkeysModel::IsGroupColumn)).toBool()) - { - // if the index is invalid (root index) or represents an group use it. - parent = _index; - } - else - { - // It is an action. Take the parent. - parent = _index.parent(); - } - - KHotKeys::SimpleActionData *data = - new KHotKeys::SimpleActionData( 0, i18n("New Action"), i18n("Comment")); - data->set_trigger( new KHotKeys::WindowTrigger(data) ); - data->enable(); - - createActionFromType(actionType, data); - - QModelIndex newAct = _view->model()->insertActionData(data, parent); - _view->setCurrentIndex(newAct); - _view->edit(newAct); - _view->resizeColumnToContents(KHotkeysModel::NameColumn); - } - - -void HotkeysTreeViewContextMenu::newGroupAction() - { - QModelIndex parent; // == root element - if (!_index.isValid() - || _view->model()->data( _index.sibling( _index.row(), KHotkeysModel::IsGroupColumn)).toBool()) - { - // if the index is invalid (root index) or represents an group use it. - parent = _index; - } - else - { - // It is an action. Take the parent. - parent = _index.parent(); - } - - QModelIndex newGroup = _view->model()->addGroup(parent); - _view->setCurrentIndex(newGroup); - _view->edit(newGroup); - _view->resizeColumnToContents(KHotkeysModel::NameColumn); - } - - -void HotkeysTreeViewContextMenu::deleteAction() - { - if (!_index.isValid()) - { - Q_ASSERT( _index.isValid() ); - return; - } - - bool deletionSuccess; - deletionSuccess = _view->model()->removeRow(_index.row(), _index.parent()); - Q_ASSERT(deletionSuccess == true); - Q_UNUSED(deletionSuccess); - - _view->setCurrentIndex(QModelIndex()); - } - - -#include "moc_hotkeys_context_menu.cpp" - diff --git a/khotkeys/kcm_hotkeys/hotkeys_context_menu.h b/khotkeys/kcm_hotkeys/hotkeys_context_menu.h deleted file mode 100644 index 4b0aa56f..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_context_menu.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef HOTKEYS_CONTEXT_MENU_H -#define HOTKEYS_CONTEXT_MENU_H -/** - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "triggers/triggers.h" -#include "actions/actions.h" - -#include "libkhotkeysfwd.h" - -#include -#include - - -class HotkeysTreeView; - -#include -#include - - -class HotkeysTreeViewContextMenu : public QMenu - { - Q_OBJECT - -public: - - HotkeysTreeViewContextMenu( const QModelIndex &index, HotkeysTreeView *parent = 0 ); - HotkeysTreeViewContextMenu( HotkeysTreeView *parent = 0 ); - - virtual ~HotkeysTreeViewContextMenu(); - - //! Create a submenu per allowed trigger type - void createTriggerMenus( - KHotKeys::Trigger::TriggerTypes triggerTypes, - KHotKeys::Action::ActionTypes actionTypes); - - //! Populate a trigger menu - void populateTriggerMenu(QMenu *menu, QSignalMapper *mapper, KHotKeys::Action::ActionTypes types); - -private Q_SLOTS: - - void slotAboutToShow(); - void slotAboutToShowForCurrent(); - void deleteAction(); - - void exportAction(); - void importAction(); - - void newGlobalShortcutActionAction(int); - void newWindowTriggerActionAction(int); - void newGroupAction(); - -private: - - KHotKeys::Action* createActionFromType( - int type, - KHotKeys::SimpleActionData *data) const; - - QModelIndex _index; - HotkeysTreeView *_view; - }; - - - -#endif /* HOTKEYS_CONTEXT_MENU_H */ - diff --git a/khotkeys/kcm_hotkeys/hotkeys_export_widget.cpp b/khotkeys/kcm_hotkeys/hotkeys_export_widget.cpp deleted file mode 100644 index bed20a67..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_export_widget.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "hotkeys_export_widget.h" - -#include - -KHotkeysExportWidget::KHotkeysExportWidget(QWidget *parent) - : QWidget(parent) - { - ui.setupUi(this); - } - - -KHotkeysExportWidget::~KHotkeysExportWidget() - { - } - - -KHotkeysExportDialog::KHotkeysExportDialog(QWidget *parent) - : KDialog(parent) - { - setCaption(i18n("Export Group")); - setButtons(KDialog::Ok | KDialog::Cancel); - - w = new KHotkeysExportWidget(this); - setMainWidget(w); - } - - -KHotkeysExportDialog::~KHotkeysExportDialog() - {} - - -bool -KHotkeysExportDialog::allowMerging() const - { - return w->ui.allowMerging->isChecked(); - } - - -QString -KHotkeysExportDialog::importId() const - { - return w->ui.id->text(); - } - - -void -KHotkeysExportDialog::setAllowMerging(bool allow) - { - w->ui.allowMerging->setChecked(allow); - } - - -void -KHotkeysExportDialog::setImportId(const QString &id) - { - w->ui.id->setText(id); - } - - -int -KHotkeysExportDialog::state() const - { - return w->ui.state->currentIndex(); - } - - -KUrl -KHotkeysExportDialog::url() const - { - return w->ui.filename->url(); - } - - -#include "moc_hotkeys_export_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/hotkeys_export_widget.h b/khotkeys/kcm_hotkeys/hotkeys_export_widget.h deleted file mode 100644 index fd9583ef..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_export_widget.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef HOTKEYS_EXPORT_WIDGET_H -#define HOTKEYS_EXPORT_WIDGET_H -/** - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "ui_hotkeys_export_widget.h" - -#include "kdialog.h" -#include "kurl.h" - -#include - - -/** - * @author Michael Jansen - */ -class KHotkeysExportWidget : public QWidget - { - Q_OBJECT - -public: - - KHotkeysExportWidget(QWidget *parent); - virtual ~KHotkeysExportWidget(); - - // The layout - Ui::KHotkeysExportWidget ui; - - }; // KHotkeysExportWidget - -/** - * @author Michael Jansen - */ -class KHotkeysExportDialog : public KDialog - { -public: - KHotkeysExportDialog(QWidget*); - virtual ~KHotkeysExportDialog(); - - QString importId() const; - - bool allowMerging() const; - void setAllowMerging(bool); - void setImportId(const QString &id); - int state() const; - KUrl url() const; - -private: - - KHotkeysExportWidget *w; - }; // KHotkeysExportDialog - - -#endif /* HOTKEYS_EXPORT_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/hotkeys_export_widget.ui b/khotkeys/kcm_hotkeys/hotkeys_export_widget.ui deleted file mode 100644 index 021cfaa6..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_export_widget.ui +++ /dev/null @@ -1,165 +0,0 @@ - - - KHotkeysExportWidget - - - - 0 - 0 - 587 - 128 - - - - - - - Change the exported state for the actions. - - - Export Actions - - - state - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Configure in which state the actions should be exported.</p> -<p style=" margin-top:8px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Actual State</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:30px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Export the actions in their current state.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Disabled</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:30px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Export the actions in a disabled state.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Enabled</p> -<p style=" margin-top:0px; margin-bottom:8px; margin-left:30px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Export the actions in an enabled state.</p></body></html> - - - - Actual State - - - - - Enabled - - - - - Disabled - - - - - - - - KHotkeys file id. - - - A khotkeys file id is used to ensure files are not imported more than once. They are mostly used for automatic updates from the KDE developers. - - - Id - - - id - - - - - - - Set import id for file, or leave empty - - - - - - - Filename - - - filename - - - - - - - *.khotkeys - - - KFile::File - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Allow Merging - - - allowMerging - - - - - - - Merge into existing directories on import? - - - Allow merging of content if a directory with the same name exists on importing. If merging is not allowed, there will be two directories with the same name. - - - - - - - - - - - KUrlRequester - QFrame -
kurlrequester.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
-
- - state - id - allowMerging - filename - - -
diff --git a/khotkeys/kcm_hotkeys/hotkeys_model.cpp b/khotkeys/kcm_hotkeys/hotkeys_model.cpp deleted file mode 100644 index bfc3abff..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_model.cpp +++ /dev/null @@ -1,712 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "hotkeys_model.h" - -#include "action_data/simple_action_data.h" -#include "action_data/menuentry_shortcut_action_data.h" -#include "action_data/action_data_group.h" - -#include - -#include - -#include -#include -#include - - -static KHotKeys::ActionDataBase *findElement( - void *ptr - ,KHotKeys::ActionDataGroup *root) - { - Q_ASSERT(root); - if (!root) return NULL; - - KHotKeys::ActionDataBase *match = NULL; - - Q_FOREACH( KHotKeys::ActionDataBase *element, root->children()) - { - if (ptr == element) - { - match = element; - break; - } - - if (KHotKeys::ActionDataGroup *subGroup = dynamic_cast(element)) - { - match = findElement(ptr, subGroup); - if (match) break; - } - } - - return match; - } - - - -KHotkeysModel::KHotkeysModel( QObject *parent ) - : QAbstractItemModel(parent) - ,_settings() - ,_actions(0) - {} - - -KHotkeysModel::~KHotkeysModel() - { - } - - -QModelIndex KHotkeysModel::addGroup( const QModelIndex & parent ) - { - KHotKeys::ActionDataGroup *list; - if (parent.isValid()) - { - list = indexToActionDataGroup(parent); - } - else - { - list = _actions; - } - Q_ASSERT(list); - - beginInsertRows( parent, list->size(), list->size() ); - - /* KHotKeys:: ActionDataGroup *action = */ - new KHotKeys::ActionDataGroup( list, i18n("New Group"), i18n("Comment")); - - endInsertRows(); - return index( list->size()-1, NameColumn, parent ); - } - - -// Add a group -QModelIndex KHotkeysModel::insertActionData( KHotKeys::ActionDataBase *data, const QModelIndex & parent ) - { - Q_ASSERT(data); - - KHotKeys::ActionDataGroup *list; - if (parent.isValid()) - { - list = indexToActionDataGroup(parent); - } - else - { - list = _actions; - } - Q_ASSERT(list); - - beginInsertRows( parent, list->size(), list->size() ); - - list->add_child(data); - - endInsertRows(); - return index( list->size()-1, NameColumn, parent ); - } - - -int KHotkeysModel::columnCount( const QModelIndex & ) const - { - return 2; - } - - -QVariant KHotkeysModel::data( const QModelIndex &index, int role ) const - { - // Check that the index is valid - if (!index.isValid()) - { - return QVariant(); - } - - // Get the item behind the index - KHotKeys::ActionDataBase *action = indexToActionDataBase(index); - Q_ASSERT(action); - - // Handle CheckStateRole - if (role==Qt::CheckStateRole) - { - switch(index.column()) - { - case EnabledColumn: - // If the parent is enabled we display the state of the object. - // If the parent is disabled this object is disabled too. - if (action->parent() && !action->parent()->isEnabled()) - { - return Qt::Unchecked; - } - return action->isEnabled() - ? Qt::Checked - : Qt::Unchecked; - - default: - return QVariant(); - } - } - - // Display and Tooltip. Tooltip displays the complete name. That's nice if - // there is not enough space - else if (role==Qt::DisplayRole || role==Qt::ToolTipRole) - { - switch (index.column()) - { - case NameColumn: - return action->name(); - - case EnabledColumn: - return QVariant(); - - case IsGroupColumn: - return indexToActionDataGroup(index)!=0; - - case TypeColumn: - { - const std::type_info &ti = typeid(*action); - if (ti==typeid(KHotKeys::SimpleActionData)) - return KHotkeysModel::SimpleActionData; - else if (ti==typeid(KHotKeys::MenuEntryShortcutActionData)) - return KHotkeysModel::SimpleActionData; - else if (ti==typeid(KHotKeys::ActionDataGroup)) - return KHotkeysModel::ActionDataGroup; - else - return KHotkeysModel::Other; - } - - default: - return QVariant(); - } - } - - // Decoration role - else if (role==Qt::DecorationRole) - { - switch (index.column()) - { - // The 0 is correct here. We want to decorate that column - // regardless of the content it has - case 0: - return dynamic_cast(action) - ? KIcon("folder") - : QVariant(); - - default: - return QVariant(); - } - } - - //Providing the current action name on edit - else if (role==Qt::EditRole) - { - switch (index.column()) - { - case NameColumn: - return action->name(); - - default: - return QVariant(); - } - } - - else if (role==Qt::ForegroundRole) - { - QPalette pal; - switch (index.column()) - { - case NameColumn: - if (!action->isEnabled()) - { - return pal.color(QPalette::Disabled, QPalette::Foreground); - } - - default: - return QVariant(); - } - } - - // For everything else - return QVariant(); - } - - -bool KHotkeysModel::dropMimeData( - const QMimeData *data - ,Qt::DropAction action - ,int row - ,int column - ,const QModelIndex &parent) - { - Q_UNUSED(column); - - // We only support move actions and our own mime type - if ( (action!=Qt::CopyAction) - || !data->hasFormat("application/x-pointer")) - { - kDebug() << "Drop not supported " << data->formats(); - return false; - } - - // Decode the stream - QByteArray encodedData = data->data("application/x-pointer"); - QDataStream stream(&encodedData, QIODevice::ReadOnly); - QList ptrs; - while (!stream.atEnd()) - { - qulonglong ptr; - stream >> ptr; - ptrs << quintptr(ptr); - } - - // No pointers, nothing to do - if (ptrs.empty()) return false; - - // Get the group we have to drop into. If the drop target is no group get - // it's parent and drop behind it - int position = row; - QModelIndex dropIndex = parent; - KHotKeys::ActionDataGroup *dropToGroup = indexToActionDataGroup(dropIndex); - if (!dropToGroup) - { - dropIndex = parent.parent(); - dropToGroup = indexToActionDataGroup(dropIndex); - position = dropToGroup->children().indexOf(indexToActionDataBase(parent)); - } - - if (position==-1) - { - position = dropToGroup->size(); - } - - // Do the moves - Q_FOREACH(quintptr ptr, ptrs) - { - KHotKeys::ActionDataBase *element = findElement( - reinterpret_cast(ptr), - _actions); - - if (element) moveElement(element, dropToGroup, position); - } - - return true; - } - - -void KHotkeysModel::emitChanged(KHotKeys::ActionDataBase *item) - { - Q_ASSERT( item ); - - KHotKeys::ActionDataGroup *parent = item->parent(); - QModelIndex topLeft; - QModelIndex bottomRight; - if (!parent) - { - topLeft = createIndex( 0, 0, _actions ); - bottomRight = createIndex( 0, 0, _actions ); - } - else - { - int row = parent->children().indexOf(item); - topLeft = createIndex( row, 0, parent ); - bottomRight = createIndex( row, columnCount(topLeft), parent ); - } - - emit dataChanged( topLeft, bottomRight ); - } - - -void KHotkeysModel::exportInputActions( - const QModelIndex &index, - KConfigBase &config, - const QString& id, - const KHotKeys::ActionState state, - bool mergingAllowed) - { - KHotKeys::ActionDataBase *element = indexToActionDataBase(index); - KHotKeys::ActionDataGroup *group = indexToActionDataGroup(index); - - settings()->exportTo( - group ? group : element->parent(), - config, - id, - state, - mergingAllowed); - } - - -Qt::ItemFlags KHotkeysModel::flags( const QModelIndex &index ) const - { - Qt::ItemFlags flags = QAbstractItemModel::flags(index); - - Q_ASSERT(!(flags & Qt::ItemIsDropEnabled)); - Q_ASSERT(!(flags & Qt::ItemIsDragEnabled)); - - if (!index.isValid()) - { - return flags | Qt::ItemIsDropEnabled; - } - - KHotKeys::ActionDataBase *element = indexToActionDataBase(index); - KHotKeys::ActionDataGroup *actionGroup = indexToActionDataGroup(index); - if (!actionGroup) actionGroup = element->parent(); - - Q_ASSERT(element); - Q_ASSERT(actionGroup); - - // We do not allow dragging for system groups and their elements - // We do not allow dropping into systemgroups - if (!actionGroup->is_system_group()) - { - flags |= Qt::ItemIsDragEnabled; - flags |= Qt::ItemIsDropEnabled; - } - - // Show a checkbox in column 1 whatever is shown there. - switch (index.column()) - { - case 1: - return flags - | Qt::ItemIsUserCheckable; - - default: - return flags - | Qt::ItemIsEditable; - } - } - - -// Get header data for section -QVariant KHotkeysModel::headerData( int section, Qt::Orientation, int role ) const - { - if (role!=Qt::DisplayRole) - { - return QVariant(); - } - - switch (section) - { - case NameColumn: - return QVariant(i18nc("action name", "Name")); - - case EnabledColumn: - return QVariant(); - return QVariant(i18nc("action enabled", "Enabled")); - - case IsGroupColumn: - return QVariant(i18n("Type")); - - default: - return QVariant(); - } - } - - -void KHotkeysModel::importInputActions(const QModelIndex &index, KConfigBase const &config) - { - KHotKeys::ActionDataGroup *group = indexToActionDataGroup(index); - QModelIndex groupIndex = index; - if (!group) - { - group = indexToActionDataBase(index)->parent(); - groupIndex = index.parent(); - } - - if (settings()->importFrom(group, config, KHotKeys::ImportAsk, KHotKeys::Retain)) - { - kDebug(); - reset(); - save(); - } - } - - -QModelIndex KHotkeysModel::index( int row, int column, const QModelIndex &parent ) const - { - KHotKeys::ActionDataGroup *actionGroup = indexToActionDataGroup(parent); - if (!actionGroup || row>=actionGroup->children().size() ) - { - return QModelIndex(); - } - - KHotKeys::ActionDataBase *action = actionGroup->children().at(row); - Q_ASSERT( action ); - return createIndex( row, column, action ); - } - - -// Convert index to ActionDataBase -KHotKeys::ActionDataBase *KHotkeysModel::indexToActionDataBase( const QModelIndex &index ) const - { - if (!index.isValid()) - { - return _actions; - } - return static_cast( index.internalPointer() ); - } - - -// Convert index to ActionDataGroup -KHotKeys::ActionDataGroup *KHotkeysModel::indexToActionDataGroup( const QModelIndex &index ) const - { - if (!index.isValid()) - { - return _actions; - } - return dynamic_cast( indexToActionDataBase(index) ); - } - - -void KHotkeysModel::load() - { - _settings.reread_settings(true); - _actions = _settings.actions(); - reset(); - } - - -QMimeData *KHotkeysModel::mimeData(const QModelIndexList &indexes) const - { - QMimeData * mimeData = new QMimeData(); - QByteArray encodedData; - - QDataStream stream(&encodedData, QIODevice::WriteOnly); - - Q_FOREACH (const QModelIndex &index, indexes) - { - if (index.isValid() and index.column() == 0) - { - KHotKeys::ActionDataBase *element = indexToActionDataBase(index); - // We use the pointer as id. - stream << qulonglong(reinterpret_cast(element)); - } - } - - mimeData->setData("application/x-pointer", encodedData); - return mimeData; - } - - -QStringList KHotkeysModel::mimeTypes() const - { - QStringList types; - types << "application/x-pointer"; - return types; - } - - -bool KHotkeysModel::moveElement( - KHotKeys::ActionDataBase *element - ,KHotKeys::ActionDataGroup *newGroup - ,int position) - { - Q_ASSERT(element && newGroup); - if (!element || !newGroup) return false; - - // TODO: Make this logic more advanced - // We do not allow moving into our systemgroup - if (newGroup->is_system_group()) return false; - - // Make sure we don't move a group to one of it's children or - // itself. - KHotKeys::ActionDataGroup *tmp = newGroup; - do { - if (tmp == element) - { - kDebug() << "Forbidden move" << tmp->name(); - return false; - } - } - while((tmp = tmp->parent())); - - KHotKeys::ActionDataGroup *oldParent = element->parent(); - - // TODO: Make this logic more advanced - // We do not allow moving from our systemgroup - if (oldParent->is_system_group()) return false; - - // Adjust position if oldParent and newGroup are identical - if (oldParent == newGroup) - { - if (oldParent->children().indexOf(element) < position) - { - --position; - } - } - - emit layoutAboutToBeChanged(); - - // Remove it from it's current place - oldParent->remove_child(element); - newGroup->add_child(element, position); - - emit layoutChanged(); - - return true; - } - - -// Get parent object for index -QModelIndex KHotkeysModel::parent( const QModelIndex &index ) const - { - KHotKeys::ActionDataBase *action = indexToActionDataBase(index); - if (!action) - { - return QModelIndex(); - } - - KHotKeys::ActionDataGroup *parent = action->parent(); - if (!parent) - { - return QModelIndex(); - } - - KHotKeys::ActionDataGroup *grandparent = parent->parent(); - if (!grandparent) - { - return QModelIndex(); - } - - int row = grandparent->children().indexOf(parent); - return createIndex( row, 0, parent ); - } - - -// Remove rows ( items ) -bool KHotkeysModel::removeRows( int row, int count, const QModelIndex &parent ) - { - Q_ASSERT( count == 1 ); - - beginRemoveRows( parent, row, row+count-1 ); - - KHotKeys::ActionDataGroup *list; - if (parent.isValid()) - { - list = indexToActionDataGroup(parent); - } - else - { - list = _actions; - } - Q_ASSERT(list); - Q_UNUSED(list); - - KHotKeys::ActionDataBase *action = indexToActionDataBase(index(row,0,parent)); - - action->aboutToBeErased(); - delete action; - - endRemoveRows(); - return true; - } - - -// Number of rows for index -int KHotkeysModel::rowCount( const QModelIndex &index ) const - { - KHotKeys::ActionDataGroup *group = indexToActionDataGroup(index); - if (!group) - { - return 0; - } - - return group->children().count(); - } - - -void KHotkeysModel::save() - { - _settings.write(); - } - - -// Set data -bool KHotkeysModel::setData( const QModelIndex &index, const QVariant &value, int role ) - { - - if ( !index.isValid() ) - { - return false; - } - - KHotKeys::ActionDataBase *action = indexToActionDataBase(index); - Q_ASSERT( action ); - - // Handle CheckStateRole - if ( role == Qt::CheckStateRole ) - { - switch(index.column()) - { - case EnabledColumn: - { - // If the parent is enabled we display the state of the object. - // If the parent is disabled this object is disabled too. - if (action->parent() && !action->parent()->isEnabled()) - { - // TODO: Either show a message box or enhance the gui to - // show this item cannot be enabled - return false; - } - - value.toInt() == Qt::Checked - ? action->enable() - : action->disable(); - - // If this is a group we have to inform the view that all our - // childs have changed. They are all disabled now - KHotKeys::ActionDataGroup *actionGroup = indexToActionDataGroup(index); - if (actionGroup && actionGroup->size()) - { - Q_EMIT dataChanged( - createIndex(0, 0, actionGroup), - createIndex(actionGroup->size(), columnCount(index), actionGroup)); - } - } - break; - - default: - return false; - } - } - else if ( role == Qt::EditRole ) - { - switch ( index.column() ) - { - case NameColumn: - { - action->set_name( value.toString() ); - } - break; - - default: - return false; - } - } - else - return false; - - emit dataChanged( index, index ); - return true; - } - - -KHotKeys::Settings *KHotkeysModel::settings() - { - return &_settings; - } - - -#include "moc_hotkeys_model.cpp" diff --git a/khotkeys/kcm_hotkeys/hotkeys_model.h b/khotkeys/kcm_hotkeys/hotkeys_model.h deleted file mode 100644 index 06846bac..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_model.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KHOTKEYSMODEL_H -#define KHOTKEYSMODEL_H - -#include "libkhotkeysfwd.h" -#include "settings.h" - -#include - - -/** - */ -class KHotkeysModel : public QAbstractItemModel - { - Q_OBJECT - - public: - - enum ItemType { - Other //!< Some unknown action type - ,ActionDataGroup //!< A shortcut group - ,SimpleActionData - }; - - enum Column { - NameColumn, - EnabledColumn, - IsGroupColumn, - TypeColumn }; - - /** - * Default constructor - * - * @param - */ - KHotkeysModel( QObject *parent = 0 ); - - /** - * Destructor - */ - virtual ~KHotkeysModel(); - - /** - * \group Qt Model/View Framework methods - */ - //@{ - QModelIndex index( int, int, const QModelIndex &parent = QModelIndex() ) const; - QModelIndex parent( const QModelIndex &index ) const; - int rowCount( const QModelIndex &index ) const; - int columnCount( const QModelIndex &index ) const; - QVariant headerData( int section, Qt::Orientation, int role = Qt::DisplayRole ) const; - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - bool setData( const QModelIndex &index, const QVariant &value, int role ); - Qt::ItemFlags flags( const QModelIndex &index ) const; - //@} - - /** - * \group Drag and Drop Support - */ - //@{ - bool dropMimeData( - const QMimeData *data - ,Qt::DropAction action - ,int row - ,int column - ,const QModelIndex &parent); - QMimeData *mimeData(const QModelIndexList &indexes) const; - QStringList mimeTypes() const; - //@} - - /** - * Add a group as child of @a parent. - * - * @return the index for the new group - */ - QModelIndex addGroup( const QModelIndex &parent ); - - /** - * Export the input actions into @a config. - */ - void exportInputActions( - const QModelIndex &index, - KConfigBase &config, - const QString& id, - const KHotKeys::ActionState state, - bool allowMerging); - - /** - *Import the input actions from @a config. - */ - void importInputActions(const QModelIndex &index, KConfigBase const &config); - - /** - * Get the KHotKeys::ActionDataBase behind the index. - */ - KHotKeys::ActionDataBase *indexToActionDataBase( const QModelIndex &index ) const; - - /** - * Get the KHotKeys::ActionDataBase behind the index or 0. - * - * Getting 0 doesn't mean the index is invalid. It means you provided a - * action object. - */ - KHotKeys::ActionDataGroup *indexToActionDataGroup( const QModelIndex &index ) const; - - /** - * Insert @a data as a child of @a parent. - */ - QModelIndex insertActionData( KHotKeys::ActionDataBase *data, const QModelIndex &parent ); - - /** - * Load the settings from the file - */ - void load(); - - /** - * Move @p element to @p newGroup at @position. - * - * @param element move this element - * @param newGroup to this group - * @param position and put it at this position. default is last - * - * @return @c true if moved, @c false if not. - */ - bool moveElement( - KHotKeys::ActionDataBase *element - ,KHotKeys::ActionDataGroup *newGroup - ,int position = -1); - - /** - * Remove @a count rows starting with @a row under @a parent. - */ - bool removeRows( int row, int count, const QModelIndex &parent ); - - /** - * Save the settings to the file - */ - void save(); - - /** - * Return the settings we handle - */ - KHotKeys::Settings *settings(); - - void emitChanged( KHotKeys::ActionDataBase *item ); - - private: - - KHotKeys::Settings _settings; - KHotKeys::ActionDataGroup *_actions; - -}; - -#endif /* #ifndef KHOTKEYSMODEL_HPP */ diff --git a/khotkeys/kcm_hotkeys/hotkeys_proxy_model.cpp b/khotkeys/kcm_hotkeys/hotkeys_proxy_model.cpp deleted file mode 100644 index a4b422c8..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_proxy_model.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "hotkeys_proxy_model.h" -#include "hotkeys_model.h" - - -class KHotkeysProxyModelPrivate - { -public: - KHotkeysProxyModelPrivate( KHotkeysProxyModel *host ); - - //! Our host - KHotkeysProxyModel *q; - - }; // class KHotkeysProxyModelPrivate - - -KHotkeysProxyModelPrivate::KHotkeysProxyModelPrivate( KHotkeysProxyModel *host ) - : q(host) - {} - - - -KHotkeysProxyModel::KHotkeysProxyModel( QObject *parent ) - : QSortFilterProxyModel(parent) - ,d( new KHotkeysProxyModelPrivate(this) ) - {} - - -KHotkeysProxyModel::~KHotkeysProxyModel() - { - delete d; d=0; - } - - -bool KHotkeysProxyModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const - { - Q_UNUSED(source_row); - Q_UNUSED(source_parent); - return true; - } - - -// Convert index to ActionDataBase -KHotKeys::ActionDataBase *KHotkeysProxyModel::indexToActionDataBase( const QModelIndex &index ) const - { - return sourceModel()->indexToActionDataBase( mapToSource(index) ); - } - - -// Convert index to ActionDataGroup -KHotKeys::ActionDataGroup *KHotkeysProxyModel::indexToActionDataGroup( const QModelIndex &index ) const - { - return sourceModel()->indexToActionDataGroup( mapToSource(index) ); - } - - -// Return the source model -KHotkeysModel *KHotkeysProxyModel::sourceModel() const - { - return static_cast( QSortFilterProxyModel::sourceModel() ); - } - - -#include "moc_hotkeys_proxy_model.cpp" diff --git a/khotkeys/kcm_hotkeys/hotkeys_proxy_model.h b/khotkeys/kcm_hotkeys/hotkeys_proxy_model.h deleted file mode 100644 index e48c1299..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_proxy_model.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KHOTKEYSPROXYMODEL_H -#define KHOTKEYSPROXYMODEL_H - -#include "libkhotkeysfwd.h" - -#include - - - -class KHotkeysProxyModelPrivate; -class KHotkeysModel; - - -/** - * @author Michael Jansen - */ -class KHotkeysProxyModel : public QSortFilterProxyModel - { - Q_OBJECT - - public: - - /** - * Default constructor - */ - KHotkeysProxyModel( QObject *parent ); - - /** - * Destructor - */ - virtual ~KHotkeysProxyModel(); - - /** - * Returns true if the item in column @a column should be included in - * the model. - */ - bool filterAcceptsRow( int source_column, const QModelIndex &source_parent ) const; - - /** - * Get the KHotKeys::ActionDataBase behind the index. - */ - KHotKeys::ActionDataBase *indexToActionDataBase( const QModelIndex &index ) const; - - /** - * Get the KHotKeys::ActionDataBase behind the index or 0. - * - * Getting 0 doesn't mean the index is invalid. It means you provided a - * action object. - */ - KHotKeys::ActionDataGroup *indexToActionDataGroup( const QModelIndex &index ) const; - - /** - * Return the source model. Casted to the correct class. - */ - KHotkeysModel *sourceModel() const; - - private: - - //! Implementation details - KHotkeysProxyModelPrivate *d; -}; - -#endif /* #ifndef KHOTKEYSPROXYMODEL_HPP */ diff --git a/khotkeys/kcm_hotkeys/hotkeys_tree_view.cpp b/khotkeys/kcm_hotkeys/hotkeys_tree_view.cpp deleted file mode 100644 index d7120e17..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_tree_view.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "hotkeys_tree_view.h" -#include "hotkeys_context_menu.h" - -#include "hotkeys_model.h" - -#include "actions/actions.h" -#include "action_data/action_data_group.h" -#include "action_data/simple_action_data.h" - -#include -#include - -#include - - -HotkeysTreeView::HotkeysTreeView( QWidget *parent ) - : QTreeView(parent) - { - setObjectName("khotkeys treeview"); - setAllColumnsShowFocus(true); - setDragEnabled(true); - setAcceptDrops(true); - setDropIndicatorShown(true); - } - - -HotkeysTreeView::~HotkeysTreeView() - {} - - -void -HotkeysTreeView::contextMenuEvent( QContextMenuEvent *event ) - { - QModelIndex index = indexAt(event->pos()); - // KHotKeys::ActionDataBase *item = model()->indexToActionDataBase(index); - HotkeysTreeViewContextMenu menu( index, this ); - menu.exec(event->globalPos()); - } - - -void -HotkeysTreeView::modelReset() - { - resizeColumnToContents(KHotkeysModel::NameColumn); - } - - -KHotkeysModel *HotkeysTreeView::model() - { - return dynamic_cast( QTreeView::model() ); - } - - -void -HotkeysTreeView::setModel( QAbstractItemModel *model ) - { - if (!dynamic_cast( model )) - { - Q_ASSERT(dynamic_cast( model )); - return; - } - QTreeView::setModel(model); - - setAllColumnsShowFocus(true); - setAlternatingRowColors(true); - - setSelectionBehavior( QAbstractItemView::SelectRows ); - setSelectionMode( QAbstractItemView::SingleSelection ); - - connect( - model, SIGNAL(modelReset()), - this, SLOT(modelReset())); - - resizeColumnToContents(KHotkeysModel::EnabledColumn); - resizeColumnToContents(KHotkeysModel::NameColumn); - } - -#include "moc_hotkeys_tree_view.cpp" diff --git a/khotkeys/kcm_hotkeys/hotkeys_tree_view.h b/khotkeys/kcm_hotkeys/hotkeys_tree_view.h deleted file mode 100644 index a3ba60e5..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_tree_view.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef HOTKEYS_TREE_VIEW_H -#define HOTKEYS_TREE_VIEW_H - -#include "libkhotkeysfwd.h" - -#include "triggers/triggers.h" -#include "actions/actions.h" - -#include -#include - - -#include - -class KHotkeysModel; - -/** - * @author Michael Jansen - */ -class HotkeysTreeView : public QTreeView - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - HotkeysTreeView( QWidget *parent = 0 ); - - /** - * Destructor - */ - virtual ~HotkeysTreeView(); - - /** - * The user requested a context menu - */ - void contextMenuEvent( QContextMenuEvent *event ); - - /** - * Set a new model - */ - void setModel( QAbstractItemModel *model ); - KHotkeysModel *model(); - -private Q_SLOTS: - - void modelReset(); - -}; - - -#endif /* #ifndef HOTKEYS_TREE_VIEW_H */ diff --git a/khotkeys/kcm_hotkeys/hotkeys_widget_base.cpp b/khotkeys/kcm_hotkeys/hotkeys_widget_base.cpp deleted file mode 100644 index b1429fbb..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_widget_base.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "hotkeys_widget_base.h" - -#include "action_data/action_data_group.h" - -#include - - -HotkeysWidgetBase::HotkeysWidgetBase( QWidget *parent ) - : HotkeysWidgetIFace(parent) - { - ui.setupUi( this ); - - connect( - ui.comment, SIGNAL(textChanged()), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(ui.comment, "comment" ); - } - - -HotkeysWidgetBase::~HotkeysWidgetBase() - { - } - - -void HotkeysWidgetBase::apply() - { - HotkeysWidgetIFace::apply(); - emit changed(_data); - } - - -void HotkeysWidgetBase::extend(QWidget *w, const QString &label) - { - ui.tabs->addTab(w, label); - } - - -bool HotkeysWidgetBase::isChanged() const - { - return _data->comment() != ui.comment->toPlainText(); - } - - -void HotkeysWidgetBase::doCopyFromObject() - { - ui.comment->setText( _data->comment() ); - } - - -void HotkeysWidgetBase::doCopyToObject() - { - _data->set_comment( ui.comment->toPlainText() ); - } - - -#include "moc_hotkeys_widget_base.cpp" diff --git a/khotkeys/kcm_hotkeys/hotkeys_widget_base.h b/khotkeys/kcm_hotkeys/hotkeys_widget_base.h deleted file mode 100644 index 343230e9..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_widget_base.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef HOTKEYS_WIDGET_BASE_H -#define HOTKEYS_WIDGET_BASE_H - -#include "ui_hotkeys_widget_base.h" - - -#include "hotkeys_widget_iface.h" -#include "libkhotkeysfwd.h" - - -class HotkeysWidgetBasePrivate; - - -/** - * @author Michael Jansen - */ -class HotkeysWidgetBase : public HotkeysWidgetIFace - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - HotkeysWidgetBase( QWidget *parent = 0 ); - - /** - * Destructor - */ - virtual ~HotkeysWidgetBase(); - - virtual void apply(); - - /** - * The associated action. - */ - KHotKeys::ActionDataBase *data() - { - return _data; - } - - const KHotKeys::ActionDataBase *data() const - { - return _data; - } - - virtual bool isChanged() const; - - using HotkeysWidgetIFace::changed; - -Q_SIGNALS: - - void changed(KHotKeys::ActionDataBase*); - -protected: - -#if 0 - /** - * Append the QLayoutItems from QGridLayout \from to QGridLayout \to. - */ - void mergeLayouts( QGridLayout *to, QGridLayout *from ); -#endif - -protected: - - void extend(QWidget*, const QString &); - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - - Ui::HotkeysWidgetBase ui; - - KHotKeys::ActionDataBase *_data; -}; - -#endif /* #ifndef HOTKEYS_WIDGET_BASE_H */ diff --git a/khotkeys/kcm_hotkeys/hotkeys_widget_base.ui b/khotkeys/kcm_hotkeys/hotkeys_widget_base.ui deleted file mode 100644 index 6ab68ed5..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_widget_base.ui +++ /dev/null @@ -1,46 +0,0 @@ - - HotkeysWidgetBase - - - - 0 - 0 - 800 - 799 - - - - - 0 - - - - - 0 - - - - Comment - - - - 0 - - - - - - - - - - - - - KTextEdit - QTextEdit -
ktextedit.h
-
-
- -
diff --git a/khotkeys/kcm_hotkeys/hotkeys_widget_iface.cpp b/khotkeys/kcm_hotkeys/hotkeys_widget_iface.cpp deleted file mode 100644 index 4887854b..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_widget_iface.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "hotkeys_widget_iface.h" - - -HotkeysWidgetIFace::HotkeysWidgetIFace( QWidget *parent ) - : QWidget(parent) - ,_changedSignals(new QSignalMapper(this)) - { - // Listen to the signal mapper, but not yet - connect( - _changedSignals, SIGNAL(mapped(QString)), - this, SLOT(slotChanged(QString)) ); - _changedSignals->blockSignals(true); - } - - -HotkeysWidgetIFace::~HotkeysWidgetIFace() - {} - - -void HotkeysWidgetIFace::apply() - { - copyToObject(); - } - - -void HotkeysWidgetIFace::copyFromObject() - { - _changedSignals->blockSignals(true); - doCopyFromObject(); - _changedSignals->blockSignals(false); - } - -void HotkeysWidgetIFace::copyToObject() - { - doCopyToObject(); - } - - -void HotkeysWidgetIFace::slotChanged( const QString & /* what */ ) - { - emit changed(isChanged()); - } - - - - -#include "moc_hotkeys_widget_iface.cpp" diff --git a/khotkeys/kcm_hotkeys/hotkeys_widget_iface.h b/khotkeys/kcm_hotkeys/hotkeys_widget_iface.h deleted file mode 100644 index cba76d58..00000000 --- a/khotkeys/kcm_hotkeys/hotkeys_widget_iface.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef HOTKEYS_WIDGET_IFACE -#define HOTKEYS_WIDGET_IFACE - -#include "libkhotkeysfwd.h" - - -#include -#include - - -/** - * @author Michael Jansen - */ -class HotkeysWidgetIFace : public QWidget - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - HotkeysWidgetIFace( QWidget *parent = 0 ); - - /** - * Destructor - */ - virtual ~HotkeysWidgetIFace(); - - virtual bool isChanged() const = 0; - void copyFromObject(); - void copyToObject(); - - virtual void apply(); - -Q_SIGNALS: - - void changed(bool) const; - -public Q_SLOTS: - - void slotChanged(const QString &what = "Nothing" ); - - -protected: - - QSignalMapper *_changedSignals; - - virtual void doCopyFromObject() = 0; - virtual void doCopyToObject() = 0; - -}; - -#endif /* #ifndef HOTKEYS_WIDGET_BASE_H */ - diff --git a/khotkeys/kcm_hotkeys/kcm_hotkeys.cpp b/khotkeys/kcm_hotkeys/kcm_hotkeys.cpp deleted file mode 100644 index 38c133d1..00000000 --- a/khotkeys/kcm_hotkeys/kcm_hotkeys.cpp +++ /dev/null @@ -1,438 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "kcm_hotkeys.h" -#include "hotkeys_context_menu.h" -#include "ui_kcm_hotkeys.h" -#include "kcm_module_factory.h" - -#include - - -// ACTION_DATAS -#include "action_data/action_data_group.h" -// OUR ACTION WIDGETS -#include "action_group_widget.h" -#include "simple_action_data_widget.h" -#include "global_settings_widget.h" -// REST -#include "daemon/daemon.h" -#include "khotkeys_interface.h" -#include "hotkeys_model.h" -#include "hotkeys_proxy_model.h" -#include "hotkeys_tree_view.h" -#include "khotkeysglobal.h" - -#include - -#include -#include -#include -#include -#include -#include -#include - - - -class KCMHotkeysPrivate : public Ui::KCMHotkeysWidget - { - public: - - KCMHotkeysPrivate( KCMHotkeys *host ); - - /** The model holding the shortcut settings. Beware! There is a proxy - * model between us and that model */ - KHotkeysModel *model; - - //! Our host - KCMHotkeys *q; - - //! The currently shown dialog - HotkeysWidgetIFace *current; - - //! The currently shown item - QModelIndex currentIndex; - - /** - * Show the widget. If the current widget has changes allow - * cancelation ! of this action - */ - bool maybeShowWidget(const QModelIndex &next); - - /** - * Applies the changes from the current item - */ - void applyCurrentItem(); - - /** - * A Hotkey was changed. Update the treeview. - */ - void _k_hotkeyChanged(KHotKeys::ActionDataBase*); - - /** - * Activate the current item. The method is needed because of qt bug - */ - void _k_activateCurrentItem(); - - void load(); - void save(); - }; - - -KCMHotkeys::KCMHotkeys( QWidget *parent, const QVariantList & /* args */ ) - : KCModule( KCMModuleFactory::componentData(), parent ) - ,d( new KCMHotkeysPrivate(this) ) - { - // Inform KCModule of the buttons we support - KCModule::setButtons(KCModule::Buttons(KCModule::Default | KCModule::Apply | KCModule::Help)); - - // Add the about data - KAboutData *about = new KAboutData( - "khotkeys", - 0, - ki18n("KDE Hotkeys Configuration Module"), - KDE_VERSION_STRING, - KLocalizedString(), - KAboutData::License_GPL, - ki18n("Copyright 2008 (c) Michael Jansen") - ); - about->addAuthor( - ki18n("Michael Jansen"), - ki18n("Maintainer"), - "kde@michael-jansen.biz" ); - setAboutData(about); - - // Tell KCModule we were changed. - connect( - d->action_group, SIGNAL(changed(bool)), - this, SIGNAL(changed(bool)) ); - connect( - d->simple_action, SIGNAL(changed(bool)), - this, SIGNAL(changed(bool)) ); - connect( - d->global_settings, SIGNAL(changed(bool)), - this, SIGNAL(changed(bool)) ); - // Update TreeView if hotkeys was changed - connect( - d->simple_action, SIGNAL(changed(KHotKeys::ActionDataBase*)), - this, SLOT(_k_hotkeyChanged(KHotKeys::ActionDataBase*))); - connect( - d->action_group, SIGNAL(changed(KHotKeys::ActionDataBase*)), - this, SLOT(_k_hotkeyChanged(KHotKeys::ActionDataBase*))); - - // Show the context menu - d->menu_button->setMenu(new HotkeysTreeViewContextMenu(d->tree_view)); - - // Switch to the global settings dialog - connect(d->settings_button, SIGNAL(clicked(bool)), - SLOT(showGlobalSettings())); - } - - -void KCMHotkeys::currentChanged( const QModelIndex &pCurrent, const QModelIndex &pPrevious ) - { - // We're not interested in changes of columns. Just compare the rows - QModelIndex current = - pCurrent.isValid() - ? pCurrent.sibling( pCurrent.row(), 0 ) - : QModelIndex(); - QModelIndex previous = - pPrevious.isValid() - ? pPrevious.sibling( pPrevious.row(), 0 ) - : QModelIndex(); - - // Now it's possible for previous and current to be the same - if (current==previous || current==d->currentIndex) - { - return; - } - - // Current and previous differ. Ask user if there are unsaved changes - if ( !d->maybeShowWidget(current) ) - { - // Bring focus back to the current item - d->tree_view->selectionModel()->setCurrentIndex( - d->currentIndex, - QItemSelectionModel::SelectCurrent); - - // See http://www.qtsoftware.com/developer/task-tracker/index_html?method=entry&id=132516 - QTimer::singleShot(0, this, SLOT(_k_activateCurrentItem())); - return; - } - - if (!current.isValid()) - { - return showGlobalSettings(); - } - - // Now go on and activate the new item; - KHotKeys::ActionDataBase *item = d->model->indexToActionDataBase( current ); - QModelIndex typeOfIndex = d->model->index( current.row(), KHotkeysModel::TypeColumn, current.parent() ); - - switch (d->model->data( typeOfIndex ).toInt()) - { - - case KHotkeysModel::SimpleActionData: - { - KHotKeys::SimpleActionData *data = dynamic_cast(item); - if (data) - { - d->simple_action->setActionData( data ); - d->current = d->simple_action; - } - } - break; - - case KHotkeysModel::ActionDataGroup: - { - KHotKeys::ActionDataGroup *group = dynamic_cast(item); - if (group) - { - d->action_group->setActionData( group ); - d->current = d->action_group; - } - } - break; - - default: - { - const std::type_info &ti = typeid(*item); - kDebug() << "##### Unknown ActionDataType " << ti.name(); - } - - } // switch - - d->currentIndex = current; - d->stack->setCurrentWidget( d->current ); - } - - -KCMHotkeys::~KCMHotkeys() - { - delete d; d=0; - } - - -void KCMHotkeys::defaults() - { - kWarning() << "not yet implemented!"; - } - - -void KCMHotkeys::load() - { - showGlobalSettings(); - d->load(); - } - - -void KCMHotkeys::showGlobalSettings() - { - d->current = d->global_settings; - d->currentIndex = QModelIndex(); - - d->tree_view->setCurrentIndex(d->currentIndex); - d->global_settings->copyFromObject(); - d->stack->setCurrentWidget( d->global_settings ); - } - - -void KCMHotkeys::slotChanged() - { - emit changed(true); - } - - -void KCMHotkeys::slotReset() - { - showGlobalSettings(); - } - - -void KCMHotkeys::save() - { - d->save(); - emit changed(false); - } - - -// ========================================================================== -// KCMHotkeysPrivate - - -KCMHotkeysPrivate::KCMHotkeysPrivate( KCMHotkeys *host ) - : Ui::KCMHotkeysWidget() - ,model(NULL) - ,q(host) - ,current(NULL) - { - setupUi(q); - - // Initialize the global part of the khotkeys lib ( handler ... ) - KHotKeys::init_global_data(false, q); - } - - -void KCMHotkeysPrivate::load() - { - // Start khotkeys - KHotKeys::Daemon::start(); - - // disconnect the signals - if (tree_view->selectionModel()) - { - QObject::disconnect( - tree_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), - q, SLOT(currentChanged(QModelIndex,QModelIndex)) ); - } - - // Create a new model; - tree_view->setModel(new KHotkeysModel); - // Delete the old - delete model; - // Now use the old - model = tree_view->model(); - - model->load(); - global_settings->setModel(model); - - QObject::connect( - model, SIGNAL(rowsRemoved(QModelIndex,int,int)), - q, SLOT(slotChanged())); - QObject::connect( - model, SIGNAL(rowsInserted(QModelIndex,int,int)), - q, SLOT(slotChanged())); - QObject::connect( - model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - q, SLOT(slotChanged())); - - QObject::connect( - model, SIGNAL(modelAboutToBeReset()), - q, SLOT(slotReset())); - - // reconnect the signals - QObject::connect( - tree_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), - q, SLOT(currentChanged(QModelIndex,QModelIndex)) ); - } - - -bool KCMHotkeysPrivate::maybeShowWidget(const QModelIndex &nextIndex) - { - kDebug(); - - // If the current widget is changed, ask user if switch is ok - if (current && (currentIndex != nextIndex) && current->isChanged()) - { - int choice = KMessageBox::warningContinueCancel( - q, - i18n("The current action has unsaved changes. If you continue these changes will be lost."), - i18n("Save changes") ); - if (choice != KMessageBox::Continue) - { - return false; - } - // Apply the changes from the current item - //applyCurrentItem(); - //save(); - } - return true; - } - - -void KCMHotkeysPrivate::save() - { - if (current) - applyCurrentItem(); - - // Write the settings - model->save(); - - if (!KHotKeys::Daemon::isRunning()) - { - if (!KHotKeys::Daemon::start()) - { - // On startup the demon does the updating stuff, therefore reload - // the actions. - model->load(); - } - else - { - KMessageBox::error( - q, - "" + i18n("Unable to contact khotkeys. Your changes are saved, but they could not be activated.") + "" ); - } - - return; - } - - // Inform kdedkhotkeys demon to reload settings - QDBusConnection bus = QDBusConnection::sessionBus(); - QPointer iface = new OrgKdeKhotkeysInterface( - "org.kde.kded", - "/modules/khotkeys", - bus, - q); - - QDBusError err; - if(!iface->isValid()) - { - err = iface->lastError(); - if (err.isValid()) - { - kError() << err.name() << ":" << err.message(); - } - KMessageBox::error( - q, - "" + i18n("Unable to contact khotkeys. Your changes are saved, but they could not be activated.") + "" ); - return; - } - - // Reread the configuration. We have no possibility to check if it worked. - iface->reread_configuration(); - } - - -void KCMHotkeysPrivate::applyCurrentItem() - { - Q_ASSERT( current ); - // Only save when really changed - if (current->isChanged()) - { - current->apply(); - } - } - - -void KCMHotkeysPrivate::_k_hotkeyChanged(KHotKeys::ActionDataBase* hotkey) - { - model->emitChanged(hotkey); - } - - -void KCMHotkeysPrivate::_k_activateCurrentItem() - { - tree_view->selectionModel()->setCurrentIndex( - tree_view->selectionModel()->currentIndex(), - QItemSelectionModel::SelectCurrent); - } - -#include "moc_kcm_hotkeys.cpp" diff --git a/khotkeys/kcm_hotkeys/kcm_hotkeys.h b/khotkeys/kcm_hotkeys/kcm_hotkeys.h deleted file mode 100644 index 9b0d16b0..00000000 --- a/khotkeys/kcm_hotkeys/kcm_hotkeys.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KCMHOTKEYS_H -#define KCMHOTKEYS_H - -#include - -#include - -class KCMHotkeysPrivate; -#include - -namespace KHotKeys { - class ActionDataBase; -} - -/** - * @brief KCMHotkeys KDE KCM Hotkeys Configuration Module - * @author Michael Jansen - * @date 2008-03-07 - */ -class KCMHotkeys : public KCModule - { - Q_OBJECT - -public: - - /** - * Create the module. - * - * @param parent Parent widget - */ - KCMHotkeys( QWidget *parent, const QVariantList &arg ); - - /** - * Destroy the module - */ - virtual ~KCMHotkeys(); - - /** - * Set all settings back to defaults. - */ - void defaults(); - - /** - * Load all settings. - */ - void load(); - - /** - * Save the settings - */ - void save(); - - - -public Q_SLOTS: - - void slotChanged(); - - void slotReset(); - - /** - * Call when the current item has changed - */ - void currentChanged( const QModelIndex ¤t, const QModelIndex &previous ); - - /** - * Show global settings dialog - */ - void showGlobalSettings(); - -private: - - Q_PRIVATE_SLOT(d, void _k_hotkeyChanged(KHotKeys::ActionDataBase*)) - Q_PRIVATE_SLOT(d, void _k_activateCurrentItem()) - - KCMHotkeysPrivate *d; -}; - -#endif /* #ifndef KCMHOTKEYS_HPP */ diff --git a/khotkeys/kcm_hotkeys/kcm_hotkeys.ui b/khotkeys/kcm_hotkeys/kcm_hotkeys.ui deleted file mode 100644 index d250ca60..00000000 --- a/khotkeys/kcm_hotkeys/kcm_hotkeys.ui +++ /dev/null @@ -1,85 +0,0 @@ - - - KCMHotkeysWidget - - - - 0 - 0 - 631 - 435 - - - - - - - Qt::Horizontal - - - - - - - - - - - - Edit - - - - - - - Settings - - - - - - - - - - - 3 - 0 - - - - - - - - - - - - - HotkeysTreeView - QTreeView -
hotkeys_tree_view.h
-
- - ActionGroupWidget - QWidget -
action_group_widget.h
- 1 -
- - SimpleActionDataWidget - QWidget -
simple_action_data_widget.h
- 1 -
- - GlobalSettingsWidget - QWidget -
global_settings_widget.h
- 1 -
-
- -
diff --git a/khotkeys/kcm_hotkeys/kcm_module_factory.cpp b/khotkeys/kcm_hotkeys/kcm_module_factory.cpp deleted file mode 100644 index 0dbb1550..00000000 --- a/khotkeys/kcm_hotkeys/kcm_module_factory.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kcm_module_factory.h" - -// local -#include "kcm_hotkeys.h" - -// libkhotkeys -#include "daemon/daemon.h" - -// KDE -#include -#include - -K_PLUGIN_FACTORY_DEFINITION( - KCMModuleFactory, - registerPlugin("khotkeys" /*plugin keyword, cf .desktop file*/); - ) -K_EXPORT_PLUGIN(KCMModuleFactory("khotkeys" /*component data name & catalog name*/)) diff --git a/khotkeys/kcm_hotkeys/kcm_module_factory.h b/khotkeys/kcm_hotkeys/kcm_module_factory.h deleted file mode 100644 index 25233744..00000000 --- a/khotkeys/kcm_hotkeys/kcm_module_factory.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef KCM_MODULE_FACTORY_H -#define KCM_MODULE_FACTORY_H -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "kcm_hotkeys.h" - -K_PLUGIN_FACTORY_DECLARATION(KCMModuleFactory) - - -#endif /* #ifndef KCM_MODULE_FACTORY_H */ diff --git a/khotkeys/kcm_hotkeys/khotkeys.desktop b/khotkeys/kcm_hotkeys/khotkeys.desktop deleted file mode 100644 index 89040326..00000000 --- a/khotkeys/kcm_hotkeys/khotkeys.desktop +++ /dev/null @@ -1,187 +0,0 @@ -[Desktop Entry] -Exec=kcmshell4 khotkeys -Icon=preferences-desktop-keyboard-khotkeys -Type=Service -X-KDE-ServiceTypes=KCModule -X-KDE-Library=kcm_hotkeys -X-KDE-PluginKeyword=khotkeys -X-KDE-System-Settings-Parent-Category=shortcuts-and-gestures -X-KDE-ParentApp=kcontrol -X-DocPath=kcontrol/khotkeys/index.html - -Name=Custom Shortcuts -Name[ar]=اختصارات مخصصة -Name[ast]=Accesos rápidos personalizaos -Name[bg]=Потребителски бързи клавиши -Name[bn]=নিজস্ব শর্টকাট -Name[bs]=Posebne prečice -Name[ca]=Dreceres personalitzades -Name[ca@valencia]=Dreceres personalitzades -Name[cs]=Vlastní zkratky -Name[da]=Brugervalgte genveje -Name[de]=Eigene Kurzbefehle -Name[el]=Προσαρμοσμένες συντομεύσεις -Name[en_GB]=Custom Shortcuts -Name[es]=Accesos rápidos personalizados -Name[et]=Kohandatud kiirklahvid -Name[eu]=Lasterbide pertsonalizatuak -Name[fi]=Mukautetut pikatoiminnot -Name[fr]=Raccourcis personnalisés -Name[ga]=Aicearraí Saincheaptha -Name[gl]=Atallos personalizados -Name[he]=קיצורי דרך מותאמים אישית -Name[hr]=Prilagođeni prečaci -Name[hu]=Egyedi billentyűparancsok -Name[ia]=Vias breve adaptabile -Name[id]=Jalan Pintas Suai -Name[is]=Sérsniðnar flýtivísanir -Name[it]=Scorciatoie personalizzate -Name[ja]=カスタムショートカット -Name[kk]=Өзінің тіркесімдері -Name[km]=ផ្លូវកាត់​ផ្ទាល់ខ្លួន -Name[kn]=ಇಚ್ಚೆಯ ಶೀಘ್ರಮಾರ್ಗಗಳು (ಶಾರ್ಟ್ ಕಟ್) -Name[ko]=사용자 정의 바로 가기 -Name[lt]=Spartieji klavišai -Name[lv]=Pielāgoti īsceļi -Name[mr]=ऐच्छिक शॉर्टकट -Name[nb]=Egendefinerte snarveier -Name[nds]=Egen Tastkombinatschonen -Name[nl]=Aangepaste snelkoppelingen -Name[nn]=Tilpassa snarvegar -Name[pa]=ਪਸੰਦੀਦਾ ਸ਼ਾਰਟਕੱਟ -Name[pl]=Własne skróty -Name[pt]=Atalhos Personalizados -Name[pt_BR]=Atalhos personalizados -Name[ro]=Acceleratori personalizați -Name[ru]=Специальные действия -Name[si]=රිසි කෙටි මං -Name[sk]=Vlastné skratky -Name[sl]=Bližnjice po meri -Name[sr]=Посебне пречице -Name[sr@ijekavian]=Посебне пречице -Name[sr@ijekavianlatin]=Posebne prečice -Name[sr@latin]=Posebne prečice -Name[sv]=Egna webbgenvägar -Name[tg]=Истинодҳои интихобӣ -Name[th]=ทางลัดกำหนดเอง -Name[tr]=Özel Kısayollar -Name[ug]=ئىختىيارى تېزلەتمە -Name[uk]=Нетипові скорочення -Name[vi]=Phím tắt tuỳ chỉnh -Name[wa]=Rascourtis da vosse -Name[x-test]=xxCustom Shortcutsxx -Name[zh_CN]=自定义快捷键 -Name[zh_TW]=自訂捷徑 - -Comment=Configure Input Actions settings -Comment[ar]=اضبط إعدادات إجراءات الإدخال -Comment[ast]=Configuración de les preferencies d'aiciones d'entrada -Comment[bg]=Настройване на входящите действия -Comment[bs]=Podešavanje postavki radnji unosa -Comment[ca]=Configura l'arranjament de les accions d'entrada -Comment[ca@valencia]=Configura l'arranjament de les accions d'entrada -Comment[cs]=Nastavení vstupních činností -Comment[csb]=Kònfigùracëjô dzéjaniów weńdzeniô -Comment[da]=Indstilling af input-handlinger -Comment[de]=Eingabe-Aktionen einrichten -Comment[el]=Διαμόρφωση ενεργειών εισόδου -Comment[en_GB]=Configure Input Actions settings -Comment[eo]=Agordo de enigaj agoj -Comment[es]=Configuración de las preferencias de acciones de entrada -Comment[et]=Sisestustoimingute seadistamine -Comment[eu]=Konfiguratu sarrerako ekintzen ezarpenak -Comment[fi]=Syöttötoimintojen asetukset -Comment[fr]=Configurer les paramètres des actions d'entrée -Comment[fy]=Ynfier aksjes ynstelle -Comment[ga]=Cumraigh socruithe na nGníomhartha Ionchurtha -Comment[gl]=Configura as opcións de entrada -Comment[gu]=ઇનપુટ ક્રિયાઓ રૂપરેખાંકિત કરો -Comment[he]=הגדרות פעולות קלט -Comment[hr]=Konfiguriranje postavki ulaznih akcija -Comment[hu]=A beviteli műveletek beállításai -Comment[ia]=Configura preferentias de actiones de insertar -Comment[id]=Atur pengaturan Aksi Masukan -Comment[is]=Stillingar inntaksaðgerða -Comment[it]=Configura le impostazioni delle azioni di immissione -Comment[ja]=入力アクションの設定 -Comment[kk]=Енгізу әрекеттерінің параметрлерін баптау -Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​នៃ​​ការ​កំណត់​សកម្មភាព​បញ្ចូល -Comment[kn]=ಆದಾನ ಕ್ರಿಯೆಗಳ ಸಂಯೋಜನೆಗಳನ್ನು ಸಂರಚಿಸು -Comment[ko]=입력 동작 설정 -Comment[lt]=Konfigūruoti įvedimo veiklų nustatymus -Comment[lv]=Konfigurēt ievades darbību iestatījumus -Comment[mk]=Конфигурирајте ги поставувањата за влезни дејства -Comment[ml]=ഇന്‍പുട്ട് പ്രവര്‍ത്തന സജ്ജീകരണങ്ങള്‍ ക്രമീകരിക്കുക -Comment[mr]=इनपुट क्रिया व्यवस्था संयोजीत करा -Comment[nb]=Sett opp innstillinger for inndata-handlinger -Comment[nds]=Instellen för Ingaavakschonen fastleggen -Comment[nl]=Invoeractieinstellingen configureren -Comment[nn]=Set opp innstillingar for innhandlingar -Comment[pa]=ਇੰਪੁੱਟ ਐਕਸ਼ਨ ਸੈਟਿੰਗ ਸੰਰਚਨਾ -Comment[pl]=Ustawienia działań wejściowych -Comment[pt]=Configurar as opções das Acções de Entrada -Comment[pt_BR]=Configura as opções das ações de entrada -Comment[ro]=Configurează acțiunile de intrare -Comment[ru]=Настройка способов запуска действий -Comment[si]=ආදාන ක්‍රියා සැකසුම් වෙනස් කරන්න -Comment[sk]=Nastavenie vstupných akcií -Comment[sl]=Nastavi vhodna dejanja -Comment[sr]=Подешавање поставки радњи уноса -Comment[sr@ijekavian]=Подешавање поставки радњи уноса -Comment[sr@ijekavianlatin]=Podešavanje postavki radnji unosa -Comment[sr@latin]=Podešavanje postavki radnji unosa -Comment[sv]=Anpassa inställningar av inmatningsåtgärder -Comment[tg]=Танзимоти сабад -Comment[th]=ปรับแต่งการตั้งค่าการกระทำเพื่อป้อนข้อมูล -Comment[tr]=Girdi Eylemleri ayarlarını yapılandır -Comment[ug]=كىرگۈزۈش مەشغۇلات تەڭشەك سەپلىمىسى -Comment[uk]=Налаштування параметрів дій з вводу -Comment[vi]=Cấu hình các thiết lập cho Hành động nhập -Comment[wa]=Apontyî les tchuzes des Faitindjes èn intrêye -Comment[x-test]=xxConfigure Input Actions settingsxx -Comment[zh_CN]=配置输入动作设置 -Comment[zh_TW]=設定輸入動作 -Categories=Qt;KDE;X-KDE-settings-accessibility; - -X-KDE-Keywords=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch -X-KDE-Keywords[bs]=globalni, prečice na tastaturi, učestale tipke, vreleTipke, kVreleTipke, ulazne akcije, kretnje miša, akcije, pokretanja, lansira -X-KDE-Keywords[ca]=global,dreceres de teclat,dreceres de teclat,hotkeys,KHotKeys,accions d'entrada,gestos del ratolí,accions,activadors,llança -X-KDE-Keywords[ca@valencia]=global,dreceres de teclat,dreceres de teclat,hotkeys,KHotKeys,accions d'entrada,gestos del ratolí,accions,activadors,llança -X-KDE-Keywords[da]=globale,tastaturgenveje,genvejstaster,hotkeys,KHotKeys,input-handlinger,musegestusser,handlinger,udløsere,kør -X-KDE-Keywords[de]=global,tastatur,tastenkürzel,kurzbefehle,hot keys,hotkeys,KHotKeys,eingaben,mausgesten,aktionen,auslöser,starten -X-KDE-Keywords[el]=καθολικές,συντομεύσεις πληκτρολογίου,πλήκτρα συντόμευσης,hotkeys,KHotKeys,ενέργειες δεδομένων εισόδου,νεύματα ποντικιού,ενέργειες,ενεργοποιήσεις,εκτελέσεις -X-KDE-Keywords[en_GB]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch -X-KDE-Keywords[es]=global,accesos rápidos de teclado,atajos de teclado,teclas rápidas,KHotKeys,acciones de entrada,gestos del ratón,acciones,disparadores,lanzamiento -X-KDE-Keywords[et]=globaalne,klaviatuur,kiirklahvid,KHotKeys,sisestustoimingud,hiirežestid,toimingud,käivitajad,käivitamine -X-KDE-Keywords[eu]=orokorra,laster-tekla,sarrerako ekintzak,sagu bidezko keinuak, ekintzak, abiarazle, abiarazi -X-KDE-Keywords[fi]=globaali,työpöydänlaajuinen,pikanäppäimet,näppäimistön pikavalinnat,näppäinyhdistelmät,oikotiet,KHotKeys,syöttötoiminnot,hiirieleet,toiminnot,laukaisimet,käynnistys,pikatoiminnot -X-KDE-Keywords[fr]=global, raccourcis clavier, touches de raccourcis, raccourcis, KHotKeys, actions de saisie, mouvement de la souris, actions, déclencheurs, lancer -X-KDE-Keywords[gl]=global,atallos de teclado,atallo,accións de entrada,acenos co rato,accións,disparadores,iniciar,lanzar -X-KDE-Keywords[hu]=globális,gyorsbillentyűk,gyorsbillentyűk,gyorsbillentyűk,KHotKeys,beviteli műveletek,egérmozdulatok,műveletek,triggerek,indítás -X-KDE-Keywords[ia]=global,vias breve de claviero, claves calide,claves calide,KHotKeys, actiones de ingresso,gestos de mus,actiones,discatenator,lancear -X-KDE-Keywords[it]=globale,scorciatoie di tastiera,scorciatoie,KHotKeys,azioni di immissione,gesti del mouse,azioni,attivazione,avvio -X-KDE-Keywords[kk]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch -X-KDE-Keywords[km]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch -X-KDE-Keywords[ko]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch,전역,단축키,키보드 단축키,입력 동작,제스처,마우스 제스처,동작,트리거,실행 -X-KDE-Keywords[mr]=ग्लोबल, की बोर्ड शॉर्टकटस,हॉट कीज, हॉट कीज, के हॉट कीज, इनपुट क्रिया, माऊस इशारे, क्रिया, ट्रीगर्स, लॉन्च -X-KDE-Keywords[nb]=global,tastesnarveier,hurtigtaster,KHotKeys,inndata-handlinger,musebevegelser,handlinger,utløsere,oppstart -X-KDE-Keywords[nds]=Globaal,Tastkombinatschonen,KHotKeys,Ingaavakschonen,Muustekens;Akschonen,Utlösers,starten -X-KDE-Keywords[nl]=globaal,toetsenbordsneltoets,hot-keys,hotkeys,KHotKeys,invoeracties,muisbeweging,acties,triggers,opstarten -X-KDE-Keywords[pl]=globalne,skróty klawiaturowe,gorące klawisze,KHotKeys,działania wejścia, gesty myszy,działania,wyzwalacze,uruchomienie -X-KDE-Keywords[pt]=global,atalhos de teclado,KHotKeys,acções de entrada,gestos do rato,acções,eventos,lançamento -X-KDE-Keywords[pt_BR]=global,atalhos de teclado,KHotKeys,ações de entrada,gestos do mouse,ações,eventos,lançamento,execução -X-KDE-Keywords[ru]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch,глобальные,комбинации клавиш,горячие клавиши,действия,запуск действий,росчерки мышью,запуск -X-KDE-Keywords[sk]=globálne,globálne skratky,horúce klávesy,hotkeys,KHotKeys,vstupné akcie,gestá myši,akcie,spúšťače,spustenie -X-KDE-Keywords[sl]=splošno,tipkovne bližnjice,bližnjice,hitre tipke,khotkeys,vhodna dejanja,vnosna dejanja,kretnje z miško,dejanja,sprožilci,zagon -X-KDE-Keywords[sr]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch,глобалне,пречице са тастатуре,К‑пречице,радње улаза,гестови мишем,радње,окидачи,покретање -X-KDE-Keywords[sr@ijekavian]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch,глобалне,пречице са тастатуре,К‑пречице,радње улаза,гестови мишем,радње,окидачи,покретање -X-KDE-Keywords[sr@ijekavianlatin]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch,globalne,prečice sa tastature,K‑prečice,radnje ulaza,gestovi mišem,radnje,okidači,pokretanje -X-KDE-Keywords[sr@latin]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch,globalne,prečice sa tastature,K‑prečice,radnje ulaza,gestovi mišem,radnje,okidači,pokretanje -X-KDE-Keywords[sv]=global,tangentbordsgenvägar,KHotKeys,indataåtgärder,musgester,åtgärder,avtryckare,start -X-KDE-Keywords[tr]=genel,sistem geneli,klavye kısayolları,KHotKeys,girdi eylemleri,fare hareketleri,eylemler,tetikleyiciler,çalıştır,başlat -X-KDE-Keywords[uk]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch,загальні,глобальні,клавіатура,клавіатурні скорочення,введення,жести,жести мишею,дії,вмикання,запуск -X-KDE-Keywords[x-test]=xxglobal,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launchxx -X-KDE-Keywords[zh_CN]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch,全局,快捷键,热键,输入动作,鼠标手势,动作,触发,启动 -X-KDE-Keywords[zh_TW]=global,keyboard shortcuts,hot keys,hotkeys,KHotKeys,input actions,mouse gestures,actions,triggers,launch - - diff --git a/khotkeys/kcm_hotkeys/simple_action_data_widget.cpp b/khotkeys/kcm_hotkeys/simple_action_data_widget.cpp deleted file mode 100644 index bda8999b..00000000 --- a/khotkeys/kcm_hotkeys/simple_action_data_widget.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "simple_action_data_widget.h" - -#include "actions/command_url_action_widget.h" -#include "actions/dbus_action_widget.h" -#include "actions/menuentry_action_widget.h" -#include "actions/keyboard_input_action_widget.h" -#include "triggers/shortcut_trigger_widget.h" -#include "triggers/window_trigger_widget.h" - -#include - - -SimpleActionDataWidget::SimpleActionDataWidget( QWidget *parent ) - : HotkeysWidgetBase( parent ) - ,currentTrigger(NULL) - ,currentAction(NULL) - {} - - -SimpleActionDataWidget::~SimpleActionDataWidget() - { - delete currentTrigger; - delete currentAction; - } - - -bool SimpleActionDataWidget::isChanged() const - { - return ( currentTrigger && currentTrigger->isChanged() ) - || ( currentAction && currentAction->isChanged() ) - || Base::isChanged(); - } - - -void SimpleActionDataWidget::doCopyFromObject() - { - Base::doCopyFromObject(); - - if (currentTrigger) - { - currentTrigger->copyFromObject(); - } - - if (currentAction) - { - currentAction->copyFromObject(); - } - - } - - -void SimpleActionDataWidget::doCopyToObject() - { - Base::doCopyToObject(); - - if (currentTrigger) - { - currentTrigger->copyToObject(); - } - - if (currentAction) - { - currentAction->copyToObject(); - } - } - - -void SimpleActionDataWidget::setActionData( KHotKeys::SimpleActionData* pData ) - { - _data = pData; - - // Now go and work on the trigger - delete currentTrigger; currentTrigger = NULL; - - if ( KHotKeys::Trigger *trg = data()->trigger() ) - { - switch ( trg->type() ) - { - case KHotKeys::Trigger::ShortcutTriggerType: - kDebug() << "1"; - currentTrigger = new ShortcutTriggerWidget( static_cast(trg) ); - break; - - case KHotKeys::Trigger::WindowTriggerType: - kDebug() << "2"; - currentTrigger = new WindowTriggerWidget( static_cast(trg) ); - break; - - default: - kDebug() << "Unknown trigger type"; - }; - } - - if (currentTrigger ) - { - connect( - currentTrigger, SIGNAL(changed(bool)), - this, SLOT(slotChanged())); - extend(currentTrigger, i18n("Trigger")); - } - - // Now go and work on the action - delete currentAction; currentAction = NULL; - - if ( KHotKeys::Action *act = data()->action() ) - { - switch ( act->type() ) - { - case KHotKeys::Action::MenuEntryActionType: - currentAction = new MenuentryActionWidget( static_cast(act) ); - break; - - case KHotKeys::Action::DBusActionType: - currentAction = new DbusActionWidget( static_cast(act) ); - break; - - case KHotKeys::Action::CommandUrlActionType: - currentAction = new CommandUrlActionWidget( static_cast(act) ); - break; - - case KHotKeys::Action::KeyboardInputActionType: - currentAction = new KeyboardInputActionWidget( static_cast(act) ); - break; - - default: - kDebug() << "Unknown action type"; - }; - } - - if (currentAction ) - { - connect( - currentAction, SIGNAL(changed(bool)), - this, SLOT(slotChanged())); - extend(currentAction, i18n("Action")); - } - - Base::copyFromObject(); - } - - - -#include "moc_simple_action_data_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/simple_action_data_widget.h b/khotkeys/kcm_hotkeys/simple_action_data_widget.h deleted file mode 100644 index 1891f5ca..00000000 --- a/khotkeys/kcm_hotkeys/simple_action_data_widget.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef SIMPLE_ACTION_DATA_WIDGET_H -#define SIMPLE_ACTION_DATA_WIDGET_H - -#include "hotkeys_widget_base.h" - -#include "action_data/simple_action_data.h" - -#include - - -/** - * @author Michael Jansen - */ -class SimpleActionDataWidget : public HotkeysWidgetBase - { - Q_OBJECT - - typedef HotkeysWidgetBase Base; - -public: - - /** - * Default constructor - */ - SimpleActionDataWidget( QWidget *parent = 0 ); - - - /** - * Edit \a action. - */ - void setActionData( KHotKeys::SimpleActionData *action ); - - - KHotKeys::SimpleActionData *data() - { - return static_cast( _data ); - } - - const KHotKeys::SimpleActionData *data() const - { - return static_cast( _data ); - } - - - /** - * Destructor - */ - virtual ~SimpleActionDataWidget(); - - virtual bool isChanged() const; - -protected: - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - -private: - - HotkeysWidgetIFace *currentTrigger; - HotkeysWidgetIFace *currentAction; - -}; - -#endif /* #ifndef SIMPLE_ACTION_DATA_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.cpp b/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.cpp deleted file mode 100644 index c03ff4fc..00000000 --- a/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "shortcut_trigger_widget.h" - -#include "action_data/action_data.h" -#include "triggers/triggers.h" - -#include - -#include - - -ShortcutTriggerWidget::ShortcutTriggerWidget( KHotKeys::ShortcutTrigger *trigger, QWidget *parent ) - : TriggerWidgetBase(trigger, parent) - { - shortcut_trigger_ui.setupUi(this); - - shortcut_trigger_ui.shortcut->setCheckForConflictsAgainst( - // Don't know why that is necessary but it doesn't compile - // without. - KKeySequenceWidget::ShortcutTypes( - KKeySequenceWidget::GlobalShortcuts - | KKeySequenceWidget::StandardShortcuts )); - - connect( - shortcut_trigger_ui.shortcut, SIGNAL(keySequenceChanged(QKeySequence)), - _changedSignals, SLOT(map()) ); - _changedSignals->setMapping(shortcut_trigger_ui.shortcut, "shortcut" ); - - // If the global shortcuts is changed outside of the dialog just copy the - // new key sequencence. It doesn't matter if the user changed the sequence - // here. - connect( - trigger, SIGNAL(globalShortcutChanged(QKeySequence)), - this, SLOT(_k_globalShortcutChanged(QKeySequence)) ); - } - - -ShortcutTriggerWidget::~ShortcutTriggerWidget() - { - } - - -KHotKeys::ShortcutTrigger *ShortcutTriggerWidget::trigger() - { - return static_cast(_trigger); - } - - -const KHotKeys::ShortcutTrigger *ShortcutTriggerWidget::trigger() const - { - return static_cast(_trigger); - } - - -void ShortcutTriggerWidget::doCopyFromObject() - { - Q_ASSERT(trigger()); - shortcut_trigger_ui.shortcut->setKeySequence( trigger()->shortcut().primary() ); - } - - -void ShortcutTriggerWidget::doCopyToObject() - { - Q_ASSERT(trigger()); - trigger()->set_key_sequence( shortcut_trigger_ui.shortcut->keySequence()); - } - - -bool ShortcutTriggerWidget::isChanged() const - { - Q_ASSERT(trigger()); - return trigger()->shortcut().primary() != shortcut_trigger_ui.shortcut->keySequence(); - } - - -void ShortcutTriggerWidget::_k_globalShortcutChanged(const QKeySequence &seq) - { - shortcut_trigger_ui.shortcut->setKeySequence(seq); - } - - -#include "moc_shortcut_trigger_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.h b/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.h deleted file mode 100644 index 25a953f2..00000000 --- a/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef SHORTCUT_TRIGGER_WIDGET_H -#define SHORTCUT_TRIGGER_WIDGET_H -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "trigger_widget_base.h" -#include "ui_shortcut_trigger_widget.h" - -#include - -/** - * @author Michael Jansen - */ -class ShortcutTriggerWidget : public TriggerWidgetBase - { - Q_OBJECT - - typedef TriggerWidgetBase Base; - -public: - - /** - * Default constructor - */ - ShortcutTriggerWidget(KHotKeys::ShortcutTrigger *trigger, QWidget *parent = NULL); - - /** - * Destructor - */ - virtual ~ShortcutTriggerWidget(); - - KHotKeys::ShortcutTrigger *trigger(); - const KHotKeys::ShortcutTrigger *trigger() const; - - - virtual bool isChanged() const; - -private Q_SLOTS: - - //! Invoked if the global shortcut is changed for the corresponding - // shortcut trigger - void _k_globalShortcutChanged(const QKeySequence &); - -private: - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - - - Ui::ShortcutTriggerWidget shortcut_trigger_ui; - -}; - -#endif /* #ifndef SHORTCUT_TRIGGER_WIDGET_H */ diff --git a/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.ui b/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.ui deleted file mode 100644 index 5dad4bcc..00000000 --- a/khotkeys/kcm_hotkeys/triggers/shortcut_trigger_widget.ui +++ /dev/null @@ -1,70 +0,0 @@ - - - ShortcutTriggerWidget - - - - 0 - 0 - 302 - 81 - - - - - - - &Shortcut: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - shortcut - - - - - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - 20 - 6 - - - - - - - - - KKeySequenceWidget - QWidget -
kkeysequencewidget.h
-
-
- -
diff --git a/khotkeys/kcm_hotkeys/triggers/trigger_widget_base.cpp b/khotkeys/kcm_hotkeys/triggers/trigger_widget_base.cpp deleted file mode 100644 index 2e8c53da..00000000 --- a/khotkeys/kcm_hotkeys/triggers/trigger_widget_base.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "trigger_widget_base.h" - - -TriggerWidgetBase::TriggerWidgetBase( KHotKeys::Trigger *trigger, QWidget *parent ) - : HotkeysWidgetIFace(parent) - ,_trigger(trigger) - {} - -TriggerWidgetBase::~TriggerWidgetBase() - {} - -#include "moc_trigger_widget_base.cpp" diff --git a/khotkeys/kcm_hotkeys/triggers/trigger_widget_base.h b/khotkeys/kcm_hotkeys/triggers/trigger_widget_base.h deleted file mode 100644 index 47af24d7..00000000 --- a/khotkeys/kcm_hotkeys/triggers/trigger_widget_base.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TRIGGER_WIDGET_BASE_H -#define TRIGGER_WIDGET_BASE_H - -#include "hotkeys_widget_iface.h" - -#include "libkhotkeysfwd.h" -#include "triggers/triggers.h" - - -/** - * @author Michael Jansen - */ -class TriggerWidgetBase : public HotkeysWidgetIFace - { - Q_OBJECT - -public: - - /** - * Default constructor - */ - - /** - * Destructor - */ - virtual ~TriggerWidgetBase(); - - virtual KHotKeys::Trigger * trigger() { return _trigger; } - virtual const KHotKeys::Trigger * trigger() const { return _trigger; } - -protected: - - TriggerWidgetBase( KHotKeys::Trigger *trigger, QWidget *parent = 0 ); - - KHotKeys::Trigger *_trigger; - - }; - -#endif /* #ifndef TRIGGER_WIDGET_BASE_H */ diff --git a/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.cpp b/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.cpp deleted file mode 100644 index 63fde256..00000000 --- a/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "window_trigger_widget.h" -#include "helper_widgets/window_definition_list_widget.h" -#include "windows_helper/window_selection_list.h" -#include "windows_helper/window_selection_rules.h" - -#include "windows_handler.h" - -#include "kdebug.h" - - -WindowTriggerWidget::WindowTriggerWidget( KHotKeys::WindowTrigger *trigger, QWidget *parent ) - : TriggerWidgetBase(trigger, parent) - ,_windowdef_widget(NULL) - { - window_trigger_ui.setupUi(this); - - if (trigger->windows()->count() == 0) - { - trigger->windows()->insert(0, new KHotKeys::Windowdef_simple("", "")); - } - - QHBoxLayout *layout = new QHBoxLayout(); - _windowdef_widget = new WindowDefinitionListWidget(trigger->windows(), window_trigger_ui.window_group); - layout->addWidget(_windowdef_widget); - window_trigger_ui.window_group->setLayout(layout); - - connect(window_trigger_ui.window_appears, SIGNAL(toggled(bool)), - _changedSignals, SLOT(map())); - _changedSignals->setMapping(window_trigger_ui.window_appears, "appears"); - connect(window_trigger_ui.window_disappears, SIGNAL(toggled(bool)), - _changedSignals, SLOT(map())); - _changedSignals->setMapping(window_trigger_ui.window_disappears, "disappears"); - connect(window_trigger_ui.window_gets_focus, SIGNAL(toggled(bool)), - _changedSignals, SLOT(map())); - _changedSignals->setMapping(window_trigger_ui.window_gets_focus, "gets focus"); - connect(window_trigger_ui.window_lost_focus, SIGNAL(toggled(bool)), - _changedSignals, SLOT(map())); - _changedSignals->setMapping(window_trigger_ui.window_lost_focus, "lost focus"); - - connect(_windowdef_widget, SIGNAL(changed(bool)), - SLOT(slotWindowSelectionChanged(bool))); - } - - -WindowTriggerWidget::~WindowTriggerWidget() - { - } - - -KHotKeys::WindowTrigger *WindowTriggerWidget::trigger() - { - return static_cast(_trigger); - } - - -const KHotKeys::WindowTrigger *WindowTriggerWidget::trigger() const - { - return static_cast(_trigger); - } - - -void WindowTriggerWidget::doCopyFromObject() - { - Q_ASSERT(trigger()); - _windowdef_widget->copyFromObject(); - - window_trigger_ui.window_appears->setChecked( - trigger()->triggers_on(KHotKeys::WindowTrigger::WINDOW_APPEARS)); - window_trigger_ui.window_disappears->setChecked( - trigger()->triggers_on(KHotKeys::WindowTrigger::WINDOW_DISAPPEARS)); - window_trigger_ui.window_gets_focus->setChecked( - trigger()->triggers_on(KHotKeys::WindowTrigger::WINDOW_ACTIVATES)); - window_trigger_ui.window_lost_focus->setChecked( - trigger()->triggers_on(KHotKeys::WindowTrigger::WINDOW_DEACTIVATES)); - } - - -void WindowTriggerWidget::doCopyToObject() - { - Q_ASSERT(trigger()); - _windowdef_widget->copyToObject(); - - KHotKeys::WindowTrigger::WindowEvents events; - if (window_trigger_ui.window_appears->isChecked()) - events |= KHotKeys::WindowTrigger::WINDOW_APPEARS; - if (window_trigger_ui.window_disappears->isChecked()) - events |= KHotKeys::WindowTrigger::WINDOW_DISAPPEARS; - if (window_trigger_ui.window_gets_focus->isChecked()) - events |= KHotKeys::WindowTrigger::WINDOW_ACTIVATES; - if (window_trigger_ui.window_lost_focus->isChecked()) - events |= KHotKeys::WindowTrigger::WINDOW_DEACTIVATES; - - trigger()->setOnWindowEvents(events); - } - - -bool WindowTriggerWidget::isChanged() const - { - Q_ASSERT(trigger()); - - if( window_trigger_ui.window_appears->isChecked() - != trigger()->triggers_on(KHotKeys::WindowTrigger::WINDOW_APPEARS) - || window_trigger_ui.window_disappears->isChecked() - != trigger()->triggers_on(KHotKeys::WindowTrigger::WINDOW_DISAPPEARS) - || window_trigger_ui.window_gets_focus->isChecked() - != trigger()->triggers_on(KHotKeys::WindowTrigger::WINDOW_ACTIVATES) - || window_trigger_ui.window_lost_focus->isChecked() - != trigger()->triggers_on(KHotKeys::WindowTrigger::WINDOW_DEACTIVATES)) - return true; - - return _windowdef_widget->isChanged(); - } - - -void WindowTriggerWidget::slotWindowSelectionChanged(bool isChanged) const - { - emit changed(isChanged); - } - - - -#include "moc_window_trigger_widget.cpp" diff --git a/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.h b/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.h deleted file mode 100644 index c7f770de..00000000 --- a/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef WINDOW_TRIGGER_WIDGET_H -#define WINDOW_TRIGGER_WIDGET_H - -#include "trigger_widget_base.h" - -#include "ui_window_trigger_widget.h" - -#include -class WindowDefinitionListWidget; - -/** - * @author Michael Jansen - */ -class WindowTriggerWidget : public TriggerWidgetBase - { - Q_OBJECT - - typedef TriggerWidgetBase Base; - -public: - - /** - * Default constructor - */ - WindowTriggerWidget( KHotKeys::WindowTrigger *trigger, QWidget *parent = 0 ); - - /** - * Destructor - */ - virtual ~WindowTriggerWidget(); - - KHotKeys::WindowTrigger *trigger(); - const KHotKeys::WindowTrigger *trigger() const; - - - virtual bool isChanged() const; - -private Q_SLOTS: - - void slotWindowSelectionChanged(bool) const; - -private: - - virtual void doCopyFromObject(); - virtual void doCopyToObject(); - - Ui::WindowTriggerWidget window_trigger_ui; - - WindowDefinitionListWidget *_windowdef_widget; - -}; - -#endif /* #ifndef WINDOW_TRIGGER_WIDGET_H */ - diff --git a/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.ui b/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.ui deleted file mode 100644 index 9490c3ed..00000000 --- a/khotkeys/kcm_hotkeys/triggers/window_trigger_widget.ui +++ /dev/null @@ -1,60 +0,0 @@ - - WindowTriggerWidget - - - - 0 - 0 - 400 - 300 - - - - - - - Trigger When - - - - - - Window appears - - - - - - - Window disappears - - - - - - - Window gets focus - - - - - - - Window loses focus - - - - - - - - - - Window - - - - - - - diff --git a/khotkeys/libkhotkeysprivate/CMakeLists.txt b/khotkeys/libkhotkeysprivate/CMakeLists.txt deleted file mode 100644 index 47844168..00000000 --- a/khotkeys/libkhotkeysprivate/CMakeLists.txt +++ /dev/null @@ -1,82 +0,0 @@ -# KHotKey convenience library. Contains -# - Actions -# - Trigger -# - Conditions -# - Some gui stuff - -set(khotkeysprivate_SRCS - - # ACTIONS - actions/action.cpp - actions/action_list.cpp - actions/activate_window_action.cpp - actions/command_url_action.cpp - actions/dbus_action.cpp - actions/keyboard_input_action.cpp - actions/menuentry_action.cpp - - # ACTION DATA - action_data/action_data.cpp - action_data/action_data_base.cpp - action_data/action_data_group.cpp - action_data/generic_action_data.cpp - action_data/menuentry_shortcut_action_data.cpp - action_data/simple_action_data.cpp - - action_data/action_data_visitor.cpp - - # CONDITIONS - conditions/active_window_condition.cpp - conditions/and_condition.cpp - conditions/condition.cpp - conditions/conditions_list_base.cpp - conditions/conditions_list.cpp - conditions/existing_window_condition.cpp - conditions/not_condition.cpp - conditions/or_condition.cpp - conditions/conditions_visitor.cpp - - # TRIGGERS - triggers/shortcut_trigger.cpp - triggers/trigger.cpp - triggers/trigger_list.cpp - triggers/triggers.cpp - triggers/window_trigger.cpp - - # WINDOWS_HELPER - windows_helper/window_selection_rules.cpp - windows_helper/window_selection_list.cpp - windows_helper/window_selection_interface.cpp - - # DAEMON - daemon/daemon.h - daemon/daemon.cpp - - # OTHER - khotkeysglobal.cpp - settings.cpp - settings_reader_v2.cpp - settings_writer.cpp - shortcuts_handler.cpp - windows_handler.cpp -) - -add_library(khotkeysprivate SHARED ${khotkeysprivate_SRCS}) -target_link_libraries(khotkeysprivate - KDE4::kio - ${X11_LIBRARIES} - kworkspace -) -if(X11_XTest_FOUND) - target_link_libraries(khotkeysprivate ${X11_XTest_LIB}) -endif(X11_XTest_FOUND) -set_target_properties(khotkeysprivate PROPERTIES - VERSION ${GENERIC_LIB_VERSION} - SOVERSION ${GENERIC_LIB_SOVERSION} -) -install( - TARGETS khotkeysprivate - DESTINATION ${KDE4_LIB_INSTALL_DIR} - LIBRARY NAMELINK_SKIP -) - diff --git a/khotkeys/libkhotkeysprivate/action_data/action_data.cpp b/khotkeys/libkhotkeysprivate/action_data/action_data.cpp deleted file mode 100644 index e369e70a..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/action_data.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#include "action_data/action_data.h" - -#include "action_data/action_data_visitor.h" -#include "actions/actions.h" -#include "triggers/triggers.h" - -#include -#include - - -namespace KHotKeys -{ - - -ActionData::ActionData( - ActionDataGroup* parent_P, - const QString& name_P, - const QString& comment_P, - Trigger_list* triggers_P, - Condition_list* conditions_P, - ActionList* actions_P) - : ActionDataBase( parent_P, name_P, comment_P, conditions_P), - _triggers( triggers_P ), - _actions( actions_P ) - { - if (!_triggers) - _triggers = new Trigger_list; - - if (!_actions) - _actions = new ActionList; - } - - -void ActionData::accept(ActionDataConstVisitor *visitor) const - { - visitor->visitActionData(this); - } - - -ActionData::~ActionData() - { - delete _triggers; _triggers = NULL; - delete _actions; _actions = NULL; - } - - -void ActionData::accept(ActionDataVisitor *visitor) - { - visitor->visitActionData(this); - } - -void ActionData::doDisable() - { - triggers()->disable(); - update_triggers(); - } - -void ActionData::doEnable() - { - triggers()->enable(); - update_triggers(); - } - - -Trigger_list* ActionData::triggers() - { - return _triggers; - } - - -const Trigger_list* ActionData::triggers() const - { - return _triggers; - } - - -void ActionData::aboutToBeErased() - { - _triggers->aboutToBeErased(); - _actions->aboutToBeErased(); - } - -const ActionList* ActionData::actions() const - { - return _actions; - } - - -ActionList* ActionData::actions() - { - return _actions; - } - - -void ActionData::execute() - { - for( ActionList::Iterator it = _actions->begin(); - it != _actions->end(); - ++it ) - (*it)->execute(); - } - - -void ActionData::add_trigger( Trigger* trigger_P ) - { - _triggers->append( trigger_P ); - } - - -void ActionData::add_triggers( Trigger_list* triggers_P ) - { - while (!triggers_P->isEmpty()) - { - _triggers->append( triggers_P->takeFirst() ); - } - Q_ASSERT( triggers_P->isEmpty()); - delete triggers_P; - } - - -void ActionData::set_triggers( Trigger_list* triggers_P ) - { - if (_triggers) delete _triggers; - - _triggers = triggers_P; - } - - -void ActionData::add_action(Action* action, Action* after) - { - if (after) - { - int index = _actions->indexOf(after); - _actions->insert( - index != -1 - ? index +1 - : _actions->count(), - action); - } - else - { - _actions->append(action); - } - } - - -void ActionData::add_actions( ActionList* actions_P, Action* after_P ) - { - int index = 0; - for( ActionList::Iterator it = _actions->begin(); - it != _actions->end(); - ++it ) - { - ++index; - if( *it == after_P ) - break; - } - - while (!actions_P->empty()) - { - // Insert the actions to _actions after removing them from actions_P - // to prevent their deletion upon delete actions_P below. - _actions->insert( ++index, actions_P->takeFirst() ); - } - Q_ASSERT( actions_P->isEmpty()); - delete actions_P; - } - - -void ActionData::set_actions( ActionList* actions_P ) - { - if (_actions) delete _actions; - _actions = actions_P; - } - - -void ActionData::update_triggers() - { - if (!_triggers) return; - - bool activate = false; - // Activate the triggers if the actions is enabled and the conditions - // match. - if (isEnabled() && conditions_match()) - { - activate = true; - } - - for( Trigger_list::Iterator it = _triggers->begin(); - it != _triggers->end(); - ++it ) - { - (*it)->activate(activate); - } - } - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/action_data/action_data.h b/khotkeys/libkhotkeysprivate/action_data/action_data.h deleted file mode 100644 index 0fbcc5d1..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/action_data.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef ACTION_DATA_H -#define ACTION_DATA_H - -#include "action_data_base.h" - -namespace KHotKeys { - -class Action; -class ActionDataGroup; -class ActionList; -class Trigger_list; -class Trigger; - - -// TODO : code documentation -class KDE_EXPORT ActionData - : public ActionDataBase - { - - typedef ActionDataBase base; - - public: - - ActionData( - ActionDataGroup* parent_P, - const QString& name_P, - const QString& comment_P, - Trigger_list* triggers_P, - Condition_list* conditions_P, - ActionList* actions_P); - - virtual ~ActionData(); - - /** - * Visitor pattern - * @reimp - */ - virtual void accept(ActionDataVisitor *visitor); - virtual void accept(ActionDataConstVisitor *visitor) const; - - virtual void update_triggers(); - - virtual void execute(); - - /** - * @reimp - */ - void aboutToBeErased(); - - const Trigger_list* triggers() const; - Trigger_list* triggers(); - - const ActionList* actions() const; - ActionList* actions(); - - virtual void add_trigger( Trigger* trigger_P ); - - virtual void add_triggers( - Trigger_list* triggers_P ); // Trigger_list instance will be deleted - - virtual void set_triggers( Trigger_list* triggers_P ); - - virtual void add_action( Action* action_P, Action* after_P = 0 ); - - virtual void add_actions( ActionList* actions_P, - Action* after_P = 0 ); // ActionList will be deleted - - virtual void set_actions( ActionList* actions_P ); - - private: - - Trigger_list* _triggers; - ActionList* _actions; - - virtual void doEnable(); - virtual void doDisable(); - }; - - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/action_data/action_data_base.cpp b/khotkeys/libkhotkeysprivate/action_data/action_data_base.cpp deleted file mode 100644 index cf17c703..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/action_data_base.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#include "action_data_base.h" - -#include "action_data/action_data_visitor.h" -#include "action_data/action_data_group.h" - -#include "conditions/conditions_list.h" - -#include -#include - - -namespace KHotKeys -{ - -ActionDataBase::ActionDataBase( - ActionDataGroup* parent_P - ,const QString& name_P - ,const QString& comment_P - ,Condition_list* conditions_P) - : _parent(parent_P) - ,_conditions(conditions_P) - ,_name(name_P) - ,_comment(comment_P) - ,_enabled(false) - ,_importId() - ,_allowMerging(false) - { - if (parent()) parent()->add_child( this ); - - if (!_conditions) - { - _conditions = new Condition_list(QString(), this); - } - else - { - _conditions->set_data( this ); - } - } - - -ActionDataBase::~ActionDataBase() - { - if( parent()) - parent()->remove_child( this ); - delete _conditions; - } - - -void ActionDataBase::accept(ActionDataVisitor *visitor) - { - visitor->visitActionDataBase(this); - } - - -void ActionDataBase::accept(ActionDataConstVisitor *visitor) const - { - visitor->visitActionDataBase(this); - } - - -bool ActionDataBase::cfg_is_enabled(const KConfigGroup& cfg_P ) - { - return cfg_P.readEntry("Enabled", false); - } - - -bool ActionDataBase::allowMerging() const - { - return _allowMerging; - } - - -QString ActionDataBase::comment() const - { - return _comment; - } - - -const Condition_list* ActionDataBase::conditions() const - { - return _conditions; - } - - -Condition_list* ActionDataBase::conditions() - { - return _conditions; - } - - -bool ActionDataBase::conditions_match() const - { - return ( conditions() ? conditions()->match() : true ) - && ( parent() ? parent()->conditions_match() : true ); - } - - -bool ActionDataBase::isEnabled(IgnoreParent ip ) const - { - if( ip == Ignore ) - return _enabled; - else - return _enabled && ( parent() == 0 || parent()->isEnabled()); - } - - -QString ActionDataBase::name() const - { - return _name; - } - - -ActionDataGroup* ActionDataBase::parent() const - { - return _parent; - } - - -void ActionDataBase::setAllowMerging(bool allowMerging) - { - _allowMerging = allowMerging; - } - - -void ActionDataBase::set_comment( const QString &comment ) - { - _comment = comment; - } - - -void ActionDataBase::disable() - { - if (!_enabled) - return; - - _enabled = false; - doDisable(); - } - - -void ActionDataBase::enable() - { - if (_enabled) - return; - - _enabled = true; - - // Enable only if the parent is enabled too - if (isEnabled()) - // FIXME: let doEnable decide if it makes sense to enable (No trigger - // .... ) - doEnable(); - } - - -QString -ActionDataBase::importId() const - { - return _importId; - } - - -void ActionDataBase::set_name( const QString& name_P ) - { - _name = name_P; - } - - -void ActionDataBase::set_conditions(Condition_list* conditions) - { - if (_conditions) - { - delete _conditions; - } - - _conditions = conditions; - } - - -void -ActionDataBase::setImportId(const QString &id) - { - _importId = id; - } - - -} // namespace KHotKeys - -#include "moc_action_data_base.cpp" diff --git a/khotkeys/libkhotkeysprivate/action_data/action_data_base.h b/khotkeys/libkhotkeysprivate/action_data/action_data_base.h deleted file mode 100644 index f81d1627..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/action_data_base.h +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef ACTION_DATA_BASE_H -#define ACTION_DATA_BASE_H - -#include "kdemacros.h" - -#include -#include - - -class KConfigGroup; - - -namespace KHotKeys { - -class ActionDataGroup; -class ActionDataVisitor; -class ActionDataConstVisitor; -class Condition_list; - - -/** - * Base class for all actions. - */ -class KDE_EXPORT ActionDataBase : public QObject - { - Q_OBJECT - - Q_DISABLE_COPY( ActionDataBase ) - - public: - - /** - * Create a action data base object. - * - * \param parent A ActionDataGroup or 0. If provided this action is - * registered with the group. - * \param name Name for the object. - * \param comment Comment for the object. - * \param condition Conditions for the object or 0 - */ - ActionDataBase( - ActionDataGroup* parent, - const QString& name, - const QString& comment, - Condition_list* condition); - - /** - * Destructor - */ - virtual ~ActionDataBase(); - - /** - * Visitor pattern - */ - virtual void accept(ActionDataVisitor *visitor); - virtual void accept(ActionDataConstVisitor *visitor) const; - - /** - * Get the conditions for this action or 0 if the action has no - * conditions. - */ - const Condition_list* conditions() const; - Condition_list* conditions(); - - /** - * Prepare this action for complete removal. - */ - virtual void aboutToBeErased() = 0; - - /** - * Get the \c ActionDataGroup this object belongs to or 0 if it - * does not belong to a group. - */ - ActionDataGroup* parent() const; - - /** - * \todo document this method - */ - virtual void update_triggers() = 0; - - /** - * Check if the conditions match. - */ - bool conditions_match() const; - - //@{ - /** - * Name for the action - */ - QString name() const; - void set_name( const QString& name ); - //@} - - - //@{ - /** - * A comment for this action. - */ - QString comment() const; - void set_comment( const QString &comment ); - //@} - - /** - */ - void setImportId(const QString&); - QString importId() const; - - /** - */ - void setAllowMerging(bool); - bool allowMerging() const; - - /** - * Is the action enabled? - * - * The action has different states. - * - * Absolute State: Has the action an enabled/disabled state? - * Effective State: Even if the action is enabled it's effective state - * is disabled if it's parent is disabled. - */ - enum IgnoreParent - { - Ignore, - DontIgnore - }; - bool isEnabled(IgnoreParent ip = DontIgnore) const; - - /** - * Enable the action. - */ - void enable(); - void disable(); - //@} - - /** - * See if it the config group is enabled. - */ - static bool cfg_is_enabled(const KConfigGroup& cfg); - - //! Set the list of condition for this element - void set_conditions(Condition_list* conditions); - - protected: - - virtual void doEnable() = 0; - - virtual void doDisable() = 0; - - private: - - friend class ActionDataGroup; - - //! The parent or NULL - ActionDataGroup* _parent; - - //! List of conditions for this element - Condition_list* _conditions; - - //! Name for element - QString _name; - - //! The comment for this element - QString _comment; - - //! If this element is enabled - bool _enabled; // is not really important, only used in conf. module and when reading cfg. file - - //! The importId from the file we were imported - QString _importId; - - //! Is it allowed to merge this directory with others. Used when - //exporting and importig the directory - bool _allowMerging; - - }; - - -} // namespace KHotKeys - -#endif // ACTION_DATA_BASE_H diff --git a/khotkeys/libkhotkeysprivate/action_data/action_data_group.cpp b/khotkeys/libkhotkeysprivate/action_data/action_data_group.cpp deleted file mode 100644 index 803c307c..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/action_data_group.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#include "action_data_group.h" - -#include "action_data/action_data_visitor.h" -#include "actions/actions.h" - -#include -#include - - -namespace KHotKeys -{ - -ActionDataGroup::ActionDataGroup( - ActionDataGroup* parent_P, - const QString& name_P, - const QString& comment_P, - Condition_list* conditions_P, - system_group_t system_group_P) - : ActionDataBase(parent_P, name_P, comment_P, conditions_P) - ,_list() - ,_system_group(system_group_P) - {} - - -ActionDataGroup::~ActionDataGroup() - { - while (!_list.isEmpty()) - { - delete _list.takeFirst(); - } - } - - -void ActionDataGroup::accept(ActionDataVisitor *visitor) - { - visitor->visitActionDataGroup(this); - } - - - -void ActionDataGroup::accept(ActionDataConstVisitor *visitor) const - { - visitor->visitActionDataGroup(this); - } - - - -Action::ActionTypes ActionDataGroup::allowedActionTypes() const - { - switch (_system_group) - { - case SYSTEM_MENUENTRIES: - return Action::MenuEntryActionType; - - default: - return Action::AllTypes; - } - } - - -Trigger::TriggerTypes ActionDataGroup::allowedTriggerTypes() const - { - switch (_system_group) - { - case SYSTEM_MENUENTRIES: - return Trigger::ShortcutTriggerType; - - default: - return Trigger::AllTypes; - } - } - - -bool ActionDataGroup::is_system_group() const - { - return _system_group != SYSTEM_NONE and _system_group != SYSTEM_ROOT; - } - - -void ActionDataGroup::set_system_group(system_group_t group) - { - _system_group = group; - } - - -ActionDataGroup::system_group_t ActionDataGroup::system_group() const - { - return _system_group; - } - - -void ActionDataGroup::add_child(ActionDataBase* child_P) - { - // Just make sure we don't get the same child twice - Q_ASSERT(!_list.contains(child_P)); - if (_list.contains(child_P)) return; - - if (child_P->parent()) - { - child_P->parent()->remove_child( child_P ); - } - - child_P->_parent = this; - - _list.append( child_P ); - } - - -void ActionDataGroup::add_child(ActionDataBase* child_P, int position) - { - // Just make sure we don't get the same child twice - Q_ASSERT(!_list.contains(child_P)); - if (_list.contains(child_P)) return; - - if (child_P->parent()) - { - child_P->parent()->remove_child( child_P ); - } - - child_P->_parent = this; - - _list.insert( position, child_P ); - } - - -void ActionDataGroup::aboutToBeErased() - { - Q_FOREACH( ActionDataBase *child, _list) - { - child->aboutToBeErased(); - } - } - - -const QList ActionDataGroup::children() const - { - return _list; - } - - -void ActionDataGroup::doDisable() - { - Q_FOREACH( ActionDataBase *child, _list) - { - child->update_triggers(); - } - } - - -void ActionDataGroup::doEnable() - { - Q_FOREACH( ActionDataBase *child, _list) - { - child->update_triggers(); - } - - } - - -void ActionDataGroup::remove_child( ActionDataBase* child_P ) - { - child_P->_parent = NULL; - _list.removeAll( child_P ); // is not auto-delete - } - - -int ActionDataGroup::size() const - { - return _list.size(); - } - - -void ActionDataGroup::update_triggers() - { - Q_FOREACH(ActionDataBase *child, children()) - { - child->update_triggers(); - } - } - - -} // namespace KHotKeys - -#include "moc_action_data_group.cpp" diff --git a/khotkeys/libkhotkeysprivate/action_data/action_data_group.h b/khotkeys/libkhotkeysprivate/action_data/action_data_group.h deleted file mode 100644 index b54f9700..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/action_data_group.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef ACTION_DATA_GROUP_H -#define ACTION_DATA_GROUP_H - -#include "action_data_base.h" -#include "actions/actions.h" -#include "triggers/triggers.h" - -#include "QtCore/QList" - -#include "kdemacros.h" - - -class KHotkeysModel; - -namespace KHotKeys { - - -/** - * A group of \c ActionDataBase objects - * - * # The group can contain actions or action groups. - * # The group has its own list of conditions. These conditions apply to all children. - */ -class KDE_EXPORT ActionDataGroup - : public ActionDataBase - { - Q_OBJECT - - public: - - enum system_group_t { - SYSTEM_NONE, //!< TODO - SYSTEM_MENUENTRIES, //!< Shortcuts for menu entries. - SYSTEM_ROOT, //!< TODO - /* last one*/ SYSTEM_MAX //!< End of enum marker - }; // don't remove entries - - /** - * Create a \c ActionDataGroup object. - * - * \param parent_P A ActionDataGroup or 0. If provided this action is - * registered with the group. - * \param name_P Name for the object. - * \param comment_P Comment for the object. - * \param condition_P Conditions for the object or 0 - * \param system_group_t Group type - * \param enabled_P Is the action enabled? - */ - ActionDataGroup( - ActionDataGroup* parent_P, - const QString& name_P = QString(), - const QString& comment_P = QString(), - Condition_list* conditions_P = NULL, - system_group_t system_group_P = SYSTEM_NONE); - - virtual ~ActionDataGroup(); - - /** - * Visitor pattern - */ - virtual void accept(ActionDataVisitor *visitor); - virtual void accept(ActionDataConstVisitor *visitor) const; - - virtual void update_triggers(); - - /** - * What kind of actions are allowed for this group? - */ - Action::ActionTypes allowedActionTypes() const; - - /** - * What kind of trigger are allowed for this group? - */ - Trigger::TriggerTypes allowedTriggerTypes() const; - - /** - * Get a shallow copy of the list of children. - */ - const QList children() const; - - /** - * Number of childrens. - */ - int size() const; - - /** - * @reimp - */ - void aboutToBeErased(); - - /** - * Is this a system group? - * - * @{ - */ - bool is_system_group() const; - system_group_t system_group() const; - void set_system_group(system_group_t group); - //@} - - // CHECKME : Why this? - using ActionDataBase::set_conditions; // make public - - //! Add a child to this collection - void add_child( ActionDataBase* child_P, int position ); - - //! Add a child to this collection - void add_child( ActionDataBase* child_P ); - - //! Remove a child from this collection - void remove_child( ActionDataBase* child_P ); - - Q_SIGNALS: - - void stateChanged(bool isEnabled); - - protected: - - //! The children - QList< ActionDataBase* > _list; - - //! System group type - system_group_t _system_group; // e.g. menuedit entries, can't be deleted or renamed - - virtual void doEnable(); - - virtual void doDisable(); - - }; - - - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/action_data/action_data_visitor.cpp b/khotkeys/libkhotkeysprivate/action_data/action_data_visitor.cpp deleted file mode 100644 index e5e585b5..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/action_data_visitor.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "action_data/action_data_visitor.h" - -#include "action_data/action_data_base.h" - -#include - -namespace KHotKeys { - -ActionDataVisitor::ActionDataVisitor() - {} - - -ActionDataVisitor::~ActionDataVisitor() - {} - - -void ActionDataVisitor::visitActionDataBase(ActionDataBase *action) - { - kDebug() << action->name(); - Q_ASSERT(false); - } - - - -ActionDataConstVisitor::ActionDataConstVisitor() - {} - - -ActionDataConstVisitor::~ActionDataConstVisitor() - {} - - -void ActionDataConstVisitor::visitActionDataBase(const ActionDataBase *action) - { - kDebug() << action->name(); - Q_ASSERT(false); - } - -} // KHotKeys - - - diff --git a/khotkeys/libkhotkeysprivate/action_data/action_data_visitor.h b/khotkeys/libkhotkeysprivate/action_data/action_data_visitor.h deleted file mode 100644 index 1556eed0..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/action_data_visitor.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef ACTION_DATA_VISITOR_H -#define ACTION_DATA_VISITOR_H -/** - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -namespace KHotKeys { - -class ActionData; -class ActionDataBase; -class ActionDataGroup; -class Generic_action_data; -class MenuEntryShortcutActionData; -class SimpleActionData; -template< typename T, typename A > class SimpleActionDataHelper; - -/** - * @author Michael Jansen - */ -class ActionDataVisitor - { -public: - - ActionDataVisitor(); - - virtual ~ActionDataVisitor(); - - virtual void visitActionDataBase(ActionDataBase *base); - - virtual void visitActionData(ActionData *base) = 0; - - virtual void visitActionDataGroup(ActionDataGroup *group) = 0; - - virtual void visitGenericActionData(Generic_action_data *data) = 0; - - virtual void visitMenuentryShortcutActionData(MenuEntryShortcutActionData *data) = 0; - - virtual void visitSimpleActionData(SimpleActionData *data) = 0; - - }; // ActionDataVisitor - - -/** - * @author Michael Jansen - */ -class ActionDataConstVisitor - { -public: - - ActionDataConstVisitor(); - - virtual ~ActionDataConstVisitor(); - - virtual void visitActionDataBase(const ActionDataBase *base); - - virtual void visitActionData(const ActionData *base) = 0; - - virtual void visitActionDataGroup(const ActionDataGroup *group) = 0; - - virtual void visitGenericActionData(const Generic_action_data *data) = 0; - - virtual void visitMenuentryShortcutActionData(const MenuEntryShortcutActionData *data) = 0; - - virtual void visitSimpleActionData(const SimpleActionData *data) = 0; - - template< typename T, typename A > - KHotKeys::ActionDataBase *visitSimpleActionDataHelper(const KHotKeys::SimpleActionDataHelper *object); - -private: - - }; // ActionDataConstVisitor - -} // KHotKeys - -#endif /* ACTION_DATA_VISITOR_H */ - diff --git a/khotkeys/libkhotkeysprivate/action_data/generic_action_data.cpp b/khotkeys/libkhotkeysprivate/action_data/generic_action_data.cpp deleted file mode 100644 index 6734cc62..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/generic_action_data.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#include "generic_action_data.h" - -#include "action_data/action_data_visitor.h" -#include "actions/actions.h" - -#include - - -namespace KHotKeys -{ - - -Generic_action_data::Generic_action_data( - ActionDataGroup* parent, - const QString& name, - const QString& comment, - Trigger_list* triggers, - Condition_list* conditions, - ActionList* actions) - : ActionData(parent, name, comment, triggers, conditions, actions) - { - } - - -Generic_action_data::~Generic_action_data() - {} - - -void Generic_action_data::accept(ActionDataVisitor *visitor) - { - visitor->visitGenericActionData(this); - } - - -void Generic_action_data::accept(ActionDataConstVisitor *visitor) const - { - visitor->visitGenericActionData(this); - } - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/action_data/generic_action_data.h b/khotkeys/libkhotkeysprivate/action_data/generic_action_data.h deleted file mode 100644 index ffc50736..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/generic_action_data.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef GENERIC_ACTION_DATA_H -#define GENERIC_ACTION_DATA_H - -#include "action_data.h" - - -namespace KHotKeys { - -class ActionDataGroup; - -class KDE_EXPORT Generic_action_data - : public ActionData - { - typedef ActionData base; - - public: - - Generic_action_data( - ActionDataGroup* parent_P, - const QString& name_P = QString(), - const QString& comment_P = QString(), - Trigger_list* triggers_P = NULL, - Condition_list* conditions_P = NULL, - ActionList* actions_P = NULL); - - ~Generic_action_data(); - - /** - * Visitor pattern - * @reimp - */ - virtual void accept(ActionDataVisitor *visitor); - virtual void accept(ActionDataConstVisitor *visitor) const; - - // CHECKME: Why this? - using ActionDataBase::set_conditions; // make public - using ActionData::add_trigger; // make public - using ActionData::add_triggers; // make public - using ActionData::set_triggers; // make public - using ActionData::add_action; // make public - using ActionData::add_actions; // make public - using ActionData::set_actions; // make public - }; - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/action_data/menuentry_shortcut_action_data.cpp b/khotkeys/libkhotkeysprivate/action_data/menuentry_shortcut_action_data.cpp deleted file mode 100644 index 1887dac1..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/menuentry_shortcut_action_data.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (C) 1999-2001 Lubos Lunak - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "menuentry_shortcut_action_data.h" - -#include "action_data/action_data_visitor.h" -#include "actions/actions.h" -#include "conditions/conditions.h" - -#include -#include - -namespace KHotKeys { - - -MenuEntryShortcutActionData::MenuEntryShortcutActionData( - ActionDataGroup* parent, - const QString& name, - const QString& comment, - const KShortcut& shortcut, - const QString& menuentry) - : base(parent, name, comment) - { - set_action( new MenuEntryAction( this, menuentry )); - set_trigger( new ShortcutTrigger( this, shortcut )); - } - - -MenuEntryShortcutActionData::MenuEntryShortcutActionData( - ActionDataGroup* parent, - const QString& name, - const QString& comment) - : base(parent, name, comment) - {} - - -void MenuEntryShortcutActionData::accept(ActionDataVisitor *visitor) - { - visitor->visitMenuentryShortcutActionData(this); - } - - -void MenuEntryShortcutActionData::accept(ActionDataConstVisitor *visitor) const - { - visitor->visitMenuentryShortcutActionData(this); - } - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/action_data/menuentry_shortcut_action_data.h b/khotkeys/libkhotkeysprivate/action_data/menuentry_shortcut_action_data.h deleted file mode 100644 index 47b5b998..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/menuentry_shortcut_action_data.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef MENUENTRY_SHORTCUT_ACTION_DATA_H -#define MENUENTRY_SHORTCUT_ACTION_DATA_H -/** - * Copyright (C) 1999-2001 Lubos Lunak - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "simple_action_data.h" -#include "triggers/triggers.h" -#include "actions/actions.h" - - -namespace KHotKeys { - -class KDE_EXPORT MenuEntryShortcutActionData - : public SimpleActionDataHelper< ShortcutTrigger, MenuEntryAction > - { - public: - - typedef SimpleActionDataHelper< ShortcutTrigger, MenuEntryAction > base; - - MenuEntryShortcutActionData( - ActionDataGroup* parent, - const QString& name = QString(), - const QString& comment = QString()); - - MenuEntryShortcutActionData( - ActionDataGroup* parent, - const QString& name, - const QString& comment, - const KShortcut& shortcut, - const QString& command_url); - - /** - * Visitor pattern - * @reimp - */ - virtual void accept(ActionDataVisitor *visitor); - virtual void accept(ActionDataConstVisitor *visitor) const; - - }; - - -} // namespace KHotKeys - - -#endif /* MENUENTRY_SHORTCUT_ACTION_DATA_H */ diff --git a/khotkeys/libkhotkeysprivate/action_data/simple_action_data.cpp b/khotkeys/libkhotkeysprivate/action_data/simple_action_data.cpp deleted file mode 100644 index 8b82ec10..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/simple_action_data.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright (C) 1999-2001 Lubos Lunak - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "simple_action_data.h" - -#include "action_data/action_data_visitor.h" -#include "conditions/conditions.h" -#include "conditions/conditions_list.h" - -#include - - -namespace KHotKeys { - - -SimpleActionData::SimpleActionData( - ActionDataGroup* parent_P, - const QString& name_P, - const QString& comment_P) - : ActionData( - parent_P, - name_P, - comment_P, - 0, - new Condition_list( "", this ), - 0) - {} - - -void SimpleActionData::accept(ActionDataVisitor *visitor) - { - visitor->visitSimpleActionData(this); - } - - -void SimpleActionData::accept(ActionDataConstVisitor *visitor) const - { - visitor->visitSimpleActionData(this); - } - - -void SimpleActionData::doEnable() - { - if (trigger()) - { - trigger()->enable(); - update_triggers(); - } - } - - -void SimpleActionData::doDisable() - { - if (trigger()) - { - trigger()->disable(); - update_triggers(); - } - } - - -void SimpleActionData::set_action( Action* action_P ) - { - ActionList* tmp = new ActionList( "Simple_action_data" ); - tmp->append( action_P ); - set_actions( tmp ); - } - - -void SimpleActionData::set_trigger( Trigger* trigger_P ) - { - Trigger_list* tmp = new Trigger_list( "Simple_action" ); - tmp->append( trigger_P ); - set_triggers( tmp ); - } - - -const Action* SimpleActionData::action() const - { - if( actions() == 0 || actions()->isEmpty() ) - return 0; - return actions()->first(); - } - - -Action* SimpleActionData::action() - { - if( actions() == 0 || actions()->isEmpty() ) - return 0; - return actions()->first(); - } - - -const Trigger* SimpleActionData::trigger() const - { - if( triggers() == 0 || triggers()->isEmpty() ) - return NULL; - - return triggers()->first(); - } - - -Trigger* SimpleActionData::trigger() - { - if( triggers() == 0 || triggers()->isEmpty() ) - return NULL; - - return triggers()->first(); - } - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/action_data/simple_action_data.h b/khotkeys/libkhotkeysprivate/action_data/simple_action_data.h deleted file mode 100644 index 0d208343..00000000 --- a/khotkeys/libkhotkeysprivate/action_data/simple_action_data.h +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef SIMPLE_ACTION_DATA_H -#define SIMPLE_ACTION_DATA_H - -#include "action_data/action_data.h" - -#include "actions/actions.h" -#include "triggers/triggers.h" - -namespace KHotKeys { - - -class KDE_EXPORT SimpleActionData : public ActionData - { - typedef ActionData base; - -public: - - SimpleActionData( - ActionDataGroup* parent_P, - const QString& name_P = QString(), - const QString& comment_P = QString()); - - /** - * Visitor pattern - * @reimp - */ - virtual void accept(ActionDataVisitor *visitor); - virtual void accept(ActionDataConstVisitor *visitor) const; - - //! The action associated with this hotkey - virtual const Action* action() const; - virtual Action* action(); - - //! The trigger for this hotkey - virtual const Trigger* trigger() const; - virtual Trigger* trigger(); - - void set_action( Action* action_P ); - void set_trigger( Trigger* trigger_P ); - -protected: - - void doEnable(); - - void doDisable(); - - }; // class SimpleActionData - - -/** - * A template adding convenience methods to SimpleActionData. - */ -template< typename T, typename A > -class KDE_EXPORT SimpleActionDataHelper - : public SimpleActionData - { - typedef SimpleActionData base; - - public: - - SimpleActionDataHelper( - ActionDataGroup* parent_P, - const QString& name_P, - const QString& comment_P) - : base( parent_P, name_P, comment_P) - {} - - //! The action associated with this hotkey - const A* action() const; - A* action(); - - //! The trigger for this hotkey - const T* trigger() const; - T* trigger(); - - void set_action( Action *action_P ); - void set_trigger( Trigger *trigger_P ); - - }; - -// ========================================================================== -// TEMPLATE METHOD DEFINITIONS - - -template< typename T, typename A > -void SimpleActionDataHelper< T, A >::set_action( Action* action_P ) - { - Q_ASSERT( dynamic_cast( action_P ) ); - base::set_action(action_P); - } - -template< typename T, typename A > -void SimpleActionDataHelper< T, A >::set_trigger( Trigger* trigger_P ) - { - Q_ASSERT( dynamic_cast( trigger_P ) ); - base::set_trigger(trigger_P); - } - -template< typename T, typename A > -const A* SimpleActionDataHelper< T, A >::action() const - { - if( actions() == 0 || actions()->isEmpty() ) - return 0; - return dynamic_cast< const A* >( actions()->first()); - } - -template< typename T, typename A > -A* SimpleActionDataHelper< T, A >::action() - { - if( actions() == 0 || actions()->isEmpty() ) - return 0; - return dynamic_cast< A* >(actions()->first()); - } - -template< typename T, typename A > -const T* SimpleActionDataHelper< T, A >::trigger() const - { - if( triggers() == 0 || triggers()->isEmpty() ) - return 0; - return dynamic_cast< const T* >( triggers()->first()); - } - -template< typename T, typename A > -T* SimpleActionDataHelper< T, A >::trigger() - { - if( triggers() == 0 || triggers()->isEmpty() ) - return 0; - return dynamic_cast< T* >( triggers()->first()); - } - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/actions/action.cpp b/khotkeys/libkhotkeysprivate/actions/action.cpp deleted file mode 100644 index b94229a6..00000000 --- a/khotkeys/libkhotkeysprivate/actions/action.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "actions.h" - -#include -#include - -namespace KHotKeys { - - -ActionVisitor::~ActionVisitor() - {} - - -Action::Action( ActionData* data_P ) - : data( data_P ) - { - } - - -Action::~Action() - { - } - - -void Action::aboutToBeErased() - { - // Nothing to do yet. - } - -void Action::cfg_write( KConfigGroup& cfg_P ) const - { - cfg_P.writeEntry( "Type", "ERROR" ); // derived classes should call with their type - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/actions/action_list.cpp b/khotkeys/libkhotkeysprivate/actions/action_list.cpp deleted file mode 100644 index eec46c45..00000000 --- a/khotkeys/libkhotkeysprivate/actions/action_list.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "actions.h" - -#include - -namespace KHotKeys { - -ActionList::ActionList( const QString& comment_P ) - : QList< Action* >(), _comment( comment_P ) - {} - - -void ActionList::aboutToBeErased() - { - QListIterator it(*this); - while (it.hasNext()) - { - it.next()->aboutToBeErased(); - } - } - -const QString& ActionList::comment() const - { - return _comment; - } - - -ActionList::~ActionList() - { - while (!isEmpty()) - { - delete takeFirst(); - } - } - - -void ActionList::cfg_write( KConfigGroup& cfg_P ) const - { - QString save_cfg_group = cfg_P.name(); - int i = 0; - for( ActionList::ConstIterator it = begin(); - it != end(); - ++it ) - { - KConfigGroup group( cfg_P.config(), save_cfg_group + QString::number( i++ ) ); - (*it)->cfg_write( group ); - } - cfg_P.writeEntry( "ActionsCount", i ); - } - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/actions/action_visitor.h b/khotkeys/libkhotkeysprivate/actions/action_visitor.h deleted file mode 100644 index 06dbf607..00000000 --- a/khotkeys/libkhotkeysprivate/actions/action_visitor.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef ACTION_VISITOR_H -#define ACTION_VISITOR_H -/** - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -namespace KHotKeys { - -class Action; -class ActionList; -class ActivateWindowAction; -class CommandUrlAction; -class DBusAction; -class KeyboardInputAction; -class MenuEntryAction; - -/** - * @author Michael Jansen - */ -class ActionVisitor - { -public: - ActionVisitor(); - virtual ~ActionVisitor(); - -private: - - virtual void visit(Action*)= 0 - virtual void visit(ActionList*)= 0 - virtual void visit(ActivateWindowAction*)= 0 - virtual void visit(CommandUrlAction*)= 0 - virtual void visit(DBusAction*)= 0 - virtual void visit(KeyboardInputAction*)= 0 - virtual void visit(MenuEntryAction*)= 0 - - virtual void visit(Action*) const= 0 - virtual void visit(ActionList*) const= 0 - virtual void visit(ActivateWindowAction*) const= 0 - virtual void visit(CommandUrlAction*) const= 0 - virtual void visit(DBusAction*) const= 0 - virtual void visit(KeyboardInputAction*) const= 0 - virtual void visit(MenuEntryAction*) const= 0 - }; // ActionVisitor - - -} // namespace KHotKeys - -#endif /* ACTION_VISITOR_H */ - diff --git a/khotkeys/libkhotkeysprivate/actions/actions.h b/khotkeys/libkhotkeysprivate/actions/actions.h deleted file mode 100644 index 61057857..00000000 --- a/khotkeys/libkhotkeysprivate/actions/actions.h +++ /dev/null @@ -1,381 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef _ACTIONS_H_ -#define _ACTIONS_H_ - - -#include -#include - -#include -#include - -class KConfig; - -#include "khotkeysglobal.h" - -namespace KHotKeys -{ - -class ActionData; -class Windowdef_list; - -class ActionVisitor - { -public: - virtual ~ActionVisitor() = 0; - }; - - -// this one is a base for all "real" resulting actions, e.g. running a command, -// ActionData instances usually contain at least one Action -class KDE_EXPORT Action - { - Q_DISABLE_COPY( Action ) - - public: - - /** - * A enum for all possible action types. - * - * @see type() - */ - enum ActionType - { - ActivateWindowActionType = 0x01, //!< @see ActivateWindowAction - CommandUrlActionType = 0x02, //!< @see CommandUrlAction - DBusActionType = 0x04, //!< @see DBusAction - KeyboardInputActionType = 0x08, //!< @see KeyboardInputAction - MenuEntryActionType = 0x10, //!< @see MenuEntryAction - ActionListType = 0x11, //!< @see ActionList - AllTypes = 0xEF //!< All types. For convenience - }; - - Q_DECLARE_FLAGS(ActionTypes, ActionType) - - /** - * Create a action - */ - Action( ActionData* data_P ); - - virtual ~Action(); - - /** - * Acyclic visitor pattern - */ - virtual void accept(ActionVisitor&) = 0; - - /** - * Execute the action. - */ - virtual void execute() = 0; - - /** - * Have a look what's inside. - * - * @return the type of the action. - */ - virtual ActionType type() = 0; - - /** - * Returns a short descriptions of the action. - * - * The description is generated and can't be set. - * - * @return a description for this action - */ - virtual const QString description() const = 0; - - /** - * Write the actions configuration to @p cfg_P. - */ - virtual void cfg_write( KConfigGroup& cfg_P ) const; - - /** - * Return a copy of the action. - * - * This is a real deep copy. - */ - virtual Action* copy( ActionData* data_P ) const = 0; - - /** - * The action is about to be erased permanently - */ - virtual void aboutToBeErased(); - - protected: - - /** - * The action data corresponding to this action. - */ - ActionData* const data; - }; - -Q_DECLARE_OPERATORS_FOR_FLAGS(Action::ActionTypes) - - -class KDE_EXPORT ActionList - : public QList< Action* > - { - Q_DISABLE_COPY( ActionList ) - - public: - ActionList( const QString& comment = QString()); - - ~ActionList(); - void cfg_write( KConfigGroup& cfg_P ) const; - //! Some convenience typedef - typedef QList::Iterator Iterator; - typedef QList::ConstIterator ConstIterator; - const QString& comment() const; - - /** - * @reimp - */ - void aboutToBeErased(); - - private: - QString _comment; - }; - - - -class CommandUrlAction; -class CommandUrlActionVisitor - { -public: - virtual ~CommandUrlActionVisitor(); - virtual void visit(CommandUrlAction&) = 0; - }; - - -class KDE_EXPORT CommandUrlAction - : public Action - { - typedef Action base; - public: - CommandUrlAction( ActionData* data_P, const QString& command_url_P = QString() ); - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual void execute(); - virtual const QString description() const; - - //! The command url to trigger - void set_command_url( const QString &command_url ); - QString command_url() const; - - virtual ActionType type() { return CommandUrlActionType; } - virtual Action* copy( ActionData* data_P ) const; - - /** - * Acyclic visitor pattern - */ - virtual void accept(ActionVisitor&); - - private: - QString _command_url; - }; - - -class MenuEntryAction; -class MenuEntryActionVisitor - { -public: - virtual ~MenuEntryActionVisitor(); - virtual void visit(MenuEntryAction&) = 0; - }; - - -class KDE_EXPORT MenuEntryAction - : public CommandUrlAction - { - typedef CommandUrlAction base; - public: - MenuEntryAction( ActionData* data_P, const QString& menuentry_P = QString() ); - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual void execute(); - - // The service we trigger - KService::Ptr service() const; - void set_service( KService::Ptr ); - - virtual const QString description() const; - virtual Action* copy( ActionData* data_P ) const; - virtual ActionType type() { return Action::MenuEntryActionType; } - - /** - * Acyclic visitor pattern - */ - virtual void accept(ActionVisitor&); - - private: - KService::Ptr _service; - }; - - -class DBusAction; -class DBusActionVisitor - { -public: - virtual ~DBusActionVisitor(); - virtual void visit(DBusAction&) = 0; - }; - -class KDE_EXPORT DBusAction - : public Action - { - typedef Action base; - public: - DBusAction( - ActionData* data_P, - const QString& app_P = QString(), - const QString& obj_P = QString(), - const QString& call_P= QString(), - const QString& args_P= QString() ); - - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual void execute(); - const QString remote_application() const; - const QString remote_object() const; - const QString called_function() const; - const QString arguments() const; - - void set_remote_application( const QString &application ); - void set_remote_object( const QString &object ); - void set_called_function( const QString &function ); - void set_arguments( const QString &args ); - - virtual const QString description() const; - virtual Action* copy( ActionData* data_P ) const; - virtual ActionType type() { return DBusActionType; } - - /** - * Acyclic visitor pattern - */ - virtual void accept(ActionVisitor&); - - private: - QString _application; // CHECKME QCString ? - QString _object; - QString _function; - QString _arguments; - }; - - -class KeyboardInputAction; -class KeyboardInputActionVisitor - { -public: - virtual ~KeyboardInputActionVisitor(); - virtual void visit(KeyboardInputAction&) = 0; - }; - -class KDE_EXPORT KeyboardInputAction - : public Action - { - typedef Action base; - public: - - /** - * Where should we send the data too - */ - enum DestinationWindow - { - ActiveWindow, - SpecificWindow, - ActionWindow - }; - - KeyboardInputAction( - ActionData* data_P, - const QString& input_P = QString(), - Windowdef_list* dest_window_P = NULL, - bool active_window_P = true); - - virtual ~KeyboardInputAction(); - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual void execute(); - - - const QString& input() const; - void setInput(const QString &input); - - // send to specific window: dest_window != NULL - // send to active window: dest_window == NULL && activeWindow() == true - // send to action window: dest_window == NULL && activeWindow() == false - // - - DestinationWindow destination() const; - void setDestination(const DestinationWindow &dest); - - const Windowdef_list* dest_window() const; - Windowdef_list* dest_window(); - void setDestinationWindowRules(Windowdef_list *list); - - bool activeWindow() const; - virtual const QString description() const; - virtual Action* copy( ActionData* data_P ) const; - virtual ActionType type() { return KeyboardInputActionType; } - - /** - * Acyclic visitor pattern - */ - virtual void accept(ActionVisitor&); - - private: - QString _input; - Windowdef_list* _dest_window; - - //! Which window should get the input - DestinationWindow _destination; - }; - - -class ActivateWindowAction; -class ActivateWindowActionVisitor - { -public: - virtual ~ActivateWindowActionVisitor(); - virtual void visit(ActivateWindowAction&) = 0; - }; - - -class KDE_EXPORT ActivateWindowAction - : public Action - { - typedef Action base; - public: - ActivateWindowAction( - ActionData* data_P, - const Windowdef_list* window = NULL); - - virtual ~ActivateWindowAction(); - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual void execute(); - - const Windowdef_list* window() const; - void set_window_list(Windowdef_list *list); - - virtual const QString description() const; - virtual Action* copy( ActionData* data_P ) const; - virtual ActionType type() { return ActivateWindowActionType; } - - /** - * Acyclic visitor pattern - */ - virtual void accept(ActionVisitor&); - - private: - const Windowdef_list* _window; - }; - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/actions/activate_window_action.cpp b/khotkeys/libkhotkeysprivate/actions/activate_window_action.cpp deleted file mode 100644 index 1c575fd9..00000000 --- a/khotkeys/libkhotkeysprivate/actions/activate_window_action.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "actions.h" -#include "windows_handler.h" -#include "windows_helper/window_selection_list.h" - -#include -#include - -#ifdef Q_WS_X11 -// Has to be behind all qt related stuff. Else the build fails miserably -#include -#endif - -namespace KHotKeys { - - -ActivateWindowActionVisitor::~ActivateWindowActionVisitor() - {} - - -ActivateWindowAction::ActivateWindowAction( ActionData* data_P, - const Windowdef_list* window_P ) - : Action( data_P ), _window( window_P ) - { - } - - -void ActivateWindowAction::accept(ActionVisitor& visitor) - { - if (ActivateWindowActionVisitor *v = dynamic_cast(&visitor)) - { - v->visit(*this); - } - else - { - kDebug() << "Visitor error"; - } - } - - -const Windowdef_list* ActivateWindowAction::window() const - { - return _window; - } - - -ActivateWindowAction::~ActivateWindowAction() - { - delete _window; - } - - -void ActivateWindowAction::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Type", "ACTIVATE_WINDOW" ); // overwrites value set in base::cfg_write() - KConfigGroup windowGroup( cfg_P.config(), cfg_P.name() + "Window" ); - window()->cfg_write( windowGroup ); - } - - -void ActivateWindowAction::execute() - { - if( window()->match( windows_handler->active_window())) - return; // is already active - WId win_id = windows_handler->find_window( window()); - if( win_id != None ) - windows_handler->activate_window( win_id ); - } - - -const QString ActivateWindowAction::description() const - { - return i18n( "Activate window: " ) + window()->comment(); - } - - -Action* ActivateWindowAction::copy( ActionData* data_P ) const - { - return new ActivateWindowAction( data_P, window()->copy()); - } - - -void ActivateWindowAction::set_window_list(Windowdef_list *list) - { - delete _window; - _window = list; - } - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/actions/command_url_action.cpp b/khotkeys/libkhotkeysprivate/actions/command_url_action.cpp deleted file mode 100644 index b6ebc289..00000000 --- a/khotkeys/libkhotkeysprivate/actions/command_url_action.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "actions/actions.h" -#include "action_data/action_data.h" - -#include -#include -#include -#include -#include -#include - - -namespace KHotKeys { - -CommandUrlActionVisitor::~CommandUrlActionVisitor() - {} - - -CommandUrlAction::CommandUrlAction( ActionData* data_P, const QString& command_url_P ) - : Action( data_P ), _command_url( command_url_P ) - { - } - - -QString CommandUrlAction::command_url() const - { - return _command_url; - } - - -void CommandUrlAction::accept(ActionVisitor& visitor) - { - if (CommandUrlActionVisitor *v = dynamic_cast(&visitor)) - { - v->visit(*this); - } - else - { - kDebug() << "Visitor error"; - } - } - - -void CommandUrlAction::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "CommandURL", command_url()); - cfg_P.writeEntry( "Type", "COMMAND_URL" ); // overwrites value set in base::cfg_write() - } - - -Action* CommandUrlAction::copy( ActionData* data_P ) const - { - return new CommandUrlAction( data_P, command_url()); - } - - -const QString CommandUrlAction::description() const - { - return i18n( "Command/URL : " ) + command_url(); - } - - -void CommandUrlAction::execute() - { - kDebug(); - if( command_url().isEmpty()) - return; - KUriFilterData uri; - QString cmd = command_url(); - static bool sm_ready = false; - if( !sm_ready ) - { - KWorkSpace::propagateSessionManager(); - sm_ready = true; - } -// int space_pos = command_url().find( ' ' ); -// if( command_url()[ 0 ] != '\'' && command_url()[ 0 ] != '"' && space_pos > -1 -// && command_url()[ space_pos - 1 ] != '\\' ) -// cmd = command_url().left( space_pos ); // get first 'word' - uri.setData( cmd ); - KUriFilter::self()->filterUri( uri ); - if( uri.uri().isLocalFile() && !uri.uri().hasFragment() ) - cmd = uri.uri().toLocalFile(); - else - cmd = uri.uri().url(); - switch( uri.uriType()) - { - case KUriFilterData::LocalFile: - case KUriFilterData::LocalDir: - case KUriFilterData::NetProtocol: - { - ( void ) new KRun( uri.uri(),0L); - break; - } - case KUriFilterData::Executable: - { - if( !uri.hasArgsAndOptions()) - { - KService::Ptr service = KService::serviceByDesktopName( cmd ); - if( service ) - { - KRun::run( *service, KUrl::List(), NULL ); - break; - } - } - // fall though - } - case KUriFilterData::Shell: - { - if( !KRun::runCommand( - cmd + ( uri.hasArgsAndOptions() ? uri.argsAndOptions() : "" ), - cmd, uri.iconName(), NULL )) { - // CHECKME ? - } - break; - } - default: // error - return; - } - } - - -void CommandUrlAction::set_command_url( const QString &command ) - { - _command_url = command; - } - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/actions/dbus_action.cpp b/khotkeys/libkhotkeysprivate/actions/dbus_action.cpp deleted file mode 100644 index 7ad931f9..00000000 --- a/khotkeys/libkhotkeysprivate/actions/dbus_action.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "actions.h" - -#include -#include -#include -#include - -namespace KHotKeys { - -DBusActionVisitor::~DBusActionVisitor() - {} - - -DBusAction::DBusAction( ActionData* data_P, const QString& app_P, const QString& obj_P, - const QString& call_P, const QString& args_P ) - : Action( data_P ), _application( app_P ), _object( obj_P ), _function( call_P ), _arguments( args_P ) - { - } - - -void DBusAction::accept(ActionVisitor& visitor) - { - if (DBusActionVisitor *v = dynamic_cast(&visitor)) - { - v->visit(*this); - } - else - { - kDebug() << "Visitor error"; - } - } - - -const QString DBusAction::remote_application() const - { - return _application; - } - - -const QString DBusAction::remote_object() const - { - return _object; - } - - -const QString DBusAction::called_function() const - { - return _function; - } - - -const QString DBusAction::arguments() const - { - return _arguments; - } - - -void DBusAction::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Type", "DBUS" ); // overwrites value set in base::cfg_write() - cfg_P.writeEntry( "RemoteApp", _application ); - cfg_P.writeEntry( "RemoteObj", _object ); - cfg_P.writeEntry( "Call", _function ); - cfg_P.writeEntry( "Arguments", _arguments ); - } - - -void DBusAction::execute() - { - if( _application.isEmpty() || _object.isEmpty() || _function.isEmpty()) - return; - QStringList args_list; - QString args_str = _arguments; - while( !args_str.isEmpty()) - { - int pos = 0; - while( args_str[ pos ] == ' ' ) - ++pos; - if( args_str[ pos ] == '\"' || args_str[ pos ] == '\'' ) - { - QString val = ""; - QChar sep = args_str[ pos ]; - bool skip = false; - ++pos; - for(; - pos < args_str.length(); - ++pos ) - { - if( args_str[ pos ] == '\\' ) - { - skip = true; - continue; - } - if( !skip && args_str[ pos ] == sep ) - break; - skip = false; - val += args_str[ pos ]; - } - if( pos >= args_str.length()) - return; - ++pos; - args_str = args_str.mid( pos ); - args_list.append( val ); - } - else - { - // one word - if( pos != 0 ) - args_str = args_str.mid( pos ); - int nxt_pos = args_str.indexOf( ' ' ); - args_list.append( args_str.left( nxt_pos )); // should be ok if nxt_pos is -1 - args_str = nxt_pos >= 0 ? args_str.mid( nxt_pos ) : ""; - } - } - kDebug() << "D-Bus call:" << _application << ":" << _object << ":" << _function << ":" << args_list; - // most distributions ship a suffixed symlink to qdbus, look for that first - QString qdbusExe = KStandardDirs::findExe("qdbus-katie"); - if (qdbusExe.isEmpty()) { - qdbusExe = KStandardDirs::findExe("qdbus-qt4"); - } - if (qdbusExe.isEmpty()) { - // no exe lookup, let it fail if not found - qdbusExe = "qdbus"; - } - QStringList qdbusArgs; - qdbusArgs << _application << _object << _function << args_list; - QProcess::startDetached(qdbusExe, qdbusArgs); - } - - -const QString DBusAction::description() const - { - return i18n( "D-Bus: " ) + remote_application() + "::" + remote_object() + "::" - + called_function(); - } - - -Action* DBusAction::copy( ActionData* data_P ) const - { - return new DBusAction( data_P, remote_application(), remote_object(), - called_function(), arguments()); - } - -void DBusAction::set_arguments( const QString &arguments ) - { - _arguments = arguments; - } - - -void DBusAction::set_called_function( const QString &function ) - { - _function = function; - } - - -void DBusAction::set_remote_application( const QString &application ) - { - _application = application; - } - - -void DBusAction::set_remote_object( const QString &object ) - { - _object = object; - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/actions/keyboard_input_action.cpp b/khotkeys/libkhotkeysprivate/actions/keyboard_input_action.cpp deleted file mode 100644 index fca81b7e..00000000 --- a/khotkeys/libkhotkeysprivate/actions/keyboard_input_action.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "actions.h" - -#include "input.h" -#include "windows_handler.h" -#include "shortcuts_handler.h" -#include "windows_helper/window_selection_list.h" - -#include -#include - -// #include -#include -#include - -/* -*/ - -namespace KHotKeys { - -KeyboardInputActionVisitor::~KeyboardInputActionVisitor() - {} - - -KeyboardInputAction::KeyboardInputAction( - ActionData* data_P, - const QString& input_P, - Windowdef_list* dest_window_P, - bool active_window_P) - : Action( data_P ), - _input( input_P ), - _dest_window( dest_window_P ) - { - if (dest_window_P) _destination = SpecificWindow; - else if (active_window_P) _destination = ActiveWindow; - else _destination = ActionWindow; - - if (!_dest_window) _dest_window = new Windowdef_list; - } - - -KeyboardInputAction::~KeyboardInputAction() - { - delete _dest_window; - } - - -void KeyboardInputAction::accept(ActionVisitor& visitor) - { - if (KeyboardInputActionVisitor *v = dynamic_cast(&visitor)) - { - v->visit(*this); - } - else - { - kDebug() << "Visitor error"; - } - } - - -const QString& KeyboardInputAction::input() const - { - return _input; - } - - -void KeyboardInputAction::setDestination(const DestinationWindow & dest) - { - _destination = dest; - } - - -void KeyboardInputAction::setDestinationWindowRules(Windowdef_list *list) - { - if (_dest_window) - delete _dest_window; - - _dest_window = list; - } - - -void KeyboardInputAction::setInput(const QString &input) - { - _input = input; - } - - -const Windowdef_list* KeyboardInputAction::dest_window() const - { - return _dest_window; - } - - -Windowdef_list* KeyboardInputAction::dest_window() - { - return _dest_window; - } - - -KeyboardInputAction::DestinationWindow KeyboardInputAction::destination() const - { - return _destination; - } - - -void KeyboardInputAction::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Type", "KEYBOARD_INPUT" ); // overwrites value set in base::cfg_write() - cfg_P.writeEntry( "Input", input()); - - cfg_P.writeEntry( "DestinationWindow", int(_destination) ); - - if( _destination == SpecificWindow && dest_window() != NULL ) - { - KConfigGroup windowGroup( cfg_P.config(), cfg_P.name() + "DestinationWindow" ); - dest_window()->cfg_write( windowGroup ); - } - } - - -void KeyboardInputAction::execute() - { - kDebug(); - - if( input().isEmpty()) - { - kDebug() << "Input is empty"; - return; - } - - Window w = InputFocus; - switch (_destination) - { - case SpecificWindow: - Q_ASSERT(dest_window()); - w = windows_handler->find_window(dest_window()); - if (w == None) w = InputFocus; - break; - - case ActionWindow: - w = windows_handler->action_window(); - if (w == None) w = InputFocus; - break; - - case ActiveWindow: - // Nothing to do because w is InputFocus already - break; - - default: - Q_ASSERT(false); - } - - int last_index = -1, start = 0; - while(( last_index = input().indexOf( ':', last_index + 1 )) != -1 ) // find next ';' - { - QString key = input().mid( start, last_index - start ).trimmed(); - keyboard_handler->send_macro_key( key, w ); - start = last_index + 1; - } - // and the last one - QString key = input().mid( start, input().length()).trimmed(); - keyboard_handler->send_macro_key( key, w ); // the rest - XFlush( QX11Info::display()); - } - - -const QString KeyboardInputAction::description() const - { - QString tmp = input(); - tmp.replace( '\n', ' ' ); - tmp.truncate( 30 ); - return i18n( "Keyboard input: " ) + tmp; - } - - -Action* KeyboardInputAction::copy( ActionData* data_P ) const - { - return new KeyboardInputAction( - data_P, - input(), - dest_window() ? dest_window()->copy() : NULL, - _destination == ActiveWindow); - } - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/actions/menuentry_action.cpp b/khotkeys/libkhotkeysprivate/actions/menuentry_action.cpp deleted file mode 100644 index 69894afa..00000000 --- a/khotkeys/libkhotkeysprivate/actions/menuentry_action.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "actions.h" -#include "action_data/action_data.h" - -#include -#include -#include -#include -#include - -namespace KHotKeys { - -MenuEntryActionVisitor::~MenuEntryActionVisitor() - {} - - -MenuEntryAction::MenuEntryAction( ActionData* data_P, const QString& menuentry_P ) - : CommandUrlAction( data_P, menuentry_P ) - { - } - - -void MenuEntryAction::accept(ActionVisitor& visitor) - { - if (MenuEntryActionVisitor *v = dynamic_cast(&visitor)) - { - v->visit(*this); - } - else - { - kDebug() << "Visitor error"; - } - } - - -void MenuEntryAction::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Type", "MENUENTRY" ); // overwrites value set in base::cfg_write() - } - - -KService::Ptr MenuEntryAction::service() const - { - if (!_service) - { - const_cast(this)->_service = KService::serviceByStorageId(command_url()); - } - return _service; - } - - -void MenuEntryAction::set_service( KService::Ptr service ) - { - _service = service; - if (service) - { - set_command_url(service->storageId()); - } - else - { - set_command_url(QString()); - } - } - - -void MenuEntryAction::execute() - { - if (!service()) - { - KMessageBox::sorry( - NULL, - i18n("No service configured."), - i18n("Input Action: %1", data->comment())); - return; - } - - if (!KRun::run( *service(), KUrl::List(), 0 )) - { - KMessageBox::sorry( - NULL, - i18n("Failed to start service '%1'.", service()->name()), - i18n("Input Action: %1", data->comment())); - return; - } - } - - -Action* MenuEntryAction::copy( ActionData* data_P ) const - { - return new MenuEntryAction( data_P, command_url()); - } - - -const QString MenuEntryAction::description() const - { - return i18n( "Menu entry: " ) + (service() ? service()->comment() : QString()); - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/conditions/active_window_condition.cpp b/khotkeys/libkhotkeysprivate/conditions/active_window_condition.cpp deleted file mode 100644 index 6c28efe0..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/active_window_condition.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions/active_window_condition.h" - -#include "windows_helper/window_selection_list.h" -#include "windows_handler.h" -#include "khotkeysglobal.h" - -#include -#include -#include - -namespace KHotKeys { - -Active_window_condition::Active_window_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ) - : Condition( cfg_P, parent_P ) - { - KConfigGroup windowConfig( cfg_P.config(), cfg_P.name() + "Window" ); - _window = new Windowdef_list( windowConfig ); - init(); - set_match(); - } - - -Active_window_condition::Active_window_condition( Windowdef_list* window_P, - Condition_list_base* parent_P ) - : Condition( parent_P ), _window( window_P ) - { - init(); - set_match(); - } - - -Active_window_condition::~Active_window_condition() - { - disconnect( windows_handler, NULL, this, NULL ); - delete _window; - } - - -void Active_window_condition::active_window_changed( WId ) - { - set_match(); - } - - -void Active_window_condition::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - KConfigGroup windowConfig( cfg_P.config(), cfg_P.name() + "Window" ); - window()->cfg_write( windowConfig ); - cfg_P.writeEntry( "Type", "ACTIVE_WINDOW" ); // overwrites value set in base::cfg_write() - } - - -Active_window_condition* Active_window_condition::copy() const - { - kDebug(); - return new Active_window_condition(window()->copy()); - } - - -const QString Active_window_condition::description() const - { - return i18n( "Active window: " ) + window()->comment(); - } - - -void Active_window_condition::init() - { - connect( windows_handler, SIGNAL(active_window_changed(WId)), - this, SLOT(active_window_changed(WId))); - } - - -bool Active_window_condition::match() const - { - return is_match; - } - - -void Active_window_condition::set_match() - { - is_match = window()->match( Window_data( windows_handler->active_window())); - updated(); - } - - -const Windowdef_list* Active_window_condition::window() const - { - return _window; - } - - -Windowdef_list* Active_window_condition::window() - { - return _window; - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/conditions/active_window_condition.h b/khotkeys/libkhotkeysprivate/conditions/active_window_condition.h deleted file mode 100644 index dffbf15c..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/active_window_condition.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef ACTIVE_WINDOW_CONDITION_H -#define ACTIVE_WINDOW_CONDITION_H -/* Copyright (C) 2009 Michael Jansen - Copyright (C) 1999-2001 Lubos Lunak - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions/condition.h" - -#include - -#include - - -class KConfigGroup; - -namespace KHotKeys { - -class Condition_list_base; -class Windowdef_list; - -/** - * @author Michael Jansen - */ -class KDE_EXPORT Active_window_condition - : public QObject, public Condition - { - Q_OBJECT - typedef Condition base; - public: - Active_window_condition(Windowdef_list* window_P, Condition_list_base* parent_P = NULL); - Active_window_condition(KConfigGroup& cfg_P, Condition_list_base* parent_P); - virtual ~Active_window_condition(); - virtual bool match() const; - virtual void cfg_write( KConfigGroup& cfg_P ) const; - const Windowdef_list* window() const; - Windowdef_list* window(); - virtual Active_window_condition* copy() const; - virtual const QString description() const; - public Q_SLOTS: - void active_window_changed( WId ); - private: - void init(); - void set_match(); - Windowdef_list* _window; - bool is_match; - }; - -} // namespace KHotKeys - -#endif /* #ifndef ACTIVE_WINDOW_CONDITION_H */ diff --git a/khotkeys/libkhotkeysprivate/conditions/and_condition.cpp b/khotkeys/libkhotkeysprivate/conditions/and_condition.cpp deleted file mode 100644 index bbebe275..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/and_condition.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions.h" - -#include -#include - -namespace KHotKeys { - - -And_condition::And_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ) - : Condition_list_base( cfg_P, parent_P ) - { - } - - -And_condition::And_condition( Condition_list_base* parent_P ) - : Condition_list_base( parent_P ) - { - } - - -void And_condition::cfg_write( KConfigGroup& cfg_P ) const - { - kDebug() << description() << " with " << count() << " children";; - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Type", "AND" ); // overwrites value set in base::cfg_write() - } - - -And_condition* And_condition::copy() const - { - And_condition* ret = new And_condition(); - for (ConstIterator it=begin(); it!=end(); ++it) - { - ret->append((*it)->copy()); - } - return ret; - } - - -const QString And_condition::description() const - { - return i18nc( "And_condition", "And" ); - } - - -bool And_condition::match() const - { - for (ConstIterator it=begin(); it!=end(); ++it) - { - if (!(*it)->match()) - { - return false; - } - } - return true; // all true (or empty) - } - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/conditions/condition.cpp b/khotkeys/libkhotkeysprivate/conditions/condition.cpp deleted file mode 100644 index d653b412..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/condition.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions/conditions.h" - -#include "conditions/active_window_condition.h" -#include "conditions/existing_window_condition.h" -#include "conditions/conditions_visitor.h" - -#include -#include - -namespace KHotKeys { - -Condition::Condition( Condition_list_base* parent ) - : _parent(NULL) - { - if (parent) - { - parent->append(this); - Q_ASSERT(_parent); - } - } - - -Condition::Condition( KConfigGroup&, Condition_list_base* parent ) - : _parent(NULL) - { - if (parent) - { - parent->append(this); - Q_ASSERT(_parent); - } - } - - -Condition::~Condition() - { - if( _parent ) _parent->removeAll( this ); - } - - -void Condition::cfg_write( KConfigGroup& cfg_P ) const - { - cfg_P.writeEntry( "Type", "ERROR" ); - } - - -Condition* Condition::create_cfg_read( KConfigGroup& cfg_P, Condition_list_base* parent_P ) - { - QString type = cfg_P.readEntry( "Type" ); - if( type == "ACTIVE_WINDOW" ) - return new Active_window_condition( cfg_P, parent_P ); - if( type == "EXISTING_WINDOW" ) - return new Existing_window_condition( cfg_P, parent_P ); - if( type == "NOT" ) - return new Not_condition( cfg_P, parent_P ); - if( type == "AND" ) - return new And_condition( cfg_P, parent_P ); - if( type == "OR" ) - return new Or_condition( cfg_P, parent_P ); - kWarning() << "Unknown Condition type read from cfg file\n"; - return NULL; - } - - -const Condition_list_base* Condition::parent() const - { - return _parent; - } - - -Condition_list_base* Condition::parent() - { - return _parent; - } - - -void Condition::reparent(Condition_list_base *parent) - { - if (_parent == parent) return; - - if (_parent) _parent->removeAll(this); - _parent = parent; - if (_parent) _parent->append(this); - } - - -void Condition::updated() const - { - if (!khotkeys_active() || !_parent) - { - return; - } - - _parent->updated(); - } - - -void Condition::visit( ConditionsVisitor *visitor ) - { - visitor->visitCondition( this ); - } - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/conditions/condition.h b/khotkeys/libkhotkeysprivate/conditions/condition.h deleted file mode 100644 index 36d10add..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/condition.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef CONDITION_H -#define CONDITION_H -/* Copyright (C) 2009 Michael Jansen - Copyright (C) 1999-2001 Lubos Lunak - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include - -#include "kdemacros.h" - -class KConfigGroup; - - -namespace KHotKeys { - -class ConditionsVisitor; -class Condition_list_base; - -/** - * @author Michael Jansen - */ -class KDE_EXPORT Condition - { - Q_DISABLE_COPY( Condition ) - - public: - Condition( Condition_list_base* parent_P = NULL ); - Condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ); - virtual ~Condition(); - virtual bool match() const = 0; - virtual void updated() const; // called when the condition changes - virtual void cfg_write( KConfigGroup& cfg_P ) const = 0; - virtual const QString description() const = 0; - virtual Condition* copy() const = 0; - const Condition_list_base* parent() const; - Condition_list_base* parent(); - static Condition* create_cfg_read( KConfigGroup& cfg_P, Condition_list_base* parent_P ); - - // Reparent the condition to another list. - void reparent(Condition_list_base *parent); - - virtual void visit( ConditionsVisitor *visitor ); - - protected: - - Condition_list_base* _parent; - }; - - -} // namespace KHotKeys - -#endif /* #ifndef CONDITION_H */ diff --git a/khotkeys/libkhotkeysprivate/conditions/conditions.h b/khotkeys/libkhotkeysprivate/conditions/conditions.h deleted file mode 100644 index 31529c0e..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/conditions.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef CONDITIONS_H -#define CONDITIONS_H - -#include "conditions/conditions_list_base.h" - -#include "action_data/action_data_group.h" -#include "windows_handler.h" - -class KConfigGroup; - -namespace KHotKeys -{ - -class Condition; - -class KDE_EXPORT Not_condition - : public Condition_list_base - { - typedef Condition_list_base base; - public: - Not_condition( Condition_list_base* parent = NULL ); - Not_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ); - virtual bool match() const; - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual Not_condition* copy() const; - virtual const QString description() const; - const Condition* condition() const; - virtual bool accepts_children() const; - }; - -class KDE_EXPORT And_condition - : public Condition_list_base - { - typedef Condition_list_base base; - public: - And_condition( Condition_list_base* parent = NULL ); - And_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ); - virtual bool match() const; - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual And_condition* copy() const; - virtual const QString description() const; - }; - -class KDE_EXPORT Or_condition - : public Condition_list_base - { - typedef Condition_list_base base; - public: - Or_condition( Condition_list_base* parent = NULL ); - Or_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ); - virtual bool match() const; - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual Or_condition* copy() const; - virtual const QString description() const; - }; - - -} // namespace KHotKeys - -#endif // #define CONDITIONS_H diff --git a/khotkeys/libkhotkeysprivate/conditions/conditions_list.cpp b/khotkeys/libkhotkeysprivate/conditions/conditions_list.cpp deleted file mode 100644 index 17bd1263..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/conditions_list.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions/conditions_list.h" -#include "conditions/conditions_visitor.h" - -#include "action_data/action_data.h" -#include "khotkeysglobal.h" - -#include -#include - -namespace KHotKeys { - -Condition_list::Condition_list( KConfigGroup& cfg_P, ActionDataBase* data_P ) - : Condition_list_base( cfg_P, NULL ), data( data_P ) - { - _comment = cfg_P.readEntry( "Comment" ); - } - - -Condition_list::Condition_list( const QString& comment_P, ActionDataBase* data_P ) - : Condition_list_base( NULL ), _comment( comment_P ), data( data_P ) - { - } - - -void Condition_list::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Comment", comment()); - } - - -const QString& Condition_list::comment() const - { - return _comment; - } - - -Condition_list* Condition_list::copy() const - { - kDebug() << count(); - - Condition_list* ret = new Condition_list(comment()); - for( ConstIterator it = begin(); - it != end(); - ++it ) - { - ret->append((*it)->copy()); - } - return ret; - } - - -const QString Condition_list::description() const - { - return QString(); - } - - -bool Condition_list::match() const - { - if( count() == 0 ) // no conditions to match => ok - return true; - for( ConstIterator it(begin()); - it != end(); - ++it ) - if( (*it)->match()) // OR - return true; - return false; - } - - -void Condition_list::set_data( ActionDataBase* data_P ) - { - Q_ASSERT( data == NULL || data == data_P ); - data = data_P; - } - - -void Condition_list::updated() const - { - if( !khotkeys_active()) - return; - data->update_triggers(); -// base::updated(); no need to, doesn't have parent - } - - -void Condition_list::visit( ConditionsVisitor *visitor ) - { - visitor->visitConditionsList(this); - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/conditions/conditions_list.h b/khotkeys/libkhotkeysprivate/conditions/conditions_list.h deleted file mode 100644 index a9e8dd81..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/conditions_list.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef CONDITIONS_LIST_H -#define CONDITIONS_LIST_H -/* Copyright (C) 2009 Michael Jansen - Copyright (C) 1999-2001 Lubos Lunak - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "conditions/conditions_list_base.h" - -#include - -class KConfigGroup; - -namespace KHotKeys { - -class ActionDataBase; - -/** - * @author Michael Jansen - */ -class KDE_EXPORT Condition_list - : public Condition_list_base - { - typedef Condition_list_base base; - public: - Condition_list( const QString& comment_P, ActionDataBase* parent = NULL ); - Condition_list( KConfigGroup& cfg_P, ActionDataBase* data_P ); - void cfg_write( KConfigGroup& cfg_P ) const; - virtual Condition_list* copy() const; - virtual bool match() const; - const QString& comment() const; - void set_data( ActionDataBase* data_P ); - virtual void updated() const; - virtual const QString description() const; - - virtual void visit(ConditionsVisitor *visitor); - private: - QString _comment; - ActionDataBase* data; - }; - - -} // namespace KHotKeys - -#endif /* #ifndef CONDITIONS_LIST_H */ diff --git a/khotkeys/libkhotkeysprivate/conditions/conditions_list_base.cpp b/khotkeys/libkhotkeysprivate/conditions/conditions_list_base.cpp deleted file mode 100644 index b2eb44e8..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/conditions_list_base.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions/conditions_list_base.h" -#include "conditions/conditions_visitor.h" - -#include -#include - -namespace KHotKeys { - - -Condition_list_base::Condition_list_base( Condition_list_base* parent_P ) - : Condition( parent_P ), - QList< Condition* >() - { - } - - -Condition_list_base::Condition_list_base( - const QList< Condition* >& children_P, - Condition_list_base* parent_P) - : Condition( parent_P ), - QList< Condition* >( children_P ) - { - } - - -Condition_list_base::Condition_list_base( KConfigGroup& cfg_P, Condition_list_base* parent_P ) - : Condition( parent_P ) - { - int cnt = cfg_P.readEntry( "ConditionsCount", 0 ); - for( int i = 0; - i < cnt; - ++i ) - { - KConfigGroup conditionConfig( cfg_P.config(), cfg_P.name() + QString::number( i ) ); - (void) Condition::create_cfg_read( conditionConfig, this ); - } - } - - -Condition_list_base::~Condition_list_base() - { - // Carefully delete conditions in a manual loop. Something like qDeleteAll - // would crash because the conditions remove themselves from this list in - // their destructors. - while( !isEmpty() ) - { - Condition* c = first(); - removeAll( c ); - delete c; - } - } - - -bool Condition_list_base::accepts_children() const - { - return true; - } - - -void Condition_list_base::append(Condition *cond) - { - if (cond->parent() == this) - { - return; - } - - cond->reparent(this); - QList::append(cond); - } - - -Condition_list_base::Iterator Condition_list_base::begin() - { - return QList::begin(); - } - - -Condition_list_base::ConstIterator Condition_list_base::begin() const - { - return QList::begin(); - } - - -void Condition_list_base::clear() - { - return QList::clear(); - } - - -void Condition_list_base::cfg_write( KConfigGroup& cfg_P ) const - { - int i = 0; - for( ConstIterator it(begin()); - it != end(); - ++it, ++i ) - { - KConfigGroup conditionConfig( cfg_P.config(), cfg_P.name() + QString::number( i ) ); - (*it)->cfg_write( conditionConfig ); - } - cfg_P.writeEntry( "ConditionsCount", i ); - } - - -int Condition_list_base::count() const - { - return QList::count(); - } - - -Condition* Condition_list_base::first() - { - return QList::first(); - } - - -Condition const* Condition_list_base::first() const - { - return QList::first(); - } - - -Condition_list_base::Iterator Condition_list_base::end() - { - return QList::end(); - } - - -Condition_list_base::ConstIterator Condition_list_base::end() const - { - return QList::end(); - } - - -bool Condition_list_base::isEmpty() const - { - return QList::isEmpty(); - } - - -int Condition_list_base::removeAll(Condition *const &cond) - { - return QList::removeAll(cond); - } - - -void Condition_list_base::visit( ConditionsVisitor *visitor ) - { - visitor->visitConditionsListBase(this); - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/conditions/conditions_list_base.h b/khotkeys/libkhotkeysprivate/conditions/conditions_list_base.h deleted file mode 100644 index 27c20aea..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/conditions_list_base.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef CONDITION_LIST_BASE_H -#define CONDITION_LIST_BASE_H -/* Copyright (C) 2009 Michael Jansen - Copyright (C) 1999-2001 Lubos Lunak - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "conditions/condition.h" - -#include "kdemacros.h" - -#include - - -class KConfigGroup; - -namespace KHotKeys { - -class ConditionsVisitor; - -/** - * @author Michael Jansen - */ -class KDE_EXPORT Condition_list_base : public Condition, private QList < Condition* > - { - typedef Condition base; - - public: - - Condition_list_base( Condition_list_base* parent = NULL ); - - Condition_list_base( - const QList< Condition* >& children_P, - Condition_list_base* parent_P ); - - Condition_list_base( KConfigGroup& cfg_P, Condition_list_base* parent_P ); - - virtual ~Condition_list_base(); - - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual bool accepts_children() const; - - typedef QList< Condition* >::iterator Iterator; - typedef QList< Condition* >::const_iterator ConstIterator; - - void append(Condition*); - - Iterator begin(); - ConstIterator begin() const; - - Iterator end(); - ConstIterator end() const; - - Condition *first(); - Condition const* first() const; - - int count() const; - - bool isEmpty() const; - - void clear(); - - virtual void visit( ConditionsVisitor *visitor ); - -protected: - - int removeAll(Condition *const &); - - friend class Condition; - }; - - -} // namespace KHotKeys - -#endif /* #ifndef CONDITION_LIST_BASE_H */ diff --git a/khotkeys/libkhotkeysprivate/conditions/conditions_visitor.cpp b/khotkeys/libkhotkeysprivate/conditions/conditions_visitor.cpp deleted file mode 100644 index 25d3283f..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/conditions_visitor.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 2009 Michael Jansen - Copyright (C) 1999-2001 Lubos Lunak - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions/conditions_visitor.h" -#include "conditions/conditions_list_base.h" - -namespace KHotKeys { - -ConditionsVisitor::ConditionsVisitor() - {} - - -ConditionsVisitor::~ConditionsVisitor() - {} - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/conditions/conditions_visitor.h b/khotkeys/libkhotkeysprivate/conditions/conditions_visitor.h deleted file mode 100644 index 35920051..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/conditions_visitor.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef CONDITIONS_VISITOR_H -#define CONDITIONS_VISITOR_H -/* Copyright (C) 2009 Michael Jansen - Copyright (C) 1999-2001 Lubos Lunak - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kdemacros.h" - -namespace KHotKeys { - class Condition_list_base; - class Condition_list; - class Condition; - - -/** - * @author Michael Jansen - */ -class KDE_EXPORT ConditionsVisitor - { -public: - - ConditionsVisitor(); - virtual ~ ConditionsVisitor(); - - virtual void visitCondition( Condition *condition ) = 0; - virtual void visitConditionsList( Condition_list *list) = 0; - virtual void visitConditionsListBase( Condition_list_base *list) = 0; - -private: - - }; // class ConditionsVisitor - - -} // namespace KHotKeys - - -#endif /* #ifndef CONDITIONS_VISITOR_H */ diff --git a/khotkeys/libkhotkeysprivate/conditions/existing_window_condition.cpp b/khotkeys/libkhotkeysprivate/conditions/existing_window_condition.cpp deleted file mode 100644 index a41a1ec5..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/existing_window_condition.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "conditions/existing_window_condition.h" - -#include "windows_helper/window_selection_list.h" - -#include "windows_handler.h" -#include "khotkeysglobal.h" - - -namespace KHotKeys { - -Existing_window_condition::Existing_window_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ) - : Condition( cfg_P, parent_P ) - { - KConfigGroup windowConfig( cfg_P.config(), cfg_P.name() + "Window" ); - _window = new Windowdef_list( windowConfig ); - init(); - set_match(); - } - - -Existing_window_condition::Existing_window_condition( Windowdef_list* window_P, - Condition_list_base* parent_P ) - : Condition( parent_P ), _window( window_P ), is_match( false ) - { - init(); - set_match(); - } - - -Existing_window_condition::~Existing_window_condition() - { - disconnect( windows_handler, NULL, this, NULL ); - delete _window; - } - - -void Existing_window_condition::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - KConfigGroup windowConfig( cfg_P.config(), cfg_P.name() + "Window" ); - window()->cfg_write( windowConfig ); - cfg_P.writeEntry( "Type", "EXISTING_WINDOW" ); // overwrites value set in base::cfg_write() - } - - -Existing_window_condition* Existing_window_condition::copy() const - { - return new Existing_window_condition(window()->copy()); - } - - -const QString Existing_window_condition::description() const - { - return i18n( "Existing window: " ) + window()->comment(); - } - - -void Existing_window_condition::init() - { - connect( windows_handler, SIGNAL(window_added(WId)), this, SLOT(window_added(WId))); - connect( windows_handler, SIGNAL(window_removed(WId)), this, SLOT(window_removed(WId))); - } - - -bool Existing_window_condition::match() const - { - return is_match; - } - - -void Existing_window_condition::set_match( WId w_P ) - { - if( w_P != None && !is_match ) - is_match = window()->match( Window_data( w_P )); - else - is_match = windows_handler->find_window( window()) != None; - updated(); - } - - -const Windowdef_list* Existing_window_condition::window() const - { - return _window; - } - - -Windowdef_list* Existing_window_condition::window() - { - return _window; - } - - -void Existing_window_condition::window_added( WId w_P ) - { - set_match( w_P ); - } - - -void Existing_window_condition::window_removed( WId ) - { - set_match(); - } - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/conditions/existing_window_condition.h b/khotkeys/libkhotkeysprivate/conditions/existing_window_condition.h deleted file mode 100644 index f5603900..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/existing_window_condition.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef EXISTING_WINDOW_CONDITION_H -#define EXISTING_WINDOW_CONDITION_H -/* Copyright (C) 2009 Michael Jansen - Copyright (C) 1999-2001 Lubos Lunak - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions/condition.h" - -#include -#include -#include - -#include // Needed because of some Qt Status redefinitions -#include // Needed because of some Qt Status redefinitions - -#include - -#ifdef Q_WS_X11 -#include -#include -#else -#define None 0 -#endif - -namespace KHotKeys { - -class Condition_list_base; -class Windowdef_list; - - -/** - * @author Michael Jansen - */ -class KDE_EXPORT Existing_window_condition - : public QObject, public Condition - { - Q_OBJECT - typedef Condition base; - public: - Existing_window_condition( Windowdef_list* window_P, Condition_list_base* parent = NULL ); - Existing_window_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ); - virtual ~Existing_window_condition(); - virtual bool match() const; - virtual void cfg_write( KConfigGroup& cfg_P ) const; - const Windowdef_list* window() const; - Windowdef_list* window(); - virtual Existing_window_condition* copy() const; - virtual const QString description() const; - public Q_SLOTS: - void window_added( WId w_P ); - void window_removed( WId w_P ); - private: - void init(); - void set_match( WId w_P = None ); - Windowdef_list* _window; - bool is_match; - }; - - -} // namespace KHotKeys - -#endif /* #ifndef EXISTING_WINDOW_CONDITION_H */ diff --git a/khotkeys/libkhotkeysprivate/conditions/not_condition.cpp b/khotkeys/libkhotkeysprivate/conditions/not_condition.cpp deleted file mode 100644 index 62ddc63c..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/not_condition.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions.h" - -#include - -namespace KHotKeys { - -Not_condition::Not_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ) - : Condition_list_base( cfg_P, parent_P ) - {} - - -Not_condition::Not_condition( Condition_list_base* parent_P ) - : Condition_list_base( parent_P ) - {} - - -void Not_condition::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Type", "NOT" ); // overwrites value set in base::cfg_write() - } - - -const Condition* Not_condition::condition() const - { - return first(); - } - - -Not_condition* Not_condition::copy() const - { - Not_condition* ret = new Not_condition(); - if (!isEmpty()) - { - ret->append(condition()->copy()); - } - - return ret; - } - - -const QString Not_condition::description() const - { - return i18nc( "Not_condition", "Not" ); - } - - -bool Not_condition::accepts_children() const - { - return count() == 0; - } - - -bool Not_condition::match() const - { - return condition() ? !condition()->match() : false; - } - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/conditions/or_condition.cpp b/khotkeys/libkhotkeysprivate/conditions/or_condition.cpp deleted file mode 100644 index c1b6a4dc..00000000 --- a/khotkeys/libkhotkeysprivate/conditions/or_condition.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "conditions.h" - -#include - -namespace KHotKeys { - -Or_condition::Or_condition( KConfigGroup& cfg_P, Condition_list_base* parent_P ) - : Condition_list_base( cfg_P, parent_P ) - {} - - -Or_condition::Or_condition( Condition_list_base* parent_P ) - : Condition_list_base( parent_P ) - {} - - -bool Or_condition::match() const - { - if( count() == 0 ) // empty => ok - return true; - for( ConstIterator it(begin()); - it != end(); - ++it ) - if( (*it)->match()) // OR - return true; - return false; - } - - -void Or_condition::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Type", "OR" ); // overwrites value set in base::cfg_write() - } - - -Or_condition* Or_condition::copy() const - { - Or_condition* ret = new Or_condition(); - for( ConstIterator it(begin()); - it != end(); - ++it ) - ret->append( (*it)->copy()); - return ret; - } - - -const QString Or_condition::description() const - { - return i18nc( "Or_condition", "Or" ); - } - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/daemon/daemon.cpp b/khotkeys/libkhotkeysprivate/daemon/daemon.cpp deleted file mode 100644 index 092641b9..00000000 --- a/khotkeys/libkhotkeysprivate/daemon/daemon.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "daemon.h" - -#include "khotkeysglobal.h" - -#include -#include - -#include -#include -#include -#include - - -namespace KHotKeys { namespace Daemon { - - -bool isEnabled() -{ - KConfig khotkeysrc( KHOTKEYS_CONFIG_FILE ); - KConfigGroup main( &khotkeysrc, "Main" ); - return ! main.readEntry( "Disabled", false ); -} - -static QDBusInterface* Kded() -{ - QDBusInterface *iface = new QDBusInterface( "org.kde.kded", "/kded","org.kde.kded" ); - if (!iface->isValid()) { - QDBusError err = iface->lastError(); - if (err.isValid()) { - kError() << "Failed to contact kded [" << err.name() << "]:" << err.message(); - } - } - return iface; -} - - -bool isRunning() -{ - QScopedPointer kded( Kded() ); - if (!kded->isValid()) { - return false; - } - - // I started with checking if i could get a valid /KHotKeys Interface. But - // it resisted to work. So lets do the other thing. - QDBusReply modules = kded->call( "loadedModules" ); - return modules.value().contains("khotkeys"); -} - - -bool reload() -{ - // No kded no reload - QScopedPointer kded( Kded() ); - if (!kded->isValid()) { - return false; - } - - // Inform kdedkhotkeys demon to reload settings - QDBusConnection bus = QDBusConnection::sessionBus(); - QDBusInterface iface( - "org.kde.kded", - "/modules/khotkeys", - "org.kde.khotkeys", - bus ); - if(!iface.isValid()) { - QDBusError err = iface.lastError(); - if (err.isValid()) { - kError() << err.name() << ":" << err.message(); - } - return start(); - } - - QDBusMessage reply = iface.call("reread_configuration"); - QDBusError err = iface.lastError(); - if (err.isValid()) { - kError() << err.name() << ":" << err.message(); - return false; - } - - return true; -} - - -bool start() -{ - QScopedPointer kded( Kded() ); - if (!kded->isValid()) { - return false; - } - QDBusReply reply = kded->call( "loadModule", "khotkeys" ); - QDBusError err = reply.error(); - - if (err.isValid()) { - kError() << "Unable to start server org.kde.khotkeys (kded module) [" - << err.name() << "]:" << err.message(); - return false; - } - - Q_ASSERT( reply.isValid() ); - - if ( reply.value() ) { - return true; - } else { - kError() << "Unable to start server org.kde.khotkeys (kded module)"; - return false; - } -} - - -bool stop() -{ - if (!isRunning()) { - return true; - } - - QScopedPointer kded( Kded() ); - if (!kded->isValid()) { - return false; - } - - QDBusReply reply = kded->call( "unloadModule", "khotkeys" ); - QDBusError err = reply.error(); - - if (err.isValid()) { - kError() << "Error when stopping khotkeys kded module [" << err.name() << "]:" << err.message(); - return false; - } - - Q_ASSERT( reply.isValid() ); - - if ( reply.value() ) { - return true; - } else { - kError() << "Failed to stop server org.kde.khotkeys (kded module)"; - return false; - } -} - -}} // namespace KHotKeys::Daemon diff --git a/khotkeys/libkhotkeysprivate/daemon/daemon.h b/khotkeys/libkhotkeysprivate/daemon/daemon.h deleted file mode 100644 index 394ed9d3..00000000 --- a/khotkeys/libkhotkeysprivate/daemon/daemon.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef DAEMON_H -#define DAEMON_H -/* Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kdemacros.h" - -/** - * @author Michael Jansen - */ -namespace KHotKeys { - - namespace Daemon { - - KDE_EXPORT bool isRunning(); - KDE_EXPORT bool reload(); - KDE_EXPORT bool start(); - KDE_EXPORT bool stop(); - - /** - * Is the daemon enabled by the user? - */ - KDE_EXPORT bool isEnabled(); - } - -} // namespace KHotKeys::Daemon - -#endif /* #ifndef DAEMON_H */ diff --git a/khotkeys/libkhotkeysprivate/input.h b/khotkeys/libkhotkeysprivate/input.h deleted file mode 100644 index d3138911..00000000 --- a/khotkeys/libkhotkeysprivate/input.h +++ /dev/null @@ -1,25 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef KHOTKEYS_INPUT_H -#define KHOTKEYS_INPUT_H - -namespace KHotKeys -{ - -class Mouse - { - public: - static bool send_mouse_button( int button_P, bool release_P ); - }; - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/khotkeysglobal.cpp b/khotkeys/libkhotkeysprivate/khotkeysglobal.cpp deleted file mode 100644 index 9b56190e..00000000 --- a/khotkeys/libkhotkeysprivate/khotkeysglobal.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#define _KHOTKEYSGLOBAL_CPP_ - -#include "khotkeysglobal.h" - -#include -#include - -#include "input.h" -#include "windows_handler.h" -#include "triggers/triggers.h" -#include "shortcuts_handler.h" - -namespace KHotKeys -{ - -QPointer keyboard_handler = NULL; -QPointer windows_handler = NULL; - -static bool _khotkeys_active = false; - -void init_global_data( bool active_P, QObject* owner_P ) - { - // FIXME: get rid of that static_cast<>s. Don't know why they are there. - // Make these singletons. - if (!keyboard_handler) - { - keyboard_handler = new ShortcutsHandler( active_P ? ShortcutsHandler::Active : ShortcutsHandler::Configuration, owner_P ); - } - if (!windows_handler) - { - windows_handler = new WindowsHandler( active_P, owner_P ); - } - khotkeys_set_active( false ); - } - -void khotkeys_set_active( bool active_P ) - { - _khotkeys_active = active_P; - } - -bool khotkeys_active() - { - return _khotkeys_active; - } - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/khotkeysglobal.h b/khotkeys/libkhotkeysprivate/khotkeysglobal.h deleted file mode 100644 index 5c41d7f8..00000000 --- a/khotkeys/libkhotkeysprivate/khotkeysglobal.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef _KHOTKEYSGLOBAL_H_ -#define _KHOTKEYSGLOBAL_H_ - -#define KHOTKEYS_VERSION "2.1" -#define KHOTKEYS_CONFIG_FILE "khotkeysrc" - -#include -#include - -#include - -#include - -namespace KHotKeys -{ - -class WindowsHandler; -class ShortcutsHandler; - -KDE_EXPORT extern QPointer keyboard_handler; -extern QPointer windows_handler; - -// CHECKME hmms :( -KDE_EXPORT bool khotkeys_active(); -KDE_EXPORT void khotkeys_set_active( bool active_P ); - -KDE_EXPORT void init_global_data( bool active_P, QObject* owner_P ); - -const char* const MENU_EDITOR_ENTRIES_GROUP_NAME = I18N_NOOP( "Menu Editor entries" ); - -//*************************************************************************** -// Inline -//*************************************************************************** - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/libkhotkeysfwd.h b/khotkeys/libkhotkeysprivate/libkhotkeysfwd.h deleted file mode 100644 index c5da1b1e..00000000 --- a/khotkeys/libkhotkeysprivate/libkhotkeysfwd.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef LIBKHOTKEYSFWD_H -#define LIBKHOTKEYSFWD_H - -namespace KHotKeys - { - class Action; - class ActionDataBase; - class ActionDataGroup; - class ActionList; - class CommandUrlAction; - class DBusAction; - class MenuEntryAction; - class MenuEntryShortcutActionData; - class ShortcutTrigger; - class SimpleActionData; - class Trigger; - } - - -#endif /* #ifndef LIBKHOTKEYSFWD_H */ diff --git a/khotkeys/libkhotkeysprivate/settings.cpp b/khotkeys/libkhotkeysprivate/settings.cpp deleted file mode 100644 index 95c51634..00000000 --- a/khotkeys/libkhotkeysprivate/settings.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/** - * Copyright (C) 1999-2001 Lubos Lunak - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - **/ - -#include "settings.h" - -#include "action_data/action_data.h" -#include "settings_reader_v2.h" -#include "settings_writer.h" -#include "windows_helper/window_selection_list.h" - -#include -#include -#include -#include - -#include - -namespace KHotKeys -{ - -// Settings - -Settings::Settings() - : m_actions( NULL ) - { - reinitialize(); - } - - -Settings::~Settings() - { - delete m_actions; m_actions = 0; - } - - -ActionDataGroup *Settings::actions() - { - return m_actions; - } - - -const ActionDataGroup *Settings::actions() const - { - return m_actions; - } - -void Settings::disableDaemon() - { - daemon_disabled = true; - } - -void Settings::enableDaemon() - { - daemon_disabled = false; - } - -void Settings::exportTo( - ActionDataBase *what, - KConfigBase &config, - const QString &id, - KHotKeys::ActionState state, - bool allowMerging) - { - SettingsWriter writer(this, state, id, allowMerging); - writer.exportTo(what, config); - } - - -bool Settings::isDaemonDisabled() const - { - return daemon_disabled; - } - - -bool Settings::loadDefaults() - { - reinitialize(); - - // Load the default set. - QString installPath = KGlobal::dirs()->installPath("data"); - - KConfig file(installPath + "khotkeys/defaults.khotkeys"); - if (read_settings(m_actions, file, true, Enabled)) - { - kDebug() << "Loaded defaults from" << file.name(); - already_imported.append("defaults"); - return true; - } - else - { - kDebug() << "Failed to load defaults from" << file.name(); - return false; - } - - } - - -void Settings::reinitialize() - { - // Rereading settings. First delete what we have - setActions(NULL); - - daemon_disabled = false; - - already_imported = QStringList(); - } - - -void Settings::setActions( ActionDataGroup *actions ) - { - delete m_actions; - - m_actions = actions - ? actions - : new ActionDataGroup( - NULL, - "should never see", - "should never see", - NULL, - ActionDataGroup::SYSTEM_ROOT); - m_actions->enable(); - } - -ActionDataGroup *Settings::takeActions() - { - ActionDataGroup *res = m_actions; - m_actions = 0; - return res; - } - - -bool Settings::import(KConfig& config, ImportType ask, ActionState state) - { - return importFrom(m_actions, config, ask, state); - } - - -bool Settings::isConfigFileValid(KConfigBase const &config, ImportType ask) - { - bool valid = false; - - // The file is only valid if it has a main group - KConfigGroup mainGroup( &config, "Main" ); - if (mainGroup.isValid()) - { - // Now check the version - int version = mainGroup.readEntry( "Version", -1234576 ); - switch (version) - { - case 3: - valid = true; - break; - - case 2: - case 1: // Version 1 and 2 files no longer supported - kDebug() << "Version 1 or 2 file encountered."; - valid = false; - break; - - case -1234576: // No Version entry -> invalid file - kDebug() << "No version specified in file:"; - valid = false; - break; - - default: - kDebug() << "Invalid Version found:" << version; - valid = false; - break; - } - } - - // if it's valid we are finished. - if (valid) return valid; - - // See if we should inform the user. - switch (ask) - { - case ImportAsk: - { - KMessageBox::information( - QApplication::activeWindow(), - "The specified file is empty or not a configuration file", - "Import actions"); - } - break; - - case ImportSilent: - break; - - default: - Q_ASSERT(false); - } - - return valid; - } - - -bool Settings::importFrom(ActionDataGroup *element, KConfigBase const &config, ImportType ask, ActionState state) - { - // Make sure the given file is valid - if (!isConfigFileValid(config, ask)) return false; - - KConfigGroup mainGroup(&config, "Main"); - // A file can have a import id. - QString import_id = mainGroup.readEntry( "ImportId" ); - if (!import_id.isEmpty()) - { - // File has a id. Check for a previous import. - if (already_imported.contains( import_id )) - { - switch (ask) - { - case ImportAsk: - // Ask the user? - if( ask == ImportSilent - || ( ask == ImportAsk && KMessageBox::warningContinueCancel( - NULL, - i18n( "This \"actions\" file has already been imported before. " - "Are you sure you want to import it again?" )) != KMessageBox::Continue ) ) - { - return true; // import "successful" - } - break; - - case ImportSilent: - return true; - - default: - // Unknown ImportType. Most likely None. - Q_ASSERT(false); - return true; - } - } - else - { - already_imported.append(import_id); - } - } - else - { - switch (ask) - { - case ImportAsk: - if (KMessageBox::warningContinueCancel( - NULL, - i18n( "This \"actions\" file has no ImportId field and therefore it cannot be determined " - "whether or not it has been imported already. Are you sure you want to import it?" )) - == KMessageBox::Cancel ) - { - return true; - } - break; - - case ImportSilent: - return true; - - default: - // Unknown ImportType. Most likely None. - Q_ASSERT(false); - return true; - } - } - - // Include Disabled, Disable the imported actions - return read_settings(element, config, true, state); - } - - -void Settings::validate() - { - // Create the KMenuEdit group if it does not yet exist - get_system_group(ActionDataGroup::SYSTEM_MENUENTRIES); - } - - -ActionDataGroup *Settings::get_system_group(ActionDataGroup::system_group_t group_id) - { - Q_ASSERT(m_actions); - - // Search for the menuentries system group. - ActionDataGroup *system_group = NULL; - - Q_FOREACH(KHotKeys::ActionDataBase* element, m_actions->children()) - { - ActionDataGroup *group = dynamic_cast(element); - - if (group && (group->system_group() == group_id)) - { - system_group = group; - break; - } - } - - // Check if we found the group - if (system_group==NULL) - { - switch (group_id) - { - case ActionDataGroup::SYSTEM_MENUENTRIES: - system_group = new ActionDataGroup( - m_actions, - "KMenuEdit", - "KMenuEdit Global Shortcuts", - NULL, - ActionDataGroup::SYSTEM_MENUENTRIES); - system_group->enable(); - break; - - default: - Q_ASSERT(false); - return NULL; - } - } - - Q_ASSERT(system_group); - return system_group; - } - - -bool Settings::reread_settings(bool include_disabled) - { - KConfig config( KHOTKEYS_CONFIG_FILE ); - - // If we read the main settings and there is no main. Initialize the file - // and return - KConfigGroup mainGroup( &config, "Main" ); // main group - if (!mainGroup.exists()) - { - loadDefaults(); - validate(); - return false; - } - - // First delete what we have - reinitialize(); - - // ### Read the global configurations. Reinitialize sets the default - daemon_disabled = mainGroup.readEntry( "Disabled", daemon_disabled); - - // ### List of already imported configuration files - already_imported = mainGroup.readEntry( - "AlreadyImported", - QStringList()); - - bool rc = read_settings(m_actions, config, include_disabled, Retain); - // Ensure the system groups exist - validate(); - return rc; - } - - -bool Settings::read_settings(ActionDataGroup *root, KConfigBase const &config, bool include_disabled, ActionState stateStrategy) - { - // Make sure the given file is valid - if (!isConfigFileValid(config, ImportSilent)) return false; - - KConfigGroup mainGroup( &config, "Main" ); // main group - int version = mainGroup.readEntry( "Version", -1234576 ); - QString import_id = mainGroup.readEntry( "ImportId" ); - switch (version) - { - case 3: - { - kDebug() << "Version 3 File!"; - SettingsReaderV2 reader(this, include_disabled, stateStrategy, import_id); - reader.read(config, root); - } - break; - - default: - // All other values are impossible because of the - // isConfigFileValid() call above. - Q_ASSERT(false); - return false; - } - - return true; - } - - -bool Settings::update() - { - QStringList updates(KGlobal::dirs()->findAllResources("data", "khotkeys/*.khotkeys")); - bool imported(false); - - Q_FOREACH (const QString &path, updates) - { - // Import checks if the file was already imported. - KConfig file(path); - if (import(file, ImportSilent, Retain)) - { - kDebug() << "Imported file" << path; - imported = true; - } - } - - if (imported) - { - write(); - } - return false; - } - - -void Settings::write() - { - KConfig cfg( KHOTKEYS_CONFIG_FILE ); - SettingsWriter writer(this, Retain); - writer.writeTo(cfg); - } - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/settings.h b/khotkeys/libkhotkeysprivate/settings.h deleted file mode 100644 index 098f6137..00000000 --- a/khotkeys/libkhotkeysprivate/settings.h +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#ifndef _SETTINGS_H_ -#define _SETTINGS_H_ - -#include "actions/actions.h" -#include "action_data/action_data_group.h" -#include - -class KConfig; - -namespace KHotKeys -{ - -class ActionDataGroup; - -/** - * How to handle imports. - */ -enum ImportType - { - ImportNone, //!< no import is done - ImportAsk, //!< if already imported before, ask (called from GUI) - ImportSilent //!< if already imported before, ignore (called from the update script) - }; - -enum ActionState - { - Retain, //!< Keep the current state - Enabled, //!< Enable all actions - Disabled //!< Disable all actions - }; - - -/** - * Handles KHotKeys Settings. - * - * Settings are saved to the khotkeysrc file. - */ -class KDE_EXPORT Settings -{ - Q_DISABLE_COPY( Settings ) - -public: - - Settings(); - ~Settings(); - - /** - * Get the system group. - */ - ActionDataGroup *get_system_group(ActionDataGroup::system_group_t group_id); - - /** - * Read the settings. - * - * \param include_disabled_P Load disabled shortcuts? - */ - bool reread_settings(bool include_disabled = true); - - /** - * Update the settings. - * - * Checks if updates are available and imports them if not yet done. - */ - bool update(); - - /** - * Write the settings. - */ - void write(); - - /** - * Export settings to @a config. - * - * @param id use id for the exported file. - * @param state state to use for exported actions - */ - void exportTo( - ActionDataBase *what, - KConfigBase &config, - const QString &id, - ActionState state, - bool allowMerging); - - /** - * Import settings from \a cfg_P. - */ - bool import(KConfig& cfg_P, ImportType ask, ActionState state); - - bool importFrom( - ActionDataGroup *parent, - KConfigBase const &config, - ImportType ask, - ActionState state); - - /** - * Get all actions - */ - ActionDataGroup *actions(); - const ActionDataGroup *actions() const; - - /** - * Take the actions. - * - * \note Ownership is transfered to you. Subsequent calls to action() will - * return 0 - */ - ActionDataGroup *takeActions(); - - /** - * Set the actions. - * - * \note Ownership is taken. The current action list will be deleted. If - * \@a actions is NULL the method will create a new ActionDataGroup - */ - void setActions( ActionDataGroup *actions ); - - /** - * @name KHotkeys Daemon - */ - //@{ - /** - * Disable the daemon. - */ - void disableDaemon(); - - /** - * Enable the daemon. - */ - void enableDaemon(); - - /** - * Is the daemon disabled? - */ - bool isDaemonDisabled() const; - //@} - - /** - * Load the default settings - */ - bool loadDefaults(); - - /** - * Check if the given config file is a valid khotkeys file - */ - bool isConfigFileValid(KConfigBase const &config, ImportType ask); - -protected: - - /** - * Read settings from \a cfg_P. - * - * @param root the group to import to - * @param config config object to read from - * @param include_disabled should we read disabled actions? - * @param state enable, disable or keep the actions enabled state - */ - bool read_settings( - ActionDataGroup *root, - KConfigBase const &config, - bool include_disabled, - ActionState state); - - /** - * Make sure all System Groups exists - */ - void validate(); - -private: - - // Reset all values. No defaults are loaded - void reinitialize(); - - /** - * TODO - */ - ActionDataGroup* m_actions; - - /** - * KHotKeys daemon disabled? - */ - bool daemon_disabled; - - /** - * List of id's for all imported files. - */ - QStringList already_imported; - - friend class SettingsWriter; -}; - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/settings_reader_v2.cpp b/khotkeys/libkhotkeysprivate/settings_reader_v2.cpp deleted file mode 100644 index 10c2a1c8..00000000 --- a/khotkeys/libkhotkeysprivate/settings_reader_v2.cpp +++ /dev/null @@ -1,498 +0,0 @@ -/** - * Copyright (C) 1999-2001 Lubos Lunak - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - **/ - -#include "settings_reader_v2.h" - -#include "action_data/action_data_group.h" -#include "action_data/generic_action_data.h" -#include "action_data/menuentry_shortcut_action_data.h" -#include "action_data/simple_action_data.h" - -#include "conditions/conditions_list.h" - -#include "triggers/triggers.h" - -#include "windows_helper/window_selection_list.h" - - -#include "settings.h" - -#include -#include -#include -#include - - -SettingsReaderV2::SettingsReaderV2( - KHotKeys::Settings *settings, - bool loadAll, - KHotKeys::ActionState stateStrategy, - const QString &importId) - : _settings(settings), - _loadAll(loadAll), - _stateStrategy(stateStrategy), - _importId(importId) - { -#ifdef KHOTKEYS_TRACE - kDebug() << "Created SettingsReader with disableActions(" << _stateStrategy << ")"; -#endif - } - - -SettingsReaderV2::~SettingsReaderV2() - {} - - -void SettingsReaderV2::read(const KConfigBase &config, KHotKeys::ActionDataGroup *parent) - { - KConfigGroup data(&config, "Data"); - - // We have to skip the top level group. - QString configName = data.name(); - int cnt = data.readEntry("DataCount", 0); - for (int i = 1; i <= cnt; ++i) - { - KConfigGroup childConfig(data.config(), configName + '_' + QString::number(i)); - if (_loadAll || KHotKeys::ActionDataBase::cfg_is_enabled(childConfig)) - { - KHotKeys::ActionDataBase *elem = readActionData(childConfig, parent); - if (!_importId.isEmpty()) - elem->setImportId(_importId); - } - } - } - - -KHotKeys::ActionDataGroup *SettingsReaderV2::readGroup( - const KConfigGroup &config, - KHotKeys::ActionDataGroup *parent) - { -#ifdef KHOTKEYS_TRACE - kDebug() << "Reading group" << config.readEntry( "Name" ); -#endif - KHotKeys::ActionDataGroup *group = NULL; - - // Check if it is allowed to merge the group. If yes check for a group - // with the desired name - if (config.readEntry("AllowMerge", false)) - { - Q_FOREACH (KHotKeys::ActionDataBase *child, parent->children()) - { - if (KHotKeys::ActionDataGroup* existing = dynamic_cast< KHotKeys::ActionDataGroup* >(child)) - { - if (config.readEntry( "Name" ) == existing->name()) - { - group = existing; - break; - } - } - } - } - - // Do not allow loading a system group if there is already one. - unsigned int system_group_tmp = config.readEntry( "SystemGroup", 0 ); - if ((system_group_tmp != 0) && (system_group_tmp < KHotKeys::ActionDataGroup::SYSTEM_MAX)) - { - // It's a valid value. Get the system group and load into it - group = _settings->get_system_group( - static_cast< KHotKeys::ActionDataGroup::system_group_t > (system_group_tmp)); - } - - // if no group was found or merging is disabled create a new group - if (!group) - { - group = new KHotKeys::ActionDataGroup(parent); - _config = &config; - group->accept(this); - } - - Q_ASSERT(group); - - // Now load the children - QString configName = config.name(); - int cnt = config.readEntry("DataCount", 0); - for (int i = 1; i <= cnt; ++i) - { - KConfigGroup childConfig(config.config(), configName + '_' + QString::number(i)); - if (_loadAll || KHotKeys::ActionDataBase::cfg_is_enabled(childConfig)) - { - readActionData(childConfig, group); - } - } - - // The object is complete. Activate it if needed - switch (_stateStrategy) - { - case KHotKeys::Retain: - config.readEntry("Enabled", false) - ? group->enable() - : group->disable(); - break; - - case KHotKeys::Disabled: - // Its disabled by default - break; - - case KHotKeys::Enabled: - group->enable(); - break; - - default: - kWarning() << "Unkown stateStrategy"; - Q_ASSERT(false); - break; - }; - - return group; - } - - -KHotKeys::ActionDataBase *SettingsReaderV2::readActionData( - const KConfigGroup &config, - KHotKeys::ActionDataGroup *parent) - { - QString type = config.readEntry("Type"); - - if (type == "ACTION_DATA_GROUP") - { - return readGroup(config, parent); - } - - KHotKeys::ActionData *newObject = NULL; - - if (type == "GENERIC_ACTION_DATA") - { - newObject = new KHotKeys::Generic_action_data(parent); - } - else if (type == "MENUENTRY_SHORTCUT_ACTION_DATA") - { - // We collect all of those in the system group - newObject = new KHotKeys::MenuEntryShortcutActionData( - _settings->get_system_group(KHotKeys::ActionDataGroup::SYSTEM_MENUENTRIES)); - } - else if (type == "SIMPLE_ACTION_DATA" - || type == "COMMAND_URL_SHORTCUT_ACTION_DATA" - || type == "DCOP_SHORTCUT_ACTION_DATA" || type == "DBUS_SHORTCUT_ACTION_DATA" - || type == "KEYBOARD_INPUT_SHORTCUT_ACTION_DATA" - || type == "ACTIVATE_WINDOW_SHORTCUT_ACTION_DATA") - { - newObject = new KHotKeys::SimpleActionData(parent); - } - else - { - kWarning() << "Unknown ActionDataBase type read from cfg file\n"; - return NULL; - } - - _config = &config; - newObject->accept(this); - - // And the actions - readActionList(config, newObject); - - // Now load the triggers - readTriggerList(config, newObject); - - // The object is complete. Activate it if needed - switch (_stateStrategy) - { - case KHotKeys::Retain: - config.readEntry("Enabled", false) - ? newObject->enable() - : newObject->disable(); - break; - - case KHotKeys::Disabled: - // Its disabled by default - break; - - case KHotKeys::Enabled: - newObject->enable(); - break; - - default: - kWarning() << "Unkown stateStrategy"; - Q_ASSERT(false); - break; - }; - -#ifdef KHOTKEYS_TRACE - kDebug() << newObject->name() << "loaded into" << newObject->isEnabled(KHotKeys::ActionDataBase::Ignore) << "state"; -#endif - - return newObject; - } - - -KHotKeys::ActionList *SettingsReaderV2::readActionList( - const KConfigGroup &config, - KHotKeys::ActionData *parent) - { - KConfigGroup actionsGroup(config.config(), config.name() + "Actions"); - - int cnt = actionsGroup.readEntry( "ActionsCount", 0 ); - QString save_cfg_group = actionsGroup.name(); - for (int i=0; iaccept(*this); - - parent->add_action( action ); - } - - return NULL; - } - - -KHotKeys::Trigger_list *SettingsReaderV2::readTriggerList( - const KConfigGroup &config, - KHotKeys::ActionData *parent) - { - KConfigGroup triggersGroup(config.config(), config.name() + "Triggers"); - KHotKeys::Trigger_list *list = parent->triggers(); - - if (!triggersGroup.exists()) return list; - Q_ASSERT(list); - - list->set_comment(triggersGroup.readEntry("Comment")); - - KHotKeys::Trigger *trigger = NULL; - - int cnt = triggersGroup.readEntry( "TriggersCount", 0 ); - for (int i = 0; i < cnt; ++i) - { - KConfigGroup triggerConfig( triggersGroup.config(), triggersGroup.name() + QString::number( i )); - QString type = triggerConfig.readEntry("Type"); - QByteArray uuid = triggerConfig.readEntry( "Uuid", QByteArray() ); - if( uuid.isNull()) - uuid = createShortcutID(); - - if (type == "SHORTCUT" || type == "SINGLE_SHORTCUT") - trigger = new KHotKeys::ShortcutTrigger(parent, KShortcut(), uuid); - else if (type == "WINDOW") - trigger = new KHotKeys::WindowTrigger(parent); - else - { - kWarning() << "khotkeys: Unknown trigger type" << type; - return NULL; - } - - _config = & triggerConfig; - trigger->accept(*this); - - if (trigger) parent->add_trigger( trigger ); - } - - return list; - } - - -void SettingsReaderV2::visit(KHotKeys::ActivateWindowAction& action) - { - QString save_cfg_group = _config->name(); - KConfigGroup windowGroup(_config->config(), save_cfg_group + "Window" ); - action.set_window_list(new KHotKeys::Windowdef_list(windowGroup)); - } - - -void SettingsReaderV2::visit(KHotKeys::CommandUrlAction& action) - { - action.set_command_url(_config->readEntry("CommandURL")); - } - - -void SettingsReaderV2::visit(KHotKeys::DBusAction& action) - { - action.set_remote_application(_config->readEntry( "RemoteApp" )); - action.set_remote_object(_config->readEntry( "RemoteObj" )); - action.set_called_function(_config->readEntry( "Call" )); - action.set_arguments(_config->readEntry( "Arguments" )); - } - -void SettingsReaderV2::visit(KHotKeys::KeyboardInputAction& action) - { - action.setInput(_config->readEntry("Input")); - - KHotKeys::Windowdef_list *window_list = NULL; - KHotKeys::KeyboardInputAction::DestinationWindow destWindow; - - // Try the new format with DestinationWindow - int destination = _config->readEntry( "DestinationWindow", -1); - - - switch (destination) - { - case KHotKeys::KeyboardInputAction::SpecificWindow: - { - KConfigGroup windowGroup( _config->config(), _config->name() + "DestinationWindow" ); - window_list = new KHotKeys::Windowdef_list( windowGroup ); - destWindow = KHotKeys::KeyboardInputAction::SpecificWindow; - } - break; - - case KHotKeys::KeyboardInputAction::ActionWindow: - destWindow = KHotKeys::KeyboardInputAction::ActionWindow; - break; - - case KHotKeys::KeyboardInputAction::ActiveWindow: - destWindow = KHotKeys::KeyboardInputAction::ActiveWindow; - break; - - case -1: - { - // Old format - if(_config->readEntry( "IsDestinationWindow" , false)) - { - KConfigGroup windowGroup( _config->config(), _config->name() + "DestinationWindow" ); - window_list = new KHotKeys::Windowdef_list( windowGroup ); - destWindow = KHotKeys::KeyboardInputAction::SpecificWindow; - } - else - { - if (_config->readEntry( "ActiveWindow" , false)) destWindow = KHotKeys::KeyboardInputAction::ActiveWindow; - else destWindow = KHotKeys::KeyboardInputAction::ActionWindow; - } - } - break; - - default: - Q_ASSERT(false); - destWindow = KHotKeys::KeyboardInputAction::ActionWindow; - } - - if (!window_list) window_list = new KHotKeys::Windowdef_list; - - action.setDestination(destWindow); - action.setDestinationWindowRules(window_list); - } - - - -void SettingsReaderV2::visit(KHotKeys::MenuEntryAction& action) - { - visit( * static_cast(&action)); - } - - -void SettingsReaderV2::visit(KHotKeys::ShortcutTrigger &trigger) - { - QString shortcutString = _config->readEntry( "Key" ); - - // TODO: Check if this is still necessary - shortcutString.replace("Win+", "Meta+"); // Qt4 doesn't parse Win+, avoid a shortcut without modifier - - trigger.set_key_sequence(shortcutString); - } - - -void SettingsReaderV2::visit(KHotKeys::WindowTrigger &trigger) - { - KConfigGroup windowsConfig( _config->config(), _config->name() + "Windows" ); - trigger.set_window_rules(new KHotKeys::Windowdef_list(windowsConfig)); - trigger.setOnWindowEvents(KHotKeys::WindowTrigger::WindowEvents(_config->readEntry( "WindowActions", 0 ))); - } - - - -void SettingsReaderV2::visitActionDataBase( - KHotKeys::ActionDataBase *object) - { - object->set_name(_config->readEntry("Name")); - object->set_comment(_config->readEntry("Comment")); - object->setImportId(_config->readEntry("ImportId")); - object->setAllowMerging(_config->readEntry("AllowMerge", false)); - - KConfigGroup conditionsConfig( _config->config(), _config->name() + "Conditions" ); - - // Load the conditions if they exist - if ( conditionsConfig.exists() ) - { - object->set_conditions(new KHotKeys::Condition_list(conditionsConfig, object)); - } - else - { - object->set_conditions(new KHotKeys::Condition_list(QString(), object)); - } - } - - -void SettingsReaderV2::visitActionData( - KHotKeys::ActionData *object) - { - visitActionDataBase(object); - } - - -void SettingsReaderV2::visitActionDataGroup( - KHotKeys::ActionDataGroup *object) - { - unsigned int system_group_tmp = _config->readEntry( "SystemGroup", 0 ); - - // Correct wrong values - if(system_group_tmp >= KHotKeys::ActionDataGroup::SYSTEM_MAX) - { - system_group_tmp = 0; - } - - object->set_system_group(static_cast< KHotKeys::ActionDataGroup::system_group_t >(system_group_tmp)); - - visitActionDataBase(object); - } - - -void SettingsReaderV2::visitGenericActionData( - KHotKeys::Generic_action_data *object) - { - visitActionData(object); - } - - -void SettingsReaderV2::visitMenuentryShortcutActionData( - KHotKeys::MenuEntryShortcutActionData *object) - { - visitSimpleActionData(object); - } - - -void SettingsReaderV2::visitSimpleActionData( - KHotKeys::SimpleActionData *object) - { - visitActionData(object); - } diff --git a/khotkeys/libkhotkeysprivate/settings_reader_v2.h b/khotkeys/libkhotkeysprivate/settings_reader_v2.h deleted file mode 100644 index 4401c29b..00000000 --- a/khotkeys/libkhotkeysprivate/settings_reader_v2.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef SETTINGS_READER_V2_H -#define SETTINGS_READER_V2_H -/** - * Copyright (C) 1999-2001 Lubos Lunak - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - **/ - -#include "action_data/action_data_visitor.h" -#include "actions/actions.h" -#include "triggers/triggers.h" -#include "settings.h" - -class KConfigBase; -class KConfigGroup; - -namespace KHotKeys { - class Settings; - class Trigger_list; - template< typename T, typename A > class SimpleActionDataHelper; -} - - -/** - * @author Michael Jansen - */ -class SettingsReaderV2 : - public KHotKeys::ActionDataVisitor, - - public KHotKeys::ActionVisitor, - public KHotKeys::ActivateWindowActionVisitor, - public KHotKeys::CommandUrlActionVisitor, - public KHotKeys::DBusActionVisitor, - public KHotKeys::KeyboardInputActionVisitor, - public KHotKeys::MenuEntryActionVisitor, - - public KHotKeys::TriggerVisitor, - public KHotKeys::WindowTriggerVisitor, - public KHotKeys::ShortcutTriggerVisitor - { -public: - - SettingsReaderV2( - KHotKeys::Settings *settings, - bool loadAll = true, - KHotKeys::ActionState _stateStrategy = KHotKeys::Disabled, - const QString &importId = QString()); - - virtual ~SettingsReaderV2(); - - void read(const KConfigBase &config, KHotKeys::ActionDataGroup *parent); - - KHotKeys::ActionDataGroup *readGroup(const KConfigGroup &config, KHotKeys::ActionDataGroup *parent); - - KHotKeys::ActionDataBase *readActionData(const KConfigGroup &config, KHotKeys::ActionDataGroup *parent); - - KHotKeys::Trigger_list *readTriggerList(const KConfigGroup &config, KHotKeys::ActionData *parent); - - KHotKeys::ActionList *readActionList(const KConfigGroup &config, KHotKeys::ActionData *parent); - - virtual void visitActionDataBase(KHotKeys::ActionDataBase *base); - - virtual void visitActionData(KHotKeys::ActionData *group); - - virtual void visitActionDataGroup(KHotKeys::ActionDataGroup *group); - - virtual void visitGenericActionData(KHotKeys::Generic_action_data *data); - - virtual void visitMenuentryShortcutActionData(KHotKeys::MenuEntryShortcutActionData *data); - - virtual void visitSimpleActionData(KHotKeys::SimpleActionData *data); - - virtual void visit(KHotKeys::ActivateWindowAction&); - virtual void visit(KHotKeys::CommandUrlAction&); - virtual void visit(KHotKeys::DBusAction&); - virtual void visit(KHotKeys::KeyboardInputAction&); - virtual void visit(KHotKeys::MenuEntryAction&); - - virtual void visit(KHotKeys::ShortcutTrigger&); - virtual void visit(KHotKeys::WindowTrigger&); -private: - - const KConfigGroup *_config; - - KHotKeys::Settings *_settings; - - bool _loadAll; - - KHotKeys::ActionState _stateStrategy; - - QString _importId; - - }; // SettingsReaderV2 - - -#endif /* SETTINGS_READER_V2_H */ - diff --git a/khotkeys/libkhotkeysprivate/settings_writer.cpp b/khotkeys/libkhotkeysprivate/settings_writer.cpp deleted file mode 100644 index 8a251890..00000000 --- a/khotkeys/libkhotkeysprivate/settings_writer.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/** - * Copyright (C) 1999-2001 Lubos Lunak - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - **/ - - -#include "settings_writer.h" - -#include "action_data/action_data_group.h" -#include "action_data/action_data.h" -#include "action_data/generic_action_data.h" -#include "action_data/menuentry_shortcut_action_data.h" -#include "action_data/simple_action_data.h" - -#include "conditions/conditions_list.h" - -#include "settings.h" -#include "windows_helper/window_selection_list.h" - - -#include -#include -#include - -namespace KHotKeys { - -const int CurrentFileVersion = 3; - - -SettingsWriter::SettingsWriter( - const Settings *settings, - ActionState state, - const QString &id, - bool allowMerging) - : _settings(settings) - ,_state(state) - ,_importId(id) - ,_allowMerging(allowMerging) - ,_export(false) - { - } - - -void SettingsWriter::exportTo( - const ActionDataBase *element, - KConfigBase &config) - { - _export = true; - - if (!element) - { - Q_ASSERT(element); - return; - } - - // Clean the file - QStringList groups = config.groupList(); - Q_FOREACH (const QString &name, config.groupList()) - { - config.deleteGroup(name); - } - - KConfigGroup mainGroup(&config, "Main"); - mainGroup.writeEntry("Version", CurrentFileVersion); - mainGroup.writeEntry("AllowMerge", _allowMerging); - - if (!_importId.isEmpty()) mainGroup.writeEntry("ImportId", _importId); - - // The root group contains nothing but the datacount! - KConfigGroup dataGroup(&config, "Data"); - dataGroup.writeEntry("DataCount", 1); - - // The group for the element to export - KConfigGroup data1Group(&config, "Data_1"); - _stack.push(&data1Group); - element->accept(this); - _stack.pop(); - - _export = false; - } - - -void SettingsWriter::visitActionData(const ActionData *data) - { - visitActionDataBase(data); - - KConfigGroup *config = _stack.top(); - - // Write triggers if available - if (data->triggers()) - { - KConfigGroup triggersGroup( config->config(), config->name() + "Triggers" ); - data->triggers()->cfg_write( triggersGroup ); - } - - // Write actions if available - if (data->actions()) - { - KConfigGroup actionsGroup( config->config(), config->name() + "Actions" ); - data->actions()->cfg_write( actionsGroup ); - } - } - - -void SettingsWriter::visitActionDataBase(const ActionDataBase *base) - { - KConfigGroup *config = _stack.top(); - - config->writeEntry( "Type", "ERROR" ); // derived classes should call with their type - config->writeEntry( "Name", base->name()); - config->writeEntry( "Comment", base->comment()); - - switch (_state) - { - case KHotKeys::Retain: - config->writeEntry( "Enabled", base->isEnabled(ActionDataBase::Ignore)); - break; - - case KHotKeys::Enabled: - config->writeEntry("Enabled", true); - break; - - case KHotKeys::Disabled: - config->writeEntry("Enabled", false); - break; - - default: - Q_ASSERT(false); - config->writeEntry("Enabled", false); - } - - if (base->conditions()) - { - KConfigGroup conditionsConfig( config->config(), config->name() + "Conditions" ); - base->conditions()->cfg_write( conditionsConfig ); - } - else - { - kDebug() << "No conditions"; - } - } - -void SettingsWriter::visitActionDataGroup(const ActionDataGroup *group) - { - visitActionDataBase(group); - - KConfigGroup *config = _stack.top(); - - config->writeEntry( "SystemGroup", int(group->system_group())); - config->writeEntry( "Type", "ACTION_DATA_GROUP" ); - - int cnt = 0; - Q_FOREACH(ActionDataBase *child, group->children()) - { - ++cnt; - KConfigGroup childConfig( - config->config(), - config->name() + QString("_") + QString::number(cnt)); - _stack.push(&childConfig); - child->accept(this); - _stack.pop(); - } - config->writeEntry( "DataCount", cnt ); - - // We only write those two back if we do not export the settings - if (!_export) - { - // ImportId only if set - if (!group->importId().isEmpty()) - config->writeEntry("ImportId", group->importId()); - if (group->allowMerging()) - config->writeEntry("AllowMerge", group->allowMerging()); - } - - } - - -void SettingsWriter::visitGenericActionData(const Generic_action_data *data) - { - visitActionData(data); - - KConfigGroup *config = _stack.top(); - config->writeEntry( "Type", "GENERIC_ACTION_DATA" ); - } - - -void SettingsWriter::visitMenuentryShortcutActionData(const MenuEntryShortcutActionData *data) - { - visitActionData(data); - - KConfigGroup *config = _stack.top(); - config->writeEntry( "Type", "MENUENTRY_SHORTCUT_ACTION_DATA" ); - } - - -void SettingsWriter::visitSimpleActionData(const SimpleActionData *data) - { - visitActionData(data); - - KConfigGroup *config = _stack.top(); - config->writeEntry( "Type", "SIMPLE_ACTION_DATA" ); - } - - -void SettingsWriter::writeTo(KConfigBase &config) - { - QStringList groups = config.groupList(); - for( QStringList::ConstIterator it = groups.constBegin(); - it != groups.constEnd(); - ++it ) - config.deleteGroup( *it ); - - // Write the global settings - KConfigGroup mainGroup(&config, "Main"); - mainGroup.writeEntry("Version", CurrentFileVersion); - mainGroup.writeEntry("AlreadyImported", _settings->already_imported); - mainGroup.writeEntry("Disabled", _settings->isDaemonDisabled()); - - // Write the actions - KConfigGroup dataGroup( &config, "Data" ); - _stack.push(&dataGroup); - - int cnt = 0; - if (_settings->actions()) - { - Q_FOREACH(ActionDataBase *child, _settings->actions()->children()) - { - ++cnt; - KConfigGroup childConfig( - dataGroup.config(), - QString("Data_") + QString::number(cnt)); - _stack.push(&childConfig); - child->accept(this); - _stack.pop(); - } - } - dataGroup.writeEntry( "DataCount", cnt ); - _stack.pop(); - - // CHECKME Count still needed???? - // int cnt = write_actions( dataGroup, _settings->actions(), true ); - // mainGroup.writeEntry( "Autostart", cnt != 0 && !_settings->isDaemonDisabled() ); - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/settings_writer.h b/khotkeys/libkhotkeysprivate/settings_writer.h deleted file mode 100644 index 3d2d4bdf..00000000 --- a/khotkeys/libkhotkeysprivate/settings_writer.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef SETTINGS_WRITER_H -#define SETTINGS_WRITER_H -/** - * Copyright (C) 1999-2001 Lubos Lunak - * Copyright (C) 2009 Michael Jansen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - **/ - -#include "action_data/action_data_visitor.h" - -#include - -#include "settings.h" - -class KConfigBase; -class KConfigGroup; - -namespace KHotKeys { - - -/** - * @author Michael Jansen - */ -class SettingsWriter : public ActionDataConstVisitor - { - -public: - - SettingsWriter( - const Settings *settings, - ActionState state, - const QString &id = QString(), - bool allowMerging = false); - - void exportTo( - const ActionDataBase *element, - KConfigBase &config); - - void writeTo(KConfigBase &cfg); - - virtual void visitActionDataBase(const ActionDataBase *base); - - virtual void visitActionData(const ActionData *group); - - virtual void visitActionDataGroup(const ActionDataGroup *group); - - virtual void visitGenericActionData(const Generic_action_data *data); - - virtual void visitMenuentryShortcutActionData(const MenuEntryShortcutActionData *data); - - virtual void visitSimpleActionData(const SimpleActionData *data); - -private: - - const Settings *_settings; - - QStack _stack; - - ActionState _state; - - QString _importId; - - bool _allowMerging; - - bool _export; - - // Disable copying - SettingsWriter(const SettingsWriter&); - SettingsWriter& operator=(const SettingsWriter&); - - }; //SettingsWriter - -} // namespace KHotKeys - - -#endif /* SETTINGS_WRITER_H */ - diff --git a/khotkeys/libkhotkeysprivate/shortcuts_handler.cpp b/khotkeys/libkhotkeysprivate/shortcuts_handler.cpp deleted file mode 100644 index 3f62b031..00000000 --- a/khotkeys/libkhotkeysprivate/shortcuts_handler.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include - -#include "input.h" -#include "triggers/triggers.h" -#include "shortcuts_handler.h" -#include "windows_handler.h" -#include "khotkeysglobal.h" - -#include -// #include -#include -#include - -#include -#include - -#include - -namespace KHotKeys { - - -ShortcutsHandler::ShortcutsHandler( HandlerType type, QObject *parent ) - : QObject(parent) - ,_type(type) - ,_actions(new KActionCollection(this)) - { - _actions->setComponentData(KComponentData("khotkeys")); - } - - -ShortcutsHandler::~ShortcutsHandler() - { - _actions->clear(); - delete _actions; - } - - -KAction *ShortcutsHandler::addAction( - const QString &id, - const QString &text, - const KShortcut &shortcut ) - { -#ifdef KHOTKEYS_TRACE - kDebug() << id << text << shortcut; -#endif - QString realId(id); - // HACK: Do this correctly. Remove uuid on importing / exporting - // On import it can happen that id is already taken. Create it under a - // different name then. - if (_actions->action(id)) - { - qDebug() << id << " already present. Using new id!"; - realId = QString::fromLatin1(createShortcutID()); - } - - // Create the action - KAction *newAction = _actions->addAction(realId); - if (!newAction) - { - return 0; - } - // If our HandlerType is configuration we have to tell kdedglobalaccel - // that this action is only for configuration purposes. - // see KAction::~KAction - if (_type==Configuration) - { - newAction->setProperty("isConfigurationAction", QVariant(true)); - } - newAction->setText(text); - newAction->setGlobalShortcut( shortcut, KAction::ActiveShortcut ); - // Enable global shortcut. If that fails there is no sense in proceeding - if (!newAction->isGlobalShortcutEnabled()) - { - kWarning() << "Failed to enable global shortcut for '" - << text << "' " << id; - _actions->removeAction(newAction); - return 0; - } - Q_ASSERT(newAction->isEnabled()); - - connect( - newAction, SIGNAL(globalShortcutChanged(QKeySequence)), - this, SIGNAL(shortcutChanged())); - - return newAction; - } - - -QAction *ShortcutsHandler::getAction( const QString &id ) - { - return _actions->action(id); - } - - -bool ShortcutsHandler::removeAction( const QString &id ) - { - QAction *action = getAction( id ); - if (!action) - { - return false; - } - else - { - // This will delete the action. - _actions->removeAction(action); - - return true; - } - } - - -#ifdef HAVE_XTEST - -} // namespace KHotKeys -#include -namespace KHotKeys -{ - -static bool xtest_available = false; -static bool xtest_inited = false; -static bool xtest() - { - if( xtest_inited ) - return xtest_available; - xtest_inited = true; - int dummy1, dummy2, dummy3, dummy4; - xtest_available = - ( XTestQueryExtension( QX11Info::display(), &dummy1, &dummy2, &dummy3, &dummy4 ) == True ); - return xtest_available; - } -#endif - -bool ShortcutsHandler::send_macro_key( const QKeySequence &key, Window window_P ) - { - kDebug() << key << key.count() << window_P; - - if (key.isEmpty()) - return false; - - unsigned int keysym = key[0]; - int x_keycode; - KKeyServer::keyQtToCodeX(keysym, &x_keycode); - if( x_keycode == NoSymbol ) - return false; - - unsigned int x_mod; - KKeyServer::keyQtToModX(keysym, &x_mod ); -#ifdef HAVE_XTEST - if( xtest() && window_P == None ) - { - // CHECKME tohle jeste potrebuje modifikatory - bool ret = XTestFakeKeyEvent( QX11Info::display(), x_keycode, True, CurrentTime ); - ret = ret && XTestFakeKeyEvent( QX11Info::display(), x_keycode, False, CurrentTime ); - return ret; - } -#endif - if( window_P == None || window_P == InputFocus ) - window_P = windows_handler->active_window(); - if( window_P == None ) // CHECKME tohle cele je ponekud ... - window_P = InputFocus; - XEvent ev; - ev.type = KeyPress; - ev.xkey.display = QX11Info::display(); - ev.xkey.window = window_P; - ev.xkey.root = QX11Info::appRootWindow(); // I don't know whether these have to be set - ev.xkey.subwindow = None; // to these values, but it seems to work, hmm - ev.xkey.time = CurrentTime; - ev.xkey.x = 0; - ev.xkey.y = 0; - ev.xkey.x_root = 0; - ev.xkey.y_root = 0; - ev.xkey.keycode = x_keycode; - ev.xkey.state = x_mod; - ev.xkey.same_screen = True; - bool ret = XSendEvent( QX11Info::display(), window_P, True, KeyPressMask, &ev ); -#if 1 - ev.type = KeyRelease; // is this actually really needed ?? - ev.xkey.display = QX11Info::display(); - ev.xkey.window = window_P; - ev.xkey.root = QX11Info::appRootWindow(); - ev.xkey.subwindow = None; - ev.xkey.time = CurrentTime; - ev.xkey.x = 0; - ev.xkey.y = 0; - ev.xkey.x_root = 0; - ev.xkey.y_root = 0; - ev.xkey.state = x_mod; - ev.xkey.keycode = x_keycode; - ev.xkey.same_screen = True; - ret = ret && XSendEvent( QX11Info::display(), window_P, True, KeyReleaseMask, &ev ); -#endif - // Qt's autorepeat compression is broken and can create "aab" from "aba" - // XSync() should create delay longer than Qt's max autorepeat interval - XSync( QX11Info::display(), False ); - return ret; - } - - -bool Mouse::send_mouse_button( int button_P, bool release_P ) - { -#ifdef HAVE_XTEST - if( xtest()) - { - // CHECKME tohle jeste potrebuje modifikatory - // a asi i spravnou timestamp misto CurrentTime - bool ret = XTestFakeButtonEvent( QX11Info::display(), button_P, True, CurrentTime ); - if( release_P ) - ret = ret && XTestFakeButtonEvent( QX11Info::display(), button_P, False, CurrentTime ); - return ret; - } -#endif - return false; - } - -} // namespace KHotKeys - -#include "moc_shortcuts_handler.cpp" diff --git a/khotkeys/libkhotkeysprivate/shortcuts_handler.h b/khotkeys/libkhotkeysprivate/shortcuts_handler.h deleted file mode 100644 index 07bdd05f..00000000 --- a/khotkeys/libkhotkeysprivate/shortcuts_handler.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef SHORTCUTACTIONS_H -#define SHORTCUTACTIONS_H - - -#include - -#include -#include - - -class KAction; -class KShortcut; - -namespace KHotKeys { - -/** - * @author Michael Jansen - */ -class ShortcutsHandler : public QObject - { - Q_OBJECT - -public: - - enum HandlerType { - Active, //!< Create real actions - Configuration }; //!< Create configuration actions ( not active ) - - /** - * Default constructor - * - * \param Should - */ - ShortcutsHandler( HandlerType type = Active, QObject *parent = 0 ); - - /** - * Destructor - */ - ~ShortcutsHandler(); - - /** - * Create a action. - * - * The action stays in the ownership of this class. Do not delete. - * - * \param id Persistent id for the action - * \param name Name for the action. Is used in the global shortcut - * configuration dialog - * \param shortcut Shortcut that triggers the action - * - * \return The new action or 0 if an error occurred. - * - * \see KAction::registerGlobalShortcut() - */ - KAction *addAction( - const QString &id, - const QString &text, - const KShortcut &shortcut ); - - /** - * Remove a action from the collection. - * - * \param id Persistent id for the action - * - * \return The action or 0 if not found. - */ - QAction *getAction( const QString &id ); - - /** - * Remove a action from the collection. - * - * \param id Persistent id for the action - * - * \return true if the action was removed. - */ - bool removeAction( const QString &id ); - - /** - * From Kbd. - * - * \warning Does nothing, returns false - */ - bool send_macro_key( const QKeySequence &key, Window window_P ); - -Q_SIGNALS: - - /** - * One of the actions shortcuts was changed. - */ - void shortcutChanged() const; - -private: - - HandlerType _type; - - KActionCollection *_actions; - -}; - -} // namespace KHotKeys - -#endif /* #ifndef SHORTCUTACTIONS_H */ diff --git a/khotkeys/libkhotkeysprivate/triggers/shortcut_trigger.cpp b/khotkeys/libkhotkeysprivate/triggers/shortcut_trigger.cpp deleted file mode 100644 index 9da0a9cd..00000000 --- a/khotkeys/libkhotkeysprivate/triggers/shortcut_trigger.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "triggers/triggers.h" -#include "action_data/action_data.h" -#include "windows_handler.h" - -#include -#include -#include - -#include "shortcuts_handler.h" - -namespace KHotKeys { - -ShortcutTriggerVisitor::~ShortcutTriggerVisitor() - {} - - -ShortcutTrigger::ShortcutTrigger( - ActionData* data_P, - const KShortcut& shortcut, - const QByteArray &uuid ) - : Trigger( data_P ), - _uuid(uuid), - _active(false), - _shortcut(shortcut) - { - } - - -ShortcutTrigger::~ShortcutTrigger() - { - keyboard_handler->removeAction( _uuid ); - } - - -void ShortcutTrigger::accept(TriggerVisitor& visitor) - { - if (ShortcutTriggerVisitor *v = dynamic_cast(&visitor)) - { - v->visit(*this); - } - else - { - kDebug() << "Visitor error"; - } - } - - -void ShortcutTrigger::aboutToBeErased() - { - disable(); - } - - -void ShortcutTrigger::activate( bool newState ) - { -#ifdef KHOTKEYS_TRACE - kDebug() << "new:" << newState << "old:" << _active; -#endif - // If there is no change in state just return. - if (newState == _active) - return; - - _active = newState; - - if (_active) - { - QString name = data - ? data->name() - : "TODO"; - - // FIXME: The following workaround tries to prevent having two actions with - // the same uuid. That happens wile exporting/importing actions. The uuid - // is exported too. - KAction *act = keyboard_handler->addAction( _uuid, name, _shortcut ); - // addAction can change the uuid. That's why we store the uuid from the - // action - _uuid = act->objectName().toLatin1(); - - connect( - act, SIGNAL(triggered(bool)), - this, SLOT(trigger()) ); - - connect( - act, SIGNAL(globalShortcutChanged(QKeySequence)), - this, SIGNAL(globalShortcutChanged(QKeySequence))); - } - else - { - // Disable the trigger. Delete the action. - KAction *action = qobject_cast(keyboard_handler->getAction( _uuid )); - if(action) - { - // In case the shortcut was changed from the kcm. - _shortcut = action->globalShortcut(); - keyboard_handler->removeAction(_uuid); - } - } - } - - -void ShortcutTrigger::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Key", shortcut().toString()); - cfg_P.writeEntry( "Type", "SHORTCUT" ); // overwrites value set in base::cfg_write() - cfg_P.writeEntry( "Uuid", _uuid ); - } - - -ShortcutTrigger* ShortcutTrigger::copy( ActionData* data_P ) const - { - return new ShortcutTrigger( data_P ? data_P : data, shortcut(), createShortcutID()); - } - - -const QString ShortcutTrigger::description() const - { - return i18n( "Shortcut trigger: " ) + shortcut().toString(); - } - - -void ShortcutTrigger::disable() - { - activate(false); - - // Unregister the shortcut with kglobalaccel - KAction *action = qobject_cast(keyboard_handler->getAction( _uuid )); - if(action) - { - // In case the shortcut was changed from the kcm. - _shortcut = action->globalShortcut(); - - - // Unregister the global shortcut. - action->forgetGlobalShortcut(); - keyboard_handler->removeAction(_uuid); - } - } - - -void ShortcutTrigger::enable() - { - // To enable the shortcut we have to just register it once with - // kglobalaccel and deactivate it immediately - activate(true); - activate(false); - } - - -void ShortcutTrigger::set_key_sequence( const QKeySequence &seq ) - { - // Get the action from the keyboard handler - KAction *action = qobject_cast(keyboard_handler->getAction( _uuid )); - if (!action) - { - _shortcut.setPrimary(seq); - } - else - { - action->setGlobalShortcut( - KShortcut(seq), - KAction::ActiveShortcut, - KAction::NoAutoloading ); - } - } - - -KShortcut ShortcutTrigger::shortcut() const - { - // Get the action from the keyboard handler - KAction *action = qobject_cast(keyboard_handler->getAction( _uuid )); - if (!action) - { - // Not active! - return _shortcut; - } - - return action->globalShortcut(); - } - - -void ShortcutTrigger::trigger() - { - if (khotkeys_active()) - { - windows_handler->set_action_window( 0 ); // use active window - data->execute(); - } - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/triggers/trigger.cpp b/khotkeys/libkhotkeysprivate/triggers/trigger.cpp deleted file mode 100644 index 3521434f..00000000 --- a/khotkeys/libkhotkeysprivate/triggers/trigger.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "triggers.h" - -#include -#include - -namespace KHotKeys - { - -TriggerVisitor::~TriggerVisitor() - {} - - -Trigger::Trigger( ActionData* data_P ) - : data( data_P ) - { - } - - -Trigger::~Trigger() - { - } - - -void Trigger::aboutToBeErased() - {} - - -void Trigger::cfg_write( KConfigGroup& cfg_P ) const - { - cfg_P.writeEntry( "Type", "ERROR" ); - } - - - -void Trigger::enable() - {} - - -void Trigger::disable() - {} - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/triggers/trigger_list.cpp b/khotkeys/libkhotkeysprivate/triggers/trigger_list.cpp deleted file mode 100644 index 2d01db80..00000000 --- a/khotkeys/libkhotkeysprivate/triggers/trigger_list.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "triggers.h" - -#include - -namespace KHotKeys { - -Trigger_list::Trigger_list( const QString& comment_P ) - : QList< Trigger* >(), _comment( comment_P ) - { - } - - -Trigger_list::~Trigger_list() - { - while (!isEmpty()) - { - delete takeFirst(); - } - } - -void Trigger_list::aboutToBeErased() - { - QListIterator it(*this); - while (it.hasNext()) - { - it.next()->aboutToBeErased(); - } - } - - -void Trigger_list::activate( bool activate_P ) - { - for( Trigger_list::Iterator it = begin(); - it != end(); - ++it ) - { - ( *it )->activate( activate_P ); - } - } - - -void Trigger_list::cfg_write( KConfigGroup& cfg_P ) const - { - cfg_P.writeEntry( "Comment", comment()); - int i = 0; - for( Trigger_list::ConstIterator it = begin(); - it != end(); - ++it ) - { - KConfigGroup triggerConfig( cfg_P.config(), cfg_P.name() + QString::number( i++ )); - (*it)->cfg_write( triggerConfig ); - } - cfg_P.writeEntry( "TriggersCount", i ); - } - - -const QString Trigger_list::comment() const - { - return _comment; - } - - -Trigger_list* Trigger_list::copy( ActionData* data_P ) const - { - Trigger_list* ret = new Trigger_list( comment()); - for( Trigger_list::ConstIterator it = begin(); - it != end(); - ++it ) - { - ret->append( (*it)->copy( data_P )); - } - return ret; - } - - -void Trigger_list::set_comment(const QString &comment) - { - _comment = comment; - } - - -void Trigger_list::disable() - { - QListIterator it(*this); - while (it.hasNext()) - { - it.next()->disable(); - } - } - - -void Trigger_list::enable() - { - QListIterator it(*this); - while (it.hasNext()) - { - it.next()->enable(); - } - } - - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/triggers/triggers.cpp b/khotkeys/libkhotkeysprivate/triggers/triggers.cpp deleted file mode 100644 index 43746d7d..00000000 --- a/khotkeys/libkhotkeysprivate/triggers/triggers.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "moc_triggers.cpp" diff --git a/khotkeys/libkhotkeysprivate/triggers/triggers.h b/khotkeys/libkhotkeysprivate/triggers/triggers.h deleted file mode 100644 index 134fc38c..00000000 --- a/khotkeys/libkhotkeysprivate/triggers/triggers.h +++ /dev/null @@ -1,308 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _TRIGGERS_H_ -#define _TRIGGERS_H_ - -#include -#include -#include - -#include - -#include -#include "khotkeysglobal.h" - -#include "input.h" -#include "windows_handler.h" - -#include - -static inline QByteArray createShortcutID() -{ - return qRandomUuid(); -} - -namespace KHotKeys -{ - -class Windowdef_list; -class ActionData; - -class TriggerVisitor - { -public: - virtual ~TriggerVisitor(); - }; - - -class KDE_EXPORT Trigger - { - Q_DISABLE_COPY( Trigger ) - - public: - - enum TriggerType - { - ShortcutTriggerType = 0x01, //!< @see ShortcutTrigger - WindowTriggerType = 0x02, //!< @see WindowTrigger - TriggerListType = 0x04, //!< @see Trigger_list - AllTypes = 0xFF //!< All types. For convenience. - }; - - Q_DECLARE_FLAGS(TriggerTypes, TriggerType) - - Trigger( ActionData* data_P ); - virtual ~Trigger(); - virtual void cfg_write( KConfigGroup& cfg_P ) const = 0; - virtual Trigger* copy( ActionData* data_P ) const = 0; - virtual const QString description() const = 0; - virtual void activate( bool activate_P ) = 0; - - //! Disable the trigger - virtual void disable(); - - //! Enable the trigger - virtual void enable(); - - /** - * The trigger will be erased permanently - */ - virtual void aboutToBeErased(); - - /** - * The actual type for this trigger - */ - virtual TriggerType type() const = 0; - - /** - * Acyclic visitor pattern - */ - virtual void accept(TriggerVisitor&) = 0; - - protected: - ActionData* const data; - }; - -Q_DECLARE_OPERATORS_FOR_FLAGS(Trigger::TriggerTypes) - - -class KDE_EXPORT Trigger_list - : public QList< Trigger* > - { - Q_DISABLE_COPY( Trigger_list ) - - public: - Trigger_list( const QString& comment = QString() ); - virtual ~Trigger_list(); - - void activate( bool activate_P ); - void cfg_write( KConfigGroup& cfg_P ) const; - //! Some convenience typedef - typedef QList< Trigger* >::Iterator Iterator; - typedef QList< Trigger* >::ConstIterator ConstIterator; - const QString comment() const; - void set_comment(const QString &); - Trigger_list* copy( ActionData* data_P ) const; - - //! Disable the trigger - virtual void disable(); - - //! Enable the trigger - virtual void enable(); - - /** - * @reimp - */ - void aboutToBeErased(); - - private: - QString _comment; - }; - - -class ShortcutTrigger; -class ShortcutTriggerVisitor - { -public: - virtual ~ShortcutTriggerVisitor(); - virtual void visit(ShortcutTrigger&) = 0; - }; - - -class KDE_EXPORT ShortcutTrigger - : public QObject, public Trigger - { - Q_OBJECT - - typedef Trigger base; - public: - ShortcutTrigger( - ActionData* data, - const KShortcut& shortcut = KShortcut(), - const QByteArray &uuid = createShortcutID() ); - - virtual ~ShortcutTrigger(); - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual ShortcutTrigger* copy( ActionData* data_P ) const; - virtual const QString description() const; - KShortcut shortcut() const; - virtual void activate( bool activate_P ); - - void set_key_sequence( const QKeySequence &seq ); - - virtual TriggerType type() const { return ShortcutTriggerType; } - - /** - * @reimp - */ - void aboutToBeErased(); - - //! Disable the trigger - virtual void disable(); - - //! Enable the trigger - virtual void enable(); - - /** - * Acyclic visitor pattern - */ - virtual void accept(TriggerVisitor&); - - Q_SIGNALS: - - //! Emitted when the global shortcut is changed from somewhere else - // (Global Shortcuts KCM) - void globalShortcutChanged(const QKeySequence&); - - public Q_SLOTS: - - void trigger(); - - private: - - //! A persistent identifier for this shortcut - QByteArray _uuid; - - //! Are the conditions met? - bool _active; - - /** - * The Key Sequence associated with this Trigger. This is needed - * because a inactive trigger doesn't register it's shortcut with - * kde's global shortcuts registry so we have to remember the shortcut - * ourselves. Beware of synchronizing saved state, global shortcuts - * registry state and state of this var :-) . - */ - KShortcut _shortcut; - - - - }; - - -class WindowTrigger; -class WindowTriggerVisitor - { -public: - virtual ~WindowTriggerVisitor(); - virtual void visit(WindowTrigger&) = 0; - }; - - -class KDE_EXPORT WindowTrigger : public QObject, public Trigger - { - Q_OBJECT - - Q_FLAGS(WindowEvents) - - typedef Trigger base; - - public: - - enum window_action_t - { - NONE = 0, - WINDOW_APPEARS = ( 1 << 0 ), //!< The window is opened - WINDOW_DISAPPEARS = ( 1 << 1 ), //!< The window is closed - WINDOW_ACTIVATES = ( 1 << 2 ), //!< The window gets the focus - WINDOW_DEACTIVATES = ( 1 << 3 ) //!< The window loses the focus - }; - - Q_DECLARE_FLAGS(WindowEvents, window_action_t) - - WindowTrigger( - ActionData* data, - Windowdef_list* windowslist = NULL, - WindowEvents window_actions = 0 ); - - void setOnWindowEvents(WindowEvents events); - - virtual ~WindowTrigger(); - virtual void cfg_write( KConfigGroup& cfg_P ) const; - virtual WindowTrigger* copy( ActionData* data_P ) const; - virtual const QString description() const; - const Windowdef_list* windows() const; - void set_window_rules(Windowdef_list *list); - Windowdef_list* windows(); - bool triggers_on( window_action_t w_action_P ) const; - virtual void activate( bool activate_P ); - - virtual TriggerType type() const { return WindowTriggerType; } - - - - /** - * Acyclic visitor pattern - */ - virtual void accept(TriggerVisitor&); - - protected Q_SLOTS: - void window_added( WId window_P ); - void window_removed( WId window_P ); - void active_window_changed( WId window_P ); - void window_changed( WId window_P, unsigned int dirty_P ); - - private: - - //! Useful code for all constructors - void init(); - - Windowdef_list* _windows; - - WindowEvents window_actions; - - typedef QMap< WId, bool > Windows_map; - - //! Internal cache. Remembers if a window is a match or not, - Windows_map existing_windows; - - //! The last active window - WId last_active_window; - - //! Is the trigger active? - bool active; - }; - -Q_DECLARE_OPERATORS_FOR_FLAGS(WindowTrigger::WindowEvents) - -} // namespace KHotKeys - - -#endif diff --git a/khotkeys/libkhotkeysprivate/triggers/window_trigger.cpp b/khotkeys/libkhotkeysprivate/triggers/window_trigger.cpp deleted file mode 100644 index 0651c9a0..00000000 --- a/khotkeys/libkhotkeysprivate/triggers/window_trigger.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "triggers/triggers.h" -#include "action_data/action_data.h" -#include "windows_handler.h" -#include "windows_helper/window_selection_list.h" - -#include -#include - -#include - -namespace KHotKeys { - - -WindowTriggerVisitor::~WindowTriggerVisitor() - {} - - -WindowTrigger::WindowTrigger( - ActionData* data_P, - Windowdef_list* windows_P, - WindowEvents window_actions_P) - : Trigger( data_P ), - _windows( windows_P ), - window_actions( window_actions_P ), - existing_windows(), - last_active_window( None ), - active( true ) - { - if (!_windows) - { - _windows = new Windowdef_list( "Windowdef_list comment"); - } - - Q_ASSERT(_windows->isEmpty()); - init(); - } - - -WindowTrigger::~WindowTrigger() - { -// kDebug() << "~WindowTrigger :" << this; - disconnect( windows_handler, NULL, this, NULL ); - delete _windows; - } - - -void WindowTrigger::accept(TriggerVisitor& visitor) - { - if (WindowTriggerVisitor *v = dynamic_cast(&visitor)) - { - v->visit(*this); - } - else - { - kDebug() << "Visitor error"; - } - } - - -void WindowTrigger::init() - { - kDebug() << "WindowTrigger::init()"; - connect( windows_handler, SIGNAL(window_added(WId)), this, SLOT(window_added(WId))); - connect( windows_handler, SIGNAL(window_removed(WId)), this, SLOT(window_removed(WId))); - if( window_actions & ( WINDOW_ACTIVATES | WINDOW_DEACTIVATES /*| WINDOW_DISAPPEARS*/ )) - connect( windows_handler, SIGNAL(active_window_changed(WId)), - this, SLOT(active_window_changed(WId))); - connect( windows_handler, SIGNAL(window_changed(WId,uint)), - this, SLOT(window_changed(WId,uint))); - } - - -void WindowTrigger::activate( bool activate_P ) - { - active = activate_P; - } - - -void WindowTrigger::active_window_changed( WId window_P ) - { - if (!existing_windows.contains(window_P)) - { - existing_windows[window_P] = windows()->match( Window_data( window_P )); - } - - if (!active || !khotkeys_active()) - { - // We still keep track of the last active window so we have valid data - // if khotkeys is switched on again. - last_active_window = window_P; - return; - } - - // Check if the last active window was a match for us - bool was_match = existing_windows.contains(last_active_window) - ? existing_windows[last_active_window] - : false; - - if (was_match && (window_actions & WINDOW_DEACTIVATES)) - { - windows_handler->set_action_window( window_P ); - data->execute(); - } - - if (existing_windows[window_P] && ( window_actions & WINDOW_ACTIVATES)) - { - kDebug() << "Executing data"; - windows_handler->set_action_window( window_P ); - data->execute(); - } - - last_active_window = window_P; - } - - -void WindowTrigger::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - KConfigGroup windowsConfig( cfg_P.config(), cfg_P.name() + "Windows" ); - if (windows()) - { - windows()->cfg_write( windowsConfig ); - } - cfg_P.writeEntry( "WindowActions", static_cast(window_actions)); - cfg_P.writeEntry( "Type", "WINDOW" ); // overwrites value set in base::cfg_write() - } - - -const QString WindowTrigger::description() const - { - return i18n( "Window trigger: " ) + windows()->comment(); - } - - -void WindowTrigger::setOnWindowEvents(WindowEvents events) - { - window_actions = events; - } - - -void WindowTrigger::set_window_rules(Windowdef_list *list) - { - delete _windows; - _windows = list; - } - - -bool WindowTrigger::triggers_on( window_action_t w_action_P ) const - { - return window_actions & w_action_P; - } - - -void WindowTrigger::window_added( WId window_P ) - { - // Always keep track of windows, - existing_windows[window_P] = windows()->match( Window_data( window_P )); - - if (!active || !khotkeys_active()) - { - return; - } - - if (existing_windows[window_P] && (window_actions & WINDOW_APPEARS)) - { - windows_handler->set_action_window(window_P); - data->execute(); - } - } - - -void WindowTrigger::window_removed( WId window_P ) - { - // Always keep track of windows, - bool matches = false; - if (existing_windows.contains(window_P)) - { - matches = existing_windows[window_P]; - existing_windows.remove( window_P ); - } - - if (!active || !khotkeys_active()) - { - return; - } - - if (matches && (window_actions & WINDOW_DISAPPEARS)) - { - windows_handler->set_action_window( window_P ); - data->execute(); - } - } - - -void WindowTrigger::window_changed( WId window_P, unsigned int dirty_P ) - { - if (! (dirty_P & (NET::WMName | NET::WMWindowType))) - return; - - // Check if the old state was a match - bool was_match = false; - if (existing_windows.contains(window_P)) - was_match = existing_windows[window_P]; - - // Check if the new state is a match - bool matches = windows()->match( Window_data( window_P )); - existing_windows[window_P] = matches; - - if (!active || !khotkeys_active()) - { - return; - } - - if (matches && !was_match) - { - if (window_actions & WINDOW_APPEARS) - { - windows_handler->set_action_window( window_P ); - data->execute(); - } - else if (window_actions & WINDOW_ACTIVATES && window_P == windows_handler->active_window()) - { - windows_handler->set_action_window( window_P ); - data->execute(); - } - } - } - - -const Windowdef_list* WindowTrigger::windows() const - { - return _windows; - } - - -Windowdef_list* WindowTrigger::windows() - { - return _windows; - } - - -WindowTrigger* WindowTrigger::copy( ActionData* data_P ) const - { - WindowTrigger* ret = new WindowTrigger( data_P ? data_P : data, windows()->copy(), - window_actions ); - ret->existing_windows = existing_windows; // CHECKME je tohle vazne treba ? - return ret; - } - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/windows_handler.cpp b/khotkeys/libkhotkeysprivate/windows_handler.cpp deleted file mode 100644 index 0d85e391..00000000 --- a/khotkeys/libkhotkeysprivate/windows_handler.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** - - KHotKeys - - Copyright (C) 1999-2001 Lubos Lunak - - Distributed under the terms of the GNU General Public License version 2. - -****************************************************************************/ - -#define _WINDOWS_CPP_ - -#include "windows_handler.h" - -#include "windows_helper/window_selection_rules.h" -#include "windows_helper/window_selection_list.h" - -#include - -#include -#include -#include -#include -#include - -#include "khotkeysglobal.h" - -#include -#include -#include - -namespace KHotKeys -{ - -// WindowsHandler - -WindowsHandler::WindowsHandler( bool enable_signal_P, QObject* parent_P ) - : QObject( parent_P ), signals_enabled( enable_signal_P ), - _action_window( 0 ) - { - if( signals_enabled ) - { - connect( KWindowSystem::self(), SIGNAL(windowAdded(WId)), SLOT(window_added_slot(WId))); - connect( KWindowSystem::self(), SIGNAL(windowRemoved(WId)), SLOT(window_removed_slot(WId))); - connect( KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), - SLOT(active_window_changed_slot(WId))); - } - } - -WindowsHandler::~WindowsHandler() - { - } - -void WindowsHandler::window_added_slot( WId window_P ) - { - if( signals_enabled ) - emit window_added( window_P ); - // CHECKME tyhle i dalsi by asi mely jit nastavit, jestli aktivuji vsechny, nebo jen jeden - // pripojeny slot ( stejne jako u Kdb, kde by to take melo jit nastavit ) - } - -void WindowsHandler::window_removed_slot( WId window_P ) - { - if( signals_enabled ) - emit window_removed( window_P ); - if( window_P == _action_window ) - _action_window = 0; - } - -void WindowsHandler::active_window_changed_slot( WId window_P ) - { - if( signals_enabled ) - emit active_window_changed( window_P ); - } - -void WindowsHandler::window_changed_slot( WId window_P ) - { - if( signals_enabled ) - emit window_changed( window_P ); - } - -void WindowsHandler::window_changed_slot( WId window_P, unsigned int flags_P ) - { - if( signals_enabled ) - emit window_changed( window_P, flags_P ); - } - -QString WindowsHandler::get_window_role( WId id_P ) - { - // TODO this is probably just a hack - return KWindowSystem::windowInfo( id_P, 0, NET::WM2WindowRole ).windowRole(); - } - -QString WindowsHandler::get_window_class( WId id_P ) - { - XClassHint hints_ret; - if( XGetClassHint( QX11Info::display(), id_P, &hints_ret ) == 0 ) // 0 means error - return ""; - QString ret( hints_ret.res_name ); - ret += ' '; - ret += hints_ret.res_class; - XFree( hints_ret.res_name ); - XFree( hints_ret.res_class ); - return ret; - } - -WId WindowsHandler::active_window() - { - return KWindowSystem::activeWindow(); - } - -WId WindowsHandler::action_window() - { - return _action_window; - } - -void WindowsHandler::set_action_window( WId window_P ) - { - _action_window = window_P; - } - -WId WindowsHandler::find_window( const Windowdef_list* window_P ) - { - for( QList< WId >::const_iterator it = KWindowSystem::windows().begin(); - it != KWindowSystem::windows().end(); - ++it ) - { - Window_data tmp( *it ); - if( window_P->match( tmp )) - return *it; - } - return None; - } - -WId WindowsHandler::window_at_position( int x, int y ) - { - Window child, dummy; - Window parent = QX11Info::appRootWindow(); - Atom wm_state = XInternAtom( QX11Info::display(), "WM_STATE", False ); - for( int i = 0; - i < 10; - ++i ) - { - int destx, desty; - // find child at that position - if( !XTranslateCoordinates( QX11Info::display(), parent, parent, x, y, &destx, &desty, &child ) - || child == None ) - return 0; - // and now transform coordinates to the child - if( !XTranslateCoordinates( QX11Info::display(), parent, child, x, y, &destx, &desty, &dummy )) - return 0; - x = destx; - y = desty; - Atom type; - int format; - unsigned long nitems, after; - unsigned char* prop; - if( XGetWindowProperty( QX11Info::display(), child, wm_state, 0, 0, False, AnyPropertyType, - &type, &format, &nitems, &after, &prop ) == Success ) - { - if( prop != NULL ) - XFree( prop ); - if( type != None ) - return child; - } - parent = child; - } - return 0; - - } - -void WindowsHandler::activate_window( WId id_P ) - { - KWindowSystem::forceActiveWindow( id_P ); - } - -// Window_data - -Window_data::Window_data( WId id_P ) - : type( NET::Unknown ) - { - KWindowInfo kwin_info = KWindowSystem::windowInfo( id_P, NET::WMName | NET::WMWindowType ); // TODO optimize - if( kwin_info.valid()) - { - title = kwin_info.name(); - role = windows_handler->get_window_role( id_P ); - wclass = windows_handler->get_window_class( id_P ); - type = kwin_info.windowType( SUPPORTED_WINDOW_TYPES_MASK ); - if( type == NET::Unknown ) - type = NET::Normal; - } - } - -} // namespace KHotKeys - -#include "moc_windows_handler.cpp" - diff --git a/khotkeys/libkhotkeysprivate/windows_handler.h b/khotkeys/libkhotkeysprivate/windows_handler.h deleted file mode 100644 index 96ce79db..00000000 --- a/khotkeys/libkhotkeysprivate/windows_handler.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 1999-2001 Lubos Lunak - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - Version 2 as published by the Free Software Foundation; - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef WINDOWS_HANDLER_H -#define WINDOWS_HANDLER_H - -#include - -#include -#include - -#include - -namespace KHotKeys -{ - -const int SUPPORTED_WINDOW_TYPES_MASK = NET::NormalMask | NET::DesktopMask | NET::DockMask - | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::UtilityMask | NET::SplashMask; - - -class Windowdef_list; - -class KDE_EXPORT WindowsHandler : public QObject - #include - { - Q_OBJECT - public: - WindowsHandler( bool enable_signals_P, QObject* parent_P ); - virtual ~WindowsHandler(); - QString get_window_class( WId id_P ); - QString get_window_role( WId id_P ); - WId active_window(); - void set_action_window( WId window ); - WId action_window(); - WId find_window( const Windowdef_list* window_P ); - static WId window_at_position( int x, int y ); - static void activate_window( WId id_P ); - Q_SIGNALS: - void window_added( WId window_P ); - void window_removed( WId window_P ); - void active_window_changed( WId window_P ); - void window_changed( WId window_P ); - void window_changed( WId window_P, unsigned int flags_P ); - protected Q_SLOTS: - void window_added_slot( WId window_P ); - void window_removed_slot( WId window_P ); - void active_window_changed_slot( WId window_P ); - void window_changed_slot( WId window_P ); - void window_changed_slot( WId window_P, unsigned int flags_P ); - private: - bool signals_enabled; - WId _action_window; - }; - - -} // namespace KHotKeys - -#endif diff --git a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_interface.cpp b/khotkeys/libkhotkeysprivate/windows_helper/window_selection_interface.cpp deleted file mode 100644 index 28a0a9aa..00000000 --- a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_interface.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - Version 2 as published by the Free Software Foundation; - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "window_selection_rules.h" - -#include - - -namespace KHotKeys { - -Windowdef::Windowdef( const QString& comment_P ) - : _comment( comment_P ) - { - } - - -Windowdef::Windowdef( KConfigGroup& cfg_P ) - { - _comment = cfg_P.readEntry( "Comment" ); - } - - -Windowdef::~Windowdef() - { - } - - -void Windowdef::cfg_write( KConfigGroup& cfg_P ) const - { - cfg_P.writeEntry( "Type", "ERROR" ); - cfg_P.writeEntry( "Comment", comment()); - } - - -const QString& Windowdef::comment() const - { - return _comment; - } - - -Windowdef* Windowdef::create_cfg_read( KConfigGroup& cfg_P ) - { - QString type = cfg_P.readEntry( "Type" ); - if( type == "SIMPLE" ) - return new Windowdef_simple( cfg_P ); - kWarning() << "Unknown Windowdef type read from cfg file\n"; - return NULL; - } - - -void Windowdef::set_comment(const QString &comment) - { - _comment = comment; - } - - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_interface.h b/khotkeys/libkhotkeysprivate/windows_helper/window_selection_interface.h deleted file mode 100644 index e8cee29b..00000000 --- a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_interface.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef WINDOW_SELECTION_INTERFACE_H -#define WINDOW_SELECTION_INTERFACE_H -/* Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - Version 2 as published by the Free Software Foundation; - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - - -#include - -#include "KConfigGroup" -#include - -#include - -#include - -namespace KHotKeys { - -struct KDE_EXPORT Window_data - { - Window_data( WId id_P ); - QString title; // _NET_WM_NAME or WM_NAME - QString role; // WM_WINDOW_ROLE - QString wclass; // WM_CLASS - NET::WindowType type; - }; - -class KDE_EXPORT Windowdef - { - Q_DISABLE_COPY( Windowdef ) - - public: - Windowdef( const QString& comment_P ); - Windowdef( KConfigGroup& cfg_P ); - virtual ~Windowdef(); - const QString& comment() const; - void set_comment(const QString &comment); - virtual bool match( const Window_data& window_P ) = 0; - static Windowdef* create_cfg_read( KConfigGroup& cfg_P/*, ActionDataBase* data_P*/ ); - virtual void cfg_write( KConfigGroup& cfg_P ) const = 0; - virtual Windowdef* copy( /*ActionDataBase* data_P*/ ) const = 0; - virtual const QString description() const = 0; - private: - QString _comment; - }; - -} // namespace KHotKeys - -#endif /* #ifndef WINDOW_SELECTION_INTERFACE_H */ diff --git a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_list.cpp b/khotkeys/libkhotkeysprivate/windows_helper/window_selection_list.cpp deleted file mode 100644 index fee4b0f0..00000000 --- a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_list.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - Version 2 as published by the Free Software Foundation; - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - - -#include "windows_helper/window_selection_list.h" - -#include -#include - - -namespace KHotKeys { - - -Windowdef_list::Windowdef_list( const QString& comment_P ) - : QList< Windowdef* >(), _comment( comment_P ) - { - } - - -Windowdef_list::Windowdef_list( KConfigGroup& cfg_P ) - : QList< Windowdef* >() - { - _comment = cfg_P.readEntry( "Comment" ); - int cnt = cfg_P.readEntry( "WindowsCount", 0 ); - for( int i = 0; - i < cnt; - ++i ) - { - KConfigGroup windowGroup( cfg_P.config(), cfg_P.name() + QString::number( i )); - Windowdef* window = Windowdef::create_cfg_read( windowGroup ); - if( window ) - append( window ); - } - } - - -Windowdef_list::~Windowdef_list() - { - qDeleteAll(*this); - } - - -const QString& Windowdef_list::comment() const - { - return _comment; - } - - -void Windowdef_list::cfg_write( KConfigGroup& cfg_P ) const - { - int i = 0; - for( ConstIterator it(begin()); - it!= end(); - ++it, ++i ) - { - KConfigGroup itGroup( cfg_P.config(), cfg_P.name() + QString::number( i ) ); - (*it)->cfg_write( itGroup ); - } - cfg_P.writeEntry( "WindowsCount", i ); - cfg_P.writeEntry( "Comment", comment()); - } - - -Windowdef_list* Windowdef_list::copy() const - { - Windowdef_list* ret = new Windowdef_list(comment()); - for( ConstIterator it(constBegin()); - it!= constEnd(); - ++it) - { - kDebug() << "Duplicating " << (*it)->comment(); - ret->append( (*it)->copy()); - } - return ret; - } - - -bool Windowdef_list::match( const Window_data& window_P ) const - { - if( count() == 0 ) // CHECKME no windows to match => ok - return true; - for( ConstIterator it(begin()); - it != end(); - ++it ) - if( (*it)->match( window_P )) - return true; - return false; - } - - -void Windowdef_list::set_comment(const QString &comment) - { - _comment = comment; - } - - -} // namespace KHotKeys diff --git a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_list.h b/khotkeys/libkhotkeysprivate/windows_helper/window_selection_list.h deleted file mode 100644 index 6b0b2cf8..00000000 --- a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_list.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef WINDOW_SELECTION_LIST_H -#define WINDOW_SELECTION_LIST_H -/* Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - Version 2 as published by the Free Software Foundation; - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "windows_helper/window_selection_interface.h" - -#include - -namespace KHotKeys { - - -class KDE_EXPORT Windowdef_list : public QList< Windowdef* > - { - Q_DISABLE_COPY( Windowdef_list ) - - public: - Windowdef_list( const QString& comment = "" ); - Windowdef_list( KConfigGroup& cfg_P/*, ActionDataBase* data_P*/ ); - - ~Windowdef_list(); - - void cfg_write( KConfigGroup& cfg_P ) const; - bool match( const Window_data& window_P ) const; - Windowdef_list* copy( /*ActionDataBase* data_P*/ ) const; - // typedef QList< Windowdef* >::iterator Iterator; - void set_comment(const QString &comment); - const QString& comment() const; - private: - QString _comment; - }; - - -} // namespace KHotKeys - -#endif /* #ifndef WINDOW_SELECTION_LIST_H */ diff --git a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_rules.cpp b/khotkeys/libkhotkeysprivate/windows_helper/window_selection_rules.cpp deleted file mode 100644 index af697b64..00000000 --- a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_rules.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/* Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - Version 2 as published by the Free Software Foundation; - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "windows_helper/window_selection_rules.h" -#include "windows_helper/window_selection_rules.h" - -#include -#include - -namespace KHotKeys { - -Windowdef_simple::Windowdef_simple( - const QString& comment_P, - const QString& title_P, - substr_type_t title_type_P, - const QString& wclass_P, - substr_type_t wclass_type_P, - const QString& role_P, - substr_type_t role_type_P, - int window_types_P ) - : Windowdef( comment_P ), - _title( title_P ), - _title_match_type( title_type_P ), - _wclass( wclass_P ), - _wclass_match_type( wclass_type_P ), - _role( role_P ), - _role_match_type( role_type_P ), - _window_types( window_types_P ) - {} - - -Windowdef_simple::Windowdef_simple( KConfigGroup& cfg_P ) - : Windowdef( cfg_P ) - { - _title = cfg_P.readEntry( "Title" ); - _title_match_type = static_cast< substr_type_t >( cfg_P.readEntry( "TitleType",0 )); - _wclass = cfg_P.readEntry( "Class" ); - _wclass_match_type = static_cast< substr_type_t >( cfg_P.readEntry( "ClassType",0 )); - _role = cfg_P.readEntry( "Role" ); - _role_match_type = static_cast< substr_type_t >( cfg_P.readEntry( "RoleType", 0 )); - _window_types = cfg_P.readEntry( "WindowTypes",0 ); - } - - -void Windowdef_simple::cfg_write( KConfigGroup& cfg_P ) const - { - base::cfg_write( cfg_P ); - cfg_P.writeEntry( "Title", title()); - cfg_P.writeEntry( "TitleType", int(_title_match_type) ); - cfg_P.writeEntry( "Class", wclass()); - cfg_P.writeEntry( "ClassType", int(_wclass_match_type) ); - cfg_P.writeEntry( "Role", role()); - cfg_P.writeEntry( "RoleType", int(_role_match_type) ); - cfg_P.writeEntry( "WindowTypes", window_types()); - cfg_P.writeEntry( "Type", "SIMPLE" ); // overwrites value set in base::cfg_write() - } - - -Windowdef_simple* Windowdef_simple::copy() const - { - return new Windowdef_simple( comment(), title(), title_match_type(), wclass(), - wclass_match_type(), role(), role_match_type(), window_types()); - } - - -const QString Windowdef_simple::description() const - { - return i18n( "Window simple: " ) + comment(); - } - - -bool Windowdef_simple::is_substr_match( const QString& str1_P, const QString& str2_P, - substr_type_t type_P ) - { - switch( type_P ) - { - case NOT_IMPORTANT : - return true; - case CONTAINS : - return str1_P.contains( str2_P ); - case IS : - return str1_P == str2_P; - case REGEXP : - { - QRegExp rg( str2_P ); - return rg.indexIn( str1_P ) >= 0; - } - case CONTAINS_NOT : - return !str1_P.contains( str2_P ); - case IS_NOT : - return str1_P != str2_P; - case REGEXP_NOT : - { - QRegExp rg( str2_P ); - return rg.indexIn( str1_P ) < 0; - } - } - return false; - } - - -bool Windowdef_simple::match( const Window_data& window_P ) - { - if( !type_match( window_P.type )) - return false; - if( !is_substr_match( window_P.title, title(), _title_match_type )) - return false; - if( !is_substr_match( window_P.wclass, wclass(), _wclass_match_type )) - return false; - if( !is_substr_match( window_P.role, role(), _role_match_type )) - return false; - kDebug() << "window match:" << window_P.title << ":OK"; - return true; - } - - -const QString& Windowdef_simple::role() const - { - return _role; - } - - -Windowdef_simple::substr_type_t Windowdef_simple::role_match_type() const - { - return _role_match_type; - } - - -void Windowdef_simple::set_title(const QString &title) - { - _title = title; - } - - -void Windowdef_simple::set_title_match_type(const substr_type_t &type) - { - _title_match_type = type; - } - - -void Windowdef_simple::set_role(const QString &role) - { - _role = role; - } - - -void Windowdef_simple::set_role_match_type(const substr_type_t &type) - { - _role_match_type = type; - } - - -void Windowdef_simple::set_window_types(const int types) - { - _window_types = types; - } - - -void Windowdef_simple::set_wclass(const QString &wclass) - { - _wclass = wclass; - } - - -void Windowdef_simple::set_wclass_match_type(const substr_type_t &type) - { - _wclass_match_type = type; - } - - -const QString& Windowdef_simple::title() const - { - return _title; - } - - -Windowdef_simple::substr_type_t Windowdef_simple::title_match_type() const - { - return _title_match_type; - } - - -bool Windowdef_simple::type_match( window_type_t type_P ) const - { - return window_types() & type_P; - } - - -bool Windowdef_simple::type_match( NET::WindowType type_P ) const - { - return ( window_types() & ( 1 << type_P )) - || ( type_P == NET::Unknown && ( window_types() & WINDOW_TYPE_NORMAL )); - // CHECKME HACK haaaack ! - } - - -const QString& Windowdef_simple::wclass() const - { - return _wclass; - } - - -Windowdef_simple::substr_type_t Windowdef_simple::wclass_match_type() const - { - return _wclass_match_type; - } - - -int Windowdef_simple::window_types() const - { - return _window_types; - } - -} // namespace KHotKeys - diff --git a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_rules.h b/khotkeys/libkhotkeysprivate/windows_helper/window_selection_rules.h deleted file mode 100644 index e9f96d8d..00000000 --- a/khotkeys/libkhotkeysprivate/windows_helper/window_selection_rules.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef WINDOW_SELECTION_RULES_H -#define WINDOW_SELECTION_RULES_H -/* Copyright (C) 1999-2001 Lubos Lunak - Copyright (C) 2008 Michael Jansen - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - Version 2 as published by the Free Software Foundation; - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "windows_helper/window_selection_interface.h" - - -namespace KHotKeys { - -/** - * Rules to match a windows. - */ -class KDE_EXPORT Windowdef_simple : public Windowdef - { - - typedef Windowdef base; - - public: - - /** - * How to compare. - */ - enum substr_type_t - { - NOT_IMPORTANT, - CONTAINS, - IS, - REGEXP, - CONTAINS_NOT, - IS_NOT, - REGEXP_NOT - }; - - /** - * Window Type - */ - enum window_type_t - { - WINDOW_TYPE_NORMAL = ( 1 << NET::Normal ), - WINDOW_TYPE_DESKTOP = ( 1 << NET::Desktop ), - WINDOW_TYPE_DOCK = ( 1 << NET::Dock ), - WINDOW_TYPE_DIALOG = ( 1 << NET::Dialog ) - }; - - /** - * Constructor - */ - Windowdef_simple( - const QString& comment_P = QString(), - const QString& title_P = QString(), - substr_type_t _title_type_P = NOT_IMPORTANT, - const QString& wclass_P = QString(), - substr_type_t wclass_type_P = NOT_IMPORTANT, - const QString& role_P = QString(), - substr_type_t role_type_P = NOT_IMPORTANT, - int window_types_P = 0 ); - - /** - * Create from a configuration file. - */ - Windowdef_simple( KConfigGroup& cfg_P ); - - /** - * Match agains window @p window_P - */ - virtual bool match( const Window_data& window_P ); - - /** - * Write to configuration file @p cfg_P - */ - virtual void cfg_write( KConfigGroup& cfg_P ) const; - - /** - * The string to compare with the window title - */ - const QString& title() const; - void set_title(const QString &title); - - /** - * How to match the window title - */ - substr_type_t title_match_type() const; - void set_title_match_type(const substr_type_t &type); - - /** - * The string to compare with the window class - */ - const QString& wclass() const; - void set_wclass(const QString &wclass); - - /** - * How to match the window class - */ - substr_type_t wclass_match_type() const; - void set_wclass_match_type(const substr_type_t &); - - /** - * The string to compare with the window role - */ - const QString& role() const; - void set_role(const QString &role); - - /** - * How to match the window type - */ - substr_type_t role_match_type() const; - void set_role_match_type(const substr_type_t &type); - - /** - * The window types to match - */ - int window_types() const; - void set_window_types(const int types); - - /** - * - */ - bool type_match( window_type_t type_P ) const; - - /** - */ - bool type_match( NET::WindowType type_P ) const; - - /** - * Create a copy - */ - virtual Windowdef_simple* copy( /*ActionDataBase* data_P*/ ) const; - - /** - * The description of this rule. - * - * @todo: Move to base class? - */ - virtual const QString description() const; - - protected: - - /** - */ - bool is_substr_match( - const QString& str1_P, - const QString& str2_P, - substr_type_t type_P ); - - private: - - //! The title string - QString _title; - - //! How to use the title string - substr_type_t _title_match_type; - - //! The class string - QString _wclass; - - //! How to use the class string - substr_type_t _wclass_match_type; - - //! The role string - QString _role; - - //! How to use the role string - substr_type_t _role_match_type; - - //! Which window types to match - int _window_types; - }; - - -} // namespace KHotKeys - - -#endif /* #ifndef WINDOW_SELECTION_RULES_H */ diff --git a/khotkeys/test/CMakeLists.txt b/khotkeys/test/CMakeLists.txt deleted file mode 100644 index f8d1e5e3..00000000 --- a/khotkeys/test/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -MACRO(KHOTKEYS_UNIT_TESTS) - FOREACH(_testname ${ARGN}) - kde4_add_test(${_testname} ${_testname}.cpp) - target_link_libraries(${_testname} khotkeysprivate KDE4::kdecore ${QT_QTTEST_LIBRARY}) - ENDFOREACH(_testname) -ENDMACRO(KHOTKEYS_UNIT_TESTS) - -KHOTKEYS_UNIT_TESTS( - kdedmodule_daemon_test ) - diff --git a/khotkeys/test/kdedmodule_daemon_test.cpp b/khotkeys/test/kdedmodule_daemon_test.cpp deleted file mode 100644 index 32ff1120..00000000 --- a/khotkeys/test/kdedmodule_daemon_test.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (c) 2006 Volker Krause - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kdedmodule_daemon_test.h" - -#include "daemon/daemon.h" -#include "daemon/kded_module.h" - -#include - -#include - - -void Test::initTestCase() - { - daemonActive = KHotKeys::Daemon::isRunning(); - if (daemonActive) - { - qWarning() << "Shutting down a running daemon"; - KHotKeys::Daemon::stop(); - } - } - - -void Test::cleanupTestCase() - { - if (daemonActive) - { - qWarning() << "Restarting the stopped daemon"; - KHotKeys::Daemon::start(); - } - } - - -void Test::testLoading() - { - // Check loading/unloading. We have to do it more than once. When - // something is amiss kded will crash after reloading it. - QVERIFY(!KHotKeys::KdedModuleDaemon::isRunning()); - // 1st round - QVERIFY(KHotKeys::KdedModuleDaemon::start()); - QVERIFY(KHotKeys::KdedModuleDaemon::isRunning()); - QVERIFY(KHotKeys::KdedModuleDaemon::stop()); - QVERIFY(!KHotKeys::KdedModuleDaemon::isRunning()); - // 2nd round - QVERIFY(KHotKeys::KdedModuleDaemon::start()); - QVERIFY(KHotKeys::KdedModuleDaemon::isRunning()); - QVERIFY(KHotKeys::KdedModuleDaemon::stop()); - QVERIFY(!KHotKeys::KdedModuleDaemon::isRunning()); - // 3nd round - QVERIFY(KHotKeys::KdedModuleDaemon::start()); - QVERIFY(KHotKeys::KdedModuleDaemon::isRunning()); - // Ensure kded is still there - QVERIFY(QDBusInterface( "org.kde.kded", "/kded","org.kde.kded" ).isValid()); - QVERIFY(KHotKeys::KdedModuleDaemon::stop()); - } - -QTEST_MAIN(Test) -#include "moc_kdedmodule_daemon_test.cpp" diff --git a/khotkeys/test/kdedmodule_daemon_test.h b/khotkeys/test/kdedmodule_daemon_test.h deleted file mode 100644 index d85e5314..00000000 --- a/khotkeys/test/kdedmodule_daemon_test.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef LIBKHOTKEYS_TEST_H -#define LIBKHOTKEYS_TEST_H - -#include - -class Test : public QObject - { - Q_OBJECT - -private Q_SLOTS: - - void initTestCase(); - void cleanupTestCase(); - - void testLoading(); - -private: - - bool daemonActive; - - }; // class Test - -#endif diff --git a/kmenuedit/CMakeLists.txt b/kmenuedit/CMakeLists.txt index 41c92279..c719f6ce 100644 --- a/kmenuedit/CMakeLists.txt +++ b/kmenuedit/CMakeLists.txt @@ -7,7 +7,6 @@ set(kmenueditcommon_STAT_SRCS kmenuedit.cpp menufile.cpp menuinfo.cpp - khotkeys.cpp ) ########### next target ############### @@ -19,11 +18,6 @@ qt4_add_dbus_adaptor( KMenuEdit ) -qt4_add_dbus_interface( - kmenueditcommon_STAT_SRCS - ${CMAKE_CURRENT_BINARY_DIR}/../khotkeys/app/org.kde.khotkeys.xml - khotkeys_interface) - set(kmenuedit_SRCS main.cpp ${kmenueditcommon_STAT_SRCS}) add_executable(kmenuedit ${kmenuedit_SRCS}) @@ -50,6 +44,4 @@ install( DESTINATION ${KDE4_DATA_INSTALL_DIR}/kmenuedit ) -add_dependencies(kmenuedit kded_khotkeys) - kde4_install_icons(${KDE4_ICON_INSTALL_DIR}) diff --git a/kmenuedit/basictab.cpp b/kmenuedit/basictab.cpp index 9e4b71ff..109c2a1c 100644 --- a/kmenuedit/basictab.cpp +++ b/kmenuedit/basictab.cpp @@ -37,8 +37,6 @@ #include #include -#include "khotkeys.h" - #include "menuinfo.h" #include "moc_basictab.cpp" @@ -213,27 +211,9 @@ BasicTab::BasicTab( QWidget *parent ) _uidEdit->setEnabled(false); - // key binding group - general_group_keybind = new QGroupBox(this); - QHBoxLayout *keybindLayout = new QHBoxLayout(general_group_keybind); - keybindLayout->setMargin( KDialog::marginHint() ); - keybindLayout->setSpacing( KDialog::spacingHint()); - - _keyEdit = new KKeySequenceWidget(general_group_keybind); - _keyEdit->setMultiKeyShortcutsAllowed(false); - QLabel *l = new QLabel( i18n("Current shortcut &key:"), general_group_keybind); - l->setBuddy( _keyEdit ); - keybindLayout->addWidget(l); - connect( _keyEdit, SIGNAL(keySequenceChanged(QKeySequence)), - this, SLOT(slotCapturedKeySequence(QKeySequence))); - keybindLayout->addWidget(_keyEdit); - advancedLayout->addWidget( general_group_keybind ); - advancedLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)); addTab(advanced, i18n("Advanced")); - if (!KHotKeys::present()) - general_group_keybind->hide(); slotDisableAction(); } @@ -257,8 +237,6 @@ void BasicTab::slotDisableAction() _term_group->setEnabled(false); _uid_group->setEnabled(false); _iconButton->setEnabled(false); - // key binding part - general_group_keybind->setEnabled( false ); } void BasicTab::enableWidgets(bool isDF, bool isDeleted) @@ -281,7 +259,6 @@ void BasicTab::enableWidgets(bool isDF, bool isDeleted) _path_group->setEnabled(isDF && !isDeleted); _term_group->setEnabled(isDF && !isDeleted); _uid_group->setEnabled(isDF && !isDeleted); - general_group_keybind->setEnabled(isDF && !isDeleted); _termOptEdit->setEnabled(isDF && !isDeleted && _terminalCB->isChecked()); _termOptLabel->setEnabled(isDF && !isDeleted && _terminalCB->isChecked()); @@ -314,7 +291,6 @@ void BasicTab::setFolderInfo(MenuFolderInfo *folderInfo) _onlyShowInKdeCB->setChecked( false ); _hiddenEntryCB->setChecked( false ); _uidCB->setChecked(false); - _keyEdit->clearKeySequence(); enableWidgets(false, folderInfo->hidden); blockSignals(false); @@ -333,9 +309,6 @@ void BasicTab::setEntryInfo(MenuEntryInfo *entryInfo) _commentEdit->clear(); _iconButton->setIcon( QString() ); - // key binding part - _keyEdit->clearKeySequence(); - _execEdit->lineEdit()->clear(); _systrayCB->setChecked(false); _onlyShowInKdeCB->setChecked( false ); @@ -362,15 +335,6 @@ void BasicTab::setEntryInfo(MenuEntryInfo *entryInfo) _commentEdit->setCursorPosition(0); _iconButton->setIcon(df->readIcon()); - // key binding part - if( KHotKeys::present()) - { - if ( !entryInfo->shortcut().isEmpty() ) - _keyEdit->setKeySequence( entryInfo->shortcut().primary() ); - else - _keyEdit->clearKeySequence(); - } - QString temp = df->desktopGroup().readEntry("Exec"); if (temp.endsWith(QLatin1String(" -tray"))) { @@ -514,25 +478,6 @@ void BasicTab::slotExecSelected() _execEdit->lineEdit()->setText(KShell::quoteArg(path)); } -void BasicTab::slotCapturedKeySequence(const QKeySequence& seq) -{ - if (signalsBlocked()) - return; - KShortcut cut(seq, QKeySequence()); - if (_menuEntryInfo->isShortcutAvailable( cut ) && KHotKeys::present() ) - { - _menuEntryInfo->setShortcut( cut ); - } - else - { - // We will not assign the shortcut so reset the visible key sequence - _keyEdit->setKeySequence(QKeySequence()); - } - if (_menuEntryInfo) - emit changed( _menuEntryInfo ); -} - - void BasicTab::updateHiddenEntry( bool show ) { if ( show ) diff --git a/kmenuedit/basictab.h b/kmenuedit/basictab.h index 62fa0fed..883ff871 100644 --- a/kmenuedit/basictab.h +++ b/kmenuedit/basictab.h @@ -50,7 +50,6 @@ public: Q_SIGNALS: void changed( MenuFolderInfo * ); void changed( MenuEntryInfo * ); - void findServiceShortcut(const KShortcut&, KService::Ptr &); public Q_SLOTS: void setFolderInfo(MenuFolderInfo *folderInfo); @@ -62,7 +61,6 @@ protected Q_SLOTS: void systraycb_clicked(); void termcb_clicked(); void uidcb_clicked(); - void slotCapturedKeySequence(const QKeySequence&); void slotExecSelected(); void onlyshowcb_clicked(); void hiddenentrycb_clicked(); @@ -74,12 +72,11 @@ protected: KLineEdit *_nameEdit; KLineEdit *_commentEdit; KLineEdit *_descriptionEdit; - KKeySequenceWidget *_keyEdit; KUrlRequester *_execEdit, *_pathEdit; KLineEdit *_termOptEdit, *_uidEdit; QCheckBox *_terminalCB, *_uidCB, *_launchCB, *_systrayCB, *_onlyShowInKdeCB, *_hiddenEntryCB; KIconButton *_iconButton; - QGroupBox *_path_group, *_term_group, *_uid_group, *general_group_keybind; + QGroupBox *_path_group, *_term_group, *_uid_group; QLabel *_termOptLabel, *_uidLabel, *_pathLabel, *_nameLabel, *_commentLabel, *_execLabel; QLabel *_descriptionLabel; diff --git a/kmenuedit/khotkeys.cpp b/kmenuedit/khotkeys.cpp deleted file mode 100644 index f9a07c1b..00000000 --- a/kmenuedit/khotkeys.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2000 Matthias Elter - * Lubos Lunak - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "khotkeys.h" -#include "khotkeys_interface.h" - -#include -#include -#include - -static bool khotkeys_present = false; -static bool khotkeys_inited = false; -static OrgKdeKhotkeysInterface *khotkeysInterface = NULL; - - -bool KHotKeys::init() -{ - khotkeys_inited = true; - - // Check if khotkeys is running - QDBusConnection bus = QDBusConnection::sessionBus(); - khotkeysInterface = new OrgKdeKhotkeysInterface( - "org.kde.kded", - "/modules/khotkeys", - bus, - NULL); - - if(!khotkeysInterface->isValid()) { - QDBusError err = khotkeysInterface->lastError(); - if (err.isValid()) { - kError() << err.name() << ":" << err.message(); - } - KMessageBox::error( - NULL, - "" + i18n("Unable to contact khotkeys. Your changes are saved, but they could not be activated.") + "" ); - } - - khotkeys_present = khotkeysInterface->isValid(); - return true; -} - -void KHotKeys::cleanup() -{ - if( khotkeys_inited && khotkeys_present ) { - // CleanUp ??? - } - - khotkeys_inited = false; -} - -bool KHotKeys::present() -{ - if( !khotkeys_inited ) - init(); - - return khotkeys_present; -} - -QString KHotKeys::getMenuEntryShortcut( const QString& entry_P ) -{ - if( !khotkeys_inited ) - init(); - - if( !khotkeys_present || !khotkeysInterface->isValid()) - return ""; - - QDBusReply reply = khotkeysInterface->get_menuentry_shortcut(entry_P); - if (!reply.isValid()) { - kError() << reply.error(); - return ""; - - } else { - return reply; - } -} - -QString KHotKeys::changeMenuEntryShortcut( - const QString& entry_P, - const QString shortcut_P ) -{ - if( !khotkeys_inited ) - init(); - - if( !khotkeys_present || !khotkeysInterface->isValid()) - return ""; - - QDBusReply reply = khotkeysInterface->register_menuentry_shortcut( - entry_P, - shortcut_P); - - if (!reply.isValid()) { - kError() << reply.error(); - return ""; - } else { - return reply; - } -} - diff --git a/kmenuedit/khotkeys.h b/kmenuedit/khotkeys.h deleted file mode 100644 index 56639f90..00000000 --- a/kmenuedit/khotkeys.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2000 Matthias Elter - * Lubos Lunak - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef KHOTKEYS_PUBLIC_H -#define KHOTKEYS_PUBLIC_H - -#include - -// see kdebase/khotkeys/kcontrol for info on these - -class KHotKeys -{ -public: - static bool init(); - static void cleanup(); - static bool present(); - static QString getMenuEntryShortcut( const QString& entry_P ); - static QString changeMenuEntryShortcut( const QString& entry_P, - const QString shortcut_P ); -}; - -#endif diff --git a/kmenuedit/kmenuedit.cpp b/kmenuedit/kmenuedit.cpp index b24af633..0b8a91de 100644 --- a/kmenuedit/kmenuedit.cpp +++ b/kmenuedit/kmenuedit.cpp @@ -163,9 +163,6 @@ void KMenuEdit::setupView() connect(m_basicTab, SIGNAL(changed(MenuEntryInfo*)), m_tree, SLOT(currentDataChanged(MenuEntryInfo*))); - connect(m_basicTab, SIGNAL(findServiceShortcut(KShortcut,KService::Ptr&)), - m_tree, SLOT(findServiceShortcut(KShortcut,KService::Ptr&))); - // restore splitter sizes KSharedConfig::Ptr config = KGlobal::config(); KConfigGroup group(config, "General"); diff --git a/kmenuedit/main.cpp b/kmenuedit/main.cpp index a8f71d0a..7370bea8 100644 --- a/kmenuedit/main.cpp +++ b/kmenuedit/main.cpp @@ -25,7 +25,6 @@ #include #include "kmenuedit.h" -#include "khotkeys.h" static const char description[] = I18N_NOOP("KDE menu editor"); static const char version[] = "0.9"; @@ -36,7 +35,7 @@ class KMenuApplication : public KUniqueApplication { public: KMenuApplication() { } - virtual ~KMenuApplication() { KHotKeys::cleanup(); } + virtual ~KMenuApplication() { } virtual int newInstance() { KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); diff --git a/kmenuedit/menuinfo.cpp b/kmenuedit/menuinfo.cpp index d688454c..5a48efad 100644 --- a/kmenuedit/menuinfo.cpp +++ b/kmenuedit/menuinfo.cpp @@ -18,22 +18,17 @@ */ #include "menuinfo.h" +#include "menufile.h" #include - #include #include #include -#include "menufile.h" -#include "khotkeys.h" - // // MenuFolderInfo // -static QStringList *s_newShortcuts = 0; -static QStringList *s_freeShortcuts = 0; static QStringList *s_deletedApps = 0; // Add separator @@ -175,13 +170,6 @@ void MenuFolderInfo::save(MenuFile *menuFile) { if (s_deletedApps) { - // Remove hotkeys for applications that have been deleted - for(QStringList::ConstIterator it = s_deletedApps->constBegin(); - it != s_deletedApps->constEnd(); ++it) - { - // The shorcut is deleted if we set a empty sequence - KHotKeys::changeMenuEntryShortcut(*it, ""); - } delete s_deletedApps; s_deletedApps = 0; } @@ -239,31 +227,11 @@ bool MenuFolderInfo::hasDirt() // Check entries foreach (MenuEntryInfo *entryInfo, entries) { - if (entryInfo->dirty || entryInfo->shortcutDirty) return true; + if (entryInfo->dirty) return true; } return false; } -KService::Ptr MenuFolderInfo::findServiceShortcut(const KShortcut&cut) -{ - KService::Ptr result; - // Check sub-menus - foreach (MenuFolderInfo *subFolderInfo, subFolders) - { - result = subFolderInfo->findServiceShortcut(cut); - if (result) - return result; - } - - // Check entries - foreach (MenuEntryInfo *entryInfo, entries) - { - if (entryInfo->shortCut == cut) - return entryInfo->service; - } - return KService::Ptr(); -} - void MenuFolderInfo::setInUse(bool inUse) { // Propagate to sub-menus @@ -326,14 +294,6 @@ void MenuEntryInfo::save() m_desktopFile->sync(); dirty = false; } - if (shortcutDirty) - { - if( KHotKeys::present()) - { - KHotKeys::changeMenuEntryShortcut( service->storageId(), shortCut.toString() ); - } - shortcutDirty = false; - } } void MenuEntryInfo::setCaption(const QString &_caption) @@ -364,84 +324,15 @@ void MenuEntryInfo::setIcon(const QString &_icon) desktopFile()->desktopGroup().writeEntry("Icon", icon); } -KShortcut MenuEntryInfo::shortcut() -{ - if (!shortcutLoaded) - { - shortcutLoaded = true; - if( KHotKeys::present()) - { - shortCut = KShortcut(KHotKeys::getMenuEntryShortcut( service->storageId() )); - } - } - return shortCut; -} - -static void freeShortcut(const KShortcut &shortCut) -{ - if (!shortCut.isEmpty()) - { - QString shortcutKey = shortCut.toString(); - if (s_newShortcuts) - s_newShortcuts->removeAll(shortcutKey); - - if (!s_freeShortcuts) - s_freeShortcuts = new QStringList; - - s_freeShortcuts->append(shortcutKey); - } -} - -static void allocateShortcut(const KShortcut &shortCut) -{ - if (!shortCut.isEmpty()) - { - QString shortcutKey = shortCut.toString(); - if (s_freeShortcuts) - s_freeShortcuts->removeAll(shortcutKey); - - if (!s_newShortcuts) - s_newShortcuts = new QStringList; - - s_newShortcuts->append(shortcutKey); - } -} - -void MenuEntryInfo::setShortcut(const KShortcut &_shortcut) -{ - if (shortCut == _shortcut) - return; - - freeShortcut(shortCut); - allocateShortcut(_shortcut); - - shortCut = _shortcut; - if (shortCut.isEmpty()) - shortCut = KShortcut(); // Normalize - - shortcutLoaded = true; - shortcutDirty = true; -} - void MenuEntryInfo::setInUse(bool inUse) { if (inUse) { - KShortcut temp = shortcut(); - shortCut = KShortcut(); - if (isShortcutAvailable(temp)) - shortCut = temp; - else - shortcutDirty = true; - allocateShortcut(shortCut); - if (s_deletedApps) s_deletedApps->removeAll(service->storageId()); } else { - freeShortcut(shortcut()); - // Add to list of deleted apps if (!s_deletedApps) s_deletedApps = new QStringList; @@ -449,23 +340,3 @@ void MenuEntryInfo::setInUse(bool inUse) s_deletedApps->append(service->storageId()); } } - -bool MenuEntryInfo::isShortcutAvailable(const KShortcut &_shortcut) -{ - // We only have to check agains not saved local shortcuts. - // KKeySequenceWidget checks against all other registered shortcuts. - if (shortCut == _shortcut) - return true; - - QString shortcutKey = _shortcut.toString(); - bool available = true; - if (available && s_newShortcuts) - { - available = !s_newShortcuts->contains(shortcutKey); - } - if (!available && s_freeShortcuts) - { - available = s_freeShortcuts->contains(shortcutKey); - } - return available; -} diff --git a/kmenuedit/menuinfo.h b/kmenuedit/menuinfo.h index a0a7ee73..f2c6ab51 100644 --- a/kmenuedit/menuinfo.h +++ b/kmenuedit/menuinfo.h @@ -119,9 +119,6 @@ public: // Save menu and all its entries and submenus void save(MenuFile *); - // Search service by shortcut - KService::Ptr findServiceShortcut(const KShortcut&); - // Set whether the entry is in active use (as opposed to in the clipboard/deleted) void setInUse(bool inUse); @@ -145,7 +142,7 @@ class MenuEntryInfo : public MenuInfo public: explicit MenuEntryInfo(const KService::Ptr &_service, KDesktopFile *_df = 0) : service(_service), m_desktopFile(_df), - shortcutLoaded(false), shortcutDirty(false), dirty(_df != 0), hidden(false) + dirty(_df != 0), hidden(false) { caption = service->name(); description = service->genericName(); @@ -161,10 +158,6 @@ public: QString file() const { return service->entryPath(); } - KShortcut shortcut(); - void setShortcut(const KShortcut &_shortcut); - bool isShortcutAvailable(const KShortcut &_shortcut); - void setDirty(); // Set whether the entry is in active use (as opposed to in the clipboard/deleted) @@ -183,9 +176,6 @@ public: QString icon; KService::Ptr service; KDesktopFile *m_desktopFile; - KShortcut shortCut; - bool shortcutLoaded; - bool shortcutDirty; bool dirty; bool hidden; }; diff --git a/kmenuedit/treeview.cpp b/kmenuedit/treeview.cpp index 8f8c0e53..01b85f43 100644 --- a/kmenuedit/treeview.cpp +++ b/kmenuedit/treeview.cpp @@ -1891,11 +1891,6 @@ bool TreeView::dirty() return m_layoutDirty || m_rootFolder->hasDirt() || m_menuFile->dirty() || isLayoutDirty(); } -void TreeView::findServiceShortcut(const KShortcut&cut, KService::Ptr &service) -{ - service = m_rootFolder->findServiceShortcut(cut); -} - void TreeView::restoreMenuSystem() { if ( KMessageBox::warningYesNo( this, i18n( "Do you want to restore the system menu? Warning: This will remove all custom menus." ) )==KMessageBox::No ) diff --git a/kmenuedit/treeview.h b/kmenuedit/treeview.h index b7e8a53a..e589e45a 100644 --- a/kmenuedit/treeview.h +++ b/kmenuedit/treeview.h @@ -134,7 +134,6 @@ public: public Q_SLOTS: void currentDataChanged(MenuFolderInfo *folderInfo); void currentDataChanged(MenuEntryInfo *entryInfo); - void findServiceShortcut(const KShortcut&, KService::Ptr &); Q_SIGNALS: void entrySelected(MenuFolderInfo *folderInfo); diff --git a/plasma/shells/plasma-desktop/plasmaapp.cpp b/plasma/shells/plasma-desktop/plasmaapp.cpp index a1d86a19..f47ce6ae 100644 --- a/plasma/shells/plasma-desktop/plasmaapp.cpp +++ b/plasma/shells/plasma-desktop/plasmaapp.cpp @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include @@ -135,6 +137,17 @@ PlasmaApp::PlasmaApp() KGlobal::setAllowQuit(true); KGlobal::ref(); + KActionCollection* actionCollection = new KActionCollection(this); + KAction* action = actionCollection->addAction("Capture the desktop"); + action->setText(i18n("Capture the desktop")); + action->setGlobalShortcut(KShortcut(Qt::Key_Print)); + connect(action, SIGNAL(triggered(bool)), SLOT(captureDesktop())); + + action = actionCollection->addAction("Capture the current window"); + action->setText(i18n("Capture the current window")); + action->setGlobalShortcut(KShortcut(Qt::CTRL+Qt::Key_Print)); + connect(action, SIGNAL(triggered(bool)), SLOT(captureCurrentWindow())); + QTimer::singleShot(0, this, SLOT(setupDesktop())); kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "plasma app ctor end" << "(line:" << __LINE__ << ")"; } @@ -953,4 +966,14 @@ void PlasmaApp::executeCommands(const QList < QVariant > & commands) } } +void PlasmaApp::captureDesktop() +{ + KToolInvocation::kdeinitExec("ksnapshot", QStringList() << "--fullscreen"); +} + +void PlasmaApp::captureCurrentWindow() +{ + KToolInvocation::kdeinitExec("ksnapshot", QStringList() << "--current"); +} + #include "moc_plasmaapp.cpp" diff --git a/plasma/shells/plasma-desktop/plasmaapp.h b/plasma/shells/plasma-desktop/plasmaapp.h index b8783c53..958a5aab 100644 --- a/plasma/shells/plasma-desktop/plasmaapp.h +++ b/plasma/shells/plasma-desktop/plasmaapp.h @@ -130,6 +130,8 @@ private Q_SLOTS: void wallpaperCheckInTimeout(); void relocatePanels(); void executeCommands(const QList < QVariant > & commands); + void captureDesktop(); + void captureCurrentWindow(); private: DesktopCorona *m_corona;