changeset 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
files gui/src/FileEditorMdiSubWindow.cpp gui/src/FileEditorMdiSubWindow.h
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
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)));
--- 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