diff options
Diffstat (limited to 'khotkeys/kcontrol')
-rw-r--r-- | khotkeys/kcontrol/action_list_widget.cpp | 55 | ||||
-rw-r--r-- | khotkeys/kcontrol/action_list_widget.h | 24 | ||||
-rw-r--r-- | khotkeys/kcontrol/actions_listview_widget.cpp | 10 | ||||
-rw-r--r-- | khotkeys/kcontrol/actions_listview_widget.h | 16 | ||||
-rw-r--r-- | khotkeys/kcontrol/condition_list_widget.cpp | 58 | ||||
-rw-r--r-- | khotkeys/kcontrol/condition_list_widget.h | 18 | ||||
-rw-r--r-- | khotkeys/kcontrol/ui/action_list_widget_ui.ui | 30 | ||||
-rw-r--r-- | khotkeys/kcontrol/ui/condition_list_widget_ui.ui | 32 |
8 files changed, 190 insertions, 53 deletions
diff --git a/khotkeys/kcontrol/action_list_widget.cpp b/khotkeys/kcontrol/action_list_widget.cpp index ffa71bce0..e94e561e2 100644 --- a/khotkeys/kcontrol/action_list_widget.cpp +++ b/khotkeys/kcontrol/action_list_widget.cpp @@ -62,16 +62,13 @@ Action_list_widget::Action_list_widget( TQWidget* parent_P, const char* name_P ) this, TQT_SLOT( modify_pressed() ) ); // KHotKeys::Module::changed() - connect( new_button, TQT_SIGNAL( clicked()), - module, TQT_SLOT( changed())); - connect( copy_button, TQT_SIGNAL( clicked()), - module, TQT_SLOT( changed())); - connect( modify_button, TQT_SIGNAL( clicked()), - module, TQT_SLOT( changed())); - connect( delete_button, TQT_SIGNAL( clicked()), - module, TQT_SLOT( changed())); - connect( comment_lineedit, TQT_SIGNAL( textChanged( const TQString& )), - module, TQT_SLOT( changed())); + connect(new_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(copy_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(modify_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(delete_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(move_up_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(move_down_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(comment_lineedit, TQT_SIGNAL(textChanged(const TQString&)), module, TQT_SLOT(changed())); } Action_list_widget::~Action_list_widget() @@ -189,6 +186,42 @@ void Action_list_widget::modify_pressed() edit_listview_item( selected_item ); } +void Action_list_widget::move_up_pressed() + { + if ( !selected_item ) + { + return; + } + + Action_list_item *prevItem = nullptr; + TQListViewItem *currItem = actions_listview->firstChild(); + while (currItem != selected_item) + { + prevItem = static_cast< Action_list_item* >(currItem); + currItem = currItem->nextSibling(); + } + if (prevItem) + { + prevItem->moveItem(selected_item); + current_changed(selected_item); + } + } + +void Action_list_widget::move_down_pressed() + { + if ( !selected_item ) + { + return; + } + + Action_list_item *nextItem = static_cast< Action_list_item* >(selected_item->nextSibling()); + if (nextItem) + { + selected_item->moveItem(nextItem); + current_changed(selected_item); + } + } + void Action_list_widget::current_changed( TQListViewItem* item_P ) { // if( item_P == selected_item ) @@ -198,6 +231,8 @@ void Action_list_widget::current_changed( TQListViewItem* item_P ) copy_button->setEnabled( item_P != NULL ); modify_button->setEnabled( item_P != NULL ); delete_button->setEnabled( item_P != NULL ); + move_up_button->setEnabled(selected_item != actions_listview->firstChild()); + move_down_button->setEnabled(selected_item != actions_listview->lastChild()); } Action_list_item* Action_list_widget::create_listview_item( Action* action_P, diff --git a/khotkeys/kcontrol/action_list_widget.h b/khotkeys/kcontrol/action_list_widget.h index c2f32477e..38676b886 100644 --- a/khotkeys/kcontrol/action_list_widget.h +++ b/khotkeys/kcontrol/action_list_widget.h @@ -1,11 +1,11 @@ /**************************************************************************** KHotKeys - + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> Distributed under the terms of the GNU General Public License version 2. - + ****************************************************************************/ #ifndef _ACTION_LIST_WIDGET_H_ @@ -53,6 +53,8 @@ class Action_list_widget virtual void copy_pressed(); virtual void delete_pressed(); virtual void modify_pressed(); + virtual void move_up_pressed(); + virtual void move_down_pressed(); virtual void current_changed( TQListViewItem* item_P ); protected: Action_list_item* selected_item; @@ -75,14 +77,14 @@ class Action_list_item protected: Action* _action; // owns it }; - + class Action_dialog { public: virtual Action* edit_action() = 0; virtual ~Action_dialog(); }; - + class Command_url_action_dialog : public KDialogBase, public Action_dialog { @@ -95,7 +97,7 @@ class Command_url_action_dialog Command_url_widget* widget; Command_url_action* action; }; - + class Menuentry_action_dialog : public KDialogBase, public Action_dialog { @@ -108,7 +110,7 @@ class Menuentry_action_dialog Menuentry_widget* widget; Menuentry_action* action; }; - + class Dcop_action_dialog : public KDialogBase, public Action_dialog { @@ -121,7 +123,7 @@ class Dcop_action_dialog Dcop_widget* widget; Dcop_action* action; }; - + class Keyboard_input_action_dialog : public KDialogBase, public Action_dialog { @@ -134,7 +136,7 @@ class Keyboard_input_action_dialog Keyboard_input_widget* widget; Keyboard_input_action* action; }; - + class Activate_window_action_dialog : public KDialogBase, public Action_dialog { @@ -147,7 +149,7 @@ class Activate_window_action_dialog Activate_window_widget* widget; Activate_window_action* action; }; - + //*************************************************************************** // Inline //*************************************************************************** @@ -159,7 +161,7 @@ Action_list_item::Action_list_item( TQListView* parent_P, Action* action_P ) : TQListViewItem( parent_P ), _action( action_P ) { } - + inline Action_list_item::Action_list_item( TQListViewItem* parent_P, Action* action_P ) : TQListViewItem( parent_P ), _action( action_P ) @@ -185,7 +187,7 @@ Action* Action_list_item::action() const { return _action; } - + inline void Action_list_item::set_action( Action* action_P ) { diff --git a/khotkeys/kcontrol/actions_listview_widget.cpp b/khotkeys/kcontrol/actions_listview_widget.cpp index e528005ed..1b6c7a743 100644 --- a/khotkeys/kcontrol/actions_listview_widget.cpp +++ b/khotkeys/kcontrol/actions_listview_widget.cpp @@ -1,11 +1,11 @@ /**************************************************************************** KHotKeys - + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> Distributed under the terms of the GNU General Public License version 2. - + ****************************************************************************/ #define _ACTIONS_LISTVIEW_WIDGET_CPP_ @@ -138,7 +138,7 @@ void Actions_listview_widget::build_up() { build_up_recursively( module->actions_root(), NULL ); } - + void Actions_listview_widget::build_up_recursively( Action_data_group* parent_P, Action_listview_item* item_parent_P ) { @@ -147,13 +147,13 @@ void Actions_listview_widget::build_up_recursively( Action_data_group* parent_P, it; ++it ) { - prev = create_item( item_parent_P, prev, ( *it )); + prev = create_item( item_parent_P, prev, ( *it )); Action_data_group* grp = dynamic_cast< Action_data_group* >( *it ); if( grp != NULL ) build_up_recursively( grp, prev ); } } - + Action_listview_item* Actions_listview_widget::create_item( TQListViewItem* parent_P, TQListViewItem* after_P, Action_data_base* data_P ) { diff --git a/khotkeys/kcontrol/actions_listview_widget.h b/khotkeys/kcontrol/actions_listview_widget.h index 0f3a632f4..e380791ee 100644 --- a/khotkeys/kcontrol/actions_listview_widget.h +++ b/khotkeys/kcontrol/actions_listview_widget.h @@ -1,11 +1,11 @@ /**************************************************************************** KHotKeys - + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> Distributed under the terms of the GNU General Public License version 2. - + ****************************************************************************/ #ifndef _ACTIONS_LISTVIEW_WIDGET_H_ @@ -27,13 +27,13 @@ class Action_data_base; class Actions_listview_widget : public Actions_listview_widget_ui - { + { Q_OBJECT public: Actions_listview_widget( TQWidget* parent_P = NULL, const char* name_P = NULL ); Action_listview_item* current_action() const; void set_current_action( Action_listview_item* item ); - Action_data_base* current_action_data() const; + Action_data_base* current_action_data() const; void set_action_data( Action_data_base* data_P, bool recent_action_P = false ); void action_name_changed( const TQString& name_P ); void clear(); @@ -54,7 +54,7 @@ class Actions_listview_widget }; class Actions_listview - : public KHListView + : public KHListView { Q_OBJECT public: @@ -78,7 +78,7 @@ class Action_listview_item Action_data_base* data_P ); protected: Action_data_base* _data; // CHECKME doesn't own !!! - }; + }; //*************************************************************************** // Inline @@ -113,7 +113,7 @@ Actions_listview_widget* Actions_listview::widget() { return _widget; } - + // Action_listview_item inline @@ -139,7 +139,7 @@ Action_data_base* Action_listview_item::data() const { return _data; } - + inline void Action_listview_item::set_data( Action_data_base* data_P ) { diff --git a/khotkeys/kcontrol/condition_list_widget.cpp b/khotkeys/kcontrol/condition_list_widget.cpp index 864c2d4a5..817602a12 100644 --- a/khotkeys/kcontrol/condition_list_widget.cpp +++ b/khotkeys/kcontrol/condition_list_widget.cpp @@ -62,18 +62,18 @@ Condition_list_widget::Condition_list_widget( TQWidget* parent_P, const char* na copy_button->setEnabled( false ); modify_button->setEnabled( false ); delete_button->setEnabled( false ); + move_up_button->setEnabled( false ); + move_down_button->setEnabled( false ); clear_data(); // KHotKeys::Module::changed() - connect( new_button, TQT_SIGNAL( clicked()), - module, TQT_SLOT( changed())); - connect( copy_button, TQT_SIGNAL( clicked()), - module, TQT_SLOT( changed())); - connect( modify_button, TQT_SIGNAL( clicked()), - module, TQT_SLOT( changed())); - connect( delete_button, TQT_SIGNAL( clicked()), - module, TQT_SLOT( changed())); - connect( comment_lineedit, TQT_SIGNAL( textChanged( const TQString& )), - module, TQT_SLOT( changed())); + connect(new_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(copy_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(modify_button, TQT_SIGNAL(clicked()), module, TQT_SLOT( changed())); + connect(delete_button, TQT_SIGNAL(clicked()), module, TQT_SLOT( changed())); + connect(move_up_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(move_down_button, TQT_SIGNAL(clicked()), module, TQT_SLOT(changed())); + connect(comment_lineedit, TQT_SIGNAL(textChanged(const TQString&)), + module, TQT_SLOT(changed())); } Condition_list_widget::~Condition_list_widget() @@ -256,6 +256,42 @@ void Condition_list_widget::modify_pressed() edit_listview_item( selected_item ); } +void Condition_list_widget::move_up_pressed() + { + if ( !selected_item ) + { + return; + } + + Condition_list_item *prevItem = nullptr; + TQListViewItem *currItem = conditions_listview->firstChild(); + while (currItem != selected_item) + { + prevItem = static_cast< Condition_list_item* >(currItem); + currItem = currItem->nextSibling(); + } + if (prevItem) + { + prevItem->moveItem(selected_item); + current_changed(selected_item); + } + } + +void Condition_list_widget::move_down_pressed() + { + if ( !selected_item ) + { + return; + } + + Condition_list_item *nextItem = static_cast< Condition_list_item* >(selected_item->nextSibling()); + if (nextItem) + { + selected_item->moveItem(nextItem); + current_changed(selected_item); + } + } + void Condition_list_widget::current_changed( TQListViewItem* item_P ) { // if( item_P == selected_item ) @@ -277,6 +313,8 @@ void Condition_list_widget::current_changed( TQListViewItem* item_P ) } else modify_button->setEnabled( false ); + move_up_button->setEnabled(selected_item != conditions_listview->firstChild()); + move_down_button->setEnabled(selected_item != conditions_listview->lastChild()); } Condition_list_item* Condition_list_widget::create_listview_item( Condition* condition_P, diff --git a/khotkeys/kcontrol/condition_list_widget.h b/khotkeys/kcontrol/condition_list_widget.h index 0c99fd46c..04c9d3deb 100644 --- a/khotkeys/kcontrol/condition_list_widget.h +++ b/khotkeys/kcontrol/condition_list_widget.h @@ -1,11 +1,11 @@ /**************************************************************************** KHotKeys - + Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org> Distributed under the terms of the GNU General Public License version 2. - + ****************************************************************************/ #ifndef _CONDITIONS_LIST_WIDGET_H_ @@ -48,6 +48,8 @@ class Condition_list_widget virtual void copy_pressed(); virtual void delete_pressed(); virtual void modify_pressed(); + virtual void move_up_pressed(); + virtual void move_down_pressed(); virtual void current_changed( TQListViewItem* item_P ); private: void insert_listview_items( const Condition_list_base* parent_P, @@ -74,14 +76,14 @@ class Condition_list_item protected: Condition* _condition; // owns it }; - + class Condition_dialog { public: virtual Condition* edit_condition() = 0; virtual ~Condition_dialog(); }; - + class Active_window_condition_dialog : public KDialogBase, public Condition_dialog { @@ -94,7 +96,7 @@ class Active_window_condition_dialog Windowdef_list_widget* widget; Active_window_condition* condition; }; - + class Existing_window_condition_dialog : public KDialogBase, public Condition_dialog { @@ -107,7 +109,7 @@ class Existing_window_condition_dialog Windowdef_list_widget* widget; Existing_window_condition* condition; }; - + //*************************************************************************** // Inline @@ -120,7 +122,7 @@ Condition_list_item::Condition_list_item( TQListView* parent_P, Condition* condi : TQListViewItem( parent_P ), _condition( condition_P ) { } - + inline Condition_list_item::Condition_list_item( TQListViewItem* parent_P, Condition* condition_P ) : TQListViewItem( parent_P ), _condition( condition_P ) @@ -146,7 +148,7 @@ Condition* Condition_list_item::condition() const { return _condition; } - + inline void Condition_list_item::set_condition( Condition* condition_P ) { diff --git a/khotkeys/kcontrol/ui/action_list_widget_ui.ui b/khotkeys/kcontrol/ui/action_list_widget_ui.ui index d78c6b5f1..2895e5752 100644 --- a/khotkeys/kcontrol/ui/action_list_widget_ui.ui +++ b/khotkeys/kcontrol/ui/action_list_widget_ui.ui @@ -97,6 +97,22 @@ <string>Delete</string> </property> </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>move_up_button</cstring> + </property> + <property name="text"> + <string>Move &up</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>move_down_button</cstring> + </property> + <property name="text"> + <string>Move &down</string> + </property> + </widget> </vbox> </widget> </hbox> @@ -148,6 +164,18 @@ <slot>delete_pressed()</slot> </connection> <connection> + <sender>move_up_button</sender> + <signal>clicked()</signal> + <receiver>Action_list_widget_ui</receiver> + <slot>move_up_pressed()</slot> + </connection> + <connection> + <sender>move_down_button</sender> + <signal>clicked()</signal> + <receiver>Action_list_widget_ui</receiver> + <slot>move_down_pressed()</slot> + </connection> + <connection> <sender>actions_listview</sender> <signal>current_changed(TQListViewItem*)</signal> <receiver>Action_list_widget_ui</receiver> @@ -162,6 +190,8 @@ <slot access="protected" specifier="pure virtual">current_changed(TQListViewItem*)</slot> <slot access="protected" specifier="pure virtual">delete_pressed()</slot> <slot access="protected" specifier="pure virtual">modify_pressed()</slot> + <slot access="protected" specifier="pure virtual">move_up_pressed()</slot> + <slot access="protected" specifier="pure virtual">move_down_pressed()</slot> </Q_SLOTS> <includes> <include location="global" impldecl="in implementation">kdialog.h</include> diff --git a/khotkeys/kcontrol/ui/condition_list_widget_ui.ui b/khotkeys/kcontrol/ui/condition_list_widget_ui.ui index 9b3727ffd..269b889ce 100644 --- a/khotkeys/kcontrol/ui/condition_list_widget_ui.ui +++ b/khotkeys/kcontrol/ui/condition_list_widget_ui.ui @@ -94,7 +94,23 @@ <cstring>delete_button</cstring> </property> <property name="text"> - <string>Delete</string> + <string>D&elete</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>move_up_button</cstring> + </property> + <property name="text"> + <string>Move &up</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>move_down_button</cstring> + </property> + <property name="text"> + <string>Move &down</string> </property> </widget> </vbox> @@ -147,6 +163,18 @@ <slot>delete_pressed()</slot> </connection> <connection> + <sender>move_up_button</sender> + <signal>clicked()</signal> + <receiver>Condition_list_widget_ui</receiver> + <slot>move_up_pressed()</slot> + </connection> + <connection> + <sender>move_down_button</sender> + <signal>clicked()</signal> + <receiver>Condition_list_widget_ui</receiver> + <slot>move_down_pressed()</slot> + </connection> + <connection> <sender>conditions_listview</sender> <signal>current_changed(TQListViewItem*)</signal> <receiver>Condition_list_widget_ui</receiver> @@ -161,6 +189,8 @@ <slot access="protected" specifier="pure virtual">current_changed(TQListViewItem*)</slot> <slot access="protected" specifier="pure virtual">delete_pressed()</slot> <slot access="protected" specifier="pure virtual">modify_pressed()</slot> + <slot access="protected" specifier="pure virtual">move_up_pressed()</slot> + <slot access="protected" specifier="pure virtual">move_down_pressed()</slot> </Q_SLOTS> <includes> <include location="global" impldecl="in implementation">kdialog.h</include> |