changeset 15322:5ddeef055df3

* file-editor.cc (file_editor::request_open_file): canceled open --> restore focus to previous tab
author Thorsten Liebig <thorsten.liebig@gmx.de>
date Thu, 06 Sep 2012 21:21:04 +0200
parents eefbbc1ed60e
children 9f9a7ae2d263
files libgui/src/m-editor/file-editor.cc
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc
+++ b/libgui/src/m-editor/file-editor.cc
@@ -99,6 +99,7 @@
 file_editor::request_open_file ()
 {
   file_editor_tab *current_tab = active_editor_tab ();
+  int curr_tab_index = _tab_widget->currentIndex ();
   file_editor_tab *fileEditorTab = new file_editor_tab (this);
   if (fileEditorTab)
     {
@@ -111,6 +112,9 @@
         {
           // If no file was loaded, remove the tab again.
           _tab_widget->removeTab (_tab_widget->indexOf (fileEditorTab));
+          // restore focus to previous tab
+          if (curr_tab_index>=0)
+            _tab_widget->setCurrentIndex (curr_tab_index);
         }
     }
 }