From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/vcsmanager/Makefile.am | 19 ++++ parts/vcsmanager/README.dox | 55 ++++++++++++ parts/vcsmanager/kdevvcsmanager.desktop | 65 ++++++++++++++ parts/vcsmanager/vcsmanagerpart.cpp | 115 ++++++++++++++++++++++++ parts/vcsmanager/vcsmanagerpart.h | 57 ++++++++++++ parts/vcsmanager/vcsmanagerprojectconfig.cpp | 69 ++++++++++++++ parts/vcsmanager/vcsmanagerprojectconfig.h | 45 ++++++++++ parts/vcsmanager/vcsmanagerprojectconfigbase.ui | 58 ++++++++++++ 8 files changed, 483 insertions(+) create mode 100644 parts/vcsmanager/Makefile.am create mode 100644 parts/vcsmanager/README.dox create mode 100644 parts/vcsmanager/kdevvcsmanager.desktop create mode 100644 parts/vcsmanager/vcsmanagerpart.cpp create mode 100644 parts/vcsmanager/vcsmanagerpart.h create mode 100644 parts/vcsmanager/vcsmanagerprojectconfig.cpp create mode 100644 parts/vcsmanager/vcsmanagerprojectconfig.h create mode 100644 parts/vcsmanager/vcsmanagerprojectconfigbase.ui (limited to 'parts/vcsmanager') 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: +This is code, html links link text, +and images. + +\authors Jens Dagerbo +\authors 2nd author full name +... +\authors nth author full name + +\maintainer Jens Dagerbo +\maintainer 2nd maintainer full name +... +\maintainer nth maintainer full name + +\feature Describe the first feature +\feature Describe the second feature +... +\feature Describe the last feature + +\bug bugs in +YOUR_COMPONENT_NAME at Bugzilla database +\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 First frequenly asked question about your part ? Answer. +\faq Second frequenly asked question about your part ? Answer. +... +\faq Last frequenly asked question about your part ? 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 +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include "domutil.h" + +#include "vcsmanagerprojectconfig.h" + +typedef KDevGenericFactory 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 + +#include + +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 +#include + +#include +#include + +#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 +#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 @@ + +VCSManagerProjectConfigBase + + + VCSManagerProjectConfigBase + + + + 0 + 0 + 600 + 480 + + + + + + + + unnamed + + + + textLabel1 + + + Version control system to use for this project: + + + WordBreak|AlignVCenter + + + + + vcsCombo + + + + + spacer1 + + + Vertical + + + Expanding + + + + 31 + 131 + + + + + + + -- cgit v1.2.1