summaryrefslogtreecommitdiffstats
path: root/khotkeys/kcontrol/condition_list_widget.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2022-08-11 18:01:06 +0900
committerMichele Calgaro <[email protected]>2022-08-11 18:31:08 +0900
commit5e4ca4df9bb34e10a897e32e7e0ca8645b97f293 (patch)
tree8201231b29ca15ca749e4d886c35c3596b85aae6 /khotkeys/kcontrol/condition_list_widget.cpp
parent0c22a14875913dc185e029d0078a8d15c9ffe102 (diff)
downloadtdebase-5e4ca4df9bb34e10a897e32e7e0ca8645b97f293.tar.gz
tdebase-5e4ca4df9bb34e10a897e32e7e0ca8645b97f293.zip
TCC khotkeys: added 'move up' and 'move down' buttons to 'Actions' and 'Conditions' listviews for input actions.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'khotkeys/kcontrol/condition_list_widget.cpp')
-rw-r--r--khotkeys/kcontrol/condition_list_widget.cpp58
1 files changed, 48 insertions, 10 deletions
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,