summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorDaniel Teske <daniel.teske@nokia.com>2012-03-12 16:56:25 +0100
committerEike Ziller <eike.ziller@nokia.com>2012-04-05 16:47:15 +0200
commit10438d2e9d74fe5ad38f2ccbaf1fbbe8316b4061 (patch)
treeea026b58c71f3fc87704b1d973493ddd343f058b /src/plugins
parentf1c299a85e08c5ce16fc8dad371a11115687edf0 (diff)
downloadqt-creator-10438d2e9d74fe5ad38f2ccbaf1fbbe8316b4061.tar.gz
BaseTextMark: Support renaming files
Change-Id: I8d712f76fca5d8f5ecad70f1485228e21c00648d Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bookmarks/bookmark.cpp10
-rw-r--r--src/plugins/bookmarks/bookmark.h3
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp13
-rw-r--r--src/plugins/coreplugin/documentmanager.h5
-rw-r--r--src/plugins/coreplugin/idocument.h1
-rw-r--r--src/plugins/debugger/breakhandler.cpp8
-rw-r--r--src/plugins/debugger/breakhandler.h1
-rw-r--r--src/plugins/debugger/breakpointmarker.cpp6
-rw-r--r--src/plugins/debugger/breakpointmarker.h1
-rw-r--r--src/plugins/designer/formwindowfile.cpp4
-rw-r--r--src/plugins/imageviewer/imageviewerfile.cpp2
-rw-r--r--src/plugins/projectexplorer/taskhub.cpp12
-rw-r--r--src/plugins/projectexplorer/taskhub.h2
-rw-r--r--src/plugins/projectexplorer/taskmodel.cpp10
-rw-r--r--src/plugins/projectexplorer/taskmodel.h1
-rw-r--r--src/plugins/projectexplorer/taskwindow.cpp8
-rw-r--r--src/plugins/projectexplorer/taskwindow.h1
-rw-r--r--src/plugins/resourceeditor/resourceeditorw.cpp2
-rw-r--r--src/plugins/texteditor/basetextdocument.cpp5
-rw-r--r--src/plugins/texteditor/basetextmark.cpp56
-rw-r--r--src/plugins/texteditor/basetextmark.h8
-rw-r--r--src/plugins/texteditor/itextmark.h1
22 files changed, 155 insertions, 5 deletions
diff --git a/src/plugins/bookmarks/bookmark.cpp b/src/plugins/bookmarks/bookmark.cpp
index 4de678563d..45fb4bdee3 100644
--- a/src/plugins/bookmarks/bookmark.cpp
+++ b/src/plugins/bookmarks/bookmark.cpp
@@ -70,6 +70,16 @@ void Bookmark::updateBlock(const QTextBlock &block)
}
}
+void Bookmark::updateFileName(const QString &fileName)
+{
+ m_fileName = fileName;
+ QFileInfo fi(fileName);
+ m_onlyFile = fi.fileName();
+ m_path = fi.path();
+ m_manager->updateBookmark(this);
+ BaseTextMark::updateFileName(fileName);
+}
+
QString Bookmark::lineText() const
{
return m_lineText;
diff --git a/src/plugins/bookmarks/bookmark.h b/src/plugins/bookmarks/bookmark.h
index 62d55f7d1b..f26a66920f 100644
--- a/src/plugins/bookmarks/bookmark.h
+++ b/src/plugins/bookmarks/bookmark.h
@@ -54,6 +54,7 @@ public:
void updateLineNumber(int lineNumber);
void updateBlock(const QTextBlock &block);
+ void updateFileName(const QString &fileName);
void removedFromEditor();
QString filePath() const;
@@ -63,7 +64,7 @@ public:
private:
BookmarkManager *m_manager;
- const QString m_fileName;
+ QString m_fileName;
QString m_onlyFile;
QString m_path;
QString m_lineText;
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index 878c2fb612..9828859f9f 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -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)
diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h
index 7f59e50ecd..23451720e2 100644
--- a/src/plugins/coreplugin/documentmanager.h
+++ b/src/plugins/coreplugin/documentmanager.h
@@ -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);
diff --git a/src/plugins/coreplugin/idocument.h b/src/plugins/coreplugin/idocument.h
index 8a2716d398..f3048276b1 100644
--- a/src/plugins/coreplugin/idocument.h
+++ b/src/plugins/coreplugin/idocument.h
@@ -116,6 +116,7 @@ signals:
void aboutToReload();
void reloaded();
+ void fileNameChanged(const QString &oldName, const QString &newName);
private:
QString m_autoSaveName;
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 6e892b54b0..3ea1664955 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -1223,6 +1223,14 @@ void BreakHandler::gotoLocation(BreakpointModelId id) const
}
}
+void BreakHandler::updateFileNameFromMarker(BreakpointModelId id, const QString &fileName)
+{
+ Iterator it = m_storage.find(id);
+ BREAK_ASSERT(it != m_storage.end(), return);
+ it->data.fileName = fileName;
+ emit layoutChanged();
+}
+
void BreakHandler::updateLineNumberFromMarker(BreakpointModelId id, int lineNumber)
{
Iterator it = m_storage.find(id);
diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h
index 04475bc80d..d212b6d9ab 100644
--- a/src/plugins/debugger/breakhandler.h
+++ b/src/plugins/debugger/breakhandler.h
@@ -134,6 +134,7 @@ public:
BreakpointState state(BreakpointModelId id) const;
bool isEnabled(BreakpointModelId id) const;
void setEnabled(BreakpointModelId id, bool on);
+ void updateFileNameFromMarker(BreakpointModelId id, const QString &fileName);
void updateLineNumberFromMarker(BreakpointModelId id, int lineNumber);
void setMarkerFileAndLine(BreakpointModelId id,
const QString &fileName, int lineNumber);
diff --git a/src/plugins/debugger/breakpointmarker.cpp b/src/plugins/debugger/breakpointmarker.cpp
index 214184f9a6..6cac5a37c2 100644
--- a/src/plugins/debugger/breakpointmarker.cpp
+++ b/src/plugins/debugger/breakpointmarker.cpp
@@ -71,6 +71,12 @@ void BreakpointMarker::updateLineNumber(int lineNumber)
breakHandler()->updateLineNumberFromMarker(m_id, lineNumber);
}
+void BreakpointMarker::updateFileName(const QString &fileName)
+{
+ BaseTextMark::updateFileName(fileName);
+ breakHandler()->updateFileNameFromMarker(m_id, fileName);
+}
+
} // namespace Internal
} // namespace Debugger
diff --git a/src/plugins/debugger/breakpointmarker.h b/src/plugins/debugger/breakpointmarker.h
index 4101e7414d..432f59b3cd 100644
--- a/src/plugins/debugger/breakpointmarker.h
+++ b/src/plugins/debugger/breakpointmarker.h
@@ -48,6 +48,7 @@ public:
~BreakpointMarker();
void removedFromEditor();
void updateLineNumber(int lineNumber);
+ void updateFileName(const QString &fileName);
private:
BreakpointModelId m_id;
diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp
index 0b05e675ed..eea63511e8 100644
--- a/src/plugins/designer/formwindowfile.cpp
+++ b/src/plugins/designer/formwindowfile.cpp
@@ -104,9 +104,11 @@ bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSa
return false;
}
+ const QString oldFileName = m_fileName;
m_fileName = fi.absoluteFilePath();
emit setDisplayName(fi.fileName());
m_formWindow->setDirty(false);
+ emit fileNameChanged(oldFileName, m_fileName);
emit changed();
emit saved();
@@ -117,8 +119,10 @@ void FormWindowFile::rename(const QString &newName)
{
m_formWindow->setFileName(newName);
QFileInfo fi(newName);
+ const QString oldFileName = m_fileName;
m_fileName = fi.absoluteFilePath();
emit setDisplayName(fi.fileName());
+ emit fileNameChanged(oldFileName, m_fileName);
emit changed();
}
diff --git a/src/plugins/imageviewer/imageviewerfile.cpp b/src/plugins/imageviewer/imageviewerfile.cpp
index c332af750f..d54cbdce6c 100644
--- a/src/plugins/imageviewer/imageviewerfile.cpp
+++ b/src/plugins/imageviewer/imageviewerfile.cpp
@@ -97,8 +97,10 @@ bool ImageViewerFile::save(QString *errorString, const QString &fileName, bool a
void ImageViewerFile::rename(const QString &newName)
{
+ const QString oldFilename = d->fileName;
d->fileName = newName;
d->editor->setDisplayName(QFileInfo(d->fileName).fileName());
+ emit fileNameChanged(oldFilename, newName);
emit changed();
}
diff --git a/src/plugins/projectexplorer/taskhub.cpp b/src/plugins/projectexplorer/taskhub.cpp
index a05d9dc1fa..1223b46b20 100644
--- a/src/plugins/projectexplorer/taskhub.cpp
+++ b/src/plugins/projectexplorer/taskhub.cpp
@@ -48,6 +48,7 @@ public:
bool clickable() const;
void clicked();
+ void updateFileName(const QString &fileName);
void updateLineNumber(int lineNumber);
void removedFromEditor();
bool visible() const;
@@ -62,6 +63,12 @@ void TaskMark::updateLineNumber(int lineNumber)
BaseTextMark::updateLineNumber(lineNumber);
}
+void TaskMark::updateFileName(const QString &fileName)
+{
+ ProjectExplorerPlugin::instance()->taskHub()->updateTaskFileName(m_id, fileName);
+ BaseTextMark::updateFileName(fileName);
+}
+
void TaskMark::removedFromEditor()
{
ProjectExplorerPlugin::instance()->taskHub()->updateTaskLineNumber(m_id, -1);
@@ -122,6 +129,11 @@ void TaskHub::removeTask(const Task &task)
emit taskRemoved(task);
}
+void TaskHub::updateTaskFileName(unsigned int id, const QString &fileName)
+{
+ emit taskFileNameUpdated(id, fileName);
+}
+
void TaskHub::updateTaskLineNumber(unsigned int id, int line)
{
emit taskLineNumberUpdated(id, line);
diff --git a/src/plugins/projectexplorer/taskhub.h b/src/plugins/projectexplorer/taskhub.h
index 6f92c3dd5e..e48d3f507c 100644
--- a/src/plugins/projectexplorer/taskhub.h
+++ b/src/plugins/projectexplorer/taskhub.h
@@ -52,6 +52,7 @@ public:
void addTask(Task task);
void clearTasks(const Core::Id &categoryId = Core::Id());
void removeTask(const Task &task);
+ void updateTaskFileName(unsigned int id, const QString &fileName);
void updateTaskLineNumber(unsigned int id, int line);
void taskMarkClicked(unsigned int id);
void setCategoryVisibility(const Core::Id &categoryId, bool visible);
@@ -65,6 +66,7 @@ signals:
void taskAdded(const ProjectExplorer::Task &task);
void taskRemoved(const ProjectExplorer::Task &task);
void tasksCleared(const Core::Id &categoryId);
+ void taskFileNameUpdated(unsigned int id, const QString &fileName);
void taskLineNumberUpdated(unsigned int id, int line);
void categoryVisibilityChanged(const Core::Id &categoryId, bool visible);
void popupRequested(bool withFocus);
diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp
index edf903ef44..94f2307f9f 100644
--- a/src/plugins/projectexplorer/taskmodel.cpp
+++ b/src/plugins/projectexplorer/taskmodel.cpp
@@ -156,6 +156,16 @@ int TaskModel::rowForId(unsigned int id)
return it - m_tasks.constBegin();
}
+void TaskModel::updateTaskFileName(unsigned int id, const QString &fileName)
+{
+ int i = rowForId(id);
+ QTC_ASSERT(i != -1, return)
+ if (m_tasks.at(i).taskId == id) {
+ m_tasks[i].file = Utils::FileName::fromString(fileName);
+ emit dataChanged(index(i, 0), index(i, 0));
+ }
+}
+
void TaskModel::updateTaskLineNumber(unsigned int id, int line)
{
int i = rowForId(id);
diff --git a/src/plugins/projectexplorer/taskmodel.h b/src/plugins/projectexplorer/taskmodel.h
index 017e489b6e..98e857af75 100644
--- a/src/plugins/projectexplorer/taskmodel.h
+++ b/src/plugins/projectexplorer/taskmodel.h
@@ -62,6 +62,7 @@ public:
void addTask(const Task &task);
void removeTask(const Task &task);
void clearTasks(const Core::Id &categoryId = Core::Id());
+ void updateTaskFileName(unsigned int id, const QString &fileName);
void updateTaskLineNumber(unsigned int id, int line);
int sizeOfFile(const QFont &font);
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp
index 0b2e981e95..3858c2661e 100644
--- a/src/plugins/projectexplorer/taskwindow.cpp
+++ b/src/plugins/projectexplorer/taskwindow.cpp
@@ -299,6 +299,8 @@ TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate)
this, SLOT(removeTask(ProjectExplorer::Task)));
connect(d->m_taskHub, SIGNAL(taskLineNumberUpdated(uint,int)),
this, SLOT(updatedTaskLineNumber(uint,int)));
+ connect(d->m_taskHub, SIGNAL(taskFileNameUpdated(uint,QString)),
+ this, SLOT(updatedTaskFileName(uint,QString)));
connect(d->m_taskHub, SIGNAL(tasksCleared(Core::Id)),
this, SLOT(clearTasks(Core::Id)));
connect(d->m_taskHub, SIGNAL(categoryVisibilityChanged(Core::Id,bool)),
@@ -385,6 +387,12 @@ void TaskWindow::removeTask(const Task &task)
navigateStateChanged();
}
+void TaskWindow::updatedTaskFileName(unsigned int id, const QString &fileName)
+{
+ d->m_model->updateTaskFileName(id, fileName);
+ emit tasksChanged();
+}
+
void TaskWindow::updatedTaskLineNumber(unsigned int id, int line)
{
d->m_model->updateTaskLineNumber(id, line);
diff --git a/src/plugins/projectexplorer/taskwindow.h b/src/plugins/projectexplorer/taskwindow.h
index 8a41bf9b1f..a83789b5db 100644
--- a/src/plugins/projectexplorer/taskwindow.h
+++ b/src/plugins/projectexplorer/taskwindow.h
@@ -89,6 +89,7 @@ private slots:
void addCategory(const Core::Id &categoryId, const QString &displayName, bool visible);
void addTask(const ProjectExplorer::Task &task);
void removeTask(const ProjectExplorer::Task &task);
+ void updatedTaskFileName(unsigned int id, const QString &fileName);
void updatedTaskLineNumber(unsigned int id, int line);
void showTask(unsigned int id);
void clearTasks(const Core::Id &categoryId);
diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp
index 150a4a3ce8..33ded8d76b 100644
--- a/src/plugins/resourceeditor/resourceeditorw.cpp
+++ b/src/plugins/resourceeditor/resourceeditorw.cpp
@@ -194,7 +194,9 @@ bool ResourceEditorDocument::save(QString *errorString, const QString &name, boo
void ResourceEditorDocument::rename(const QString &newName)
{
+ const QString oldName = m_parent->m_resourceEditor->fileName();
m_parent->m_resourceEditor->setFileName(newName);
+ emit fileNameChanged(oldName, newName); // TODO Are there other cases where the ressource file name changes?
emit changed();
}
diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp
index 6bf18d8e75..22cb9fcd56 100644
--- a/src/plugins/texteditor/basetextdocument.cpp
+++ b/src/plugins/texteditor/basetextdocument.cpp
@@ -268,9 +268,10 @@ bool BaseTextDocument::save(QString *errorString, const QString &fileName, bool
return true;
const QFileInfo fi(fName);
+ const QString oldFileName = d->m_fileName;
d->m_fileName = QDir::cleanPath(fi.absoluteFilePath());
-
d->m_document->setModified(false);
+ emit fileNameChanged(oldFileName, d->m_fileName);
emit titleChanged(fi.fileName());
emit changed();
return true;
@@ -284,7 +285,9 @@ bool BaseTextDocument::shouldAutoSave() const
void BaseTextDocument::rename(const QString &newName)
{
const QFileInfo fi(newName);
+ const QString oldFileName = d->m_fileName;
d->m_fileName = QDir::cleanPath(fi.absoluteFilePath());
+ emit fileNameChanged(oldFileName, d->m_fileName);
emit titleChanged(fi.fileName());
emit changed();
}
diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp
index 3c68e36e28..6f5898a532 100644
--- a/src/plugins/texteditor/basetextmark.cpp
+++ b/src/plugins/texteditor/basetextmark.cpp
@@ -36,6 +36,7 @@
#include "texteditorplugin.h"
#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/documentmanager.h>
#include <extensionsystem/pluginmanager.h>
using namespace TextEditor;
@@ -47,11 +48,17 @@ BaseTextMarkRegistry::BaseTextMarkRegistry(QObject *parent)
Core::EditorManager *em = Core::EditorManager::instance();
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
SLOT(editorOpened(Core::IEditor*)));
+
+ Core::DocumentManager *dm = Core::DocumentManager::instance();
+ connect(dm, SIGNAL(allDocumentsRenamed(QString,QString)),
+ this, SLOT(allDocumentsRenamed(QString,QString)));
+ connect(dm, SIGNAL(documentRenamed(Core::IDocument*,QString,QString)),
+ this, SLOT(documentRenamed(Core::IDocument*,QString,QString)));
}
void BaseTextMarkRegistry::add(BaseTextMark *mark)
{
- m_marks[Utils::FileName::fromString(mark->fileName())].append(mark);
+ m_marks[Utils::FileName::fromString(mark->fileName())].insert(mark);
Core::EditorManager *em = Core::EditorManager::instance();
foreach (Core::IEditor *editor, em->editorsForFileName(mark->fileName())) {
if (ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor)) {
@@ -65,7 +72,7 @@ void BaseTextMarkRegistry::add(BaseTextMark *mark)
void BaseTextMarkRegistry::remove(BaseTextMark *mark)
{
- m_marks[Utils::FileName::fromString(mark->fileName())].removeOne(mark);
+ m_marks[Utils::FileName::fromString(mark->fileName())].remove(mark);
}
void BaseTextMarkRegistry::editorOpened(Core::IEditor *editor)
@@ -82,6 +89,46 @@ void BaseTextMarkRegistry::editorOpened(Core::IEditor *editor)
}
}
+void BaseTextMarkRegistry::documentRenamed(Core::IDocument *document, const
+ QString &oldName, const QString &newName)
+{
+ TextEditor::BaseTextDocument *baseTextDocument
+ = qobject_cast<TextEditor::BaseTextDocument *>(document);
+ if (!document)
+ return;
+ Utils::FileName oldFileName = Utils::FileName::fromString(oldName);
+ Utils::FileName newFileName = Utils::FileName::fromString(newName);
+ if (!m_marks.contains(oldFileName))
+ return;
+
+ QSet<BaseTextMark *> toBeMoved;
+ foreach (ITextMark *mark, baseTextDocument->documentMarker()->marks())
+ if (BaseTextMark *baseTextMark = dynamic_cast<BaseTextMark *>(mark))
+ toBeMoved.insert(baseTextMark);
+
+ m_marks[oldFileName].subtract(toBeMoved);
+ m_marks[newFileName].unite(toBeMoved);
+
+ foreach (BaseTextMark *mark, toBeMoved)
+ mark->updateFileName(newName);
+}
+
+void BaseTextMarkRegistry::allDocumentsRenamed(const QString &oldName, const QString &newName)
+{
+ Utils::FileName oldFileName = Utils::FileName::fromString(oldName);
+ Utils::FileName newFileName = Utils::FileName::fromString(newName);
+ if (!m_marks.contains(oldFileName))
+ return;
+
+ QSet<BaseTextMark *> oldFileNameMarks = m_marks.value(oldFileName);
+
+ m_marks[newFileName].unite(oldFileNameMarks);
+ m_marks[oldFileName].clear();
+
+ foreach (BaseTextMark *mark, oldFileNameMarks)
+ mark->updateFileName(newName);
+}
+
BaseTextMark::BaseTextMark(const QString &fileName, int lineNumber)
: ITextMark(lineNumber), m_fileName(fileName)
{
@@ -93,3 +140,8 @@ BaseTextMark::~BaseTextMark()
// oha we are deleted
Internal::TextEditorPlugin::instance()->baseTextMarkRegistry()->remove(this);
}
+
+void BaseTextMark::updateFileName(const QString &fileName)
+{
+ m_fileName = fileName;
+}
diff --git a/src/plugins/texteditor/basetextmark.h b/src/plugins/texteditor/basetextmark.h
index 064b84d0c3..1b31724f2f 100644
--- a/src/plugins/texteditor/basetextmark.h
+++ b/src/plugins/texteditor/basetextmark.h
@@ -40,6 +40,7 @@
#include <QWeakPointer>
#include <QHash>
+#include <QSet>
QT_BEGIN_NAMESPACE
class QTextBlock;
@@ -61,6 +62,9 @@ public:
BaseTextMark(const QString &fileName, int lineNumber);
virtual ~BaseTextMark();
+ /// called if the filename of the document changed
+ virtual void updateFileName(const QString &fileName);
+
// access to internal data
QString fileName() const { return m_fileName; }
@@ -79,8 +83,10 @@ public:
void remove(BaseTextMark *mark);
private slots:
void editorOpened(Core::IEditor *editor);
+ void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName);
+ void allDocumentsRenamed(const QString &oldName, const QString &newName);
private:
- QHash<Utils::FileName, QList<BaseTextMark *> > m_marks;
+ QHash<Utils::FileName, QSet<BaseTextMark *> > m_marks;
};
}
diff --git a/src/plugins/texteditor/itextmark.h b/src/plugins/texteditor/itextmark.h
index 19c8f4750b..79e0ca0131 100644
--- a/src/plugins/texteditor/itextmark.h
+++ b/src/plugins/texteditor/itextmark.h
@@ -103,6 +103,7 @@ class TEXTEDITOR_EXPORT ITextMarkable : public QObject
public:
ITextMarkable(QObject *parent = 0) : QObject(parent) {}
+ virtual TextMarks marks() const = 0;
virtual bool addMark(ITextMark *mark) = 0;
virtual TextMarks marksAt(int line) const = 0;
virtual void removeMark(ITextMark *mark) = 0;