changeset 15861:f425e680925e

editor: when opening an open file, bring its tab (even with short title) on top * file-editor.cc(request_open_file): also check for a tab title containing the file name without complete path when bringing tab of already open file on top
author Torsten <ttl@justmail.de>
date Fri, 28 Dec 2012 15:39:46 +0100
parents feba9ff6e6a8
children 98902367c781
files libgui/src/m-editor/file-editor.cc
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Fri Dec 28 15:01:08 2012 +0100
+++ b/libgui/src/m-editor/file-editor.cc	Fri Dec 28 15:39:46 2012 +0100
@@ -147,9 +147,12 @@
           msgBox->setWindowModality (Qt::NonModal);
           msgBox->setAttribute (Qt::WA_DeleteOnClose);
           msgBox->show ();
+          QFileInfo file(openFileName);
+          QString short_openFileName = file.fileName();  // get file name only
           for(int i = 0; i < _tab_widget->count (); i++)
-            {
-              if (_tab_widget->tabText (i) == openFileName)
+            { // check whether tab title is file name (long or short)
+              if (_tab_widget->tabText (i) == openFileName ||
+                  _tab_widget->tabText (i) == short_openFileName)
                 {
                   _tab_widget->setCurrentIndex (i);
                   break;