dolphinremoteencoding.cpp
draganddrophelper.cpp
folderexpander.cpp
+ kversioncontrolplugin.cpp
renamedialog.cpp
- revisioncontrolobserver.cpp
- revisioncontrolplugin.cpp
selectiontoggle.cpp
selectionmanager.cpp
settings/additionalinfodialog.cpp
tooltips/ktooltipitem.cpp
tooltips/kformattedballoontipdelegate.cpp
tooltips/tooltipmanager.cpp
+ versioncontrolobserver.cpp
viewproperties.cpp
zoomlevelinfo.cpp
)
#include "dolphin_generalsettings.h"
#include "draganddrophelper.h"
#include "folderexpander.h"
-#include "revisioncontrolobserver.h"
#include "selectionmanager.h"
#include "tooltips/tooltipmanager.h"
+#include "versioncontrolobserver.h"
#include <kcolorscheme.h>
#include <kdirlister.h>
connect (folderExpander, SIGNAL(enterDir(const QModelIndex&)),
m_view->m_controller, SLOT(triggerItem(const QModelIndex&)));
- new RevisionControlObserver(this);
+ new VersionControlObserver(this);
}
DolphinColumnWidget::~DolphinColumnWidget()
popup->addSeparator();
}
- // insert revision control actions
+ // insert version control actions
addRevisionControlActions(popup);
// insert 'Copy To' and 'Move To' sub menus
void DolphinContextMenu::addRevisionControlActions(KMenu* menu)
{
const DolphinView* view = m_mainWindow->activeViewContainer()->view();
- const QList<QAction*> revControlActions = view->revisionControlActions(m_selectedItems);
- if (!revControlActions.isEmpty()) {
- foreach (QAction* action, revControlActions) {
+ const QList<QAction*> versionControlActions = view->versionControlActions(m_selectedItems);
+ if (!versionControlActions.isEmpty()) {
+ foreach (QAction* action, versionControlActions) {
menu->addAction(action);
}
menu->addSeparator();
// add checkbox items for each column
QHeaderView* headerView = header();
- for (int i = DolphinModel::Size; i <= DolphinModel::Revision; ++i) {
+ for (int i = DolphinModel::Size; i <= DolphinModel::Version; ++i) {
const int logicalIndex = headerView->logicalIndex(i);
const QString text = model()->headerData(i, Qt::Horizontal).toString();
QAction* action = popup.addAction(text);
void DolphinDetailsView::updateColumnVisibility()
{
const KFileItemDelegate::InformationList list = m_controller->dolphinView()->additionalInfo();
- for (int i = DolphinModel::Size; i <= DolphinModel::Revision; ++i) {
+ for (int i = DolphinModel::Size; i <= DolphinModel::Version; ++i) {
const KFileItemDelegate::Information info = infoForColumn(i);
const bool hide = !list.contains(info);
if (isColumnHidden(i) != hide) {
QHeaderView* headerView = header();
QFontMetrics fontMetrics(viewport()->font());
- int columnWidth[DolphinModel::Revision + 1];
+ int columnWidth[DolphinModel::Version + 1];
columnWidth[DolphinModel::Size] = fontMetrics.width("00000 Items");
columnWidth[DolphinModel::ModifiedTime] = fontMetrics.width("0000-00-00 00:00");
columnWidth[DolphinModel::Permissions] = fontMetrics.width("xxxxxxxxxx");
columnWidth[DolphinModel::Owner] = fontMetrics.width("xxxxxxxxxx");
columnWidth[DolphinModel::Group] = fontMetrics.width("xxxxxxxxxx");
columnWidth[DolphinModel::Type] = fontMetrics.width("XXXX Xxxxxxx");
- columnWidth[DolphinModel::Revision] = fontMetrics.width("xxxxxxxx");
+ columnWidth[DolphinModel::Version] = fontMetrics.width("xxxxxxxx");
int requiredWidth = 0;
for (int i = KDirModel::Size; i <= KDirModel::Type; ++i) {
KFileItemDelegate::paint(painter, option, index);
}
- if (dolphinModel->hasRevisionData() && isNameColumn) {
+ if (dolphinModel->hasVersionData() && isNameColumn) {
// The currently shown items are under revision control. Show the current revision
// state by adding an emblem.
const QModelIndex dirIndex = proxyModel->mapToSource(index);
- const QModelIndex revisionIndex = dolphinModel->index(dirIndex.row(), DolphinModel::Revision, dirIndex.parent());
+ const QModelIndex revisionIndex = dolphinModel->index(dirIndex.row(), DolphinModel::Version, dirIndex.parent());
const QVariant data = dolphinModel->data(revisionIndex, Qt::DecorationRole);
- const RevisionControlPlugin::RevisionState state = static_cast<RevisionControlPlugin::RevisionState>(data.toInt());
+ const KVersionControlPlugin::VersionState state = static_cast<KVersionControlPlugin::VersionState>(data.toInt());
- if (state != RevisionControlPlugin::UnversionedRevision) {
+ if (state != KVersionControlPlugin::UnversionedVersion) {
const QRect rect = iconRect(option, index);
const QPixmap emblem = emblemForState(state, rect.size());
painter->drawPixmap(rect.x(), rect.y() + rect.height() - emblem.height(), emblem);
}
}
-QPixmap DolphinFileItemDelegate::emblemForState(RevisionControlPlugin::RevisionState state, const QSize& size) const
+QPixmap DolphinFileItemDelegate::emblemForState(KVersionControlPlugin::VersionState state, const QSize& size) const
{
// TODO: all icons that are use here will be replaced by revision control emblems provided by the
// Oxygen team before KDE 4.4
- Q_ASSERT(state <= RevisionControlPlugin::ConflictingRevision);
+ Q_ASSERT(state <= KVersionControlPlugin::ConflictingVersion);
if ((m_cachedSize != size) || !m_cachedEmblems[state].isNull()) {
m_cachedSize = size;
}
const QSize emblemSize(emblemHeight, emblemHeight);
- for (int i = 0; i <= RevisionControlPlugin::ConflictingRevision; ++i) {
+ for (int i = 0; i <= KVersionControlPlugin::ConflictingVersion; ++i) {
QString iconName;
switch (state) {
- case RevisionControlPlugin::NormalRevision: iconName = "dialog-ok-apply"; break;
- case RevisionControlPlugin::UpdateRequiredRevision: iconName = "rating"; break;
- case RevisionControlPlugin::LocallyModifiedRevision: iconName = "emblem-important"; break;
- case RevisionControlPlugin::AddedRevision: iconName = "list-add"; break;
- case RevisionControlPlugin::ConflictingRevision: iconName = "application-exit"; break;
+ case KVersionControlPlugin::NormalVersion: iconName = "dialog-ok-apply"; break;
+ case KVersionControlPlugin::UpdateRequiredVersion: iconName = "rating"; break;
+ case KVersionControlPlugin::LocallyModifiedVersion: iconName = "emblem-important"; break;
+ case KVersionControlPlugin::AddedVersion: iconName = "list-add"; break;
+ case KVersionControlPlugin::ConflictingVersion: iconName = "application-exit"; break;
default: Q_ASSERT(false); break;
}
const DolphinModel* dolphinModel,
const QModelIndex& index);
- QPixmap emblemForState(RevisionControlPlugin::RevisionState state, const QSize& size) const;
+ QPixmap emblemForState(KVersionControlPlugin::VersionState state, const QSize& size) const;
private:
bool m_hasMinimizedNameColumn;
mutable QSize m_cachedSize;
- mutable QPixmap m_cachedEmblems[RevisionControlPlugin::ConflictingRevision + 1];
+ mutable QPixmap m_cachedEmblems[KVersionControlPlugin::ConflictingVersion + 1];
};
inline void DolphinFileItemDelegate::setMinimizedNameColumn(bool minimized)
DolphinModel::DolphinModel(QObject* parent) :
KDirModel(parent),
- m_hasRevisionData(false),
+ m_hasVersionData(false),
m_revisionHash()
{
}
bool DolphinModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
- if ((index.column() == DolphinModel::Revision) && (role == Qt::DecorationRole)) {
+ if ((index.column() == DolphinModel::Version) && (role == Qt::DecorationRole)) {
// TODO: remove data again when items are deleted...
const QPersistentModelIndex key = index;
- const RevisionControlPlugin::RevisionState state = static_cast<RevisionControlPlugin::RevisionState>(value.toInt());
- if (m_revisionHash.value(key, RevisionControlPlugin::UnversionedRevision) != state) {
- if (!m_hasRevisionData) {
+ const KVersionControlPlugin::VersionState state = static_cast<KVersionControlPlugin::VersionState>(value.toInt());
+ if (m_revisionHash.value(key, KVersionControlPlugin::UnversionedVersion) != state) {
+ if (!m_hasVersionData) {
connect(this, SIGNAL(rowsRemoved (const QModelIndex&, int, int)),
this, SLOT(slotRowsRemoved(const QModelIndex&, int, int)));
- m_hasRevisionData = true;
+ m_hasVersionData = true;
}
m_revisionHash.insert(key, state);
return sortRoleData(index);
case Qt::DecorationRole:
- if (index.column() == DolphinModel::Revision) {
- return m_revisionHash.value(index, RevisionControlPlugin::UnversionedRevision);
+ if (index.column() == DolphinModel::Version) {
+ return m_revisionHash.value(index, KVersionControlPlugin::UnversionedVersion);
}
break;
case Qt::DisplayRole:
- if (index.column() == DolphinModel::Revision) {
- switch (m_revisionHash.value(index, RevisionControlPlugin::UnversionedRevision)) {
- case RevisionControlPlugin::NormalRevision:
+ if (index.column() == DolphinModel::Version) {
+ switch (m_revisionHash.value(index, KVersionControlPlugin::UnversionedVersion)) {
+ case KVersionControlPlugin::NormalVersion:
return i18nc("@item::intable", "Normal");
- case RevisionControlPlugin::UpdateRequiredRevision:
+ case KVersionControlPlugin::UpdateRequiredVersion:
return i18nc("@item::intable", "Update required");
- case RevisionControlPlugin::LocallyModifiedRevision:
+ case KVersionControlPlugin::LocallyModifiedVersion:
return i18nc("@item::intable", "Locally modified");
- case RevisionControlPlugin::AddedRevision:
+ case KVersionControlPlugin::AddedVersion:
return i18nc("@item::intable", "Added");
- case RevisionControlPlugin::RemovedRevision:
+ case KVersionControlPlugin::RemovedVersion:
return i18nc("@item::intable", "Removed");
- case RevisionControlPlugin::ConflictingRevision:
+ case KVersionControlPlugin::ConflictingVersion:
return i18nc("@item::intable", "Conflicting");
- case RevisionControlPlugin::UnversionedRevision:
+ case KVersionControlPlugin::UnversionedVersion:
default:
return i18nc("@item::intable", "Unversioned");
}
return KDirModel::headerData(section, orientation, role);
}
- Q_ASSERT(section == DolphinModel::Revision);
- return i18nc("@title::column", "Revision");
+ Q_ASSERT(section == DolphinModel::Version);
+ return i18nc("@title::column", "Version");
}
return QVariant();
}
return KDirModel::columnCount(parent) + (ExtraColumnCount - ColumnCount);
}
-void DolphinModel::clearRevisionData()
+void DolphinModel::clearVersionData()
{
m_revisionHash.clear();
- m_hasRevisionData = false;
+ m_hasVersionData = false;
}
-bool DolphinModel::hasRevisionData() const
+bool DolphinModel::hasVersionData() const
{
- return m_hasRevisionData;
+ return m_hasVersionData;
}
void DolphinModel::slotRowsRemoved(const QModelIndex& parent, int start, int end)
{
- if (m_hasRevisionData) {
+ if (m_hasVersionData) {
const int column = parent.column();
for (int row = start; row <= end; ++row) {
m_revisionHash.remove(parent.child(row, column));
retString = item.mimeComment();
break;
- case DolphinModel::Revision:
+ case DolphinModel::Version:
retString = "test";
break;
}
#define DOLPHINMODEL_H
#include <kdirmodel.h>
-#include <revisioncontrolplugin.h>
+#include <kversioncontrolplugin.h>
#include <libdolphin_export.h>
#include <QHash>
public:
enum AdditionalColumns {
- Revision = KDirModel::ColumnCount,
+ Version = KDirModel::ColumnCount,
ExtraColumnCount
};
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
- void clearRevisionData();
- bool hasRevisionData() const;
+ void clearVersionData();
+ bool hasVersionData() const;
private slots:
void slotRowsRemoved(const QModelIndex& parent, int start, int end);
QVariant sortRoleData(const QModelIndex& index) const;
private:
- bool m_hasRevisionData;
- QHash<QPersistentModelIndex, RevisionControlPlugin::RevisionState> m_revisionHash;
+ bool m_hasVersionData;
+ QHash<QPersistentModelIndex, KVersionControlPlugin::VersionState> m_revisionHash;
static const char* m_others;
};
#include "draganddrophelper.h"
#include "folderexpander.h"
#include "renamedialog.h"
-#include "revisioncontrolobserver.h"
#include "tooltips/tooltipmanager.h"
#include "settings/dolphinsettings.h"
+#include "versioncontrolobserver.h"
#include "viewproperties.h"
#include "zoomlevelinfo.h"
m_proxyModel(proxyModel),
m_previewGenerator(0),
m_toolTipManager(0),
- m_revisionControlObserver(0),
+ m_versionControlObserver(0),
m_rootUrl(),
m_activeItemUrl(),
m_createdItemUrl(),
loadDirectory(url);
}
- // When changing the URL there is no need to keep the revision
+ // When changing the URL there is no need to keep the version
// data of the previous URL.
- m_dolphinModel->clearRevisionData();
+ m_dolphinModel->clearVersionData();
emit startedPathLoading(url);
}
return text;
}
-QList<QAction*> DolphinView::revisionControlActions(const KFileItemList& items) const
+QList<QAction*> DolphinView::versionControlActions(const KFileItemList& items) const
{
return items.isEmpty()
- ? m_revisionControlObserver->contextMenuActions(url().path(KUrl::AddTrailingSlash))
- : m_revisionControlObserver->contextMenuActions(items);
+ ? m_versionControlObserver->contextMenuActions(url().path(KUrl::AddTrailingSlash))
+ : m_versionControlObserver->contextMenuActions(items);
}
void DolphinView::setUrl(const KUrl& url)
m_previewGenerator = new KFilePreviewGenerator(view);
m_previewGenerator->setPreviewShown(m_showPreview);
- m_revisionControlObserver = new RevisionControlObserver(view);
- connect(m_revisionControlObserver, SIGNAL(infoMessage(const QString&)),
+ m_versionControlObserver = new VersionControlObserver(view);
+ connect(m_versionControlObserver, SIGNAL(infoMessage(const QString&)),
this, SIGNAL(infoMessage(const QString&)));
- connect(m_revisionControlObserver, SIGNAL(errorMessage(const QString&)),
+ connect(m_versionControlObserver, SIGNAL(errorMessage(const QString&)),
this, SIGNAL(errorMessage(const QString&)));
- connect(m_revisionControlObserver, SIGNAL(operationCompletedMessage(const QString&)),
+ connect(m_versionControlObserver, SIGNAL(operationCompletedMessage(const QString&)),
this, SIGNAL(operationCompletedMessage(const QString&)));
if (DolphinSettings::instance().generalSettings()->showToolTips()) {
class KActionCollection;
class KDirLister;
class KUrl;
-class RevisionControlObserver;
class ToolTipManager;
+class VersionControlObserver;
class ViewProperties;
/**
QString statusBarText() const;
/**
- * Returns the revision control actions that are provided for the items \p items.
+ * Returns the version control actions that are provided for the items \p items.
* Usually the actions are presented in the context menu.
*/
- QList<QAction*> revisionControlActions(const KFileItemList& items) const;
+ QList<QAction*> versionControlActions(const KFileItemList& items) const;
/**
* Updates the state of the 'Additional Information' actions in \a collection.
KFilePreviewGenerator* m_previewGenerator;
ToolTipManager* m_toolTipManager;
- RevisionControlObserver* m_revisionControlObserver;
+ VersionControlObserver* m_versionControlObserver;
KUrl m_rootUrl;
KUrl m_activeItemUrl;
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "revisioncontrolplugin.h"
+#include "kversioncontrolplugin.h"
-RevisionControlPlugin::RevisionControlPlugin()
+KVersionControlPlugin::KVersionControlPlugin()
{
}
-RevisionControlPlugin::~RevisionControlPlugin()
+KVersionControlPlugin::~KVersionControlPlugin()
{
}
-#include "revisioncontrolplugin.moc"
+#include "kversioncontrolplugin.moc"
// ----------------------------------------------------------------------------
#include <QTextStream>
SubversionPlugin::SubversionPlugin() :
- m_revisionInfoHash(),
- m_revisionInfoKeys(),
+ m_versionInfoHash(),
+ m_versionInfoKeys(),
m_updateAction(0),
m_showLocalChangesAction(0),
m_commitAction(0),
while (process.waitForReadyRead()) {
char buffer[1024];
while (process.readLine(buffer, sizeof(buffer)) > 0) {
- RevisionState state = NormalRevision;
+ VersionState state = NormalVersion;
QString filePath(buffer);
switch (buffer[0]) {
- case '?': state = UnversionedRevision; break;
- case 'M': state = LocallyModifiedRevision; break;
- case 'A': state = AddedRevision; break;
- case 'D': state = RemovedRevision; break;
- case 'C': state = ConflictingRevision; break;
+ case '?': state = UnversionedVersion; break;
+ case 'M': state = LocallyModifiedVersion; break;
+ case 'A': state = AddedVersion; break;
+ case 'D': state = RemovedVersion; break;
+ case 'C': state = ConflictingVersion; break;
default:
if (filePath.contains('*')) {
- state = UpdateRequiredRevision;
+ state = UpdateRequiredVersion;
}
break;
}
const int length = filePath.length() - pos - 1;
filePath = filePath.mid(pos, length);
if (!filePath.isEmpty()) {
- m_revisionInfoHash.insert(filePath, state);
+ m_versionInfoHash.insert(filePath, state);
}
}
}
- m_revisionInfoKeys = m_revisionInfoHash.keys();
+ m_versionInfoKeys = m_versionInfoHash.keys();
return true;
}
{
}
-RevisionControlPlugin::RevisionState SubversionPlugin::revisionState(const KFileItem& item)
+KVersionControlPlugin::VersionState SubversionPlugin::versionState(const KFileItem& item)
{
const QString itemUrl = item.localPath();
- if (m_revisionInfoHash.contains(itemUrl)) {
- return m_revisionInfoHash.value(itemUrl);
+ if (m_versionInfoHash.contains(itemUrl)) {
+ return m_versionInfoHash.value(itemUrl);
}
if (!item.isDir()) {
- // files that have not been listed by 'svn status' (= m_revisionInfoHash)
- // are under revision control per definition
- return NormalRevision;
+ // files that have not been listed by 'svn status' (= m_versionInfoHash)
+ // are under version control per definition
+ return NormalVersion;
}
- // The item is a directory. Check whether an item listed by 'svn status' (= m_revisionInfoHash)
+ // The item is a directory. Check whether an item listed by 'svn status' (= m_versionInfoHash)
// is part of this directory. In this case a local modification should be indicated in the
// directory already.
- foreach (const QString& key, m_revisionInfoKeys) {
+ foreach (const QString& key, m_versionInfoKeys) {
if (key.startsWith(itemUrl)) {
- const RevisionState state = m_revisionInfoHash.value(key);
- if (state == LocallyModifiedRevision) {
- return LocallyModifiedRevision;
+ const VersionState state = m_versionInfoHash.value(key);
+ if (state == LocallyModifiedVersion) {
+ return LocallyModifiedVersion;
}
}
}
- return NormalRevision;
+ return NormalVersion;
}
QList<QAction*> SubversionPlugin::contextMenuActions(const KFileItemList& items)
}
m_contextDir.clear();
- // iterate all items and check the revision state to know which
+ // iterate all items and check the version state to know which
// actions can be enabled
const int itemsCount = items.count();
- int revisionedCount = 0;
+ int versionedCount = 0;
int editingCount = 0;
foreach (const KFileItem& item, items) {
- const RevisionState state = revisionState(item);
- if (state != UnversionedRevision) {
- ++revisionedCount;
+ const VersionState state = versionState(item);
+ if (state != UnversionedVersion) {
+ ++versionedCount;
}
switch (state) {
- case LocallyModifiedRevision:
- case ConflictingRevision:
+ case LocallyModifiedVersion:
+ case ConflictingVersion:
++editingCount;
break;
default:
}
}
m_commitAction->setEnabled(editingCount > 0);
- m_addAction->setEnabled(revisionedCount == 0);
- m_removeAction->setEnabled(revisionedCount == itemsCount);
+ m_addAction->setEnabled(versionedCount == 0);
+ m_removeAction->setEnabled(versionedCount == itemsCount);
QList<QAction*> actions;
actions.append(m_updateAction);
// Write the commit description into a temporary file, so
// that it can be read by the command "svn commit -F". The temporary
// file must stay alive until slotOperationCompleted() is invoked and will
- // be destroyed when the revision plugin is destructed.
+ // be destroyed when the version plugin is destructed.
if (!m_tempFile.open()) {
emit errorMessage(i18nc("@info:status", "Commit of SVN changes failed."));
return;
{
if (m_contextItems.isEmpty()) {
emit operationCompletedMessage(m_operationCompletedMsg);
- emit revisionStatesChanged();
+ emit versionStatesChanged();
} else {
startSvnCommandProcess();
}
class QAction;
/**
- * @brief Base class for revision control plugins.
+ * @brief Base class for version control plugins.
*
- * Enables the file manager to show the revision state
- * of a revisioned file.
+ * Enables the file manager to show the version state
+ * of a versioned file.
*/
-class LIBDOLPHINPRIVATE_EXPORT RevisionControlPlugin : public QObject
+class LIBDOLPHINPRIVATE_EXPORT KVersionControlPlugin : public QObject
{
Q_OBJECT
public:
- enum RevisionState
+ enum VersionState
{
- /** The file is not under revision control. */
- UnversionedRevision,
+ /** The file is not under version control. */
+ UnversionedVersion,
/**
- * The file is under revision control and represents
+ * The file is under version control and represents
* the latest version.
*/
- NormalRevision,
+ NormalVersion,
/**
- * The file is under revision control and a newer
+ * The file is under version control and a newer
* version exists on the main branch.
*/
- UpdateRequiredRevision,
+ UpdateRequiredVersion,
/**
- * The file is under revision control and has been
+ * The file is under version control and has been
* modified locally.
*/
- LocallyModifiedRevision,
+ LocallyModifiedVersion,
/**
- * The file has not been under revision control but
+ * The file has not been under version control but
* has been marked to get added with the next commit.
*/
- AddedRevision,
+ AddedVersion,
/**
- * The file is under revision control but has been marked
+ * The file is under version control but has been marked
* for getting removed with the next commit.
*/
- RemovedRevision,
+ RemovedVersion,
/**
- * The file is under revision control and has been locally
+ * The file is under version control and has been locally
* modified. A modification has also been done on the main
* branch.
*/
- ConflictingRevision
+ ConflictingVersion
};
- RevisionControlPlugin();
- virtual ~RevisionControlPlugin();
+ KVersionControlPlugin();
+ virtual ~KVersionControlPlugin();
/**
* Returns the name of the file which stores
- * the revision control informations.
+ * the version control informations.
* (e. g. .svn, .cvs, .git).
*/
virtual QString fileName() const = 0;
/**
- * Is invoked whenever the revision control
+ * Is invoked whenever the version control
* information will get retrieved for the directory
* \p directory. It is assured that the directory
* contains a trailing slash.
virtual bool beginRetrieval(const QString& directory) = 0;
/**
- * Is invoked after the revision control information has been
+ * Is invoked after the version control information has been
* received. It is assured that
- * RevisionControlPlugin::beginInfoRetrieval() has been
+ * KVersionControlPlugin::beginInfoRetrieval() has been
* invoked before.
*/
virtual void endRetrieval() = 0;
/**
- * Returns the revision state for the file \p item.
- * It is assured that RevisionControlPlugin::beginInfoRetrieval() has been
+ * Returns the version state for the file \p item.
+ * It is assured that KVersionControlPlugin::beginInfoRetrieval() has been
* invoked before and that the file is part of the directory specified
* in beginInfoRetrieval().
*/
- virtual RevisionState revisionState(const KFileItem& item) = 0;
+ virtual VersionState versionState(const KFileItem& item) = 0;
/**
* Returns the list of actions that should be shown in the context menu
* for the files \p items. It is assured that the passed list is not empty.
- * If an action triggers a change of the revisions, the signal
- * RevisionControlPlugin::revisionStatesChanged() must be emitted.
+ * If an action triggers a change of the versions, the signal
+ * KVersionControlPlugin::versionStatesChanged() must be emitted.
*/
virtual QList<QAction*> contextMenuActions(const KFileItemList& items) = 0;
/**
* Returns the list of actions that should be shown in the context menu
- * for the directory \p directory. If an action triggers a change of the revisions,
- * the signal RevisionControlPlugin::revisionStatesChanged() must be emitted.
+ * for the directory \p directory. If an action triggers a change of the versions,
+ * the signal KVersionControlPlugin::versionStatesChanged() must be emitted.
*/
virtual QList<QAction*> contextMenuActions(const QString& directory) = 0;
signals:
/**
- * Should be emitted when the revision state of files might have been changed
+ * Should be emitted when the version state of files might have been changed
* after the last retrieval (e. g. by executing a context menu action
- * of the revision control plugin). The file manager will be triggered to
- * update the revision states of the directory \p directory by invoking
- * RevisionControlPlugin::beginRetrieval(),
- * RevisionControlPlugin::revisionState() and
- * RevisionControlPlugin::endRetrieval().
+ * of the version control plugin). The file manager will be triggered to
+ * update the version states of the directory \p directory by invoking
+ * KVersionControlPlugin::beginRetrieval(),
+ * KVersionControlPlugin::versionState() and
+ * KVersionControlPlugin::endRetrieval().
*/
- void revisionStatesChanged();
+ void versionStatesChanged();
/**
* Is emitted if an information message with the content \a msg
#include <QHash>
#include <QTemporaryFile>
-class LIBDOLPHINPRIVATE_EXPORT SubversionPlugin : public RevisionControlPlugin
+class LIBDOLPHINPRIVATE_EXPORT SubversionPlugin : public KVersionControlPlugin
{
Q_OBJECT
virtual QString fileName() const;
virtual bool beginRetrieval(const QString& directory);
virtual void endRetrieval();
- virtual RevisionControlPlugin::RevisionState revisionState(const KFileItem& item);
+ virtual KVersionControlPlugin::VersionState versionState(const KFileItem& item);
virtual QList<QAction*> contextMenuActions(const KFileItemList& items);
virtual QList<QAction*> contextMenuActions(const QString& directory);
void startSvnCommandProcess();
private:
- QHash<QString, RevisionState> m_revisionInfoHash;
- QList<QString> m_revisionInfoKeys; // cache for accessing the keys of the hash
+ QHash<QString, VersionState> m_versionInfoHash;
+ QList<QString> m_versionInfoKeys; // cache for accessing the keys of the hash
QAction* m_updateAction;
QAction* m_showLocalChangesAction;
hideColumn(DolphinModel::Owner);
hideColumn(DolphinModel::Group);
hideColumn(DolphinModel::Type);
- hideColumn(DolphinModel::Revision);
+ hideColumn(DolphinModel::Version);
header()->hide();
break;
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-#include "revisioncontrolobserver.h"
+#include "versioncontrolobserver.h"
#include "dolphinmodel.h"
-#include "revisioncontrolplugin.h"
+#include "kversioncontrolplugin.h"
#include <kdirlister.h>
#include <klocale.h>
#include <QTimer>
/**
- * The performance of updating the revision state of items depends
+ * The performance of updating the version state of items depends
* on the used plugin. To prevent that Dolphin gets blocked by a
* slow plugin, the updating is delegated to a thread.
*/
{
public:
UpdateItemStatesThread(QObject* parent, QMutex* pluginMutex);
- void setData(RevisionControlPlugin* plugin,
- const QList<RevisionControlObserver::ItemState>& itemStates);
- QList<RevisionControlObserver::ItemState> itemStates() const;
+ void setData(KVersionControlPlugin* plugin,
+ const QList<VersionControlObserver::ItemState>& itemStates);
+ QList<VersionControlObserver::ItemState> itemStates() const;
bool retrievedItems() const;
protected:
private:
bool m_retrievedItems;
- RevisionControlPlugin* m_plugin;
+ KVersionControlPlugin* m_plugin;
QMutex* m_pluginMutex;
- QList<RevisionControlObserver::ItemState> m_itemStates;
+ QList<VersionControlObserver::ItemState> m_itemStates;
};
UpdateItemStatesThread::UpdateItemStatesThread(QObject* parent, QMutex* pluginMutex) :
{
}
-void UpdateItemStatesThread::setData(RevisionControlPlugin* plugin,
- const QList<RevisionControlObserver::ItemState>& itemStates)
+void UpdateItemStatesThread::setData(KVersionControlPlugin* plugin,
+ const QList<VersionControlObserver::ItemState>& itemStates)
{
m_plugin = plugin;
m_itemStates = itemStates;
Q_ASSERT(!m_itemStates.isEmpty());
Q_ASSERT(m_plugin != 0);
- // The items from m_itemStates may be located in different directory levels. The revision
- // plugin requires the root directory for RevisionControlPlugin::beginRetrieval(). Instead
+ // The items from m_itemStates may be located in different directory levels. The version
+ // plugin requires the root directory for KVersionControlPlugin::beginRetrieval(). Instead
// of doing an expensive search, we utilize the knowledge of the implementation of
- // RevisionControlObserver::addDirectory() to be sure that the last item contains the root.
+ // VersionControlObserver::addDirectory() to be sure that the last item contains the root.
const QString directory = m_itemStates.last().item.url().directory(KUrl::AppendTrailingSlash);
QMutexLocker locker(m_pluginMutex);
if (m_plugin->beginRetrieval(directory)) {
const int count = m_itemStates.count();
for (int i = 0; i < count; ++i) {
- m_itemStates[i].revision = m_plugin->revisionState(m_itemStates[i].item);
+ m_itemStates[i].version = m_plugin->versionState(m_itemStates[i].item);
}
m_plugin->endRetrieval();
m_retrievedItems = true;
}
}
-QList<RevisionControlObserver::ItemState> UpdateItemStatesThread::itemStates() const
+QList<VersionControlObserver::ItemState> UpdateItemStatesThread::itemStates() const
{
return m_itemStates;
}
// ------------------------------------------------------------------------------------------------
-RevisionControlObserver::RevisionControlObserver(QAbstractItemView* view) :
+VersionControlObserver::VersionControlObserver(QAbstractItemView* view) :
QObject(view),
m_pendingItemStatesUpdate(false),
- m_revisionedDirectory(false),
+ m_versionedDirectory(false),
m_silentUpdate(false),
m_view(view),
m_dirLister(0),
}
}
-RevisionControlObserver::~RevisionControlObserver()
+VersionControlObserver::~VersionControlObserver()
{
if (m_updateItemStatesThread != 0) {
m_updateItemStatesThread->terminate();
m_plugin = 0;
}
-QList<QAction*> RevisionControlObserver::contextMenuActions(const KFileItemList& items) const
+QList<QAction*> VersionControlObserver::contextMenuActions(const KFileItemList& items) const
{
- if (m_dolphinModel->hasRevisionData() && (m_plugin != 0)) {
+ if (m_dolphinModel->hasVersionData() && (m_plugin != 0)) {
QMutexLocker locker(&m_pluginMutex);
return m_plugin->contextMenuActions(items);
}
return QList<QAction*>();
}
-QList<QAction*> RevisionControlObserver::contextMenuActions(const QString& directory) const
+QList<QAction*> VersionControlObserver::contextMenuActions(const QString& directory) const
{
- if (m_dolphinModel->hasRevisionData() && (m_plugin != 0)) {
+ if (m_dolphinModel->hasVersionData() && (m_plugin != 0)) {
QMutexLocker locker(&m_pluginMutex);
return m_plugin->contextMenuActions(directory);
}
return QList<QAction*>();
}
-void RevisionControlObserver::delayedDirectoryVerification()
+void VersionControlObserver::delayedDirectoryVerification()
{
m_silentUpdate = false;
m_dirVerificationTimer->start();
}
-void RevisionControlObserver::silentDirectoryVerification()
+void VersionControlObserver::silentDirectoryVerification()
{
m_silentUpdate = true;
m_dirVerificationTimer->start();
}
-void RevisionControlObserver::verifyDirectory()
+void VersionControlObserver::verifyDirectory()
{
- KUrl revisionControlUrl = m_dirLister->url();
- if (!revisionControlUrl.isLocalFile()) {
+ KUrl versionControlUrl = m_dirLister->url();
+ if (!versionControlUrl.isLocalFile()) {
return;
}
this, SIGNAL(operationCompletedMessage(const QString&)));
}
- revisionControlUrl.addPath(m_plugin->fileName());
- const KFileItem item = m_dirLister->findByUrl(revisionControlUrl);
+ versionControlUrl.addPath(m_plugin->fileName());
+ const KFileItem item = m_dirLister->findByUrl(versionControlUrl);
- bool foundRevisionInfo = !item.isNull();
- if (!foundRevisionInfo && m_revisionedDirectory) {
- // Revision control systems like Git provide the revision information
- // file only in the root directory. Check whether the revision information file can
+ bool foundVersionInfo = !item.isNull();
+ if (!foundVersionInfo && m_versionedDirectory) {
+ // Version control systems like Git provide the version information
+ // file only in the root directory. Check whether the version information file can
// be found in one of the parent directories.
// TODO...
}
- if (foundRevisionInfo) {
- if (!m_revisionedDirectory) {
- m_revisionedDirectory = true;
+ if (foundVersionInfo) {
+ if (!m_versionedDirectory) {
+ m_versionedDirectory = true;
// The directory is versioned. Assume that the user will further browse through
// versioned directories and decrease the verification timer.
this, SLOT(delayedDirectoryVerification()));
connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
this, SLOT(delayedDirectoryVerification()));
- connect(m_plugin, SIGNAL(revisionStatesChanged()),
+ connect(m_plugin, SIGNAL(versionStatesChanged()),
this, SLOT(silentDirectoryVerification()));
}
updateItemStates();
- } else if (m_revisionedDirectory) {
- m_revisionedDirectory = false;
+ } else if (m_versionedDirectory) {
+ m_versionedDirectory = false;
// The directory is not versioned. Reset the verification timer to a higher
// value, so that browsing through non-versioned directories is not slown down
this, SLOT(delayedDirectoryVerification()));
disconnect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
this, SLOT(delayedDirectoryVerification()));
- disconnect(m_plugin, SIGNAL(revisionStatesChanged()),
+ disconnect(m_plugin, SIGNAL(versionStatesChanged()),
this, SLOT(silentDirectoryVerification()));
}
}
-void RevisionControlObserver::applyUpdatedItemStates()
+void VersionControlObserver::applyUpdatedItemStates()
{
if (!m_updateItemStatesThread->retrievedItems()) {
// ignore m_silentUpdate for an error message
- emit errorMessage(i18nc("@info:status", "Update of revision information failed."));
+ emit errorMessage(i18nc("@info:status", "Update of version information failed."));
return;
}
const QList<ItemState> itemStates = m_updateItemStatesThread->itemStates();
foreach (const ItemState& itemState, itemStates) {
m_dolphinModel->setData(itemState.index,
- QVariant(static_cast<int>(itemState.revision)),
+ QVariant(static_cast<int>(itemState.version)),
Qt::DecorationRole);
}
}
}
-void RevisionControlObserver::updateItemStates()
+void VersionControlObserver::updateItemStates()
{
Q_ASSERT(m_plugin != 0);
if (m_updateItemStatesThread == 0) {
addDirectory(QModelIndex(), itemStates);
if (!itemStates.isEmpty()) {
if (!m_silentUpdate) {
- emit infoMessage(i18nc("@info:status", "Updating revision information..."));
+ emit infoMessage(i18nc("@info:status", "Updating version information..."));
}
m_updateItemStatesThread->setData(m_plugin, itemStates);
m_updateItemStatesThread->start(); // applyUpdatedItemStates() is called when finished
}
}
-void RevisionControlObserver::addDirectory(const QModelIndex& parentIndex, QList<ItemState>& itemStates)
+void VersionControlObserver::addDirectory(const QModelIndex& parentIndex, QList<ItemState>& itemStates)
{
const int rowCount = m_dolphinModel->rowCount(parentIndex);
for (int row = 0; row < rowCount; ++row) {
- const QModelIndex index = m_dolphinModel->index(row, DolphinModel::Revision, parentIndex);
+ const QModelIndex index = m_dolphinModel->index(row, DolphinModel::Version, parentIndex);
addDirectory(index, itemStates);
ItemState itemState;
itemState.index = index;
itemState.item = m_dolphinModel->itemForIndex(index);
- itemState.revision = RevisionControlPlugin::UnversionedRevision;
+ itemState.version = KVersionControlPlugin::UnversionedVersion;
itemStates.append(itemState);
}
}
-#include "revisioncontrolobserver.moc"
+#include "versioncontrolobserver.moc"
#include <libdolphin_export.h>
#include <kfileitem.h>
-#include <revisioncontrolplugin.h>
+#include <kversioncontrolplugin.h>
#include <QList>
#include <QMutex>
#include <QObject>
class UpdateItemStatesThread;
/**
- * @brief Observes all revision control plugins.
+ * @brief Observes all version control plugins.
*
* The item view gets updated automatically if the currently shown
- * directory is under revision control.
+ * directory is under version control.
*
- * @see RevisionControlPlugin
+ * @see VersionControlPlugin
*/
-class LIBDOLPHINPRIVATE_EXPORT RevisionControlObserver : public QObject
+class LIBDOLPHINPRIVATE_EXPORT VersionControlObserver : public QObject
{
Q_OBJECT
public:
- RevisionControlObserver(QAbstractItemView* view);
- virtual ~RevisionControlObserver();
+ VersionControlObserver(QAbstractItemView* view);
+ virtual ~VersionControlObserver();
QList<QAction*> contextMenuActions(const KFileItemList& items) const;
QList<QAction*> contextMenuActions(const QString& directory) const;
{
QPersistentModelIndex index;
KFileItem item;
- RevisionControlPlugin::RevisionState revision;
+ KVersionControlPlugin::VersionState version;
};
void updateItemStates();
private:
bool m_pendingItemStatesUpdate;
- bool m_revisionedDirectory;
+ bool m_versionedDirectory;
bool m_silentUpdate; // if true, no messages will be send during the update
- // of revision states
+ // of version states
QAbstractItemView* m_view;
KDirLister* m_dirLister;
QTimer* m_dirVerificationTimer;
mutable QMutex m_pluginMutex;
- RevisionControlPlugin* m_plugin;
+ KVersionControlPlugin* m_plugin;
UpdateItemStatesThread* m_updateItemStatesThread;
friend class UpdateItemStatesThread;