diff options
Diffstat (limited to 'parts/vcsmanager')
-rw-r--r-- | parts/vcsmanager/Makefile.am | 19 | ||||
-rw-r--r-- | parts/vcsmanager/README.dox | 55 | ||||
-rw-r--r-- | parts/vcsmanager/kdevvcsmanager.desktop | 65 | ||||
-rw-r--r-- | parts/vcsmanager/vcsmanagerpart.cpp | 115 | ||||
-rw-r--r-- | parts/vcsmanager/vcsmanagerpart.h | 57 | ||||
-rw-r--r-- | parts/vcsmanager/vcsmanagerprojectconfig.cpp | 69 | ||||
-rw-r--r-- | parts/vcsmanager/vcsmanagerprojectconfig.h | 45 | ||||
-rw-r--r-- | parts/vcsmanager/vcsmanagerprojectconfigbase.ui | 58 |
8 files changed, 483 insertions, 0 deletions
diff --git a/parts/vcsmanager/Makefile.am b/parts/vcsmanager/Makefile.am new file mode 100644 index 00000000..c3d19403 --- /dev/null +++ b/parts/vcsmanager/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdevvcsmanager.la +libkdevvcsmanager_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevvcsmanager_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdevvcsmanager_la_SOURCES = vcsmanagerpart.cpp \ + vcsmanagerprojectconfigbase.ui vcsmanagerprojectconfig.cpp + +METASOURCES = AUTO + +appsharedir = $(kde_datadir)/kdevvcsmanager +appshare_DATA = + +servicedir = $(kde_servicesdir) +service_DATA = kdevvcsmanager.desktop + +rcdir = $(kde_datadir)/kdevvcsmanager + diff --git a/parts/vcsmanager/README.dox b/parts/vcsmanager/README.dox new file mode 100644 index 00000000..1e6c6327 --- /dev/null +++ b/parts/vcsmanager/README.dox @@ -0,0 +1,55 @@ +/** \class VCSManager +Put a brief description here, the brief description ends at the first dot. +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +<code>This is code</code>, html links <a href="http://somelocation">link text</a>, +and images. + +\authors <a href="mailto:jens.dagerbo@swipnet.se">Jens Dagerbo</a> +\authors <a href="mailto:2nd author AT provider.com">2nd author full name</a> +... +\authors <a href="mailto:nth author AT provider.com">nth author full name</a> + +\maintainer <a href="mailto:jens.dagerbo@swipnet.se">Jens Dagerbo</a> +\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a> +... +\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a> + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=YOUR_COMPONENT_NAME& +bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number"> +YOUR_COMPONENT_NAME at Bugzilla database</a> +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq <b>First frequenly asked question about your part ?</b> Answer. +\faq <b>Second frequenly asked question about your part ?</b> Answer. +... +\faq <b>Last frequenly asked question about your part ?</b> Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/parts/vcsmanager/kdevvcsmanager.desktop b/parts/vcsmanager/kdevvcsmanager.desktop new file mode 100644 index 00000000..ca647ba3 --- /dev/null +++ b/parts/vcsmanager/kdevvcsmanager.desktop @@ -0,0 +1,65 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Name=KDevVCSManager +Name[da]=KDevelop VCS-håndtering +Name[nds]=KDevelop-VKS-Pleger +Name[sk]=KDev VCS manažér +Name[sv]=KDevelop VCS-hantering +Name[tg]=РоҳбариKDevVCS +Name[zh_TW]=KDevelop VCS 管理器 +GenericName=VCSManager +GenericName[da]=VCS-håndtering +GenericName[fa]=مدیر VCS +GenericName[nds]=VKS-Pleger +GenericName[ru]=Управление системами контроля версий +GenericName[sk]=VCS manažér +GenericName[sl]=Upravitelj VCS +GenericName[sr]=VCS менаџер +GenericName[sr@Latn]=VCS menadžer +GenericName[sv]=VCS-hantering +GenericName[tg]=РоҳбариVCS +GenericName[zh_TW]=VCS 管理員 +Comment=Version Control System Manager +Comment[ca]=Gestor per al sistema de control de versions +Comment[da]=Versionskontrolsystem-håndtering +Comment[de]=Verwaltung für VCS +Comment[el]=Διαχειριστής συστήματος ελέγχου εκδόσεων +Comment[es]=Administrador de sistemas de control de versiones +Comment[et]=Versioonikontrollisüsteemi haldur +Comment[eu]=Version Control System (VCS) kudeatzailea +Comment[fa]=مدیر سیستم کنترل نسخه +Comment[fr]=Gestionnaire du système de contrôle de versions +Comment[gl]=Xestor do Sistema de control de versións +Comment[hu]=Kezelőfelület verziókövető rendszerekhez +Comment[it]=Gestore Sistema Controllo Versione +Comment[ms]=Pengurus Sistem Kawalan Versi +Comment[nds]=VKS-Pleger +Comment[ne]=संस्करण नियन्त्रण प्रणाली प्रबन्धक +Comment[nl]=Versie Controle Systeem-beheerder +Comment[pl]=Menedżer Systemu kontroli wersji +Comment[pt]=Gestor de Sistema de Controlo de Versão +Comment[pt_BR]=Gerenciador do Sistema de Controle de Versão +Comment[ru]=Управление системами контроля версий +Comment[sk]=Manažér systému riadenia verzií +Comment[sl]=Upravitelj sistema za nadzor različic +Comment[sr]=Менаџер система контроле верзија +Comment[sr@Latn]=Menadžer sistema kontrole verzija +Comment[sv]=Hantering av versionskontrollsystem +Comment[tr]=Sürüm Kontrol Sistemi Yöneticisi +Comment[zh_CN]=版本控制系统管理器 +Comment[zh_TW]=版本控制系統管理員 +Icon=kdevelop +ServiceTypes=KDevelop/Plugin + +X-KDevelop-Plugin-Version=1 +X-KDevelop-Plugin-Homepage= +X-KDevelop-Plugin-BugsEmailAddress=jens.dagerbo@swipnet.se +X-KDevelop-Plugin-Copyright=(C) by Jens Dagerbo + +X-KDevelop-Args= + +X-KDevelop-Scope=Core +X-KDE-Library=libkdevvcsmanager +X-KDevelop-Version=5 +X-KDevelop-Properties=VCS diff --git a/parts/vcsmanager/vcsmanagerpart.cpp b/parts/vcsmanager/vcsmanagerpart.cpp new file mode 100644 index 00000000..1cafb8eb --- /dev/null +++ b/parts/vcsmanager/vcsmanagerpart.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** + * Copyright (C) 2005 by Jens Dagerbo * + * jens.dagerbo@swipnet.se * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "vcsmanagerpart.h" + +#include <qtimer.h> +#include <qpopupmenu.h> +#include <qwhatsthis.h> + +#include <klocale.h> +#include <kaction.h> +#include <kdialogbase.h> +#include <kiconloader.h> +#include <kmessagebox.h> +#include <kdevplugininfo.h> +#include <kdevgenericfactory.h> +#include <kdebug.h> + +#include <kdevcore.h> +#include <kdevmainwindow.h> +#include <configwidgetproxy.h> +#include <kdevplugincontroller.h> +#include "domutil.h" + +#include "vcsmanagerprojectconfig.h" + +typedef KDevGenericFactory<VCSManagerPart> VCSManagerFactory; +KDevPluginInfo data("kdevvcsmanager"); +K_EXPORT_COMPONENT_FACTORY( libkdevvcsmanager, VCSManagerFactory( data ) ) + +#define GLOBALDOC_OPTIONS 1 +#define PROJECTDOC_OPTIONS 2 + +VCSManagerPart::VCSManagerPart(QObject *parent, const char *name, const QStringList &/*args*/) + : KDevPlugin(&data, parent, name ? name : "VCSManagerPart") +{ + kdDebug() << " ********** VCSManagerPart::VCSManagerPart() ************** " << endl; + + setInstance(VCSManagerFactory::instance()); +// setXMLFile("kdevvcsmanager.rc"); + + m_configProxy = new ConfigWidgetProxy(core()); + m_configProxy->createProjectConfigPage(i18n("Version Control"), PROJECTDOC_OPTIONS, info()->icon()); + connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), + this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int))); + + connect(core(), SIGNAL(projectOpened()), this, SLOT(projectOpened())); +} + +VCSManagerPart::~VCSManagerPart() +{ + delete m_configProxy; +} + +void VCSManagerPart::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo) +{ + switch (pageNo) + { + case PROJECTDOC_OPTIONS: + { + VCSManagerProjectConfig *w = new VCSManagerProjectConfig(this, page, "project config"); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + break; + } + } +} + +void VCSManagerPart::projectOpened() +{ + loadVCSPlugin(); +} + +void VCSManagerPart::loadVCSPlugin() +{ + unloadVCSPlugin(); + + QDomDocument & dom = *projectDom(); + m_vcsPluginName = DomUtil::readEntry( dom, "/general/versioncontrol" ).stripWhiteSpace(); + if ( m_vcsPluginName.isEmpty() ) return; + + QString constraint = QString( "DesktopEntryName=='%1'" ).arg( m_vcsPluginName ); + pluginController()->loadPlugin( "KDevelop/VersionControl", constraint ); +} + +void VCSManagerPart::unloadVCSPlugin() +{ + if ( !m_vcsPluginName.isEmpty() ) + { + pluginController()->unloadPlugin( m_vcsPluginName ); + } +} + +QString VCSManagerPart::vcsPlugin() +{ + return m_vcsPluginName; +} + +#include "vcsmanagerpart.moc" diff --git a/parts/vcsmanager/vcsmanagerpart.h b/parts/vcsmanager/vcsmanagerpart.h new file mode 100644 index 00000000..631373da --- /dev/null +++ b/parts/vcsmanager/vcsmanagerpart.h @@ -0,0 +1,57 @@ +/*************************************************************************** +* Copyright (C) 2005 by Jens Dagerbo * +* jens.dagerbo@swipnet.se * +* * +* 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., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ + +#ifndef KDEVVCSMANAGER_H +#define KDEVVCSMANAGER_H + +#include <kdevplugin.h> + +#include <qguardedptr.h> + +class QPopupMenu; +class KAction; +class KDialogBase; +class Context; +class ConfigWidgetProxy; +class VCSManagerWidget; + +/** +Please read the README.dox file for more info about this part +*/ +class VCSManagerPart: public KDevPlugin +{ + Q_OBJECT +public: + VCSManagerPart(QObject *parent, const char *name, const QStringList &args); + ~VCSManagerPart(); + QString vcsPlugin(); + void loadVCSPlugin(); + void unloadVCSPlugin(); + +private slots: + void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo); + void projectOpened(); + +private: + QString m_vcsPluginName; + ConfigWidgetProxy *m_configProxy; +}; + +#endif diff --git a/parts/vcsmanager/vcsmanagerprojectconfig.cpp b/parts/vcsmanager/vcsmanagerprojectconfig.cpp new file mode 100644 index 00000000..07986a88 --- /dev/null +++ b/parts/vcsmanager/vcsmanagerprojectconfig.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2005 by Jens Dagerbo * + * jens.dagerbo@swipnet.se * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include <qcombobox.h> +#include <qstring.h> + +#include <ktrader.h> +#include <klocale.h> + +#include "domutil.h" + +#include "vcsmanagerprojectconfig.h" +#include "vcsmanagerpart.h" + +VCSManagerProjectConfig::VCSManagerProjectConfig( VCSManagerPart *part, QWidget *parent, const char *name ) + : VCSManagerProjectConfigBase( parent, name ), m_part( part ) +{ + setup(); +} + +void VCSManagerProjectConfig::accept() +{ + QString vcsPluginName = *m_vcsPluginNames.at( vcsCombo->currentItem() ); + + QDomDocument & dom = *m_part->projectDom(); + DomUtil::writeEntry( dom, "/general/versioncontrol", vcsPluginName ); + + m_part->loadVCSPlugin(); +} + +void VCSManagerProjectConfig::setup( ) +{ + vcsCombo->insertItem( i18n("No Version Control System", "None"), 0 ); + m_vcsPluginNames << ""; + + int current = 0; + + QString constraint = QString("[X-KDevelop-Version] == %1").arg(KDEVELOP_PLUGIN_VERSION); + KTrader::OfferList offers = KTrader::self()->query("KDevelop/VersionControl", constraint ); + KTrader::OfferList::const_iterator it = offers.begin(); + for ( int i = 1; it != offers.end(); ++it, ++i ) + { + vcsCombo->insertItem( (*it)->genericName(), i ); + m_vcsPluginNames << (*it)->desktopEntryName(); + if ( (*it)->desktopEntryName() == m_part->vcsPlugin() ) + { + current = i; + } + } + vcsCombo->setCurrentItem( current ); +} + +#include "vcsmanagerprojectconfig.moc" diff --git a/parts/vcsmanager/vcsmanagerprojectconfig.h b/parts/vcsmanager/vcsmanagerprojectconfig.h new file mode 100644 index 00000000..b1558008 --- /dev/null +++ b/parts/vcsmanager/vcsmanagerprojectconfig.h @@ -0,0 +1,45 @@ +/*************************************************************************** +* Copyright (C) 2005 by Jens Dagerbo * +* jens.dagerbo@swipnet.se * +* * +* 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., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ + +#ifndef VCSMANAGER_PROJECT_CONFIG_H +#define VCSMANAGER_PROJECT_CONFIG_H + +#include <ktrader.h> +#include "vcsmanagerprojectconfigbase.h" + +class VCSManagerPart; + +class VCSManagerProjectConfig: public VCSManagerProjectConfigBase +{ + Q_OBJECT +public: + VCSManagerProjectConfig( VCSManagerPart *part, QWidget *parent = 0, const char *name = 0); + +public slots: + void accept(); + +private: + void setup(); + + VCSManagerPart * m_part; + QStringList m_vcsPluginNames; +}; + +#endif diff --git a/parts/vcsmanager/vcsmanagerprojectconfigbase.ui b/parts/vcsmanager/vcsmanagerprojectconfigbase.ui new file mode 100644 index 00000000..735a018f --- /dev/null +++ b/parts/vcsmanager/vcsmanagerprojectconfigbase.ui @@ -0,0 +1,58 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>VCSManagerProjectConfigBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>VCSManagerProjectConfigBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <property name="caption"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Version control system to use for this project:</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>vcsCombo</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>131</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> |