summaryrefslogtreecommitdiffstats
path: root/khotkeys/kcontrol/action_list_widget.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2022-08-09 08:23:06 +0900
committerMichele Calgaro <[email protected]>2022-08-09 08:23:06 +0900
commit0c22a14875913dc185e029d0078a8d15c9ffe102 (patch)
tree30b7a68ba98bd7a78cd5f695d8b00d75f4e89163 /khotkeys/kcontrol/action_list_widget.cpp
parent96955a58cbbbdba22bdfb8e4fdfdbea0444ccd14 (diff)
downloadtdebase-0c22a14875913dc185e029d0078a8d15c9ffe102.tar.gz
tdebase-0c22a14875913dc185e029d0078a8d15c9ffe102.zip
TCC khotkeys: fixed logic related to action and condition item selection after deleting an existing item.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'khotkeys/kcontrol/action_list_widget.cpp')
-rw-r--r--khotkeys/kcontrol/action_list_widget.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/khotkeys/kcontrol/action_list_widget.cpp b/khotkeys/kcontrol/action_list_widget.cpp
index 79744a09e..ffa71bce0 100644
--- a/khotkeys/kcontrol/action_list_widget.cpp
+++ b/khotkeys/kcontrol/action_list_widget.cpp
@@ -148,24 +148,45 @@ void Action_list_widget::new_selected( int type_P )
void Action_list_widget::copy_pressed()
{
- if ( !selected_item )
- return;
+ if ( !selected_item )
+ {
+ return;
+ }
+
actions_listview->setSelected( create_listview_item( selected_item->action(),
- selected_item->parent() ? NULL : actions_listview, selected_item->parent(),
- selected_item, true ), true );
+ selected_item->parent() ? NULL : actions_listview, selected_item->parent(),
+ selected_item, true ), true );
}
void Action_list_widget::delete_pressed()
{
- delete selected_item; // CHECKME snad vyvola signaly pro enable()
+ if ( !selected_item )
+ {
+ return;
+ }
+
+ Action_list_item *nextItem = static_cast< Action_list_item* >(selected_item->nextSibling());
+ delete selected_item;
selected_item = NULL;
+ if (!nextItem)
+ {
+ // If the last item of the list was deleted, get the new last item
+ nextItem = static_cast< Action_list_item* >(actions_listview->lastItem());
+ }
+ if (nextItem)
+ {
+ actions_listview->setSelected(nextItem, true);
+ current_changed(nextItem);
+ }
}
void Action_list_widget::modify_pressed()
{
- if ( !selected_item )
- return;
- edit_listview_item( selected_item );
+ if ( !selected_item )
+ {
+ return;
+ }
+ edit_listview_item( selected_item );
}
void Action_list_widget::current_changed( TQListViewItem* item_P )