# HG changeset patch # User Daniel J Sebald # Date 1359333893 21600 # Node ID 1eb3c67139f6915bfa07285404490993913adced # Parent 200dab2eecd4980b085f8046b890118ea40ebf81 Add full-length-name tool tip to editor file tab when name is not full length. * file-editor-tab.cc (file_editor_tab::update_window_title): Add and construct tooltip variable then signal file_name_changed() with second input string. * file-editor-tab.h (file_editor_tab::file_name_changed): Add second input string to accommodate tool tip. * file-editor.cc, file-editor.h (file_editor::handle_file_name_changed): Add second input string and set tool tip via Qt setTabToolTip() member function. diff --git a/libgui/src/m-editor/file-editor-tab.cc b/libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -658,6 +658,7 @@ file_editor_tab::update_window_title (bool modified) { QString title (""); + QString tooltip (""); if (_file_name.isEmpty () || _file_name.at (_file_name.count () - 1) == '/') title = tr(""); else @@ -668,15 +669,16 @@ { QFileInfo file(_file_name); title = file.fileName(); + tooltip = _file_name; } } if ( modified ) { - emit file_name_changed (title.prepend("* ")); + emit file_name_changed (title.prepend("* "), tooltip); } else - emit file_name_changed (title); + emit file_name_changed (title, tooltip); } void diff --git a/libgui/src/m-editor/file-editor-tab.h b/libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h +++ b/libgui/src/m-editor/file-editor-tab.h @@ -86,7 +86,7 @@ void file_has_changed (const QString& fileName); signals: - void file_name_changed (const QString& fileName); + void file_name_changed (const QString& fileName, const QString& toolTip); void editor_state_changed (bool copy_available, const QString& fileName); void tab_remove_request (); void add_filename_to_list (const QString& fileName); diff --git a/libgui/src/m-editor/file-editor.cc b/libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -423,7 +423,7 @@ } void -file_editor::handle_file_name_changed (const QString& fileName) +file_editor::handle_file_name_changed (const QString& fileName, const QString& toolTip) { QObject *fileEditorTab = sender(); if (fileEditorTab) @@ -433,6 +433,7 @@ if (_tab_widget->widget (i) == fileEditorTab) { _tab_widget->setTabText (i, fileName); + _tab_widget->setTabToolTip (i, toolTip); } } } @@ -766,8 +767,8 @@ _tab_widget->addTab (f, fn); // Signals from the file editor_tab - connect (f, SIGNAL (file_name_changed (const QString&)), - this, SLOT (handle_file_name_changed (const QString&))); + connect (f, SIGNAL (file_name_changed (const QString&, const QString&)), + this, SLOT (handle_file_name_changed (const QString&, const QString&))); connect (f, SIGNAL (editor_state_changed (bool, const QString&)), this, SLOT (handle_editor_state_changed (bool, const QString&))); connect (f, SIGNAL (tab_remove_request ()), diff --git a/libgui/src/m-editor/file-editor.h b/libgui/src/m-editor/file-editor.h --- a/libgui/src/m-editor/file-editor.h +++ b/libgui/src/m-editor/file-editor.h @@ -113,7 +113,7 @@ void request_uncomment_selected_text (); void request_find (); - void handle_file_name_changed (const QString& fileName); + void handle_file_name_changed (const QString& fileName, const QString& toolTip); void handle_tab_close_request (int index); void handle_tab_remove_request (); void handle_add_filename_to_list (const QString& fileName);