forked from qt-creator/qt-creator
Fixes: fakevim: code cosmetics
This commit is contained in:
@@ -126,7 +126,6 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
FakeVimPlugin *q;
|
FakeVimPlugin *q;
|
||||||
QAction *m_installHandlerAction;
|
QAction *m_installHandlerAction;
|
||||||
Core::ICore *m_core;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
@@ -136,7 +135,6 @@ FakeVimPluginPrivate::FakeVimPluginPrivate(FakeVimPlugin *plugin)
|
|||||||
{
|
{
|
||||||
q = plugin;
|
q = plugin;
|
||||||
m_installHandlerAction = 0;
|
m_installHandlerAction = 0;
|
||||||
m_core = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FakeVimPluginPrivate::~FakeVimPluginPrivate()
|
FakeVimPluginPrivate::~FakeVimPluginPrivate()
|
||||||
@@ -149,10 +147,7 @@ void FakeVimPluginPrivate::shutdown()
|
|||||||
|
|
||||||
bool FakeVimPluginPrivate::initialize()
|
bool FakeVimPluginPrivate::initialize()
|
||||||
{
|
{
|
||||||
m_core = Core::ICore::instance();
|
Core::ActionManager *actionManager = Core::ICore::instance()->actionManager();
|
||||||
QTC_ASSERT(m_core, return false);
|
|
||||||
|
|
||||||
Core::ActionManager *actionManager = m_core->actionManager();
|
|
||||||
QTC_ASSERT(actionManager, return false);
|
QTC_ASSERT(actionManager, return false);
|
||||||
|
|
||||||
QList<int> globalcontext;
|
QList<int> globalcontext;
|
||||||
@@ -174,7 +169,7 @@ bool FakeVimPluginPrivate::initialize()
|
|||||||
this, SLOT(installHandlerOnCurrentEditor()));
|
this, SLOT(installHandlerOnCurrentEditor()));
|
||||||
|
|
||||||
// EditorManager
|
// EditorManager
|
||||||
QObject *editorManager = m_core->editorManager();
|
QObject *editorManager = Core::ICore::instance()->editorManager();
|
||||||
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||||
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
||||||
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
||||||
@@ -239,9 +234,9 @@ void FakeVimPluginPrivate::writeFile(bool *handled,
|
|||||||
if (editor && editor->file()->fileName() == fileName) {
|
if (editor && editor->file()->fileName() == fileName) {
|
||||||
// Handle that as a special case for nicer interaction with core
|
// Handle that as a special case for nicer interaction with core
|
||||||
Core::IFile *file = editor->file();
|
Core::IFile *file = editor->file();
|
||||||
m_core->fileManager()->blockFileChange(file);
|
Core::ICore::instance()->fileManager()->blockFileChange(file);
|
||||||
file->save(fileName);
|
file->save(fileName);
|
||||||
m_core->fileManager()->unblockFileChange(file);
|
Core::ICore::instance()->fileManager()->unblockFileChange(file);
|
||||||
*handled = true;
|
*handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,33 +253,17 @@ void FakeVimPluginPrivate::removeHandler()
|
|||||||
|
|
||||||
void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
|
void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
Q_UNUSED(editor);
|
|
||||||
//qDebug() << "OPENING: " << editor << editor->widget();
|
//qDebug() << "OPENING: " << editor << editor->widget();
|
||||||
//installHandler(editor);
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
QSettings *s = ICore::instance()->settings();
|
QSettings *s = ICore::instance()->settings();
|
||||||
bool automatic = s->value("textInteractionSettings/UseVim").toBool();
|
bool automatic = s->value("textInteractionSettings/UseVim").toBool();
|
||||||
//qDebug() << "USE VIM: " << automatic;
|
|
||||||
if (automatic)
|
if (automatic)
|
||||||
installHandler(editor);
|
installHandler(editor);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
QWidget *widget = editor->widget();
|
|
||||||
if (BaseTextEditor *bt = qobject_cast<BaseTextEditor *>(widget)) {
|
|
||||||
InteractionSettings settings = bt->interactionSettings();
|
|
||||||
qDebug() << "USE VIM: " << settings.m_useVim;
|
|
||||||
if (settings.m_useVim)
|
|
||||||
installHandler(editor);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimPluginPrivate::editorAboutToClose(Core::IEditor *editor)
|
void FakeVimPluginPrivate::editorAboutToClose(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
|
//qDebug() << "CLOSING: " << editor << editor->widget();
|
||||||
Q_UNUSED(editor);
|
Q_UNUSED(editor);
|
||||||
//qDebug() << "CLOSING: " << editor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimPluginPrivate::showCommandBuffer(const QString &contents)
|
void FakeVimPluginPrivate::showCommandBuffer(const QString &contents)
|
||||||
|
|||||||
Reference in New Issue
Block a user