|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Revision control support in Dolphin/KonquerorHello,
I have added a revision control support into Dolphin/Konqueror that works with each view mode (the working version has not been committed yet, will be done on Monday). "Revision control support" in the scope of Dolphin means that the revision state of a file is indicated by an emblem above the icon and that context dependent revision control actions are provided in the context menu. For testing purposes I temporary implemented a Subversion plugin inside Dolphin (part of dolphin/src/revisioncontrolplugin.*), but for sure this plugin should be moved outside of Dolphin ASAP. I'd like to move this plugin into the kdesdk module, but before this I'd need to move the revision control base class from Dolphin into kdebase/apps/lib/konq as krevisioncontrolplugin.h/krevisioncontrolplugin.cpp (see attached patch). Are there any general concerns/suggestions regarding the interface or the method- and enum-names? Would it be OK if I commit this class this Monday? Whom must I ask to get the OK to create a directory "revisioncontrol" (suggestion) inside KDE/kdesdk? This directory would contain the files: subversionplugin.cpp subversionplugin.h subversionplugin.desktop and might get extended by other revision control plugins. Thanks! Peter [krevisioncontrol.diff] Index: krevisioncontrolplugin.h =================================================================== --- krevisioncontrolplugin.h (Revision 0) +++ krevisioncontrolplugin.h (Revision 0) @@ -0,0 +1,138 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz <peter.penz@...> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * + * Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef KREVISIONCONTROLPLUGIN_H +#define KREVISIONCONTROLPLUGIN_H + +#include <libkonq_export.h> + +#include <QList> +#include <QObject> + +class KFileItem; +class KFileItemList; +class QAction; + +/** + * @brief Base class for revision control plugins. + * + * Enables the file manager to show the revision state + * of a revisioned file. Actions can be + * provided that are added to the context menu. + */ +class LIBKONQ_EXPORT KRevisionControlPlugin : public QObject +{ + Q_OBJECT + +public: + enum RevisionState + { + /** The file is not under revision control. */ + UnversionedRevision, + /** + * The file is under revision control and represents + * the latest version. + */ + NormalRevision, + /** + * The file is under revision control and a newer + * version exists on the main branch. + */ + UpdateRequiredRevision, + /** + * The file is under revision control and has been + * modified locally. + */ + LocallyModifiedRevision, + /** + * The file has not been under revision control but + * has been marked to get added with the next commit. + */ + AddedRevision, + /** + * The file is under revision control and has been locally + * modified. A modification has also been done on the main + * branch. + */ + ConflictingRevision + }; + + KRevisionControlPlugin(); + virtual ~KRevisionControlPlugin(); + + /** + * Returns the name of the file which stores + * the revision control informations. + * (e. g. .svn, .cvs, .git). + */ + virtual QString fileName() const = 0; + + /** + * Is invoked whenever the revision 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 + * received. It is assured that + * RevisionControlPlugin::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 + * invoked before and that the file is part of the directory specified + * in beginInfoRetrieval(). + */ + virtual RevisionState revisionState(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. + */ + 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. + */ + virtual QList<QAction*> contextMenuActions(const QString& directory) = 0; + +signals: + /** + * Should be emitted when the revision state of files has been changed + * after the last retrieval. 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(). + */ + void revisionStatesChanged(const QString& directory); +}; + +#endif // KREVISIONCONTROLPLUGIN_H + Index: krevisioncontrolplugin.cpp =================================================================== --- krevisioncontrolplugin.cpp (Revision 0) +++ krevisioncontrolplugin.cpp (Revision 0) @@ -0,0 +1,30 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz <peter.penz@...> * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public * + * License along with this library; see the file COPYING.LIB. If not, * + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * + * Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include "krevisioncontrolplugin.h" + +KRevisionControlPlugin::KRevisionControlPlugin() +{ +} + +KRevisionControlPlugin::~KRevisionControlPlugin() +{ +} + +#include "krevisioncontrolplugin.moc" Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (Revision 999489) +++ CMakeLists.txt (Arbeitskopie) @@ -13,6 +13,7 @@ konq_popupmenuplugin.cpp # for KonqPopupMenu and its plugins konq_dndpopupmenuplugin.cpp # for KonqDndPopupMenu and its plugins knewmenu.cpp # used by dolphin, KonqPopupMenu, and konqueror (File menu; to be moved to dolphinpart) + krevisioncontrolplugin.cpp # used by dolphin and its revision control plugins konq_copytomenu.cpp # used by dolphin, KonqPopupMenu konq_operations.cpp # used by dolphin and konqueror konq_events.cpp @@ -54,6 +55,7 @@ konq_popupmenuplugin.h konq_dndpopupmenuplugin.h knewmenu.h + krevisioncontrolplugin.h konq_menuactions.h # konq_copytomenu.h - anyone needs it? konq_operations.h |
|
|
Re: Revision control support in Dolphin/KonquerorHi,
I've attached an updated patch for version control support in Dolphin/Konqueror. There is a related discussion ongoing on kdevelop-devel (see https://barney.cs.uni-potsdam.de/mailman/private/kdevelop-devel/2009- August/034635.html), but no matter where the version control plugins will get located and how much code is shared [1], the plugin interface must be moved outside of Dolphin first. If there are no objections, I'd commit the classes KVersionControlPlugin.h KVersionControlPlugin.cpp into kdebase/apps/lib/konq on Monday the 31th of September (more details are given in the old e-mail below). Best regards, Peter [1] currently it looks like KDE/kdevplatform/plugins might be a proper location On Saturday, 25. July 2009 22:47:49 Peter Penz wrote: > Hello, > > I have added a revision control support into Dolphin/Konqueror that works > with each view mode (the working version has not been committed yet, will > be done on Monday). "Revision control support" in the scope of Dolphin > means that the revision state of a file is indicated by an emblem above the > icon and that context dependent revision control actions are provided in > the context menu. > > For testing purposes I temporary implemented a Subversion plugin inside > Dolphin (part of dolphin/src/revisioncontrolplugin.*), but for sure this > plugin should be moved outside of Dolphin ASAP. > > I'd like to move this plugin into the kdesdk module, but before this I'd > need to move the revision control base class from Dolphin into > kdebase/apps/lib/konq as > krevisioncontrolplugin.h/krevisioncontrolplugin.cpp (see attached patch). > > Are there any general concerns/suggestions regarding the interface or the > method- and enum-names? Would it be OK if I commit this class this Monday? > > Whom must I ask to get the OK to create a directory "revisioncontrol" > (suggestion) inside KDE/kdesdk? This directory would contain the files: > subversionplugin.cpp > subversionplugin.h > subversionplugin.desktop > > and might get extended by other revision control plugins. > > Thanks! > Peter [kversioncontrol.diff] Index: kversioncontrolplugin.cpp =================================================================== --- kversioncontrolplugin.cpp (Revision 0) +++ kversioncontrolplugin.cpp (Revision 0) @@ -0,0 +1,30 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz <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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "kversioncontrolplugin.h" + +KVersionControlPlugin::KVersionControlPlugin() +{ +} + +KVersionControlPlugin::~KVersionControlPlugin() +{ +} + +#include "kversioncontrolplugin.moc" Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (Revision 1015504) +++ CMakeLists.txt (Arbeitskopie) @@ -20,6 +20,7 @@ konq_historyentry.cpp konq_historyloader.cpp konq_historyprovider.cpp + kversioncontrolplugin.cpp # used by dolphin and its version control plugins konq_popupmenuinformation.cpp # deprecated (functionality has moved to kdelibs) konq_menuactions.cpp # deprecated (functionality has moved to kdelibs) @@ -61,6 +62,7 @@ konq_events.h konqmimedata.h konq_fileitemcapabilities.h + kversioncontrolplugin.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel ) install( FILES konqpopupmenuplugin.desktop konqdndpopupmenuplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) Index: kversioncontrolplugin.h =================================================================== --- kversioncontrolplugin.h (Revision 0) +++ kversioncontrolplugin.h (Revision 0) @@ -0,0 +1,162 @@ +/*************************************************************************** + * Copyright (C) 2009 by Peter Penz <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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef KVERSIONCONTROLPLUGIN_H +#define KVERSIONCONTROLPLUGIN_H + +#include <libkonq_export.h> + +#include <QDateTime> +#include <QString> +#include <QObject> + +class KFileItem; +class KFileItemList; +class QAction; + +/** + * @brief Base class for version control plugins. + * + * Enables the file manager to show the version state + * of a versioned file. + */ +class LIBKONQ_EXPORT KVersionControlPlugin : public QObject +{ + Q_OBJECT + +public: + enum VersionState + { + /** The file is not under version control. */ + UnversionedVersion, + /** + * The file is under version control and represents + * the latest version. + */ + NormalVersion, + /** + * The file is under version control and a newer + * version exists on the main branch. + */ + UpdateRequiredVersion, + /** + * The file is under version control and has been + * modified locally. + */ + LocallyModifiedVersion, + /** + * The file has not been under version control but + * has been marked to get added with the next commit. + */ + AddedVersion, + /** + * The file is under version control but has been marked + * for getting removed with the next commit. + */ + RemovedVersion, + /** + * The file is under version control and has been locally + * modified. A modification has also been done on the main + * branch. + */ + ConflictingVersion + }; + + KVersionControlPlugin(); + virtual ~KVersionControlPlugin(); + + /** + * Returns the name of the file which stores + * the version control informations. + * (e. g. .svn, .cvs, .git). + */ + virtual QString fileName() const = 0; + + /** + * 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 version control information has been + * received. It is assured that + * KVersionControlPlugin::beginInfoRetrieval() has been + * invoked before. + */ + virtual void endRetrieval() = 0; + + /** + * 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 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 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 versions, + * the signal KVersionControlPlugin::versionStatesChanged() must be emitted. + */ + virtual QList<QAction*> contextMenuActions(const QString& directory) = 0; + +signals: + /** + * 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 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 versionStatesChanged(); + + /** + * Is emitted if an information message with the content \a msg + * should be shown. + */ + void infoMessage(const QString& msg); + + /** + * Is emitted if an error message with the content \a msg + * should be shown. + */ + void errorMessage(const QString& msg); + + /** + * Is emitted if an "operation completed" message with the content \a msg + * should be shown. + */ + void operationCompletedMessage(const QString& msg); +}; + +#endif // KVERSIONCONTROLPLUGIN_H + |
| Free embeddable forum powered by Nabble | Forum Help |