summaryrefslogtreecommitdiffstats
path: root/khotkeys/kcontrol/condition_list_widget.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2022-08-11 18:01:06 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2022-08-12 17:39:12 +0900
commit12007bb689082f356835ae6ad4412ee414230e83 (patch)
tree0c0a1cc4c1e7244cce7fa75ad7fcea4dbccdc25a /khotkeys/kcontrol/condition_list_widget.cpp
parent371ad533a3d4bf755ea1ccf50f8821261428d059 (diff)
downloadtdebase-12007bb689082f356835ae6ad4412ee414230e83.tar.gz
tdebase-12007bb689082f356835ae6ad4412ee414230e83.zip
TCC khotkeys: added 'move up' and 'move down' buttons to 'Actions' and 'Conditions' listviews for input actions.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 5e4ca4df9bb34e10a897e32e7e0ca8645b97f293)
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,