X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/896ee459af10c73d20d0ae093b4c02348ffedb18..7eeb8dba6aeba09aa3dfa7fa5f0b00840d4d8317:/src/versioncontrol/versioncontrolobserver.cpp diff --git a/src/versioncontrol/versioncontrolobserver.cpp b/src/versioncontrol/versioncontrolobserver.cpp index aea60b28d..ebe59e049 100644 --- a/src/versioncontrol/versioncontrolobserver.cpp +++ b/src/versioncontrol/versioncontrolobserver.cpp @@ -20,6 +20,7 @@ #include "versioncontrolobserver.h" #include +#include "dolphin_versioncontrolsettings.h" #include #include @@ -75,9 +76,16 @@ VersionControlObserver::~VersionControlObserver() if (m_updateItemStatesThread != 0) { disconnect(m_updateItemStatesThread, SIGNAL(finished()), this, SLOT(applyUpdatedItemStates())); - m_updateItemStatesThread->deleteWhenFinished(); + if (m_updateItemStatesThread->isFinished()) { + delete m_updateItemStatesThread; + } else { + m_updateItemStatesThread->deleteWhenFinished(); + } m_updateItemStatesThread = 0; } + + m_plugin->disconnect(); + m_plugin = 0; } QList VersionControlObserver::contextMenuActions(const KFileItemList& items) const @@ -171,6 +179,12 @@ void VersionControlObserver::verifyDirectory() void VersionControlObserver::applyUpdatedItemStates() { + if (m_plugin == 0) { + // The signal finished() has been emitted, but the thread has been marked + // as invalid in the meantime. Just ignore the signal in this case. + return; + } + if (!m_updateItemStatesThread->retrievedItems()) { // ignore m_silentUpdate for an error message emit errorMessage(i18nc("@info:status", "Update of version information failed.")); @@ -211,7 +225,7 @@ void VersionControlObserver::updateItemStates() { Q_ASSERT(m_plugin != 0); if (m_updateItemStatesThread == 0) { - m_updateItemStatesThread = new UpdateItemStatesThread(this); + m_updateItemStatesThread = new UpdateItemStatesThread(); connect(m_updateItemStatesThread, SIGNAL(finished()), this, SLOT(applyUpdatedItemStates())); } @@ -263,11 +277,16 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director if (plugins.isEmpty()) { // No searching for plugins has been done yet. Query the KServiceTypeTrader for // all fileview version control plugins and remember them in 'plugins'. + const QString disabledPlugins = VersionControlSettings::disabledPlugins(); + const QStringList disabledPluginsList = disabledPlugins.split(','); + const KService::List pluginServices = KServiceTypeTrader::self()->query("FileViewVersionControlPlugin"); for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) { - KVersionControlPlugin* plugin = (*it)->createInstance(); - Q_ASSERT(plugin != 0); - plugins.append(plugin); + if (!disabledPluginsList.contains((*it)->name())) { + KVersionControlPlugin* plugin = (*it)->createInstance(); + Q_ASSERT(plugin != 0); + plugins.append(plugin); + } } if (plugins.isEmpty()) { pluginsAvailable = false;