diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /parts/distpart | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
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
Diffstat (limited to 'parts/distpart')
-rw-r--r-- | parts/distpart/Makefile.am | 16 | ||||
-rw-r--r-- | parts/distpart/README | 3 | ||||
-rw-r--r-- | parts/distpart/README.dox | 24 | ||||
-rw-r--r-- | parts/distpart/distpart_part.cpp | 84 | ||||
-rw-r--r-- | parts/distpart/distpart_part.h | 55 | ||||
-rw-r--r-- | parts/distpart/distpart_ui.ui | 1243 | ||||
-rw-r--r-- | parts/distpart/distpart_widget.cpp | 605 | ||||
-rw-r--r-- | parts/distpart/distpart_widget.h | 210 | ||||
-rw-r--r-- | parts/distpart/kdevdistpart.desktop | 70 | ||||
-rw-r--r-- | parts/distpart/kdevpart_distpart.rc | 8 | ||||
-rw-r--r-- | parts/distpart/lsmsupport.cpp | 32 | ||||
-rw-r--r-- | parts/distpart/lsmsupport.h | 35 | ||||
-rw-r--r-- | parts/distpart/packagebase.cpp | 117 | ||||
-rw-r--r-- | parts/distpart/packagebase.h | 84 | ||||
-rw-r--r-- | parts/distpart/specsupport.cpp | 315 | ||||
-rw-r--r-- | parts/distpart/specsupport.h | 54 |
16 files changed, 2955 insertions, 0 deletions
diff --git a/parts/distpart/Makefile.am b/parts/distpart/Makefile.am new file mode 100644 index 00000000..0a1d949f --- /dev/null +++ b/parts/distpart/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdevdistpart.la +libkdevdistpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevdistpart_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdevdistpart_la_SOURCES = distpart_ui.ui distpart_part.cpp distpart_widget.cpp packagebase.cpp lsmsupport.cpp specsupport.cpp + +METASOURCES = AUTO +KDEICON = AUTO +servicedir = $(kde_servicesdir) +service_DATA = kdevdistpart.desktop + +rc_DATA = kdevpart_distpart.rc +rcdir = $(kde_datadir)/kdevdistpart diff --git a/parts/distpart/README b/parts/distpart/README new file mode 100644 index 00000000..731741e1 --- /dev/null +++ b/parts/distpart/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/parts/distpart/README.dox b/parts/distpart/README.dox new file mode 100644 index 00000000..994b4f84 --- /dev/null +++ b/parts/distpart/README.dox @@ -0,0 +1,24 @@ +/** \class DistpartPart +This part aims to provide some help to the developpers for packaging +and publishing their projects by ftp protocol. + +Only RPM package format is supported for now. More to come. +If you want to develop a new package support, please have a look at +specsupport.h and specsupport.cpp. Help is always welcome :-) + +\authors <a href="mailto:geiseri AT yahoo.com">Ian Reinart Geiser</a> + +\maintainer <a href="mailto:Yann.Hodique AT lifl.fr">Yann Hodique</a> + +\feature provide some help to the developpers for packaging and publishing their projects by ftp protocol +\feature support RPM package format + +\bug Development package, documentation package, application icon and local +options (in publishing tab) are currently ignored. + +\bug The creation of the source archive is just a +call to "dist" or "dist-bzip2" target of the Makefile. If those +targets don't exist, nothing is done to solve the problem (for +example when the project is QMake-based) + +*/ diff --git a/parts/distpart/distpart_part.cpp b/parts/distpart/distpart_part.cpp new file mode 100644 index 00000000..b719533d --- /dev/null +++ b/parts/distpart/distpart_part.cpp @@ -0,0 +1,84 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 "distpart_part.h" + +#include <qwhatsthis.h> + +#include <kiconloader.h> +#include <klocale.h> +#include <kdevgenericfactory.h> +#include <kdebug.h> + +#include "kdevcore.h" +#include <kdevplugininfo.h> + +#include "distpart_widget.h" + +#include <kdialogbase.h> + +typedef KDevGenericFactory<DistpartPart> DistpartFactory; +static const KDevPluginInfo data("kdevdistpart"); +K_EXPORT_COMPONENT_FACTORY( libkdevdistpart, DistpartFactory( data ) ) + +DistpartPart::DistpartPart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin(&data, parent, name ? name : "DistpartPart") { + + kdDebug(9007) << "DistpartPart::DistpartPart()" << endl; + setInstance(DistpartFactory::instance()); + + setXMLFile("kdevpart_distpart.rc"); + + m_action = new KAction( i18n("Distribution && Publishing"), "package", 0, + this, SLOT(show()), + actionCollection(), "make_dist" ); + + m_action->setToolTip(i18n("Make source and binary distribution")); + m_action->setWhatsThis(i18n("<b>Project distribution & publishing</b><p>Helps users package and publish their software.")); + //QWhatsThis::add(m_widget, i18n("This will help users package and publish their software.")); + + m_dlg = new KDialogBase( 0 , "dist_part", false, i18n("Distribution & Publishing"), KDialogBase::Ok|KDialogBase::Cancel); + + m_dialog = new DistpartDialog(this, m_dlg ); + m_dlg->setMainWidget(m_dialog); + + connect( m_dlg, SIGNAL(okClicked()), m_dialog, SLOT(slotokayPushButtonPressed())); + connect( m_dlg, SIGNAL(cancelClicked()), m_dialog, SLOT(slotcancelPushButtonPressed())); + // Package types + //RpmPackage = new SpecSupport(this); + //LsmPackage = new LsmSupport(this); +} + + +DistpartPart::~DistpartPart() { + kdDebug(9007) << "DistpartPart::~DistpartPart()" << endl; + delete m_dialog; + //delete RpmPackage; + //delete LsmPackage; +} + +void DistpartPart::show() { + m_dlg->exec(); +} + +void DistpartPart::hide() { + m_dlg->cancel(); +} + +#include "distpart_part.moc" diff --git a/parts/distpart/distpart_part.h b/parts/distpart/distpart_part.h new file mode 100644 index 00000000..c8caa0a3 --- /dev/null +++ b/parts/distpart/distpart_part.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 __KDEVPART_DISTPART_H__ +#define __KDEVPART_DISTPART_H__ + + +#include <qguardedptr.h> +#include <kdevplugin.h> +#include <kaction.h> + +#include "packagebase.h" + +class DistpartDialog; +class KDialogBase; + +class DistpartPart : public KDevPlugin { + Q_OBJECT + +public: + + DistpartPart(QObject *parent, const char *name, const QStringList &); + ~DistpartPart(); + +public slots: + void show(); + void hide(); + +private: + packageBase *RpmPackage, *LsmPackage; + QGuardedPtr<DistpartDialog> m_dialog; + KAction *m_action; + QGuardedPtr<KDialogBase> m_dlg; +}; + + +#endif diff --git a/parts/distpart/distpart_ui.ui b/parts/distpart/distpart_ui.ui new file mode 100644 index 00000000..a987c009 --- /dev/null +++ b/parts/distpart/distpart_ui.ui @@ -0,0 +1,1243 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>distpart_ui</class> +<author>Ian Reinhart Geiser <geiseri@yahoo.com></author> +<widget class="QWidget"> + <property name="name"> + <cstring>packaging_dialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>606</width> + <height>649</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="caption"> + <string>Prepare for Release</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout30</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>titleLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>250</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string><H2>Project Packaging & Publishing</H2></string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>KDevelopGraphic</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>48</width> + <height>48</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>48</width> + <height>48</height> + </size> + </property> + <property name="pixmap"> + <pixmap>"kdevelop"</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QTabWidget"> + <property name="name"> + <cstring>actions_box</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="tabPosition"> + <enum>Top</enum> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Source &Distribution</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListBox" row="1" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>srcDistFileListBox</cstring> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>customProjectCheckBox</cstring> + </property> + <property name="text"> + <string>&Use custom options</string> + </property> + <property name="toolTip" stdset="0"> + <string>Default is: %n-%v.tar.gz</string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>Layout19</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>sourceOptionsGroupBox</cstring> + </property> + <property name="title"> + <string>Source Options</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>bzipCheckBox</cstring> + </property> + <property name="text"> + <string>Use &bzip2 instead of gzip</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout34</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>archiveNameLabel</cstring> + </property> + <property name="text"> + <string><b>Archive name format: </b><br> %n - File name <br> %v - File version <br> %d - Date of archive</string> + </property> + <property name="buddy" stdset="0"> + <cstring>archNameFormatLineEdit</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>archNameFormatLineEdit</cstring> + </property> + <property name="text"> + <string>%n-%v</string> + </property> + <property name="toolTip" stdset="0"> + <string>Enter the filename using the format options. </string> + </property> + </widget> + </vbox> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer37</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>addFile</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Add Files</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>createSrcArchPushButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Create Source Archive</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>resetSrcPushButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>R&eset</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>fileListLabel</cstring> + </property> + <property name="text"> + <string>File &list:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>srcDistFileListBox</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Package &Information</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLineEdit" row="4" column="1"> + <property name="name"> + <cstring>licenseLineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>vendorLabel</cstring> + </property> + <property name="text"> + <string>Ve&ndor:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>vendorLineEdit</cstring> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1"> + <property name="name"> + <cstring>releaseLineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>appNameLineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Application name</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="1"> + <property name="name"> + <cstring>vendorLineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>appNameLabel</cstring> + </property> + <property name="text"> + <string>&Application name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>appNameLineEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>summaryLabel</cstring> + </property> + <property name="text"> + <string>S&ummary:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>summaryLineEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>licenseLabel</cstring> + </property> + <property name="text"> + <string>&License:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>licenseLineEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>releaseLabel</cstring> + </property> + <property name="text"> + <string>R&elease:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>releaseLineEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>versionLabel</cstring> + </property> + <property name="text"> + <string>&Version:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>versionLineEdit</cstring> + </property> + </widget> + <widget class="KLineEdit" row="5" column="1"> + <property name="name"> + <cstring>summaryLineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KLineEdit" row="7" column="1"> + <property name="name"> + <cstring>packagerLineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>versionLineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Version of the file package. +Menu item: Project/Project Options/General/Version +changes project compiled version number</string> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>groupLabel</cstring> + </property> + <property name="text"> + <string>&Group:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>groupLineEdit</cstring> + </property> + </widget> + <widget class="QLabel" row="7" column="0"> + <property name="name"> + <cstring>packagerLabel</cstring> + </property> + <property name="text"> + <string>Pac&kager:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>packagerLineEdit</cstring> + </property> + </widget> + <widget class="KLineEdit" row="6" column="1"> + <property name="name"> + <cstring>groupLineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>advancedOptionsGroupBox</cstring> + </property> + <property name="title"> + <string>Advanced Package Op&tions</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>devPackageCheckBox</cstring> + </property> + <property name="text"> + <string>&Create development package</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>docsPackageCheckBox</cstring> + </property> + <property name="text"> + <string>Create documentation package</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>appIconCheckBox</cstring> + </property> + <property name="text"> + <string>Include application icon</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>archLabel</cstring> + </property> + <property name="text"> + <string>Architecture target:<BR><b>(Note: You must have a compiler that supports this target)</b></string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>i386</string> + </property> + </item> + <item> + <property name="text"> + <string>i586</string> + </property> + </item> + <item> + <property name="text"> + <string>i686</string> + </property> + </item> + <item> + <property name="text"> + <string>AMD K6</string> + </property> + </item> + <item> + <property name="text"> + <string>AMD K7</string> + </property> + </item> + <item> + <property name="text"> + <string>PPC</string> + </property> + </item> + <item> + <property name="text"> + <string>PPC G3</string> + </property> + </item> + <item> + <property name="text"> + <string>PPC Altevec</string> + </property> + </item> + <item> + <property name="text"> + <string>Dec Alpha (AXP)</string> + </property> + </item> + <item> + <property name="text"> + <string>Sparc</string> + </property> + </item> + <property name="name"> + <cstring>archComboBox</cstring> + </property> + <property name="currentItem"> + <number>0</number> + </property> + <property name="autoResize"> + <bool>true</bool> + </property> + <property name="sizeLimit"> + <number>10</number> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>srcPackagePushButton</cstring> + </property> + <property name="text"> + <string>&Build Source +Package</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>buildAllPushButton</cstring> + </property> + <property name="text"> + <string>Build Binar&y +Package</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>exportSPECPushButton</cstring> + </property> + <property name="text"> + <string>E&xport +Build Files</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>importSPECPushButton</cstring> + </property> + <property name="text"> + <string>I&mport +Build Files</string> + </property> + </widget> + </vbox> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout16</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>projectDescriptionLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Description:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>projectDescriptionMultilineEdit</cstring> + </property> + </widget> + <widget class="KTextEdit"> + <property name="name"> + <cstring>projectDescriptionMultilineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="resizePolicy"> + <enum>Manual</enum> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>C&hangelog:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>projectChangelogMultilineEdit</cstring> + </property> + </widget> + <widget class="KTextEdit"> + <property name="name"> + <cstring>projectChangelogMultilineEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Pr&oject Publishing</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>localOptionsGroupBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Local Options</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout15</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>genHTMLCheckBox</cstring> + </property> + <property name="text"> + <string>Ge&nerate HTML information page</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="1"> + <property name="name"> + <cstring>useRPMInfoCheckBox</cstring> + </property> + <property name="text"> + <string>&User information generated by RPM</string> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout21</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>genHTMLPushButton</cstring> + </property> + <property name="text"> + <string>&Generate</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>resetHTMLPushButton</cstring> + </property> + <property name="text"> + <string>R&eset</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>remoteOptionsGroupBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Re&mote Options</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListBox" row="1" column="1"> + <property name="name"> + <cstring>uploadFileListBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>250</width> + <height>0</height> + </size> + </property> + </widget> + <widget class="QLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>Layout23</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>fileSubmissionLabel</cstring> + </property> + <property name="text"> + <string>File su&bmission list:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>uploadFileListBox</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer24</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Minimum</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>uploadAddFileToolButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>+</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>uploadRemoveToolButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>-</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="0" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>Layout25</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>uploadCustomCheckBox</cstring> + </property> + <property name="text"> + <string>Upload to &custom FTP site</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>uploadftpkdeorgCheckBox</cstring> + </property> + <property name="text"> + <string>Upload files to ftp.&kde.org</string> + </property> + </widget> + <spacer row="4" column="0"> + <property name="name"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton" row="7" column="0"> + <property name="name"> + <cstring>uploadSubmitPushButton</cstring> + </property> + <property name="text"> + <string>Sub&mit</string> + </property> + </widget> + <widget class="KLineEdit" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>uploadURLLineEdit</cstring> + </property> + <property name="text"> + <string>ftp://username:password@ftp.server.com/path/</string> + </property> + </widget> + <widget class="KPushButton" row="7" column="1"> + <property name="name"> + <cstring>uploadResetPushButton</cstring> + </property> + <property name="text"> + <string>Reset</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>uploadAppsKDEcomCheckBox</cstring> + </property> + <property name="text"> + <string>Upload to &apps.kde.com</string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + </vbox> + </widget> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>buildAllPushButton</sender> + <signal>clicked()</signal> + <receiver>packaging_dialog</receiver> + <slot>slotbuildAllPushButtonPressed()</slot> + </connection> + <connection> + <sender>exportSPECPushButton</sender> + <signal>clicked()</signal> + <receiver>packaging_dialog</receiver> + <slot>slotexportSPECPushButtonPressed()</slot> + </connection> + <connection> + <sender>srcPackagePushButton</sender> + <signal>clicked()</signal> + <receiver>packaging_dialog</receiver> + <slot>slotsrcPackagePushButtonPressed()</slot> + </connection> + <connection> + <sender>importSPECPushButton</sender> + <signal>clicked()</signal> + <receiver>packaging_dialog</receiver> + <slot>slotimportSPECPushButtonPressed()</slot> + </connection> + <connection> + <sender>addFile</sender> + <signal>clicked()</signal> + <receiver>packaging_dialog</receiver> + <slot>slotAddFileButtonPressed()</slot> + </connection> + <connection> + <sender>srcDistFileListBox</sender> + <signal>clicked(QListBoxItem*)</signal> + <receiver>packaging_dialog</receiver> + <slot>slotRemoveFile(QListBoxItem*)</slot> + </connection> +</connections> +<tabstops> + <tabstop>actions_box</tabstop> + <tabstop>customProjectCheckBox</tabstop> + <tabstop>bzipCheckBox</tabstop> + <tabstop>archNameFormatLineEdit</tabstop> + <tabstop>createSrcArchPushButton</tabstop> + <tabstop>resetSrcPushButton</tabstop> + <tabstop>srcDistFileListBox</tabstop> + <tabstop>appNameLineEdit</tabstop> + <tabstop>versionLineEdit</tabstop> + <tabstop>releaseLineEdit</tabstop> + <tabstop>vendorLineEdit</tabstop> + <tabstop>licenseLineEdit</tabstop> + <tabstop>summaryLineEdit</tabstop> + <tabstop>groupLineEdit</tabstop> + <tabstop>packagerLineEdit</tabstop> + <tabstop>projectDescriptionMultilineEdit</tabstop> + <tabstop>projectChangelogMultilineEdit</tabstop> + <tabstop>devPackageCheckBox</tabstop> + <tabstop>docsPackageCheckBox</tabstop> + <tabstop>appIconCheckBox</tabstop> + <tabstop>archComboBox</tabstop> + <tabstop>genHTMLCheckBox</tabstop> + <tabstop>useRPMInfoCheckBox</tabstop> + <tabstop>genHTMLPushButton</tabstop> + <tabstop>resetHTMLPushButton</tabstop> + <tabstop>uploadftpkdeorgCheckBox</tabstop> + <tabstop>uploadAppsKDEcomCheckBox</tabstop> + <tabstop>uploadCustomCheckBox</tabstop> + <tabstop>uploadURLLineEdit</tabstop> + <tabstop>uploadSubmitPushButton</tabstop> + <tabstop>uploadResetPushButton</tabstop> + <tabstop>uploadAddFileToolButton</tabstop> + <tabstop>uploadRemoveToolButton</tabstop> + <tabstop>uploadFileListBox</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> + <include location="global" impldecl="in implementation">kiconloader.h</include> + <include location="global" impldecl="in implementation">kpushbutton.h</include> + <include location="global" impldecl="in implementation">klistbox.h</include> + <include location="global" impldecl="in implementation">klineedit.h</include> + <include location="global" impldecl="in implementation">ktextedit.h</include> +</includes> +<slots> + <slot>slotbuildAllPushButtonPressed()</slot> + <slot>slotexportSPECPushButtonPressed()</slot> + <slot>slotimportSPECPushButtonPressed()</slot> + <slot>slotsrcPackagePushButtonPressed()</slot> + <slot>slotAddFileButtonPressed()</slot> + <slot>slotRemoveFile(QListBoxItem *item)</slot> +</slots> +<pixmapfunction>DesktopIcon</pixmapfunction> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>klistbox.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>ktextedit.h</includehint> + <includehint>ktextedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistbox.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/parts/distpart/distpart_widget.cpp b/parts/distpart/distpart_widget.cpp new file mode 100644 index 00000000..71c981e8 --- /dev/null +++ b/parts/distpart/distpart_widget.cpp @@ -0,0 +1,605 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 "distpart_widget.h" + +#include <kparts/part.h> +#include <klibloader.h> +#include <kurl.h> +#include <kdebug.h> +#include <kprocess.h> +#include <kfiledialog.h> +#include <kio/netaccess.h> +#include <klocale.h> +#include "kdevproject.h" +#include "domutil.h" +#include <ktar.h> +#include <kmessagebox.h> + +#include <kdevcore.h> +#include <qgroupbox.h> +#include <qlayout.h> +#include <qnetwork.h> +#include <qurloperator.h> +#include <qmessagebox.h> +#include "distpart_part.h" +#include <qdir.h> +#include <qfile.h> +#include <qregexp.h> +#include <qstringlist.h> +#include <qtabwidget.h> +#include "kdevmakefrontend.h" +#include <kprogress.h> + +#include <qerrormessage.h> +#include "specsupport.h" +#include "lsmsupport.h" + +DistpartDialog::DistpartDialog(DistpartPart *part, QWidget *parent) + :distpart_ui(parent, "dist_widget"), m_part(part) { + m_spec = new SpecSupport(m_part); + + connect( customProjectCheckBox, SIGNAL(toggled(bool) ), + this, SLOT(slotcustomProjectCheckBoxChanged())); + connect( uploadCustomCheckBox, SIGNAL(toggled(bool)), + this, SLOT(slotuploadCustomCheckBoxChanged())); + +// connect( okayPushButton, SIGNAL(clicked()), +// this, SLOT(slotokayPushButtonPressed())); +// connect( cancelPushButton, SIGNAL(clicked()), +// this, SLOT(slotcancelPushButtonPressed())); +/* connect(help_PushButton, SIGNAL(clicked()), + this, SLOT(slothelp_PushButtonPressed()));*/ + connect( createSrcArchPushButton, SIGNAL(clicked()), + this, SLOT(slotcreateSrcArchPushButtonPressed())); + connect( resetSrcPushButton, SIGNAL(clicked()), + this, SLOT(slotresetSrcPushButtonPressed())); + + connect( genHTMLPushButton, SIGNAL(clicked()), + this, SLOT(slotgenHTMLPushButtonPressed())); + connect( resetHTMLPushButton, SIGNAL(clicked()), + this, SLOT(slotresetHTMLPushButtonPressed())); + connect( uploadSubmitPushButton, SIGNAL(clicked()), + this, SLOT(slotuploadSubmitPushButtonPressed())); + connect( uploadResetPushButton, SIGNAL(clicked()), + this, SLOT(slotuploadResetPushButtonPressed())); + connect( uploadAddFileToolButton, SIGNAL(clicked()), + this, SLOT(slotuploadAddFileToolButtonPressed())); + connect( uploadRemoveToolButton, SIGNAL(clicked()), + this, SLOT(slotuploadRemoveToolButtonPressed())); + connect ( srcDistFileListBox, SIGNAL(clicked(QListBoxItem *item)), this, SLOT(slotRemoveFile(QListBoxItem *item))); +// connect( buildAllPushButton, SIGNAL( clicked() ), this, SLOT( slotbuildAllPushButtonPressed() )); +// connect( exportSPECPushButton, SIGNAL( clicked() ), this, SLOT( slotexportSPECPushButtonPressed( ) ) ); +// connect( srcPackagePushButton, SIGNAL( clicked() ), this, SLOT( slotsrcPackagePushButtonPressed() ) ); +// connect( importSPECPushButton, SIGNAL( clicked() ), this, SLOT( slotimportSPECPushButtonPressed() ) ); + loadSettings(); + + + localOptionsGroupBox->setEnabled(false); + devPackageCheckBox->setEnabled(false); + docsPackageCheckBox->setEnabled(false); + appIconCheckBox->setEnabled(false); + uploadftpkdeorgCheckBox->setEnabled(false); + uploadAppsKDEcomCheckBox->setEnabled(false); +} + + +DistpartDialog::~DistpartDialog() { +} + +// QPushButton* okayPushButton; + +void DistpartDialog::slotokayPushButtonPressed() { + storeSettings(); +// accept(); +} +// QPushButton* cancelPushButton; + +void DistpartDialog::slotcancelPushButtonPressed() { +// reject(); +} +// QPushButton* help_PushButton; + +/*void DistpartDialog::slothelp_PushButtonPressed() { + QMessageBox::about(this,i18n("Distpart Help"),i18n("In order to build a RPM package :\n\t1) Create a source archive\n\t2) Generate a SPEC File\n\t3) Build the package")); +}*/ + +// QPushButton* createSrcArchPushButton; +void DistpartDialog::slotcreateSrcArchPushButtonPressed() { + kdDebug() << "Starting archive..." << endl; + QString dist = (getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? "application/x-bzip2" : "application/x-gzip"; + + QString filename = m_part->project()->projectDirectory() + "/" + getSourceName(); + + KTar tar(filename, dist); + if ( tar.open(IO_WriteOnly) ) + { + //QStringList files = m_part->project()->distFiles(); + KProgressDialog *prog = new KProgressDialog( 0, "dialog", i18n("Building Package"), "", true ); + prog->show(); + for( uint idx = 0; idx < srcDistFileListBox->numRows(); ++idx) + { + QString file = srcDistFileListBox->text(idx); + if ( !tar.addLocalFile( m_part->project()->projectDirectory() + "/" + file, getappNameFormatLineEditText() + "/" + file) ) + { + kdDebug() << "Failed to write file " << file << endl; + } + else + { + prog->setLabel(i18n("Adding file: %1").arg( file) ); + prog->progressBar()->setValue( (idx*100)/srcDistFileListBox->numRows() ); + } + } + tar.close( ); + prog->hide(); + delete prog; + KMessageBox::information( this, i18n("Archive made at: %1").arg( filename ), i18n("Archive Done") ); + + } + else + { + kdDebug() << "Failed to open archive..." << endl; + } + +} + +// QPushButton* resetSrcPushButton; +void DistpartDialog::slotresetSrcPushButtonPressed() { + srcDistFileListBox->clear(); + loadSettings(); +} + + + +// QPushButton* genHTMLPushButton; +void DistpartDialog::slotgenHTMLPushButtonPressed() {} + +// QPushButton* resetHTMLPushButton; +void DistpartDialog::slotresetHTMLPushButtonPressed() {} + +// QToolButton* uploadAddFileToolButton; +void DistpartDialog::slotuploadAddFileToolButtonPressed() { + uploadFileListBox->insertStringList(KFileDialog::getOpenFileNames()); +} + +// QToolButton* uploadRemoveToolButton; +void DistpartDialog::slotuploadRemoveToolButtonPressed() { + for(unsigned int i=0; i< uploadFileListBox->count(); i++) + if ( uploadFileListBox->isSelected(i)) uploadFileListBox->removeItem(i); +} + +// QPushButton* uploadSubmitPushButton; +void DistpartDialog::slotuploadSubmitPushButtonPressed() { + + if(getuploadftpkdeorgCheckBoxState() || getuploadAppsKDEcomCheckBoxState()) + kdDebug() << "Implement ftp.kde.org & apps.kde.com ftp transfer" << endl; + else { + for(unsigned int i=0; i< uploadFileListBox->count(); i++) + KIO::NetAccess::copy(KURL::fromPathOrURL( uploadFileListBox->text(i) ), + KURL::fromPathOrURL( getuploadURLLineEditText() + uploadFileListBox->text(i).replace(QRegExp("[^/]*/"),"") )); + } +} + +// QPushButton* uploadResetPushButton; +void DistpartDialog::slotuploadResetPushButtonPressed() { + uploadFileListBox->clear(); +} + +// Connect Slots to the following widgets and add +// accessors and mutators + + +// QCheckBox* customProjectCheckBox; +void DistpartDialog::slotcustomProjectCheckBoxChanged() { + kdDebug () << "New State" << customProjectCheckBox->isChecked() << endl; + sourceOptionsGroupBox->setEnabled( customProjectCheckBox->isChecked()); +} + +bool DistpartDialog::getcustomProjectCheckBoxState() { + return customProjectCheckBox->isChecked(); +} + +void DistpartDialog::setcustomProjectCheckBoxState(bool state) { + customProjectCheckBox->setChecked(state); +} + +// QCheckBox* uploadCustomCheckBox; +void DistpartDialog::slotuploadCustomCheckBoxChanged() { + uploadURLLineEdit->setEnabled( uploadCustomCheckBox->isChecked()); +} + +bool DistpartDialog::getuploadCustomCheckBoxState() { + return uploadCustomCheckBox->isChecked(); +} + +void DistpartDialog::setuploadCustomCheckBoxState(bool state) { + uploadCustomCheckBox->setChecked(state); +} + +// Add accessors and mutators for the following + +// QCheckBox* bzipCheckBox; +bool DistpartDialog::getbzipCheckBoxState() { + return bzipCheckBox->isChecked(); +} + +void DistpartDialog::setbzipCheckBoxState(bool state) { + bzipCheckBox->setChecked(state); +} + +// QCheckBox* appIconCheckBox; +bool DistpartDialog::getappIconCheckBoxState() { + return appIconCheckBox->isChecked(); +} + +void DistpartDialog::setappIconCheckBoxState(bool state) { + appIconCheckBox->setChecked(state); +} + +// QCheckBox* genHTMLCheckBox; +bool DistpartDialog::getgenHTMLCheckBoxState() { + return genHTMLCheckBox->isChecked(); +} + +void DistpartDialog::setgenHTMLCheckBoxState(bool state) { + genHTMLCheckBox->setChecked(state); +} + +// QCheckBox* useRPMInfoCheckBox; +bool DistpartDialog::getuseRPMInfoCheckBoxState() { + return useRPMInfoCheckBox->isChecked(); +} + +void DistpartDialog::setuseRPMInfoCheckBoxState(bool state) { + useRPMInfoCheckBox->setChecked(state); +} + +// QCheckBox* uploadAppsKDEcomCheckBox; +bool DistpartDialog::getuploadAppsKDEcomCheckBoxState() { + return uploadAppsKDEcomCheckBox->isChecked(); +} + +void DistpartDialog::setuploadAppsKDEcomCheckBoxState(bool state) { + uploadAppsKDEcomCheckBox->setChecked(state); +} + +// QCheckBox* uploadftpkdeorgCheckBox; +bool DistpartDialog::getuploadftpkdeorgCheckBoxState() { + return uploadftpkdeorgCheckBox->isChecked(); +} + +void DistpartDialog::setuploadftpkdeorgCheckBoxState(bool state) { + uploadftpkdeorgCheckBox->setChecked(state); +} + +// QCheckBox* devPackageCheckBox; +bool DistpartDialog::getdevPackageCheckBoxState() { + return devPackageCheckBox->isChecked(); +} + +void DistpartDialog::setdevPackageCheckBoxState(bool state) { + devPackageCheckBox->setChecked(state); +} + +// QCheckBox* docsPackageCheckBox; +bool DistpartDialog::getdocsPackageCheckBoxState() { + return docsPackageCheckBox->isChecked(); +} + +void DistpartDialog::setdocsPackageCheckBoxState(bool state) { + docsPackageCheckBox->setChecked(state); +} + +// QLineEdit* archNameFormatLineEdit; +QString DistpartDialog::getarchNameFormatLineEditText() { + return archNameFormatLineEdit->text(); +} + +void DistpartDialog::setarchNameFormatLineEditText(QString text) { + archNameFormatLineEdit->setText(text); +} + +// QLineEdit* appNameLineEdit; +QString DistpartDialog::getappNameFormatLineEditText() { + return appNameLineEdit->text(); +} + +void DistpartDialog::setappNameFormatLineEditText(QString text) { + appNameLineEdit->setText(text); +} + +// QLineEdit* summaryLineEdit; +QString DistpartDialog::getsummaryLineEditText() { + return summaryLineEdit->text(); +} + +void DistpartDialog::setsummaryLineEditText(QString text) { + summaryLineEdit->setText(text); +} + +// QLineEdit* groupLineEdit; +QString DistpartDialog::getgroupLineEditText() { + return groupLineEdit->text(); +} + +void DistpartDialog::setgroupLineEditText(QString text) { + groupLineEdit->setText(text); +} + +// QLineEdit* releaseLineEdit; +QString DistpartDialog::getreleaseLineEditText() { + return releaseLineEdit->text(); +} + +void DistpartDialog::setreleaseLineEditText(QString text) { + releaseLineEdit->setText(text); +} + +// QLineEdit* VersionLineEdit; +QString DistpartDialog::getversionLineEditText() { + return versionLineEdit->text(); +} + +void DistpartDialog::setversionLineEditText(QString text) { + versionLineEdit->setText( text ); +} + +// QLineEdit* VendorLineEdit; +QString DistpartDialog::getvendorLineEditText() { + return vendorLineEdit->text(); +} + +void DistpartDialog::setvendorLineEditText(QString text) { + vendorLineEdit->setText(text); +} + +// QLineEdit* LicenseLineEdit; +QString DistpartDialog::getlicenseLineEditText() { + return licenseLineEdit->text(); +} + +void DistpartDialog::setlicenseLineEditText(QString text) { + licenseLineEdit->setText(text); +} + +// QLineEdit* uploadURLLineEdit; +QString DistpartDialog::getuploadURLLineEditText() { + return uploadURLLineEdit->text(); +} + +void DistpartDialog::setuploadURLLineEditText(QString text) { + uploadURLLineEdit->setText(text); +} + +// QLineEdit* PackagerLineEdit; +QString DistpartDialog::getpackagerLineEditText() { + return packagerLineEdit->text(); +} + +void DistpartDialog::setpackagerLineEditText(QString text) { + packagerLineEdit->setText(text); +} + +// QComboBox* archComboBox; +QString DistpartDialog::getarchComboBoxText() { + return archComboBox->currentText(); +} + +int DistpartDialog::getarchComboBoxItem() { + return archComboBox->currentItem(); +} + +void DistpartDialog::setarchComboBoxItem(int item) { + archComboBox->setCurrentItem( item ); +} + +// QListBox* uploadFileListBox; +QString DistpartDialog::getuploadFileListBoxText() { + return uploadFileListBox->currentText(); +} + +int DistpartDialog::getuploadFileListBoxItem() { + return uploadFileListBox->currentItem(); +} + +void DistpartDialog::setuploadFileListBoxItem(int item) { + uploadFileListBox->setCurrentItem( item); +} + +// QListBox* srcDistFileListBox; +QString DistpartDialog::getsrcDistFileListBoxText() { + return srcDistFileListBox->currentText (); +} + +int DistpartDialog::getsrcDistFileListBoxItem() { + return srcDistFileListBox->currentItem (); +} + +void DistpartDialog::setsrcDistFileListBoxItem(int item) { + srcDistFileListBox->setCurrentItem( item ); +} + +// QMultiLineEdit* projectDescriptionMultilineEdit; +QString DistpartDialog::getprojectDescriptionMultilineEditText() { + return projectDescriptionMultilineEdit->text(); +} + +void DistpartDialog::setprojectDescriptionMultilineEditText(QString text) { + projectDescriptionMultilineEdit->setText(text); +} + +QString DistpartDialog::getprojectChangelogMultilineEditText() { + return projectChangelogMultilineEdit->text(); +} + +void DistpartDialog::setprojectChangelogMultilineEditText(QString text) { + projectChangelogMultilineEdit->setText(text); +} + +QString DistpartDialog::getSourceName() { + QString name = (getcustomProjectCheckBoxState()) ? getarchNameFormatLineEditText() : QString("%n-%v"); + name += (getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? ".tar.bz2" : ".tar.gz"; + return name.replace(QRegExp("%n"),getappNameFormatLineEditText()) + .replace(QRegExp("%v"),getversionLineEditText()) + .replace(QRegExp("%d"),QDate::currentDate().toString("yyyyMMdd")); +} + +void DistpartDialog::loadSettings() { + QDomDocument &dom = *m_part->projectDom(); + + srcDistFileListBox->insertStringList( m_part->project()->distFiles() ); + + // First Tab + setcustomProjectCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/custom",false)); + slotcustomProjectCheckBoxChanged(); + setbzipCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/bzip",false)); + setarchNameFormatLineEditText(DomUtil::readEntry(dom,"/dist/archname")); + + + // Second Tab + setappNameFormatLineEditText(DomUtil::readEntry(dom,"/dist/appname", m_part->project()->projectName() )); + setversionLineEditText(DomUtil::readEntry(dom,"/dist/version",DomUtil::readEntry(dom,"/general/version"))); + setreleaseLineEditText(DomUtil::readEntry(dom,"/dist/release")); + setvendorLineEditText(DomUtil::readEntry(dom,"/dist/vendor")); + setlicenseLineEditText(DomUtil::readEntry(dom,"/dist/licence")); + setsummaryLineEditText(DomUtil::readEntry(dom,"/dist/summary")); + setgroupLineEditText(DomUtil::readEntry(dom,"/dist/group")); + setpackagerLineEditText(DomUtil::readEntry(dom,"/dist/packager")); + setprojectDescriptionMultilineEditText(DomUtil::readEntry(dom,"/dist/description",DomUtil::readEntry(dom,"/general/description"))); + setprojectChangelogMultilineEditText(DomUtil::readEntry(dom,"/dist/changelog")); + setdevPackageCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/devpackage")); + setdocsPackageCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/docspackage")); + setappIconCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/appicon")); + setarchComboBoxItem(DomUtil::readIntEntry(dom,"/dist/arch")); + + // Third Tab + setgenHTMLCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/genHTML")); + setuseRPMInfoCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/useRPM")); + setuploadftpkdeorgCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/ftpkde")); + setuploadAppsKDEcomCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/appskde")); + setuploadCustomCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/custom")); + slotuploadCustomCheckBoxChanged(); + setuploadURLLineEditText(DomUtil::readEntry(dom,"/dist/url")); +} + +void DistpartDialog::storeSettings() { + QDomDocument &dom = *m_part->projectDom(); + + // First Tab + DomUtil::writeBoolEntry(dom,"/dist/custom",getcustomProjectCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/bzip",getbzipCheckBoxState()); + DomUtil::writeEntry(dom,"/dist/archname",getarchNameFormatLineEditText()); + + // Second Tab + DomUtil::writeEntry(dom,"/dist/appname",getappNameFormatLineEditText()); + DomUtil::writeEntry(dom,"/dist/version",getversionLineEditText()); + DomUtil::writeEntry(dom,"/dist/release",getreleaseLineEditText()); + DomUtil::writeEntry(dom,"/dist/vendor",getvendorLineEditText()); + DomUtil::writeEntry(dom,"/dist/licence",getlicenseLineEditText()); + DomUtil::writeEntry(dom,"/dist/summary",getsummaryLineEditText()); + DomUtil::writeEntry(dom,"/dist/group",getgroupLineEditText()); + DomUtil::writeEntry(dom,"/dist/packager",getpackagerLineEditText()); + DomUtil::writeEntry(dom,"/dist/description",getprojectDescriptionMultilineEditText()); + DomUtil::writeEntry(dom,"/dist/changelog",getprojectChangelogMultilineEditText()); + DomUtil::writeBoolEntry(dom,"/dist/devpackage",getdevPackageCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/docspackage",getdocsPackageCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/appicon",getappIconCheckBoxState()); + DomUtil::writeIntEntry(dom,"/dist/arch",getarchComboBoxItem()); + + // Third Tab + DomUtil::writeBoolEntry(dom,"/dist/genHTML",getgenHTMLCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/useRPM",getuseRPMInfoCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/ftpkde",getuploadftpkdeorgCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/appskde",getuploadAppsKDEcomCheckBoxState()); + DomUtil::writeBoolEntry(dom,"/dist/custom",getuploadCustomCheckBoxState()); + DomUtil::writeEntry(dom,"/dist/url",getuploadURLLineEditText()); +} +// Populate Spec Data from UI; +void DistpartDialog::setPackageData() +{ + m_spec->setAppRevision( releaseLineEdit->text()); + m_spec->setAppName( appNameLineEdit->text()); + m_spec->setAppVendor( vendorLineEdit->text()); + m_spec->setAppLicense( licenseLineEdit->text()); + m_spec->setAppSummary( summaryLineEdit->text()); + m_spec->setAppPackager( packagerLineEdit->text()); + m_spec->setAppVersion( versionLineEdit->text()); + m_spec->setAppGroup( groupLineEdit->text()); + m_spec->setAppDescription( projectDescriptionMultilineEdit->text()); + m_spec->setAppChangelog( projectChangelogMultilineEdit->text()); +} +// Populate UI from Spec data; +void DistpartDialog::getPackageData() +{ + releaseLineEdit->setText(m_spec->getAppRevision()); + appNameLineEdit->setText(m_spec->getAppName()); + vendorLineEdit->setText(m_spec->getAppVendor()); + licenseLineEdit->setText(m_spec->getAppLicense( )); + summaryLineEdit->setText(m_spec->getAppSummary( )); + packagerLineEdit->setText(m_spec->getAppPackager( )); + versionLineEdit->setText(m_spec->getAppVersion()); + groupLineEdit->setText(m_spec->getAppGroup( )); + projectDescriptionMultilineEdit->setText(m_spec->getAppDescription( )); + projectChangelogMultilineEdit->setText(m_spec->getAppChangelog( )); +} +void DistpartDialog::slotbuildAllPushButtonPressed( ) +{ + setPackageData(); + m_spec->slotbuildAllPushButtonPressed(); +} + +void DistpartDialog::slotexportSPECPushButtonPressed( ) +{ + setPackageData(); + m_spec->slotexportSPECPushButtonPressed(); +} + +void DistpartDialog::slotimportSPECPushButtonPressed( ) +{ + m_spec->slotimportSPECPushButtonPressed(); + getPackageData(); +} + +void DistpartDialog::slotsrcPackagePushButtonPressed( ) +{ + setPackageData(); + m_spec->slotsrcPackagePushButtonPressed(); +} + + +void DistpartDialog::slotAddFileButtonPressed(){ + QStringList filenames = KFileDialog::getOpenFileNames(); + for(uint count =0; count< filenames.size(); count++){ + QString base = m_part->project()->projectDirectory() +"/"; + srcDistFileListBox->insertItem(filenames[count].remove(base)); + } +} + +void DistpartDialog::slotRemoveFile(QListBoxItem *item){ + if ( KMessageBox::Yes == KMessageBox::warningYesNo( this, i18n("Remove %1").arg( item->text() ), i18n("Remove File") )){ + for(uint count =0; count< srcDistFileListBox->numRows(); count++){ + if ( item == srcDistFileListBox->item(count)){ + srcDistFileListBox->removeItem(count); + break; + } + } + } +} + +#include "distpart_widget.moc" diff --git a/parts/distpart/distpart_widget.h b/parts/distpart/distpart_widget.h new file mode 100644 index 00000000..81d91700 --- /dev/null +++ b/parts/distpart/distpart_widget.h @@ -0,0 +1,210 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 __DISTPART_WIDGET_H__ +#define __DISTPART_WIDGET_H__ + + +#include <qwidget.h> +#include <qstring.h> +#include "distpart_ui.h" +#include <klistbox.h> +#include <qcheckbox.h> +#include <kpushbutton.h> +#include <klineedit.h> +#include <ktextedit.h> +#include <qcombobox.h> +#include <qprogressbar.h> + +class KDevProject; +class DistpartPart; +class QUrlOperator; +class KProcess; +class QTabWidget; +class SpecSupport; + +namespace KParts { +class ReadOnlyPart; +} + + +class DistpartDialog : public distpart_ui { + Q_OBJECT + +public: + + DistpartDialog(DistpartPart *part, QWidget *parent); + ~DistpartDialog(); + +signals: + void okay(); + void cancel(); + void help(); + void createsrc(); + void resetsrc(); + void buildall(); + void savespec(); + void loadspec(); + void srcrpm(); + void genhtml(); + void resethtml(); + void upload(); + void resetupload(); + + // Accessors and mutators to control GUI + // Connect Slots to the following widgets + + +public slots: + // QPushButton* okayPushButton; + + + void slotokayPushButtonPressed(); + // QPushButton* cancelPushButton; + void slotcancelPushButtonPressed(); + // QPushButton* help_PushButton; +// void slothelp_PushButtonPressed(); + // QPushButton* createSrcArchPushButton; + void slotcreateSrcArchPushButtonPressed(); + // QPushButton* resetSrcPushButton; + void slotresetSrcPushButtonPressed(); + + // QPushButton* genHTMLPushButton; + void slotgenHTMLPushButtonPressed(); + // QPushButton* resetHTMLPushButton; + void slotresetHTMLPushButtonPressed(); + // QToolButton* uploadAddFileToolButton; + void slotuploadAddFileToolButtonPressed(); + // QToolButton* uploadRemoveToolButton; + void slotuploadRemoveToolButtonPressed(); + // QPushButton* uploadSubmitPushButton; + void slotuploadSubmitPushButtonPressed(); + // QPushButton* uploadResetPushButton; + void slotuploadResetPushButtonPressed(); + + // Connect Slots to the following widgets and add + // accessors and mutators + // QCheckBox* customProjectCheckBox; + void slotcustomProjectCheckBoxChanged(); + // QCheckBox* uploadCustomCheckBox; + void slotuploadCustomCheckBoxChanged(); + + void slotbuildAllPushButtonPressed(); + void slotexportSPECPushButtonPressed(); + void slotimportSPECPushButtonPressed(); + void slotsrcPackagePushButtonPressed(); + void slotAddFileButtonPressed(); + void slotRemoveFile(QListBoxItem *item); + +public: + bool getcustomProjectCheckBoxState(); + void setcustomProjectCheckBoxState(bool state); + bool getuploadCustomCheckBoxState(); + void setuploadCustomCheckBoxState(bool state); + + // Add accessors and mutators for the following + + // QCheckBox* bzipCheckBox; + bool getbzipCheckBoxState(); + void setbzipCheckBoxState(bool state); + // QCheckBox* appIconCheckBox; + bool getappIconCheckBoxState(); + void setappIconCheckBoxState(bool state); + // QCheckBox* genHTMLCheckBox; + bool getgenHTMLCheckBoxState(); + void setgenHTMLCheckBoxState(bool state); + // QCheckBox* useRPMInfoCheckBox; + bool getuseRPMInfoCheckBoxState(); + void setuseRPMInfoCheckBoxState(bool state); + // QCheckBox* uploadAppsKDEcomCheckBox; + bool getuploadAppsKDEcomCheckBoxState(); + void setuploadAppsKDEcomCheckBoxState(bool state); + // QCheckBox* uploadftpkdeorgCheckBox; + bool getuploadftpkdeorgCheckBoxState(); + void setuploadftpkdeorgCheckBoxState(bool state); + // QCheckBox* devPackageCheckBox; + bool getdevPackageCheckBoxState(); + void setdevPackageCheckBoxState(bool state); + // QCheckBox* docsPackageCheckBox; + bool getdocsPackageCheckBoxState(); + void setdocsPackageCheckBoxState(bool state); + // QLineEdit* archNameFormatLineEdit; + QString getarchNameFormatLineEditText(); + void setarchNameFormatLineEditText(QString text); + // QLineEdit* appNameLineEdit; + QString getappNameFormatLineEditText(); + void setappNameFormatLineEditText(QString text); + // QLineEdit* summaryLineEdit; + QString getsummaryLineEditText(); + void setsummaryLineEditText(QString text); + // QLineEdit* groupLineEdit; + QString getgroupLineEditText(); + void setgroupLineEditText(QString text); + // QLineEdit* releaseLineEdit; + QString getreleaseLineEditText(); + void setreleaseLineEditText(QString text); + // QLineEdit* VersionLineEdit; + QString getversionLineEditText(); + void setversionLineEditText(QString text); + // QLineEdit* VendorLineEdit; + QString getvendorLineEditText(); + void setvendorLineEditText(QString text); + // QLineEdit* LicenseLineEdit; + QString getlicenseLineEditText(); + void setlicenseLineEditText(QString text); + // QLineEdit* uploadURLLineEdit; + QString getuploadURLLineEditText(); + void setuploadURLLineEditText(QString text); + // QLineEdit* PackagerLineEdit; + QString getpackagerLineEditText(); + void setpackagerLineEditText(QString text); + // QComboBox* archComboBox; + QString getarchComboBoxText(); + int getarchComboBoxItem(); + void setarchComboBoxItem(int item); + // QListBox* uploadFileListBox; + QString getuploadFileListBoxText(); + int getuploadFileListBoxItem(); + void setuploadFileListBoxItem(int item); + // QListBox* srcDistFileListBox; + QString getsrcDistFileListBoxText(); + int getsrcDistFileListBoxItem(); + void setsrcDistFileListBoxItem(int item); + // QMultiLineEdit* projectDescriptionMultilineEdit; + QString getprojectDescriptionMultilineEditText(); + void setprojectDescriptionMultilineEditText(QString text); + + QString getprojectChangelogMultilineEditText(); + void setprojectChangelogMultilineEditText(QString text); + + QString getSourceName(); + +private: + void loadSettings(); + void storeSettings(); + void setPackageData(); + void getPackageData(); + + SpecSupport *m_spec; + DistpartPart *m_part; + QString dir; +}; + + +#endif diff --git a/parts/distpart/kdevdistpart.desktop b/parts/distpart/kdevdistpart.desktop new file mode 100644 index 00000000..8eaf44ee --- /dev/null +++ b/parts/distpart/kdevdistpart.desktop @@ -0,0 +1,70 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Aids in building and publishing the final project. Supports creation of RPM packages or source packages. +Comment[ca]=Ajuda en la construcció i publicació del projecte final. Suporta la creació de paquets RPM o paquets font. +Comment[da]=Hjælper til med at bygge og publicere det færdige projekt. Understøtter at oprette RPM-pakker og kildekodepakker. +Comment[de]=Unterstützt beim Erstellen und Ausliefern des fertigen Projekts. Derzeit werden RPM- und Quell-Pakete unterstützt. +Comment[el]=Βοηθά στην κατασκευή και δημοσίευση του τελικού έργου. Για την ώρα υποστηρίζεται μόνο η μορφή RPM. +Comment[es]=Ayuda en la construcción y publicación del proyecto final. Contempla la creación de paquetes RPM y de código fuente. +Comment[et]=Abi valmisprojekti ehitamisel ja avaldamisel. Toetatud on RPM-pakettide ja lähtekoodipakettide loomine. +Comment[fr]=Outil d'aide à la construction et à la publication du projet final. Prend en charge la création de paquetages RPM ou de paquetages de sources. +Comment[hu]=A projekt felépítésében és publikálásában segít. RPM és forráscsomagok készítését teszi lehetővé. +Comment[it]=Aiuta nella compilazione e pubblicazione del progetto finale. Supporta la creazione di pacchetti RPM o di pacchetti sorgenti. +Comment[ms]=Membantu dalam membina dan menerbitkan projek akhir. Menyokong penciptaan pakej RPM atau pakej sumber. +Comment[nds]=Ünnerstütten för't Opstellen un Apenmaken vun't fardige Projekt. Ünnerstütt dat Opstellen vun RPMs un Bornpaketen. +Comment[nl]=Helpt bij het bouwen en publiceren van het uiteindelijke project. Ondersteunt het aanmaken van RPM-pakketten of broncodepakketten. +Comment[pl]=Pomoc w budowaniu i publikowaniu projektu. Obsługuje tworzenie pakietów RPM i paczek ze źródłami. +Comment[pt]=Ajuda na construção e publicação do projecto final. Suporta a criação de pacotes RPM ou pacotes com código-fonte. +Comment[pt_BR]=Auxilia na compilação e publicação do projeto final. Suporta a criação de pacotes RPM ou pacotes fontes. +Comment[ru]=Помощник по сборке и распространению окончательных версий проекта. Поддерживает создание пакетов RPM или пакетов с исходным кодом. +Comment[sk]=Pomáha pri vytváraní a publikovaní finálneho projektu. Podporované sú RPM a zdrojové balíčky. +Comment[sr]=Помаже у грађењу и објављивању коначног пројекта. За сада је подржано стварање RPM и изворних пакета. +Comment[sr@Latn]=Pomaže u građenju i objavljivanju konačnog projekta. Za sada je podržano stvaranje RPM i izvornih paketa. +Comment[sv]=Hjälper till att bygga och publicera det färdiga projektet. Stöder att skapa RPM-paket och källkodspaket. +Comment[zh_TW]=協助建立與發布最終專案版本。支援建立 RPM 套件與 RPM 源碼套件。 +Name=KDevdistpart +Name[da]=KDevelop distpart +Name[de]=Unterstützung für Paketerstellung (KDevelop) +Name[hi]=के-डेव-डिस्टपार्ट +Name[nds]=Paketopstell-Ünnerstütten för't KDevelop +Name[sk]=KDev distribúcia +Name[sv]=KDevelop distributionsdel +Name[zh_TW]=KDevelop 發布元件 +GenericName=Final Packaging Support +GenericName[ca]=Suport per a l'empaquetat final +GenericName[da]=Endelig pakkestøtte +GenericName[de]=Unterstützung für Paketerstellung +GenericName[el]=Υποστήριξη τελικού πακέτου +GenericName[es]=Soporte para empaquetado final +GenericName[et]=Lõpp-pakendamise toetus +GenericName[eu]=Azken paketatze euskarria +GenericName[fa]=پشتیبانی بستهبندی نهایی +GenericName[fr]=Gestion du conditionnement final +GenericName[gl]=Soporte para empaquetado final +GenericName[hu]=Csomagelőkészítő +GenericName[it]=Supporto finale per la creazione di pacchetti +GenericName[ja]=最終パッケージ化サポート +GenericName[nds]=Ünnerstütten för't Paketopstellen +GenericName[ne]=अन्तिम प्याकेजिङ समर्थन +GenericName[nl]=Ondersteuning voor projectpublicatie +GenericName[pl]=Obsługa ostatecznego pakowania +GenericName[pt]=Suporte a Empacotamento Final +GenericName[pt_BR]=Suporte ao Empacotamento Final +GenericName[ru]=Сборка и распространение пакетов +GenericName[sk]=Podpora finálneho balíčkovania +GenericName[sl]=Podpora končnemu ustarjanju paketov +GenericName[sr]=Подршка за коначно паковање +GenericName[sr@Latn]=Podrška za konačno pakovanje +GenericName[sv]=Stöd för slutpaketering +GenericName[ta]=ஆதரவுள்ள கடைசி தொகுப்பு +GenericName[tg]=Ҷамъкунӣ ва ҷорӣ намудани пакетҳо +GenericName[tr]=Son Paketleme Desteği +GenericName[zh_CN]=最终打包支持 +GenericName[zh_TW]=最終包裝支援 +Icon=kdevelop +ServiceTypes=KDevelop/Plugin +X-KDE-Library=libkdevdistpart +X-KDevelop-Version=5 +X-KDevelop-Scope=Project +X-KDevelop-Properties=ProjectPackaging diff --git a/parts/distpart/kdevpart_distpart.rc b/parts/distpart/kdevpart_distpart.rc new file mode 100644 index 00000000..8b142d04 --- /dev/null +++ b/parts/distpart/kdevpart_distpart.rc @@ -0,0 +1,8 @@ +<!DOCTYPE kpartgui> +<kpartplugin name="distpart" library="libdistpartplugin" version="2"> +<MenuBar> + <Menu name="project"><Text>&Project</Text> + <Action name="make_dist" group="tools_project_operations"/> + </Menu> +</MenuBar> +</kpartplugin> diff --git a/parts/distpart/lsmsupport.cpp b/parts/distpart/lsmsupport.cpp new file mode 100644 index 00000000..84414f6a --- /dev/null +++ b/parts/distpart/lsmsupport.cpp @@ -0,0 +1,32 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 "lsmsupport.h" + +LsmSupport::LsmSupport() : packageBase() { + +} + +LsmSupport::~LsmSupport() { +} + +QString LsmSupport::generatePackage( ) +{ + return ""; +} diff --git a/parts/distpart/lsmsupport.h b/parts/distpart/lsmsupport.h new file mode 100644 index 00000000..3f50c7ea --- /dev/null +++ b/parts/distpart/lsmsupport.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 __LSMSUPPORT_H__ +#define __LSMSUPPORT_H__ + +#include "packagebase.h" +#include "distpart_part.h" + +class LsmSupport : public packageBase +{ + +public: + LsmSupport(); + virtual ~LsmSupport(); +QString generatePackage( ); +}; + +#endif diff --git a/parts/distpart/packagebase.cpp b/parts/distpart/packagebase.cpp new file mode 100644 index 00000000..797c2613 --- /dev/null +++ b/parts/distpart/packagebase.cpp @@ -0,0 +1,117 @@ +#include "packagebase.h" + +packageBase::packageBase() { + +} + +packageBase::~packageBase() {} + +QString packageBase::getAppName() { + return AppName; +} + +QString packageBase::getAppVersion() { + return AppVersion; +} + +QString packageBase::getAppRevision() { + return AppRevision; +} + +QString packageBase::getAppGroup() { + return AppGroup; +} + +QString packageBase::getAppPackager() { + return AppPackager; +} + +QString packageBase::getAppURL() { + return AppURL; +} + +QString packageBase::getAppSummary() { + return AppSummary; +} + +QString packageBase::getAppVendor() { + return AppVendor; +} + +QString packageBase::getAppLicense() { + return AppLicense; +} + +QString packageBase::getAppArch() { + return AppArch; +} + +QString packageBase::getAppDescription() { + return AppDescription; +} + +QString packageBase::getAppChangelog() { + return AppChangelog; +} + +QString packageBase::getAppSource() { + return AppSource; +} + +QStringList packageBase::getAppFileList() { + return AppFileList; +} + +void packageBase::setAppName(const QString& name) { + AppName = name; +} + +void packageBase::setAppVersion(const QString& version){ + AppVersion = version; +} + +void packageBase::setAppRevision(const QString& revision){ + AppRevision = revision; +} + +void packageBase::setAppGroup(const QString& group){ + AppGroup = group; +} + +void packageBase::setAppPackager(const QString& packager){ + AppPackager = packager; +} + +void packageBase::setAppURL(const QString& url) +{ + AppURL = url; +} + +void packageBase::setAppSummary(const QString& summary){ + AppSummary = summary; +} + +void packageBase::setAppVendor(const QString& vendor){ + AppVendor = vendor; +} + +void packageBase::setAppLicense(const QString& licence){ + AppLicense = licence; +} + +void packageBase::setAppArch(const QString& arch){ + AppArch = arch; +} + +void packageBase::setAppDescription(const QString& description){ + AppDescription = description; +} + +void packageBase::setAppChangelog(const QString& changelog){ + AppChangelog = changelog; +} + +void packageBase::setAppFileList( const QStringList & list ) +{ + AppFileList = list; +} diff --git a/parts/distpart/packagebase.h b/parts/distpart/packagebase.h new file mode 100644 index 00000000..17148982 --- /dev/null +++ b/parts/distpart/packagebase.h @@ -0,0 +1,84 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 __PACKAGEBASE_H__ +#define __PACKAGEBASE_H__ + +#include <kurl.h> +#include <qstringlist.h> + +class packageBase +{ + +public: + packageBase(); + virtual ~packageBase(); + +// Generic accessors and mutators for child classes + virtual QString generatePackage( ) = 0 ; + //virtual bool loadFile(KURL theFile) = 0; + //virtual bool saveFile(KURL theFile) = 0; + + virtual QString getAppName(); + virtual QString getAppVersion(); + virtual QString getAppRevision(); + virtual QString getAppGroup(); + virtual QString getAppPackager(); + virtual QString getAppURL(); + virtual QString getAppSummary(); + virtual QString getAppVendor(); + virtual QString getAppLicense(); + virtual QString getAppArch(); + virtual QString getAppDescription(); + virtual QString getAppChangelog(); + virtual QString getAppSource(); + virtual QStringList getAppFileList(); + + virtual void setAppName(const QString&); + virtual void setAppVersion(const QString&); + virtual void setAppRevision(const QString&); + virtual void setAppGroup(const QString&); + virtual void setAppPackager(const QString&); + virtual void setAppURL(const QString&); + virtual void setAppSummary(const QString&); + virtual void setAppVendor(const QString&); + virtual void setAppLicense(const QString&); + virtual void setAppArch(const QString&); + virtual void setAppDescription(const QString&); + virtual void setAppChangelog(const QString&); + virtual void setAppFileList(const QStringList &list); + + private: + QString AppName; + QString AppVersion; + QString AppRevision; + QString AppGroup; + QString AppPackager; + QString AppURL; + QString AppSummary; + QString AppVendor; + QString AppLicense; + QString AppArch; + QString AppDescription; + QString AppChangelog; + QString AppSource; + QStringList AppFileList; +}; + +#endif diff --git a/parts/distpart/specsupport.cpp b/parts/distpart/specsupport.cpp new file mode 100644 index 00000000..b9ba6e1e --- /dev/null +++ b/parts/distpart/specsupport.cpp @@ -0,0 +1,315 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 "specsupport.h" +#include "kdevproject.h" +#include "kdevmakefrontend.h" +#include "distpart_widget.h" + +#include <kdebug.h> +#include <kfiledialog.h> +#include <klocale.h> +#include <kprocess.h> +#include <qfile.h> +#include <qdir.h> +#include <qerrormessage.h> +#include <qregexp.h> +#include <qpushbutton.h> +//#include <qvbox.h> +#include <qgroupbox.h> +#include <qtabwidget.h> +#include <qmessagebox.h> + +/// \FIXME This is at least the fifth place in the kdevelop code something like this exists +QString QRegExp_escape(const QString& str ) +{ +#if QT_VERSION >= 0x030100 + return QRegExp::escape(str); +#else + // this block is copyrighted by Trolltech AS (GPL) + static const char meta[] = "$()*+.?[\\]^{|}"; + QString quoted = str; + int i = 0; + + while ( i < (int) quoted.length() ) { + if ( strchr(meta, quoted[i].latin1()) != 0 ) + quoted.insert( i++, "\\" ); + i++; + } + return quoted; +#endif +} + +SpecSupport::SpecSupport(DistpartPart *part) : packageBase(), m_part(part) { + dir = ""; + +// srcPackagePushButton = new QPushButton(i18n("Src Package"),area()); +// buildAllPushButton = new QPushButton(i18n("Src/Binary Packages"),area()); +// exportSPECPushButton = new QPushButton(i18n("Export SPEC File"),area()); +// importSPECPushButton = new QPushButton(i18n("Import SPEC File"),area()); +// +// +// +// connect(buildAllPushButton, SIGNAL(clicked()), +// this, SLOT(slotbuildAllPushButtonPressed())); +// connect(exportSPECPushButton, SIGNAL(clicked()), +// this, SLOT(slotexportSPECPushButtonPressed())); +// connect(importSPECPushButton, SIGNAL(clicked()), +// this, SLOT(slotimportSPECPushButtonPressed())); +// connect(srcPackagePushButton, SIGNAL(clicked()), +// this, SLOT(slotsrcPackagePushButtonPressed())); + + parseDotRpmmacros(); +} + +SpecSupport::~SpecSupport() { +} + +// QPushButton* buildAllPushButton; +void SpecSupport::slotbuildAllPushButtonPressed() { + QMap<QString,QString>::Iterator it; + QFile file1(dir + "/" + getAppSource()); + QFile file2(*(map.find("_sourcedir")) + "/" + getAppSource()); + if (!file2.exists()) { + if (!file1.exists()) { + QMessageBox::critical(0 ,i18n("Error"),i18n("You need to create a source archive first.")); + return; + } + else + if (KDevMakeFrontend *makeFrontend = m_part->extension<KDevMakeFrontend>("KDevelop/MakeFrontend")) + makeFrontend->queueCommand(dir,"cd " + KProcess::quote(dir) + + " && cp " + KProcess::quote(getAppSource()) + " " + KProcess::quote(*(map.find("_sourcedir")))); + } + if (KDevMakeFrontend *makeFrontend = m_part->extension<KDevMakeFrontend>("KDevelop/MakeFrontend")) + makeFrontend->queueCommand(dir,"cd " + KProcess::quote((((it = map.find("_specdir")) != map.end()) ? (*it) : dir)) + + " && rpmbuild -ba " + m_part->project()->projectName() + ".spec"); +} + +// QPushButton* exportSPECPushButton; +void SpecSupport::slotexportSPECPushButtonPressed() { + QMap<QString,QString>::Iterator it; + QString specname = ((it = map.find("_specdir")) != map.end()) ? (*it) : (m_part->project()->projectDirectory()); + specname += ("/" + m_part->project()->projectName() + ".spec"); + QFile file(specname); + + if(file.open(IO_WriteOnly)) { + QTextStream stream(&file); + stream << generatePackage(); + file.close(); + } else { + kdDebug() << "TODO : intercept write error in SpecSupport::slotexportSPECPushButtonPressed()"; + } +} + +QString SpecSupport::getInfo(QString s, QString motif) { + QRegExp re(motif + "[ \t]*([^ \t].*[^ \t])[ \t]*"); + if (re.exactMatch(s)) + return re.cap(1); + return QString::null; +} + +// QPushButton* importSPECPushButton; +void SpecSupport::slotimportSPECPushButtonPressed() { + QString fileName = KFileDialog::getOpenFileName(dir,"*.spec"); + if( fileName.isEmpty()) + return; + QFile file(fileName); + + if(file.open(IO_ReadOnly)) { + QTextStream stream(&file); + + while (!stream.atEnd()) { + QString s = stream.readLine(); + QString info; + if (!(info = getInfo(s,"Name:")).isEmpty()) + setAppName(info); + else if (!(info = getInfo(s,"Version:")).isEmpty()) + setAppVersion(info); + else if (!(info = getInfo(s,"Release:")).isEmpty()) + setAppRevision(info); + else if (!(info = getInfo(s,"Vendor:")).isEmpty()) + setAppVendor(info); + else if (!(info = getInfo(s,"Copyright:")).isEmpty()) + setAppLicense(info); + else if (!(info = getInfo(s,"Summary:")).isEmpty()) + setAppSummary(info); + else if (!(info = getInfo(s,"Group:")).isEmpty()) + setAppGroup(info); + else if (!(info = getInfo(s,"Packager:")).isEmpty()) + setAppPackager(info); + else if (s.startsWith("%description")) { + QString desc; + while (!stream.atEnd()) { + QString str = stream.readLine(); + if (str.startsWith("%")) break; + else desc += str + "\n"; + } + setAppDescription(desc); + } + else if (s.startsWith("%changelog")) { + QString change; + while (!stream.atEnd()) { + QString str = stream.readLine(); + if (str.startsWith("%")) break; + else change += str + "\n"; + } + setAppChangelog(change); + } + } + } +} + +void SpecSupport::slotAddFileButtonPressed(){ +QString filename = KFileDialog::getOpenFileName (); +} + +// QPushButton* srcPackagePushButton; +void SpecSupport::slotsrcPackagePushButtonPressed() { + QMap<QString,QString>::Iterator it; + + QFile file1(dir + "/" + getAppSource()); + QFile file2(*(map.find("_sourcedir")) + "/" + getAppSource()); + if (!file2.exists()) { + if (!file1.exists()) { + QMessageBox::critical(0,i18n("Error"),i18n("You need to create a source archive first.")); + return; + } + else + if (KDevMakeFrontend *makeFrontend = m_part->extension<KDevMakeFrontend>("KDevelop/MakeFrontend")) + makeFrontend->queueCommand(dir,"cd " + KProcess::quote(dir) + + " && cp " + KProcess::quote(getAppSource()) + " " + KProcess::quote(*(map.find("_sourcedir")))); + } + if (KDevMakeFrontend *makeFrontend = m_part->extension<KDevMakeFrontend>("KDevelop/MakeFrontend")) + makeFrontend->queueCommand(dir,"cd " + KProcess::quote((((it = map.find("_specdir")) != map.end()) ? (*it) : dir)) + + " && rpmbuild -bs " + m_part->project()->projectName() + ".spec"); +} + +void SpecSupport::parseDotRpmmacros() { + QFile dotfile(QDir::homeDirPath() + "/.rpmmacros"); + + if (!dotfile.open(IO_ReadOnly)) { +// QErrorMessage * msg = new QErrorMessage(this); +// msg->message("It seems you don't have a ~/.rpmmacros\nYou may experience problems building packages.\n"); +// msg->exec(); + return; + } + QTextStream stream(&dotfile); + + // Perhaps will it appear as a necessity to parse the global rpm config file? + + // Pre defined macros : + map.insert("name",getAppName()); + + // .rpmmacros parsing : + while (!stream.atEnd()) { + QString s = stream.readLine(); + QRegExp re("%([^ \t]*)[ \t][ \t]*([^\t]*)$"); + if(re.exactMatch(s)) { + QRegExp subst("%\\{([^%]*)\\}"); + QString value = re.cap(2).stripWhiteSpace(); + + while(subst.search(value) != -1) { + value.replace(QRegExp("%\\{"+ QRegExp_escape( subst.cap(1) ) +"\\}"),*map.find(subst.cap(1))); + } + map.insert(re.cap(1),value); + } + } + dotfile.close(); + + // create directories if necessary : + createRpmDirectoryFromMacro("_topdir"); + createRpmDirectoryFromMacro("_tmppath"); + createRpmDirectoryFromMacro("_builddir"); + createRpmDirectoryFromMacro("_rpmdir"); + createRpmDirectoryFromMacro("_sourcedir"); + createRpmDirectoryFromMacro("_specdir"); + createRpmDirectoryFromMacro("_srcrpmdir"); +} + +bool SpecSupport::createRpmDirectoryFromMacro(const QString & name) { + QMap<QString,QString>::Iterator it; + if((it = map.find(name)) != map.end()) { + QDir dir(*it); + if (!dir.exists()) return dir.mkdir(*it); + } + return false; +} + +QString SpecSupport::generatePackage( ) +{ + QString spec; + spec += "# This spec file was generated by KDevelop \n"; + spec += "# Please report any problem to KDevelop Team <kdevelop-devel@kdevelop.org> \n"; + spec += "# Thanks to Matthias Saou for his explanations on http://freshrpms.net/docs/fight.html\n\n"; + + spec += "Name: " + getAppName() + "\n"; + spec += "Version: " + getAppVersion() + "\n"; + spec += "Release: " + getAppRevision() + "\n"; + spec += "Vendor: " + getAppVendor() + "\n"; + spec += "Copyright: " + getAppLicense() + "\n"; + spec += "Summary: " + getAppSummary() + "\n"; + spec += "Group: " + getAppGroup() + "\n"; + spec += "Packager: " + getAppPackager() + "\n"; + spec += "BuildRoot: %{_tmppath}/%{name}-root \n"; + spec += "Source: " + getAppSource() + "\n"; + + spec += "\n"; + spec += "%description\n"; + spec += getAppDescription()+ "\n"; + + spec += "\n"; + spec += "%prep\n"; + spec += "%setup\n"; + spec += "CFLAGS=\"$RPM_OPT_FLAGS\" CXXFLAGS=\"$RPM_OPT_FLAGS\" ./configure \\ \n"; + spec += "--target=" + getAppArch() + "\n"; + spec += "--disable-debug --enable-debug=no \n"; + + spec += "\n"; + spec += "%build\n"; + spec += "%configure\n"; + spec += "make\n"; + + spec += "\n"; + spec += "%install\n"; + spec += "rm -rf %{buildroot}\n"; + spec += "%makeinstall\n"; + + spec += "\n"; + spec += "%clean\n"; + spec += "rm -rf %{buildroot}\n"; + + spec += "\n"; + spec += "%post -p /sbin/ldconfig\n"; + + spec += "%postun -p /sbin/ldconfig\n"; + + spec += "%files\n"; + spec += "%defattr(-, root, root)\n"; + spec += "%doc AUTHORS COPYING ChangeLog NEWS README TODO\n"; + spec += "%{_bindir}/*\n"; + spec += "%{_libdir}/*.so.*\n"; + spec += "%{_datadir}/%{name}\n"; + spec += "%{_mandir}/man8/*\n"; + + spec += "%changelog\n"; + spec += getAppChangelog() + "\n"; + + return spec; +} diff --git a/parts/distpart/specsupport.h b/parts/distpart/specsupport.h new file mode 100644 index 00000000..d64642e9 --- /dev/null +++ b/parts/distpart/specsupport.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2004 by ian reinhart geiser * + * geiseri@kde.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 __SPECSUPPORT_H__ +#define __SPECSUPPORT_H__ + +#include <qstring.h> +#include <qmap.h> +#include "packagebase.h" +#include "distpart_part.h" +#include "distpart_widget.h" + +class SpecSupport : public packageBase { + +public: + SpecSupport(DistpartPart *part); + ~SpecSupport(); + +public: + QString generatePackage(); + void slotbuildAllPushButtonPressed(); + void slotexportSPECPushButtonPressed(); + void slotimportSPECPushButtonPressed(); + void slotsrcPackagePushButtonPressed(); + void slotAddFileButtonPressed(); + +private: + void parseDotRpmmacros(); + bool createRpmDirectoryFromMacro(const QString & name); + + QString getInfo(QString s, QString motif); + + QString dir; + DistpartPart *m_part; + QMap<QString,QString> map; +}; + +#endif |