popup->addSeparator();
}
+ // insert revision control actions
+ DolphinView* view = m_mainWindow->activeViewContainer()->view();
+ const QList<QAction*> revControlActions = view->revisionControlActions(m_selectedItems);
+ if (revControlActions.count() > 0) {
+ foreach (QAction* action, revControlActions) {
+ popup->addAction(action);
+ }
+ popup->addSeparator();
+ }
+
// insert 'Copy To' and 'Move To' sub menus
if (DolphinSettings::instance().generalSettings()->showCopyMoveMenu()) {
m_copyToMenu.setItems(m_selectedItems);
m_proxyModel(proxyModel),
m_previewGenerator(0),
m_toolTipManager(0),
+ m_revisionControlObserver(0),
m_rootUrl(),
m_activeItemUrl(),
m_createdItemUrl(),
return text;
}
+QList<QAction*> DolphinView::revisionControlActions(const KFileItemList& items) const
+{
+ return m_revisionControlObserver->contextMenuActions(items);
+}
+
void DolphinView::setUrl(const KUrl& url)
{
m_newFileNames.clear();
m_previewGenerator = new KFilePreviewGenerator(view);
m_previewGenerator->setPreviewShown(m_showPreview);
- new RevisionControlObserver(view);
+ m_revisionControlObserver = new RevisionControlObserver(view);
if (DolphinSettings::instance().generalSettings()->showToolTips()) {
m_toolTipManager = new ToolTipManager(view, m_proxyModel);
class KDirLister;
class KUrl;
class KToggleAction;
+class RevisionControlObserver;
class ToolTipManager;
class QModelIndex;
class ViewProperties;
*/
QString statusBarText() const;
+ /**
+ * Returns the revision 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;
+
/**
* Updates the state of the 'Additional Information' actions in \a collection.
*/
KFilePreviewGenerator* m_previewGenerator;
ToolTipManager* m_toolTipManager;
+ RevisionControlObserver* m_revisionControlObserver;
+
KUrl m_rootUrl;
KUrl m_activeItemUrl;
KUrl m_createdItemUrl; // URL for a new item that got created by the "Create New..." menu
m_plugin = 0;
}
+QList<QAction*> RevisionControlObserver::contextMenuActions(const KFileItemList& items) const
+{
+ if (m_dolphinModel->hasRevisionData() && (m_plugin != 0)) {
+ return m_plugin->contextMenuActions(items);
+ }
+
+ return QList<QAction*>();
+}
+
void RevisionControlObserver::delayedDirectoryVerification()
{
m_dirVerificationTimer->start();
#include <kfileitem.h>
#include <revisioncontrolplugin.h>
+#include <QList>
#include <QObject>
#include <QPersistentModelIndex>
#include <QString>
class DolphinModel;
class KDirLister;
+class KFileItemList;
class QAbstractItemView;
+class QAction;
class QThread;
class QTimer;
class UpdateItemStatesThread;
RevisionControlObserver(QAbstractItemView* view);
virtual ~RevisionControlObserver();
+ QList<QAction*> contextMenuActions(const KFileItemList& items) const;
+
private slots:
void delayedDirectoryVerification();
void verifyDirectory();
#include "revisioncontrolplugin.h"
+#include <kaction.h>
+#include <kicon.h>
+#include <klocale.h>
#include <kfileitem.h>
#include <QDir>
#include <QString>
SubversionPlugin::SubversionPlugin() :
m_directory(),
- m_revisionInfoHash()
+ m_revisionInfoHash(),
+ m_updateAction(0),
+ m_commitAction(0),
+ m_addAction(0),
+ m_removeAction(0)
{
+ m_updateAction = new KAction(this);
+ m_updateAction->setIcon(KIcon("view-refresh"));
+ m_updateAction->setText(i18nc("@item:inmenu", "SVN Update"));
+
+ m_commitAction = new KAction(this);
+ m_commitAction->setText(i18nc("@item:inmenu", "SVN Commit..."));
+
+ m_addAction = new KAction(this);
+ m_addAction->setIcon(KIcon("list-add"));
+ m_addAction->setText(i18nc("@item:inmenu", "SVN Add"));
+
+ m_removeAction = new KAction(this);
+ m_removeAction->setIcon(KIcon("list-remove"));
+ m_removeAction->setText(i18nc("@item:inmenu", "SVN Delete"));
}
SubversionPlugin::~SubversionPlugin()
{
Q_UNUSED(items);
// TODO...
- return QList<QAction*>();
+ QList<QAction*> actions;
+ actions.append(m_updateAction);
+ actions.append(m_commitAction);
+ actions.append(m_addAction);
+ actions.append(m_removeAction);
+ return actions;
}
bool SubversionPlugin::equalRevisionContent(const QString& name) const
QString m_directory;
QHash<QString, RevisionInfo> m_revisionInfoHash;
+
+ QAction* m_updateAction;
+ QAction* m_commitAction;
+ QAction* m_addAction;
+ QAction* m_removeAction;
};
#endif // REVISIONCONTROLPLUGIN_H