diff gui/src/FileEditorMdiSubWindow.cpp @ 13557:ad18a8e7fb02

editor: change window title if text is modified
author ttl <ttl@justmail.de>
date Sat, 30 Jul 2011 15:19:42 +0200
parents 0d18b0e168ae
children 248b897d9f36
line wrap: on
line diff
--- 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)));