summaryrefslogtreecommitdiffstats
path: root/vcs/perforce
diff options
context:
space:
mode:
Diffstat (limited to 'vcs/perforce')
-rw-r--r--vcs/perforce/Makefile.am19
-rw-r--r--vcs/perforce/README3
-rw-r--r--vcs/perforce/README.dox15
-rw-r--r--vcs/perforce/commitdlg.cpp161
-rw-r--r--vcs/perforce/commitdlg.h57
-rw-r--r--vcs/perforce/integrator/Makefile.am13
-rw-r--r--vcs/perforce/integrator/kdevperforceintegrator.desktop44
-rw-r--r--vcs/perforce/integrator/perforceintegrator.cpp54
-rw-r--r--vcs/perforce/integrator/perforceintegrator.h39
-rw-r--r--vcs/perforce/integrator/pfintegratordlg.cpp40
-rw-r--r--vcs/perforce/integrator/pfintegratordlg.h36
-rw-r--r--vcs/perforce/integrator/pfintegratordlgbase.ui47
-rw-r--r--vcs/perforce/kdevperforce.desktop82
-rw-r--r--vcs/perforce/kdevperforcepart.rc23
-rw-r--r--vcs/perforce/perforcepart.cpp364
-rw-r--r--vcs/perforce/perforcepart.h79
16 files changed, 1076 insertions, 0 deletions
diff --git a/vcs/perforce/Makefile.am b/vcs/perforce/Makefile.am
new file mode 100644
index 00000000..e684e2f0
--- /dev/null
+++ b/vcs/perforce/Makefile.am
@@ -0,0 +1,19 @@
+# Here resides the cvs part
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevperforce.la
+libkdevperforce_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevperforce_la_LIBADD = $(top_builddir)/lib/libkdevelop.la $(top_builddir)/lib/interfaces/extensions/libkdevextensions.la
+
+libkdevperforce_la_SOURCES = perforcepart.cpp commitdlg.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevperforce.desktop
+
+rcdir = $(kde_datadir)/kdevperforce
+
+SUBDIRS = integrator
diff --git a/vcs/perforce/README b/vcs/perforce/README
new file mode 100644
index 00000000..731741e1
--- /dev/null
+++ b/vcs/perforce/README
@@ -0,0 +1,3 @@
+Please read the on-line, automaticaly updated KDevelop API documentation at:
+http://www.kdevelop.org
+or read the README.dox file.
diff --git a/vcs/perforce/README.dox b/vcs/perforce/README.dox
new file mode 100644
index 00000000..6a0ae647
--- /dev/null
+++ b/vcs/perforce/README.dox
@@ -0,0 +1,15 @@
+/** \class PerforcePart
+Integrates the perforce version managment system into KDevelop.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a> Copyright (C) 1999-2001
+\authors <a href="mailto:harry AT kdevelop.org">Harald Fernengel</a> Copyright (C) 2002-2003
+
+\maintainer <a href="mailto:harry AT kdevelop.org">Harald Fernengel</a>
+
+\feature edit, revert and submit
+\feature use the diff frontend (also removes the crappy perforce diff headers)
+\feature Uses KAction, so you can assign your favourite shortcuts to the commands.
+
+\requirement Perforce 2003.1 http://www.perforce.com/perforce/products.html
+
+*/
diff --git a/vcs/perforce/commitdlg.cpp b/vcs/perforce/commitdlg.cpp
new file mode 100644
index 00000000..8a9be561
--- /dev/null
+++ b/vcs/perforce/commitdlg.cpp
@@ -0,0 +1,161 @@
+/***************************************************************************
+ * Copyright (C) 1999, 2000 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Modified for perforce 2002 by Harald Fernengel <harry@kdevelop.org> *
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "commitdlg.h"
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qtextedit.h>
+#include <qpushbutton.h>
+#include <qregexp.h>
+#include <kprocess.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+
+#include <stdlib.h>
+
+#include "execcommand.h"
+
+CommitDialog::CommitDialog( QWidget *parent, const char *name )
+ : KDialogBase( parent, name, true, i18n("Perforce Submit"), Ok|Cancel|Details )
+{
+ QWidget *w = new QWidget( this, "main widget" );
+ setMainWidget( w );
+
+ edit = new QTextEdit( w );
+ QFontMetrics fm(edit->fontMetrics());
+ edit->setMinimumSize(fm.width("0")*40, fm.lineSpacing()*3);
+
+ QVBoxLayout *layout = new QVBoxLayout( w, 0, spacingHint() );
+ QLabel *editLabel = new QLabel(i18n("&Enter description:"), w);
+ editLabel->setBuddy(edit);
+ layout->addWidget(editLabel);
+ layout->addWidget(edit);
+
+ w = new QWidget( this, "details widget" );
+
+ clientEdit = new KLineEdit( w );
+ userEdit = new KLineEdit( w );
+ filesBox = new KListBox( w );
+
+ layout = new QVBoxLayout( w, 0, spacingHint() );
+ QLabel *clientLabel = new QLabel(i18n("C&lient:"), w);
+ clientLabel->setBuddy(clientEdit);
+ layout->addWidget(clientLabel);
+ layout->addWidget( clientEdit );
+ QLabel *userLabel = new QLabel(i18n("&User:"), w);
+ userLabel->setBuddy(userEdit);
+ layout->addWidget( userLabel );
+ layout->addWidget( userEdit );
+ QLabel *filesLabel = new QLabel(i18n("&File(s):"), w);
+ filesLabel->setBuddy(filesBox);
+ layout->addWidget( filesLabel );
+ layout->addWidget( filesBox );
+
+ setDetailsWidget( w );
+ autoGuess();
+ edit->setFocus();
+}
+
+CommitDialog::~CommitDialog()
+{
+}
+
+void CommitDialog::autoGuess()
+{
+ char *cenv;
+
+ cenv = getenv( "P4USER" );
+ if ( cenv ) {
+ setUser( QString::fromLocal8Bit( cenv ) );
+ }
+
+ cenv = getenv( "P4CLIENT" );
+ if ( cenv ) {
+ setClient( QString::fromLocal8Bit( cenv ) );
+ }
+}
+
+void CommitDialog::setFiles( const QStringList& lst )
+{
+ filesBox->clear();
+ setDepotFiles( lst );
+}
+
+void CommitDialog::setDepotFiles( const QStringList& lst )
+{
+ QStringList args;
+
+ args << "files";
+ for ( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
+ args << (*it);
+ }
+
+ ExecCommand* cmd = new ExecCommand( "p4", args, QString::null, QStringList(), this );
+ connect( cmd, SIGNAL(finished( const QString&, const QString& )),
+ this, SLOT(getFilesFinished( const QString&, const QString& )) );
+}
+
+void CommitDialog::getFilesFinished( const QString& out, const QString& /* err */ )
+{
+ QStringList lst = QStringList::split( QChar('\n'), out );
+ for ( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
+ int pos = (*it).find( QChar('#') );
+ if ( pos > 1 && (*it).startsWith( "//" ) ) {
+ filesBox->insertItem( (*it).left( pos ) );
+ }
+ }
+}
+
+QString CommitDialog::changeList() const
+{
+ QString lst;
+
+ lst += "Change: new\n"
+ "Client: " + client() + "\n"
+ "User: " + user() + "\n"
+ "Status: new\n"
+ "Description:\n ";
+
+ lst += logMessage().replace(QRegExp("\n"), "\n ") + "\n\n";
+
+ lst += "Files:\n";
+
+ for ( uint i = 0; i < filesBox->count(); ++i ) {
+ lst += " " + filesBox->text( i ) + "\n";
+ }
+
+ return lst;
+}
+
+void CommitDialog::accept()
+{
+ if ( client().isEmpty() ) {
+ setDetails( true );
+ KMessageBox::error( this, i18n("Please enter the P4 client name.") );
+ clientEdit->setFocus();
+ } else if ( user().isEmpty() ) {
+ setDetails( true );
+ KMessageBox::error( this, i18n("Please enter the P4 user.") );
+ userEdit->setFocus();
+ } else if ( filesBox->count() == 0 ) {
+ setDetails( true );
+ KMessageBox::error( this, i18n("The changelist does not contain any files.") );
+ } else {
+ KDialogBase::accept();
+ }
+}
+
+#include "commitdlg.moc"
diff --git a/vcs/perforce/commitdlg.h b/vcs/perforce/commitdlg.h
new file mode 100644
index 00000000..390681fd
--- /dev/null
+++ b/vcs/perforce/commitdlg.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * Copyright (C) 1999, 2000 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Modified for perforce 2002 by Harald Fernengel <harry@kdevelop.org> *
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef _COMMITDIALOG_H_
+#define _COMMITDIALOG_H_
+
+#include <qstringlist.h>
+#include <qtextedit.h>
+#include <klineedit.h>
+#include <klistbox.h>
+#include <kdialogbase.h>
+
+class KProcess;
+
+class CommitDialog : public KDialogBase
+{
+ Q_OBJECT
+public:
+ CommitDialog( QWidget *parent = 0, const char *name = 0 );
+ ~CommitDialog();
+
+ QString logMessage() const { return edit->text(); }
+ QString user() const { return userEdit->text(); }
+ QString client() const { return clientEdit->text(); }
+ QString changeList() const;
+
+ void setUser( const QString& usr ) { userEdit->setText( usr ); }
+ void setClient( const QString& clnt ) { clientEdit->setText( clnt ); }
+ void setFiles( const QStringList& lst );
+
+ /** tries to fill out user and client */
+ void autoGuess();
+
+protected slots:
+ void accept();
+
+private slots:
+ void getFilesFinished( const QString& out, const QString& err );
+
+private:
+ void setDepotFiles( const QStringList& lst );
+ QTextEdit *edit;
+ KLineEdit *clientEdit, *userEdit;
+ KListBox *filesBox;
+};
+
+#endif
+
diff --git a/vcs/perforce/integrator/Makefile.am b/vcs/perforce/integrator/Makefile.am
new file mode 100644
index 00000000..0df84d8e
--- /dev/null
+++ b/vcs/perforce/integrator/Makefile.am
@@ -0,0 +1,13 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util \
+ $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libperforceintegrator.la
+libperforceintegrator_la_LDFLAGS = -avoid-version -no-undefined $(all_libraries)
+libperforceintegrator_la_LIBADD =\
+ $(top_builddir)/lib/interfaces/extras/libkdevextras.la\
+ $(top_builddir)/lib/libkdevelop.la
+kde_services_DATA = kdevperforceintegrator.desktop
+noinst_HEADERS = perforceintegrator.h pfintegratordlg.h
+libperforceintegrator_la_SOURCES = perforceintegrator.cpp \
+ pfintegratordlgbase.ui pfintegratordlg.cpp
diff --git a/vcs/perforce/integrator/kdevperforceintegrator.desktop b/vcs/perforce/integrator/kdevperforceintegrator.desktop
new file mode 100644
index 00000000..d70c7f67
--- /dev/null
+++ b/vcs/perforce/integrator/kdevperforceintegrator.desktop
@@ -0,0 +1,44 @@
+[Desktop Entry]
+Type=Service
+Name=KDevPerforceIntegrator
+Name[da]=KDevelop Perforce-integration
+Name[nds]=KDevelop-Perforce-Integreren
+Name[sk]=KDev Perforce integrácia
+Name[sv]=KDevelop Perforce-integration
+Name[zh_TW]=KDevelop Perforce 整合器
+Comment=Perforce Project Integration Facility
+Comment[ca]=Facilitat per a la integració amb projectes Perforce
+Comment[da]=Perforce projektintegration
+Comment[de]=Perforce-Projektintegration
+Comment[el]=Λειτουργία ενσωμάτωσης Perforce στο έργο
+Comment[es]=Entorno para integración con proyectos Perforce
+Comment[et]=Perforce projekti põimimisvahend
+Comment[eu]=Perforce proiektuen integrazio-tresna
+Comment[fa]=تسهیلات مجتمع‌سازی پروژۀ Perforce
+Comment[fr]=Fonction d'intégration pour un projet utilisant Perforce
+Comment[gl]=Utilidade para a integración de proxectos Perforce
+Comment[hu]=Integrálás a Perforce-szal
+Comment[it]=Funzione di integrazione del progetto Perforce
+Comment[ja]=Perforce プロジェクト統合ツール
+Comment[ms]=Kemudahan Integrasi Projek Perforce
+Comment[nds]=Perforce-Projektintegreren
+Comment[ne]=परफोर्स परियोजना एकिकरण सुविधा
+Comment[nl]=Perforce project-integratie
+Comment[pl]=Integracja z Perforce
+Comment[pt]=Integração com Projectos Perforce
+Comment[pt_BR]=Facilidade de Integração ao Projeto de Perforce
+Comment[ru]=Интеграция Perforce
+Comment[sk]=Perforce projektová integrácia
+Comment[sr]=Интеграција Perforce-а у пројекат
+Comment[sr@Latn]=Integracija Perforce-a u projekat
+Comment[sv]=Funktion för integrering av Perforce i projekt
+Comment[tr]=Perforce Proje Bütünleştirme Aracı
+Comment[zh_CN]=Perforce 工程集成功能
+Comment[zh_TW]=Perforce 專案整合工具
+Exec=blubb
+ServiceTypes=KDevelop/VCSIntegrator
+X-KDE-Library=libperforceintegrator
+X-KDevelop-Default=false
+X-KDevelop-VCS=Perforce
+X-KDevelop-VCSPlugin=kdevperforce
+X-KDevelop-Version=5
diff --git a/vcs/perforce/integrator/perforceintegrator.cpp b/vcs/perforce/integrator/perforceintegrator.cpp
new file mode 100644
index 00000000..a5e40a36
--- /dev/null
+++ b/vcs/perforce/integrator/perforceintegrator.cpp
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * 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 "perforceintegrator.h"
+
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+#include "pfintegratordlg.h"
+
+static const KDevPluginInfo data("kdevperforceintegrator");
+typedef KDevGenericFactory<PerforceIntegrator> PerforceIntegratorFactory;
+K_EXPORT_COMPONENT_FACTORY( libperforceintegrator, PerforceIntegratorFactory(data) )
+
+PerforceIntegrator::PerforceIntegrator(QObject* parent, const char* name,
+ const QStringList // args
+ )
+ :KDevVCSIntegrator(parent, name)
+{
+}
+
+PerforceIntegrator::~PerforceIntegrator()
+{
+}
+
+VCSDialog* PerforceIntegrator::fetcher(QWidget* // parent
+ )
+{
+ return 0;
+}
+
+VCSDialog* PerforceIntegrator::integrator(QWidget* parent)
+{
+ PFIntegratorDlg *dlg = new PFIntegratorDlg(parent);
+ return dlg;
+}
+
+#include "perforceintegrator.moc"
diff --git a/vcs/perforce/integrator/perforceintegrator.h b/vcs/perforce/integrator/perforceintegrator.h
new file mode 100644
index 00000000..3bb82a2d
--- /dev/null
+++ b/vcs/perforce/integrator/perforceintegrator.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * 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 PERFORCEINTEGRATOR_H
+#define PERFORCEINTEGRATOR_H
+
+#include <kdevvcsintegrator.h>
+
+#include <qstringlist.h>
+
+class PerforceIntegrator : public KDevVCSIntegrator
+{
+Q_OBJECT
+public:
+ PerforceIntegrator(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~PerforceIntegrator();
+
+ virtual VCSDialog* fetcher(QWidget* parent);
+ virtual VCSDialog* integrator(QWidget* parent);
+
+};
+
+#endif
diff --git a/vcs/perforce/integrator/pfintegratordlg.cpp b/vcs/perforce/integrator/pfintegratordlg.cpp
new file mode 100644
index 00000000..917f2a20
--- /dev/null
+++ b/vcs/perforce/integrator/pfintegratordlg.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * 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 "pfintegratordlg.h"
+
+PFIntegratorDlg::PFIntegratorDlg(QWidget *parent, const char *name)
+ :PFIntegratorDlgBase(parent, name)
+{
+}
+
+void PFIntegratorDlg::accept()
+{
+}
+
+void PFIntegratorDlg::init(const QString &/*projectName*/, const QString &/*projectLocation*/)
+{
+}
+
+QWidget *PFIntegratorDlg::self()
+{
+ return const_cast<PFIntegratorDlg*>(this);
+}
+
+#include "pfintegratordlg.moc"
diff --git a/vcs/perforce/integrator/pfintegratordlg.h b/vcs/perforce/integrator/pfintegratordlg.h
new file mode 100644
index 00000000..a74b6749
--- /dev/null
+++ b/vcs/perforce/integrator/pfintegratordlg.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * 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 PFINTEGRATORDLG_H
+#define PFINTEGRATORDLG_H
+
+#include "pfintegratordlgbase.h"
+#include <kdevvcsintegrator.h>
+
+class PFIntegratorDlg: public PFIntegratorDlgBase, public VCSDialog {
+Q_OBJECT
+public:
+ PFIntegratorDlg(QWidget *parent = 0, const char *name = 0);
+
+ virtual void accept();
+ virtual void init(const QString &projectName, const QString &projectLocation);
+ virtual QWidget *self();
+};
+
+#endif
diff --git a/vcs/perforce/integrator/pfintegratordlgbase.ui b/vcs/perforce/integrator/pfintegratordlgbase.ui
new file mode 100644
index 00000000..5b12a70f
--- /dev/null
+++ b/vcs/perforce/integrator/pfintegratordlgbase.ui
@@ -0,0 +1,47 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>PFIntegratorDlgBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>PFIntegratorDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>No options available for this VCS.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>435</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/vcs/perforce/kdevperforce.desktop b/vcs/perforce/kdevperforce.desktop
new file mode 100644
index 00000000..678eab7e
--- /dev/null
+++ b/vcs/perforce/kdevperforce.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Integrates Perforce, a software configuration management system. http://www.perforce.com/
+Comment[ca]=Integra Perforce, un sistema de gestió de la configuració del programari. http://www.perforce.com/
+Comment[da]=Integrerer Perforce, et software-indstilling håndteringssystem. http://www.perforce.com/
+Comment[de]=Integration von Perforce, einem System zur Verwaltung von Software-Konfigurationen. http://www.perforce.com/
+Comment[el]=Ενσωματώνει το Perforce, ένα σύστημα διαχείρισης και ρύθμισης λογισμικού.http://www.perforce.com/
+Comment[es]=Integra Perforce, un sistema de adminsitración de la configuración del software. http://www.perforce.com/
+Comment[et]=Integreerib tarkvaraseadistuste haldamise süsteemi Perforce. http://www.perforce.com/
+Comment[eu]=Perforce integratzen du, software konfiguazio kudeaketa sistema bat. http://www.perforce.com/
+Comment[fa]=Perforce را مجتمع‌سازی می‌کند. یک سیستم مدیریت پیکربندی نرم‌افزار. http://www.perforce.com/
+Comment[fr]=Intègre « PerForce », un système de gestion de configuration de logiciels. http:/www.perforce.com/
+Comment[gl]=Integra Perforce, un sistema de xestións de configuracións. http://www.perforce.com/
+Comment[hi]=परफ़ोर्स को इंटीग्रेट करता है, जो कि सॉफ्टवेयर कॉन्फ़िगरेशन प्रबंधन तंत्र है. http://www.perforce.com/
+Comment[hu]=Integrációt biztosít a Perforce szoftverkonfigurációs rendszerrel - http://www.perforce.com/
+Comment[it]=Integra Perforce, un sistema per la configurazione software. http://www.perforce.com/
+Comment[ja]=ソフトウェア設定管理システム Perforce を統合します。
+Comment[ms]=Menggabungkan Perforce, sebuah sistem pengurusan tetapan perisian. http://www.perforce.com/
+Comment[nds]=Integreren vun Perforce, en Systeem för't Plegen vun Programminstellen. http://www.perforce.com/
+Comment[ne]=परफोर्स एकिकरण गर्दछ, सफ्टवेयर कन्फिगरेसन व्यवस्थापन प्रणाली http://www.perforce.com/
+Comment[nl]=Integreert Perforce, een systeem voor softwareconfiguratie. Zie http://www.perforce.com/
+Comment[pl]=Integracja z Perforce, systemem zarządzania konfiguracją oprogramowania. http://www.perforce.com/
+Comment[pt]=Integra o Perforce, um sistema de gestão de configurações de 'software'. http://www.perforce.com/
+Comment[pt_BR]=Integra o Perforce, um software de configuração e gerenciamento do sistema. http://www.perforce.com/
+Comment[ru]=Интегрирует Perforce, систему управления конфигурациями программного обеспечения. http://www.perforce.com/
+Comment[sk]=Integrácia Perforce, konfiguračný projektový manažment. http://www.perforce.com/
+Comment[sl]=Integrira Perforce, upravljalni sistem programja. http://www.perforce.com/
+Comment[sr]=Интегрише Perforce, систем за управљање подешавањем софтвера. http://www.perforce.com/
+Comment[sr@Latn]=Integriše Perforce, sistem za upravljanje podešavanjem softvera. http://www.perforce.com/
+Comment[sv]=Integrerar Perforce, ett konfigurationshanteringsverktyg för programvara. http://www.perforce.com/
+Comment[ta]=ஒருங்கிணைக்கும் Perforce, ஒரு மென்பொருள் மேலாளர் அமைப்பு. http://www.perforce.com/
+Comment[tg]=Интеграл намудани Perforce, барномаи идоракунандаро шарҳи барномаҳои таъмин нигоҳ медорад.http://www.perforce.com/
+Comment[tr]=Bir yazılım ayar yönetimi sistemi olan Perforce'u bütünleştirir. http://www.perforce.com/
+Comment[zh_CN]=集成 Perforce,系统配置管理软件 http://www.perforce.com/
+Comment[zh_TW]=整合 Perforce,一套軟體設定管理系統。http://www.perforce.com/
+Name=KDevPerforce
+Name[da]=KDevelop Perforce
+Name[de]=Unterstützung für Perforce (KDevelop)
+Name[hi]=के-डेव-परफ़ोर्स
+Name[nds]=Perforce-Ünnerstütten för KDevelop
+Name[sk]=KDev Perforce
+Name[sv]=KDevelop Perforce
+Name[ta]=Kdev Perforce
+Name[zh_TW]=KDevelop Perforce
+GenericName=Perforce Integration
+GenericName[ca]=Integració amb Perforce
+GenericName[da]=Perforce integration
+GenericName[de]=Perforce-Integration
+GenericName[el]=Ενσωμάτωση Perforce
+GenericName[es]=Integración de Perforce
+GenericName[et]=Perforce'i põimimine
+GenericName[eu]=Perforce integrazioa
+GenericName[fa]=مجتمع‌سازی Perforce
+GenericName[fr]=Intégration de « Perforce »
+GenericName[ga]=Comhtháthú Perforce
+GenericName[gl]=Integración de Perforce
+GenericName[hi]=परफ़ोर्स इंटीग्रेशन
+GenericName[hu]=Perforce-integráció
+GenericName[it]=Integrazione di Perforce
+GenericName[ms]=Intergrasi Perforce
+GenericName[nds]=Perforce-Integreren
+GenericName[ne]=परफोर्स इन्टिग्रेसन
+GenericName[nl]=Perforce-integratie
+GenericName[pl]=Integracja z Perforce
+GenericName[pt]=Integração com o Perforce
+GenericName[pt_BR]=Integração com o Perforce
+GenericName[ru]=Интеграция Perforce
+GenericName[sk]=Perforce integrácia
+GenericName[sl]=Integracija Perforce
+GenericName[sr]=Интеграција perforce-а
+GenericName[sr@Latn]=Integracija perforce-a
+GenericName[sv]=Integrering av Perforce
+GenericName[ta]=Perforce ஒருங்கிணைப்பு
+GenericName[tg]=Интегратсия Perforce
+GenericName[tr]=Perforce Bütünleştirmesi
+GenericName[zh_CN]=Perforce 集成
+GenericName[zh_TW]=Perforce 整合
+ServiceTypes=KDevelop/VersionControl
+X-KDE-Library=libkdevperforce
+X-KDevelop-Version=5
+X-KDevelop-Properties=VCS,PerforceVCS
diff --git a/vcs/perforce/kdevperforcepart.rc b/vcs/perforce/kdevperforcepart.rc
new file mode 100644
index 00000000..27b5fe08
--- /dev/null
+++ b/vcs/perforce/kdevperforcepart.rc
@@ -0,0 +1,23 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevPerforcePart" version="1">
+<MenuBar>
+ <Menu name="tools">
+ <Menu name="version_control" group="tools_project_operations">
+ <Text>&amp;Version Control</Text>
+ <Merge />
+ <Menu name="version_control_tools_perforce">
+ <Text>&amp;Perforce</Text>
+ <Action name="perforce_submit" />
+ <Action name="perforce_diff" />
+ <Action name="perforce_edit" />
+ <Action name="perforce_revert" />
+ <Action name="perforce_sync" />
+ <Action name="perforce_add" />
+ <Action name="perforce_remove" />
+ </Menu>
+ </Menu>
+ </Menu>
+</MenuBar>
+
+</kpartgui>
+
diff --git a/vcs/perforce/perforcepart.cpp b/vcs/perforce/perforcepart.cpp
new file mode 100644
index 00000000..9aeadc6f
--- /dev/null
+++ b/vcs/perforce/perforcepart.cpp
@@ -0,0 +1,364 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Extended 2002 by Harald Fernengel <harry@kdevelop.org> *
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#include "perforcepart.h"
+
+#include <qfileinfo.h>
+#include <qpopupmenu.h>
+#include <qregexp.h>
+#include <kpopupmenu.h>
+#include <kdebug.h>
+#include <kdevgenericfactory.h>
+#include <kprocess.h>
+#include <kmessagebox.h>
+#include <kapplication.h>
+#include <kaction.h>
+#include <kurl.h>
+#include <kparts/part.h>
+
+#include "kdevpartcontroller.h"
+#include "kdevcore.h"
+#include "kdevmakefrontend.h"
+#include "kdevdifffrontend.h"
+#include "kdevplugininfo.h"
+#include "commitdlg.h"
+#include "execcommand.h"
+
+static const KDevPluginInfo data("kdevperforce");
+
+typedef KDevGenericFactory<PerforcePart> PerforceFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevperforce, PerforceFactory( data ) )
+
+PerforcePart::PerforcePart( QObject *parent, const char *name, const QStringList & )
+ : KDevVersionControl( &data, parent, name ? name : "PerforcePart" )
+{
+ setInstance(PerforceFactory::instance());
+ setupActions();
+
+ connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
+ this, SLOT(contextMenu(QPopupMenu *, const Context *)) );
+}
+
+
+PerforcePart::~PerforcePart()
+{}
+
+void PerforcePart::setupActions()
+{
+ actionEdit = new KAction( i18n("Edit"), 0, this, SLOT(slotActionEdit()),
+ actionCollection(), "perforce_edit" );
+ actionEdit->setToolTip(i18n("Edit"));
+ actionEdit->setWhatsThis(i18n("<b>Edit</b><p>Opens file(s) in a client workspace for edit."));
+ actionRevert = new KAction( i18n("Revert"), 0, this, SLOT(slotActionRevert()),
+ actionCollection(), "perforce_revert" );
+ actionRevert->setToolTip(i18n("Revert"));
+ actionRevert->setWhatsThis(i18n("<b>Revert</b><p>Discards changes made to open files."));
+ actionSubmit = new KAction( i18n("Submit"), 0, this, SLOT(slotActionCommit()),
+ actionCollection(), "perforce_submit" );
+ actionSubmit->setToolTip(i18n("Submit"));
+ actionSubmit->setWhatsThis(i18n("<b>Submit</b><p>Sends changes made to open files to the depot."));
+ actionSync = new KAction( i18n("Sync"), 0, this, SLOT(slotActionUpdate()),
+ actionCollection(), "perforce_sync" );
+ actionSync->setToolTip(i18n("Sync"));
+ actionSync->setWhatsThis(i18n("<b>Sync</b><p>Copies files from the depot into the workspace."));
+ actionDiff = new KAction( i18n("Diff Against Repository"), 0, this, SLOT(slotActionDiff()),
+ actionCollection(), "perforce_diff" );
+ actionDiff->setToolTip(i18n("Diff against repository"));
+ actionDiff->setWhatsThis(i18n("<b>Diff against repository</b><p>Compares a client workspace file to a revision in the depot."));
+ actionAdd = new KAction( i18n("Add to Repository"), 0, this, SLOT(slotActionAdd()),
+ actionCollection(), "perforce_add" );
+ actionAdd->setToolTip(i18n("Add to repository"));
+ actionAdd->setWhatsThis(i18n("<b>Add to repository</b><p>Open file(s) in a client workspace for addition to the depot."));
+ actionRemove = new KAction( i18n("Remove From Repository"), 0, this, SLOT(slotActionRemove()),
+ actionCollection(), "perforce_remove" );
+ actionRemove->setToolTip(i18n("Remove from repository"));
+ actionRemove->setWhatsThis(i18n("<b>Remove from repository</b><p>Open file(s) in a client workspace for deletion from the depot."));
+}
+
+void PerforcePart::contextMenu(QPopupMenu *popup, const Context *context)
+{
+ if (context->hasType( Context::FileContext )) {
+ const FileContext *fcontext = static_cast<const FileContext*>(context);
+ popupfile = fcontext->urls().first().path();
+ QFileInfo fi( popupfile );
+ popup->insertSeparator();
+
+ KPopupMenu *sub = new KPopupMenu(popup);
+ QString name = fi.fileName();
+ sub->insertTitle( i18n("Actions for %1").arg(name) );
+
+ int id = sub->insertItem( i18n("Edit"),
+ this, SLOT(slotEdit()) );
+ sub->setWhatsThis(id, i18n("<b>Edit</b><p>Opens file(s) in a client workspace for edit."));
+ id = sub->insertItem( i18n("Revert"),
+ this, SLOT(slotRevert()) );
+ sub->setWhatsThis(id, i18n("<b>Revert</b><p>Discards changes made to open files."));
+ id = sub->insertItem( i18n("Submit"),
+ this, SLOT(slotCommit()) );
+ sub->setWhatsThis(id, i18n("<b>Submit</b><p>Sends changes made to open files to the depot."));
+ id = sub->insertItem( i18n("Sync"),
+ this, SLOT(slotUpdate()) );
+ sub->setWhatsThis(id, i18n("<b>Sync</b><p>Copies files from the depot into the workspace."));
+ sub->insertSeparator();
+ id = sub->insertItem( i18n("Diff Against Repository"),
+ this, SLOT(slotDiff()) );
+ sub->setWhatsThis(id, i18n("<b>Diff against repository</b><p>Compares a client workspace file to a revision in the depot."));
+ id = sub->insertItem( i18n("Add to Repository"),
+ this, SLOT(slotAdd()) );
+ sub->setWhatsThis(id, i18n("<b>Add to repository</b><p>Open file(s) in a client workspace for addition to the depot."));
+ id = sub->insertItem( i18n("Remove From Repository"),
+ this, SLOT(slotRemove()) );
+ sub->setWhatsThis(id, i18n("<b>Remove from repository</b><p>Open file(s) in a client workspace for deletion from the depot."));
+ id = popup->insertItem(i18n("Perforce"), sub);
+ }
+}
+
+void PerforcePart::execCommand( const QString& cmd, const QString& filename )
+{
+ if ( filename.isEmpty() )
+ return;
+
+ QFileInfo fi( filename );
+ if (fi.isDir()) {
+ KMessageBox::error( 0, i18n("Cannot handle directories, please select single files") );
+ return;
+ }
+ QString dir = fi.dirPath();
+ QString name = fi.fileName();
+
+ QString command("cd ");
+ command += KProcess::quote(dir);
+ command += " && p4 " + cmd + " ";
+ command += name;
+
+ if (KDevMakeFrontend *makeFrontend = extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir, command);
+}
+
+void PerforcePart::edit( const QString& filename )
+{
+ execCommand( "edit", filename );
+}
+
+void PerforcePart::revert( const QString& filename )
+{
+ if ( KMessageBox::questionYesNo( 0,
+ i18n("Do you really want to revert "
+ "the file %1 and lose all your changes?").arg( filename ), QString::null, i18n("Revert"), i18n("Do Not Revert") ) == KMessageBox::Yes ) {
+ execCommand( "revert", filename );
+ }
+}
+
+void PerforcePart::commit( const QString& filename )
+{
+ if ( filename.isEmpty() )
+ return;
+
+ QFileInfo fi( filename );
+ if ( fi.isDir() ) {
+ KMessageBox::error( 0, i18n("Submitting of subdirectories is not supported") );
+ return;
+ }
+
+ CommitDialog d;
+ QStringList lst;
+ lst << filename;
+ d.setFiles( lst );
+ if (d.exec() == QDialog::Rejected)
+ return;
+
+ QString message = d.changeList();
+ if (!message.isEmpty())
+ message = KShellProcess::quote(message);
+
+ QString command("echo " + message);
+ command += " | p4 submit -i";
+
+ if (KDevMakeFrontend *makeFrontend = extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand("", command);
+}
+
+
+void PerforcePart::update( const QString& filename )
+{
+ if ( filename.isEmpty() )
+ return;
+
+ QString dir, name;
+ QFileInfo fi( filename );
+ if (fi.isDir()) {
+ dir = fi.absFilePath();
+ name = "..."; // three dots means "recoursive"
+ } else {
+ dir = fi.dirPath();
+ name = fi.fileName();
+ }
+
+ QString command("cd ");
+ command += KProcess::quote(dir);
+ command += " && p4 sync ";
+ command += name;
+
+ if (KDevMakeFrontend *makeFrontend = extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir, command);
+}
+
+
+void PerforcePart::add( const QString& filename )
+{
+ execCommand( "add", filename );
+}
+
+
+void PerforcePart::remove( const QString& filename )
+{
+ execCommand( "delete", filename );
+}
+
+void PerforcePart::diff( const QString& filename )
+{
+ if ( filename.isEmpty() )
+ return;
+
+ QString name;
+ QFileInfo fi( filename );
+
+ if ( fi.isDir() ) {
+ name = fi.absFilePath() + "...";
+ } else {
+ name = filename;
+ }
+ QStringList args;
+
+ args << "diff";
+ args << "-du";
+ args << name;
+ ExecCommand* cmv = new ExecCommand( "p4", args, QString::null, QStringList(), this );
+ connect( cmv, SIGNAL(finished( const QString&, const QString& )),
+ this, SLOT(slotDiffFinished( const QString&, const QString& )) );
+}
+
+void PerforcePart::slotDiffFinished( const QString& diff, const QString& err )
+{
+ if ( diff.isNull() && err.isNull() ) {
+ kdDebug(9000) << "p4 diff cancelled" << endl;
+ return; // user pressed cancel or an error occured
+ }
+
+ if ( diff.isEmpty() && !err.isEmpty() ) {
+ KMessageBox::detailedError( 0, i18n("P4 output errors during diff."), err, i18n("Errors During Diff") );
+ return;
+ }
+
+ if ( !err.isEmpty() ) {
+ int s = KMessageBox::warningContinueCancelList( 0, i18n("P4 output errors during diff. Do you still want to continue?"),
+ QStringList::split( "\n", err, false ), i18n("Errors During Diff") );
+ if ( s != KMessageBox::Continue )
+ return;
+ }
+
+ if ( diff.isEmpty() ) {
+ KMessageBox::information( 0, i18n("There is no difference to the repository."), i18n("No Differences Found") );
+ return;
+ }
+
+ // strip the ==== headers
+ static QRegExp rx( "(^|\\n)==== ([^ ]+) -.*====\\n" );
+ rx.setMinimal( true );
+ QString strippedDiff = diff;
+ strippedDiff.replace( rx, "--- \\2\n+++ \\2\n" );
+
+ if (KDevDiffFrontend *diffFrontend = extension<KDevDiffFrontend>("KDevelop/DiffFrontend"))
+ diffFrontend->showDiff( strippedDiff );
+}
+
+QString PerforcePart::currentFile()
+{
+ KParts::ReadOnlyPart *part = dynamic_cast<KParts::ReadOnlyPart*>( partController()->activePart() );
+ if ( part ) {
+ KURL url = part->url();
+ if ( url.isLocalFile() )
+ return url.path();
+ }
+ return QString::null;
+}
+
+void PerforcePart::slotActionCommit()
+{
+ commit( currentFile() );
+}
+
+void PerforcePart::slotActionUpdate()
+{
+ update( currentFile() );
+}
+void PerforcePart::slotActionAdd()
+{
+ add( currentFile() );
+}
+
+void PerforcePart::slotActionRemove()
+{
+ remove( currentFile() );
+}
+
+void PerforcePart::slotActionEdit()
+{
+ edit( currentFile() );
+}
+
+void PerforcePart::slotActionRevert()
+{
+ revert( currentFile() );
+}
+
+void PerforcePart::slotActionDiff()
+{
+ diff( currentFile() );
+}
+
+void PerforcePart::slotCommit()
+{
+ commit( popupfile );
+}
+
+void PerforcePart::slotUpdate()
+{
+ update( popupfile );
+}
+
+void PerforcePart::slotAdd()
+{
+ add( popupfile );
+}
+
+void PerforcePart::slotRemove()
+{
+ remove( popupfile );
+}
+
+void PerforcePart::slotEdit()
+{
+ edit( popupfile );
+}
+
+void PerforcePart::slotRevert()
+{
+ revert( popupfile );
+}
+
+void PerforcePart::slotDiff()
+{
+ diff( popupfile );
+}
+
+#include "perforcepart.moc"
diff --git a/vcs/perforce/perforcepart.h b/vcs/perforce/perforcepart.h
new file mode 100644
index 00000000..5a50871c
--- /dev/null
+++ b/vcs/perforce/perforcepart.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Extended to use perforce 2002 by Harald Fernengel <harry@kdevelop.org>*
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef _PERFORCEPART_H_
+#define _PERFORCEPART_H_
+
+#include <kdevversioncontrol.h>
+#include <klocale.h>
+
+class Context;
+class QPopupMenu;
+class KAction;
+
+class PerforcePart : public KDevVersionControl
+{
+ Q_OBJECT
+
+public:
+ PerforcePart( QObject *parent, const char *name, const QStringList & );
+ ~PerforcePart();
+
+ virtual QString shortDescription() const
+ { return i18n( "Perforce is a version control system" ); }
+
+ virtual void createNewProject(const QString& /* dir */) {}
+ virtual bool fetchFromRepository() { return true; }
+ virtual KDevVCSFileInfoProvider *fileInfoProvider() const { return 0; }
+ virtual bool isValidDirectory(const QString& /* dirPath*/) const
+ { return true; }
+
+private slots:
+ void contextMenu(QPopupMenu *popup, const Context *context);
+ void slotCommit();
+ void slotUpdate();
+ void slotAdd();
+ void slotRemove();
+ void slotEdit();
+ void slotRevert();
+ void slotDiff();
+
+ void slotActionCommit();
+ void slotActionUpdate();
+ void slotActionAdd();
+ void slotActionRemove();
+ void slotActionEdit();
+ void slotActionRevert();
+ void slotActionDiff();
+
+ void slotDiffFinished( const QString&, const QString& );
+
+private:
+ void commit( const QString& filename );
+ void update( const QString& filename );
+ void add( const QString& filename );
+ void remove( const QString& filename );
+ void edit( const QString& filename );
+ void revert( const QString& filename );
+ void diff( const QString& filename );
+ QString currentFile();
+
+ /** calls p4 with the command cmd and appends the filename */
+ void execCommand( const QString& cmd, const QString& filename );
+ void setupActions();
+ QString popupfile;
+ KAction *actionEdit, *actionRevert,
+ *actionSubmit, *actionSync,
+ *actionDiff, *actionAdd, *actionRemove;
+};
+
+#endif