summaryrefslogtreecommitdiffstats
path: root/khotkeys/kcontrol/condition_list_widget.cpp
diff options
context:
space:
mode:
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,