Commit 6062ff2e authored by con's avatar con
Browse files

Fixes: "Save as" does not update window title

parent 535b9691
......@@ -368,7 +368,8 @@ SessionManager::SessionManager(QObject *parent)
: QObject(parent),
m_core(Core::ICore::instance()),
m_file(new SessionFile),
m_sessionNode(new Internal::SessionNodeImpl(this))
m_sessionNode(new Internal::SessionNodeImpl(this)),
m_currentEditor(0)
{
// Create qtcreator dir if it doesn't yet exist
QString configDir = QFileInfo(m_core->settings()->fileName()).path();
......@@ -394,7 +395,7 @@ SessionManager::SessionManager(QObject *parent)
connect(ProjectExplorerPlugin::instance(), SIGNAL(currentProjectChanged(ProjectExplorer::Project *)),
this, SLOT(updateWindowTitle()));
connect(m_core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateWindowTitle()));
this, SLOT(handleCurrentEditorChange(Core::IEditor*)));
}
SessionManager::~SessionManager()
......@@ -876,6 +877,18 @@ Core::IFile *SessionManager::file() const
return m_file;
}
void SessionManager::handleCurrentEditorChange(Core::IEditor *editor)
{
if (editor != m_currentEditor) {
if (m_currentEditor)
disconnect(m_currentEditor, SIGNAL(changed()), this, SLOT(updateWindowTitle()));
if (editor)
connect(editor, SIGNAL(changed()), this, SLOT(updateWindowTitle()));
m_currentEditor = editor;
}
updateWindowTitle();
}
void SessionManager::updateWindowTitle()
{
QString windowTitle = tr("Qt Creator");
......
......@@ -37,6 +37,7 @@
#include <QtCore/QList>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QPointer>
QT_BEGIN_NAMESPACE
class QAbstractItemModel;
......@@ -169,6 +170,7 @@ private slots:
void saveActiveMode(Core::IMode *mode);
void clearProjectFileCache();
void setEditorCodec(Core::IEditor *editor, const QString &fileName);
void handleCurrentEditorChange(Core::IEditor *editor);
void updateWindowTitle();
private:
......@@ -188,6 +190,7 @@ private:
Internal::SessionFile *m_file;
Internal::SessionNodeImpl *m_sessionNode;
QPointer<Core::IEditor> m_currentEditor;
QString m_displayName;
QString m_sessionName;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment