forked from qt-creator/qt-creator
FakeVim: Update file path and global marks
Update file path and global marks if file in project is renamed. Update file path on "Save as...". Task-number: QTCREATORBUG-12810 Change-Id: Ia2361e8f65a7a494e339d96c8b4610af4ab38edb Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -1003,6 +1003,10 @@ private slots:
|
||||
void editorOpened(Core::IEditor *);
|
||||
void editorAboutToClose(Core::IEditor *);
|
||||
|
||||
void allDocumentsRenamed(const QString &oldName, const QString &newName);
|
||||
void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName);
|
||||
void renameFileNameInEditors(const QString &oldName, const QString &newName);
|
||||
|
||||
void setUseFakeVim(const QVariant &value);
|
||||
void setUseFakeVimInternal(bool on);
|
||||
void quitFakeVim();
|
||||
@@ -1222,6 +1226,11 @@ bool FakeVimPluginPrivate::initialize()
|
||||
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(editorOpened(Core::IEditor*)));
|
||||
|
||||
connect(DocumentManager::instance(), SIGNAL(allDocumentsRenamed(QString,QString)),
|
||||
this, SLOT(allDocumentsRenamed(QString,QString)));
|
||||
connect(DocumentManager::instance(), SIGNAL(documentRenamed(Core::IDocument*,QString,QString)),
|
||||
this, SLOT(documentRenamed(Core::IDocument*,QString,QString)));
|
||||
|
||||
connect(theFakeVimSetting(ConfigUseFakeVim), SIGNAL(valueChanged(QVariant)),
|
||||
this, SLOT(setUseFakeVim(QVariant)));
|
||||
connect(theFakeVimSetting(ConfigReadVimRc), SIGNAL(valueChanged(QVariant)),
|
||||
@@ -1823,6 +1832,26 @@ void FakeVimPluginPrivate::editorAboutToClose(IEditor *editor)
|
||||
m_editorToHandler.remove(editor);
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::allDocumentsRenamed(const QString &oldName, const QString &newName)
|
||||
{
|
||||
renameFileNameInEditors(oldName, newName);
|
||||
FakeVimHandler::updateGlobalMarksFilenames(oldName, newName);
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::documentRenamed(
|
||||
IDocument *, const QString &oldName, const QString &newName)
|
||||
{
|
||||
renameFileNameInEditors(oldName, newName);
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::renameFileNameInEditors(const QString &oldName, const QString &newName)
|
||||
{
|
||||
foreach (FakeVimHandler *handler, m_editorToHandler.values()) {
|
||||
if (handler->currentFileName() == oldName)
|
||||
handler->setCurrentFileName(newName);
|
||||
}
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::setUseFakeVim(const QVariant &value)
|
||||
{
|
||||
//qDebug() << "SET USE FAKEVIM" << value;
|
||||
|
||||
Reference in New Issue
Block a user