# HG changeset patch # User ttl # Date 1312031982 -7200 # Node ID ad18a8e7fb0212b5edc5c523be4f540739b9cb4c # Parent 0d18b0e168ae3398f1a82208dbba6598817933d0 editor: change window title if text is modified diff -r 0d18b0e168ae -r ad18a8e7fb02 gui/src/FileEditorMdiSubWindow.cpp --- a/gui/src/FileEditorMdiSubWindow.cpp Sat Jul 30 12:10:42 2011 +0200 +++ b/gui/src/FileEditorMdiSubWindow.cpp Sat Jul 30 15:19:42 2011 +0200 @@ -52,6 +52,18 @@ } void +FileEditorMdiSubWindow::handleModificationChanged(bool modified) +{ + if ( modified ) + { + QString title(m_fileName); + setWindowTitle(title.prepend("* ")); + } + else + setWindowTitle (m_fileName); +} + +void FileEditorMdiSubWindow::openFile () { if (checkFileModified ("Open File")==QMessageBox::Cancel) @@ -339,6 +351,9 @@ connect (saveAction, SIGNAL (hovered ()), this, SLOT (showToolTipSave ())); connect (saveAsAction, SIGNAL (hovered ()), this,SLOT (showToolTipSaveAs ())); + // connect modified signal + connect (m_editor, SIGNAL (modificationChanged(bool)), this, SLOT (handleModificationChanged(bool)) ); + m_fileName = ""; setWindowTitle (m_fileName); setWindowIcon(QIcon::fromTheme("accessories-text-editor",style->standardIcon (QStyle::SP_FileIcon))); diff -r 0d18b0e168ae -r ad18a8e7fb02 gui/src/FileEditorMdiSubWindow.h --- a/gui/src/FileEditorMdiSubWindow.h Sat Jul 30 12:10:42 2011 +0200 +++ b/gui/src/FileEditorMdiSubWindow.h Sat Jul 30 15:19:42 2011 +0200 @@ -52,7 +52,6 @@ void showToolTipSaveAs (); void showToolTipUndo (); void showToolTipRedo (); - void registerModified (bool modified); protected: @@ -66,6 +65,10 @@ QStatusBar *m_statusBar; QString m_fileName; bool m_modified; + +private slots: + void handleModificationChanged(bool modified); + }; #endif // FILEEDITORMDISUBWINDOW_H