X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/edd98d7659d028f17185835fc14208d655273c82..2f0ceedae088158b8af24a5e94500a7d1c0edecb:/src/views/versioncontrol/versioncontrolobserver.cpp diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index 9c3939632..583e183fc 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 by Peter Penz * + * Copyright (C) 2009 by Peter Penz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -21,10 +21,10 @@ #include "dolphin_versioncontrolsettings.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include "pendingthreadsmaintainer.h" @@ -35,27 +35,26 @@ #include #include -#include - -VersionControlObserver::VersionControlObserver(QAbstractItemView* view) : +VersionControlObserver::VersionControlObserver(QWidget* view) : QObject(view), m_pendingItemStatesUpdate(false), m_versionedDirectory(false), m_silentUpdate(false), m_view(view), - m_dirLister(0), - m_dolphinModel(0), + //m_dirLister(0), + //m_dolphinModel(0), m_dirVerificationTimer(0), m_plugin(0), m_updateItemStatesThread(0) { - Q_ASSERT(view != 0); + Q_ASSERT(view); + + /*QAbstractProxyModel* proxyModel = qobject_cast(view->model()); + m_dolphinModel = proxyModel ? + qobject_cast(proxyModel->sourceModel()) : + qobject_cast(view->model()); - QAbstractProxyModel* proxyModel = qobject_cast(view->model()); - m_dolphinModel = (proxyModel == 0) ? - qobject_cast(view->model()) : - qobject_cast(proxyModel->sourceModel()); - if (m_dolphinModel != 0) { + if (m_dolphinModel) { m_dirLister = m_dolphinModel->dirLister(); connect(m_dirLister, SIGNAL(completed()), this, SLOT(delayedDirectoryVerification())); @@ -70,12 +69,12 @@ VersionControlObserver::VersionControlObserver(QAbstractItemView* view) : m_dirVerificationTimer->setInterval(500); connect(m_dirVerificationTimer, SIGNAL(timeout()), this, SLOT(verifyDirectory())); - } + }*/ } VersionControlObserver::~VersionControlObserver() { - if (m_updateItemStatesThread != 0) { + if (m_updateItemStatesThread) { if (m_updateItemStatesThread->isFinished()) { delete m_updateItemStatesThread; m_updateItemStatesThread = 0; @@ -91,7 +90,7 @@ VersionControlObserver::~VersionControlObserver() } } - if (m_plugin != 0) { + if (m_plugin) { m_plugin->disconnect(); m_plugin = 0; } @@ -132,17 +131,17 @@ void VersionControlObserver::silentDirectoryVerification() void VersionControlObserver::verifyDirectory() { - const KUrl versionControlUrl = m_dirLister->url(); + const KUrl versionControlUrl; // = m_dirLister->url(); if (!versionControlUrl.isLocalFile()) { return; } - if (m_plugin != 0) { + if (m_plugin) { m_plugin->disconnect(); } m_plugin = searchPlugin(versionControlUrl); - if (m_plugin != 0) { + /*if (m_plugin) { connect(m_plugin, SIGNAL(versionStatesChanged()), this, SLOT(silentDirectoryVerification())); connect(m_plugin, SIGNAL(infoMessage(QString)), @@ -158,9 +157,9 @@ void VersionControlObserver::verifyDirectory() // The directory is versioned. Assume that the user will further browse through // versioned directories and decrease the verification timer. m_dirVerificationTimer->setInterval(100); - connect(m_dirLister, SIGNAL(refreshItems(const QList>&)), + connect(m_dirLister, SIGNAL(refreshItems(QList >)), this, SLOT(delayedDirectoryVerification())); - connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)), + connect(m_dirLister, SIGNAL(newItems(KFileItemList)), this, SLOT(delayedDirectoryVerification())); } updateItemStates(); @@ -171,16 +170,16 @@ void VersionControlObserver::verifyDirectory() // value, so that browsing through non-versioned directories is not slown down // by an immediate verification. m_dirVerificationTimer->setInterval(500); - disconnect(m_dirLister, SIGNAL(refreshItems(const QList>&)), + disconnect(m_dirLister, SIGNAL(refreshItems(QList >)), this, SLOT(delayedDirectoryVerification())); - disconnect(m_dirLister, SIGNAL(newItems(const KFileItemList&)), + disconnect(m_dirLister, SIGNAL(newItems(KFileItemList)), this, SLOT(delayedDirectoryVerification())); - } + }*/ } void VersionControlObserver::slotThreadFinished() { - if (m_plugin == 0) { + if (!m_plugin) { return; } @@ -194,7 +193,7 @@ void VersionControlObserver::slotThreadFinished() // (a detailed description of the root cause is given in the class KFilePreviewGenerator // from kdelibs). To bypass this bottleneck, the signals of the model are temporary blocked. // This works as the update of the data does not require a relayout of the views used in Dolphin. - const bool signalsBlocked = m_dolphinModel->signalsBlocked(); + /*const bool signalsBlocked = m_dolphinModel->signalsBlocked(); m_dolphinModel->blockSignals(true); const QList itemStates = m_updateItemStatesThread->itemStates(); @@ -217,13 +216,13 @@ void VersionControlObserver::slotThreadFinished() if (m_pendingItemStatesUpdate) { m_pendingItemStatesUpdate = false; updateItemStates(); - } + }*/ } void VersionControlObserver::updateItemStates() { - Q_ASSERT(m_plugin != 0); - if (m_updateItemStatesThread == 0) { + Q_ASSERT(m_plugin); + if (!m_updateItemStatesThread) { m_updateItemStatesThread = new UpdateItemStatesThread(); connect(m_updateItemStatesThread, SIGNAL(finished()), this, SLOT(slotThreadFinished())); @@ -248,7 +247,9 @@ void VersionControlObserver::updateItemStates() void VersionControlObserver::addDirectory(const QModelIndex& parentIndex, QList& itemStates) { - const int rowCount = m_dolphinModel->rowCount(parentIndex); + Q_UNUSED(parentIndex); + Q_UNUSED(itemStates); + /*const int rowCount = m_dolphinModel->rowCount(parentIndex); for (int row = 0; row < rowCount; ++row) { const QModelIndex index = m_dolphinModel->index(row, DolphinModel::Version, parentIndex); addDirectory(index, itemStates); @@ -259,7 +260,7 @@ void VersionControlObserver::addDirectory(const QModelIndex& parentIndex, QList< itemState.version = KVersionControlPlugin::UnversionedVersion; itemStates.append(itemState); - } + }*/ } KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& directory) const @@ -282,7 +283,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) { if (enabledPlugins.contains((*it)->name())) { KVersionControlPlugin* plugin = (*it)->createInstance(); - if (plugin != 0) { + if (plugin) { plugins.append(plugin); } } @@ -295,7 +296,8 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director // Verify whether the current directory contains revision information // like .svn, .git, ... - foreach (KVersionControlPlugin* plugin, plugins) { + Q_UNUSED(directory); + /*foreach (KVersionControlPlugin* plugin, plugins) { // Use the KDirLister cache to check for .svn, .git, ... files KUrl dirUrl(directory); KUrl fileUrl = dirUrl; @@ -323,14 +325,14 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director upUrl = dirUrl.upUrl(); } } - } + }*/ return 0; } bool VersionControlObserver::isVersioned() const { - return m_dolphinModel->hasVersionData() && (m_plugin != 0); + return false; //m_dolphinModel->hasVersionData() && m_plugin; } #include "versioncontrolobserver.moc"