Mercurial > octave-nkf
comparison libgui/src/m-editor/file-editor.cc @ 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 | 7d300b85ee25 |
comparison
equal
deleted
inserted
replaced
15860:feba9ff6e6a8 | 15861:f425e680925e |
---|---|
145 tr ("File %1 is already open in the editor."). | 145 tr ("File %1 is already open in the editor."). |
146 arg (openFileName), QMessageBox::Ok, 0); | 146 arg (openFileName), QMessageBox::Ok, 0); |
147 msgBox->setWindowModality (Qt::NonModal); | 147 msgBox->setWindowModality (Qt::NonModal); |
148 msgBox->setAttribute (Qt::WA_DeleteOnClose); | 148 msgBox->setAttribute (Qt::WA_DeleteOnClose); |
149 msgBox->show (); | 149 msgBox->show (); |
150 QFileInfo file(openFileName); | |
151 QString short_openFileName = file.fileName(); // get file name only | |
150 for(int i = 0; i < _tab_widget->count (); i++) | 152 for(int i = 0; i < _tab_widget->count (); i++) |
151 { | 153 { // check whether tab title is file name (long or short) |
152 if (_tab_widget->tabText (i) == openFileName) | 154 if (_tab_widget->tabText (i) == openFileName || |
155 _tab_widget->tabText (i) == short_openFileName) | |
153 { | 156 { |
154 _tab_widget->setCurrentIndex (i); | 157 _tab_widget->setCurrentIndex (i); |
155 break; | 158 break; |
156 } | 159 } |
157 } | 160 } |