Merge remote-tracking branch 'origin/2.5'

This commit is contained in:
Eike Ziller
2012-04-05 18:24:26 +02:00
38 changed files with 275 additions and 97 deletions

View File

@@ -294,6 +294,7 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add
foreach (IDocument *document, documents) {
if (document && !d->m_documentsWithoutWatch.contains(document)) {
connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*)));
connect(document, SIGNAL(fileNameChanged(QString,QString)), m_instance, SLOT(fileNameChanged(QString, QString)));
d->m_documentsWithoutWatch.append(document);
}
}
@@ -304,6 +305,7 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add
if (document && !d->m_documentsWithWatch.contains(document)) {
connect(document, SIGNAL(changed()), m_instance, SLOT(checkForNewFileName()));
connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*)));
connect(document, SIGNAL(fileNameChanged(QString,QString)), m_instance, SLOT(fileNameChanged(QString, QString)));
addFileInfo(document);
}
}
@@ -398,7 +400,18 @@ void DocumentManager::renamedFile(const QString &from, const QString &to)
addFileInfo(document);
d->m_blockedIDocument = 0;
}
emit m_instance->allDocumentsRenamed(from, to);
}
void DocumentManager::fileNameChanged(const QString &oldName, const QString &newName)
{
IDocument *doc = qobject_cast<IDocument *>(sender());
QTC_ASSERT(doc, return);
if (doc == d->m_blockedIDocument)
return;
emit m_instance->documentRenamed(doc, oldName, newName);
}
/*!
\fn bool DocumentManager::addFile(IDocument *document, bool addWatcher)

View File

@@ -148,9 +148,14 @@ signals:
/* Used to notify e.g. the code model to update the given files. Does *not*
lead to any editors to reload or any other editor manager actions. */
void filesChangedInternally(const QStringList &files);
/// emitted if all documents changed their name e.g. due to the file changing on disk
void allDocumentsRenamed(const QString &from, const QString &to);
/// emitted if one document changed its name e.g. due to save as
void documentRenamed(Core::IDocument *document, const QString &from, const QString &to);
private slots:
void documentDestroyed(QObject *obj);
void fileNameChanged(const QString &oldName, const QString &newName);
void checkForNewFileName();
void checkForReload();
void changedFile(const QString &file);

View File

@@ -116,6 +116,7 @@ signals:
void aboutToReload();
void reloaded();
void fileNameChanged(const QString &oldName, const QString &newName);
private:
QString m_autoSaveName;