diff --git a/examples/text/qml/main.qml b/examples/text/qml/main.qml
index 4b5b10ec6dd4a10d565a9d0c5fe6fca88d549e59..24aa10f5550a21f41a0c8fb7ca2e061fcb76b7b0 100644
--- a/examples/text/qml/main.qml
+++ b/examples/text/qml/main.qml
@@ -50,6 +50,8 @@ ApplicationWindow {
     minimumWidth: 400
     minimumHeight: 300
 
+    title: document.documentTitle + " - Text Editor Example"
+
     Action {
         id: cut
         text: "Cut"
diff --git a/examples/text/src/documenthandler.cpp b/examples/text/src/documenthandler.cpp
index b382e6f03a238bc4b45dd1d808bd6fc254cd172d..48b6d033c394ebe22eedbafda570963f1c750b2e 100644
--- a/examples/text/src/documenthandler.cpp
+++ b/examples/text/src/documenthandler.cpp
@@ -43,6 +43,7 @@
 #include <QtGui/QTextDocument>
 #include <QtGui/QTextCursor>
 #include <QtGui/QFontDatabase>
+#include <QtCore/QFileInfo>
 
 DocumentHandler::DocumentHandler()
     : m_target(0)
@@ -74,19 +75,41 @@ void DocumentHandler::setFileUrl(const QUrl &arg)
 {
     if (m_fileUrl != arg) {
         m_fileUrl = arg;
-        if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(arg))) {
-            QFile file(QQmlFile::urlToLocalFileOrQrc(arg));
+        QString fileName = QQmlFile::urlToLocalFileOrQrc(arg);
+        if (QFile::exists(fileName)) {
+            QFile file(fileName);
             if (file.open(QFile::ReadOnly)) {
                 QByteArray data = file.readAll();
                 QTextCodec *codec = QTextCodec::codecForHtml(data);
                 setText(codec->toUnicode(data));
+                if (m_doc)
+                    m_doc->setModified(false);
+                if (fileName.isEmpty())
+                    m_documentTitle = QStringLiteral("untitled.txt");
+                else
+                    m_documentTitle = QFileInfo(fileName).fileName();
+
                 emit textChanged();
+                emit documentTitleChanged();
             }
         }
         emit fileUrlChanged();
     }
 }
 
+QString DocumentHandler::documentTitle() const
+{
+    return m_documentTitle;
+}
+
+void DocumentHandler::setDocumentTitle(QString arg)
+{
+    if (m_documentTitle != arg) {
+        m_documentTitle = arg;
+        emit documentTitleChanged();
+    }
+}
+
 void DocumentHandler::setText(const QString &arg)
 {
     if (m_text != arg) {
diff --git a/examples/text/src/documenthandler.h b/examples/text/src/documenthandler.h
index 804b16d066ff8d382e0475359e73d5a2655d1f74..c60bc1d51988cccc4386dab71cca2b3c3ddbf310 100644
--- a/examples/text/src/documenthandler.h
+++ b/examples/text/src/documenthandler.h
@@ -74,9 +74,9 @@ class DocumentHandler : public QObject
 
     Q_PROPERTY(QStringList defaultFontSizes READ defaultFontSizes NOTIFY defaultFontSizesChanged)
 
-
     Q_PROPERTY(QUrl fileUrl READ fileUrl WRITE setFileUrl NOTIFY fileUrlChanged)
     Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+    Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle NOTIFY documentTitleChanged)
 
 public:
     DocumentHandler();
@@ -107,6 +107,8 @@ public:
     QUrl fileUrl() const;
     QString text() const;
 
+    QString documentTitle() const;
+
 public Q_SLOTS:
     void setBold(bool arg);
     void setItalic(bool arg);
@@ -116,6 +118,8 @@ public Q_SLOTS:
     void setFileUrl(const QUrl &arg);
     void setText(const QString &arg);
 
+    void setDocumentTitle(QString arg);
+
 Q_SIGNALS:
     void targetChanged();
     void cursorPositionChanged();
@@ -135,6 +139,7 @@ Q_SIGNALS:
     void fileUrlChanged();
 
     void textChanged();
+    void documentTitleChanged();
 
 private:
     QTextCursor textCursor() const;
@@ -154,6 +159,7 @@ private:
     int m_fontSize;
     QUrl m_fileUrl;
     QString m_text;
+    QString m_documentTitle;
 };
 
 #endif