summaryrefslogtreecommitdiffstats
path: root/buildtools/autotools
diff options
context:
space:
mode:
Diffstat (limited to 'buildtools/autotools')
-rw-r--r--buildtools/autotools/Makefile.am38
-rw-r--r--buildtools/autotools/README1
-rw-r--r--buildtools/autotools/README.dox39
-rw-r--r--buildtools/autotools/addapplicationdlg.cpp207
-rw-r--r--buildtools/autotools/addapplicationdlg.h45
-rw-r--r--buildtools/autotools/addapplicationdlgbase.ui552
-rw-r--r--buildtools/autotools/addexistingdirectoriesdlg.cpp388
-rw-r--r--buildtools/autotools/addexistingdirectoriesdlg.h74
-rw-r--r--buildtools/autotools/addexistingdlgbase.ui459
-rw-r--r--buildtools/autotools/addexistingfilesdlg.cpp451
-rw-r--r--buildtools/autotools/addexistingfilesdlg.h77
-rw-r--r--buildtools/autotools/addfiledlg.cpp135
-rw-r--r--buildtools/autotools/addfiledlg.h47
-rw-r--r--buildtools/autotools/addfiledlgbase.ui289
-rw-r--r--buildtools/autotools/addicondlg.cpp115
-rw-r--r--buildtools/autotools/addicondlg.h44
-rw-r--r--buildtools/autotools/addicondlgbase.ui273
-rw-r--r--buildtools/autotools/addprefixdlg.cpp76
-rw-r--r--buildtools/autotools/addprefixdlg.h45
-rw-r--r--buildtools/autotools/addservicedlg.cpp233
-rw-r--r--buildtools/autotools/addservicedlg.h46
-rw-r--r--buildtools/autotools/addservicedlgbase.ui544
-rw-r--r--buildtools/autotools/addsubprojectdlg.cpp198
-rw-r--r--buildtools/autotools/addsubprojectdlg.h44
-rw-r--r--buildtools/autotools/addsubprojectdlgbase.ui198
-rw-r--r--buildtools/autotools/addtargetdlg.cpp226
-rw-r--r--buildtools/autotools/addtargetdlg.h43
-rw-r--r--buildtools/autotools/addtargetdlgbase.ui348
-rw-r--r--buildtools/autotools/addtranslationdlg.cpp109
-rw-r--r--buildtools/autotools/addtranslationdlg.h36
-rw-r--r--buildtools/autotools/autodetailsview.cpp728
-rw-r--r--buildtools/autotools/autodetailsview.h88
-rw-r--r--buildtools/autotools/autolistviewitems.cpp181
-rw-r--r--buildtools/autotools/autolistviewitems.h143
-rw-r--r--buildtools/autotools/autoprojectpart.cpp1474
-rw-r--r--buildtools/autotools/autoprojectpart.h153
-rw-r--r--buildtools/autotools/autoprojectviewbase.ui123
-rw-r--r--buildtools/autotools/autoprojectwidget.cpp748
-rw-r--r--buildtools/autotools/autoprojectwidget.h229
-rw-r--r--buildtools/autotools/autosubprojectview.cpp1137
-rw-r--r--buildtools/autotools/autosubprojectview.h130
-rw-r--r--buildtools/autotools/autotoolsaction.cpp156
-rw-r--r--buildtools/autotools/autotoolsaction.h70
-rw-r--r--buildtools/autotools/choosetargetdialog.cpp348
-rw-r--r--buildtools/autotools/choosetargetdialog.h57
-rw-r--r--buildtools/autotools/choosetargetdlgbase.ui222
-rw-r--r--buildtools/autotools/configureoptionswidget.cpp431
-rw-r--r--buildtools/autotools/configureoptionswidget.h69
-rw-r--r--buildtools/autotools/configureoptionswidgetbase.ui1040
-rw-r--r--buildtools/autotools/fileselectorwidget.cpp243
-rw-r--r--buildtools/autotools/fileselectorwidget.h96
-rw-r--r--buildtools/autotools/kdevautoproject.desktop97
-rw-r--r--buildtools/autotools/kdevautoproject.rc30
-rw-r--r--buildtools/autotools/kdevkdeautoproject.desktop92
-rw-r--r--buildtools/autotools/kfilednddetailview.cpp212
-rw-r--r--buildtools/autotools/kfilednddetailview.h136
-rw-r--r--buildtools/autotools/kfiledndiconview.cpp194
-rw-r--r--buildtools/autotools/kfiledndiconview.h128
-rw-r--r--buildtools/autotools/kimporticonview.cpp87
-rw-r--r--buildtools/autotools/kimporticonview.h44
-rw-r--r--buildtools/autotools/makefilehandler.cpp166
-rw-r--r--buildtools/autotools/makefilehandler.h76
-rw-r--r--buildtools/autotools/managecustomcommand.cpp49
-rw-r--r--buildtools/autotools/managecustomcommand.h37
-rw-r--r--buildtools/autotools/managecustomcommandsbase.ui125
-rw-r--r--buildtools/autotools/misc.cpp999
-rw-r--r--buildtools/autotools/misc.h65
-rw-r--r--buildtools/autotools/removefiledlg.cpp182
-rw-r--r--buildtools/autotools/removefiledlg.h51
-rw-r--r--buildtools/autotools/removefiledlgbase.ui233
-rw-r--r--buildtools/autotools/removetargetdlg.cpp279
-rw-r--r--buildtools/autotools/removetargetdlg.h55
-rw-r--r--buildtools/autotools/removetargetdlgbase.ui264
-rw-r--r--buildtools/autotools/subprojectoptionsdlg.cpp404
-rw-r--r--buildtools/autotools/subprojectoptionsdlg.h63
-rw-r--r--buildtools/autotools/subprojectoptionsdlgbase.ui989
-rw-r--r--buildtools/autotools/targetoptionsdlg.cpp357
-rw-r--r--buildtools/autotools/targetoptionsdlg.h49
-rw-r--r--buildtools/autotools/targetoptionsdlgbase.ui726
79 files changed, 19435 insertions, 0 deletions
diff --git a/buildtools/autotools/Makefile.am b/buildtools/autotools/Makefile.am
new file mode 100644
index 00000000..5972b662
--- /dev/null
+++ b/buildtools/autotools/Makefile.am
@@ -0,0 +1,38 @@
+# Here resides the automake project part.
+
+INCLUDES = -I$(top_srcdir)/buildtools/lib -I$(top_srcdir)/buildtools/lib/base \
+ -I$(top_srcdir)/buildtools/lib/parsers/autotools -I$(top_srcdir)/buildtools/lib/widgets -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external \
+ -I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util $(all_includes) \
+ -I$(top_builddir)/buildtools/lib/widgets
+
+
+kde_module_LTLIBRARIES = libkdevautoproject.la
+libkdevautoproject_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevautoproject_la_LIBADD = \
+ $(top_builddir)/buildtools/lib/base/libkdevbuildbase.la \
+ $(top_builddir)/buildtools/lib/parsers/autotools/libkdevautotoolsparser.la $(top_builddir)/buildtools/lib/widgets/libkdevbuildtoolswidgets.la \
+ $(top_builddir)/lib/interfaces/extras/libkdevextras.la $(top_builddir)/lib/libkdevelop.la
+
+libkdevautoproject_la_SOURCES = autoprojectpart.cpp autoprojectwidget.cpp \
+ configureoptionswidget.cpp configureoptionswidgetbase.ui subprojectoptionsdlg.cpp \
+ subprojectoptionsdlgbase.ui targetoptionsdlg.cpp targetoptionsdlgbase.ui addservicedlg.cpp \
+ addservicedlgbase.ui addapplicationdlg.cpp addapplicationdlgbase.ui addtargetdlg.cpp \
+ addtargetdlgbase.ui addsubprojectdlg.cpp addfiledlgbase.ui addfiledlg.cpp \
+ removefiledlgbase.ui removefiledlg.cpp addicondlgbase.ui addicondlg.cpp \
+ addtranslationdlg.cpp addprefixdlg.cpp kfilednddetailview.cpp kfiledndiconview.cpp \
+ fileselectorwidget.cpp misc.cpp addsubprojectdlgbase.ui removetargetdlg.cpp \
+ removetargetdlgbase.ui choosetargetdialog.cpp choosetargetdlgbase.ui addexistingdlgbase.ui \
+ addexistingfilesdlg.cpp addexistingdirectoriesdlg.cpp kimporticonview.cpp \
+ autosubprojectview.cpp autodetailsview.cpp autolistviewitems.cpp managecustomcommandsbase.ui \
+ managecustomcommand.cpp autoprojectviewbase.ui autotoolsaction.cpp makefilehandler.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevautoproject.desktop kdevkdeautoproject.desktop
+
+rcdir = $(kde_datadir)/kdevautoproject
+rc_DATA = kdevautoproject.rc
+
+noinst_HEADERS = managecustomcommand.h autotoolsaction.h makefilehandler.h
diff --git a/buildtools/autotools/README b/buildtools/autotools/README
new file mode 100644
index 00000000..487cec41
--- /dev/null
+++ b/buildtools/autotools/README
@@ -0,0 +1 @@
+Please read the README.dox file
diff --git a/buildtools/autotools/README.dox b/buildtools/autotools/README.dox
new file mode 100644
index 00000000..acad3e64
--- /dev/null
+++ b/buildtools/autotools/README.dox
@@ -0,0 +1,39 @@
+/** \class AutoProjectPart
+Autoprojectpart is a projectmanager for Automake based projects.
+
+Loads and maintains Makefile.am files.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:victor_roeder AT gmx.de">Victor Röder</a>
+\maintainer <a href="mailto:a.lucas AT tu-bs.de">Amilcar do Carmo Lucas</a>
+
+\feature supports creating subprojects, targets, services (.desktop) and applications (.desktop).
+\feature Automake projects can be configured on subprojects, targets (except DATA and HEADER targets).
+\feature It will regenerate the projects Makefile.am files dynamically as you add or
+reconfigure subprojects**.
+\feature Unsupported automake features will be left unchanged
+(hopefully), no major testing has been run yet (at least not by myself).
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=autoproject&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number"> autoproject component at Bugzilla database</a>
+\bug Lower Automake Manager view does not update it's view when adding a subproject (and targets, etc to the new subproject)
+\bug If removing the Active Target, update the .kdevelop file, too!
+
+
+\note
+If you want to change the default implemention for running/starting the binary
+please add the following to your project file
+\verbatim
+<kdevautoproject>
+ <run>
+ <disable_default>true</disable_default>
+ </run>
+</kdevautoproject>
+\endverbatim
+with this configuration the "Automake Manager" doesn't insert the menuentry "execute program"
+and doesn't show the "Run Options" in the project configuration.<br>
+Now you can implement this features with your own special plugin.
+For an example please look at the projects generated for GBA using the VisualBoy Advance Plugin.
+This plugin starts a GBA binary with an emulator. -- <a href="mailto:smeier AT kdevelop.org">Sandy Meier</a>
+
+*/
diff --git a/buildtools/autotools/addapplicationdlg.cpp b/buildtools/autotools/addapplicationdlg.cpp
new file mode 100644
index 00000000..04e132dd
--- /dev/null
+++ b/buildtools/autotools/addapplicationdlg.cpp
@@ -0,0 +1,207 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "addapplicationdlg.h"
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qfile.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qtextstream.h>
+#include <qapplication.h>
+#include <klineedit.h>
+#include <kdebug.h>
+#include <kicondialog.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kmimetype.h>
+
+#include "autolistviewitems.h"
+
+#include "misc.h"
+#include "autoprojectwidget.h"
+#include "autoprojectpart.h"
+
+
+AddApplicationDialog::AddApplicationDialog(AutoProjectWidget *widget, SubprojectItem *spitem,
+ QWidget *parent, const char *name)
+ : AddApplicationDialogBase(parent, name, true)
+{
+ filename_edit->setText(".desktop");
+ filename_edit->home(false);
+ filename_edit->setFocus();
+ chosentypes_listview->header()->hide();
+ availtypes_listview->header()->hide();
+ QString addApplication = add_button->text();
+ QString removeApplication = remove_button->text();
+
+ add_button->setText( QApplication::reverseLayout() ? removeApplication : addApplication );
+ remove_button->setText( QApplication::reverseLayout() ? addApplication : removeApplication );
+
+ m_widget = widget;
+ subProject = spitem;
+
+ // Fill the combo box with program names in the directory
+ QPtrListIterator<TargetItem> tit(spitem->targets);
+ for (; tit.current(); ++tit) {
+ if ((*tit)->primary == "PROGRAMS")
+ executable_combo->insertItem(QString((*tit)->name));
+ }
+
+ // Fill the list of available mime types
+ KMimeType::List l = KMimeType::allMimeTypes();
+ KMimeType::List::Iterator it;
+ for (it = l.begin(); it != l.end(); ++it)
+ new QListViewItem(availtypes_listview, (*it)->name());
+
+ setIcon ( SmallIcon ( "window_new" ) );
+}
+
+
+AddApplicationDialog::~AddApplicationDialog()
+{}
+
+
+void AddApplicationDialog::iconClicked()
+{
+ KIconLoader *loader = AutoProjectFactory::instance()->iconLoader();
+ QString name = KIconDialog::getIcon(KIcon::Desktop);
+ if (!name.isNull()) {
+ iconName = name;
+ icon_button->setPixmap(loader->loadIcon(name, KIcon::Desktop));
+ }
+}
+
+
+void AddApplicationDialog::addTypeClicked()
+{
+ QListViewItem *selitem = availtypes_listview->selectedItem();
+ if (!selitem)
+ return;
+
+ QListViewItem *olditem = chosentypes_listview->firstChild();
+ while (olditem) {
+ if (selitem->text(0) == olditem->text(0))
+ return;
+ olditem = olditem->nextSibling();
+ }
+ new QListViewItem(chosentypes_listview, selitem->text(0));
+}
+
+
+void AddApplicationDialog::removeTypeClicked()
+{
+ delete chosentypes_listview->currentItem();
+}
+
+
+void AddApplicationDialog::accept()
+{
+ // Create list of mime types
+ QStringList mimeTypes;
+ QListViewItem *item = chosentypes_listview->firstChild();
+ while (item) {
+ mimeTypes.append(item->text(0));
+ item = item->nextSibling();
+ }
+
+ // Some plausibility tests
+ QString fileName = filename_edit->text();
+ if (fileName.isEmpty() || fileName == ".desktop") {
+ KMessageBox::sorry(this, i18n("You have to enter a file name."));
+ filename_edit->setFocus();
+ return;
+ }
+
+ QString executable = executable_combo->currentText();
+ if (executable.isEmpty()) {
+ KMessageBox::sorry(this, i18n("You have to enter the file name of an executable program."));
+ executable_combo->setFocus();
+ return;
+ }
+
+ QString name = name_edit->text();
+ if (name.isEmpty()) {
+ KMessageBox::sorry(this, i18n("You have to enter an application name."));
+ name_edit->setFocus();
+ return;
+ }
+
+ QFile f(subProject->path + "/" + fileName);
+ if (f.exists()) {
+ KMessageBox::sorry(this, i18n("A file with this name exists already."));
+ filename_edit->setFocus();
+ return;
+ }
+ if (!f.open(IO_WriteOnly)) {
+ KMessageBox::sorry(this, i18n("Could not open file for writing."));
+ return;
+ }
+
+ QTextStream stream(&f);
+ stream << "[Desktop Entry]" << endl;
+ stream << "Type=Application" << endl;
+ stream << "Name=" << name << endl;
+ stream << "Exec=" << (executable + " -caption \"%c\" %i %m %u") << endl;
+ stream << "Comment=" << comment_edit->text() << endl;
+ if (!iconName.isNull())
+ stream << "Icon=" << iconName << endl;
+ stream << "MimeTypes=" << mimeTypes.join(";") << endl;
+ stream << "Terminal=" << (terminal_box->isChecked()? "true" : "false") << endl;
+ f.close();
+
+ // Find a prefix that points to the applnk directory.
+ // If there is none, use appslnksection
+ QString section = section_combo->currentText();
+ QString appsdir = "$(kde_appsdir)/" + section;
+ QMap<QString,QString>::ConstIterator it;
+ for (it = subProject->prefixes.begin(); it != subProject->prefixes.end(); ++it)
+ if (it.data() == appsdir)
+ break;
+
+ QMap<QString, QString> replaceMap;
+ QString prefix;
+ if (it == subProject->prefixes.end()) {
+ prefix = "applnk" + section;
+ replaceMap.insert(prefix + "dir", appsdir);
+ subProject->prefixes.insert(prefix, appsdir);
+ } else {
+ prefix = it.key();
+ }
+ QString varname = prefix + "_DATA";
+
+ // Look if a list view item for this prefix exists already.
+ // Create a new one otherwise
+ TargetItem *titem = 0;
+ for (uint i=0; i < subProject->targets.count(); ++i) {
+ TargetItem *tmptitem = subProject->targets.at(i);
+ if ("DATA" == tmptitem->primary && prefix == tmptitem->prefix) {
+ titem = tmptitem;
+ break;
+ }
+ }
+ if (!titem) {
+ titem = m_widget->createTargetItem("", prefix, "DATA", false);
+ subProject->targets.append(titem);
+ }
+ // Add this file to the target
+ FileItem *fitem = m_widget->createFileItem(fileName, subProject);
+ titem->sources.append(fitem);
+
+ subProject->variables[varname] += (" " + fileName);
+ replaceMap.insert(varname, subProject->variables[varname]);
+ AutoProjectTool::addToMakefileam(subProject->path + "/Makefile.am", replaceMap);
+
+ QDialog::accept();
+}
+
+#include "addapplicationdlg.moc"
diff --git a/buildtools/autotools/addapplicationdlg.h b/buildtools/autotools/addapplicationdlg.h
new file mode 100644
index 00000000..d9f8e6fc
--- /dev/null
+++ b/buildtools/autotools/addapplicationdlg.h
@@ -0,0 +1,45 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _ADDAPPLICATIONDLG_H_
+#define _ADDAPPLICATIONDLG_H_
+
+#include "addapplicationdlgbase.h"
+
+class AutoProjectWidget;
+class SubprojectItem;
+class TargetItem;
+
+
+class AddApplicationDialog : public AddApplicationDialogBase
+{
+ Q_OBJECT
+
+public:
+ AddApplicationDialog( AutoProjectWidget *widget, SubprojectItem *spitem,
+ QWidget *parent = 0, const char *name = 0 );
+ ~AddApplicationDialog();
+
+protected:
+ virtual void iconClicked();
+ virtual void addTypeClicked();
+ virtual void removeTypeClicked();
+ virtual void accept();
+
+private:
+ AutoProjectWidget *m_widget;
+ SubprojectItem *subProject;
+ QString iconName;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
+
diff --git a/buildtools/autotools/addapplicationdlgbase.ui b/buildtools/autotools/addapplicationdlgbase.ui
new file mode 100644
index 00000000..5e6def81
--- /dev/null
+++ b/buildtools/autotools/addapplicationdlgbase.ui
@@ -0,0 +1,552 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AddApplicationDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>add_application_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>586</width>
+ <height>425</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add New Application .desktop File</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox7</cstring>
+ </property>
+ <property name="title">
+ <string>&amp;Application File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>terminal_box</cstring>
+ </property>
+ <property name="text">
+ <string>Start in t&amp;erminal</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>comment_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>filename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="3">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>icon_button</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QComboBox" row="0" column="3">
+ <property name="name">
+ <cstring>executable_combo</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>name_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="3">
+ <item>
+ <property name="text">
+ <string>Application</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Games</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Development</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Editors</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Graphics</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Internet</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Multimedia</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Office</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Settings</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>System</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Toys</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Utilities</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>WordProcessing</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>section_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>name_label_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>E&amp;xecutable:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>executable_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>icon_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Icon:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>icon_button</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>section_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Section:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>section_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>filename_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;File name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>filename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>name_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>name_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>comment_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Co&amp;mment:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comment_edit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox6</cstring>
+ </property>
+ <property name="title">
+ <string>Mime &amp;Types</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>chosentypes_listview</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>add_button</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;-</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>remove_button</cstring>
+ </property>
+ <property name="text">
+ <string>-&gt;</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>availtypes_listview</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>cancelbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_application_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>okbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_application_dialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>icon_button</sender>
+ <signal>clicked()</signal>
+ <receiver>add_application_dialog</receiver>
+ <slot>iconClicked()</slot>
+ </connection>
+ <connection>
+ <sender>add_button</sender>
+ <signal>clicked()</signal>
+ <receiver>add_application_dialog</receiver>
+ <slot>addTypeClicked()</slot>
+ </connection>
+ <connection>
+ <sender>remove_button</sender>
+ <signal>clicked()</signal>
+ <receiver>add_application_dialog</receiver>
+ <slot>removeTypeClicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>filename_edit</tabstop>
+ <tabstop>executable_combo</tabstop>
+ <tabstop>name_edit</tabstop>
+ <tabstop>icon_button</tabstop>
+ <tabstop>terminal_box</tabstop>
+ <tabstop>section_combo</tabstop>
+ <tabstop>comment_edit</tabstop>
+ <tabstop>chosentypes_listview</tabstop>
+ <tabstop>add_button</tabstop>
+ <tabstop>remove_button</tabstop>
+ <tabstop>availtypes_listview</tabstop>
+ <tabstop>okbutton</tabstop>
+ <tabstop>cancelbutton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">addTypeClicked()</slot>
+ <slot access="protected">iconClicked()</slot>
+ <slot access="protected">removeTypeClicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/buildtools/autotools/addexistingdirectoriesdlg.cpp b/buildtools/autotools/addexistingdirectoriesdlg.cpp
new file mode 100644
index 00000000..625d6af1
--- /dev/null
+++ b/buildtools/autotools/addexistingdirectoriesdlg.cpp
@@ -0,0 +1,388 @@
+/***************************************************************************
+ -------------------
+ begin : 12/21/2002
+ copyright : (C) 2002 by Victor R�er
+ email : victor_roeder@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qgroupbox.h>
+#include <qlayout.h>
+
+#include <kprogress.h>
+#include <klocale.h>
+#include <kio/netaccess.h>
+#include <kprocess.h>
+
+#include "autolistviewitems.h"
+#include "autosubprojectview.h"
+
+#include "autoprojectwidget.h"
+#include "autoprojectpart.h"
+
+#include "kimporticonview.h"
+
+#include "urlutil.h"
+
+#include "addexistingdirectoriesdlg.h"
+
+AddExistingDirectoriesDialog::AddExistingDirectoriesDialog ( AutoProjectPart* part, AutoProjectWidget *widget, SubprojectItem* spitem, QWidget* parent, const char* name, bool modal, WFlags fl )
+ : AddExistingDlgBase ( parent, name, modal, fl )
+{
+ setIcon ( SmallIcon ( "fileimport.png" ) );
+
+ m_spitem = spitem;
+
+ m_part = part;
+ m_widget = widget;
+
+ KFile::Mode mode = KFile::Directory;
+
+// if ( spitem && spitem->type() == ProjectItem::Subproject )
+// {
+// destStaticLabel->setText ( i18n ( "Subproject:" ) );
+// destLabel->setText ( spitem->subdir );
+// targetLabel->setText ( i18n ( "none" ) );
+// directoryLabel->setText ( i18n ( spitem->path ) );
+// }
+
+ sourceSelector = new FileSelectorWidget ( part, mode, sourceGroupBox, "source file selector" );
+ sourceGroupBoxLayout->addWidget ( sourceSelector );
+
+ importView = new KImportIconView ( i18n("Drag one or more directories with an existing Makefile.am from the left view and drop it here."), destGroupBox, "destination icon view" );
+ destGroupBoxLayout->addWidget ( importView );
+
+ setIcon ( SmallIcon ( "fileimport.png" ) );
+
+ QWidget::setTabOrder(sourceSelector, addAllButton);
+ QWidget::setTabOrder(addAllButton, addSelectedButton);
+ QWidget::setTabOrder(addSelectedButton, importView);
+ QWidget::setTabOrder(importView, removeAllButton);
+ QWidget::setTabOrder(removeAllButton, removeSelectedButton);
+ QWidget::setTabOrder(removeSelectedButton, okButton);
+ QWidget::setTabOrder(okButton, cancelButton);
+
+ sourceSelector->setFocus();
+
+ init();
+}
+
+
+AddExistingDirectoriesDialog::~AddExistingDirectoriesDialog()
+{
+}
+
+void AddExistingDirectoriesDialog::init()
+{
+ progressBar->hide();
+
+ importView->setMode ( KIconView::Select );
+ importView->setItemsMovable ( false );
+
+ connect ( okButton, SIGNAL ( clicked () ), this, SLOT ( slotOk () ) );
+
+ connect ( addSelectedButton, SIGNAL ( clicked () ), this, SLOT ( slotAddSelected() ) );
+ connect ( addAllButton, SIGNAL ( clicked () ), this, SLOT ( slotAddAll() ) );
+ connect ( removeSelectedButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveSelected() ) );
+ connect ( removeAllButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveAll() ) );
+
+ connect ( importView, SIGNAL ( dropped( QDropEvent* ) ), this, SLOT ( slotDropped ( QDropEvent* ) ) );
+
+ importView->setSelectionMode ( KFile::Multi );
+
+ sourceSelector->setDir ( m_spitem->path );
+}
+
+void AddExistingDirectoriesDialog::importItems()
+{
+ if( !importView->items() )
+ return;
+
+ // items added via button or drag 'n drop
+ KFileItemListIterator itemList ( m_importList );
+
+ // items already added to the importView
+ KFileItemListIterator importedList ( *importView->items() );
+
+ QStringList duplicateList;
+
+ importedList.toFirst();
+
+ for ( ; importedList.current(); ++importedList )
+ {
+ itemList.toFirst();
+
+ for ( ; itemList.current(); ++itemList )
+ {
+ if ( ( *importedList )->name() == ( *itemList )->name() )
+ {
+ m_importList.remove ( ( *itemList ) );
+
+ // to avoid that a item is added twice
+ if ( !duplicateList.remove ( ( *importedList )->name() ) )
+ {
+ duplicateList.append ( ( *importedList )->name() );
+ }
+ }
+ }
+ }
+
+ itemList.toFirst();
+
+ for ( ; itemList.current(); ++itemList )
+ {
+ KURL amURL = itemList.current()->url();
+ amURL.addPath("Makefile.am");
+ if (KIO::NetAccess::exists(amURL))
+ {
+ importView->insertItem ( ( *itemList ) );
+ }
+ }
+
+ importView->somethingDropped ( true );
+
+ m_importList.clear();
+
+ importView->update ();
+}
+
+void AddExistingDirectoriesDialog::slotOk()
+{
+ if ( importView->items()->count() == 0 ) QDialog::reject();
+
+ KFileItemListIterator items ( *importView->items() );
+
+ QStringList dirs;
+
+ for ( ; items.current(); ++items )
+ {
+ //if the directory is outside the project directory
+// kdDebug( 9020 ) << "dir to add " << items.current()->url().path() << " subproject " << m_spitem->path << endl;
+ if (items.current()->url().path() != m_spitem->path)
+ {
+ //copy
+ //FIXME: check this after 3.0 release and add a possibility to link, not just copy
+ KProcess proc;
+
+ proc << "cp";
+ proc << "-r";
+ proc << items.current()->url().path();
+ proc << m_spitem->path;
+ proc.start(KProcess::Block);
+ }
+ dirs << items.current()->name();
+ }
+
+ for (QStringList::const_iterator it = dirs.begin(); it != dirs.end(); ++it)
+ {
+ QString name = *it;
+
+ // Adjust SUBDIRS variable in containing Makefile.am
+ if (m_spitem->variables["SUBDIRS"].find("$(TOPSUBDIRS)") != -1)
+ {
+ QFile subdirsfile( m_spitem->path + "/subdirs" );
+ if ( subdirsfile.open( IO_WriteOnly | IO_Append ) )
+ {
+ QTextStream subdirsstream( &subdirsfile );
+ subdirsstream << name << endl;
+ subdirsfile.close();
+ }
+ }
+ else if (m_spitem->variables["SUBDIRS"].find("$(AUTODIRS)") != -1)
+ {
+ }
+ else
+ {
+ m_spitem->variables["SUBDIRS"] += (" " + name);
+ QMap<QString,QString> replaceMap;
+ replaceMap.insert("SUBDIRS", m_spitem->variables["SUBDIRS"]);
+ AutoProjectTool::addToMakefileam(m_spitem->path + "/Makefile.am", replaceMap);
+ }
+
+ // Create new item in tree view
+ SubprojectItem *newitem = new SubprojectItem(m_spitem, name);
+ newitem->subdir = name;
+ newitem->path = m_spitem->path + "/" + name;
+ newitem->variables["INCLUDES"] = m_spitem->variables["INCLUDES"];
+ newitem->setOpen(true);
+
+ // Move to the bottom of the list
+ QListViewItem *lastItem = m_spitem->firstChild();
+ while (lastItem->nextSibling())
+ lastItem = lastItem->nextSibling();
+ if (lastItem != newitem)
+ newitem->moveItem(lastItem);
+
+ // Create a Makefile in the new subdirectory
+
+ QDir dir( m_spitem->path + "/" + name );
+ QFile f( dir.filePath("Makefile.am") );
+ if (f.exists()) {
+ m_widget->getSubprojectView()->parse( newitem );
+ } else {
+ if (!f.open(IO_WriteOnly)) {
+// KMessageBox::sorry(this, i18n("Could not create Makefile.am in subdirectory %1.").arg(name));
+ continue;
+ }
+ QTextStream stream(&f);
+ stream << "INCLUDES = " << newitem->variables["INCLUDES"] << endl << "METASOURCES = AUTO" << endl;
+ f.close();
+ }
+
+
+
+ // if !isKDE: add the new sub-proj to configure.in or configure.ac
+ if ( !m_part->isKDE() ) {
+ QString projroot = m_part->projectDirectory() + "/";
+ QString subdirectory = dir.path();
+ QString relpath = subdirectory.replace(0, projroot.length(),"");
+
+ QString configureFile = m_part->getAutoConfFile(projroot);
+
+ QStringList list = AutoProjectTool::configureinLoadMakefiles(configureFile);
+ if ( !list.isEmpty() )
+ {
+ list.push_back( relpath + "/Makefile" );
+ AutoProjectTool::configureinSaveMakefiles(configureFile, list);
+ }
+ }
+
+ m_part->needMakefileCvs();
+
+ }
+ QDialog::accept();
+}
+
+void AddExistingDirectoriesDialog::slotAddSelected()
+{
+ KFileItemListIterator it ( *sourceSelector->dirOperator()->selectedItems() );
+
+ for ( ; it.current(); ++it )
+ {
+ QString relPath = URLUtil::extractPathNameRelative(m_part->projectDirectory(), ( *it )->url());
+ if (relPath[relPath.length()-1] == '/')
+ relPath = relPath.left(relPath.length()-1);
+ if ( (relPath.isEmpty()) || (! m_widget->allSubprojects().contains( relPath )) )
+ {
+ m_importList.append ( ( *it ) );
+ }
+ }
+
+ importItems();
+}
+
+void AddExistingDirectoriesDialog::slotAddAll()
+{
+ KFileItemListIterator it ( *sourceSelector->dirOperator()->view()->items() );
+
+ for ( ; it.current(); ++it )
+ {
+ QString relPath = URLUtil::extractPathNameRelative(m_part->projectDirectory(), ( *it )->url());
+ if (relPath[relPath.length()-1] == '/')
+ relPath = relPath.left(relPath.length()-1);
+ if ( (relPath.isEmpty()) || ( ! m_widget->allSubprojects().contains( relPath )) )
+ {
+ m_importList.append ( ( *it ) );
+ }
+ }
+
+ importItems();
+}
+
+void AddExistingDirectoriesDialog::slotRemoveAll()
+{
+ KURL::List deletedFiles;
+ KFileItemListIterator it ( *importView->items() );
+
+ for ( ; it.current(); ++it )
+ {
+ kdDebug ( 9020 ) << "AddExistingDirectoriesDialog::slotRemoveAll()" << endl;
+ //deletedFiles.append ( ( *it )->url() );
+ if ( (*it ) ) importView->removeItem ( *it );
+ }
+
+ importView->somethingDropped ( false );
+
+ importView->viewport()->update();
+}
+
+void AddExistingDirectoriesDialog::slotRemoveSelected()
+{
+ KFileItemListIterator items ( *importView->items() );
+
+ KFileItemList* selectedList = (KFileItemList*) importView->selectedItems();
+
+ KFileItem * deleteItem = 0L;
+
+ for ( ; items.current(); ++items )
+ {
+ deleteItem = selectedList->first();
+
+ while ( deleteItem )
+ {
+ if ( deleteItem == ( *items ) )
+ {
+ importView->removeItem ( deleteItem );
+ deleteItem = selectedList->current();
+ }
+ else
+ {
+ deleteItem = selectedList->next();
+ }
+ }
+ }
+
+ if ( importView->items()->count() == 0 ) importView->somethingDropped ( false );
+
+ importView->viewport()->update();
+}
+
+void AddExistingDirectoriesDialog::slotDropped ( QDropEvent* ev )
+{
+ kdDebug ( 9020 ) << "AddExistingDirectoriesDialog::dropped()" << endl;
+
+ KURL::List urls;
+
+ KURLDrag::decode( ev, urls );
+
+ KFileItem* item = 0L;
+ KMimeType::Ptr type = 0L;
+
+
+ for ( KURL::List::Iterator it = urls.begin(); it != urls.end(); ++it )
+ {
+ //check if this subproject is already in project
+ QString relPath = URLUtil::extractPathNameRelative(m_part->projectDirectory(), *it);
+ if (relPath[relPath.length()-1] == '/')
+ relPath = relPath.left(relPath.length()-1);
+ if ( (relPath.isEmpty()) || ( ! m_widget->allSubprojects().contains( relPath )) )
+ {
+ type = KMimeType::findByURL ( ( *it ) );
+
+ if ( type->name() != KMimeType::defaultMimeType() )
+ {
+ item = new KFileItem ( ( *it ) , type->name(), 0 );
+ }
+ else
+ {
+ item = new KFileItem ( ( *it ), "inode/directory", 0 );
+ }
+
+ m_importList.append ( item );
+ }
+ }
+
+ importItems();
+}
+
+#include "addexistingdirectoriesdlg.moc"
+
+//kate: indent-mode csands; tab-width 4; space-indent off;
diff --git a/buildtools/autotools/addexistingdirectoriesdlg.h b/buildtools/autotools/addexistingdirectoriesdlg.h
new file mode 100644
index 00000000..c4dd048e
--- /dev/null
+++ b/buildtools/autotools/addexistingdirectoriesdlg.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+ -------------------
+ begin : 12/21/2002
+ copyright : (C) 2002 by Victor R�er
+ email : victor_roeder@gmx.de
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _ADDEXISTINGDIRECTORIESDLG_H_
+#define _ADDEXISTINGDIRECTORIESDLG_H_
+
+#include "addexistingdlgbase.h"
+
+#include <qdialog.h>
+#include <kfile.h>
+
+#include "misc.h"
+#include "fileselectorwidget.h"
+
+class FileSelectorWidget;
+class AutoProjectWidget;
+class AutoProjectPart;
+class SubprojectItem;
+class TargetItem;
+class KFileItem;
+class KImportIconView;
+
+class AddExistingDirectoriesDialog : public AddExistingDlgBase
+{
+ Q_OBJECT
+
+public:
+ AddExistingDirectoriesDialog ( AutoProjectPart* part, AutoProjectWidget *widget,
+ SubprojectItem* spitem, QWidget* parent = 0,
+ const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~AddExistingDirectoriesDialog();
+
+private:
+ FileSelectorWidget* sourceSelector;
+ KImportIconView* importView;
+
+ AutoProjectPart* m_part;
+ AutoProjectWidget* m_widget;
+
+ TargetItem* m_titem;
+ SubprojectItem* m_spitem;
+
+ KFileItemList m_importList;
+
+protected:
+ void init();
+ void importItems ();
+
+protected slots:
+ void slotAddSelected();
+ void slotAddAll();
+ void slotRemoveAll();
+ void slotRemoveSelected();
+ void slotDropped ( QDropEvent* ev );
+
+ void slotOk();
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
+
diff --git a/buildtools/autotools/addexistingdlgbase.ui b/buildtools/autotools/addexistingdlgbase.ui
new file mode 100644
index 00000000..cf73ee21
--- /dev/null
+++ b/buildtools/autotools/addexistingdlgbase.ui
@@ -0,0 +1,459 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>AddExistingDlgBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AddExistingDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>592</width>
+ <height>445</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>ImportExistingDlgBase</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>buttonSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>317</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KProgress" row="2" column="0">
+ <property name="name">
+ <cstring>progressBar</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>infoGroupBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>Subproject Information</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>infoLayout1</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>directoryStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Directory:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>targetStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Target:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>infoLayout2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KSqueezedTextLabel">
+ <property name="name">
+ <cstring>directoryLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>[DIRECTORY]</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>targetLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[TARGET]</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QSplitter" row="1" column="0">
+ <property name="name">
+ <cstring>splitter2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>arrowSpacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>84</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addAllButton</cstring>
+ </property>
+ <property name="text">
+ <string>A&amp;dd All</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Import by creating symbolic links (recommended)</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addSelectedButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add Selected</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Import by copying (not recommended)</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>arrowSpacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>84</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>sourceGroupBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>240</width>
+ <height>250</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>&amp;Source Directory</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>arrowSpacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeAllButton</cstring>
+ </property>
+ <property name="text">
+ <string>R&amp;emove All</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Removes all added files.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeSelectedButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove Selected</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Removes the selected files.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>arrowSpacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>destGroupBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>140</width>
+ <height>100</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Add &amp;Following</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>AddExistingDlgBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>addAllButton</tabstop>
+ <tabstop>addSelectedButton</tabstop>
+ <tabstop>removeAllButton</tabstop>
+ <tabstop>removeSelectedButton</tabstop>
+ <tabstop>okButton</tabstop>
+ <tabstop>cancelButton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">ksqueezedtextlabel.h</include>
+ <include location="global" impldecl="in implementation">kprogress.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kprogress.h</includehint>
+ <includehint>ksqueezedtextlabel.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/autotools/addexistingfilesdlg.cpp b/buildtools/autotools/addexistingfilesdlg.cpp
new file mode 100644
index 00000000..00f3e61b
--- /dev/null
+++ b/buildtools/autotools/addexistingfilesdlg.cpp
@@ -0,0 +1,451 @@
+/***************************************************************************
+ -------------------
+ begin : Frag' mich was leichteres
+ copyright : (C) 2002 by Victor Rder
+ email : victor_roeder@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+/** Here resides the Import-existing-files-dialog of the Automake Manager (a KDevelop build tool part) **/
+
+#include <qapplication.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+//#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qpixmap.h>
+
+#include <kdebug.h>
+#include <kfileview.h>
+#include <kguiitem.h>
+#include <kprogress.h>
+#include <kprocess.h>
+#include <kurldrag.h>
+#include <kmessagebox.h>
+#include <kmimetype.h>
+#include <kiconview.h>
+#include <ksqueezedtextlabel.h>
+
+#include "urlutil.h"
+
+#include "autolistviewitems.h"
+
+#include "autoprojectwidget.h"
+#include "autoprojectpart.h"
+
+#include "kimporticonview.h"
+
+#include "addexistingfilesdlg.h"
+
+/*
+ * Constructs a AddExistingFilesDialog which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+
+AddExistingFilesDialog::AddExistingFilesDialog ( AutoProjectPart* part, AutoProjectWidget *widget, SubprojectItem* spitem, TargetItem* titem, QWidget* parent, const char* name, bool modal, WFlags fl )
+ : AddExistingDlgBase ( parent, name, modal, fl )
+{
+ m_spitem = spitem;
+ m_titem = titem;
+
+ m_part = part;
+ m_widget = widget;
+
+ KFile::Mode mode = KFile::Files;
+
+ if ( titem && spitem && titem->type() == ProjectItem::Target && spitem->type() == ProjectItem::Subproject )
+ {
+
+ if ( titem->name.isEmpty() )
+ {
+ QString target = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix );
+ targetLabel->setText ( target );
+ }
+ else
+ {
+ targetLabel->setText ( titem->name );
+ }
+ directoryLabel->setText ( spitem->path );
+ }
+
+ sourceSelector = new FileSelectorWidget ( m_part, mode, sourceGroupBox, "source file selector" );
+ sourceGroupBoxLayout->addWidget ( sourceSelector );
+
+ importView = new KImportIconView ( i18n ( "Drag one or more files from the left view and drop it here." ), destGroupBox, "destination icon view" );
+ destGroupBoxLayout->addWidget ( importView );
+ //destGroupBoxLayout->setStretchFactor(dir, 2);
+
+ QWidget::setTabOrder(sourceSelector, addAllButton);
+ QWidget::setTabOrder(addAllButton, addSelectedButton);
+ QWidget::setTabOrder(addSelectedButton, importView);
+ QWidget::setTabOrder(importView, removeAllButton);
+ QWidget::setTabOrder(removeAllButton, removeSelectedButton);
+ QWidget::setTabOrder(removeSelectedButton, okButton);
+ QWidget::setTabOrder(okButton, cancelButton);
+
+ sourceSelector->setFocus();
+
+ setIcon ( SmallIcon ( "fileimport.png" ) );
+
+ init();
+}
+
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+AddExistingFilesDialog::~AddExistingFilesDialog()
+{
+ // no need to delete child widgets, Qt does it all for me
+}
+
+
+// void AddExistingFilesDialog::resizeEvent ( QResizeEvent* ev )
+// {
+// AddExistingDlgBase::resizeEvent ( ev );
+// //importView->update();
+// }
+
+
+void AddExistingFilesDialog::init()
+{
+ progressBar->hide();
+
+ importView->setMode ( KIconView::Select );
+ importView->setItemsMovable ( false );
+
+ connect ( okButton, SIGNAL ( clicked () ), this, SLOT ( slotOk () ) );
+
+ connect ( addSelectedButton, SIGNAL ( clicked () ), this, SLOT ( slotAddSelected() ) );
+ connect ( addAllButton, SIGNAL ( clicked () ), this, SLOT ( slotAddAll() ) );
+ connect ( removeSelectedButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveSelected() ) );
+ connect ( removeAllButton, SIGNAL ( clicked () ), this, SLOT ( slotRemoveAll() ) );
+
+ connect ( importView, SIGNAL ( dropped( QDropEvent* ) ), this, SLOT ( slotDropped ( QDropEvent* ) ) );
+
+ importView->setSelectionMode ( KFile::Multi );
+
+ Q_ASSERT( m_spitem );
+ sourceSelector->setDir ( m_spitem->path );
+}
+
+void AddExistingFilesDialog::importItems()
+{
+ if( !importView->items() )
+ return;
+
+ // items added via button or drag 'n drop
+ KFileItemListIterator itemList ( m_importList );
+
+ // items already added to the importView
+ KFileItemListIterator importedList ( *importView->items() );
+
+ QListViewItem* child = m_titem->firstChild();
+
+ QStringList duplicateList;
+
+ while ( child )
+ {
+ FileItem* curItem = static_cast<FileItem*> ( child );
+
+ itemList.toFirst();
+
+ for ( ; itemList.current(); ++itemList )
+ {
+ if ( ( *itemList )->name() == curItem->name )
+ {
+ duplicateList.append ( ( *itemList )->name() );
+ m_importList.remove ( ( *itemList ) );
+ }
+ }
+
+ child = child->nextSibling();
+ }
+
+ importedList.toFirst();
+
+ for ( ; importedList.current(); ++importedList )
+ {
+ itemList.toFirst();
+
+ for ( ; itemList.current(); ++itemList )
+ {
+ if ( ( *importedList )->name() == ( *itemList )->name() )
+ {
+ m_importList.remove ( ( *itemList ) );
+
+ // to avoid that a item is added twice
+ if ( !duplicateList.remove ( ( *importedList )->name() ) )
+ {
+ duplicateList.append ( ( *importedList )->name() );
+ }
+ }
+ }
+ }
+
+ if ( duplicateList.count() > 0 )
+ {
+ if ( KMessageBox::warningContinueCancelList ( this, i18n (
+ "The following file(s) already exist(s) in the target!\n"
+ "Press Continue to import only the new files.\n"
+ "Press Cancel to abort the complete import." ),
+ duplicateList, "Warning", KGuiItem ( i18n ( "Continue" ) ) ) == KMessageBox::Cancel )
+ {
+ m_importList.clear();
+ return;
+ }
+ }
+
+ itemList.toFirst();
+
+ for ( ; itemList.current(); ++itemList )
+ {
+ if ( !( *itemList )->isDir() )
+ {
+ importView->insertItem ( ( *itemList ) );
+ }
+ }
+
+ importView->somethingDropped ( true );
+
+ m_importList.clear();
+
+ importView->update ();
+}
+
+void AddExistingFilesDialog::slotOk()
+{
+ if ( importView->items()->count() == 0 ) QDialog::reject();
+
+ progressBar->show();
+ progressBar->setFormat ( i18n ( "Importing... %p%" ) );
+
+ qApp->processEvents();
+
+ KFileItemListIterator items ( *importView->items() );
+
+ // contains at the end only the imported files outside the subproject directory
+ KFileItemList outsideList;
+
+ QStringList stringList;
+
+ for ( ; items.current(); ++items )
+ {
+ // kdDebug ( 9020 ) << " **** " << ( *items )->url().directory() << "***** " << m_spitem->path << endl;
+ if ( ( *items )->url().directory() != m_spitem->path )
+ {
+ stringList.append ( ( *items )->name() );
+ outsideList.append ( ( *items ) );
+ }
+ }
+
+ progressBar->setTotalSteps ( outsideList.count() + importView->items()->count() );
+
+ if ( outsideList.count() > 0 )
+ {
+ if ( KMessageBox::questionYesNoList ( this, i18n (
+ "The following file(s) are not in the Subproject directory.\n"
+ "Press Link to add the files by creating symbolic links.\n"
+ "Press Copy to copy the files into the directory." ),
+ stringList, i18n("Warning"), KGuiItem ( i18n ( "Link (recommended)" ) ), KGuiItem ( i18n ( "Copy (not recommended)" ) ) ) == KMessageBox::No )
+ {
+ // Copy files into the Subproject directory
+ KFileItemListIterator it ( outsideList ) ;
+
+ for ( ; it.current(); ++it )
+ {
+ KProcess proc;
+
+ proc << "cp";
+ proc << ( *it )->url().path();
+ proc << m_spitem->path;
+ proc.start(KProcess::DontCare);
+
+ progressBar->setValue ( progressBar->value() + 1 );
+ }
+ }
+ else
+ {
+ // Link them into the Subproject directory
+ KFileItemListIterator it ( outsideList ) ;
+
+ for ( ; it.current(); ++it )
+ {
+ KProcess proc;
+
+ proc << "ln";
+ proc << "-s";
+ proc << URLUtil::relativePathToFile( m_spitem->path, ( *it )->url().path() );
+ proc << m_spitem->path;
+ proc.start(KProcess::DontCare);
+
+ progressBar->setValue ( progressBar->value() + 1 );
+ }
+ }
+ }
+
+ items.toFirst();
+
+ QString canontargetname = AutoProjectTool::canonicalize ( m_titem->name );
+ QString varname;
+ if( m_titem->primary == "PROGRAMS" || m_titem->primary == "LIBRARIES" || m_titem->primary == "LTLIBRARIES" )
+ varname = canontargetname + "_SOURCES";
+ else
+ varname = m_titem->prefix + "_" + m_titem->primary;
+
+ QMap<QString,QString> replaceMap;
+ FileItem* fitem = 0L;
+ QStringList fileList;
+
+ for ( ; items.current(); ++items )
+ {
+ m_spitem->variables [ varname ] += ( " " + ( *items )->name() );
+ replaceMap.insert ( varname, m_spitem->variables [ varname ] );
+
+ fitem = m_widget->createFileItem ( ( *items )->name(), m_spitem );
+ m_titem->sources.append ( fitem );
+ m_titem->insertItem ( fitem );
+
+ fileList.append ( m_spitem->path.mid ( m_part->projectDirectory().length() + 1 ) + "/" + ( *items )->name() );
+
+ progressBar->setValue ( progressBar->value() + 1 );
+ }
+
+ m_widget->emitAddedFiles ( fileList );
+
+ AutoProjectTool::addToMakefileam ( m_spitem->path + "/Makefile.am", replaceMap );
+
+ QDialog::accept();
+
+}
+
+void AddExistingFilesDialog::slotAddSelected()
+{
+ KFileItemListIterator it ( *sourceSelector->dirOperator()->selectedItems() );
+
+ for ( ; it.current(); ++it )
+ {
+ if ( ( *it )->url().isLocalFile() ) // maybe unnecessary
+ {
+ m_importList.append ( ( *it ) );
+ }
+ }
+
+ importItems();
+}
+
+
+void AddExistingFilesDialog::slotAddAll()
+{
+ KFileItemListIterator it ( *sourceSelector->dirOperator()->view()->items() );
+
+ for ( ; it.current(); ++it )
+ {
+ if ( ( *it )->url().isLocalFile() ) // maybe unnecessary
+ {
+ m_importList.append ( ( *it ) );
+ }
+ }
+
+ importItems();
+}
+
+void AddExistingFilesDialog::slotRemoveAll()
+{
+ KURL::List deletedFiles;
+ KFileItemListIterator it ( *importView->items() );
+
+ for ( ; it.current(); ++it )
+ {
+ kdDebug ( 9020 ) << "AddExistingFilesDialog::slotRemoveAll()" << endl;
+ //deletedFiles.append ( ( *it )->url() );
+ if ( (*it ) ) importView->removeItem ( *it );
+ }
+
+ importView->somethingDropped ( false );
+
+ importView->viewport()->update();
+}
+
+void AddExistingFilesDialog::slotRemoveSelected()
+{
+ KFileItemListIterator items ( *importView->items() );
+
+ KFileItemList* selectedList = (KFileItemList*) importView->selectedItems();
+
+ KFileItem * deleteItem = 0L;
+
+ for ( ; items.current(); ++items )
+ {
+ deleteItem = selectedList->first();
+
+ while ( deleteItem )
+ {
+ if ( deleteItem == ( *items ) )
+ {
+ importView->removeItem ( deleteItem );
+ deleteItem = selectedList->current();
+ }
+ else
+ {
+ deleteItem = selectedList->next();
+ }
+ }
+ }
+
+ if ( importView->items()->count() == 0 ) importView->somethingDropped ( false );
+
+ importView->viewport()->update();
+}
+
+
+void AddExistingFilesDialog::slotDropped ( QDropEvent* ev )
+{
+ kdDebug ( 9020 ) << "AddExistingFilesDialog::dropped()" << endl;
+
+ KURL::List urls;
+
+ KURLDrag::decode( ev, urls );
+
+ KFileItem* item = 0L;
+ KMimeType::Ptr type = 0L;
+
+
+ for ( KURL::List::Iterator it = urls.begin(); it != urls.end(); ++it )
+ {
+ if ( ( *it ).isLocalFile() ) // maybe unnecessary
+ {
+ type = KMimeType::findByURL ( ( *it ) );
+
+ if ( type->name() != KMimeType::defaultMimeType() )
+ {
+ item = new KFileItem ( ( *it ) , type->name(), 0 );
+ }
+ else
+ {
+ // take a text-file-icon instead of the ugly question-mark-icon
+ item = new KFileItem ( ( *it ), "text/plain", 0 );
+ }
+
+ m_importList.append ( item );
+ }
+ }
+
+ importItems();
+}
+
+#include "addexistingfilesdlg.moc"
diff --git a/buildtools/autotools/addexistingfilesdlg.h b/buildtools/autotools/addexistingfilesdlg.h
new file mode 100644
index 00000000..5bee18b6
--- /dev/null
+++ b/buildtools/autotools/addexistingfilesdlg.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+ -------------------
+ begin : Frag' mich was leichteres
+ copyright : (C) 2002 by Victor Röder
+ email : victor_roeder@gmx.de
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+/** Here resides the Import-existing-files-dialog of the Automake Manager **/
+/** (a KDevelop build tool part) **/
+
+#ifndef ADDEXISTINGFILESDLG_H
+#define ADDEXISTINGFILESDLG_H
+
+#include <qdialog.h>
+#include <kfile.h>
+
+#include "addexistingdlgbase.h"
+#include "fileselectorwidget.h"
+
+#include "misc.h"
+
+class KImportIconView;
+class FileSelectorWidget;
+class AutoProjectWidget;
+class AutoProjectPart;
+class SubprojectItem;
+class TargetItem;
+class KFileItem;
+
+class AddExistingFilesDialog : public AddExistingDlgBase
+{
+ Q_OBJECT
+
+public:
+ AddExistingFilesDialog( AutoProjectPart* part, AutoProjectWidget *widget,
+ SubprojectItem* spitem, TargetItem* titem, QWidget* parent = 0,
+ const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~AddExistingFilesDialog();
+
+private:
+ FileSelectorWidget* sourceSelector;
+ KImportIconView* importView;
+
+ AutoProjectPart* m_part;
+ AutoProjectWidget* m_widget;
+
+ TargetItem* m_titem;
+ SubprojectItem* m_spitem;
+
+ KFileItemList m_importList;
+
+protected:
+ // virtual void resizeEvent ( QResizeEvent* ev );
+ void init();
+ void importItems ();
+
+protected slots:
+ void slotAddSelected();
+ void slotAddAll();
+ void slotRemoveAll();
+ void slotRemoveSelected();
+ void slotDropped ( QDropEvent* ev );
+
+ void slotOk();
+};
+
+#endif // ADDEXISTINGFILESDLG_H
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/addfiledlg.cpp b/buildtools/autotools/addfiledlg.cpp
new file mode 100644
index 00000000..46529086
--- /dev/null
+++ b/buildtools/autotools/addfiledlg.cpp
@@ -0,0 +1,135 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "addfiledlg.h"
+
+#include <qcheckbox.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qtextstream.h>
+
+#include <kbuttonbox.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <klineedit.h>
+#include <kmessagebox.h>
+#include <ksqueezedtextlabel.h>
+#include <kurl.h>
+
+#include "autolistviewitems.h"
+
+#include "filetemplate.h"
+#include "misc.h"
+#include "urlutil.h"
+#include "autoprojectpart.h"
+#include "autoprojectwidget.h"
+
+#include "kdevpartcontroller.h"
+
+AddFileDialog::AddFileDialog(AutoProjectPart *part, AutoProjectWidget *widget,
+ SubprojectItem *spitem, TargetItem *item,
+ QWidget *parent, const char *name)
+ : AddFileDlgBase(parent, name, true)
+{
+ connect ( createButton, SIGNAL ( clicked() ), this, SLOT ( accept() ) );
+ connect ( cancelButton, SIGNAL ( clicked() ), this, SLOT ( reject() ) );
+
+ directoryLabel->setText ( spitem->path );
+ if ( item->name.isEmpty() )
+ targetLabel->setText ( i18n ( "%1 in %2" ).arg ( item->primary ).arg ( item->prefix ) );
+ else
+ targetLabel->setText ( item->name );
+
+ setIcon ( SmallIcon ( "filenew.png" ) );
+
+ m_part = part;
+ m_widget = widget;
+ subProject = spitem;
+ target = item;
+}
+
+
+AddFileDialog::~AddFileDialog()
+{}
+
+
+void AddFileDialog::accept()
+{
+ QString name = fileEdit->text();
+ if (name.find('/') != -1) {
+ KMessageBox::sorry(this, i18n("Please enter the file name without '/' and so on."));
+ return;
+ }
+
+ QListViewItem *child = target->firstChild();
+ while (child) {
+ FileItem *item = static_cast<FileItem*>(child);
+ if (name == item->name) {
+ KMessageBox::sorry(this, i18n("This file is already in the target."));
+ return;
+ }
+ child = child->nextSibling();
+ }
+
+ if (templateCheckBox->isChecked()) {
+ QString srcdir = m_part->projectDirectory();
+ QString destdir = subProject->path;
+ QString destpath = destdir + "/" + name;
+ if (QFileInfo(destpath).exists()) {
+ KMessageBox::sorry(this, i18n("<b>A file with this name already exists.</b><br><br>Please use the \"Add existing file\" dialog."));
+ return;
+ }
+ if( !FileTemplate::copy(m_part, QFileInfo(name).extension(), destpath) )
+ kdDebug(9020) << "cannot create file " << destpath << endl;
+ } else {
+ // create an empty file
+ QString srcdir = m_part->projectDirectory();
+ QString destdir = subProject->path;
+ QString destpath = destdir + "/" + name;
+
+ if (QFileInfo(destpath).exists()) {
+ KMessageBox::sorry(this, i18n("<b>A file with this name already exists.</b><br><br>Please use the \"Add existing file\" dialog."));
+ return;
+ }
+
+ QFile f( destpath );
+ if( f.open(IO_WriteOnly) )
+ f.close();
+ }
+
+ FileItem *fitem = m_widget->createFileItem(name, subProject);
+ target->sources.append(fitem);
+ target->insertItem(fitem);
+
+ QString canontargetname = AutoProjectTool::canonicalize(target->name);
+ QString varname;
+ if( target->primary == "PROGRAMS" || target->primary == "LIBRARIES" || target->primary == "LTLIBRARIES" )
+ varname = canontargetname + "_SOURCES";
+ else
+ varname = target->prefix + "_" + target->primary;
+ subProject->variables[varname] += (" " + name);
+
+ QMap<QString,QString> replaceMap;
+ replaceMap.insert(varname, subProject->variables[varname]);
+
+ AutoProjectTool::addToMakefileam(subProject->path + "/Makefile.am", replaceMap);
+
+ m_widget->emitAddedFile( subProject->path.mid ( m_part->project()->projectDirectory().length() + 1 ) + "/" + name );
+ m_part->partController()->editDocument ( KURL ( subProject->path + "/" + name ) );
+
+ QDialog::accept();
+}
+
+#include "addfiledlg.moc"
diff --git a/buildtools/autotools/addfiledlg.h b/buildtools/autotools/addfiledlg.h
new file mode 100644
index 00000000..328e3593
--- /dev/null
+++ b/buildtools/autotools/addfiledlg.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _ADDFILEDLG_H_
+#define _ADDFILEDLG_H_
+
+#include <qdialog.h>
+
+#include "addfiledlgbase.h"
+
+class QCheckBox;
+class QLineEdit;
+class AutoProjectPart;
+class AutoProjectWidget;
+class SubprojectItem;
+class TargetItem;
+
+
+class AddFileDialog : public AddFileDlgBase
+{
+ Q_OBJECT
+
+public:
+ AddFileDialog( AutoProjectPart *part, AutoProjectWidget *widget,
+ SubprojectItem *spitem, TargetItem *item,
+ QWidget *parent = 0, const char *name = 0 );
+ ~AddFileDialog();
+
+protected:
+ virtual void accept();
+
+private:
+ AutoProjectPart *m_part;
+ AutoProjectWidget *m_widget;
+ SubprojectItem *subProject;
+ TargetItem *target;
+};
+
+#endif
diff --git a/buildtools/autotools/addfiledlgbase.ui b/buildtools/autotools/addfiledlgbase.ui
new file mode 100644
index 00000000..dc8e38b2
--- /dev/null
+++ b/buildtools/autotools/addfiledlgbase.ui
@@ -0,0 +1,289 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AddFileDlgBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AddFileDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>521</width>
+ <height>217</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Add New Created File to Target</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>targetBox</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="title">
+ <string>Subproject Information</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>targetLayout</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KSqueezedTextLabel" row="0" column="1">
+ <property name="name">
+ <cstring>directoryLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[TARGET DIRECTORY]</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>targetLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[TARGET NAME]</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>directoryStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Directory:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>targetStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Target:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>fileGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>File Information</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="1" column="0">
+ <property name="name">
+ <cstring>fileEdit</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>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>templateCheckBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Use file template</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>fileStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</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="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>New file &amp;name (with extension):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>buttonLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>buttonSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>createButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<includes>
+ <include location="global" impldecl="in implementation">ksqueezedtextlabel.h</include>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>ksqueezedtextlabel.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/autotools/addicondlg.cpp b/buildtools/autotools/addicondlg.cpp
new file mode 100644
index 00000000..251601f7
--- /dev/null
+++ b/buildtools/autotools/addicondlg.cpp
@@ -0,0 +1,115 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "addicondlg.h"
+
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <klineedit.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kprocess.h>
+#include <kstandarddirs.h>
+#include <kicontheme.h>
+#include <kdeversion.h> // fix me!
+
+#include "autolistviewitems.h"
+
+#include "autoprojectpart.h"
+#include "autoprojectwidget.h"
+
+
+const char *type_map[] = {
+ "app", "action", "device", "filesys", "mime"
+};
+
+
+const char *size_map[] = {
+ "hi16", "hi22", "hi32", "hi48", "hi64", "hi128"
+};
+
+
+AddIconDialog::AddIconDialog(AutoProjectPart *part, AutoProjectWidget *widget,
+ SubprojectItem *spitem, TargetItem *titem,
+ QWidget *parent, const char *name)
+ : AddIconDialogBase(parent, name, true)
+{
+ type_combo->insertItem(i18n("Application"));
+ type_combo->insertItem(i18n("Action"));
+ type_combo->insertItem(i18n("Device"));
+ type_combo->insertItem(i18n("File System"));
+ type_combo->insertItem(i18n("MIME Type"));
+
+ size_combo->insertItem("16");
+ size_combo->insertItem("22");
+ size_combo->insertItem("32");
+ size_combo->insertItem("48");
+ size_combo->insertItem("64");
+ size_combo->insertItem("128");
+
+ somethingChanged();
+
+ setIcon ( SmallIcon ( "iconadd_kdevelop" ) );
+
+ m_part = part;
+ m_widget = widget;
+ m_subProject = spitem;
+ m_target = titem;
+}
+
+
+AddIconDialog::~AddIconDialog()
+{}
+
+
+void AddIconDialog::somethingChanged()
+{
+ QString size = size_map[size_combo->currentItem()];
+ QString type = type_map[type_combo->currentItem()];
+ QString name = name_edit->text();
+
+ filename_edit->setText(size + "-" + type + "-" + name + ".png");
+}
+
+
+void AddIconDialog::accept()
+{
+ QString name = filename_edit->text();
+
+ QString destdir = m_subProject->subdir;
+ QString destpath = destdir + "/" + name;
+
+ QString size = size_combo->currentText();
+ QString unknown = KIconTheme::defaultThemeName()+ "/" + size + "x" + size + "/mimetypes/unknown.png";
+
+ QString templateFileName = locate("icon", unknown);
+ kdDebug(9020) << "Unknown: " << unknown << ", template: " << templateFileName << endl;
+
+ if (!templateFileName.isEmpty()) {
+ KProcess proc;
+ proc << "cp";
+ proc << templateFileName;
+ proc << destpath;
+ proc.start(KProcess::DontCare);
+ }
+
+ FileItem *fitem = m_widget->createFileItem(name, m_subProject);
+ m_target->sources.append(fitem);
+ m_target->insertItem(fitem);
+
+ m_part->startMakeCommand(destdir, QString::fromLatin1("force-reedit"));
+
+ m_widget->emitAddedFile(destpath);
+
+ QDialog::accept();
+}
+
+#include "addicondlg.moc"
diff --git a/buildtools/autotools/addicondlg.h b/buildtools/autotools/addicondlg.h
new file mode 100644
index 00000000..64fac0a5
--- /dev/null
+++ b/buildtools/autotools/addicondlg.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+* Copyright (C) 2002 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _ADDICONDLG_H_
+#define _ADDICONDLG_H_
+
+#include "addicondlgbase.h"
+
+class AutoProjectPart;
+class AutoProjectWidget;
+class SubprojectItem;
+class TargetItem;
+
+
+class AddIconDialog : public AddIconDialogBase
+{
+ Q_OBJECT
+
+public:
+ AddIconDialog( AutoProjectPart *part, AutoProjectWidget *widget,
+ SubprojectItem *spitem, TargetItem *titem,
+ QWidget *parent = 0, const char *name = 0 );
+ ~AddIconDialog();
+
+
+private:
+ virtual void somethingChanged();
+ virtual void accept();
+
+ AutoProjectPart *m_part;
+ AutoProjectWidget *m_widget;
+ SubprojectItem *m_subProject;
+ TargetItem *m_target;
+};
+
+#endif
diff --git a/buildtools/autotools/addicondlgbase.ui b/buildtools/autotools/addicondlgbase.ui
new file mode 100644
index 00000000..7fec5097
--- /dev/null
+++ b/buildtools/autotools/addicondlgbase.ui
@@ -0,0 +1,273 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AddIconDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>add_icon_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>301</width>
+ <height>218</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add New Icon</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>type_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Type:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>type_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>size_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Size:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>size_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>size_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>filename_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>File name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>filename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>name_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>name_edit</cstring>
+ </property>
+ </widget>
+ <widget class="Line" row="5" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="6" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>name_edit</cstring>
+ </property>
+ <property name="text">
+ <string>unknown</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>type_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="1">
+ <property name="name">
+ <cstring>filename_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer22</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>okbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_icon_dialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_icon_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>name_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>add_icon_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+ <connection>
+ <sender>type_combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>add_icon_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+ <connection>
+ <sender>size_combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>add_icon_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>type_combo</tabstop>
+ <tabstop>size_combo</tabstop>
+ <tabstop>name_edit</tabstop>
+ <tabstop>okbutton</tabstop>
+ <tabstop>cancelbutton</tabstop>
+</tabstops>
+<slots>
+ <slot>somethingChanged()</slot>
+</slots>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+
+</UI>
+
diff --git a/buildtools/autotools/addprefixdlg.cpp b/buildtools/autotools/addprefixdlg.cpp
new file mode 100644
index 00000000..d1557114
--- /dev/null
+++ b/buildtools/autotools/addprefixdlg.cpp
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "addprefixdlg.h"
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <kbuttonbox.h>
+#include <kfiledialog.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <kdeversion.h>
+
+AddPrefixDialog::AddPrefixDialog( const QString& nameEdit, const QString& pathEdit,
+ QWidget *parent, const char *name)
+ : QDialog(parent, name, true)
+{
+ setCaption(i18n("Add Prefix"));
+
+ QLabel *name_label = new QLabel(i18n("&Name:"), this);
+ name_edit = new KLineEdit(nameEdit, this);
+ name_edit->setFocus();
+ name_label->setBuddy(name_edit);
+ connect( name_edit, SIGNAL( textChanged ( const QString & ) ), SLOT( slotPrefixChanged() ) );
+
+ QLabel *path_label = new QLabel(i18n("&Path:"), this);
+ path_edit = new KLineEdit(pathEdit, this);
+ path_label->setBuddy(path_edit);
+ QFontMetrics fm(path_edit->fontMetrics());
+ path_edit->setMinimumWidth(fm.width('X')*35);
+ connect( path_edit, SIGNAL( textChanged ( const QString & ) ), SLOT( slotPrefixChanged() ) );
+
+ QVBoxLayout *layout = new QVBoxLayout(this, 10);
+
+ QGridLayout *grid = new QGridLayout(2, 2);
+ layout->addLayout(grid);
+ grid->addWidget(name_label, 0, 0);
+ grid->addWidget(name_edit, 0, 1);
+ grid->addWidget(path_label, 1, 0);
+ grid->addWidget(path_edit, 1, 1);
+
+ QFrame *frame = new QFrame(this);
+ frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+ layout->addWidget(frame, 0);
+
+ KButtonBox *buttonbox = new KButtonBox(this);
+ buttonbox->addStretch();
+ m_pOk = buttonbox->addButton(KStdGuiItem::ok());
+ QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel());
+ m_pOk->setDefault(true);
+ connect( m_pOk, SIGNAL(clicked()), this, SLOT(accept()) );
+ connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) );
+ buttonbox->layout();
+ layout->addWidget(buttonbox, 0);
+ slotPrefixChanged();
+}
+
+
+AddPrefixDialog::~AddPrefixDialog()
+{}
+
+void AddPrefixDialog::slotPrefixChanged()
+{
+ m_pOk->setEnabled( !name_edit->text().isEmpty() && !path_edit->text().isEmpty() );
+}
+
+#include "addprefixdlg.moc"
diff --git a/buildtools/autotools/addprefixdlg.h b/buildtools/autotools/addprefixdlg.h
new file mode 100644
index 00000000..a20bc63a
--- /dev/null
+++ b/buildtools/autotools/addprefixdlg.h
@@ -0,0 +1,45 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _ADDPREFIXDLG_H_
+#define _ADDPREFIXDLG_H_
+
+#include <qdialog.h>
+#include <klineedit.h>
+class QPushButton;
+
+class AddPrefixDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ AddPrefixDialog( const QString& nameEdit = "", const QString& pathEdit = "",
+ QWidget *parent = 0, const char *name = 0 );
+ ~AddPrefixDialog();
+
+ QString name() const
+ {
+ return name_edit->text();
+ }
+ QString path() const
+ {
+ return path_edit->text();
+ }
+private slots:
+ void slotPrefixChanged();
+
+private:
+ KLineEdit *name_edit;
+ KLineEdit *path_edit;
+ QPushButton *m_pOk;
+};
+
+#endif
diff --git a/buildtools/autotools/addservicedlg.cpp b/buildtools/autotools/addservicedlg.cpp
new file mode 100644
index 00000000..2dc76e5e
--- /dev/null
+++ b/buildtools/autotools/addservicedlg.cpp
@@ -0,0 +1,233 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "addservicedlg.h"
+
+#include <qcombobox.h>
+#include <qfile.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qtextstream.h>
+#include <klineedit.h>
+#include <kdebug.h>
+#include <kicondialog.h>
+#include <kinputdialog.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kservicetype.h>
+
+#include "autolistviewitems.h"
+
+#include "misc.h"
+#include "autoprojectwidget.h"
+#include "autoprojectpart.h"
+
+
+AddServiceDialog::AddServiceDialog(AutoProjectWidget *widget, SubprojectItem *spitem,
+ QWidget *parent, const char *name)
+ : AddServiceDialogBase(parent, name, true)
+{
+ filename_edit->setText(".desktop");
+ filename_edit->home(false);
+ filename_edit->setFocus();
+ chosentypes_listview->header()->hide();
+ availtypes_listview->header()->hide();
+
+ m_widget = widget;
+ subProject = spitem;
+
+ // Fill the combo box with library names in the directory
+ QPtrListIterator<TargetItem> tit(spitem->targets);
+ for (; tit.current(); ++tit) {
+ if ((*tit)->primary == "LTLIBRARIES")
+ library_combo->insertItem(QString((*tit)->name));
+ }
+
+ // Fill the list of available service types
+ KServiceType::List l = KServiceType::allServiceTypes();
+ KServiceType::List::Iterator it;
+ for (it = l.begin(); it != l.end(); ++it)
+ if (!(*it)->isType(KST_KMimeType))
+ new QListViewItem(availtypes_listview, (*it)->name());
+
+ setIcon ( SmallIcon ( "servicenew_kdevelop.png" ) );
+}
+
+
+AddServiceDialog::~AddServiceDialog()
+{}
+
+
+void AddServiceDialog::updateProperties()
+{
+ QStringList props;
+
+ QListViewItem *item = static_cast<QCheckListItem*>(chosentypes_listview->firstChild());
+ while (item) {
+ KServiceType::Ptr type = KServiceType::serviceType(item->text(0));
+ if (type) {
+ QStringList stprops = type->propertyDefNames();
+ QStringList::ConstIterator stit;
+ for (stit = stprops.begin(); stit != stprops.end(); ++stit)
+ if (props.find(*stit) == props.end() && (*stit) != "Name" && (*stit) != "Comment"
+ && (*stit) != "Icon")
+ props.append(*stit);
+ }
+ item = item->nextSibling();
+ }
+
+ properties_listview->clear();
+ QStringList::ConstIterator it;
+ for (it = props.begin(); it != props.end(); ++it)
+ new QListViewItem(properties_listview, *it);
+}
+
+
+void AddServiceDialog::iconClicked()
+{
+ KIconLoader *loader = AutoProjectFactory::instance()->iconLoader();
+ QString name = KIconDialog::getIcon(KIcon::Desktop);
+ if (!name.isNull()) {
+ iconName = name;
+ icon_button->setPixmap(loader->loadIcon(name, KIcon::Desktop));
+ }
+}
+
+
+void AddServiceDialog::addTypeClicked()
+{
+ QListViewItem *selitem = availtypes_listview->selectedItem();
+ if (!selitem)
+ return;
+
+ QListViewItem *olditem = chosentypes_listview->firstChild();
+ while (olditem) {
+ if (selitem->text(0) == olditem->text(0))
+ return;
+ olditem = olditem->nextSibling();
+ }
+ new QListViewItem(chosentypes_listview, selitem->text(0));
+
+ updateProperties();
+}
+
+
+void AddServiceDialog::removeTypeClicked()
+{
+ delete chosentypes_listview->currentItem();
+
+ updateProperties();
+}
+
+
+void AddServiceDialog::propertyExecuted(QListViewItem *item)
+{
+ if (!item)
+ return;
+
+ QString prop = item->text(0);
+ QString value = item->text(1);
+ bool ok;
+ value = KInputDialog::getText(i18n("Enter Value"), i18n("Property %1:").arg(prop), value, &ok, this);
+ if (!ok)
+ return;
+
+ item->setText(1, value);
+}
+
+
+void AddServiceDialog::accept()
+{
+ // Create list of service types
+ QStringList serviceTypes;
+ QListViewItem *item = chosentypes_listview->firstChild();
+ while (item) {
+ serviceTypes.append(item->text(0));
+ item = item->nextSibling();
+ }
+
+ // Some plausibility tests
+ QString fileName = filename_edit->text();
+ if (fileName.isEmpty() || fileName == ".desktop") {
+ KMessageBox::sorry(this, i18n("You have to enter a file name."));
+ filename_edit->setFocus();
+ return;
+ }
+
+ QString name = name_edit->text();
+ if (name.isEmpty()) {
+ KMessageBox::sorry(this, i18n("You have to enter a service name."));
+ name_edit->setFocus();
+ return;
+ }
+
+ QFile f(subProject->path + "/" + fileName);
+ if (f.exists()) {
+ KMessageBox::sorry(this, i18n("A file with this name exists already."));
+ filename_edit->setFocus();
+ return;
+ }
+ if (!f.open(IO_WriteOnly)) {
+ KMessageBox::sorry(this, i18n("Could not open file for writing."));
+ return;
+ }
+
+ QTextStream stream(&f);
+ stream << "[Desktop Entry]" << endl;
+ stream << "Type=Service" << endl;
+ stream << "Name=" << name << endl;
+ stream << "Comment=" << comment_edit->text() << endl;
+ if (!iconName.isNull())
+ stream << "Icon=" << iconName << endl;
+ stream << "ServiceTypes=" << serviceTypes.join(",") << endl;
+ item = properties_listview->firstChild();
+ while (item) {
+ stream << item->text(0) << "=" << item->text(1) << endl;
+ item = item->nextSibling();
+ }
+ f.close();
+
+ // Find a prefix that points to the services directory.
+ // If there is none, use kde_services
+ QMap<QString,QString>::ConstIterator it;
+ for (it = subProject->prefixes.begin(); it != subProject->prefixes.end(); ++it)
+ if (it.data() == "$(kde_servicesdir)")
+ break;
+ QString prefix = (it == subProject->prefixes.end())? QString("kde_services") : it.key();
+ QString varname = prefix + "_DATA";
+
+ // Look if a list view item for this prefix exists already.
+ // Create a new one otherwise
+ TargetItem *titem = 0;
+ for (uint i=0; i < subProject->targets.count(); ++i) {
+ TargetItem *tmptitem = subProject->targets.at(i);
+ if ("DATA" == tmptitem->primary && prefix == tmptitem->prefix) {
+ titem = tmptitem;
+ break;
+ }
+ }
+ if (!titem) {
+ titem = m_widget->createTargetItem("", prefix, "DATA", false);
+ subProject->targets.append(titem);
+ }
+ // Add this file to the target
+ FileItem *fitem = m_widget->createFileItem(fileName, subProject);
+ titem->sources.append(fitem);
+
+ subProject->variables[varname] += (" " + fileName);
+ QMap<QString, QString> replaceMap;
+ replaceMap.insert(varname, subProject->variables[varname]);
+ AutoProjectTool::addToMakefileam(subProject->path + "/Makefile.am", replaceMap);
+
+ QDialog::accept();
+}
+
+#include "addservicedlg.moc"
diff --git a/buildtools/autotools/addservicedlg.h b/buildtools/autotools/addservicedlg.h
new file mode 100644
index 00000000..c8b694a5
--- /dev/null
+++ b/buildtools/autotools/addservicedlg.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _ADDSERVICEDLG_H_
+#define _ADDSERVICEDLG_H_
+
+#include "addservicedlgbase.h"
+
+class AutoProjectWidget;
+class SubprojectItem;
+class TargetItem;
+
+
+class AddServiceDialog : public AddServiceDialogBase
+{
+ Q_OBJECT
+
+public:
+ AddServiceDialog( AutoProjectWidget *widget, SubprojectItem *spitem,
+ QWidget *parent = 0, const char *name = 0 );
+ ~AddServiceDialog();
+
+protected:
+ virtual void iconClicked();
+ virtual void addTypeClicked();
+ virtual void removeTypeClicked();
+ virtual void propertyExecuted( QListViewItem *item );
+ virtual void accept();
+
+private:
+ void updateProperties();
+
+ AutoProjectWidget *m_widget;
+ SubprojectItem *subProject;
+ QString iconName;
+};
+
+#endif
diff --git a/buildtools/autotools/addservicedlgbase.ui b/buildtools/autotools/addservicedlgbase.ui
new file mode 100644
index 00000000..050f8066
--- /dev/null
+++ b/buildtools/autotools/addservicedlgbase.ui
@@ -0,0 +1,544 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AddServiceDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>add_service_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>602</width>
+ <height>422</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add New Service</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>&amp;Service File</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>filename_edit</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="2">
+ <property name="name">
+ <cstring>icon_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Icon:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>icon_button</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="3">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>icon_button</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>24</width>
+ <height>24</height>
+ </size>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>comment_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>name_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="3">
+ <property name="name">
+ <cstring>library_combo</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="2">
+ <property name="name">
+ <cstring>library_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Library:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>library_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>filename_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;File name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>filename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>name_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>name_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>comment_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Co&amp;mment:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comment_edit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Service &amp;Types</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>chosentypes_listview</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>add_button</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;-</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>remove_button</cstring>
+ </property>
+ <property name="text">
+ <string>-&gt;</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>availtypes_listview</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QListView" row="1" column="1">
+ <column>
+ <property name="text">
+ <string>Property</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>properties_listview</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>properties_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Properties:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>properties_listview</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>okbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_service_dialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_service_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>remove_button</sender>
+ <signal>clicked()</signal>
+ <receiver>add_service_dialog</receiver>
+ <slot>removeTypeClicked()</slot>
+ </connection>
+ <connection>
+ <sender>properties_listview</sender>
+ <signal>doubleClicked(QListViewItem*)</signal>
+ <receiver>add_service_dialog</receiver>
+ <slot>propertyExecuted(QListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>properties_listview</sender>
+ <signal>returnPressed(QListViewItem*)</signal>
+ <receiver>add_service_dialog</receiver>
+ <slot>propertyExecuted(QListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>icon_button</sender>
+ <signal>clicked()</signal>
+ <receiver>add_service_dialog</receiver>
+ <slot>iconClicked()</slot>
+ </connection>
+ <connection>
+ <sender>add_button</sender>
+ <signal>clicked()</signal>
+ <receiver>add_service_dialog</receiver>
+ <slot>addTypeClicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>filename_edit</tabstop>
+ <tabstop>library_combo</tabstop>
+ <tabstop>name_edit</tabstop>
+ <tabstop>icon_button</tabstop>
+ <tabstop>comment_edit</tabstop>
+ <tabstop>chosentypes_listview</tabstop>
+ <tabstop>add_button</tabstop>
+ <tabstop>remove_button</tabstop>
+ <tabstop>availtypes_listview</tabstop>
+ <tabstop>properties_listview</tabstop>
+ <tabstop>okbutton</tabstop>
+ <tabstop>cancelbutton</tabstop>
+</tabstops>
+<slots>
+ <slot access="protected">iconClicked()</slot>
+ <slot access="protected">addTypeClicked()</slot>
+ <slot access="protected">propertyExecuted(QListViewItem*)</slot>
+ <slot access="protected">removeTypeClicked()</slot>
+</slots>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/buildtools/autotools/addsubprojectdlg.cpp b/buildtools/autotools/addsubprojectdlg.cpp
new file mode 100644
index 00000000..8011886b
--- /dev/null
+++ b/buildtools/autotools/addsubprojectdlg.cpp
@@ -0,0 +1,198 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "addsubprojectdlg.h"
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qstringlist.h>
+#include <qtextstream.h>
+#include <kbuttonbox.h>
+#include <kdebug.h>
+#include <kfiledialog.h>
+#include <kiconloader.h>
+#include <klineedit.h>
+#include <kmessagebox.h>
+
+#include "autolistviewitems.h"
+
+#include "kdevmakefrontend.h"
+#include "misc.h"
+#include "autoprojectpart.h"
+#include "autosubprojectview.h"
+
+
+AddSubprojectDialog::AddSubprojectDialog(AutoProjectPart *part, AutoSubprojectView *view,
+ SubprojectItem *item, QWidget *parent, const char *name)
+ : AddSubprojectDlgBase(parent, name, true)
+{
+ setIcon(SmallIcon("folder_new.png"));
+
+ connect( createButton, SIGNAL(clicked()), this, SLOT(accept()) );
+ connect( cancelButton, SIGNAL(clicked()), this, SLOT(reject()) );
+
+ m_subProject = item;
+ m_subprojectView = view;
+ m_part = part;
+}
+
+
+AddSubprojectDialog::~AddSubprojectDialog()
+{}
+
+
+void AddSubprojectDialog::accept()
+{
+ QString name = spEdit->text().stripWhiteSpace();
+
+ if (name.isEmpty()) {
+ KMessageBox::sorry(this, i18n("You have to give the subproject a name."));
+ return;
+ }
+
+ QListViewItem *childItem = m_subProject->firstChild();
+ while (childItem) {
+ if (name == static_cast<SubprojectItem*>(childItem)->subdir) {
+ KMessageBox::sorry(this, i18n("A subproject with this name already exists."));
+ return;
+ }
+ childItem = childItem->nextSibling();
+ }
+
+
+#if 0
+ // check for config.status
+ if( !QFileInfo(m_part->projectDirectory(), "config.status").exists() ){
+ KMessageBox::sorry(this, i18n("There is no config.status in the project root directory. Run 'Configure' first"));
+ QDialog::accept();
+ return;
+ }
+#endif
+
+ QDir dir( m_subProject->path );
+ QFileInfo file( dir, name );
+
+ if( file.exists() && !file.isDir() ) {
+ KMessageBox::sorry(this, i18n("A file named %1 already exists.").arg(name));
+ QDialog::accept();
+ return;
+ } else if( file.isDir() ) {
+ if( KMessageBox::warningContinueCancel(this,
+ i18n("A subdirectory %1 already exists. "
+ "Do you wish to add it as a subproject?").arg(name))
+ == KMessageBox::Cancel ){
+ QDialog::accept();
+ return;
+ }
+ } else if (!dir.mkdir(name)) {
+ KMessageBox::sorry(this, i18n("Could not create subdirectory %1.").arg(name));
+ QDialog::accept();
+ return;
+ }
+
+ if(!dir.cd(name)) {
+ KMessageBox::sorry(this, i18n("Could not access the subdirectory %1.").arg(name));
+ QDialog::accept();
+ return;
+ }
+
+ // Adjust SUBDIRS variable in containing Makefile.am
+ if (m_subProject->variables["SUBDIRS"].find("$(TOPSUBDIRS)") != -1)
+ {
+ QFile subdirsfile( m_subProject->path + "/subdirs" );
+ if ( subdirsfile.open( IO_WriteOnly | IO_Append ) )
+ {
+ QTextStream subdirsstream( &subdirsfile );
+ subdirsstream << name << endl;
+ subdirsfile.close();
+ }
+ }
+ else if (m_subProject->variables["SUBDIRS"].find("$(AUTODIRS)") != -1)
+ {
+ }
+ else
+ {
+ m_subProject->variables["SUBDIRS"] += (" " + name);
+ QMap<QString,QString> replaceMap;
+ replaceMap.insert("SUBDIRS", m_subProject->variables["SUBDIRS"]);
+ AutoProjectTool::addToMakefileam(m_subProject->path + "/Makefile.am", replaceMap);
+ }
+
+ // Create new item in tree view
+ SubprojectItem *newitem = new SubprojectItem(m_subProject, name);
+ newitem->subdir = name;
+ newitem->path = m_subProject->path + "/" + name;
+ newitem->variables["INCLUDES"] = m_subProject->variables["INCLUDES"];
+ newitem->setOpen(true);
+
+ // Move to the bottom of the list
+ QListViewItem *lastItem = m_subProject->firstChild();
+ while (lastItem->nextSibling())
+ lastItem = lastItem->nextSibling();
+ if (lastItem != newitem)
+ newitem->moveItem(lastItem);
+
+ // Create a Makefile in the new subdirectory
+
+ QFile f( dir.filePath("Makefile.am") );
+ if (f.exists()) {
+ m_subprojectView->parse( newitem );
+ } else {
+ if (!f.open(IO_WriteOnly)) {
+ KMessageBox::sorry(this, i18n("Could not create Makefile.am in subdirectory %1.").arg(name));
+ return;
+ }
+ QTextStream stream(&f);
+ stream << "INCLUDES = " << newitem->variables["INCLUDES"] << endl << "METASOURCES = AUTO" << endl;
+ f.close();
+ }
+
+
+
+ // if !isKDE: add the new sub-proj to configure.in
+ if ( !m_part->isKDE() ) {
+ QString projroot = m_part->projectDirectory() + "/";
+ QString subdirectory = dir.path();
+ QString relpath = subdirectory.replace(0, projroot.length(),"");
+
+ QString configureFile = m_part->getAutoConfFile(projroot);
+
+ QStringList list = AutoProjectTool::configureinLoadMakefiles(configureFile);
+ if ( !list.isEmpty() )
+ {
+ list.push_back( relpath + "/Makefile" );
+ AutoProjectTool::configureinSaveMakefiles(configureFile, list);
+ }
+ }
+
+#if 0
+ QString relmakefile = (m_subProject->path + "/" + name + "/Makefile").mid(m_part->projectDirectory().length()+1);
+ kdDebug(9020) << "Relative makefile path: " << relmakefile << endl;
+
+ QString cmdline = "cd ";
+ cmdline += KProcess::quote(m_part->projectDirectory());
+ cmdline += " && automake ";
+ cmdline += KProcess::quote(relmakefile);
+ cmdline += " && CONFIG_HEADERS=config.h CONFIG_FILES=";
+ cmdline += KProcess::quote(relmakefile);
+ cmdline += " ./config.status";
+
+ m_part->makeFrontend()->queueCommand( m_part->projectDirectory(), cmdline );
+ m_part->makeFrontend()->queueCommand( m_part->projectDirectory(), m_part->configureCommand() );
+#endif
+
+ m_part->needMakefileCvs();
+
+ QDialog::accept();
+}
+
+#include "addsubprojectdlg.moc"
diff --git a/buildtools/autotools/addsubprojectdlg.h b/buildtools/autotools/addsubprojectdlg.h
new file mode 100644
index 00000000..eabfc0e1
--- /dev/null
+++ b/buildtools/autotools/addsubprojectdlg.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _ADDSUBPROJECTDLG_H_
+#define _ADDSUBPROJECTDLG_H_
+
+#include <qdialog.h>
+#include <klineedit.h>
+
+#include "addsubprojectdlgbase.h"
+
+class AutoProjectPart;
+class AutoSubprojectView;
+class SubprojectItem;
+
+
+class AddSubprojectDialog : public AddSubprojectDlgBase
+{
+ Q_OBJECT
+
+public:
+ AddSubprojectDialog( AutoProjectPart *part, AutoSubprojectView *widget,
+ SubprojectItem *item, QWidget *parent = 0, const char *name = 0 );
+ ~AddSubprojectDialog();
+
+private:
+ virtual void accept();
+
+ KLineEdit *name_edit;
+
+ SubprojectItem *m_subProject;
+ AutoSubprojectView *m_subprojectView;
+ AutoProjectPart *m_part;
+};
+
+#endif
diff --git a/buildtools/autotools/addsubprojectdlgbase.ui b/buildtools/autotools/addsubprojectdlgbase.ui
new file mode 100644
index 00000000..b4c762b1
--- /dev/null
+++ b/buildtools/autotools/addsubprojectdlgbase.ui
@@ -0,0 +1,198 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AddSubprojectDlgBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AddSubprojectDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>445</width>
+ <height>126</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Add New Subproject</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>fileGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>Subproject</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>spStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</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="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Subproject &amp;name:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>spEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>spEdit</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>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>buttonLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>buttonSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>createButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>spEdit</tabstop>
+ <tabstop>createButton</tabstop>
+ <tabstop>cancelButton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/autotools/addtargetdlg.cpp b/buildtools/autotools/addtargetdlg.cpp
new file mode 100644
index 00000000..b01b5b82
--- /dev/null
+++ b/buildtools/autotools/addtargetdlg.cpp
@@ -0,0 +1,226 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "addtargetdlg.h"
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qgroupbox.h>
+#include <qvalidator.h>
+
+#include <klineedit.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <ksqueezedtextlabel.h>
+
+#include "autolistviewitems.h"
+
+#include "misc.h"
+#include "autodetailsview.h"
+#include "autoprojectwidget.h"
+
+
+AddTargetDialog::AddTargetDialog(AutoProjectWidget *widget, SubprojectItem *item,
+ QWidget *parent, const char *name)
+ : AddTargetDialogBase(parent, name, true)
+{
+ m_subproject = item;
+ m_widget = widget;
+// m_detailsView = view;
+
+ primary_combo->setFocus();
+ primary_combo->insertItem(i18n("Program"));
+ primary_combo->insertItem(i18n("Library"));
+ primary_combo->insertItem(i18n("Libtool Library"));
+ primary_combo->insertItem(i18n("Script"));
+ primary_combo->insertItem(i18n("Header"));
+ primary_combo->insertItem(i18n("Data File"));
+ primary_combo->insertItem(i18n("Java"));
+
+ primaryChanged(); // updates prefix combo
+
+ if (widget->kdeMode())
+ ldflagsother_edit->setText("$(all_libraries)");
+
+ connect( filename_edit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileNameChanged (const QString&) ) );
+
+ setIcon ( SmallIcon ( "targetnew_kdevelop.png" ) );
+
+ canonicalLabel->setText ( QString::null );
+}
+
+
+AddTargetDialog::~AddTargetDialog()
+{}
+
+
+void AddTargetDialog::primaryChanged()
+{
+ QStringList list;
+ switch (primary_combo->currentItem()) {
+ case 0: // Program
+ list.append("bin");
+ list.append("sbin");
+ list.append("libexec");
+ list.append("pkglib");
+ list.append("noinst");
+ break;
+ case 1: // Library
+ case 2: // Libtool library
+ list.append("lib");
+ list.append("pkglib");
+ list.append("noinst");
+ if (m_widget->kdeMode())
+ list.append("kde_module");
+ break;
+ case 3: // Script
+ list.append("bin");
+ list.append("sbin");
+ list.append("libexec");
+ list.append("pkgdata");
+ list.append("noinst");
+ break;
+ case 4: // Header
+ list.append("include");
+ list.append("oldinclude");
+ list.append("pkginclude");
+ list.append("noinst");
+ break;
+ case 5: // Data
+ list.append("bin");
+ list.append("sbin");
+ list.append("noinst");
+ break;
+ case 6: // Java
+ list.append("java");
+ list.append("noinst");
+ break;
+ }
+
+ prefix_combo->clear();
+
+ prefix_combo->insertStringList(list);
+ QStringList prefixes;
+ QMap<QString,QString>::ConstIterator it;
+ for (it = m_subproject->prefixes.begin(); it != m_subproject->prefixes.end(); ++it)
+ prefix_combo->insertItem(it.key());
+
+ // Only enable ldflags stuff for libtool libraries
+ bool lt = primary_combo->currentItem() == 2;
+ bool prog = primary_combo->currentItem() == 0;
+ allstatic_box->setEnabled(lt);
+ avoidversion_box->setEnabled(lt);
+ module_box->setEnabled(lt);
+ noundefined_box->setEnabled(lt);
+ ldflagsother_edit->setEnabled(lt || prog);
+}
+
+
+void AddTargetDialog::accept()
+{
+ QString name = filename_edit->text().stripWhiteSpace();
+ QString prefix = prefix_combo->currentText();
+
+ QString primary;
+ switch (primary_combo->currentItem()) {
+ case 0: primary = "PROGRAMS"; break;
+ case 1: primary = "LIBRARIES"; break;
+ case 2: primary = "LTLIBRARIES"; break;
+ case 3: primary = "SCRIPTS"; break;
+ case 4: primary = "HEADERS"; break;
+ case 5: primary = "DATA"; break;
+ case 6: primary = "JAVA"; break;
+ default: ;
+ }
+
+ if (name.isEmpty()) {
+ KMessageBox::sorry(this, i18n("You have to give the target a name"));
+ return;
+ }
+
+#if 0
+ if (primary == "LIBRARIES" && !name.startsWith("lib")) {
+ KMessageBox::sorry(this, i18n("Libraries must have a lib prefix."));
+ return;
+ }
+
+ if (primary == "LTLIBRARIES" && !name.startsWith("lib")) {
+ KMessageBox::sorry(this, i18n("Libtool libraries must have a lib prefix."));
+ return;
+ }
+
+ if (primary == "LTLIBRARIES" && name.right(3) != ".la") {
+ KMessageBox::sorry(this, i18n("Libtool libraries must have a .la suffix."));
+ return;
+ }
+
+#endif
+
+ if( primary.endsWith("LIBRARIES") && !name.startsWith("lib") && !module_box->isChecked() )
+ name.prepend( QString::fromLatin1("lib") );
+
+ if( primary == "LTLIBRARIES" && !name.endsWith(".la") )
+ name.append( QString::fromLatin1(".la") );
+
+ if ( primary == "LIBRARIES" && !name.endsWith(".a") )
+ name.append ( QString::fromLatin1(".a") );
+
+ QPtrListIterator<TargetItem> it(m_subproject->targets);
+ for (; it.current(); ++it)
+ if (name == (*it)->name) {
+ KMessageBox::sorry(this, i18n("A target with this name already exists."));
+ return;
+ }
+
+ QStringList flagslist;
+ if (primary == "LTLIBRARIES") {
+ if (allstatic_box->isChecked())
+ flagslist.append("-all-static");
+ if (avoidversion_box->isChecked())
+ flagslist.append("-avoid-version");
+ if (module_box->isChecked())
+ flagslist.append("-module");
+ if (noundefined_box->isChecked())
+ flagslist.append("-no-undefined");
+ }
+ flagslist.append(ldflagsother_edit->text());
+ QString ldflags = flagslist.join( " " );
+
+ TargetItem *titem = m_widget->createTargetItem(name, prefix, primary, false);
+ // m_detailsView->insertItem ( titem );
+ m_subproject->targets.append(titem);
+
+ QString canonname = AutoProjectTool::canonicalize(name);
+
+ QMap<QString,QString> replaceMap;
+
+ if( primary == "PROGRAMS" || primary == "LIBRARIES" || primary == "LTLIBRARIES" || primary == "DATA" ){
+ QString varname = prefix + "_" + primary;
+ m_subproject->variables[varname] += (" " + name);
+ replaceMap.insert(varname, m_subproject->variables[varname]);
+ if ( primary != "DATA" ){
+ replaceMap.insert(canonname + "_SOURCES", "");
+ }
+ }
+ if (primary == "LTLIBRARIES" || primary == "PROGRAMS")
+ replaceMap.insert(canonname + "_LDFLAGS", ldflags);
+
+ AutoProjectTool::addToMakefileam(m_subproject->path + "/Makefile.am", replaceMap);
+
+ QDialog::accept();
+}
+
+void AddTargetDialog::slotFileNameChanged ( const QString& text )
+{
+ canonicalLabel->setText ( AutoProjectTool::canonicalize ( text ) );
+}
+
+#include "addtargetdlg.moc"
diff --git a/buildtools/autotools/addtargetdlg.h b/buildtools/autotools/addtargetdlg.h
new file mode 100644
index 00000000..98708531
--- /dev/null
+++ b/buildtools/autotools/addtargetdlg.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _ADDTARGETDLG_H_
+#define _ADDTARGETDLG_H_
+
+#include "addtargetdlgbase.h"
+
+class AutoDetailsView;
+class AutoProjectWidget;
+class SubprojectItem;
+
+
+class AddTargetDialog : public AddTargetDialogBase
+{
+ Q_OBJECT
+
+public:
+ AddTargetDialog( AutoProjectWidget *widget, SubprojectItem *item,
+ QWidget *parent = 0, const char *name = 0 );
+ ~AddTargetDialog();
+
+protected slots:
+ virtual void slotFileNameChanged ( const QString& );
+
+private:
+ virtual void primaryChanged();
+ virtual void accept();
+
+ SubprojectItem *m_subproject;
+ AutoProjectWidget *m_widget;
+ AutoDetailsView* m_detailsView;
+};
+
+#endif
diff --git a/buildtools/autotools/addtargetdlgbase.ui b/buildtools/autotools/addtargetdlgbase.ui
new file mode 100644
index 00000000..25687563
--- /dev/null
+++ b/buildtools/autotools/addtargetdlgbase.ui
@@ -0,0 +1,348 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AddTargetDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>add_target_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>585</width>
+ <height>356</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add New Target</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>&amp;Target</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>primary_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Primary:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>primary_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>primary_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>prefix_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Pre&amp;fix:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>prefix_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>prefix_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>filename_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>File &amp;name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>filename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>filename_edit</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Spacer21</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>246</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KSqueezedTextLabel" row="2" column="3">
+ <property name="name">
+ <cstring>canonicalLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[CANONICALIZED NAME]</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="pixmap">
+ <pixmap>image0</pixmap>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer22</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>ldflags_group</cstring>
+ </property>
+ <property name="title">
+ <string>Linker Flags (&amp;LDFLAGS)</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>allstatic_box</cstring>
+ </property>
+ <property name="text">
+ <string>Do not link against shared libraries (-all-static)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>avoidversion_box</cstring>
+ </property>
+ <property name="text">
+ <string>Do not assign version numbers to libraries (-avoid-version)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>module_box</cstring>
+ </property>
+ <property name="text">
+ <string>Create a library that can be dynamically loaded (-module)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>noundefined_box</cstring>
+ </property>
+ <property name="text">
+ <string>Library does not depend on external symbols (-no-undefined)</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout11_2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>ldflagsother_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Ot&amp;her:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>ldflagsother_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>ldflagsother_edit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="394">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022230543251d2e253d856405bffcbc54105b19c856360003b0141ac02ba68c4d4c199b98323631656c62cad8c494891423ce0ee2dc4c6418208bd55a7301009c7f45ef</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>okbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_target_dialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_target_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>primary_combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>add_target_dialog</receiver>
+ <slot>primaryChanged()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>primary_combo</tabstop>
+ <tabstop>prefix_combo</tabstop>
+ <tabstop>filename_edit</tabstop>
+ <tabstop>allstatic_box</tabstop>
+ <tabstop>avoidversion_box</tabstop>
+ <tabstop>module_box</tabstop>
+ <tabstop>noundefined_box</tabstop>
+ <tabstop>ldflagsother_edit</tabstop>
+ <tabstop>okbutton</tabstop>
+ <tabstop>cancelbutton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">primaryChanged()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>ksqueezedtextlabel.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/autotools/addtranslationdlg.cpp b/buildtools/autotools/addtranslationdlg.cpp
new file mode 100644
index 00000000..993dee7d
--- /dev/null
+++ b/buildtools/autotools/addtranslationdlg.cpp
@@ -0,0 +1,109 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "addtranslationdlg.h"
+
+#include <qcombobox.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qstrlist.h>
+#include <kbuttonbox.h>
+#include <kdialog.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kstdguiitem.h>
+#include <kdeversion.h>
+
+#include "misc.h"
+#include "autoprojectpart.h"
+
+
+AddTranslationDialog::AddTranslationDialog(AutoProjectPart *part, QWidget *parent, const char *name)
+ : QDialog(parent, name, true)
+{
+ setCaption(i18n("Add Translation"));
+
+ m_part = part;
+
+ QHBox *hbox = new QHBox(this);
+ (void) new QLabel(i18n("Language:"), hbox);
+ lang_combo = new QComboBox(hbox);
+
+ QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
+ layout->addWidget(hbox);
+
+ QFrame *frame = new QFrame(this);
+ frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+ layout->addWidget(frame, 0);
+
+ KButtonBox *buttonbox = new KButtonBox(this);
+ buttonbox->addStretch();
+ QPushButton *ok_button = buttonbox->addButton(KStdGuiItem::ok());
+ QPushButton *cancel_button = buttonbox->addButton(KStdGuiItem::cancel());
+ ok_button->setDefault(true);
+ connect( ok_button, SIGNAL(clicked()), this, SLOT(accept()) );
+ connect( cancel_button, SIGNAL(clicked()), this, SLOT(reject()) );
+ buttonbox->layout();
+ layout->addWidget(buttonbox, 0);
+
+ QStringList rawlist, list;
+ rawlist << "af" << "ar" << "bg" << "bo" << "br" << "bs" << "ca" << "cs" << "cy" << "da"
+ << "de" << "el" << "en_GB" << "eo" << "es" << "et" << "eu" << "fi" << "fr";
+ rawlist << "ga" << "gl" << "gu" << "he" << "hi" << "hu" << "id" << "is" << "it" << "ja"
+ << "km" << "ko" << "lt" << "lv" << "mi" << "mk" << "mr" << "nl" << "no" << "no_NY";
+ rawlist << "oc" << "pl" << "pt" << "pt_BR" << "ro" << "ru" << "sk" << "sl" << "sr" << "sv"
+ << "ta" << "th" << "tr" << "uk" << "wa" << "zh_CN.GB2312" << "zh_TW.Big5";
+
+ // Remove already added languages
+ QStringList::ConstIterator it;
+ for (it = rawlist.begin(); it != rawlist.end(); ++it) {
+ QFileInfo fi(m_part->projectDirectory() + "/po/" + (*it) + ".po");
+ if (!fi.exists())
+ list.append(*it);
+ }
+
+ if (list.isEmpty()) {
+ KMessageBox::information(this, i18n("Your sourcecode is already translated to all supported languages."));
+ ok_button->setEnabled(false);
+ }
+ lang_combo->insertStringList(list);
+}
+
+
+AddTranslationDialog::~AddTranslationDialog()
+{}
+
+
+void AddTranslationDialog::accept()
+{
+ QString dir = m_part->projectDirectory() + "/po";
+ QString fileName = dir + "/" + lang_combo->currentText() + ".po";
+
+ QFile f(fileName);
+ if (f.exists()) {
+ KMessageBox::information(this, i18n("A translation file for the language %1 exists already."));
+ return;
+ }
+ f.open(IO_WriteOnly);
+ f.close();
+
+ dir = m_part->buildDirectory() + "/po";
+ m_part->startMakeCommand(dir, QString::fromLatin1("force-reedit"));
+
+ QDialog::accept();
+}
+
+#include "addtranslationdlg.moc"
diff --git a/buildtools/autotools/addtranslationdlg.h b/buildtools/autotools/addtranslationdlg.h
new file mode 100644
index 00000000..cd14ddf2
--- /dev/null
+++ b/buildtools/autotools/addtranslationdlg.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+* Copyright (C) 1999 by Sandy Meier *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _ADDTRANSLATIONDLG_H_
+#define _ADDTRANSLATIONDLG_H_
+
+#include <qdialog.h>
+
+class QComboBox;
+class AutoProjectPart;
+
+
+class AddTranslationDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ AddTranslationDialog( AutoProjectPart *part, QWidget *parent = 0, const char *name = 0 );
+ ~AddTranslationDialog();
+
+private:
+ virtual void accept();
+
+ QComboBox *lang_combo;
+ AutoProjectPart *m_part;
+};
+
+#endif
diff --git a/buildtools/autotools/autodetailsview.cpp b/buildtools/autotools/autodetailsview.cpp
new file mode 100644
index 00000000..26255fd3
--- /dev/null
+++ b/buildtools/autotools/autodetailsview.cpp
@@ -0,0 +1,728 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2002 by Victor Roeder <victor_roeder@gmx.de>
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+ * *
+ ***************************************************************************
+*/
+
+#include "autodetailsview.h"
+
+/** Qt */
+#include <qregexp.h>
+#include <qlistview.h>
+#include <qwidget.h>
+#include <qheader.h>
+#include <qlayout.h>
+
+ /** KDE Libs */
+#include <kxmlguiclient.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <klistview.h>
+#include <kpopupmenu.h>
+
+/** KDevelop */
+#include "kdevappfrontend.h"
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+#include "kdevpartcontroller.h"
+#include "kdevcreatefile.h"
+#include "kdevlanguagesupport.h"
+#include "kdevmakefrontend.h"
+#include "urlutil.h"
+
+#include "domutil.h"
+
+#include "targetoptionsdlg.h"
+#include "addfiledlg.h"
+#include "addicondlg.h"
+#include "addexistingfilesdlg.h"
+#include "removefiledlg.h"
+#include "removetargetdlg.h"
+
+#include "autolistviewitems.h"
+#include "autotoolsaction.h"
+#include "autoprojectpart.h"
+#include "autoprojectwidget.h"
+
+#include "subclassesdlg.h"
+
+AutoDetailsView::AutoDetailsView(AutoProjectWidget* widget, AutoProjectPart* part, QWidget *parent, const char *name)
+ : AutoProjectViewBase(parent, name)
+{
+ m_widget = widget;
+ m_part = part;
+
+ initActions();
+ QDomDocument dom = *(m_part->projectDom());
+ m_subclasslist = DomUtil::readPairListEntry(dom, "/kdevautoproject/subclassing",
+ "subclass","sourcefile", "uifile");
+
+ m_listView->setAllColumnsShowFocus( true );
+ m_listView->setRootIsDecorated( true );
+ m_listView->setResizeMode( QListView::LastColumn );
+ m_listView->addColumn( QString::null );
+ m_listView->header()->hide();
+ targetOptionsAction->setEnabled( false );
+ addNewFileAction->setEnabled( false );
+ addExistingFileAction->setEnabled( false );
+ buildTargetAction->setEnabled( false );
+ executeTargetAction->setEnabled( false );
+ removeDetailAction->setEnabled(false);
+ connect( m_listView, SIGNAL( selectionChanged( QListViewItem* ) ),
+ this, SLOT( slotSelectionChanged( QListViewItem* ) ) );
+ connect( m_listView, SIGNAL( selectionChanged() ),
+ this, SLOT( slotSelectionChanged( ) ) );
+}
+
+
+AutoDetailsView::~AutoDetailsView()
+{
+}
+
+/**
+ * If nothing selected, disable all the icons.
+ */
+void AutoDetailsView::slotSelectionChanged( ){
+
+ if ( m_listView->selectedItems().isEmpty()){
+ targetOptionsAction->setEnabled( false );
+ addNewFileAction->setEnabled( false );
+ addExistingFileAction->setEnabled( false );
+ buildTargetAction->setEnabled( false );
+ executeTargetAction->setEnabled( false );
+ removeDetailAction->setEnabled(false);
+ }
+}
+
+/**
+ * Change the enabled icons depending on what is selected.
+ * This is never called if nothing is selected..
+ * @param item
+ */
+void AutoDetailsView::slotSelectionChanged( QListViewItem* item )
+{
+ bool isTarget = false;
+ bool isRegularTarget = false;
+ bool isFile = false;
+ bool isProgram = false;
+
+ if ( item )
+ {
+ // We assume here that ALL items in the detail list view
+ // are ProjectItem's
+ ProjectItem * pvitem = static_cast<ProjectItem*>( item );
+ TargetItem* titem = 0;
+
+ if ( pvitem->type() == ProjectItem::File )
+ {
+ titem = static_cast <TargetItem*> ( pvitem->parent() );
+
+ QString primary = titem->primary;
+ if ( primary == "PROGRAMS" || primary == "LIBRARIES" ||
+ primary == "LTLIBRARIES" || primary == "JAVA" )
+ {
+ isRegularTarget = true; // not a data group
+ isFile = true;
+ }
+ }
+ else
+ {
+ titem = static_cast <TargetItem*> ( pvitem );
+ isTarget = true;
+ }
+
+ QString primary = titem->primary;
+ if ( primary == "PROGRAMS" || primary == "LIBRARIES" ||
+ primary == "LTLIBRARIES" || primary == "JAVA" )
+ {
+ isRegularTarget = true; // not a data group
+ }
+
+ if ( primary == "PROGRAMS" )
+ isProgram = true;
+ }
+
+ targetOptionsAction->setEnabled( isRegularTarget && !isFile );
+ addNewFileAction->setEnabled( isTarget );
+ addExistingFileAction->setEnabled( isTarget );
+ removeDetailAction->setEnabled ( true );
+
+ if ( isRegularTarget && isFile || isRegularTarget )
+ {
+ buildTargetAction->setEnabled ( true );
+ if( isProgram )
+ executeTargetAction->setEnabled ( true );
+ }
+ else
+ {
+ buildTargetAction->setEnabled ( false );
+ executeTargetAction->setEnabled ( false );
+ }
+ emit selectionChanged( item );
+}
+
+void AutoDetailsView::initActions()
+{
+ KActionCollection * actions = new KActionCollection( this );
+
+ targetOptionsAction = new AutoToolsAction( i18n( "Options..." ), "configure", 0,
+ this, SLOT( slotTargetOptions() ), actions,
+ "target options" );
+ targetOptionsAction->setWhatsThis(i18n("<b>Options</b><p>Target options dialog that "
+ "provides settings for linker flags and lists "
+ "of dependencies and external libraries that "
+ "are used when compiling the target."));
+ targetOptionsAction->plug( m_optionsButton );
+ targetOptionsAction->setEnabled( false );
+
+ QToolTip::add( m_button1, tr2i18n( "Create New File..." ) );
+ addNewFileAction = new AutoToolsAction( i18n( "Create New File..." ), "filenew", 0,
+ this, SLOT( slotAddNewFile() ), actions,
+ "add new file" );
+ addNewFileAction->setWhatsThis(i18n("<b>Create new file</b><p>Creates a new file and "
+ "adds it to a currently selected target."));
+ addNewFileAction->plug( m_button1 );
+ addNewFileAction->setEnabled( false );
+
+ QToolTip::add( m_button2, tr2i18n( "Add Existing Files..." ) );
+ addExistingFileAction = new AutoToolsAction( i18n( "Add Existing Files..." ), "fileimport", 0,
+ this, SLOT( slotAddExistingFile() ), actions,
+ "add existing file" );
+ addExistingFileAction->setWhatsThis(i18n("<b>Add existing files</b><p>Adds existing "
+ "file to a currently selected target. Header "
+ "files will not be included in SOURCES list "
+ "of a target. They will be added to "
+ "noinst_HEADERS instead."));
+ addExistingFileAction->plug( m_button2 );
+ addExistingFileAction->setEnabled( false );
+
+ addIconAction = new KAction( i18n( "Add Icon..." ), "iconadd_kdevelop", 0,
+ this, SLOT( slotAddIcon() ), actions, "add icon" );
+ addIconAction->setWhatsThis(i18n("<b>Add icon</b><p>Adds an icon to a KDEICON target."));
+
+ QToolTip::add( m_button4, tr2i18n( "Build Target"));
+ buildTargetAction = new AutoToolsAction( i18n( "Build Target..." ), "launch", 0,
+ this, SLOT( slotBuildTarget() ), actions,
+ "build target" );
+ buildTargetAction->setWhatsThis(i18n("<b>Build target</b><p>Constructs a series of "
+ "make commands to build the selected target. "
+ "Also builds dependent targets."));
+ buildTargetAction->plug( m_button4 );
+ buildTargetAction->setEnabled( false );
+
+ QToolTip::add( m_button5, tr2i18n( "Execute Target..."));
+ executeTargetAction = new AutoToolsAction( i18n( "Execute Target..." ), "exec", 0,
+ this, SLOT( slotExecuteTarget() ), actions,
+ "execute target" );
+ executeTargetAction->setWhatsThis(i18n("<b>Execute target</b><p>Executes the target "
+ "and tries to build in case it is not built."));
+ executeTargetAction->plug( m_button5 );
+ executeTargetAction->setEnabled( false );
+
+ setActiveTargetAction = new KAction( i18n( "Make Target Active" ), "", 0,
+ this, SLOT( slotSetActiveTarget() ), actions,
+ "set active target" );
+ setActiveTargetAction->setWhatsThis(i18n("<b>Make target active</b><p>Marks the "
+ "currently selected target as 'active'. New "
+ "files and classes by default go to an active "
+ "target. "
+ "Using the <b>Build Active Target</b> menu "
+ "command builds it."));
+
+ QToolTip::add( m_button3, tr2i18n( "Remove"));
+ removeDetailAction = new AutoToolsAction( i18n( "Remove" ), "editdelete", 0, this,
+ SLOT( slotRemoveDetail() ), actions,
+ "remove detail" );
+ removeDetailAction->setWhatsThis(i18n("<b>Remove</b><p>Shows a list of targets "
+ "dependent on the selected target or file and "
+ "asks for removal. Also asks if the target or "
+ "file should be removed from disk."));
+ removeDetailAction->plug( m_button3 );
+ removeDetailAction->setEnabled( false );
+
+ connect( m_listView, SIGNAL( executed( QListViewItem* ) ),
+ this, SLOT( slotDetailsExecuted( QListViewItem* ) ) );
+ connect( m_listView, SIGNAL( returnPressed( QListViewItem* ) ),
+ this, SLOT( slotDetailsExecuted( QListViewItem* ) ) );
+ connect( m_listView, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ),
+ this, SLOT( slotDetailsContextMenu( KListView*, QListViewItem*, const QPoint& ) ) );
+}
+
+QString AutoDetailsView::getUiFileLink(const QString& relpath, const QString& filename)
+{
+ DomUtil::PairList::iterator it;
+
+ for (it=m_subclasslist.begin(); it != m_subclasslist.end(); ++it)
+ {
+ if ((*it).first == QString("/")+relpath+filename)
+ return (*it).second;
+ }
+
+ return QString::null;
+}
+
+void AutoDetailsView::slotTargetOptions()
+{
+ kdDebug( 9020 ) << "AutoDetailsView::slotTargetOptions()" << endl;
+ TargetItem *titem = dynamic_cast <TargetItem*> ( m_listView->selectedItem() );
+
+ if ( !titem )
+ return;
+
+ TargetOptionsDialog dlg( m_widget, titem, this, "target options dialog" );
+
+ dlg.setCaption ( i18n ( "Target Options for '%1'" ).arg ( titem->name ) );
+
+ dlg.exec();
+}
+
+
+void AutoDetailsView::slotAddNewFile()
+{
+ TargetItem * titem = dynamic_cast <TargetItem*> ( m_listView->selectedItem() );
+ if ( !titem )
+ return;
+
+ KDevCreateFile * createFileSupport = m_part->extension<KDevCreateFile>("KDevelop/CreateFile");
+ if (createFileSupport)
+ {
+ KDevCreateFile::CreatedFile crFile =
+ createFileSupport->createNewFile(QString::null,
+ m_widget->selectedSubproject()->path);
+/* if (crFile.status == KDevCreateFile::CreatedFile::STATUS_OK)
+ {
+ FileItem *fitem = m_widget->createFileItem(crFile.filename, m_widget->selectedSubproject());
+ titem->sources.append(fitem);
+ titem->insertItem(fitem);
+ emit selectionChanged( titem ); // update list view
+ }*/
+ } else {
+ AddFileDialog dlg( m_part, m_widget, m_widget->selectedSubproject(), titem,
+ this, "add file dialog" );
+ QString caption;
+ if ( titem->name.isEmpty() )
+ caption = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix );
+ else
+ caption = titem->name;
+
+ dlg.setCaption ( i18n ( "Add New File to '%1'" ).arg ( caption ) );
+
+ if ( dlg.exec() )
+ emit selectionChanged( titem ); // update list view
+ }
+}
+
+
+void AutoDetailsView::slotAddExistingFile()
+{
+ TargetItem * titem = dynamic_cast <TargetItem*> ( m_listView->selectedItem() );
+ if ( !titem )
+ return;
+
+ AddExistingFilesDialog dlg( m_part, m_widget, m_widget->selectedSubproject(), titem,
+ this, "add existing files" );
+ QString caption;
+ if ( titem->name.isEmpty() )
+ caption = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix );
+ else
+ caption = titem->name;
+
+ dlg.setCaption( i18n( "Add Existing Files to '%1'" ).arg ( caption ) );
+
+ dlg.exec();
+}
+
+
+void AutoDetailsView::slotAddIcon()
+{
+ TargetItem * titem = dynamic_cast <TargetItem*> ( m_listView->selectedItem() );
+ if ( !titem )
+ return ;
+
+ AddIconDialog dlg( m_part, m_widget, m_widget->selectedSubproject(), titem,
+ this, "add icon" );
+ dlg.exec();
+}
+
+
+void AutoDetailsView::slotBuildTarget()
+{
+ ProjectItem * pvitem = dynamic_cast<ProjectItem*>( m_listView->selectedItem() );
+ if ( !pvitem )
+ return;
+
+ TargetItem* titem = 0;
+
+ if ( pvitem->type() == ProjectItem::File )
+ titem = static_cast <TargetItem*> ( pvitem->parent() );
+ else
+ titem = static_cast <TargetItem*> ( m_listView->selectedItem() );
+
+ QString relpath = URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + m_widget->selectedSubproject()->relativePath();
+
+ m_part->buildTarget(relpath, titem);
+}
+
+void AutoDetailsView::slotExecuteTarget()
+{
+ ProjectItem * pvitem = dynamic_cast<ProjectItem*>( m_listView->selectedItem() );
+ if ( !pvitem )
+ return;
+
+ TargetItem* titem = 0;
+
+ if ( pvitem->type() == ProjectItem::File )
+ titem = static_cast <TargetItem*> ( pvitem->parent() );
+ else
+ titem = static_cast <TargetItem*> ( m_listView->selectedItem() );
+
+ QString relpath = URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + m_part->activeDirectory();
+ m_part->executeTarget(QDir( DomUtil::readEntry( *m_part->projectDom(), "/kdevautoproject/run/cwd/"+titem->name )), titem);
+}
+
+void AutoDetailsView::slotRemoveDetail()
+{
+ ProjectItem * pvitem = dynamic_cast<ProjectItem*>( m_listView->selectedItem() );
+
+ if ( pvitem && ( pvitem->type() == ProjectItem::File ) )
+ {
+ FileItem * fitem = static_cast <FileItem*> ( m_listView->selectedItem() );
+ if(fitem && fitem->is_subst)
+ {
+ fitem->changeMakefileEntry("");
+ return;
+ }
+
+ QListViewItem* sibling = fitem->nextSibling();
+
+ if ( !fitem )
+ return;
+
+ TargetItem *titem = static_cast<TargetItem*>( fitem->parent() );
+
+ RemoveFileDialog dlg( m_widget, m_part, m_widget->selectedSubproject(),
+ titem, fitem->text( 0 ), this, "remove file dialog" );
+
+ QString caption;
+ if ( titem->name.isEmpty() )
+ caption = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix );
+ else
+ caption = titem->name;
+
+ dlg.setCaption ( i18n ( "Remove File From '%1'" ).arg ( caption ) );
+
+ if ( dlg.exec() )
+ {
+ emit selectionChanged( titem );
+
+ if ( sibling)
+ {
+ m_listView->setSelected ( sibling, true );
+ m_listView->ensureItemVisible ( sibling );
+ }
+ }
+
+ return;
+ }
+
+ if ( pvitem && ( pvitem->type() == ProjectItem::Target ) )
+ {
+ TargetItem* titem = static_cast <TargetItem*> ( m_listView->selectedItem() );
+ QListViewItem* sibling = titem->nextSibling();
+
+ if ( !titem ) return;
+
+ bool isactive = ( titem == m_widget->activeTarget() );
+ RemoveTargetDialog dlg ( m_widget, m_part, m_widget->selectedSubproject(),
+ titem, this, "remove target dialog" );
+
+ dlg.setCaption ( i18n ( "Remove Target From '%1'" ).arg ( m_widget->selectedSubproject()->subdir ) );
+
+ if ( dlg.exec() )
+ {
+ //details->takeItem ( titem );
+
+ m_widget->slotOverviewSelectionChanged ( m_widget->selectedSubproject() );
+
+ if( isactive )
+ m_widget->setActiveTarget("");
+ if ( sibling)
+ {
+ m_listView->setSelected ( sibling, true );
+ m_listView->ensureItemVisible ( sibling );
+ }
+ }
+
+ return;
+ }
+}
+
+
+void AutoDetailsView::slotDetailsContextMenu( KListView *, QListViewItem *item, const QPoint &p )
+{
+ if ( !item )
+ return;
+
+ ProjectItem *pvitem = dynamic_cast<ProjectItem*>( item );
+ if ( !pvitem )
+ {
+ kdDebug(9020) << k_funcinfo << "Cast to type of ProjectItem* failed."
+ << "Details context menu will be empty!";
+ return;
+ }
+
+ if ( pvitem->type() == ProjectItem::Target )
+ {
+
+ TargetItem * titem = dynamic_cast<TargetItem*>( pvitem );
+ if ( !titem )
+ {
+ kdDebug(9020) << k_funcinfo << "Unable to populate target item menu"
+ << " due to failed cast. " << endl;
+ return;
+ }
+
+ QString caption;
+ if ( titem->name.isEmpty() )
+ caption = i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix );
+ else
+ caption = titem->name;
+
+ KPopupMenu popup( i18n( "Target: %1" ).arg( caption ), this );
+
+ if ( titem->primary == "PROGRAMS" || titem->primary == "LIBRARIES"
+ || titem->primary == "LTLIBRARIES" || titem->primary == "JAVA" )
+ {
+ targetOptionsAction->plug( &popup );
+ popup.insertSeparator();
+ addNewFileAction->plug( &popup );
+ addExistingFileAction->plug( &popup );
+ popup.insertSeparator();
+ removeDetailAction->plug( &popup );
+ popup.insertSeparator();
+ setActiveTargetAction->plug( &popup );
+ popup.insertSeparator();
+ buildTargetAction->plug( &popup );
+ if( titem->primary == "PROGRAMS")
+ executeTargetAction->plug( &popup );
+ }
+ else if ( titem->primary == "KDEDOCS" )
+ {
+ addNewFileAction->plug( &popup );
+ addExistingFileAction->plug( &popup );
+ popup.insertSeparator();
+ removeDetailAction->plug( &popup );
+ popup.insertSeparator();
+ buildTargetAction->plug( &popup );
+ }
+ else if ( titem->primary == "KDEICON" )
+ {
+ addIconAction->plug( &popup );
+ popup.insertSeparator();
+ removeDetailAction->plug( &popup );
+ }
+ else
+ {
+ addNewFileAction->plug( &popup );
+ addExistingFileAction->plug( &popup );
+ popup.insertSeparator();
+ removeDetailAction->plug( &popup );
+ }
+
+ popup.exec( p );
+
+ }
+ else if ( pvitem->type() == ProjectItem::File )
+ {
+
+ FileItem * fitem = dynamic_cast<FileItem*>( pvitem );
+ if ( !fitem )
+ {
+ kdDebug(9020) << k_funcinfo << "Unable to populate file item menu"
+ << " due to failed cast. " << endl;
+ return;
+ }
+
+ KPopupMenu popup( i18n( "File: %1" ).arg( fitem->name ), this );
+
+ removeDetailAction->plug( &popup );
+ KURL::List urls;
+ urls.append(m_widget->selectedSubproject()->path + "/" + fitem->name);
+ FileContext context(urls);
+
+ int idSubclassWidget = popup.insertItem(SmallIconSet("qmake_subclass"),
+ i18n("Subclassing Wizard...") );
+ popup.setWhatsThis(idSubclassWidget, i18n("<b>Subclass widget</b><p>Launches "
+ "<b>Subclassing</b> wizard. "
+ "It allows to create a subclass from the "
+ "class defined in .ui file. "
+ "There is also possibility to implement "
+ "slots and functions defined in the base "
+ "class."));
+ int idUISubclasses = popup.insertItem(SmallIconSet("qmake_subclass"),
+ i18n("List of Subclasses..."));
+ popup.setWhatsThis(idUISubclasses, i18n("<b>List of subclasses</b><p>Shows "
+ "subclasses list editor. "
+ "There is possibility to add or remove "
+ "subclasses from the list."));
+ int idUpdateWidgetclass = popup.insertItem(SmallIconSet("qmake_subclass"),
+ i18n("Edit ui-Subclass..."));
+ popup.setWhatsThis(idUpdateWidgetclass, i18n("<b>Edit ui-subclass</b><p>Launches "
+ "<b>Subclassing</b> wizard and prompts "
+ "to implement missing in childclass "
+ "slots and functions."));
+ int idViewUIH = popup.insertItem(SmallIconSet("qmake_ui_h"),
+ i18n("Open ui.h File"));
+ popup.setWhatsThis(idViewUIH, i18n("<b>Open ui.h file</b><p>Opens .ui.h file "
+ "associated with the selected .ui."));
+
+ if (!fitem->name.contains(QRegExp("ui$")) || fitem->is_subst == true)
+ {
+ popup.removeItem(idUISubclasses);
+ popup.removeItem(idViewUIH);
+ popup.removeItem(idSubclassWidget);
+ }
+
+ if (fitem->uiFileLink.isEmpty())
+ popup.removeItem(idUpdateWidgetclass);
+
+ if(fitem->is_subst == false)
+ m_part->core()->fillContextMenu( &popup, &context );
+
+ int r = popup.exec( p );
+
+ if(r == idViewUIH)
+ {
+ m_part->partController()->editDocument(KURL(m_widget->selectedSubproject()->path
+ + "/" + QString(fitem->name + ".h")));
+ }
+ else if (r == idSubclassWidget)
+ {
+ QStringList newFileNames;
+ newFileNames = m_part->languageSupport()->subclassWidget(m_widget->selectedSubproject()->path + "/" + fitem->name);
+ if (!newFileNames.empty())
+ {
+ QDomDocument &dom = *(m_part->projectDom());
+ for (uint i=0; i<newFileNames.count(); i++)
+ {
+ QString srcfile_relpath = newFileNames[i];
+ srcfile_relpath.remove(0,m_part->projectDirectory().length());
+ QString uifile_relpath = QString(m_widget->selectedSubproject()->path + "/" + fitem->name).remove(0,m_part->projectDirectory().length());
+ DomUtil::PairList list = DomUtil::readPairListEntry(dom,"/kdevautoproject/subclassing",
+ "subclass","sourcefile", "uifile");
+
+ list << DomUtil::Pair(srcfile_relpath,uifile_relpath);
+ DomUtil::writePairListEntry(dom, "/kdevautoproject/subclassing",
+ "subclass", "sourcefile", "uifile", list);
+ newFileNames[i] = newFileNames[i].replace(QRegExp(m_part->projectDirectory()+"/"),"");
+ }
+ m_subclasslist = DomUtil::readPairListEntry(dom,"/kdevautoproject/subclassing",
+ "subclass","sourcefile", "uifile");
+ m_part->addFiles(newFileNames);
+ }
+ }
+ else if (r == idUpdateWidgetclass)
+ {
+ QString noext = m_widget->selectedSubproject()->path + "/" + fitem->name;
+
+ if (noext.findRev('.')>-1)
+ noext = noext.left(noext.findRev('.'));
+
+ QStringList dummy;
+ QString uifile = fitem->uiFileLink;
+
+ if (uifile.findRev('/')>-1)
+ {
+ QStringList uisplit = QStringList::split('/',uifile);
+ uifile=uisplit[uisplit.count()-1];
+ }
+
+ m_part->languageSupport()->updateWidget(m_widget->selectedSubproject()->path
+ + "/" + uifile, noext);
+ }
+ else if (r == idUISubclasses)
+ {
+ QDomDocument &dom = *(m_part->projectDom());
+ DomUtil::PairList list = DomUtil::readPairListEntry(dom,"/kdevautoproject/subclassing",
+ "subclass","sourcefile", "uifile");
+ SubclassesDlg *sbdlg = new SubclassesDlg( QString(m_widget->selectedSubproject()->path + "/" +fitem->name).remove(0,m_part->projectDirectory().length()),
+ list, m_part->projectDirectory());
+
+ if (sbdlg->exec())
+ {
+ QDomElement el = DomUtil::elementByPath( dom, "/kdevautoproject");
+ QDomElement el2 = DomUtil::elementByPath( dom, "/kdevautoproject/subclassing");
+ if ( (!el.isNull()) && (!el2.isNull()) )
+ {
+ el.removeChild(el2);
+ }
+
+ DomUtil::writePairListEntry(dom, "/kdevautoproject/subclassing", "subclass",
+ "sourcefile", "uifile", list);
+
+ m_subclasslist = DomUtil::readPairListEntry(dom,"/kdevautoproject/subclassing",
+ "subclass","sourcefile", "uifile");
+ }
+ }
+ }
+}
+
+
+void AutoDetailsView::slotDetailsExecuted( QListViewItem *item )
+{
+ if ( !item )
+ return ;
+
+ ProjectItem *pvitem = static_cast<ProjectItem*>( item );
+ if ( pvitem->type() != ProjectItem::File )
+ return ;
+
+ if ( !m_widget->selectedSubproject() )
+ return;
+
+ QString dirName = m_widget->selectedSubproject()->path;
+ FileItem *fitem = static_cast<FileItem*>( item );
+ if(fitem->is_subst)
+ {
+ fitem->changeSubstitution();
+ return;
+ }
+
+ m_part->partController()->editDocument( KURL( dirName + "/" + fitem->name ) );
+}
+
+void AutoDetailsView::slotSetActiveTarget()
+{
+ TargetItem * titem = static_cast<TargetItem*>( m_listView->selectedItem() );
+ if ( !titem ) return ;
+
+ SubprojectItem * subpitem = m_widget->selectedSubproject();
+ if ( !subpitem ) return;
+
+ QString targetPath = subpitem->path + "/" + titem->name;
+ targetPath = targetPath.mid( m_part->projectDirectory().length() + 1 );
+ kdDebug( 9020 ) << "Setting active " << targetPath << endl;
+ m_widget->setActiveTarget( targetPath );
+ QDomDocument &dom = *m_part->projectDom();
+ DomUtil::writeEntry( dom, "/kdevautoproject/general/activetarget", targetPath );
+}
+
+void AutoDetailsView::focusOutEvent(QFocusEvent */*e*/)
+{
+ m_widget->setLastFocusedView(AutoProjectWidget::DetailsView);
+}
+
+#include "autodetailsview.moc"
+
+//kate: indent-mode csands; tab-width 4; space-indent off;
diff --git a/buildtools/autotools/autodetailsview.h b/buildtools/autotools/autodetailsview.h
new file mode 100644
index 00000000..ee67558d
--- /dev/null
+++ b/buildtools/autotools/autodetailsview.h
@@ -0,0 +1,88 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2002 by Victor Roeder <victor_roeder@gmx.de>
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+* *
+***************************************************************************
+*/
+
+#ifndef AUTODETAILSVIEW_H
+#define AUTODETAILSVIEW_H
+
+#include "autoprojectviewbase.h"
+
+#include "domutil.h"
+#include "autolistviewitems.h"
+
+class KAction;
+
+class AutoProjectPart;
+class AutoProjectWidget;
+class AutoToolsAction;
+
+class AutoDetailsView : protected AutoProjectViewBase
+{
+ friend class RemoveFileDialog;
+ friend class FileItem;
+ Q_OBJECT
+
+public:
+ AutoDetailsView( AutoProjectWidget* widget, AutoProjectPart* part, QWidget *parent, const char *name );
+ virtual ~AutoDetailsView();
+
+ QString getUiFileLink( const QString &path, const QString& filename );
+ KListView* listView()
+ {
+ return m_listView;
+ }
+
+public slots:
+ void slotSelectionChanged( QListViewItem* item );
+ void slotSelectionChanged();
+
+signals:
+ void selectionChanged( QListViewItem* );
+
+protected:
+ void initActions ();
+ virtual void focusOutEvent( QFocusEvent *e );
+
+private slots:
+ void slotDetailsExecuted( QListViewItem *item );
+ void slotDetailsContextMenu( KListView *, QListViewItem *item, const QPoint &p );
+
+ void slotTargetOptions ();
+ void slotAddNewFile();
+ void slotAddExistingFile();
+ void slotAddIcon();
+ void slotBuildTarget();
+ void slotExecuteTarget();
+ void slotRemoveDetail();
+ void slotSetActiveTarget();
+
+private:
+ AutoProjectWidget* m_widget;
+ AutoProjectPart* m_part;
+
+ DomUtil::PairList m_subclasslist;
+
+ AutoToolsAction* targetOptionsAction;
+ AutoToolsAction* addNewFileAction;
+ AutoToolsAction* addExistingFileAction;
+ KAction* addIconAction;
+ AutoToolsAction* buildTargetAction;
+ AutoToolsAction* executeTargetAction;
+ KAction* setActiveTargetAction;
+ AutoToolsAction* removeDetailAction;
+
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/autolistviewitems.cpp b/buildtools/autotools/autolistviewitems.cpp
new file mode 100644
index 00000000..454d12f5
--- /dev/null
+++ b/buildtools/autotools/autolistviewitems.cpp
@@ -0,0 +1,181 @@
+/***************************************************************************
+* Copyright (C) 2001-2002 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* Copyright (C) 2002 by Victor Rder *
+* victor_roeder@gmx.de *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#include <qpainter.h>
+#include <qinputdialog.h>
+#include <qregexp.h>
+
+#include <kiconloader.h>
+#include "misc.h"
+#include "autolistviewitems.h"
+#include "autoprojectpart.h"
+#include "autoprojectwidget.h"
+#include "autodetailsview.h"
+
+/**
+* Class ProjectItem
+*/
+
+ProjectItem::ProjectItem( Type type, QListView *parent, const QString &text )
+ : QListViewItem( parent, text ), typ( type )
+{
+ bld = false;
+}
+
+
+ProjectItem::ProjectItem( Type type, ProjectItem *parent, const QString &text )
+ : QListViewItem( parent, text ), typ( type )
+{
+ bld = false;
+}
+
+
+void ProjectItem::paintCell( QPainter *p, const QColorGroup &cg,
+ int column, int width, int alignment )
+{
+ if ( isBold() )
+ {
+ QFont font( p->font() );
+ font.setBold( true );
+ p->setFont( font );
+ }
+ QListViewItem::paintCell( p, cg, column, width, alignment );
+}
+
+
+/**
+* Class SubprojectItem
+*/
+
+SubprojectItem::SubprojectItem( QListView *parent, const QString &text )
+ : ProjectItem( Subproject, parent, text )
+{
+ init();
+}
+
+
+SubprojectItem::SubprojectItem( SubprojectItem *parent, const QString &text )
+ : ProjectItem( Subproject, parent, text )
+{
+ init();
+}
+
+
+void SubprojectItem::init()
+{
+ targets.setAutoDelete( true );
+ setPixmap( 0, SmallIcon( "folder" ) );
+}
+
+
+QString SubprojectItem::relativePath()
+{
+ QString relpath = subdir;
+
+ SubprojectItem *it = this;
+ while ( (it= dynamic_cast<SubprojectItem*>(it->parent())) )
+ {
+ relpath.prepend(it->subdir + "/");
+ }
+ relpath.remove(0, 2);
+
+ return relpath;
+}
+
+
+/**
+* Class TargetItem
+*/
+
+TargetItem::TargetItem( QListView *lv, bool group, const QString &text )
+ : ProjectItem( Target, lv, text )
+{
+ sources.setAutoDelete( true );
+ setPixmap( 0, group ? SmallIcon( "tar" ) : SmallIcon( "binary" ) );
+}
+
+
+/**
+* Class FileItem
+*/
+
+FileItem::FileItem( QListView *lv, const QString &text, bool set_is_subst )
+ : ProjectItem( File, lv, text ) , is_subst(set_is_subst)
+{
+ if(!is_subst)
+ {
+ setPixmap( 0, SmallIcon( "document" ) );
+ }
+ else
+ {
+ setPixmap( 0, SmallIcon( "variablenew" ) );
+ }
+}
+
+
+void FileItem::changeSubstitution()
+{
+if(!is_subst)
+return;
+
+ bool ok;
+ QString text = QInputDialog::getText(
+ i18n("Edit Substitution"), i18n("Substitution:"), QLineEdit::Normal,
+ name, &ok );
+ if ( ok && !text.isEmpty() )
+ {
+ // user entered something and pressed OK
+ QString new_name = text;
+ if(new_name == name)
+ return;
+ setText(0,new_name);
+ changeMakefileEntry(new_name);
+ name = new_name;
+ }
+ else
+ {
+ // user entered nothing or pressed Cancel
+
+ }
+}
+
+void FileItem::changeMakefileEntry(const QString& new_name)
+{
+ TargetItem* target = dynamic_cast<TargetItem*>(parent());
+
+ QMap<QString,QString> replaceMap;
+
+ QString canontargetname = AutoProjectTool::canonicalize(target->name);
+ QString varname;
+ if( target->primary == "PROGRAMS" || target->primary == "LIBRARIES" || target->primary == "LTLIBRARIES" )
+ varname = canontargetname + "_SOURCES";
+ else
+ varname = target->prefix + "_" + target->primary;
+ if( AutoDetailsView* lv = dynamic_cast<AutoDetailsView*>(listView()) )
+ {
+ if ( SubprojectItem* subProject = lv->m_part->m_widget->selectedSubproject() )
+ {
+ QStringList sources = QStringList::split(QRegExp("[ \t\n]"), subProject->variables[varname]);
+ QStringList::iterator it = sources.find(name);
+ (*it) = new_name;
+ subProject->variables[varname] = sources.join(" ");
+ replaceMap.insert(varname, subProject->variables[varname]);
+
+ AutoProjectTool::addToMakefileam(subProject->path + "/Makefile.am", replaceMap);
+
+ if(new_name == "")
+ target->sources.remove(this);
+ }
+ }
+}
diff --git a/buildtools/autotools/autolistviewitems.h b/buildtools/autotools/autolistviewitems.h
new file mode 100644
index 00000000..0dece2a2
--- /dev/null
+++ b/buildtools/autotools/autolistviewitems.h
@@ -0,0 +1,143 @@
+/***************************************************************************
+* Copyright (C) 2001-2002 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* Copyright (C) 2002 by Victor Röder *
+* victor_roeder@gmx.de *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef AUTOLISTVIEWITEMS_H
+#define AUTOLISTVIEWITEMS_H
+
+#include <qptrlist.h>
+
+#include <qlistview.h>
+
+class TargetItem;
+class FileItem;
+class AutoProjectPart;
+
+/**
+* Base class for all items appearing in ProjectOverview and ProjectDetails.
+*/
+class ProjectItem : public QListViewItem
+{
+public:
+ enum Type { Subproject, Target, File };
+
+ ProjectItem( Type type, QListView *parent, const QString &text );
+ ProjectItem( Type type, ProjectItem *parent, const QString &text );
+
+ void paintCell( QPainter *p, const QColorGroup &cg,
+ int column, int width, int alignment );
+ void setBold( bool b )
+ {
+ bld = b;
+ }
+ bool isBold() const
+ {
+ return bld;
+ }
+ Type type()
+ {
+ return typ;
+ }
+
+private:
+ Type typ;
+ bool bld;
+
+};
+
+
+/**
+* Stores the content of one Makefile.am
+*/
+class SubprojectItem : public ProjectItem
+{
+public:
+ SubprojectItem( QListView *parent, const QString &text );
+ SubprojectItem( SubprojectItem *parent, const QString &text );
+
+ /** name of the directory */
+ QString subdir;
+ /** absolute path */
+ QString path;
+ /** mapping from prefix to path */
+ QMap<QString, QString> prefixes;
+ /** mapping from variable name to value */
+ QMap<QString, QString> variables;
+ /** list of targets */
+ QPtrList<TargetItem> targets;
+
+ QString relativePath();
+
+private:
+ void init();
+};
+
+
+/**
+* Stores one target
+* For e.g. the line
+* bin_LTLIBRARIES = foo.la
+* generates a target with name 'foo.la', primary LTLIBRARIES and prefix 'bin'
+* In order to make things not too simple ;-) headers and data are handled
+* a bit different from programs, libraries and scripts: All headers for a
+* certain prefix (analogously for data) are put in _one_ TargetItem object,
+* and the names of the files are put in the sources variable. This avoids
+* cluttering the list view with lots of header items.
+*/
+class TargetItem : public ProjectItem
+{
+public:
+ //enum TargetKind { Program, Library, DataGroup, IconGroup, DocGroup };
+
+ TargetItem( QListView *lv, bool group, const QString &text );
+
+ // Target kind - not used currently
+ //TargetKind kind;
+ //! Name of target, e.g. foo
+ QString name;
+ //! One of PROGRAMS, LIBRARIES, LTLIBRARIES, SCRIPTS, HEADERS, DATA, JAVA
+ //! In addition to these automake primaries, we use KDEICON and KDEDOCS
+ //! for am_edit magic
+ QString primary;
+ //! May be bin, pkglib, noinst, check, sbin, pkgdata, java...
+ QString prefix;
+ //! Content of foo_SOURCES (or java_JAVA) assignment
+ QPtrList<FileItem> sources;
+ //! Content of foo_LDFLAGS assignment
+ QString ldflags;
+ //! Content of foo_LDADD assignment
+ QString ldadd;
+ //! Content of foo_LIBADD assignment
+ QString libadd;
+ //! Content of foo_DEPENDENCIES assignment
+ QString dependencies;
+};
+
+
+// Not sure if this complexity is really necessary...
+class FileItem : public ProjectItem
+{
+
+public:
+ FileItem( QListView *lv, const QString &text, bool set_is_subst = false );
+ void changeSubstitution();
+ void changeMakefileEntry( const QString& );
+
+ QString name;
+ QString uiFileLink;
+ const bool is_subst;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
+
diff --git a/buildtools/autotools/autoprojectpart.cpp b/buildtools/autotools/autoprojectpart.cpp
new file mode 100644
index 00000000..ea0b6896
--- /dev/null
+++ b/buildtools/autotools/autoprojectpart.cpp
@@ -0,0 +1,1474 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * Copyright (C) 2002 by Victor Roeder *
+ * victor_roeder@gmx.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <config.h>
+
+#include "autoprojectpart.h"
+#include "autolistviewitems.h"
+#include "configureoptionswidget.h"
+#include "addtranslationdlg.h"
+#include "addicondlg.h"
+#include "autoprojectwidget.h"
+
+#include <qdom.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qpopupmenu.h>
+#include <qstringlist.h>
+#include <qwhatsthis.h>
+#include <qregexp.h>
+#include <qgroupbox.h>
+
+
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kparts/part.h>
+#include <kdeversion.h>
+#include <kprocess.h>
+
+#include <domutil.h>
+#include <kdevcore.h>
+#include <kdevmakefrontend.h>
+#include <kdevappfrontend.h>
+#include <kdevmainwindow.h>
+#include <kdevpartcontroller.h>
+#include <makeoptionswidget.h>
+#include <runoptionswidget.h>
+#include <envvartools.h>
+
+#include <configwidgetproxy.h>
+#include <kdevplugininfo.h>
+#include <urlutil.h>
+
+#define CONFIGURE_OPTIONS 1
+#define RUN_OPTIONS 2
+#define MAKE_OPTIONS 3
+
+static const KDevPluginInfo data("kdevautoproject");
+
+K_EXPORT_COMPONENT_FACTORY( libkdevautoproject, AutoProjectFactory( data ) )
+
+AutoProjectPart::AutoProjectPart(QObject *parent, const char *name, const QStringList &args)
+ : KDevBuildTool(&data, parent, name ? name : "AutoProjectPart")
+ , m_lastCompilationFailed(false)
+{
+ setInstance(AutoProjectFactory::instance());
+
+ setXMLFile("kdevautoproject.rc");
+
+ m_executeAfterBuild = false;
+ m_isKDE = (args[0] == "kde");
+ m_needMakefileCvs = false;
+
+ m_widget = new AutoProjectWidget(this, m_isKDE);
+ m_widget->setIcon(SmallIcon( info()->icon() ));
+ m_widget->setCaption(i18n("Automake Manager"));
+ QWhatsThis::add(m_widget, i18n("<b>Automake manager</b><p>"
+ "The project tree consists of two parts. The 'overview' "
+ "in the upper half shows the subprojects, each one having a "
+ "Makefile.am. The 'details' view in the lower half shows the "
+ "targets and files for the subproject selected in the overview."));
+
+ mainWindow()->embedSelectViewRight(m_widget, i18n("Automake Manager"), i18n("Automake manager"));
+ KAction *action;
+
+ action = new KAction( i18n("Add Translation..."), 0,
+ this, SLOT(slotAddTranslation()),
+ actionCollection(), "project_addtranslation" );
+ action->setToolTip(i18n("Add translation"));
+ action->setWhatsThis(i18n("<b>Add translation</b><p>Creates .po file for the selected language."));
+ action->setGroup("autotools");
+
+
+ if (!m_isKDE)
+ action->setEnabled(false);
+
+ action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8,
+ this, SLOT(slotBuild()),
+ actionCollection(), "build_build" );
+ action->setToolTip(i18n("Build project"));
+ action->setWhatsThis(i18n("<b>Build project</b><p>Runs <b>make</b> from the project directory.<br>"
+ "Environment variables and make arguments can be specified "
+ "in the project settings dialog, <b>Make Options</b> tab."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("Build &Active Target"), "make_kdevelop", Key_F7,
+ this, SLOT(slotBuildActiveTarget()),
+ actionCollection(), "build_buildactivetarget" );
+ action->setToolTip(i18n("Build active target"));
+ action->setWhatsThis(i18n("<b>Build active target</b><p>Constructs a series of make commands to build an active target. "
+ "Also builds dependent targets.<br>"
+ "Environment variables and make arguments can be specified "
+ "in the project settings dialog, <b>Make Options</b> tab."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("Compile &File"), "make_kdevelop",
+ this, SLOT(slotCompileFile()),
+ actionCollection(), "build_compilefile" );
+ action->setToolTip(i18n("Compile file"));
+ action->setWhatsThis(i18n("<b>Compile file</b><p>Runs <b>make filename.o</b> command from the directory where 'filename' is the name of currently opened file.<br>"
+ "Environment variables and make arguments can be specified "
+ "in the project settings dialog, <b>Make Options</b> tab."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("Run Configure"), 0,
+ this, SLOT(slotConfigure()),
+ actionCollection(), "build_configure" );
+ action->setToolTip(i18n("Run configure"));
+ action->setWhatsThis(i18n("<b>Run configure</b><p>Executes <b>configure</b> with flags, arguments "
+ "and environment variables specified in the project settings dialog, "
+ "<b>Configure Options</b> tab."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("Run automake && friends"), 0,
+ this, SLOT(slotMakefilecvs()),
+ actionCollection(), "build_makefilecvs" );
+ action->setToolTip(i18n("Run automake && friends"));
+ action->setWhatsThis(i18n("<b>Run automake && friends</b><p>Executes<br><b>make -f Makefile.cvs</b><br><b>./configure</b><br>commands from the project directory."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("Install"), 0,
+ this, SLOT(slotInstall()),
+ actionCollection(), "build_install" );
+ action->setToolTip(i18n("Install"));
+ action->setWhatsThis(i18n("<b>Install</b><p>Runs <b>make install</b> command from the project directory.<br>"
+ "Environment variables and make arguments can be specified "
+ "in the project settings dialog, <b>Make Options</b> tab."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("Install (as root user)"), 0,
+ this, SLOT(slotInstallWithKdesu()),
+ actionCollection(), "build_install_kdesu" );
+ action->setToolTip(i18n("Install as root user"));
+ action->setWhatsThis(i18n("<b>Install</b><p>Runs <b>make install</b> command from the project directory with root privileges.<br>"
+ "It is executed via kdesu command.<br>"
+ "Environment variables and make arguments can be specified "
+ "in the project settings dialog, <b>Make Options</b> tab."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("&Clean Project"), 0,
+ this, SLOT(slotClean()),
+ actionCollection(), "build_clean" );
+ action->setToolTip(i18n("Clean project"));
+ action->setWhatsThis(i18n("<b>Clean project</b><p>Runs <b>make clean</b> command from the project directory.<br>"
+ "Environment variables and make arguments can be specified "
+ "in the project settings dialog, <b>Make Options</b> tab."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("&Distclean"), 0,
+ this, SLOT(slotDistClean()),
+ actionCollection(), "build_distclean" );
+ action->setToolTip(i18n("Distclean"));
+ action->setWhatsThis(i18n("<b>Distclean</b><p>Runs <b>make distclean</b> command from the project directory.<br>"
+ "Environment variables and make arguments can be specified "
+ "in the project settings dialog, <b>Make Options</b> tab."));
+ action->setGroup("autotools");
+
+ action = new KAction( i18n("Make Messages && Merge"), 0,
+ this, SLOT(slotMakeMessages()),
+ actionCollection(), "build_messages" );
+ action->setToolTip(i18n("Make messages && merge"));
+ action->setWhatsThis(i18n("<b>Make messages && merge</b><p>Runs <b>make package-messages</b> command from the project directory.<br>"
+ "Environment variables and make arguments can be specified "
+ "in the project settings dialog, <b>Make Options</b> tab."));
+ action->setGroup("autotools");
+
+ if (!m_isKDE)
+ action->setEnabled(false);
+
+ buildConfigAction = new KSelectAction( i18n("Build Configuration"), 0,
+ actionCollection(), "project_configuration" );
+ buildConfigAction->setToolTip(i18n("Build configuration menu"));
+ buildConfigAction->setWhatsThis(i18n("<b>Build configuration menu</b><p>Allows to switch between project build configurations.<br>"
+ "Build configuration is a set of build and top source directory settings, "
+ "configure flags and arguments, compiler flags, etc.<br>"
+ "Modify build configurations in project settings dialog, <b>Configure Options</b> tab."));
+ buildConfigAction->setGroup("autotools");
+
+ QDomDocument &dom = *projectDom();
+ if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/run/disable_default")) {
+ //ok we handle the execute in this kpart
+ action = new KAction( i18n("Execute Program"), "exec", SHIFT+Key_F9,
+ this, SLOT(slotExecute()),
+ actionCollection(), "build_execute" );
+ action->setToolTip(i18n("Execute program"));
+ action->setWhatsThis(i18n("<b>Execute program</b><p>Executes the currently active target or the main program specified in project settings, <b>Run Options</b> tab."));
+ action->setGroup("autotools");
+ }
+
+ connect( buildConfigAction, SIGNAL(activated(const QString&)),
+ this, SLOT(slotBuildConfigChanged(const QString&)) );
+ connect( buildConfigAction->popupMenu(), SIGNAL(aboutToShow()),
+ this, SLOT(slotBuildConfigAboutToShow()) );
+
+// connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(projectConfigWidget(KDialogBase*)) );
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createProjectConfigPage( i18n("Configure Options"), CONFIGURE_OPTIONS, info()->icon() );
+ _configProxy->createProjectConfigPage( i18n("Run Options"), RUN_OPTIONS, info()->icon() );
+ _configProxy->createProjectConfigPage( i18n("Make Options"), MAKE_OPTIONS, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+
+ connect( makeFrontend(), SIGNAL(commandFinished(const QString&)),
+ this, SLOT(slotCommandFinished(const QString&)) );
+ connect( makeFrontend(), SIGNAL(commandFailed(const QString&)),
+ this, SLOT(slotCommandFailed(const QString&)) );
+
+ setWantautotools();
+
+
+}
+
+
+AutoProjectPart::~AutoProjectPart()
+{
+ if (m_widget)
+ {
+ mainWindow()->removeView(m_widget);
+ }
+ delete m_widget;
+ delete _configProxy;
+}
+
+
+void AutoProjectPart::insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int pagenumber )
+{
+ switch ( pagenumber )
+ {
+ case CONFIGURE_OPTIONS:
+ {
+ ConfigureOptionsWidget *w2 = new ConfigureOptionsWidget(this, page );
+ connect( dlg, SIGNAL(okClicked()), w2, SLOT(accept()) );
+ }
+ break;
+
+ case RUN_OPTIONS:
+ {
+ QDomDocument &dom = *projectDom();
+ if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/run/disable_default"))
+ {
+ //ok we handle the execute in this kpart
+ RunOptionsWidget *w3 = new RunOptionsWidget(*projectDom(), "/kdevautoproject", buildDirectory(), page );
+ connect( dlg, SIGNAL(okClicked()), w3, SLOT(accept()) );
+ }
+ }
+ break;
+
+ case MAKE_OPTIONS:
+ {
+ MakeOptionsWidget *w4 = new MakeOptionsWidget(*projectDom(), "/kdevautoproject", page );
+ connect( dlg, SIGNAL(okClicked()), w4, SLOT(accept()) );
+ }
+ break;
+ }
+}
+
+void AutoProjectPart::openProject(const QString &dirName, const QString &projectName)
+{
+ m_projectName = projectName;
+ m_projectPath =dirName;
+
+ m_widget->openProject(dirName);
+
+ QDomDocument &dom = *projectDom();
+ QString activeTarget = DomUtil::readEntry(dom, "/kdevautoproject/general/activetarget");
+ kdDebug(9020) << k_funcinfo << "activeTarget " << activeTarget << endl;
+ if (!activeTarget.isEmpty())
+ m_widget->setActiveTarget(activeTarget);
+ else
+ {
+ KMessageBox::information( m_widget, i18n("No active target specified, running the application will\n"
+ "not work until you make a target active in the Automake Manager\n"
+ "on the right side or use the Main Program options under\n"
+ "Project -> Project Options -> Run Options"), i18n("No active target specified"), "kdevelop_open_project_no_active_target");
+ }
+
+ KDevProject::openProject( dirName, projectName );
+}
+
+
+void AutoProjectPart::closeProject()
+{
+ m_widget->closeProject();
+}
+
+
+QString AutoProjectPart::projectDirectory() const
+{
+ return m_projectPath;
+}
+
+
+QString AutoProjectPart::projectName() const
+{
+ return m_projectName;
+}
+
+
+/** Retuns a PairList with the run environment variables */
+DomUtil::PairList AutoProjectPart::runEnvironmentVars() const
+{
+ return DomUtil::readPairListEntry(*projectDom(), "/kdevautoproject/run/envvars", "envvar", "name", "value");
+}
+
+
+/** Retuns the currently selected run directory
+ * If no main Program was selected in the Run Options dialog
+ * use the currently active target instead to calculate it.
+ * The returned string can be:
+ * if /kdevautoproject/run/directoryradio == executable
+ * The directory where the executable is
+ * if /kdevautoproject/run/directoryradio == build
+ * The directory where the executable is relative to build directory
+ * if /kdevautoproject/run/directoryradio == custom
+ * The custom directory absolute path
+ */
+QString AutoProjectPart::runDirectory() const
+{
+
+ QDomDocument &dom = *projectDom();
+
+ QString cwd;
+ if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() )
+ {
+ cwd = defaultRunDirectory("kdevautoproject");
+ }else
+ {
+ cwd = DomUtil::readEntry( dom, "/kdevautoproject/run/cwd/"+m_widget->activeTarget()->name );
+ }
+ if( cwd.isEmpty() )
+ cwd = buildDirectory() +"/"+ URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) +"/"+m_widget->activeDirectory();
+
+ return cwd;
+}
+
+
+/** Retuns the currently selected main program
+ * If no main Program was selected in the Run Options dialog
+ * use the currently active target instead.
+ * The returned string can be:
+ * if /kdevautoproject/run/directoryradio == executable
+ * The executable name
+ * if /kdevautoproject/run/directoryradio == build
+ * The path to executable relative to build directory
+ * if /kdevautoproject/run/directoryradio == custom or relative == false
+ * The absolute path to executable
+ */
+
+QString AutoProjectPart::mainProgram() const
+{
+ QDomDocument * dom = projectDom();
+
+ if ( !dom ) return QString();
+
+ if( DomUtil::readBoolEntry(*dom, "/kdevautoproject/run/useglobalprogram", false) )
+ {
+ QString DomMainProgram = DomUtil::readEntry(*dom, "/kdevautoproject/run/mainprogram");
+
+ if ( DomMainProgram.isEmpty() ) return QString();
+
+ if ( DomMainProgram.startsWith("/") ) // assume absolute path
+ {
+ return DomMainProgram;
+ }
+ else // assume builddir relative path
+ {
+ QString relprojectpath = URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() );
+ if( !relprojectpath.isEmpty() )
+ relprojectpath = "/" + relprojectpath;
+ return buildDirectory() + relprojectpath + "/" + DomMainProgram;
+ }
+
+ }
+ else // If no Main Program was specified, return the active target
+ {
+ TargetItem* titem = m_widget->activeTarget();
+
+ if ( !titem ) {
+ KMessageBox::error( m_widget, i18n("There is no active target.\n"
+ "Unable to determine the main program."), i18n("No active target found") );
+ kdDebug ( 9020 ) << k_funcinfo << "Error! : There's no active target! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl;
+ return QString::null;
+ }
+
+ if ( titem->primary != "PROGRAMS" ) {
+ KMessageBox::error( m_widget, i18n("Active target \"%1\" is not binary ( %2 ).\n"
+ "Unable to determine the main program. If you want this\n"
+ "to be the active target, set a main program under\n"
+ "Project -> Project Options -> Run Options").arg(titem->name).arg(titem->primary), i18n("Active target is not a library") );
+ kdDebug ( 9020 ) << k_funcinfo << "Error! : Active target isn't binary (" << titem->primary << ") ! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl;
+ return QString::null;
+ }
+
+ QString relprojectpath = URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() );
+ if( !relprojectpath.isEmpty() )
+ relprojectpath = "/" + relprojectpath;
+ return buildDirectory() + relprojectpath + "/" + activeDirectory() + "/" + titem->name;
+ }
+}
+
+
+/** Retuns a QString with the debug command line arguments */
+QString AutoProjectPart::debugArguments() const
+{
+ QDomDocument &dom = *projectDom();
+
+ if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() )
+ {
+ return DomUtil::readEntry(dom, "/kdevautoproject/run/globaldebugarguments");
+ }else
+ {
+ return DomUtil::readEntry(dom, "/kdevautoproject/run/debugarguments/" + m_widget->activeTarget()->name);
+ }
+}
+
+
+/** Retuns a QString with the run command line arguments */
+QString AutoProjectPart::runArguments() const
+{
+ QDomDocument &dom = *projectDom();
+
+ if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() )
+ {
+ return DomUtil::readEntry(dom, "/kdevautoproject/run/programargs");
+ }else
+ {
+ return DomUtil::readEntry(dom, "/kdevautoproject/run/runarguments/" + m_widget->activeTarget()->name);
+ }
+}
+
+
+QString AutoProjectPart::activeDirectory() const
+{
+ return m_widget->activeDirectory();
+}
+
+
+QStringList AutoProjectPart::allFiles() const
+{
+ return m_widget->allFiles();
+}
+
+
+void AutoProjectPart::setWantautotools()
+{
+ QDomDocument &dom = *projectDom();
+ QDomElement el = DomUtil::elementByPath(dom, "/kdevautoproject/make");
+ if ( el.namedItem("envvars").isNull() ) {
+ DomUtil::PairList list;
+ list << DomUtil::Pair("WANT_AUTOCONF_2_5", "1");
+ list << DomUtil::Pair("WANT_AUTOMAKE_1_6", "1");
+ DomUtil::writePairListEntry(dom, "/kdevautoproject/make/envvars", "envvar", "name", "value", list);
+ }
+}
+
+
+QString AutoProjectPart::makeEnvironment() const
+{
+ // Get the make environment variables pairs into the environstr string
+ // in the form of: "ENV_VARIABLE=ENV_VALUE"
+ // Note that we quote the variable value due to the possibility of
+ // embedded spaces
+ DomUtil::PairList envvars =
+ DomUtil::readPairListEntry(*projectDom(), "/kdevautoproject/make/envvars", "envvar", "name", "value");
+
+ QString environstr;
+ DomUtil::PairList::ConstIterator it;
+ for (it = envvars.begin(); it != envvars.end(); ++it)
+ {
+ environstr += (*it).first;
+ environstr += "=";
+ environstr += EnvVarTools::quote((*it).second);
+ environstr += " ";
+ }
+
+ KConfigGroup grp( kapp->config(), "MakeOutputView" );
+ if( grp.readBoolEntry( "ForceCLocale", true ) )
+ environstr += "LC_MESSAGES="+EnvVarTools::quote("C")+" "+"LC_CTYPE="+EnvVarTools::quote("C")+" ";
+
+ return environstr;
+}
+
+
+void AutoProjectPart::addFile(const QString &fileName)
+{
+ QStringList fileList;
+ fileList.append ( fileName );
+
+ this->addFiles ( fileList );
+}
+
+void AutoProjectPart::addFiles ( const QStringList& fileList )
+{
+ QString directory, name;
+ QStringList::ConstIterator it;
+ bool messageBoxShown = false;
+
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ int pos = ( *it ).findRev('/');
+ if (pos != -1)
+ {
+ directory = ( *it ).left(pos);
+ name = ( *it ).mid(pos+1);
+ }
+ else
+ {
+ directory = "";
+ name = ( *it );
+ }
+
+ if (directory != m_widget->activeDirectory() ||
+ directory.isEmpty())
+ {
+ if ( !messageBoxShown )
+ {
+ KMessageBox::information(m_widget, i18n("The directory you selected is not the active directory.\n"
+ "You should 'activate' the target you're currently working on in Automake Manager.\n"
+ "Just right-click a target and choose 'Make Target Active'."),
+ i18n ( "No Active Target Found" ), "No automake manager active target warning" );
+ messageBoxShown = true;
+ }
+ }
+ }
+
+ m_widget->addFiles(fileList);
+}
+
+void AutoProjectPart::removeFile(const QString &fileName)
+{
+ QStringList fileList;
+ fileList.append ( fileName );
+
+ this->removeFiles ( fileList );
+}
+
+void AutoProjectPart::removeFiles ( const QStringList& fileList )
+{
+ /// \FIXME m_widget->removeFiles does nothing!
+ m_widget->removeFiles ( fileList );
+
+ emit removedFilesFromProject ( fileList );
+}
+
+QStringList AutoProjectPart::allBuildConfigs() const
+{
+ QDomDocument &dom = *projectDom();
+
+ QStringList allConfigs;
+ allConfigs.append("default");
+
+ QDomNode node = dom.documentElement().namedItem("kdevautoproject").namedItem("configurations");
+ QDomElement childEl = node.firstChild().toElement();
+ while (!childEl.isNull())
+ {
+ QString config = childEl.tagName();
+ kdDebug(9020) << k_funcinfo << "Found config " << config << endl;
+ if (config != "default")
+ allConfigs.append(config);
+ childEl = childEl.nextSibling().toElement();
+ }
+
+ return allConfigs;
+}
+
+
+QString AutoProjectPart::currentBuildConfig() const
+{
+ QDomDocument &dom = *projectDom();
+
+ QString config = DomUtil::readEntry(dom, "/kdevautoproject/general/useconfiguration");
+ if (config.isEmpty() || !allBuildConfigs().contains(config))
+ config = "default";
+
+ return config;
+}
+
+
+QString AutoProjectPart::buildDirectory() const
+{
+ QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/";
+
+ QString builddir = DomUtil::readEntry(*projectDom(), prefix + "builddir");
+ if (builddir.isEmpty())
+ return topsourceDirectory();
+ else if (builddir.startsWith("/"))
+ return builddir;
+ else
+ return projectDirectory() + "/" + builddir;
+}
+
+QString AutoProjectPart::topsourceDirectory() const
+{
+ QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/";
+
+ QString topsourcedir = DomUtil::readEntry(*projectDom(), prefix + "topsourcedir");
+ if (topsourcedir.isEmpty())
+ return projectDirectory();
+ else if (topsourcedir.startsWith("/"))
+ return topsourcedir;
+ else
+ return projectDirectory() + "/" + topsourcedir;
+}
+
+QString AutoProjectPart::constructMakeCommandLine(const QString &dir, const QString &target) const
+{
+
+ QString preCommand;
+ QFileInfo fi1();
+ kdDebug(9020) << k_funcinfo << "Looking for Makefile in " << dir << endl;
+ if ( !QFile::exists(dir + "/GNUmakefile") && !QFile::exists(dir + "/makefile")
+ && ! QFile::exists(dir + "/Makefile") )
+ {
+ if (!QFile::exists(buildDirectory() + "/configure"))
+ {
+ int r = KMessageBox::questionYesNo(m_widget, i18n("%1\nThere is no Makefile in this directory\n"
+ "and no configure script for this project.\n"
+ "Run automake & friends and configure first?").arg(buildDirectory()), QString::null, i18n("Run Them"), i18n("Do Not Run"));
+ if (r == KMessageBox::No)
+ return QString::null;
+ preCommand = makefileCvsCommand();
+ if (preCommand.isNull())
+ return QString::null;
+ preCommand += " && ";
+ preCommand += configureCommand() + " && ";
+ }
+ else
+ {
+ int r = KMessageBox::questionYesNo(m_widget, i18n("%1\nThere is no Makefile in this directory. Run 'configure' first?").arg(dir), QString::null, i18n("Run configure"), i18n("Do Not Run"));
+ if (r == KMessageBox::No)
+ return QString::null;
+ preCommand = configureCommand() + " && ";
+ }
+ }
+ QDomDocument &dom = *projectDom();
+
+ QString cmdline = DomUtil::readEntry(dom, "/kdevautoproject/make/makebin");
+ int prio = DomUtil::readIntEntry(dom, "/kdevautoproject/make/prio");
+ QString nice;
+ kdDebug(9020) << k_funcinfo << "nice = " << prio<< endl;
+ if (prio != 0)
+ {
+ nice = QString("nice -n%1 ").arg(prio);
+ }
+
+ if (cmdline.isEmpty())
+ cmdline = MAKE_COMMAND;
+ if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/make/abortonerror"))
+ cmdline += " -k";
+ bool runmultiple = DomUtil::readBoolEntry(dom, "/kdevautoproject/make/runmultiplejobs");
+ int jobs = DomUtil::readIntEntry(dom, "/kdevautoproject/make/numberofjobs");
+ if (runmultiple && jobs != 0)
+ {
+ cmdline += " -j";
+ cmdline += QString::number(jobs);
+ }
+ if (DomUtil::readBoolEntry(dom, "/kdevautoproject/make/dontact"))
+ cmdline += " -n";
+
+ cmdline += " ";
+ cmdline += target;
+ cmdline.prepend(nice);
+ cmdline.prepend(makeEnvironment());
+
+ QString dircmd = "cd ";
+ dircmd += KProcess::quote(dir);
+ dircmd += " && ";
+
+ return preCommand + dircmd + cmdline;
+}
+
+
+void AutoProjectPart::startMakeCommand(const QString &dir, const QString &target, bool withKdesu)
+{
+ if (partController()->saveAllFiles()==false)
+ return; //user cancelled
+ kdDebug(9020) << "startMakeCommand:" << dir << ": "<< target << endl;
+ m_buildCommand = constructMakeCommandLine(dir, target);
+
+ if (withKdesu)
+ m_buildCommand = "kdesu -t -c '" + m_buildCommand + "'";
+
+ if (!m_buildCommand.isNull())
+ makeFrontend()->queueCommand(dir, m_buildCommand);
+}
+
+
+/** Adds the make command for the libraries that the target depends on
+ * to the make frontend queue (this is a recursive function) */
+bool AutoProjectPart::queueInternalLibDependenciesBuild(TargetItem* titem, QStringList& alreadyScheduledDeps)
+{
+
+ QString addstr = (titem->primary == "PROGRAMS")? titem->ldadd : titem->libadd;
+ QStringList l2 = QStringList::split(QRegExp("[ \t]"), addstr); // list of dependencies
+ QString tdir; // temp target directory
+ QString tname; // temp target name
+ QString tcmd; // temp command line
+ QStringList::Iterator l2it;
+ for (l2it = l2.begin(); l2it != l2.end(); ++l2it)
+ {
+ QString dependency = *l2it;
+ if (dependency.startsWith("$(top_builddir)/"))
+ {
+ // These are the internal libraries
+ dependency.remove("$(top_builddir)/");
+
+ if( !alreadyScheduledDeps.contains(*l2it) )
+ {
+ alreadyScheduledDeps << *l2it;
+ tdir = buildDirectory();
+ if (!tdir.endsWith("/") && !tdir.isEmpty())
+ tdir += "/";
+ int pos = dependency.findRev('/');
+ if (pos == -1)
+ {
+ tname = dependency;
+ }
+ else
+ {
+ tdir += dependency.left(pos+1);
+ tname = dependency.mid(pos+1);
+ }
+ kdDebug(9020) << "Scheduling : <" << tdir << "> target <" << tname << ">" << endl;
+ // Recursively queue the dependencies for building
+ SubprojectItem *spi = m_widget->subprojectItemForPath( dependency.left(pos) );
+ if (spi)
+ {
+ QPtrList< TargetItem > tl = spi->targets;
+ // Cycle through the list of targets to find the one we're looking for
+ TargetItem *ti = tl.first();
+ do
+ {
+ if (ti->name == tname)
+ {
+ // found it: queue it and stop looking
+ if( !queueInternalLibDependenciesBuild(ti, alreadyScheduledDeps) )
+ return false;
+ break;
+ }
+ ti = tl.next();
+ }
+ while (ti);
+ }
+
+ kdDebug(9020) << "queueInternalLibDependenciesBuild:" << tdir << ": "<< tname << endl;
+ tcmd = constructMakeCommandLine(tdir, tname);
+ if (!tcmd.isNull())
+ {
+ makeFrontend()->queueCommand( tdir, tcmd);
+ }
+ }else
+ {
+ //Message box about circular deps.
+ tdir = buildDirectory();
+ if (!tdir.endsWith("/") && !tdir.isEmpty())
+ tdir += "/";
+ int pos = dependency.findRev('/');
+ if (pos == -1)
+ {
+ tname = dependency;
+ }
+ else
+ {
+ tdir += dependency.left(pos+1);
+ tname = dependency.mid(pos+1);
+ }
+ KMessageBox::error( 0, i18n("Found a circular dependency in the project, between this target and %1.\nCannot build this project until this is resolved.").arg(tname), i18n("Circular Dependency found") );
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+
+void AutoProjectPart::slotBuild()
+{
+ //m_lastCompilationFailed = false;
+
+ if( m_needMakefileCvs )
+ {
+ slotMakefilecvs();
+ slotConfigure();
+ m_needMakefileCvs = false;
+ }
+
+ startMakeCommand(buildDirectory(), QString::fromLatin1(""));
+}
+
+
+void AutoProjectPart::buildTarget(QString relpath, TargetItem* titem)
+{
+
+ if ( !titem )
+ return;
+
+ //m_lastCompilationFailed = false;
+
+ // Calculate the complete name of the target and store it in name
+ QString name = titem->name;
+ if ( titem->primary == "KDEDOCS" )
+ name = "index.cache.bz2";
+
+ // Calculate the full path of the target and store it in path
+ QString path = buildDirectory();
+ if (!path.endsWith("/") && !path.isEmpty())
+ path += "/";
+ if (relpath.at(0) == '/')
+ path += relpath.mid(1);
+ else
+ path += relpath;
+
+ // Save all files once
+ partController()->saveAllFiles();
+
+ // Add the make command for the libraries that the target depends on to the make frontend queue
+ // if this recursive behavour is un-wanted comment the next line
+ QStringList deps;
+ if( !queueInternalLibDependenciesBuild(titem, deps) )
+ return;
+
+ // Calculate the "make" command line for the target
+ //QString relpath = dir.path().mid( projectDirectory().length() );
+ m_runProg=buildDirectory() + "/" + relpath+"/"+name;
+ kdDebug(9020) << "buildTarget:" << buildDirectory()<< endl;
+ kdDebug(9020) << "buildTarget:" << relpath << " " << path << ": "<< name << " : " << m_runProg << endl;
+ QString tcmd = constructMakeCommandLine( path, name );
+
+ // Call make
+ if (!tcmd.isNull())
+ {
+ m_buildCommand = tcmd;
+ makeFrontend()->queueCommand( path, tcmd);
+ }
+}
+
+
+void AutoProjectPart::slotBuildActiveTarget()
+{
+ // Get a pointer to the active target
+ TargetItem* titem = m_widget->activeTarget();
+
+ if ( !titem )
+ return;
+
+ // build it
+ buildTarget( URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + activeDirectory(), titem);
+}
+
+
+void AutoProjectPart::slotCompileFile()
+{
+ KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
+ if (!part || !part->url().isLocalFile())
+ return;
+
+ QString fileName = part->url().path();
+ QFileInfo fi(fileName);
+ QString sourceDir = fi.dirPath();
+ QString baseName = fi.baseName(true);
+ kdDebug(9020) << "Compiling " << fileName
+ << " in dir " << sourceDir
+ << " with baseName " << baseName << endl;
+
+ QString projectDir = projectDirectory();
+ if (!sourceDir.startsWith(projectDir)) {
+ KMessageBox::sorry(m_widget, i18n("Can only compile files in directories which belong to the project."));
+ return;
+ }
+
+ QString buildDir = buildDirectory() + sourceDir.mid(projectDir.length());
+ QString target = baseName + ".lo";
+ kdDebug(9020) << "builddir " << buildDir << ", target " << target << endl;
+
+ startMakeCommand(buildDir, target);
+}
+
+QString AutoProjectPart::configureCommand() const
+{
+ QDomDocument &dom = *projectDom();
+ QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/";
+
+ QString cmdline = "\"" + topsourceDirectory();
+ cmdline += "/configure\"";
+ QString cc = DomUtil::readEntry(dom, prefix + "ccompilerbinary");
+ if (!cc.isEmpty())
+ cmdline.prepend(QString("CC=%1 ").arg(cc));
+ QString cflags = DomUtil::readEntry(dom, prefix + "cflags");
+ if (!cflags.isEmpty())
+ cmdline.prepend(QString("CFLAGS=\"%1\" ").arg(cflags));
+ QString cxx = DomUtil::readEntry(dom, prefix + "cxxcompilerbinary");
+ if (!cxx.isEmpty())
+ cmdline.prepend(QString("CXX=%1 ").arg(cxx));
+ QString cxxflags = DomUtil::readEntry(dom, prefix + "cxxflags");
+ if (!cxxflags.isEmpty())
+ cmdline.prepend(QString("CXXFLAGS=\"%1\" ").arg(cxxflags));
+ QString f77 = DomUtil::readEntry(dom, prefix + "f77compilerbinary");
+ if (!f77.isEmpty())
+ cmdline.prepend(QString("F77=%1 ").arg(f77));
+ QString fflags = DomUtil::readEntry(dom, prefix + "f77flags");
+ if (!fflags.isEmpty())
+ cmdline.prepend(QString("FFLAGS=\"%1\" ").arg(fflags));
+ QString cppflags = DomUtil::readEntry(dom, prefix + "cppflags");
+ if (!cppflags.isEmpty())
+ cmdline.prepend(QString("CPPFLAGS=\"%1\" ").arg(cppflags));
+ QString ldflags = DomUtil::readEntry(dom, prefix + "ldflags");
+ if (!ldflags.isEmpty())
+ cmdline.prepend(QString("LDFLAGS=\"%1\" ").arg(ldflags));
+
+ QString configargs = DomUtil::readEntry(dom, prefix + "configargs");
+ if (!configargs.isEmpty()) {
+ cmdline += " ";
+ cmdline += configargs;
+ }
+
+ DomUtil::PairList envvars =
+ DomUtil::readPairListEntry(*projectDom(), prefix + "envvars", "envvar", "name", "value");
+
+ QString environstr;
+ DomUtil::PairList::ConstIterator it;
+ for (it = envvars.begin(); it != envvars.end(); ++it) {
+ environstr += (*it).first;
+ environstr += "=";
+ environstr += EnvVarTools::quote((*it).second);
+ environstr += " ";
+ }
+ cmdline.prepend(environstr);
+
+ QString builddir = buildDirectory();
+ QString dircmd;
+
+ // if the build directory doesn't exist, add it's creation to the configureCommand
+ if ( !QFile::exists(builddir)) {
+ dircmd = "mkdir ";
+ dircmd += KProcess::quote(builddir);
+ dircmd += " && ";
+ }
+
+ // add "cd into the build directory" to the configureCommand
+ dircmd += "cd ";
+ dircmd += KProcess::quote(builddir);
+ dircmd += " && ";
+
+ return dircmd + cmdline;
+}
+
+void AutoProjectPart::slotConfigure()
+{
+ QString cmdline = configureCommand();
+ if (cmdline.isNull())
+ return;
+
+ makeFrontend()->queueCommand(buildDirectory(), cmdline);
+}
+
+QString AutoProjectPart::makefileCvsCommand() const
+{
+ kdDebug(9020) << "makefileCvsCommand: runDirectory :" << runDirectory() << ":" <<endl;
+ kdDebug(9020) << "makefileCvsCommand: topsourceDirectory :" << topsourceDirectory() << ":" <<endl;
+ kdDebug(9020) << "makefileCvsCommand: makeEnvironment :" << makeEnvironment() << ":" <<endl;
+ kdDebug(9020) << "makefileCvsCommand: currentBuildConfig :" << currentBuildConfig() << ":" <<endl;
+
+
+ QString cmdline = DomUtil::readEntry(*projectDom(), "/kdevautoproject/make/makebin");
+ if (cmdline.isEmpty())
+ cmdline = MAKE_COMMAND;
+
+ int prio = DomUtil::readIntEntry(*projectDom(), "/kdevautoproject/make/prio");
+ QString nice;
+ kdDebug(9020) << "makefileCvsCommand() nice = " << prio<< endl;
+ if (prio != 0) {
+ nice = QString("nice -n%1 ").arg(prio);
+ }
+
+ if (QFile::exists(topsourceDirectory() + "/Makefile.cvs"))
+ cmdline += " -f Makefile.cvs";
+ else if (QFile::exists(topsourceDirectory() + "/Makefile.dist"))
+ cmdline += " -f Makefile.dist";
+ else if (QFile::exists(topsourceDirectory() + "/autogen.sh"))
+ cmdline = "./autogen.sh";
+ else {
+ KMessageBox::sorry(m_widget, i18n("There is neither a Makefile.cvs file nor an "
+ "autogen.sh script in the project directory."));
+ return QString::null;
+ }
+
+ cmdline.prepend(nice);
+ cmdline.prepend(makeEnvironment());
+
+ QString dircmd = "cd ";
+ dircmd += KProcess::quote(topsourceDirectory());
+ dircmd += " && ";
+
+ return dircmd + cmdline;
+}
+
+void AutoProjectPart::slotMakefilecvs()
+{
+ QString cmdline = makefileCvsCommand();
+ if ( cmdline.isNull() )
+ return;
+
+ makeFrontend()->queueCommand(projectDirectory(), cmdline);
+}
+
+
+void AutoProjectPart::slotInstall()
+{
+ startMakeCommand(buildDirectory(), QString::fromLatin1("install"));
+}
+
+
+void AutoProjectPart::slotInstallWithKdesu()
+{
+ // First issue "make" to build the entire project with the current user
+ // This way we make sure all files are up to date before we do the "make install"
+ slotBuild();
+
+ // After that issue "make install" with the root user
+ startMakeCommand(buildDirectory(), QString::fromLatin1("install"), true);
+}
+
+
+void AutoProjectPart::slotClean()
+{
+ startMakeCommand(buildDirectory(), QString::fromLatin1("clean"));
+}
+
+
+void AutoProjectPart::slotDistClean()
+{
+ startMakeCommand(buildDirectory(), QString::fromLatin1("distclean"));
+}
+
+
+void AutoProjectPart::slotMakeMessages()
+{
+ startMakeCommand(buildDirectory(), QString::fromLatin1("package-messages"));
+}
+
+
+/** Checks if the currently selected main program or,
+ * if no main Program was selected in the Run Options dialog,
+ * the currently active target is up-to-date and builds it if necessary.
+ * In the end checks if the program is already running and if not calls the
+ * slotExecute2() function to execute it or asks the user what to do.
+ */
+void AutoProjectPart::slotExecute()
+{
+ partController()->saveAllFiles();
+ QDomDocument &dom = *projectDom();
+
+ m_runProg=m_runProg.isEmpty()?mainProgram():m_runProg;
+
+ bool _auto = false;
+ if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autocompile", true) && isDirty() ){
+ m_executeAfterBuild = true;
+ if ( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) ){
+ // A Main Program was specified, build all targets because we don't know which is it
+ kdDebug(9020) << "slotExecute: before slotBuild" << endl;
+ slotBuild();
+
+ }
+ else{
+ // If no Main Program was specified, build the active target
+ kdDebug(9020) << "slotExecute: before slotBuildActiveTarget" << endl;
+ slotBuildActiveTarget();
+ }
+ _auto = true;
+ }
+
+ if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autoinstall", false) && isDirty() ){
+ m_executeAfterBuild = true;
+ // Use kdesu??
+ if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autokdesu", false) ){
+ //slotInstallWithKdesu assumes that it hasn't just been build...
+ kdDebug(9020) << "slotExecute: before startMakeCommand" << endl;
+ _auto ? slotInstallWithKdesu() : startMakeCommand(buildDirectory(), QString::fromLatin1("install"), true);
+ }
+ else{
+ kdDebug(9020) << "slotExecute: before slotInstall" << endl;
+ slotInstall();
+ }
+ _auto = true;
+ }
+
+ if ( _auto ){
+ m_runProg.truncate(0);
+ return;
+ }
+
+ if (appFrontend()->isRunning()) {
+ if (KMessageBox::questionYesNo(m_widget, i18n("Your application is currently running. Do you want to restart it?"), i18n("Application Already Running"), i18n("&Restart Application"), i18n("Do &Nothing")) == KMessageBox::No)
+ return;
+ connect(appFrontend(), SIGNAL(processExited()), SLOT(slotExecute2()));
+ appFrontend()->stopApplication();
+ return;
+ }
+ kdDebug(9020) << "slotExecute: before slotExecute2" << endl;
+ slotExecute2();
+}
+
+void AutoProjectPart::executeTarget(const QDir& dir, const TargetItem* titem)
+{
+ m_executeAfterBuild=true;
+ partController()->saveAllFiles();
+
+ bool is_dirty = false;
+ QDateTime t = QFileInfo(dir , titem->name ).lastModified();
+ QPtrListIterator<FileItem> it( titem->sources );
+ for( ; it.current() ; ++it )
+ {
+ if( t < QFileInfo(dir , (*it)->name).lastModified())
+ is_dirty = true;
+ }
+
+ if( DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/autocompile", true) && is_dirty )
+ {
+ connect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteTargetAfterBuild(const QString&)) );
+ connect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotNotExecuteTargetAfterBuildFailed(const QString&)) );
+
+ m_runProg=titem->name;
+ m_executeTargetAfterBuild.first = dir;
+ m_executeTargetAfterBuild.second = const_cast<TargetItem*>(titem);
+
+ QString relpath = "/" + URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + m_widget->selectedSubproject()->subdir;
+ kdDebug(9020) << "executeTarget: before buildTarget " << relpath << endl;
+ buildTarget(relpath, const_cast<TargetItem*>(titem));
+ return;
+ }
+
+
+ bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/terminal");
+
+ QString program = environString();
+
+ if ( !titem ) {
+ KMessageBox::error( m_widget, i18n("There is no active target.\n"
+ "Unable to determine the main program"), i18n("No active target found") );
+ kdDebug ( 9020 ) << k_funcinfo << "Error! : There's no active target! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl;
+ program += titem->name;
+ }else if ( titem->primary != "PROGRAMS" ) {
+ KMessageBox::error( m_widget, i18n("Active target \"%1\" is not binary ( %2 ).\n"
+ "Unable to determine the main program. If you want this\n"
+ "to be the active target, set a main program under\n"
+ "Project -> Project Options -> Run Options").arg(titem->name).arg(titem->primary), i18n("Active target is not a library") );
+ kdDebug ( 9020 ) << k_funcinfo << "Error! : Active target isn't binary (" << titem->primary << ") ! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl;
+ program += titem->name;
+ }else
+ program += buildDirectory() + "/" + URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + m_widget->selectedSubproject()->relativePath()+ "/" + titem->name;
+
+ QString args = DomUtil::readEntry(*projectDom(), "/kdevautoproject/run/runarguments/" + titem->name);
+
+ program += " " + args;
+ kdDebug(9020) << "executeTarget:cmd=" << dir.path() << " " << program << endl;
+ appFrontend()->startAppCommand(dir.path(), program ,inTerminal);
+ m_executeAfterBuild=false;
+
+}
+
+void AutoProjectPart::slotExecuteTargetAfterBuild(const QString& command)
+{
+ kdDebug(9020) << "slotExecuteTargetAfterBuild " << command << endl;
+ if ( m_executeAfterBuild && constructMakeCommandLine(m_executeTargetAfterBuild.first.path(), m_executeTargetAfterBuild.second->name) == command )
+ {
+ disconnect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteAfterTargetBuild()) );
+ disconnect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotExecuteAfterTargetBuildFailed()) );
+ kdDebug(9020) << "slotExecuteTargetAfterBuild " << endl;
+ executeTarget(m_executeTargetAfterBuild.first, m_executeTargetAfterBuild.second);
+ }
+
+}
+
+void AutoProjectPart::slotNotExecuteTargetAfterBuildFailed(const QString& command)
+{
+ kdDebug(9020) << "executeTargetAfterBuildFailed" << endl;
+ if ( constructMakeCommandLine(m_executeTargetAfterBuild.first.path(), m_executeTargetAfterBuild.second->name) == command )
+ {
+ m_executeAfterBuild=false;
+ disconnect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteTargetAfterBuild()) );
+ disconnect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotNotExecuteTargetAfterBuildFailed()) );
+ }
+}
+
+
+/* Get the run environment variables pairs into the environstr string
+ * in the form of: "ENV_VARIABLE=ENV_VALUE"
+ * Note that we quote the variable value due to the possibility of
+ * embedded spaces. */
+QString AutoProjectPart::environString() const
+{
+ DomUtil::PairList envvars = runEnvironmentVars();
+ QString environstr;
+ DomUtil::PairList::ConstIterator it;
+ for (it = envvars.begin(); it != envvars.end(); ++it) {
+ environstr += (*it).first;
+ environstr += "=";
+ environstr += EnvVarTools::quote((*it).second);
+ environstr += " ";
+ }
+ return environstr;
+}
+
+/** Executes the currently selected main program.
+ * If no main Program was selected in the Run Options dialog
+ * the currently active target is executed instead.
+ */
+void AutoProjectPart::slotExecute2()
+{
+ disconnect(appFrontend(), SIGNAL(processExited()), this, SLOT(slotExecute2()));
+
+ if (m_runProg.isEmpty()){
+ // Do not execute non executable targets
+ return;
+ }
+
+ QString program = environString();
+ // Adds the ./ that is necessary to execute the program in bash shells
+ if (!m_runProg.startsWith("/")){
+ program += "./";
+ }
+ program += m_runProg;
+ program += " " + runArguments();
+
+ bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/terminal");
+
+ kdDebug(9020) << "slotExecute2: runDirectory: <" << runDirectory() << ">" <<endl;
+ kdDebug(9020) << "slotExecute2: environstr : <" << environString() << ">" <<endl;
+ kdDebug(9020) << "slotExecute2: mainProgram : <" << mainProgram() << ">" <<endl;
+ kdDebug(9020) << "slotExecute2: runArguments: <" << runArguments() << ">" <<endl;
+ kdDebug(9020) << "slotExecute2: program : <" << program << ">" <<endl;
+
+ appFrontend()->startAppCommand(runDirectory(), program, inTerminal);
+ m_executeAfterBuild=false;
+ m_runProg.truncate(0);
+}
+
+
+void AutoProjectPart::slotAddTranslation()
+{
+ AddTranslationDialog dlg(this, m_widget);
+ dlg.exec();
+}
+
+
+void AutoProjectPart::slotBuildConfigChanged(const QString &config)
+{
+ DomUtil::writeEntry(*projectDom(), "/kdevautoproject/general/useconfiguration", config);
+ kdDebug(9020) << "Changed used configuration to " << config << endl;
+}
+
+
+void AutoProjectPart::slotBuildConfigAboutToShow()
+{
+ QStringList l = allBuildConfigs();
+ buildConfigAction->setItems(l);
+ buildConfigAction->setCurrentItem(l.findIndex(currentBuildConfig()));
+}
+
+void AutoProjectPart::restorePartialProjectSession ( const QDomElement* el )
+{
+ m_widget->restoreSession ( el );
+}
+
+void AutoProjectPart::savePartialProjectSession ( QDomElement* el )
+{
+ QDomDocument domDoc = el->ownerDocument();
+
+ KMessageBox::information ( 0, "Hallo, Welt!" );
+
+ kdDebug ( 9020 ) << k_funcinfo << "1" << endl;
+
+ if ( domDoc.isNull() )
+ {
+ kdDebug ( 9020 ) << k_funcinfo << "2" << endl;
+ return;
+ }
+
+ kdDebug ( 9020 ) << k_funcinfo << "3" << endl;
+
+ m_widget->saveSession ( el );
+}
+
+void AutoProjectPart::slotCommandFinished( const QString& command )
+{
+ kdDebug(9020) << k_funcinfo << endl;
+
+ if( m_buildCommand != command )
+ return;
+
+ m_buildCommand = QString::null;
+
+ m_timestamp.clear();
+ QStringList fileList = allFiles();
+ QStringList::Iterator it = fileList.begin();
+ while( it != fileList.end() ){
+ QString fileName = *it;
+ ++it;
+
+ m_timestamp[ fileName ] = QFileInfo( projectDirectory(), fileName ).lastModified();
+ }
+
+ emit projectCompiled();
+
+ // reset the "last compilation has failed" flag
+ m_lastCompilationFailed = false;
+
+ if( m_executeAfterBuild ){
+ slotExecute();
+ }
+}
+
+void AutoProjectPart::slotCommandFailed( const QString& /*command*/ )
+{
+ kdDebug(9020) << "slotCommandFinished " << k_funcinfo << endl;
+
+ m_lastCompilationFailed = true;
+ m_executeAfterBuild=false;
+}
+
+bool AutoProjectPart::isDirty()
+{
+ if (m_lastCompilationFailed) return true;
+
+ QStringList fileList = allFiles();
+ QStringList::Iterator it = fileList.begin();
+ while( it != fileList.end() ){
+ QString fileName = *it;
+ ++it;
+
+ QMap<QString, QDateTime>::Iterator it = m_timestamp.find( fileName );
+ QDateTime t = QFileInfo( projectDirectory(), fileName ).lastModified();
+ if( it == m_timestamp.end() || *it != t ){
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void AutoProjectPart::needMakefileCvs( )
+{
+ m_needMakefileCvs = true;
+}
+
+bool AutoProjectPart::isKDE() const
+{
+ return m_isKDE;
+}
+
+KDevProject::Options AutoProjectPart::options() const
+{
+ return UsesAutotoolsBuildSystem;
+}
+
+QStringList recursiveATFind( const QString &currDir, const QString &baseDir )
+{
+ kdDebug(9020) << "Dir " << currDir << endl;
+ QStringList fileList;
+
+ if( !currDir.contains( "/..") && !currDir.contains("/.") )
+ {
+ QDir dir(currDir);
+ QStringList dirList = dir.entryList(QDir::Dirs );
+ QStringList::Iterator idx = dirList.begin();
+ for( ; idx != dirList.end(); ++idx )
+ {
+ fileList += recursiveATFind( currDir + "/" + (*idx),baseDir );
+ }
+ QStringList newFiles = dir.entryList("*.am *.in");
+ idx = newFiles.begin();
+ for( ; idx != newFiles.end(); ++idx )
+ {
+ QString file = currDir + "/" + (*idx);
+ fileList.append( file.remove( baseDir ) );
+ }
+ }
+
+
+ return fileList;
+}
+
+/*!
+ \fn AutoProjectPart::distFiles() const
+ */
+QStringList AutoProjectPart::distFiles() const
+{
+ QStringList sourceList = allFiles();
+ // Scan current source directory for any .pro files.
+ QString projectDir = projectDirectory();
+ QDir dir(projectDir);
+ QDir admin(projectDir +"/admin");
+ QStringList files = dir.entryList( "Makefile.cvs Makefile.am configure* INSTALL README NEWS TODO ChangeLog COPYING AUTHORS stamp-h.in acinclude.m4 config.h.in Makefile.in install-sh config.sub config.guess mkinstalldirs missing ltmain.sh depcomp");
+ QStringList adminFiles = admin.entryList(QDir::Files);
+ QStringList::Iterator idx = adminFiles.begin();
+ for( ; idx != adminFiles.end(); ++idx)
+ {
+ files.append( "admin/" + (*idx) );
+ }
+ QStringList srcDirs = dir.entryList(QDir::Dirs);
+ idx = srcDirs.begin();
+ for(; idx != srcDirs.end(); ++idx)
+ {
+ sourceList += recursiveATFind( projectDirectory() + "/" + (*idx), projectDirectory());
+ }
+ return sourceList + files;
+}
+
+void AutoProjectPart::startSimpleMakeCommand( const QString & dir, const QString & command, bool withKdesu )
+{
+ if (partController()->saveAllFiles()==false)
+ return; //user cancelled
+
+ // m_buildCommand = constructMakeCommandLine(dir, target);
+
+ QString cmdline = command;
+ cmdline.prepend(makeEnvironment());
+
+ QString dircmd = "cd ";
+ dircmd += KProcess::quote(dir);
+ dircmd += " && ";
+
+ m_buildCommand = dircmd + cmdline;
+
+ if (withKdesu)
+ m_buildCommand = "kdesu -t -c '" + m_buildCommand + "'";
+
+ if (!m_buildCommand.isNull())
+ makeFrontend()->queueCommand(dir, m_buildCommand);
+}
+
+QString AutoProjectPart::getAutoConfFile(const QString& dir){
+
+ QFile inFile(dir + "/configure.in");
+ QFile acFile(dir + "/configure.ac");
+ if ( inFile.exists()){
+ return inFile.name();
+ }else if (acFile.exists()){
+ return acFile.name();
+ }
+ return acFile.name();;
+}
+
+#include "autoprojectpart.moc"
+
+// kate: space-indent on; indent-width 4;
diff --git a/buildtools/autotools/autoprojectpart.h b/buildtools/autotools/autoprojectpart.h
new file mode 100644
index 00000000..d0862cc3
--- /dev/null
+++ b/buildtools/autotools/autoprojectpart.h
@@ -0,0 +1,153 @@
+/***************************************************************************
+* Copyright (C) 2001-2002 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* Copyright (C) 2002 by Victor R�er *
+* victor_roeder@gmx.de *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _AUTOPROJECTPART_H_
+#define _AUTOPROJECTPART_H_
+
+#include <qdict.h>
+#include <qguardedptr.h>
+#include <qmap.h>
+#include <qdatetime.h>
+#include <qdir.h>
+#include <kdevgenericfactory.h>
+#include "kdevbuildtool.h"
+
+class QDomElement;
+class QStringList;
+class KDialogBase;
+class AutoProjectWidget;
+class KSelectAction;
+class TargetItem;
+class ConfigWidgetProxy;
+
+class AutoProjectPart : public KDevBuildTool
+{
+ Q_OBJECT
+
+public:
+ AutoProjectPart( QObject *parent, const char *name, const QStringList &args );
+ virtual ~AutoProjectPart();
+
+ /**
+ * Implementation of the KDevProject interface.
+ */
+ virtual QString projectDirectory() const;
+ virtual QString projectName() const;
+ virtual DomUtil::PairList runEnvironmentVars() const;
+ virtual QString runDirectory() const;
+ virtual QString mainProgram() const;
+ virtual QString debugArguments() const;
+ virtual QString runArguments() const;
+ virtual QString environString() const;
+ virtual QString activeDirectory() const;
+ virtual QStringList allFiles() const;
+ virtual void addFile( const QString &fileName );
+ virtual void addFiles ( const QStringList& fileList );
+ virtual void removeFile( const QString &fileName );
+ virtual void removeFiles ( const QStringList& fileList );
+ virtual QString buildDirectory() const;
+ virtual Options options() const;
+
+ /**
+ * Implementation of the KDevPlugin interface.
+ */
+ virtual void restorePartialProjectSession ( const QDomElement* el );
+ virtual void savePartialProjectSession ( QDomElement* el );
+
+ /**
+ * automake specific methods.
+ */
+ QStringList allBuildConfigs() const;
+ QString currentBuildConfig() const;
+ QString topsourceDirectory() const;
+ void startMakeCommand( const QString &dir, const QString &target, bool withKdesu = false );
+ void startSimpleMakeCommand( const QString &dir, const QString &command, bool withKdesu = false );
+ void buildTarget( QString relpath, TargetItem* titem );
+ void executeTarget( const QDir& dir, const TargetItem* titem );
+
+ void needMakefileCvs();
+ bool isDirty();
+ bool isKDE() const;
+ QStringList distFiles() const;
+ QString getAutoConfFile(const QString& dir);
+
+protected:
+ /**
+ * Reimplemented from KDevProject. These methods are only
+ * for use by the application core.
+ */
+ virtual void openProject( const QString &dirName, const QString &projectName );
+ virtual void closeProject();
+
+private slots:
+ // void projectConfigWidget(KDialogBase *dlg);
+ void slotAddTranslation();
+ void slotBuild();
+ void slotBuildActiveTarget();
+ void slotCompileFile();
+ void slotClean();
+ void slotDistClean();
+ void slotInstall();
+ void slotInstallWithKdesu();
+ void slotMakefilecvs();
+ void slotMakeMessages();
+ void slotConfigure();
+ void slotExecute();
+ void slotExecute2();
+ void slotExecuteTargetAfterBuild( const QString& command );
+ void slotNotExecuteTargetAfterBuildFailed( const QString& command );
+ void slotBuildConfigChanged( const QString &config );
+ void slotBuildConfigAboutToShow();
+ void slotCommandFinished( const QString& command );
+ void slotCommandFailed( const QString& command );
+ //void slotImportExisting();
+ void insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int );
+
+
+private:
+ QGuardedPtr<AutoProjectWidget> m_widget;
+ QString m_projectName;
+ QString m_projectPath;
+ KSelectAction *buildConfigAction;
+
+ QString makeEnvironment() const;
+ void setWantautotools();
+ QString makefileCvsCommand() const;
+ QString configureCommand() const;
+
+ QMap<QString, QDateTime> m_timestamp;
+ bool m_executeAfterBuild;
+ QString m_buildCommand;
+ bool m_needMakefileCvs;
+ bool m_lastCompilationFailed;
+ bool m_isKDE;
+ QPair<QDir, TargetItem*> m_executeTargetAfterBuild;
+ QString m_runProg;
+
+ ConfigWidgetProxy * _configProxy;
+
+ // Enble AutoProjectWidget to emit our signals
+ friend class AutoProjectWidget;
+ friend class AddSubprojectDialog;
+ friend class FileItem;
+
+ // For make commands queuing
+ QString constructMakeCommandLine( const QString &dir, const QString &target ) const;
+ bool queueInternalLibDependenciesBuild( TargetItem* titem, QStringList& list );
+};
+
+typedef KDevGenericFactory<AutoProjectPart> AutoProjectFactory;
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/autoprojectviewbase.ui b/buildtools/autotools/autoprojectviewbase.ui
new file mode 100644
index 00000000..ad5142ba
--- /dev/null
+++ b/buildtools/autotools/autoprojectviewbase.ui
@@ -0,0 +1,123 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>AutoProjectViewBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>AutoProjectViewBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>245</width>
+ <height>334</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>4</number>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>m_button1</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>m_button2</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>m_button3</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>m_button4</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>m_button5</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QToolButton">
+ <property name="name">
+ <cstring>m_optionsButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Options</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KListView" row="1" column="0">
+ <property name="name">
+ <cstring>m_listView</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ <property name="fullWidth">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/autotools/autoprojectwidget.cpp b/buildtools/autotools/autoprojectwidget.cpp
new file mode 100644
index 00000000..c3248504
--- /dev/null
+++ b/buildtools/autotools/autoprojectwidget.cpp
@@ -0,0 +1,748 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2001-2002 by Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (c) 2002 by Victor Roeder <victor_roeder@gmx.de>
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+ * *
+ ***************************************************************************
+*/
+
+
+#include "autoprojectwidget.h"
+
+#include <qcheckbox.h>
+#include <qdom.h>
+#include <qfile.h>
+#include <qheader.h>
+#include <qpainter.h>
+#include <qptrstack.h>
+#include <qregexp.h>
+#include <qsplitter.h>
+#include <qstringlist.h>
+#include <qtextstream.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qtimer.h>
+
+#include <kdebug.h>
+#include <kfiledialog.h>
+#include <klistview.h>
+#include <kmessagebox.h>
+#include <kregexp.h>
+#include <kurl.h>
+#include <kfile.h>
+#include <kxmlguiclient.h>
+#include <kaction.h>
+
+#include "kdevcore.h"
+#include "domutil.h"
+#include "misc.h"
+#include "choosetargetdialog.h"
+
+#include "autolistviewitems.h"
+
+#include "autoprojectpart.h"
+#include "autosubprojectview.h"
+#include "autodetailsview.h"
+#include "urlutil.h"
+#include "makefilehandler.h"
+
+static QString nicePrimary( const QString &primary )
+{
+ if ( primary == "PROGRAMS" )
+ return i18n( "Program" );
+ else if ( primary == "LIBRARIES" )
+ return i18n( "Library" );
+ else if ( primary == "LTLIBRARIES" )
+ return i18n( "Libtool Library" );
+ else if ( primary == "SCRIPTS" )
+ return i18n( "Script" );
+ else if ( primary == "HEADERS" )
+ return i18n( "Header" );
+ else if ( primary == "DATA" )
+ return i18n( "Data" );
+ else if ( primary == "JAVA" )
+ return i18n( "Java" );
+ else
+ return QString::null;
+}
+
+
+AutoProjectWidget::AutoProjectWidget( AutoProjectPart *part, bool kde )
+ : QVBox( 0, "auto project widget" )
+{
+ m_part = part;
+ m_kdeMode = kde;
+ m_activeSubproject = 0;
+ m_activeTarget = 0;
+ m_shownSubproject = 0;
+ m_choosenTarget = 0;
+ m_makefileHandler = new MakefileHandler();
+
+ QSplitter *splitter = new QSplitter(Vertical, this);
+
+ initOverview ( splitter );
+ initDetailview ( splitter );
+
+ initActions ();
+}
+
+
+AutoProjectWidget::~AutoProjectWidget()
+{
+ delete m_makefileHandler;
+}
+
+void AutoProjectWidget::initOverview ( QWidget* parent )
+{
+ m_subprojectView = new AutoSubprojectView( this, m_part, parent, "project overview widget" );
+}
+
+void AutoProjectWidget::initDetailview ( QWidget* parent )
+{
+ m_detailView = new AutoDetailsView( this, m_part, parent, "project details widget" );
+}
+
+void AutoProjectWidget::initActions()
+{
+ connect( m_subprojectView, SIGNAL( selectionChanged( QListViewItem* ) ),
+ this, SLOT( slotOverviewSelectionChanged( QListViewItem* ) ) );
+}
+
+AutoSubprojectView* AutoProjectWidget::getSubprojectView ()
+{
+ return m_subprojectView;
+}
+
+AutoDetailsView* AutoProjectWidget::getDetailsView ()
+{
+ return m_detailView;
+}
+
+void AutoProjectWidget::openProject( const QString &dirName )
+{
+ m_subprojectView->loadMakefileams ( dirName );
+ MakefileHandler mfh;
+ mfh.parse( m_part->projectDirectory(), true );
+
+}
+
+
+void AutoProjectWidget::closeProject()
+{
+ m_shownSubproject = 0;
+ m_subprojectView->listView()->clear();
+ m_detailView->listView()->clear();
+}
+
+SubprojectItem* AutoProjectWidget::activeSubproject ()
+{
+ return m_activeSubproject;
+}
+
+TargetItem* AutoProjectWidget::activeTarget ()
+{
+ return m_activeTarget;
+}
+
+QStringList AutoProjectWidget::allSubprojects()
+{
+ int prefixlen = m_part->projectDirectory().length() + 1;
+ QStringList res;
+
+ QListViewItemIterator it( m_subprojectView->listView() );
+ for ( ; it.current(); ++it )
+ {
+ // Skip root subproject
+ // if ( it.current() == m_subprojectView->firstChild() )
+ // continue;
+ QString path = static_cast<SubprojectItem*>( it.current() ) ->path;
+ res.append( path.mid( prefixlen ) );
+ }
+
+ return res;
+}
+
+QPtrList <SubprojectItem> AutoProjectWidget::allSubprojectItems()
+{
+ QPtrList <SubprojectItem> res;
+
+ QListViewItemIterator it ( m_subprojectView->listView() );
+
+ for ( ; it.current(); ++it )
+ {
+ // Skip root subproject
+ // if ( it.current() == m_subprojectView->firstChild() )
+ // continue;
+
+ SubprojectItem* spitem = static_cast <SubprojectItem*> ( it.current() );
+ res.append ( spitem );
+ }
+
+ return res;
+}
+
+SubprojectItem* AutoProjectWidget::subprojectItemForPath(const QString & path, bool pathIsAbsolute)
+{
+ kdDebug(9020) << "Looking for path " << path << endl;
+
+ int prefixLen = m_part->projectDirectory().length() + 1;
+ QListViewItemIterator it( m_subprojectView->listView() );
+ for(; it.current(); ++it)
+ {
+ SubprojectItem* spitem = static_cast<SubprojectItem*>(it.current() );
+ QString relpath = (spitem->path).mid(prefixLen);
+ kdDebug(9020) << " ... checking -" << spitem->path << "-" << endl;
+ kdDebug(9020) << " ... (tailored: -" << relpath << "- against -" << (pathIsAbsolute ? path.mid(prefixLen) : path) << "- )" << endl;
+ if ( relpath == (pathIsAbsolute ? path.mid(prefixLen) : path))
+ {
+ kdDebug(9020) << "Found it!" << endl;
+ return spitem;
+ }
+ }
+ kdDebug(9020) << "Not found" << endl;
+ return NULL;
+}
+
+QString AutoProjectWidget::pathForTarget(const TargetItem *titem) const
+{
+
+ if (!titem)
+ return QString::null;
+
+ kdDebug(9020) << "Looking for target " << titem->name << endl;
+ int prefixLen = m_part->projectDirectory().length() + 1;
+ QListViewItemIterator it( m_subprojectView->listView() );
+ for(; it.current(); ++it)
+ {
+ SubprojectItem* spitem = static_cast<SubprojectItem*>(it.current() );
+ kdDebug(9020) << "Checking: " << spitem->path << endl;
+ if (spitem->targets.containsRef(titem))
+ {
+ kdDebug(9020) << "Found it!" << endl;
+ QString relpath = (spitem->path).mid(prefixLen);
+ return relpath;
+ }
+ }
+ kdDebug(9020) << "Not found" << endl;
+ return QString::null;
+}
+
+QStringList AutoProjectWidget::allLibraries()
+{
+ int prefixlen = m_part->projectDirectory().length() + 1;
+ QStringList res;
+
+ QListViewItemIterator it( m_subprojectView->listView() );
+ for ( ; it.current(); ++it )
+ {
+ SubprojectItem *spitem = static_cast<SubprojectItem*>( it.current() );
+ QString path = spitem->path;
+ QPtrListIterator<TargetItem> tit( spitem->targets );
+ for ( ; tit.current(); ++tit )
+ {
+ QString primary = ( *tit ) ->primary;
+ if ( primary == "LIBRARIES" || primary == "LTLIBRARIES" )
+ {
+ QString fullname = path + "/" + ( *tit ) ->name;
+ res.append( fullname.mid( prefixlen ) );
+ }
+ }
+ }
+
+ return res;
+}
+
+
+QStringList AutoProjectWidget::allFiles()
+{
+ QPtrStack<QListViewItem> s;
+ QMap<QString, bool> dict;
+
+ for ( QListViewItem * item = m_subprojectView->listView()->firstChild(); item;
+ item = item->nextSibling() ? item->nextSibling() : s.pop() )
+ {
+ if ( item->firstChild() )
+ s.push( item->firstChild() );
+
+ SubprojectItem *spitem = static_cast<SubprojectItem*>( item );
+ // use URLUtil so paths in root project dir are worked out correctly
+ QString relPath = URLUtil::relativePath(m_part->projectDirectory(), spitem->path, URLUtil::SLASH_SUFFIX);
+ QPtrListIterator<TargetItem> tit( spitem->targets );
+ for ( ; tit.current(); ++tit )
+ {
+ QPtrListIterator<FileItem> fit( tit.current() ->sources );
+ for ( ; fit.current(); ++fit )
+ {
+
+ if((*fit)->is_subst)
+ continue;
+
+ QFileInfo fileInfo( (*fit)->name );
+ if( fileInfo.extension() == "ui" )
+ {
+ dict.insert( relPath + fileInfo.baseName() + ".h", true );
+ dict.insert( relPath + fileInfo.baseName() + ".cpp", true );
+ }
+
+ dict.insert( relPath + ( *fit ) ->name, true );
+ }
+ }
+ }
+
+ // Files may be in multiple targets, so we have to remove
+ // duplicates
+ QStringList res;
+ QMap<QString, bool>::Iterator it = dict.begin();
+ while( it != dict.end() ){
+ res << it.key();
+ ++it;
+ }
+
+ return res;
+}
+
+
+QString AutoProjectWidget::subprojectDirectory()
+{
+ if ( !selectedSubproject() )
+ return QString::null;
+
+ return selectedSubproject()->path;
+}
+
+
+void AutoProjectWidget::setActiveTarget( const QString &targetPath )
+{
+ int prefixlen = m_part->projectDirectory().length() + 1;
+ QString olddir = m_part->activeDirectory();
+ m_activeSubproject = 0;
+ m_activeTarget = 0;
+
+ QListViewItemIterator it( m_subprojectView->listView() );
+ for ( ; it.current(); ++it )
+ {
+ SubprojectItem *spitem = static_cast<SubprojectItem*>( it.current() );
+ QString path = spitem->path;
+ QPtrListIterator<TargetItem> tit( spitem->targets );
+ for ( ; tit.current(); ++tit )
+ {
+ QString primary = ( *tit ) ->primary;
+ if ( primary != "PROGRAMS" && primary != "LIBRARIES"
+ && primary != "LTLIBRARIES" && primary != "JAVA" )
+ continue;
+
+ QString currentTargetPath = ( path + "/" + ( *tit ) ->name ).mid( prefixlen );
+
+ bool hasTarget = ( targetPath == currentTargetPath );
+ ( *tit )->setBold( hasTarget );
+ if ( hasTarget )
+ {
+ spitem->setBold( true );
+ m_activeSubproject = spitem;
+ m_activeTarget = ( *tit );
+ m_subprojectView->listView()->setSelected( m_activeSubproject, true );
+ m_subprojectView->listView()->ensureItemVisible ( m_activeSubproject );
+ m_subprojectView->listView()->viewport()->update();
+ m_detailView->listView()->setSelected ( m_activeTarget, true );
+ m_detailView->listView()->ensureItemVisible ( m_activeTarget );
+ m_detailView->listView()->viewport()->update();
+ }
+ else
+ {
+ // to avoid a setBold ( false ) if there's another target in the current Subproject (i.e. spitem) ...
+ spitem->setBold ( ( m_activeSubproject == spitem ) );
+ m_detailView->listView()->viewport()->update();
+ }
+ }
+ }
+ if( olddir != m_part->activeDirectory() )
+ {
+ emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() );
+ }
+
+ if ( m_activeSubproject == 0 && m_activeTarget == 0 )
+ {
+ m_subprojectView->listView()->setSelected ( m_subprojectView->listView()->firstChild(), true );
+ m_subprojectView->listView()->ensureItemVisible ( m_subprojectView->listView()->firstChild() );
+ m_subprojectView->listView()->viewport()->update();
+ }
+}
+
+
+QString AutoProjectWidget::activeDirectory()
+{
+ if ( m_activeSubproject )
+ return m_activeSubproject->path.mid( m_part->projectDirectory().length() + 1 );
+ else
+ {
+/* if ( selectedSubproject() )
+ return selectedSubproject()->path;
+ else*/
+ return QString::null;
+ }
+}
+
+
+void AutoProjectWidget::addFiles( const QStringList &list )
+{
+ QDomDocument &dom = *m_part->projectDom();
+ QStringList fileList = list;
+
+ if ( DomUtil::readBoolEntry( dom, "/kdevautoproject/general/useactivetarget" ) )
+ {
+ QStringList::iterator it;
+
+ QString fileName;
+
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ int pos = ( *it ).findRev('/');
+ if (pos != -1)
+ fileName = ( *it ).mid(pos+1);
+ else
+ fileName = ( *it );
+
+ //FileItem * fitem = createFileItem( fileName,m_activeSubproject );
+ //m_activeTarget->sources.append( fitem );
+ //m_activeTarget->insertItem( fitem );
+
+ /// @todo Merge with code in addfiledlg.cpp
+ // Check wether a selected subproject+target exists and matches this file
+ // If so use that as target.
+ if( m_detailView->listView()->selectedItem() && m_subprojectView->listView()->selectedItem() )
+ {
+ TargetItem *titem = dynamic_cast <TargetItem*> ( m_detailView->listView()->selectedItem() );
+ SubprojectItem * subitem = dynamic_cast <SubprojectItem*> ( m_subprojectView->listView()->selectedItem() );
+ QString relativeDir = URLUtil::directory(*it);
+ SubprojectItem* spitem = subprojectItemForPath(relativeDir);
+
+ if( titem && subitem && subitem == spitem )
+ {
+ addToTarget(fileName, subitem, titem);
+ }else
+ {
+ addToTarget(fileName, m_activeSubproject, m_activeTarget);
+ }
+ }else
+ {
+ addToTarget(fileName, m_activeSubproject, m_activeTarget);
+ }
+
+// QString canontargetname = AutoProjectTool::canonicalize( m_activeTarget->name );
+// QString varname = canontargetname + "_SOURCES";
+// m_activeSubproject->variables[ varname ] += ( " " + fileName );
+//
+// QMap<QString, QString> replaceMap;
+// replaceMap.insert( varname, m_activeSubproject->variables[ varname ] );
+//
+// AutoProjectTool::addToMakefileam( m_activeSubproject->path + "/Makefile.am", replaceMap );
+ }
+
+ emitAddedFiles ( list );
+ }
+ else
+ {
+ QStringList doManually, doneAutomatically;
+ // First check wether the detail view has a selected target and the subproject
+ // view selected subproject matches the path of the new file. Then
+ // we can assume the user used the right-click option on the target
+ for( QStringList::iterator it = fileList.begin(); it != fileList.end(); ++it)
+ {
+ bool autoAdded = false;
+ if( m_detailView->listView()->selectedItem() && m_subprojectView->listView()->selectedItem() )
+ {
+ TargetItem *titem = dynamic_cast <TargetItem*> ( m_detailView->listView()->selectedItem() );
+ SubprojectItem * subitem = dynamic_cast <SubprojectItem*> ( m_subprojectView->listView()->selectedItem() );
+ QString relativeDir = URLUtil::directory(*it);
+ SubprojectItem* spitem = subprojectItemForPath(relativeDir);
+ if( titem && subitem && subitem == spitem )
+ {
+ addToTarget(URLUtil::filename(*it), subitem, titem);
+ autoAdded = true;
+ doneAutomatically << *it;
+ }
+ }
+ if(!autoAdded) doManually << *it;
+ }
+
+ // See if we can figure out the target for each file without asking the user
+ // I think it's a valid assumption that if a directory contains only one target
+ // the file can be added to that target (Julian Rockey linux at jrockey.com)
+ QStringList temp = doManually;
+ doManually.clear();
+ for(QStringList::iterator it = temp.begin();it!=temp.end();++it)
+ {
+ bool autoAdded = false;
+ QString relativeDir = URLUtil::directory(*it);
+ SubprojectItem* spitem = subprojectItemForPath(relativeDir);
+ if (spitem)
+ {
+ QPtrList<TargetItem> titemList = spitem->targets;
+ if (titemList.count()==1) {
+ addToTarget( URLUtil::filename(*it), spitem, titemList.first() );
+ doneAutomatically.append(*it);
+ autoAdded = true;
+ }
+ }
+
+ // add to manual list if this file wasn't auto-added
+ if (!autoAdded) doManually.append(*it);
+ }
+ if (doneAutomatically.count()>0) emitAddedFiles(doneAutomatically);
+
+ // raise dialog for any files that weren't added automatically
+ if (doManually.count()>0) {
+ ChooseTargetDialog chooseTargetDlg ( this, m_part, doManually, this, "choose target dialog" );
+
+ //chooseTargetDlg = new ChooseTargetDialog ( this, this, "choose target dialog" );
+
+ if ( chooseTargetDlg.exec() && chooseTargetDlg.alwaysUseActiveTarget() )
+ DomUtil::writeBoolEntry( dom, "/kdevautoproject/general/useactivetarget", true );
+ }
+ }
+}
+
+void AutoProjectWidget::addToTarget(const QString & fileName, SubprojectItem* spitem, TargetItem* titem)
+{
+ QString varname;
+ /// \FIXME a quick hack to prevent adding header files to _SOURCES and display them in noinst_HEADERS
+ if (AutoProjectPrivate::isHeader(fileName) &&
+ ( titem->primary == "PROGRAMS" || titem->primary == "LIBRARIES" || titem->primary == "LTLIBRARIES" ) )
+ {
+ kdDebug ( 9020 ) << "Ignoring header file and adding it to noinst_HEADERS: " << fileName << endl;
+ TargetItem* noinst_HEADERS_item = getSubprojectView()->findNoinstHeaders(spitem);
+ FileItem *fitem = createFileItem( fileName, spitem );
+ noinst_HEADERS_item->sources.append( fitem );
+ noinst_HEADERS_item->insertItem( fitem );
+ varname = "noinst_HEADERS";
+ }
+ else
+ {
+ FileItem * fitem = createFileItem( fileName, spitem );
+ titem->sources.append( fitem );
+ titem->insertItem( fitem );
+
+ QString canontargetname = AutoProjectTool::canonicalize( titem->name );
+ varname = canontargetname + "_SOURCES";
+ }
+ spitem->variables[ varname ] += ( " " + fileName );
+
+ QMap<QString, QString> replaceMap;
+ replaceMap.insert( varname, spitem->variables[ varname ] );
+
+ AutoProjectTool::addToMakefileam( spitem->path + "/Makefile.am", replaceMap );
+
+ m_detailView->slotSelectionChanged( spitem );
+}
+
+void AutoProjectWidget::removeFiles( const QStringList &list )
+{
+ Q_UNUSED( list )
+}
+
+void AutoProjectWidget::slotOverviewSelectionChanged( QListViewItem *item )
+{
+ if ( !item )
+ return;
+
+ // Delete the items from the details view first.
+ if ( m_shownSubproject )
+ {
+ // Remove all TargetItems and all of their children from the view
+ kdDebug ( 9020 ) << "m_shownSubproject (before takeItem()): " << m_shownSubproject->subdir << endl;
+
+ QListViewItem* i = m_detailView->listView()->firstChild();
+ while( i )
+ {
+ QListViewItem* o = i;
+ i = i->nextSibling();
+ m_detailView->listView()->takeItem(o);
+ }
+ }
+
+ // We assume here that ALL items in the over list view
+ // are SubprojectItem's
+ m_shownSubproject = dynamic_cast<SubprojectItem*>( item );
+ if ( !m_shownSubproject) return;
+ kdDebug ( 9020 ) << "m_shownSubproject (after takeItem()): " << selectedSubproject()->subdir << endl;
+
+ // Insert all TargetItems and all of their children into the view
+ QPtrListIterator<TargetItem> it2( selectedSubproject()->targets );
+ for ( ; it2.current(); ++it2 )
+ {
+ kdDebug ( 9020 ) << "insertItem in detail " << ( *it2 )->name << endl;
+ m_detailView->listView()->insertItem( *it2 );
+ QPtrListIterator<FileItem> it3( ( *it2 ) ->sources );
+ for ( ; it3.current(); ++it3 )
+ ( *it2 )->insertItem( *it3 );
+ QString primary = ( *it2 ) ->primary;
+ if ( primary == "PROGRAMS" || primary == "LIBRARIES" ||
+ primary == "LTLIBRARIES" || primary == "JAVA" )
+ ( *it2 ) ->setOpen( true );
+ }
+}
+
+TargetItem *AutoProjectWidget::selectedTarget()
+{
+ ProjectItem * pvitem = static_cast<ProjectItem*>( m_detailView->listView()->selectedItem() );
+ if ( !pvitem || ( pvitem->type() != ProjectItem::Target ) )
+ return 0;
+
+ return static_cast<TargetItem*>( pvitem );
+}
+
+
+FileItem *AutoProjectWidget::selectedFile()
+{
+ ProjectItem * pvitem = static_cast<ProjectItem*>( m_detailView->listView()->selectedItem() );
+ if ( !pvitem || ( pvitem->type() != ProjectItem::File ) )
+ return 0;
+
+ return static_cast<FileItem*>( pvitem );
+}
+
+SubprojectItem* AutoProjectWidget::selectedSubproject()
+{
+ ProjectItem * pvitem = static_cast <SubprojectItem*> ( m_subprojectView->listView()->selectedItem() );
+
+ if ( !pvitem || ( pvitem->type() != ProjectItem::Subproject ) )
+ return 0;
+
+ return static_cast <SubprojectItem*> ( pvitem );
+}
+
+TargetItem *AutoProjectWidget::createTargetItem( const QString &name,
+ const QString &prefix, const QString &primary,
+ bool take )
+{
+ bool docgroup = ( primary == "KDEDOCS" );
+ bool icongroup = ( primary == "KDEICON" );
+ bool group = !(docgroup || icongroup);
+
+ QString text;
+ if ( docgroup )
+ text = i18n( "Documentation data" );
+ else if ( icongroup )
+ text = i18n( "KDE Icon data" ).arg( prefix );
+ else
+ text = i18n( "%1 (%2 in %3)" ).arg( name ).arg( nicePrimary( primary ) ).arg( prefix );
+
+ // Workaround because of QListView not being able to create
+ // items without actually inserting them
+ TargetItem *titem = new TargetItem( m_detailView->listView(), group, text );
+ titem->name = name;
+ titem->prefix = prefix;
+ titem->primary = primary;
+ if( take )
+ m_detailView->listView()->takeItem( titem );
+
+ return titem;
+}
+
+
+FileItem *AutoProjectWidget::createFileItem( const QString &name, SubprojectItem *subproject )
+{
+ bool is_subst;
+ if(name.find("$(") == 0 || name.find("${") == 0)
+ is_subst = true;
+ else
+ is_subst = false;
+
+ FileItem * fitem = new FileItem( m_subprojectView->listView(), name, is_subst );
+ fitem->uiFileLink = m_detailView->getUiFileLink(subproject->relativePath()+"/", name );
+ m_subprojectView->listView()->takeItem( fitem );
+ fitem->name = name;
+
+ return fitem;
+}
+
+
+void AutoProjectWidget::emitAddedFiles( const QStringList &fileList )
+{
+ emit m_part->addedFilesToProject( fileList );
+}
+
+void AutoProjectWidget::emitAddedFile( const QString &name )
+{
+ QStringList fileList;
+ fileList.append ( name );
+ emit m_part->addedFilesToProject( fileList );
+}
+
+void AutoProjectWidget::emitRemovedFiles( const QStringList &fileList )
+{
+ emit m_part->removedFilesFromProject( fileList );
+}
+
+void AutoProjectWidget::emitRemovedFile( const QString &name )
+{
+ QStringList fileList;
+ fileList.append ( name );
+ emit m_part->removedFilesFromProject( fileList );
+}
+
+void AutoProjectWidget::restoreSession ( const QDomElement* el )
+{
+ Q_UNUSED( el );
+}
+
+void AutoProjectWidget::saveSession ( QDomElement* el )
+{
+ if ( m_activeTarget && m_activeSubproject )
+ {
+ QDomDocument domDoc = el->ownerDocument();
+
+ QString activeTargetPath = m_activeSubproject->path.mid ( m_part->project()->projectDirectory().length() + 1 );
+ activeTargetPath = activeTargetPath + "/" + m_activeTarget->name;
+
+ QDomElement generalEl = domDoc.createElement("general");
+
+ kdDebug ( 9020 ) << k_funcinfo << "Saving session data of AutoProjectWidget: " << activeTargetPath << endl;
+
+ generalEl.setAttribute("activetarget", activeTargetPath);
+ el->appendChild(generalEl);
+ }
+}
+
+void AutoProjectWidget::setActiveSubproject( SubprojectItem * spitem )
+{
+ QString olddir = m_part->activeDirectory();
+ m_activeSubproject = spitem;
+ emit m_part->activeDirectoryChanged( olddir, m_part->activeDirectory() );
+}
+
+void AutoProjectWidget::focusInEvent( QFocusEvent */*e*/ )
+{
+ switch (m_lastFocusedView)
+ {
+ case DetailsView:
+ m_detailView->listView()->setFocus();
+ break;
+ case SubprojectView:
+ default:
+ m_subprojectView->listView()->setFocus();
+ }
+}
+
+void AutoProjectWidget::setLastFocusedView( AutoProjectView view )
+{
+ m_lastFocusedView = view;
+}
+
+#include "autoprojectwidget.moc"
+
+MakefileHandler* AutoProjectWidget::makefileHandler()
+{
+ return m_makefileHandler;
+}
+//kate: indent-mode csands; tab-width 4; space-indent off;
+
diff --git a/buildtools/autotools/autoprojectwidget.h b/buildtools/autotools/autoprojectwidget.h
new file mode 100644
index 00000000..0f4a8b13
--- /dev/null
+++ b/buildtools/autotools/autoprojectwidget.h
@@ -0,0 +1,229 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2001-2002 by Bernd Gehrmann <bernd@kdevelop.org>
+ Copyright (c) 2002 by Victor Roeder <victor_roeder@gmx.de>
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+* *
+***************************************************************************
+*/
+
+#ifndef _AUTOPROJECTWIDGET_H_
+#define _AUTOPROJECTWIDGET_H_
+
+#include <qdict.h>
+#include <qlistview.h>
+#include <qmap.h>
+#include <qvbox.h>
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qtoolbutton.h>
+#include <kiconloader.h>
+#include <klocale.h>
+
+#include "domutil.h"
+#include "makefilehandler.h"
+
+class AutoProjectPart;
+class AutoSubprojectView;
+class AutoDetailsView;
+class SubprojectItem;
+class TargetItem;
+class FileItem;
+class KAction;
+class QDomElement;
+class QToolButton;
+class QStringList;
+class QFocusEvent;
+class KListViewItem;
+class QListViewItem;
+class MakefileHandler;
+
+class AutoProjectWidget : public QVBox
+{
+ Q_OBJECT
+ friend class RemoveFileDialog;
+ friend class TargetOptionsDialog; // to access projectDom() via m_part->projectDom()
+public:
+ AutoProjectWidget( AutoProjectPart *part, bool kde );
+ ~AutoProjectWidget();
+
+ void openProject( const QString &dirName );
+ void closeProject();
+
+ /**
+ * A list of the (relative) names of all subprojects (== subdirectories)
+ */
+ QStringList allSubprojects();
+ /**
+ * A list of all Subproject items in the overview KListView
+ */
+ QPtrList <SubprojectItem> allSubprojectItems();
+ /**
+ * A list of the (relative) names of all libraries
+ */
+ QStringList allLibraries();
+ /**
+ * A list of all files that belong to the project
+ **/
+ QStringList allFiles();
+ /**
+ * The top level directory of the project.
+ **/
+ QString projectDirectory() const;
+ /**
+ * The directory of the currently shown subproject.
+ */
+ QString subprojectDirectory();
+ /**
+ * Are we in KDE mode?
+ */
+ bool kdeMode() const
+ {
+ return m_kdeMode;
+ }
+
+ /**
+ * Sets the given target active. The argument is given
+ * relative to the project directory.
+ */
+ void setActiveTarget( const QString &targetPath );
+ /**
+ * Returns the active target as path relative to
+ * the project directory.
+ */
+ QString activeDirectory();
+
+ /**
+ * Adds a file to the active target.
+ * If the file does not contain a "/" character, it is added
+ * to the active target.
+ * If it does contain "/" character(s), ... @todo .. add to appropriate target
+ */
+ void addFiles( const QStringList &list );
+ /**
+ * Removes the file fileName from the directory directory.
+ * (not implemented currently)
+ */
+ void removeFiles( const QStringList &list );
+
+ /**
+ * Returns the currently selected target. Returns 0 if
+ * no target is selected.
+ */
+ TargetItem *selectedTarget();
+
+ /**
+ * Returns the currently selected file. Returns 0 if
+ * no file is selected.
+ */
+ FileItem *selectedFile();
+
+ /**
+ * Returns the currently selected subproject (directory with Makefile.am). Returns 0 if
+ * no subproject is selected.
+ */
+ SubprojectItem* selectedSubproject();
+
+ /**
+ * Creates a TargetItem instance without a parent item.
+ */
+ TargetItem *createTargetItem( const QString &name,
+ const QString &prefix, const QString &primary,
+ bool take = true );
+ /**
+ * Creates a FileItem instance without a parent item.
+ */
+ FileItem *createFileItem( const QString &name, SubprojectItem *subproject );
+
+ /**
+ * Returns the Subproject that contains the Active Target. The Active Target is a special target
+ * to which e.g. all files are added to.
+ */
+ SubprojectItem* activeSubproject ();
+ void setActiveSubproject( SubprojectItem* spitem );
+
+ /**
+ * Returns the Active Target. The Active Target is a special target
+ * to which e.g. all files are added to.
+ */
+ TargetItem* activeTarget();
+
+ /**
+ * Returns the sub project item, if any, for a given path. The path supplied can be either
+ * absolute, or relative to the project directory. If no subproject item is found for the
+ * path, null is returned.
+ */
+ SubprojectItem* subprojectItemForPath( const QString & path, bool pathIsAbsolute = false );
+
+ /**
+ * Returns the projectdir-relative path for a target item
+ */
+ QString pathForTarget( const TargetItem *item ) const;
+
+ /**
+ * Adds file fileName to target titem in subproject spitem
+ */
+ void addToTarget( const QString & fileName, SubprojectItem* spitem, TargetItem* titem );
+
+ /**
+ * Restores the last settings of the AutoProjectWidget
+ */
+ void restoreSession ( const QDomElement* el );
+
+ /**
+ * Saves the latest changes of the AutoProjectWidget to the session file.
+ */
+ void saveSession ( QDomElement* el );
+
+ AutoSubprojectView* getSubprojectView ();
+ AutoDetailsView* getDetailsView ();
+
+
+ void emitAddedFile ( const QString& name );
+ void emitAddedFiles( const QStringList &fileList );
+ void emitRemovedFile ( const QString& name );
+ void emitRemovedFiles( const QStringList &fileList );
+
+ void parse( SubprojectItem *item );
+
+ enum AutoProjectView { SubprojectView, DetailsView };
+ void setLastFocusedView( AutoProjectView view );
+
+ MakefileHandler* makefileHandler();
+
+public slots:
+ void slotOverviewSelectionChanged( QListViewItem *item );
+
+protected:
+ void initOverview ( QWidget* parent );
+ void initDetailview ( QWidget* parent );
+ void initActions ();
+
+ virtual void focusInEvent( QFocusEvent *e );
+
+private:
+
+ AutoSubprojectView* m_subprojectView;
+ AutoDetailsView* m_detailView;
+
+ bool m_kdeMode;
+ AutoProjectPart *m_part;
+ SubprojectItem *m_activeSubproject;
+ TargetItem *m_activeTarget;
+ TargetItem *m_choosenTarget;
+ SubprojectItem *m_shownSubproject;
+
+ AutoProjectView m_lastFocusedView;
+
+ MakefileHandler *m_makefileHandler;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/autosubprojectview.cpp b/buildtools/autotools/autosubprojectview.cpp
new file mode 100644
index 00000000..efa3a358
--- /dev/null
+++ b/buildtools/autotools/autosubprojectview.cpp
@@ -0,0 +1,1137 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2002 by Victor Roeder <victor_roeder@gmx.de>
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+ * *
+ ***************************************************************************
+*/
+
+/** Qt */
+#include <qregexp.h>
+#include <qcheckbox.h>
+#include <qstringlist.h>
+#include <qtable.h>
+#include <qlayout.h>
+
+/** KDE Libs */
+#include <kxmlguiclient.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kpopupmenu.h>
+#include <kmessagebox.h>
+#include <kapplication.h>
+#include <kprocess.h>
+#include <ksqueezedtextlabel.h>
+#include <kdialogbase.h>
+#include <klistview.h>
+
+/** KDevelop */
+#include <kdevmainwindow.h>
+#include <kdevmakefrontend.h>
+#include <kdevappfrontend.h>
+#include <kdevcore.h>
+#include <urlutil.h>
+
+/** AutoProject */
+#include "subprojectoptionsdlg.h"
+#include "addsubprojectdlg.h"
+#include "addtargetdlg.h"
+#include "addservicedlg.h"
+#include "addapplicationdlg.h"
+#include "addexistingdirectoriesdlg.h"
+#include "autolistviewitems.h"
+#include "autoprojectwidget.h"
+#include "autoprojectpart.h"
+#include "autosubprojectview.h"
+#include "autotoolsaction.h"
+#include "removesubprojectdialog.h"
+#include "managecustomcommand.h"
+
+namespace AutoProjectPrivate
+{
+
+bool isHeader( const QString& fileName )
+{
+ return QStringList::split( ";", "h;H;hh;hxx;hpp;tcc;h++" ).contains( QFileInfo(fileName).extension(false) );
+}
+
+static QString cleanWhitespace( const QString &str )
+{
+ QString res;
+
+ QStringList l = QStringList::split( QRegExp( "[ \t]" ), str );
+ QStringList::ConstIterator it;
+ for ( it = l.begin(); it != l.end(); ++it )
+ {
+ res += *it;
+ res += " ";
+ }
+
+ return res.left( res.length() - 1 );
+}
+
+static void removeDir( const QString& dirName )
+{
+ QDir d( dirName );
+ const QFileInfoList* fileList = d.entryInfoList();
+ if( !fileList )
+ return;
+
+ QFileInfoListIterator it( *fileList );
+ while( it.current() ){
+ const QFileInfo* fileInfo = it.current();
+ ++it;
+
+ if( fileInfo->fileName() == "." || fileInfo->fileName() == ".." )
+ continue;
+
+ if( fileInfo->isDir() && !fileInfo->isSymLink() )
+ removeDir( fileInfo->absFilePath() );
+
+ kdDebug(9020) << "remove " << fileInfo->absFilePath() << endl;
+ d.remove( fileInfo->fileName(), false );
+ }
+
+ kdDebug(9020) << "remove dir " << dirName << endl;
+ d.rmdir( d.absPath(), true );
+}
+
+}
+
+
+AutoSubprojectView::AutoSubprojectView(AutoProjectWidget* widget, AutoProjectPart* part, QWidget *parent, const char *name)
+: AutoProjectViewBase(parent, name)
+{
+
+ m_widget = widget;
+ m_part = part;
+
+ m_listView->setSorting(-1);
+ m_listView->header()->hide();
+ m_listView->addColumn( QString::null );
+
+ connect( m_listView, SIGNAL( selectionChanged( QListViewItem* ) ),
+ this, SLOT( slotSelectionChanged( QListViewItem* ) ) );
+
+ initActions();
+}
+
+
+AutoSubprojectView::~AutoSubprojectView()
+{
+}
+
+void AutoSubprojectView::slotSelectionChanged( QListViewItem* item )
+{
+ if ( m_listView->selectedItems().count() <= 0 )
+ {
+ subProjectOptionsAction->setEnabled( false );
+ addSubprojectAction->setEnabled( false );
+ addTargetAction->setEnabled( false );
+ addServiceAction->setEnabled( false );
+ addApplicationAction->setEnabled( false );
+ buildSubprojectAction->setEnabled( false );
+ }
+ else
+ {
+ subProjectOptionsAction->setEnabled( true );
+ addSubprojectAction->setEnabled( true );
+ addTargetAction->setEnabled( true );
+ addServiceAction->setEnabled( true );
+ addApplicationAction->setEnabled( true );
+ buildSubprojectAction->setEnabled( true );
+ }
+
+ emit selectionChanged( item );
+}
+
+void AutoSubprojectView::loadMakefileams ( const QString& dir )
+{
+ SubprojectItem * item = new SubprojectItem( m_listView, m_part->projectName() );
+ item->setPixmap ( 0, SmallIcon ( "kdevelop" ) );
+ item->subdir = "/";
+ item->path = dir;
+ parse( item );
+ item->setOpen( true );
+
+ //setSelected( item, true );
+
+ expandCollapseFirst( m_listView->firstChild(), false );
+}
+
+
+void AutoSubprojectView::initActions()
+{
+ KActionCollection * actions = new KActionCollection( this );
+
+ subProjectOptionsAction = new AutoToolsAction( i18n( "Options..." ), "configure", 0,
+ this, SLOT( slotSubprojectOptions() ), actions, "subproject options" );
+ subProjectOptionsAction->setWhatsThis(i18n("<qt><b>Options</b><p>Shows subproject options dialog "
+ "that provides settings for compiler, include paths, "
+ "prefixes and build order.</qt>"));
+ subProjectOptionsAction->plug( m_optionsButton );
+
+ QToolTip::add( m_button1, tr2i18n( "Add new subproject..."));
+ addSubprojectAction = new AutoToolsAction( i18n( "Add new subproject..." ), "folder_new", 0,
+ this, SLOT( slotAddSubproject() ), actions, "add subproject" );
+ addSubprojectAction->setWhatsThis(i18n("<qt><b>Add new subproject</b><p>Creates a new "
+ "subproject in currently selected subproject.</qt>"));
+ addSubprojectAction->plug( m_button1 );
+
+ removeSubprojectAction = new KAction( i18n( "Remove Subproject..." ), "remove_subdir", 0,
+ this, SLOT( slotRemoveSubproject() ), actions, "remove subproject" );
+ removeSubprojectAction->setWhatsThis(i18n("<qt><b>Remove subproject</b><p>Removes the subproject. Asks if the "
+ "subproject should be also removed from disk. Only subprojects "
+ "which do not hold other subprojects can be removed.</qt>"));
+ addExistingSubprojectAction = new KAction( i18n( "Add Existing Subprojects..." ), "fileimport", 0,
+ this, SLOT( slotAddExistingSubproject() ), actions, "add existing subproject" );
+ addExistingSubprojectAction->setWhatsThis(i18n("<qt><b>Add existing subprojects</b><p>Imports existing "
+ "subprojects containing Makefile.am.</qt>"));
+
+ QToolTip::add( m_button2, tr2i18n( "Add Target..."));
+ addTargetAction = new AutoToolsAction( i18n( "Add Target..." ), "targetnew_kdevelop", 0,
+ this, SLOT( slotAddTarget() ), actions, "add target" );
+ addTargetAction->setWhatsThis(i18n( "<qt><b>Add target</b><p>Adds a new target to "
+ "the currently selected subproject. Target can be a "
+ "binary program, library, script, also a collection of "
+ "data or header files.</qt>"));
+ addTargetAction->plug( m_button2 );
+
+ QToolTip::add( m_button3, tr2i18n( "Add Service..."));
+ addServiceAction = new AutoToolsAction( i18n( "Add Service..." ), "servicenew_kdevelop", 0, this,
+ SLOT( slotAddService() ), actions, "add service" );
+ addServiceAction->setWhatsThis(i18n("<qt><b>Add service</b><p>Creates a .desktop file describing the service.</qt>"));
+ addServiceAction->plug( m_button3 );
+
+ QToolTip::add( m_button4, tr2i18n( "Add Application..."));
+ addApplicationAction = new AutoToolsAction( i18n( "Add Application..." ), "window_new", 0, this,
+ SLOT( slotAddApplication() ), actions, "add application" );
+ addApplicationAction->setWhatsThis(i18n("<qt><b>Add application</b><p>Creates an application .desktop file.</qt>"));
+ addApplicationAction->plug( m_button4 );
+
+ QToolTip::add( m_button5, tr2i18n( "Build"));
+ buildSubprojectAction = new AutoToolsAction( i18n( "Build" ), "launch", 0, this,
+ SLOT( slotBuildSubproject() ), actions, "build subproject" );
+ buildSubprojectAction->setWhatsThis(i18n("<qt><b>Build</b><p>Runs <b>make</b> from the directory of "
+ "the selected subproject.<br> Environment variables and "
+ "make arguments can be specified in the project settings "
+ "dialog, <b>Make Options</b> tab.</qt>"));
+ buildSubprojectAction->plug( m_button5 );
+
+ forceReeditSubprojectAction = new KAction( i18n( "Force Reedit" ), 0, 0, this,
+ SLOT( slotForceReeditSubproject() ), actions, "force-reedit subproject" );
+ forceReeditSubprojectAction->setWhatsThis(i18n("<qt><b>Force Reedit</b><p>Runs <b>make force-reedit</b> "
+ "from the directory of the selected subproject.<br>This "
+ "recreates makefile (tip: and solves most of .moc related "
+ "problems)<br>Environment variables and make arguments can "
+ "be specified in the project settings dialog, "
+ "<b>Make Options</b> tab.</qt>"));
+
+ if (!m_part->isKDE())
+ forceReeditSubprojectAction->setEnabled(false);
+
+ cleanSubprojectAction = new KAction( i18n( "Clean" ), 0, 0, this,
+ SLOT( slotCleanSubproject() ), actions, "clean subproject" );
+ cleanSubprojectAction->setWhatsThis(i18n("<qt><b>Clean</b><p>Runs <b>make clean</b> from the directory of "
+ "the selected subproject.<br> Environment variables and make "
+ "arguments can be specified in the project settings dialog, "
+ "<b>Make Options</b> tab.</qt>"));
+
+ installSubprojectAction = new KAction( i18n( "Install" ), 0, 0, this,
+ SLOT( slotInstallSubproject() ), actions, "install subproject" );
+ installSubprojectAction->setWhatsThis(i18n("<qt><b>Install</b><p>Runs <b>make install</b> from the directory "
+ "of the selected subproject.<br> Environment variables and "
+ "make arguments can be specified in the project settings "
+ "dialog, <b>Make Options</b> tab.</qt>"));
+ installSuSubprojectAction = new KAction( i18n( "Install (as root user)" ), 0, 0,
+ this, SLOT( slotInstallSuSubproject() ), actions, "install subproject as root" );
+ installSuSubprojectAction->setWhatsThis(i18n("<qt><b>Install as root user</b><p>Runs <b>make install</b> "
+ "command from the directory of the selected subproject "
+ "with root privileges.<br> It is executed via kdesu "
+ "command.<br> Environment variables and make arguments "
+ "can be specified in the project settings dialog, "
+ "<b>Make Options</b> tab.</qt>"));
+
+ expandAction = new KAction( i18n( "Expand Subtree" ), 0, 0, this,
+ SLOT(slotExpandTree()), actions, "expandAction" );
+ collapseAction = new KAction( i18n( "Collapse Subtree" ), 0, 0, this,
+ SLOT(slotCollapseTree()), actions, "collapseAction" );
+
+ otherAction = new KAction( i18n( "Manage Custom Commands..." ), 0, 0, this,
+ SLOT( slotManageBuildCommands() ), actions, "manage custom commands" );
+ otherAction->setWhatsThis(i18n("<qt><b>Manage custom commands</b><p>Allows to create, edit and "
+ "delete custom build commands which appears in the subproject "
+ "context menu.<br></qt>"));
+
+ connect( m_listView, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ),
+ this, SLOT( slotContextMenu( KListView*, QListViewItem*, const QPoint& ) ) );
+}
+
+void AutoSubprojectView::slotContextMenu( KListView *, QListViewItem *item, const QPoint &p )
+{
+ if ( !item )
+ return ;
+
+ KPopupMenu popup( i18n( "Subproject: %1" ).arg( item->text( 0 ) ), this );
+
+ subProjectOptionsAction->plug( &popup );
+ popup.insertSeparator();
+ addSubprojectAction->plug( &popup );
+ addTargetAction->plug( &popup );
+ addServiceAction->plug( &popup );
+ addApplicationAction->plug( &popup );
+ popup.insertSeparator();
+ addExistingSubprojectAction->plug( &popup );
+ popup.insertSeparator();
+ removeSubprojectAction->plug( &popup );
+ popup.insertSeparator();
+ buildSubprojectAction->plug( &popup );
+ popup.insertSeparator();
+ forceReeditSubprojectAction->plug( &popup );
+ cleanSubprojectAction->plug( &popup );
+ popup.insertSeparator();
+ installSubprojectAction->plug( &popup );
+ installSuSubprojectAction->plug( &popup );
+ popup.insertSeparator();
+ collapseAction->plug( &popup );
+ expandAction->plug( &popup );
+
+ KConfig *config = m_part->instance()->config();
+ bool separate = true;
+ QMap<QString,QString> customBuildCommands = config->entryMap("CustomCommands");
+ for (QMap<QString,QString>::const_iterator it = customBuildCommands.constBegin();
+ it != customBuildCommands.constEnd(); ++it)
+ {
+ if (separate)
+ {
+ popup.insertSeparator();
+ separate = false;
+ }
+ int id = popup.insertItem(it.key(), this, SLOT(slotCustomBuildCommand(int)));
+ m_commandList.append(it.data());
+ popup.setItemParameter(id, m_commandList.findIndex(it.data()));
+ }
+
+ popup.insertSeparator();
+ otherAction->plug( &popup );
+
+ KURL::List urls;
+ urls.append(m_widget->selectedSubproject()->path);
+ FileContext context(urls);
+ m_part->core()->fillContextMenu( &popup, &context );
+
+ popup.exec( p );
+}
+
+void AutoSubprojectView::slotSubprojectOptions()
+{
+ kdDebug( 9020 ) << "AutoSubprojectView::slotSubprojectOptions()" << endl;
+
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ SubprojectOptionsDialog dlg( m_part, m_widget, spitem, this, "subproject options dialog" );
+ dlg.exec();
+}
+
+
+void AutoSubprojectView::slotAddSubproject()
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ AddSubprojectDialog dlg( m_part, this, spitem, this, "add subproject dialog" );
+
+ dlg.setCaption ( i18n ( "Add New Subproject to '%1'" ).arg ( spitem->subdir ) );
+ dlg.exec();
+}
+
+
+void AutoSubprojectView::slotAddExistingSubproject()
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ AddExistingDirectoriesDialog dlg ( m_part, m_widget, spitem, this, "add existing subprojects" );
+
+ dlg.setCaption ( i18n ( "Add Existing Subproject to '%1'" ).arg ( spitem->subdir ) );
+ dlg.targetLabel->setText("");
+ dlg.directoryLabel->setText(spitem->path);
+
+ if ( dlg.exec() )
+ emit selectionChanged ( spitem );
+}
+
+void AutoSubprojectView::slotAddTarget()
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ AddTargetDialog dlg( m_widget, spitem, this, "add target dialog" );
+
+ dlg.setCaption ( i18n ( "Add New Target to '%1'" ).arg ( spitem->subdir ) );
+
+ // Update the details view if a target was added
+ if ( dlg.exec() )
+ emit selectionChanged( spitem );
+}
+
+
+void AutoSubprojectView::slotAddService()
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ AddServiceDialog dlg( m_widget, spitem, this, "add service dialog" );
+
+ dlg.setCaption ( i18n ( "Add New Service to '%1'" ).arg ( spitem->subdir ) );
+
+ // Update the details view if a service was added
+ if ( dlg.exec() )
+ emit selectionChanged( spitem );
+}
+
+
+void AutoSubprojectView::slotAddApplication()
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ AddApplicationDialog dlg( m_widget, spitem, this, "add application dialog" );
+
+ dlg.setCaption ( i18n ( "Add New Application to '%1'" ).arg ( spitem->subdir ) );
+
+ // Update the details view if an application was added
+ if ( dlg.exec() )
+ emit selectionChanged( spitem );
+}
+
+
+void AutoSubprojectView::slotBuildSubproject()
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() );
+
+ m_part->startMakeCommand( m_part->buildDirectory() + relpath, QString::fromLatin1( "" ) );
+}
+
+void AutoSubprojectView::slotRemoveSubproject()
+{
+ kdDebug(9020) << "AutoSubprojectView::slotRemoveSubproject()" << endl;
+
+ SubprojectItem* spitem = static_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if( !spitem )
+ return;
+
+ SubprojectItem* parent = static_cast<SubprojectItem*>( spitem->parent() );
+ if( !parent || !parent->listView() || spitem->childCount() != 0 ){
+ KMessageBox::error( 0, i18n("This item cannot be removed"), i18n("Automake Manager") );
+ return;
+ }
+
+ QStringList list = QStringList::split( QRegExp("[ \t]"), parent->variables["SUBDIRS"] );
+ QStringList::Iterator it = list.find( spitem->subdir );
+ QString subdirToRemove = spitem->subdir;
+ bool topsubdirs = true;
+ if ((parent->variables["SUBDIRS"].find("$(TOPSUBDIRS)") == -1)
+ && (parent->variables["SUBDIRS"].find("$(AUTODIRS)") == -1))
+ {
+ topsubdirs = false;
+ if( it == list.end() ){
+ KMessageBox::sorry(this, i18n("There is no subproject %1 in SUBDIRS").arg(spitem->subdir));
+ return;
+ }
+ }
+
+ RemoveSubprojectDialog dlg(i18n("Remove Subproject %1").arg(spitem->text(0)),
+ i18n("Do you really want to remove subproject %1 with all targets and files?").arg(spitem->text(0)));
+ if( dlg.exec() ){
+
+ bool removeSources = dlg.removeFromDisk();
+
+ if (!topsubdirs)
+ {
+ list.remove( it );
+ parent->variables[ "SUBDIRS" ] = list.join( " " );
+ }
+
+ parent->listView()->setSelected( parent, true );
+ kapp->processEvents( 500 );
+
+
+ if( removeSources ){
+ kdDebug(9020) << "remove dir " << spitem->path << endl;
+ AutoProjectPrivate::removeDir( spitem->path );
+ }
+
+ if( m_widget->activeSubproject() == spitem ){
+ m_widget->setActiveSubproject( 0 );
+ }
+
+ // Adjust AC_OUTPUT in configure.in
+ if ( !m_part->isKDE() ) {
+
+ QString projroot = m_part->projectDirectory() + "/";
+ QString subdirectory = spitem->path;
+ QString relpath = subdirectory.replace(0, projroot.length(),"");
+
+ QString configureFile = m_part->getAutoConfFile(projroot);
+
+ QStringList list = AutoProjectTool::configureinLoadMakefiles(configureFile);
+
+ QStringList::iterator it;
+
+ for ( it = list.begin(); it != list.end(); it++ ) {
+ QString current = (QString) (*it);
+ QRegExp path_regex(relpath);
+ if ( path_regex.search(current) >= 0) {
+ list.remove(it);
+ break;
+ }
+ }
+ AutoProjectTool::configureinSaveMakefiles(configureFile, list);
+
+ }
+
+ // remove all targets
+ spitem->targets.setAutoDelete( true );
+ spitem->targets.clear();
+ delete( spitem );
+ spitem = 0;
+
+ // Adjust SUBDIRS variable in containing Makefile.am
+
+ if (parent->variables["SUBDIRS"].find("$(TOPSUBDIRS)") != -1)
+ {
+ QFile subdirsfile( parent->path + "/subdirs" );
+ QStringList topdirs;
+ if ( subdirsfile.open( IO_ReadOnly ) )
+ {
+ QTextStream subdirsstream( &subdirsfile );
+ while (!subdirsstream.atEnd())
+ topdirs.append(subdirsstream.readLine());
+ subdirsfile.close();
+ }
+ topdirs.remove(subdirToRemove);
+ if ( subdirsfile.open( IO_WriteOnly | IO_Truncate ) )
+ {
+ QTextStream subdirsstream( &subdirsfile );
+ for (QStringList::const_iterator it = topdirs.begin(); it != topdirs.end(); ++it)
+ subdirsstream << *it << endl;
+ subdirsfile.close();
+ }
+ }
+
+ QMap<QString,QString> replaceMap;
+ replaceMap.insert( "SUBDIRS", subdirToRemove );
+ AutoProjectTool::removeFromMakefileam( parent->path + "/Makefile.am", replaceMap );
+
+ QString relmakefile = ( parent->path + "/Makefile" ).mid( m_part->projectDirectory().length()+1 );
+ kdDebug(9020) << "Relative makefile path: " << relmakefile << endl;
+
+ // check for config.status
+ if( !QFileInfo(m_part->buildDirectory(), "config.status").exists() ){
+ return;
+ }
+
+ QString cmdline = "cd ";
+ cmdline += KProcess::quote(m_part->projectDirectory());
+ cmdline += " && automake ";
+ cmdline += KProcess::quote(relmakefile);
+ cmdline += " && cd ";
+ cmdline += KProcess::quote(m_part->buildDirectory());
+ cmdline += " && CONFIG_HEADERS=config.h CONFIG_FILES=";
+ cmdline += KProcess::quote(relmakefile);
+ cmdline += " ./config.status";
+ m_part->makeFrontend()->queueCommand( m_part->projectDirectory(), cmdline );
+ }
+}
+
+
+void AutoSubprojectView::parsePrimary( SubprojectItem *item,
+ const QString &lhs, const QString &rhs )
+{
+ // Parse line foo_bar = bla bla
+
+ int pos = lhs.findRev( '_' );
+ QString prefix = lhs.left( pos );
+ QString primary = lhs.right( lhs.length() - pos - 1 );
+ // kdDebug(9020) << "Prefix:" << prefix << ",Primary:" << primary << endl;
+
+
+#if 0
+
+ QStrList prefixes;
+ prefixes.append( "bin" );
+ prefixes.append( "pkglib" );
+ prefixes.append( "pkgdata" );
+ prefixes.append( "noinst" );
+ prefixes.append( "check" );
+ prefixes.append( "sbin" );
+ QStrList primaries;
+ primaries.append( "PROGRAMS" );
+ primaries.append( "LIBRARIES" );
+ primaries.append( "LTLIBRARIES" );
+ primaries.append( "SCRIPTS" );
+ primaries.append( "HEADERS" );
+ primaries.append( "DATA" );
+#endif
+
+ // Not all combinations prefix/primary are possible, so this
+ // could also be checked... not trivial because the list of
+ // possible prefixes can be extended dynamically (see below)
+ if ( primary == "PROGRAMS" || primary == "LIBRARIES" || primary == "LTLIBRARIES" )
+ {
+ QStringList l = QStringList::split( QRegExp( "[ \t\n]" ), rhs );
+ QStringList::Iterator it1;
+ for ( it1 = l.begin(); it1 != l.end(); ++it1 )
+ {
+ TargetItem *titem = m_widget->createTargetItem( *it1, prefix, primary );
+ item->targets.append( titem );
+
+ QString canonname = AutoProjectTool::canonicalize( *it1 );
+ titem->ldflags = AutoProjectPrivate::cleanWhitespace( item->variables[ canonname + "_LDFLAGS" ] );
+ titem->ldadd = AutoProjectPrivate::cleanWhitespace( item->variables[ canonname + "_LDADD" ] );
+ titem->libadd = AutoProjectPrivate::cleanWhitespace( item->variables[ canonname + "_LIBADD" ] );
+ titem->dependencies = AutoProjectPrivate::cleanWhitespace( item->variables[ canonname + "_DEPENDENCIES" ] );
+
+ QString sources = item->variables[ canonname + "_SOURCES" ];
+ QStringList sourceList = QStringList::split( QRegExp( "[ \t\n]" ), sources );
+ QMap<QString, bool> dict;
+ QStringList::Iterator it = sourceList.begin();
+ while( it != sourceList.end() ){
+ dict.insert( *it, true );
+ ++it;
+ }
+
+ QMap<QString, bool>::Iterator dictIt = dict.begin();
+ while( dictIt != dict.end() ){
+ QString fname = dictIt.key();
+ ++dictIt;
+
+ FileItem *fitem = m_widget->createFileItem( fname, item );
+ titem->sources.append( fitem );
+
+ if( AutoProjectPrivate::isHeader(fname) )
+ headers += fname;
+ }
+ }
+ }
+ else if ( primary == "SCRIPTS" || primary == "HEADERS" || primary == "DATA" )
+ {
+ // See if we have already such a group
+ for ( uint i = 0; i < item->targets.count(); ++i )
+ {
+ TargetItem *titem = item->targets.at( i );
+ if ( primary == titem->primary && prefix == titem->prefix )
+ {
+ item->targets.remove( i );
+ break;
+ }
+ }
+ // Create a new one
+ TargetItem *titem = m_widget->createTargetItem( "", prefix, primary );
+ item->targets.append( titem );
+
+ QStringList l = QStringList::split( QRegExp( "[ \t]" ), rhs );
+ QStringList::Iterator it3;
+ for ( it3 = l.begin(); it3 != l.end(); ++it3 )
+ {
+ QString fname = *it3;
+ FileItem *fitem = m_widget->createFileItem( fname, item );
+ titem->sources.append( fitem );
+
+ if( AutoProjectPrivate::isHeader(fname) )
+ headers += fname;
+
+ }
+ }
+ else if ( primary == "JAVA" )
+ {
+ QStringList l = QStringList::split( QRegExp( "[ \t\n]" ), rhs );
+ QStringList::Iterator it1;
+ TargetItem *titem = m_widget->createTargetItem( "", prefix, primary );
+ item->targets.append( titem );
+
+ for ( it1 = l.begin(); it1 != l.end(); ++it1 )
+ {
+ FileItem *fitem = m_widget->createFileItem( *it1, item );
+ titem->sources.append( fitem );
+ }
+ }
+}
+
+
+void AutoSubprojectView::parseKDEDOCS( SubprojectItem *item,
+ const QString & /*lhs*/, const QString & /*rhs*/ )
+{
+ // Handle the line KDE_ICON =
+ // (actually, no parsing is involved here)
+
+ QString prefix = "kde_docs";
+ QString primary = "KDEDOCS";
+
+ TargetItem *titem = m_widget->createTargetItem( "", prefix, primary );
+ item->targets.append( titem );
+
+ QDir d( item->path );
+ QStringList l = d.entryList( QDir::Files );
+
+ QRegExp re( "Makefile.*|\\..*|.*~|index.cache.bz2" );
+
+ QStringList::ConstIterator it;
+ for ( it = l.begin(); it != l.end(); ++it )
+ {
+ if ( !re.exactMatch( *it ) )
+ {
+ QString fname = *it;
+ FileItem * fitem = m_widget->createFileItem( fname, item );
+ titem->sources.append( fitem );
+ }
+ }
+}
+
+
+void AutoSubprojectView::parseKDEICON( SubprojectItem *item,
+ const QString &lhs, const QString &rhs )
+{
+ // Parse a line foo_ICON = bla bla
+
+ int pos = lhs.find( "_ICON" );
+ QString prefix = lhs.left( pos );
+ if ( prefix == "KDE" )
+ prefix = "kde_icon";
+
+ QString primary = "KDEICON";
+
+ TargetItem *titem = m_widget->createTargetItem( "", prefix, primary );
+ item->targets.append( titem );
+
+ QDir d( item->path );
+ QStringList l = d.entryList( QDir::Files );
+
+ QString regexp;
+
+ if ( rhs == "AUTO" )
+ {
+ regexp = ".*\\.(png|mng|xpm)";
+ }
+ else
+ {
+ QStringList appNames = QStringList::split( QRegExp( "[ \t\n]" ), rhs );
+ regexp = ".*(-" + appNames.join( "|-" ) + ")\\.(png|mng|xpm)";
+ }
+
+ QRegExp re( regexp );
+
+ QStringList::ConstIterator it;
+ for ( it = l.begin(); it != l.end(); ++it )
+ {
+ if ( re.exactMatch( *it ) )
+ {
+ FileItem * fitem = m_widget->createFileItem( *it, item );
+ titem->sources.append( fitem );
+ }
+ }
+}
+
+
+void AutoSubprojectView::parsePrefix( SubprojectItem *item,
+ const QString &lhs, const QString &rhs )
+{
+ // Parse a line foodir = bla bla
+ QString name = lhs.left( lhs.length() - 3 );
+ QString dir = rhs;
+ item->prefixes.insert( name, dir );
+}
+
+
+void AutoSubprojectView::parseSUBDIRS( SubprojectItem *item,
+ const QString & /*lhs*/, const QString &rhs )
+{
+ // Parse a line SUBDIRS = bla bla
+ QString subdirs = rhs;
+ kdDebug( 9020 ) << "subdirs are " << subdirs << endl;
+
+ // Take care of KDE hacks:
+ // TOPSUBDIRS is an alias for all directories
+ // listed in the subdirs file
+ if ( subdirs.find( "$(TOPSUBDIRS)" ) != -1 )
+ {
+ QStringList dirs;
+ QFile subdirsfile( item->path + "/subdirs" );
+ if( subdirsfile.exists() )
+ {
+ if ( subdirsfile.open( IO_ReadOnly ) )
+ {
+ QTextStream subdirsstream( &subdirsfile );
+ while ( !subdirsstream.atEnd() )
+ dirs.append( subdirsstream.readLine() );
+ subdirsfile.close();
+ }
+ } else
+ {
+ QDir d( item->path );
+ QStringList l = d.entryList( QDir::Dirs );
+ for( QStringList::const_iterator it = l.begin(); it != l.end(); ++it )
+ {
+ if( (*it) != "CVS" && (*it) != "admin" && (*it) != ".svn" && (*it) != "." && (*it) != ".." )
+ {
+ QDir subdir = d;
+ subdir.cd( *it, false );
+ if( subdir.exists( "Makefile.am" ) )
+ dirs.append( *it );
+ }
+ }
+
+ }
+ subdirs.replace( QRegExp( "\\$\\(TOPSUBDIRS\\)" ), dirs.join( " " ) );
+ }
+
+ // AUTODIRS is an alias for all subdirectories
+ if ( subdirs.find( "$(AUTODIRS)" ) != -1 )
+ {
+ QDir d( item->path );
+ QStringList dirs = d.entryList( QDir::Dirs );
+ dirs.remove( "." );
+ dirs.remove( ".." );
+ dirs.remove( "CVS" );
+ subdirs.replace( QRegExp( "\\$\\(AUTODIRS\\)" ), dirs.join( " " ) );
+ }
+
+ // If there are any variables in the subdirs line then search
+ // the Makefile(.am?) for its definition. Unfortunately, it may be
+ // defined outside this file in which case those dirs won't be added.
+ QRegExp varre( "\\$\\(\\s*(.*)\\s*\\)" );
+ varre.setMinimal( true );
+ while ( varre.search( subdirs ) != -1 )
+ {
+ QString varname = varre.cap( 1 );
+ QString varvalue;
+
+ // Search the whole Makefile(.am?)
+ // Note that if the variable isn't found it just disappears
+ // (Perhaps we should add it back in this case?)
+ QMap<QString, QString>::ConstIterator varit = item->variables.find( varname );
+ if ( varit != item->variables.end() )
+ {
+ kdDebug( 9020 ) << "Found Makefile var " << varname << ", adding dirs <" << varit.data() << ">" << endl;
+ varvalue = varit.data();
+ }
+ else
+ {
+ kdDebug( 9020 ) << "Not found Makefile var " << varname << endl;
+ }
+ subdirs.replace( QRegExp( "\\$\\(\\s*" + varname + "\\s*\\)" ), varvalue );
+ }
+
+ //search for AC_SUBST variables and try to replace them with variables
+ //that have been already defined e.g. in a "kdevelop hint"
+ varre = QRegExp( "\\@(.*)\\@" );
+ varre.setMinimal( true );
+ while ( varre.search( subdirs ) != -1 )
+ {
+ QString varname = varre.cap( 1 );
+ QString varvalue;
+
+ // Search the whole Makefile(.am?)
+ // Note that if the variable isn't found it just disappears
+ // (Perhaps we should add it back in this case?)
+ QMap<QString, QString>::ConstIterator varit = item->variables.find( varname );
+ if ( varit != item->variables.end() )
+ {
+ kdDebug( 9020 ) << "Found Makefile var " << varname << ", adding dirs <" << varit.data() << ">" << endl;
+ varvalue = varit.data();
+ }
+ else
+ {
+ kdDebug( 9020 ) << "Not found Makefile var " << varname << endl;
+ }
+ subdirs.replace( QRegExp( "\\@" + varname + "\\@" ), varvalue );
+ }
+
+ QStringList l = QStringList::split( QRegExp( "[ \t]" ), subdirs );
+ l.sort();
+ QStringList::Iterator it;
+ for ( it = l.begin(); it != l.end(); ++it )
+ {
+ if ( *it == "." )
+ continue;
+ SubprojectItem *newitem = new SubprojectItem( item, ( *it ) );
+ newitem->subdir = ( *it );
+ newitem->path = item->path + "/" + ( *it );
+ parse( newitem );
+ // Experience tells me this :-)
+ bool open = true;
+ if ( newitem->subdir == "doc" )
+ open = false;
+ if ( newitem->subdir == "po" )
+ open = false;
+ if ( newitem->subdir == "pics" )
+ open = false;
+ if ( newitem && static_cast<SubprojectItem*>( newitem->parent() )
+ ->subdir == "doc" )
+ open = false;
+ if ( newitem && static_cast<SubprojectItem*>
+ ( newitem->parent() ) ->subdir == "po" )
+ open = false;
+ if ( newitem && static_cast<SubprojectItem*>
+ ( newitem->parent() ) ->subdir == "pics" )
+ open = false;
+ newitem->setOpen( open );
+
+ // Move to the bottom of the list
+ QListViewItem *lastItem = item->firstChild();
+ while ( lastItem->nextSibling()
+ )
+ lastItem = lastItem->nextSibling();
+ if ( lastItem != newitem )
+ newitem->moveItem( lastItem );
+ }
+}
+
+void AutoSubprojectView::parse( SubprojectItem *item )
+{
+ headers.clear();
+ AutoProjectTool::parseMakefileam( item->path + "/Makefile.am", &item->variables );
+
+ QMap<QString, QString>::ConstIterator it;
+ for ( it = item->variables.begin(); it != item->variables.end(); ++it )
+ {
+ QString lhs = it.key();
+ QString rhs = it.data();
+ if ( lhs == "KDE_DOCS" )
+ parseKDEDOCS( item, lhs, rhs );
+ else if ( lhs.right( 5 ) == "_ICON" )
+ parseKDEICON( item, lhs, rhs );
+ else if ( lhs.find( '_' ) > 0 )
+ parsePrimary( item, lhs, rhs );
+ else if ( lhs.right( 3 ) == "dir" )
+ parsePrefix( item, lhs, rhs );
+ else if ( lhs == "SUBDIRS" )
+ parseSUBDIRS( item, lhs, rhs );
+ }
+
+ /// @todo only if in a c++ project
+ TargetItem* noinst_HEADERS_item = findNoinstHeaders(item);
+
+ QDir dir( item->path );
+ QStringList headersList = QStringList::split( QRegExp("[ \t]"), item->variables[ "noinst_HEADERS" ] );
+
+ headersList += dir.entryList( "*.h;*.H;*.hh;*.hxx;*.hpp;*.tcc", QDir::Files );
+ headersList.sort();
+ headersList = QStringList::split(QRegExp("[ \t]"), headersList.join( " " ));
+
+ QStringList::Iterator fileIt = headersList.begin();
+ while( fileIt != headersList.end() ){
+ QString fname = *fileIt;
+ ++fileIt;
+
+ if( AutoProjectPrivate::isHeader(fname) && !headers.contains(fname) ){
+ FileItem *fitem = m_widget->createFileItem( fname, item );
+ noinst_HEADERS_item->sources.append( fitem );
+ }
+ }
+}
+
+void AutoSubprojectView::slotForceReeditSubproject( )
+{
+ SubprojectItem* spitem = dynamic_cast <SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() );
+
+ m_part->startMakeCommand( m_part->buildDirectory() + relpath, "force-reedit" );
+}
+
+void AutoSubprojectView::slotInstallSubproject( )
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() );
+
+ m_part->startMakeCommand( m_part->buildDirectory() + relpath, "install" );
+}
+
+void AutoSubprojectView::slotInstallSuSubproject( )
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() );
+
+ m_part->startMakeCommand( m_part->buildDirectory() + relpath, "install", true );
+}
+
+TargetItem * AutoSubprojectView::findNoinstHeaders( SubprojectItem *item )
+{
+ TargetItem* noinst_HEADERS_item = 0;
+ QPtrListIterator<TargetItem> itemIt( item->targets );
+ while( itemIt.current() ){
+ TargetItem* titem = itemIt.current();
+ ++itemIt;
+
+ if( titem->prefix == "noinst" && titem->primary == "HEADERS" ){
+ noinst_HEADERS_item = titem;
+ break;
+ }
+ }
+
+ if( !noinst_HEADERS_item ){
+ noinst_HEADERS_item = m_widget->createTargetItem( "", "noinst", "HEADERS" );
+ item->targets.append( noinst_HEADERS_item );
+ }
+
+ return noinst_HEADERS_item;
+}
+
+void AutoSubprojectView::slotCleanSubproject( )
+{
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() );
+
+ m_part->startMakeCommand( m_part->buildDirectory() + relpath, "clean" );
+}
+
+void AutoSubprojectView::focusOutEvent( QFocusEvent */* e*/ )
+{
+ m_widget->setLastFocusedView(AutoProjectWidget::SubprojectView);
+}
+
+void AutoSubprojectView::slotManageBuildCommands( )
+{
+ KConfig *config = m_part->instance()->config();
+ //menu item name <-> command
+ QMap<QString, QString> customBuildCommands = config->entryMap("CustomCommands");
+
+ KDialogBase dlg(KDialogBase::Plain, i18n("Manage Custom Commands"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok);
+ dlg.plainPage()->setMargin(0);
+ (new QVBoxLayout(dlg.plainPage(), 0, 0))->setAutoAdd(true);
+
+ ManageCustomCommand *widget = new ManageCustomCommand(dlg.plainPage());
+
+ for (QMap<QString,QString>::const_iterator it = customBuildCommands.constBegin();
+ it != customBuildCommands.constEnd(); ++it)
+ {
+ widget->commandsTable->insertRows(widget->commandsTable->numRows());
+ widget->setRowProperties(widget->commandsTable->numRows()-1);
+ widget->commandsTable->setText(widget->commandsTable->numRows() - 1, 0, it.key());
+ widget->commandsTable->setText(widget->commandsTable->numRows() - 1, 1,
+ it.data().section(":::", 0, 0));
+ static_cast<QComboTableItem*>(widget->commandsTable->
+ item(widget->commandsTable->numRows() - 1, 2))->
+ setCurrentItem(it.data().section(":::", 1, 1).toInt());
+ }
+
+ widget->commandsTable->setFocus();
+ if (dlg.exec() == QDialog::Accepted)
+ {
+ config->deleteGroup("CustomCommands");
+ config->setGroup("CustomCommands");
+ for (int i = 0; i < widget->commandsTable->numRows(); ++i)
+ {
+ config->writeEntry(widget->commandsTable->text(i, 0),
+ widget->commandsTable->text(i, 1)+":::"+
+ QString("%1").arg(static_cast<QComboTableItem*>(widget->
+ commandsTable->item(i, 2))->currentItem()));
+ }
+ config->sync();
+ }
+
+}
+
+void AutoSubprojectView::slotCustomBuildCommand(int val)
+{
+ QString cmd = m_commandList[val].section(":::", 0, 0);
+ int type = m_commandList[val].section(":::", 1, 1).toInt();
+
+ SubprojectItem* spitem = dynamic_cast<SubprojectItem*>( m_listView->selectedItem() );
+ if ( !spitem ) return;
+
+ QString relpath = "/" + URLUtil::getRelativePath( m_part->topsourceDirectory(), m_part->projectDirectory() ) + "/" + spitem->path.mid( m_part->projectDirectory().length() );
+ switch (type)
+ {
+ case 0: //make target
+ m_part->startMakeCommand( m_part->buildDirectory() + relpath, cmd );
+ break;
+ case 1: //make target as root
+ m_part->startMakeCommand( m_part->buildDirectory() + relpath, cmd, true );
+ break;
+ case 2: //make command
+ m_part->startSimpleMakeCommand( m_part->buildDirectory() + relpath, cmd );
+ break;
+ case 3: //make command as root
+ m_part->startSimpleMakeCommand( m_part->buildDirectory() + relpath, cmd, true );
+ break;
+ case 4: //command
+ m_part->appFrontend()->startAppCommand(m_part->buildDirectory() + relpath,
+ cmd, false);
+ break;
+ case 5: //command as root
+ m_part->appFrontend()->startAppCommand(m_part->buildDirectory() + relpath,
+ "kdesu -t -c ' cd " +
+ KProcess::quote(m_part->buildDirectory() + relpath) + " && "
+ + cmd + "'", false);
+ break;
+ }
+}
+
+void AutoSubprojectView::slotExpandTree()
+{
+ expandCollapseFirst( m_listView->currentItem(), true );
+}
+
+void AutoSubprojectView::slotCollapseTree()
+{
+ expandCollapseFirst( m_listView->currentItem(), false );
+}
+
+void AutoSubprojectView::expandCollapseFirst( QListViewItem * item, bool expand )
+{
+ if ( !item ) return;
+
+ if ( item == m_listView->firstChild() ) // special case for root node
+ {
+ item = item->firstChild();
+ while ( item )
+ {
+ expandCollapse( item, expand );
+ item = item->nextSibling();
+ }
+ }
+ else
+ {
+ expandCollapse( item, expand );
+ }
+}
+
+void AutoSubprojectView::expandCollapse( QListViewItem * item, bool expand )
+{
+ if ( !item ) return;
+
+ item->setOpen( expand );
+
+ item = item->firstChild();
+ while ( item )
+ {
+ expandCollapse( item, expand );
+ item = item->nextSibling();
+ }
+}
+
+#include "autosubprojectview.moc"
+
+// kate: indent-mode csands; tab-width 4; space-indent off;
diff --git a/buildtools/autotools/autosubprojectview.h b/buildtools/autotools/autosubprojectview.h
new file mode 100644
index 00000000..e49caddd
--- /dev/null
+++ b/buildtools/autotools/autosubprojectview.h
@@ -0,0 +1,130 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2002 by Victor Roeder <victor_roeder@gmx.de>
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+* *
+***************************************************************************
+*/
+
+#ifndef AUTOSUBPROJECTVIEW_H
+#define AUTOSUBPROJECTVIEW_H
+
+#include <qwidget.h>
+#include "autoprojectviewbase.h"
+
+
+class KAction;
+class AutoToolsAction;
+class AutoProjectWidget;
+class AutoProjectPart;
+class TargetItem;
+class SubprojectItem;
+class KListViewItem;
+class KListView;
+
+namespace AutoProjectPrivate
+{
+ bool isHeader( const QString& fileName );
+}
+
+
+//with protected inheritance gcc 3.2.3 complains in autoprojectwidget.cpp, line 116
+//that it cannot access the base class QObject (for the connect() call),
+//so in order to be able to compile this file I made the inheritance public again, Alex
+class AutoSubprojectView : public AutoProjectViewBase
+{
+ Q_OBJECT
+
+public:
+ AutoSubprojectView( AutoProjectWidget* widget, AutoProjectPart* part, QWidget *parent, const char *name );
+ virtual ~AutoSubprojectView();
+
+public:
+ void loadMakefileams ( const QString& dir );
+
+ void parse( SubprojectItem *item );
+ KListView* listView() const
+ {
+ return m_listView;
+ }
+
+ TargetItem *findNoinstHeaders( SubprojectItem *item );
+
+signals:
+ void selectionChanged( QListViewItem* );
+
+protected:
+ void initActions ();
+
+ void parseKDEDOCS( SubprojectItem *item,
+ const QString &lhs, const QString &rhs );
+ void parseKDEICON( SubprojectItem *item,
+ const QString &lhs, const QString &rhs );
+ void parsePrimary( SubprojectItem *item,
+ const QString &lhs, const QString &rhs );
+ void parsePrefix( SubprojectItem *item,
+ const QString &lhs, const QString &rhs );
+ void parseSUBDIRS( SubprojectItem *item,
+ const QString &lhs, const QString &rhs );
+ virtual void focusOutEvent( QFocusEvent *e );
+ void expandCollapse( QListViewItem * item, bool expand );
+ void expandCollapseFirst( QListViewItem * item, bool expand );
+
+private:
+ AutoProjectWidget* m_widget;
+ AutoProjectPart* m_part;
+ QStringList headers;
+
+ bool m_kdeMode;
+
+ AutoToolsAction* addApplicationAction;
+ AutoToolsAction* subProjectOptionsAction;
+ AutoToolsAction* addSubprojectAction;
+ KAction* addExistingSubprojectAction;
+ AutoToolsAction* addTargetAction;
+ AutoToolsAction* addServiceAction;
+ AutoToolsAction* buildSubprojectAction;
+ KAction* removeSubprojectAction;
+ KAction* cleanSubprojectAction;
+ KAction* forceReeditSubprojectAction;
+ KAction* installSubprojectAction;
+ KAction* installSuSubprojectAction;
+ KAction* otherAction;
+ KAction* expandAction;
+ KAction* collapseAction;
+
+ QStringList m_commandList;
+ QValueList<int> m_commandTypeList;
+
+private slots:
+ void slotContextMenu( KListView *, QListViewItem *item, const QPoint &p );
+ //void slotSubprojectExecuted(QListViewItem* item);
+ void slotSelectionChanged( QListViewItem* item );
+ void slotAddApplication();
+ void slotSubprojectOptions();
+ void slotAddSubproject();
+ void slotAddExistingSubproject();
+ void slotAddTarget();
+ void slotAddService();
+ void slotBuildSubproject();
+ void slotRemoveSubproject();
+ void slotForceReeditSubproject();
+ void slotInstallSubproject();
+ void slotInstallSuSubproject();
+ void slotCleanSubproject();
+ void slotManageBuildCommands();
+ void slotCustomBuildCommand( int );
+ void slotExpandTree();
+ void slotCollapseTree();
+};
+
+#endif
+
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/autotoolsaction.cpp b/buildtools/autotools/autotoolsaction.cpp
new file mode 100644
index 00000000..63b38762
--- /dev/null
+++ b/buildtools/autotools/autotoolsaction.cpp
@@ -0,0 +1,156 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+ * *
+ ***************************************************************************
+*/
+#include "autotoolsaction.h"
+
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+
+AutoToolsAction::~AutoToolsAction()
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const KShortcut& cut,
+ const QObject* receiver, const char* slot,
+ KActionCollection* parent, const char* name )
+: KAction( text, cut, receiver, slot, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ const QObject* receiver, const char* slot,
+ KActionCollection* parent, const char* name )
+: KAction( text, pix, cut, receiver, slot, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const QString& pix, const KShortcut& cut,
+ const QObject* receiver, const char* slot,
+ KActionCollection* parent, const char* name )
+: KAction( text, pix, cut, receiver, slot, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const KGuiItem& item, const KShortcut & cut,
+ const QObject* receiver, const char* slot,
+ KActionCollection* parent, const char* name )
+: KAction( item, cut, receiver, slot, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const KShortcut& cut,
+ QObject* parent, const char* name )
+: KAction( text, cut, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const KShortcut& cut,
+ const QObject* receiver, const char* slot,
+ QObject* parent, const char* name )
+: KAction( text, cut, receiver, slot, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const QIconSet& pix,
+ const KShortcut& cut, QObject* parent, const char* name )
+: KAction( text, pix, cut, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const QString& pix,
+ const KShortcut& cut, QObject* parent, const char* name )
+: KAction( text, pix, cut, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const QIconSet& pix,
+ const KShortcut& cut, const QObject* receiver,
+ const char* slot, QObject* parent, const char * name )
+: KAction( text, pix, cut, receiver, slot, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( const QString& text, const QString& pix,
+ const KShortcut & cut, const QObject* receiver,
+ const char* slot, QObject* parent, const char * name )
+: KAction( text, pix, cut, receiver, slot, parent, name )
+{
+}
+
+AutoToolsAction::AutoToolsAction( QObject * parent, const char * name )
+: KAction( parent, name )
+{
+}
+
+int AutoToolsAction::plug( QWidget* w, int index )
+{
+ if ( !w ) {
+ kdWarning(129) << "KAction::plug called with 0 argument\n";
+ return -1;
+ }
+
+ // Check if action is permitted
+ if (kapp && !kapp->authorizeKAction(name()))
+ return -1;
+
+ if ( ::qt_cast<QToolButton*>( w ) )
+ {
+ QToolButton* tb = static_cast<QToolButton*>( w );
+ connect( tb, SIGNAL( clicked() ), this, SLOT( activate() ) );
+ int id = getToolButtonID();
+
+ if ( !icon().isEmpty() )
+ tb->setPixmap( SmallIcon( icon() ) );
+ else
+ tb->setText( text() );
+
+ if ( !isEnabled() )
+ tb->setEnabled( false );
+
+ if ( !whatsThis().isEmpty() )
+ {
+ QWhatsThis::remove( tb );
+ QWhatsThis::add( tb, whatsThisWithIcon() );
+ }
+
+ if ( !toolTip().isEmpty() )
+ {
+ QToolTip::remove( tb );
+ QToolTip::add( tb, toolTip() );
+ }
+
+ addContainer( tb, id );
+
+ return containerCount() - 1;
+ }
+
+ return KAction::plug( w, index );
+}
+
+void AutoToolsAction::updateEnabled( int i )
+{
+ QWidget* w = container( i );
+
+ if ( ::qt_cast<QToolButton*>( w ) )
+ static_cast<QToolButton*>( w )->setEnabled( isEnabled() );
+ else
+ KAction::updateEnabled( i ) ;
+}
+
+
+
+//kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/autotoolsaction.h b/buildtools/autotools/autotoolsaction.h
new file mode 100644
index 00000000..97c8e79e
--- /dev/null
+++ b/buildtools/autotools/autotoolsaction.h
@@ -0,0 +1,70 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+* *
+***************************************************************************
+*/
+#ifndef AUTOTOOLSACTION_H
+#define AUTOTOOLSACTION_H
+
+#include <kxmlguiclient.h>
+#include <kaction.h>
+
+class QObject;
+class KActionCollection;
+
+/**
+ * A KAction derivative that will work with the QToolButtons used in
+ * the Automake Manager
+ * @author Matt Rogers
+ */
+class AutoToolsAction : public KAction
+{
+public:
+ virtual ~AutoToolsAction();
+
+ AutoToolsAction( const QString& text, const KShortcut& cut,
+ const QObject* receiver, const char* slot,
+ KActionCollection* parent, const char* name );
+
+ AutoToolsAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ const QObject* receiver, const char* slot,
+ KActionCollection* parent, const char* name );
+
+ AutoToolsAction( const QString& text, const QString& pix, const KShortcut& cut,
+ const QObject* receiver, const char* slot,
+ KActionCollection* parent, const char* name );
+
+ AutoToolsAction( const KGuiItem& item, const KShortcut& cut,
+ const QObject* receiver, const char* slot,
+ KActionCollection* parent, const char* name );
+
+ AutoToolsAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
+ AutoToolsAction( const QString& text, const KShortcut& cut,
+ const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
+ AutoToolsAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ QObject* parent = 0, const char* name = 0 );
+ AutoToolsAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
+ QObject* parent = 0, const char* name = 0 );
+ AutoToolsAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
+ AutoToolsAction( const QString& text, const QString& pix, const KShortcut& cut,
+ const QObject* receiver, const char* slot, QObject* parent,
+ const char* name = 0 );
+ AutoToolsAction( QObject* parent = 0, const char* name = 0 );
+
+ virtual int plug( QWidget *widget, int index = -1 );
+
+ virtual void updateEnabled( int i );
+};
+
+#endif
+
+//kate: indent-mode csands; tab-width 4; auto-insert-doxygen on;
diff --git a/buildtools/autotools/choosetargetdialog.cpp b/buildtools/autotools/choosetargetdialog.cpp
new file mode 100644
index 00000000..b35c5c75
--- /dev/null
+++ b/buildtools/autotools/choosetargetdialog.cpp
@@ -0,0 +1,348 @@
+/***************************************************************************
+ -------------------
+ begin : 29.11.2002
+ copyright : (C) 2002 by Victor Rder
+ email : victor_roeder@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "choosetargetdialog.h"
+
+#include <qcheckbox.h>
+#include <qwidget.h>
+#include <qgroupbox.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qptrlist.h>
+#include <qradiobutton.h>
+#include <qstringlist.h>
+#include <qfileinfo.h>
+
+#include <kcombobox.h>
+#include <kdialog.h>
+#include <kdebug.h>
+#include <klistview.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+#include <ksqueezedtextlabel.h>
+#include <kurl.h>
+
+#include "choosetargetdlgbase.h"
+#include "autodetailsview.h"
+#include "autolistviewitems.h"
+#include "autosubprojectview.h"
+#include "misc.h"
+#include "autoprojectwidget.h"
+#include "autoprojectpart.h"
+
+#include "kdevpartcontroller.h"
+
+class ChooseTargetDialog::Private
+{
+public:
+ AutoProjectWidget* widget;
+ AutoProjectPart* part;
+ QStringList fileList;
+ QPtrList<SubprojectItem> subprojectList;
+ SubprojectItem* chosenSubproject;
+ TargetItem* chosenTarget;
+ ChooseTargetDlgBase* baseUI;
+};
+
+ChooseTargetDialog::ChooseTargetDialog ( AutoProjectWidget* widget, AutoProjectPart* part,
+ QStringList fileList, QWidget* parent, const char* name )
+: KDialogBase( parent, name, false, i18n("Automake Manager - Choose Target"),
+ Ok | Cancel, KDialogBase::Ok, true /* seperator */ )
+
+{
+ Q_UNUSED( parent );
+ Q_UNUSED( name );
+ d = new ChooseTargetDialog::Private;
+ d->widget = widget;
+ d->part = part;
+ d->fileList = fileList;
+ d->subprojectList = widget->allSubprojectItems();
+ d->baseUI = new ChooseTargetDlgBase( this, "base ui" );
+ setMainWidget( d->baseUI );
+
+ d->baseUI->subprojectComboBox->setAutoCompletion( true );
+ d->baseUI->targetComboBox->setAutoCompletion( true );
+ d->baseUI->newFileList->header()->hide();
+ d->baseUI->newFileList->addColumn( QString::null );
+ d->baseUI->newFileList->setSorting(-1);
+
+ setIcon ( SmallIcon ( "target_kdevelop" ) );
+
+
+ QPtrListIterator<SubprojectItem> sit(d->subprojectList);
+ for ( ; (*sit); ++sit )
+ {
+ QPtrList<TargetItem> targetList = (*sit)->targets;
+ QPtrListIterator<TargetItem> targetIt(targetList);
+
+ // Only insert Subproject which have a "regular" target
+ for ( ; (*targetIt); ++targetIt )
+ {
+ QString titemPrimary = (*targetIt)->primary;
+ if ( titemPrimary == "PROGRAMS" || titemPrimary == "LIBRARIES" ||
+ titemPrimary == "LTLIBRARIES" || titemPrimary == "JAVA" )
+ {
+ d->baseUI->subprojectComboBox->insertItem ( SmallIcon ( "folder" ), (*sit)->subdir );
+ }
+ }
+ }
+
+ if ( d->widget->activeTarget() && d->widget->activeSubproject() )
+ {
+ d->chosenTarget = d->widget->activeTarget();
+ //kdDebug ( 9020 ) << "1) Chosen target is " << d->chosenTarget->name << endl;
+ d->chosenSubproject = widget->activeSubproject();
+ d->baseUI->chosenTargetLabel->setText( ( widget->activeSubproject()->path + "/<b>" +
+ d->widget->activeTarget()->name + "</b>" )
+ .mid( d->part->projectDirectory().length() + 1 ) );
+ d->baseUI->subprojectComboBox->setEnabled( false );
+ d->baseUI->targetComboBox->setEnabled( false );
+
+ d->baseUI->subprojectComboBox->setCurrentItem( widget->activeSubproject()->subdir );
+ slotSubprojectChanged( widget->activeSubproject()->subdir );
+ }
+ else
+ {
+ d->baseUI->activeTargetRadioButton->toggle();
+ d->baseUI->activeTargetRadioButton->setEnabled ( false );
+ d->baseUI->neverAskAgainCheckbox->setEnabled ( false );
+
+ slotSubprojectChanged ( d->baseUI->subprojectComboBox->text(0) );
+ }
+
+ QStringList::iterator it;
+ QString fileName;
+
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ int pos = ( *it ).findRev('/');
+ if (pos != -1)
+ fileName = ( *it ).mid(pos+1);
+ else
+ fileName = ( *it );
+
+
+ d->baseUI->newFileList->insertItem( new QListViewItem( d->baseUI->newFileList, fileName ) );
+ }
+
+ connect ( d->baseUI->subprojectComboBox, SIGNAL ( activated ( const QString& ) ),
+ this, SLOT( slotSubprojectChanged ( const QString& ) ) );
+ connect ( d->baseUI->targetComboBox, SIGNAL ( activated ( const QString& ) ),
+ this, SLOT( slotTargetChanged ( const QString& ) ) );
+}
+
+
+ChooseTargetDialog::~ChooseTargetDialog()
+{
+}
+
+void ChooseTargetDialog::slotSubprojectChanged ( const QString& name )
+{
+ d->chosenTarget = 0;
+ SubprojectItem* spitem = d->subprojectList.first();
+
+ for ( ; spitem; spitem = d->subprojectList.next() )
+ {
+ if ( spitem->subdir == name )
+ {
+ QPtrList <TargetItem> targetList = spitem->targets;
+ TargetItem* titem = targetList.first();
+
+ d->baseUI->targetComboBox->clear();
+
+/* choosenSubprojectLabel->setText ( ( spitem->path + "<b>" + ->name + "</b>" ).mid ( d->widget->projectDirectory().length() + 1 ) );*/
+
+ d->chosenSubproject = spitem;
+
+ for ( ; titem; titem = targetList.next() )
+ {
+ if ( titem->primary == "PROGRAMS" || titem->primary == "LIBRARIES" ||
+ titem->primary == "LTLIBRARIES" || titem->primary == "JAVA" )
+ {
+ d->baseUI->targetComboBox->insertItem ( SmallIcon ( "target_kdevelop" ), titem->name );
+
+ //d->baseUI->targetComboBox->addToHistory ( titem->name );
+
+ // if the Active Target is in the currently selected Subproject
+ if ( d->widget->activeTarget() &&
+ titem->name == d->widget->activeTarget()->name )
+ {
+ d->baseUI->targetComboBox->setCurrentItem( titem->name );
+ d->baseUI->chosenTargetLabel->setText( ( spitem->path + "/<b>" + titem->name + "</b>" ).mid( d->part->projectDirectory().length() + 1 ) );
+ d->chosenTarget = titem;
+ //kdDebug ( 9020 ) << "2) Chosen target is " << d->chosenTarget->name << endl;
+ }
+ else
+ {
+ //d->baseUI->targetComboBox->setCurrentItem ( 0 );
+ if ( !d->chosenTarget )
+ {
+ d->baseUI->chosenTargetLabel->setText( ( spitem->path + "/<b>" + titem->name + "</b>")
+ .mid( d->part->projectDirectory().length() + 1 ) );
+ //choosenSubprojectLabel->setText ( ( spitem->path + "<b>" + titem->name + "</b>" ).mid ( d->widget->projectDirectory().length() + 1 ) );
+
+ d->chosenTarget = titem;
+ }
+ //kdDebug ( 9020 ) << "2a) Chosen target is " << d->chosenTarget->name << endl;
+ }
+ }
+ }
+
+ break;
+ }
+ }
+}
+
+void ChooseTargetDialog::slotTargetChanged( const QString& name )
+{
+ d->baseUI->chosenTargetLabel->setText( ( d->chosenSubproject->path + "/<b>" + name + "</b>" )
+ .mid( d->part->projectDirectory().length() + 1 ) );
+
+ QPtrList <TargetItem> targetList = d->chosenSubproject->targets;
+ TargetItem* titem = targetList.first();
+
+ for ( ; titem; titem = targetList.next() )
+ {
+ if ( titem->name == name )
+ {
+ d->chosenTarget = titem;
+ //kdDebug ( 9020 ) << "4) Chosen target is " << d->chosenTarget->name << endl;
+
+ break;
+ }
+ }
+}
+
+void ChooseTargetDialog::slotOk()
+{
+ if ( d->baseUI->activeTargetRadioButton->isChecked() )
+ {
+ d->chosenTarget = d->widget->activeTarget();
+ d->chosenSubproject = d->widget->activeSubproject();
+ }
+ if ( !d->chosenSubproject || !d->chosenTarget )
+ return;
+
+ //kdDebug ( 9020 ) << "3) Chosen target is " << d->chosenTarget->name << endl;
+
+ QStringList newFileList;
+ QStringList::iterator it;
+ QString directory, fileName;
+
+ for ( it = d->fileList.begin(); it != d->fileList.end(); ++it )
+ {
+ bool found = false;
+
+ int pos = ( *it ).findRev('/');
+ if (pos != -1)
+ {
+ directory = ( *it ).left(pos);
+ fileName = ( *it ).mid(pos+1);
+ }
+ else
+ {
+ fileName = ( *it );
+ }
+
+ FileItem * fitem = d->chosenTarget->sources.first();
+ for ( ; fitem; fitem = d->chosenTarget->sources.next() )
+ {
+ if ( fitem->name == fileName )
+ {
+ KMessageBox::error ( this, i18n ( "The file %1 already exists in the chosen target.\nThe file will be created but will not be added to the target.\n"
+ "Rename the file and select 'Add Existing Files' from the Automake Manager." ).arg ( fitem->name ),
+ i18n ( "Error While Adding Files" ) );
+ found = true;
+ }
+ }
+
+ if ( !found )
+ {
+ /// \FIXME a quick hack to prevent adding header files to _SOURCES
+ /// and display them in noinst_HEADERS
+ if (AutoProjectPrivate::isHeader(fileName) &&
+ ( d->chosenTarget->primary == "PROGRAMS" || d->chosenTarget->primary == "LIBRARIES" || d->chosenTarget->primary == "LTLIBRARIES" ) )
+ {
+ kdDebug ( 9020 ) << "Ignoring header file and adding it to noinst_HEADERS: " << fileName << endl;
+ TargetItem* noinst_HEADERS_item = d->widget->getSubprojectView()->findNoinstHeaders(d->chosenSubproject);
+ FileItem *fitem = d->widget->createFileItem( fileName, d->chosenSubproject );
+ noinst_HEADERS_item->sources.append( fitem );
+ noinst_HEADERS_item->insertItem( fitem );
+
+ QString varname = "noinst_HEADERS";
+ d->chosenSubproject->variables[ varname ] += ( " " + fileName );
+
+ QMap<QString, QString> replaceMap;
+ replaceMap.insert( varname, d->chosenSubproject->variables[ varname ] );
+
+ AutoProjectTool::addToMakefileam( d->chosenSubproject->path + "/Makefile.am", replaceMap );
+ }
+ else
+ {
+ fitem = d->widget->createFileItem( fileName,d->chosenSubproject );
+ d->chosenTarget->sources.append( fitem );
+ d->chosenTarget->insertItem( fitem );
+
+ QString canontargetname = AutoProjectTool::canonicalize( d->chosenTarget->name );
+ QString varname = canontargetname + "_SOURCES";
+ d->chosenSubproject->variables[ varname ] += ( " " + fileName );
+
+ QMap<QString, QString> replaceMap;
+ replaceMap.insert( varname, d->chosenSubproject->variables[ varname ] );
+
+ AutoProjectTool::addToMakefileam( d->chosenSubproject->path + "/Makefile.am", replaceMap );
+ }
+ newFileList.append ( d->chosenSubproject->path.mid ( d->part->projectDirectory().length() + 1 ) + "/" + fileName );
+ }
+
+ if ( directory.isEmpty() || directory != d->chosenSubproject->subdir )
+ {
+ KShellProcess proc("/bin/sh");
+
+ proc << "mv";
+ proc << KShellProcess::quote( d->part->projectDirectory() + "/" + directory + "/" + fileName );
+ proc << KShellProcess::quote( d->chosenSubproject->path + "/" + fileName );
+ proc.start(KProcess::DontCare);
+ }
+
+ // why open the files?!
+// d->part->partController()->editDocument ( KURL ( d->chosenSubproject->path + "/" + fileName ) );
+
+ found = false;
+ }
+
+ d->widget->emitAddedFiles( newFileList );
+ KDialogBase::slotOk();
+}
+
+TargetItem* ChooseTargetDialog::chosenTarget()
+{
+ return d->chosenTarget;
+}
+
+SubprojectItem* ChooseTargetDialog::chosenSubproject()
+{
+ return d->chosenSubproject;
+}
+
+bool ChooseTargetDialog::alwaysUseActiveTarget() const
+{
+ return d->baseUI->neverAskAgainCheckbox->isChecked();
+}
+
+
+#include "choosetargetdialog.moc"
+//kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/choosetargetdialog.h b/buildtools/autotools/choosetargetdialog.h
new file mode 100644
index 00000000..44825ce5
--- /dev/null
+++ b/buildtools/autotools/choosetargetdialog.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ -------------------
+ begin : 29.11.2002
+ copyright : (C) 2002 by Victor Röder
+ email : victor_roeder@gmx.de
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _CHOOSETARGETDIALOG_H_
+#define _CHOOSETARGETDIALOG_H_
+
+#include <kdialogbase.h>
+
+class AutoProjectWidget;
+class AutoProjectPart;
+class SubprojectItem;
+class TargetItem;
+class QStringList;
+class QWidget;
+
+class ChooseTargetDialog : public KDialogBase
+{
+Q_OBJECT
+public:
+ ChooseTargetDialog( AutoProjectWidget* widget, AutoProjectPart* part,
+ QStringList fileList, QWidget* parent = 0,
+ const char* name = 0 );
+ ~ChooseTargetDialog();
+
+public:
+ TargetItem* chosenTarget();
+ SubprojectItem* chosenSubproject();
+
+ bool alwaysUseActiveTarget() const;
+
+public slots:
+ void slotSubprojectChanged ( const QString& );
+ void slotTargetChanged ( const QString& );
+
+protected:
+ virtual void slotOk();
+
+private:
+ class Private;
+ ChooseTargetDialog::Private* d;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/choosetargetdlgbase.ui b/buildtools/autotools/choosetargetdlgbase.ui
new file mode 100644
index 00000000..3581e595
--- /dev/null
+++ b/buildtools/autotools/choosetargetdlgbase.ui
@@ -0,0 +1,222 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ChooseTargetDlgBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ChooseTargetDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>444</width>
+ <height>306</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>444</width>
+ <height>306</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Automake Manager - Choose Target</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>activeTargetRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>Add new files to m&amp;y active target</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>chooseTargetRadioButton</cstring>
+ </property>
+ <property name="text">
+ <string>Choose &amp;another target</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>chosenTargetGroupBox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="title">
+ <string>Choose &amp;Target</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KHistoryCombo" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>subprojectComboBox</cstring>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KHistoryCombo" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>targetComboBox</cstring>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>targetStaticLabel</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Target:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>chosenTargetLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>[TARGET]</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>&amp;New Files</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView">
+ <property name="name">
+ <cstring>newFileList</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>cancelNoticeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;qt&gt;&lt;b&gt;Note:&lt;/b&gt; If you cancel, your files will be created but will &lt;b&gt;not&lt;/b&gt; be added to the project.&lt;/qt&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter</set>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>neverAskAgainCheckbox</cstring>
+ </property>
+ <property name="text">
+ <string>Do &amp;not ask me again and use always my active target</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>activeTargetRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>chosenTargetGroupBox</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>activeTargetRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>subprojectComboBox</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>activeTargetRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>targetComboBox</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>activeTargetRadioButton</tabstop>
+ <tabstop>chooseTargetRadioButton</tabstop>
+ <tabstop>subprojectComboBox</tabstop>
+ <tabstop>targetComboBox</tabstop>
+ <tabstop>newFileList</tabstop>
+ <tabstop>neverAskAgainCheckbox</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">slotActiveTargetToggled(bool)</slot>
+ <slot access="protected">slotChooseTargetToggled(bool)</slot>
+ <slot access="private">slotSubprojectChanged(const QString&amp;)</slot>
+ <slot access="private">slotTargetChanged(const QString&amp;)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/autotools/configureoptionswidget.cpp b/buildtools/autotools/configureoptionswidget.cpp
new file mode 100644
index 00000000..7e2db214
--- /dev/null
+++ b/buildtools/autotools/configureoptionswidget.cpp
@@ -0,0 +1,431 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "configureoptionswidget.h"
+
+#include <qcombobox.h>
+#include <qdir.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qtimer.h>
+#include <qvalidator.h>
+#include <klineedit.h>
+#include <kdebug.h>
+#include <kfiledialog.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kservice.h>
+#include <ktrader.h>
+
+#include "kdevcompileroptions.h"
+#include "autoprojectpart.h"
+#include "environmentvariableswidget.h"
+
+
+class ServiceComboBox
+{
+public:
+ static void insertStringList(QComboBox *combo, const QValueList<KService::Ptr> &list,
+ QStringList *names, QStringList *execs)
+ {
+ QValueList<KService::Ptr>::ConstIterator it;
+ for (it = list.begin(); it != list.end(); ++it) {
+ combo->insertItem((*it)->comment());
+ (*names) << (*it)->desktopEntryName();
+ (*execs) << (*it)->exec();
+ kdDebug(9020) << "insertStringList item " << (*it)->name() << "," << (*it)->exec() << endl;
+ }
+ }
+ static QString currentText(QComboBox *combo, const QStringList &names)
+ {
+ if (combo->currentItem() == -1)
+ return QString::null;
+ return names[combo->currentItem()];
+ }
+ static void setCurrentText(QComboBox *combo, const QString &str, const QStringList &names)
+ {
+ QStringList::ConstIterator it;
+ int i = 0;
+ for (it = names.begin(); it != names.end(); ++it) {
+ if (*it == str) {
+ combo->setCurrentItem(i);
+ break;
+ }
+ ++i;
+ }
+ }
+};
+
+
+ConfigureOptionsWidget::ConfigureOptionsWidget(AutoProjectPart *part, QWidget *parent, const char *name)
+ : ConfigureOptionsWidgetBase(parent, name)
+{
+ config_combo->setValidator(new QRegExpValidator(QRegExp("^\\D.*"), this));
+
+ m_part = part;
+ env_groupBox->setColumnLayout( 1, Qt::Vertical );
+ QDomDocument &dom = *part->projectDom();
+ m_environmentVariablesWidget = new EnvironmentVariablesWidget(dom, "/kdevautoproject/general/envvars", env_groupBox);
+
+ coffers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'C'");
+ cxxoffers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'C++'");
+ f77offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Fortran'");
+
+ ServiceComboBox::insertStringList(cservice_combo, coffers, &cservice_names, &cservice_execs);
+ ServiceComboBox::insertStringList(cxxservice_combo, cxxoffers, &cxxservice_names, &cxxservice_execs);
+ ServiceComboBox::insertStringList(f77service_combo, f77offers, &f77service_names, &f77service_execs);
+
+ if (coffers.isEmpty())
+ cflags_button->setEnabled(false);
+ if (cxxoffers.isEmpty())
+ cxxflags_button->setEnabled(false);
+ if (f77offers.isEmpty())
+ f77flags_button->setEnabled(false);
+
+ allConfigs = part->allBuildConfigs();
+ config_combo->insertStringList(allConfigs);
+
+ dirty = false;
+ currentConfig = QString::null;
+ configChanged(part->currentBuildConfig());
+
+ fixLayout();
+}
+
+
+ConfigureOptionsWidget::~ConfigureOptionsWidget()
+{}
+
+
+void ConfigureOptionsWidget::fixLayout()
+{
+ int w1 = ccompiler_label->sizeHint().width();
+ int w2 = cbinary_label->sizeHint().width();
+ int w3 = cflags_label->sizeHint().width();
+ int w4 = cxxcompiler_label->sizeHint().width();
+ int w5 = cxxbinary_label->sizeHint().width();
+ int w6 = cxxflags_label->sizeHint().width();
+ int w7 = f77compiler_label->sizeHint().width();
+ int w8 = f77binary_label->sizeHint().width();
+ int w9 = f77flags_label->sizeHint().width();
+
+ int w = QMAX(w1, QMAX(w2, w3));
+ w = QMAX(w, QMAX(w4, w5));
+ w = QMAX(w, QMAX(w6, w7));
+ w = QMAX(w, QMAX(w8, w9));
+
+ ccompiler_label->setMinimumWidth(w);
+ cxxcompiler_label->setMinimumWidth(w);
+ f77compiler_label->setMinimumWidth(w);
+}
+
+
+void ConfigureOptionsWidget::readSettings(const QString &config)
+{
+ QDomDocument dom = *m_part->projectDom();
+ QString prefix = "/kdevautoproject/configurations/" + config + "/";
+ kdDebug(9020) << "Reading config from " << prefix << endl;
+
+ configargs_edit->setText(DomUtil::readEntry(dom, prefix + "configargs"));
+ QString builddir = DomUtil::readEntry(dom, prefix + "builddir");
+ if (builddir.isEmpty() && config != "default")
+ builddir = config;
+ builddir_edit->setText(builddir);
+
+ topsourcedir_edit->setText(DomUtil::readEntry(dom, prefix + "topsourcedir"));
+
+ cppflags_edit->setText(DomUtil::readEntry(dom, prefix + "cppflags"));
+ ldflags_edit->setText(DomUtil::readEntry(dom, prefix + "ldflags"));
+
+ QString ccompiler = DomUtil::readEntry(dom, prefix + "ccompiler");
+ QString cxxcompiler = DomUtil::readEntry(dom, prefix + "cxxcompiler");
+ QString f77compiler = DomUtil::readEntry(dom, prefix + "f77compiler");
+
+ if (ccompiler.isEmpty()) {
+ kdDebug(9020) << "No c compiler set" << endl;
+ QValueList<KService::Ptr>::ConstIterator it;
+ for (it = coffers.begin(); it != coffers.end(); ++it) {
+ if ((*it)->property("X-KDevelop-Default").toBool()) {
+ kdDebug(9020) << "Found default " << (*it)->name() << endl;
+ ccompiler = (*it)->name();
+ break;
+ }
+ }
+ }
+ if (cxxcompiler.isEmpty()) {
+ kdDebug(9020) << "No cxx compiler set" << endl;
+ QValueList<KService::Ptr>::ConstIterator it;
+ for (it = cxxoffers.begin(); it != cxxoffers.end(); ++it) {
+ if ((*it)->property("X-KDevelop-Default").toBool()) {
+ kdDebug(9020) << "Found default " << (*it)->name() << endl;
+ cxxcompiler = (*it)->name();
+ break;
+ }
+ }
+ }
+ if (f77compiler.isEmpty()) {
+ kdDebug(9020) << "No c compiler set" << endl;
+ QValueList<KService::Ptr>::ConstIterator it;
+ for (it = f77offers.begin(); it != f77offers.end(); ++it) {
+ if ((*it)->property("X-KDevelop-Default").toBool()) {
+ kdDebug(9020) << "Found default " << (*it)->name() << endl;
+ f77compiler = (*it)->name();
+ break;
+ }
+ }
+ }
+
+ ServiceComboBox::setCurrentText(cservice_combo, ccompiler, cservice_names);
+ ServiceComboBox::setCurrentText(cxxservice_combo, cxxcompiler, cxxservice_names);
+ ServiceComboBox::setCurrentText(f77service_combo, f77compiler, f77service_names);
+
+ cbinary_edit->setText(DomUtil::readEntry(dom, prefix + "ccompilerbinary"));
+ cxxbinary_edit->setText(DomUtil::readEntry(dom, prefix + "cxxcompilerbinary"));
+ f77binary_edit->setText(DomUtil::readEntry(dom, prefix + "f77compilerbinary"));
+
+ cflags_edit->setText(DomUtil::readEntry(dom, prefix + "cflags"));
+ cxxflags_edit->setText(DomUtil::readEntry(dom, prefix + "cxxflags"));
+ f77flags_edit->setText(DomUtil::readEntry(dom, prefix + "f77flags"));
+
+ m_environmentVariablesWidget->readEnvironment(dom, prefix + "envvars");
+}
+
+
+void ConfigureOptionsWidget::saveSettings(const QString &config)
+{
+ m_environmentVariablesWidget->accept();
+ QDomDocument dom = *m_part->projectDom();
+ QString prefix = "/kdevautoproject/configurations/" + config + "/";
+ kdDebug(9020) << "Saving config under " << prefix << endl;
+
+ DomUtil::writeEntry(dom, prefix + "configargs", configargs_edit->text());
+ DomUtil::writeEntry(dom, prefix + "builddir", builddir_edit->text());
+ DomUtil::writeEntry(dom, prefix + "topsourcedir", topsourcedir_edit->text());
+
+ DomUtil::writeEntry(dom, prefix + "cppflags", cppflags_edit->text());
+ DomUtil::writeEntry(dom, prefix + "ldflags", ldflags_edit->text());
+
+ QFileInfo fi(m_part->buildDirectory());
+ QDir dir(fi.dir());
+ dir.mkdir(fi.fileName());
+
+ DomUtil::writeEntry(dom, prefix + "ccompiler",
+ ServiceComboBox::currentText(cservice_combo, cservice_names));
+ DomUtil::writeEntry(dom, prefix + "cxxcompiler",
+ ServiceComboBox::currentText(cxxservice_combo, cxxservice_names));
+ DomUtil::writeEntry(dom, prefix + "f77compiler",
+ ServiceComboBox::currentText(f77service_combo, f77service_names));
+
+ DomUtil::writeEntry(dom, prefix + "ccompilerbinary", cbinary_edit->text());
+ DomUtil::writeEntry(dom, prefix + "cxxcompilerbinary", cxxbinary_edit->text());
+ DomUtil::writeEntry(dom, prefix + "f77compilerbinary", f77binary_edit->text());
+
+ DomUtil::writeEntry(dom, prefix + "cflags", cflags_edit->text());
+ DomUtil::writeEntry(dom, prefix + "cxxflags", cxxflags_edit->text());
+ DomUtil::writeEntry(dom, prefix + "f77flags", f77flags_edit->text());
+
+ if (KMessageBox::questionYesNo(this, i18n("Re-run configure for %1 now?").arg(config), QString::null, i18n("Rerun"), i18n("Do Not Run")) == KMessageBox::Yes)
+ QTimer::singleShot(0, m_part, SLOT(slotConfigure()));
+
+}
+
+
+void ConfigureOptionsWidget::setDirty()
+{
+ kdDebug(9020) << "config dirty" << endl;
+ dirty = true;
+}
+
+
+void ConfigureOptionsWidget::builddirClicked()
+{
+ QString dir = builddir_edit->text();
+ dir = KFileDialog::getExistingDirectory(dir, this);
+ if (!dir.isNull())
+ builddir_edit->setText(dir);
+}
+
+void ConfigureOptionsWidget::topsourcedirClicked()
+{
+ QString dir = topsourcedir_edit->text();
+ dir = KFileDialog::getExistingDirectory(dir, this);
+ if (!dir.isNull())
+ topsourcedir_edit->setText(dir);
+}
+
+void ConfigureOptionsWidget::configComboTextChanged(const QString &config)
+{
+ bool canAdd = !allConfigs.contains(config) && !config.contains("/") && !config.isEmpty();
+ bool canRemove = allConfigs.contains(config) && config != "default";
+ addconfig_button->setEnabled(canAdd);
+ removeconfig_button->setEnabled(canRemove);
+}
+
+
+void ConfigureOptionsWidget::configChanged(const QString &config)
+{
+ if (config == currentConfig || !allConfigs.contains(config))
+ return;
+
+ if (!currentConfig.isNull() && dirty)
+ saveSettings(currentConfig);
+
+ currentConfig = config;
+ readSettings(config);
+ dirty = false;
+
+ config_combo->blockSignals(true);
+ config_combo->setEditText(config);
+ config_combo->blockSignals(false);
+}
+
+
+void ConfigureOptionsWidget::configAdded()
+{
+ QString config = config_combo->currentText();
+
+ allConfigs.append(config);
+
+ config_combo->clear();
+ config_combo->insertStringList(allConfigs);
+ configChanged(config);
+ setDirty(); // force saving
+}
+
+
+void ConfigureOptionsWidget::configRemoved()
+{
+ QString config = config_combo->currentText();
+
+ QDomDocument dom = *m_part->projectDom();
+ QDomNode node = dom.documentElement().namedItem("kdevautoproject").namedItem("configurations");
+ node.removeChild(node.namedItem(config));
+ allConfigs.remove(config);
+
+ config_combo->clear();
+ config_combo->insertStringList(allConfigs);
+
+ currentConfig = QString::null;
+ configChanged("default");
+}
+
+
+void ConfigureOptionsWidget::cserviceChanged()
+{
+ QString exec = ServiceComboBox::currentText(cservice_combo, cservice_execs);
+ cbinary_edit->setText(exec);
+ kdDebug(9020) << "exec: " << exec << endl;
+}
+
+
+void ConfigureOptionsWidget::cxxserviceChanged()
+{
+ QString exec = ServiceComboBox::currentText(cxxservice_combo, cxxservice_execs);
+ cxxbinary_edit->setText(exec);
+}
+
+
+void ConfigureOptionsWidget::f77serviceChanged()
+{
+ QString exec = ServiceComboBox::currentText(f77service_combo, f77service_execs);
+ f77binary_edit->setText(exec);
+ kdDebug(9020) << "exec: " << exec << endl;
+}
+
+
+void ConfigureOptionsWidget::cflagsClicked()
+{
+ QString name = ServiceComboBox::currentText(cservice_combo, cservice_names);
+ KDevCompilerOptions *plugin = createCompilerOptions(name);
+
+ if (plugin) {
+ QString flags = plugin->exec(this, cflags_edit->text());
+ cflags_edit->setText(flags);
+ delete plugin;
+ }
+}
+
+
+void ConfigureOptionsWidget::cxxflagsClicked()
+{
+ QString name = ServiceComboBox::currentText(cxxservice_combo, cxxservice_names);
+ KDevCompilerOptions *plugin = createCompilerOptions(name);
+
+ if (plugin) {
+ QString flags = plugin->exec(this, cxxflags_edit->text());
+ cxxflags_edit->setText(flags);
+ delete plugin;
+ }
+}
+
+
+void ConfigureOptionsWidget::f77flagsClicked()
+{
+ QString name = ServiceComboBox::currentText(f77service_combo, f77service_names);
+ KDevCompilerOptions *plugin = createCompilerOptions(name);
+
+ if (plugin) {
+ QString flags = plugin->exec(this, f77flags_edit->text());
+ f77flags_edit->setText(flags);
+ delete plugin;
+ }
+}
+
+
+KDevCompilerOptions *ConfigureOptionsWidget::createCompilerOptions(const QString &name)
+{
+ KService::Ptr service = KService::serviceByDesktopName(name);
+ if (!service) {
+ kdDebug(9020) << "Can't find service " << name;
+ return 0;
+ }
+
+ KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library()));
+ if (!factory) {
+ QString errorMessage = KLibLoader::self()->lastErrorMessage();
+ KMessageBox::error(0, i18n("There was an error loading the module %1.\n"
+ "The diagnostics is:\n%2").arg(service->name()).arg(errorMessage));
+ exit(1);
+ }
+
+ QStringList args;
+ QVariant prop = service->property("X-KDevelop-Args");
+ if (prop.isValid())
+ args = QStringList::split(" ", prop.toString());
+
+ QObject *obj = factory->create(this, service->name().latin1(),
+ "KDevCompilerOptions", args);
+
+ if (!obj->inherits("KDevCompilerOptions")) {
+ kdDebug(9020) << "Component does not inherit KDevCompilerOptions" << endl;
+ return 0;
+ }
+ KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj;
+
+ return dlg;
+}
+
+
+void ConfigureOptionsWidget::accept()
+{
+ DomUtil::writeEntry(*m_part->projectDom(), "/kdevautoproject/general/useconfiguration", currentConfig);
+ m_environmentVariablesWidget->accept();
+ if (dirty)
+ {
+ saveSettings(currentConfig);
+ }
+}
+
+#include "configureoptionswidget.moc"
diff --git a/buildtools/autotools/configureoptionswidget.h b/buildtools/autotools/configureoptionswidget.h
new file mode 100644
index 00000000..a973ce7d
--- /dev/null
+++ b/buildtools/autotools/configureoptionswidget.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+* Copyright (C) 2001-2002 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _CONFIGUREOPTIONSWIDGET_H_
+#define _CONFIGUREOPTIONSWIDGET_H_
+
+#include "configureoptionswidgetbase.h"
+
+#include <ktrader.h>
+#include "domutil.h"
+
+
+class KDevCompilerOptions;
+class AutoProjectPart;
+class EnvironmentVariablesWidget;
+
+class ConfigureOptionsWidget : public ConfigureOptionsWidgetBase
+{
+ Q_OBJECT
+
+public:
+ ConfigureOptionsWidget( AutoProjectPart *part, QWidget *parent = 0, const char *name = 0 );
+ ~ConfigureOptionsWidget();
+
+public slots:
+ void accept();
+
+private:
+ virtual void builddirClicked();
+ virtual void topsourcedirClicked();
+ virtual void setDirty();
+ virtual void configChanged( const QString &config );
+ virtual void configComboTextChanged( const QString &config );
+ virtual void configAdded();
+ virtual void configRemoved();
+ virtual void cflagsClicked();
+ virtual void cxxflagsClicked();
+ virtual void f77flagsClicked();
+ virtual void cserviceChanged();
+ virtual void cxxserviceChanged();
+ virtual void f77serviceChanged();
+
+ void fixLayout();
+ void readSettings( const QString &config );
+ void saveSettings( const QString &config );
+
+ KDevCompilerOptions *createCompilerOptions( const QString &lang );
+ KTrader::OfferList coffers, cxxoffers, f77offers;
+ QStringList cservice_names, cservice_execs;
+ QStringList cxxservice_names, cxxservice_execs;
+ QStringList f77service_names, f77service_execs;
+ QStringList allConfigs;
+ QString currentConfig;
+ bool dirty;
+
+ AutoProjectPart *m_part;
+ EnvironmentVariablesWidget* m_environmentVariablesWidget;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/configureoptionswidgetbase.ui b/buildtools/autotools/configureoptionswidgetbase.ui
new file mode 100644
index 00000000..0eb47ac7
--- /dev/null
+++ b/buildtools/autotools/configureoptionswidgetbase.ui
@@ -0,0 +1,1040 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ConfigureOptionsWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>configure_options_widget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>628</width>
+ <height>607</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Configure Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>config_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Configuration:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>config_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>config_combo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Different build profiles</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>profiles</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer17_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>8</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addconfig_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeconfig_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer18_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabwidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>general_tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;General</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="1" column="1" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>configargs_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Options to pass to configure, e.g. --prefix=&lt;install dir&gt;</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Options to pass to configure, e.g. --prefix=&lt;install dir&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>builddir_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Build directory (must be different for every different configuration):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>builddir_edit</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer23</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>
+ <widget class="QLabel" row="5" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>topsourcedir_label</cstring>
+ </property>
+ <property name="text">
+ <string>Top source &amp;directory:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>topsourcedir_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>builddir_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The build process will place the object
+files and binary in this directory.
+
+If the name does not have a leading /
+then it is relative to the project directory.
+(in the General page)
+
+The build process also checks here for
+a Makefile and a configure script.
+
+If you have imported a project and you were
+building in the project directory, you
+probably want this to be blank.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The build process will place the object
+files and binary in this directory.
+
+If the name does not have a leading /
+then it is relative to the project directory.
+(in the General page)
+
+The build process also checks here for
+a Makefile and a configure script.
+
+If you have imported a project and you were
+building in the project directory, you
+probably want this to be blank.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="4" column="4">
+ <property name="name">
+ <cstring>builddir_button</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>Spacer24</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>
+ <widget class="QPushButton" row="6" column="4">
+ <property name="name">
+ <cstring>topsourcedir_button</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="6" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>topsourcedir_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Where to start looking for the src files.
+If the name does not have a leading /
+then it is relative to the project directory.
+(in the General page)</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Where to start looking for the src files.
+If the name does not have a leading /
+then it is relative to the project directory.
+(in the General page)</string>
+ </property>
+ </widget>
+ <spacer row="6" column="0">
+ <property name="name">
+ <cstring>spacer17</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>
+ <widget class="QLabel" row="10" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>ldflags_label</cstring>
+ </property>
+ <property name="text">
+ <string>Li&amp;nker flags (LDFLAGS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>ldflags_edit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Linker flags, e.g. -L&lt;lib dir&gt; if you have libraries in a
+nonstandard directory &lt;lib dir&gt;</string>
+ </property>
+ </widget>
+ <spacer row="11" column="0">
+ <property name="name">
+ <cstring>spacer17_2_2</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>
+ <widget class="KLineEdit" row="11" column="1" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>ldflags_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Linker flags, e.g. -L&lt;lib dir&gt; if you have libraries in a
+nonstandard directory &lt;lib dir&gt;</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Linker flags, e.g. -L&lt;lib dir&gt; if you have libraries in a
+nonstandard directory &lt;lib dir&gt;</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="9" column="1" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>cppflags_edit</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>C/C++ preprocessor flags, e.g. -I&lt;include dir&gt; if you have
+headers in a nonstandard directory &lt;include dir&gt;</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>C/C++ preprocessor flags, e.g. -I&lt;include dir&gt; if you have
+headers in a nonstandard directory &lt;include dir&gt;</string>
+ </property>
+ </widget>
+ <spacer row="9" column="0">
+ <property name="name">
+ <cstring>spacer17_2</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>
+ <widget class="QLabel" row="8" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>cppflags_label</cstring>
+ </property>
+ <property name="text">
+ <string>C/C++ &amp;preprocessor flags (CPPFLAGS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cppflags_edit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>C/C++ preprocessor flags, e.g. -I&lt;include dir&gt; if you have
+headers in a nonstandard directory &lt;include dir&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>configargs_label</cstring>
+ </property>
+ <property name="text">
+ <string>Configure argu&amp;ments:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>configargs_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="12" column="0" rowspan="1" colspan="5">
+ <property name="name">
+ <cstring>env_groupBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Environment &amp;Variables</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>c_tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>C</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>ccompiler_label</cstring>
+ </property>
+ <property name="text">
+ <string>C com&amp;piler:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cservice_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cservice_combo</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>Spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>cflags_label</cstring>
+ </property>
+ <property name="text">
+ <string>Compiler f&amp;lags (CFLAGS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>cflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="4" column="2">
+ <property name="name">
+ <cstring>cflags_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <spacer row="5" column="1">
+ <property name="name">
+ <cstring>Spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>168</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>cbinary_label</cstring>
+ </property>
+ <property name="text">
+ <string>Compiler co&amp;mmand (CC):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cbinary_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>cbinary_edit</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer12</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>cxx_tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>C++</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>cxxcompiler_label</cstring>
+ </property>
+ <property name="text">
+ <string>C++ com&amp;piler:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cxxservice_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>cxxservice_combo</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>Spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>cxxbinary_label</cstring>
+ </property>
+ <property name="text">
+ <string>Compiler co&amp;mmand (CXX):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cxxbinary_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>cxxbinary_edit</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer13_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>cxxflags_label</cstring>
+ </property>
+ <property name="text">
+ <string>Compiler flags (C&amp;XXFLAGS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cxxflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>cxxflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="4" column="2">
+ <property name="name">
+ <cstring>cxxflags_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <spacer row="5" column="1">
+ <property name="name">
+ <cstring>Spacer16</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>fortran_tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>F&amp;ortran</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>f77compiler_label</cstring>
+ </property>
+ <property name="text">
+ <string>Fortra&amp;n compiler:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>f77service_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>f77service_combo</cstring>
+ </property>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>Spacer16_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>f77binary_label</cstring>
+ </property>
+ <property name="text">
+ <string>Compiler co&amp;mmand (F77):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>f77binary_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>f77binary_edit</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer17</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>f77flags_label</cstring>
+ </property>
+ <property name="text">
+ <string>Compiler f&amp;lags (FFLAGS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>f77flags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>f77flags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="4" column="2">
+ <property name="name">
+ <cstring>f77flags_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <spacer row="5" column="1">
+ <property name="name">
+ <cstring>Spacer18</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>cflags_button</sender>
+ <signal>clicked()</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>cflagsClicked()</slot>
+ </connection>
+ <connection>
+ <sender>f77flags_button</sender>
+ <signal>clicked()</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>f77flagsClicked()</slot>
+ </connection>
+ <connection>
+ <sender>cservice_combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>cserviceChanged()</slot>
+ </connection>
+ <connection>
+ <sender>f77service_combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>f77serviceChanged()</slot>
+ </connection>
+ <connection>
+ <sender>cxxflags_button</sender>
+ <signal>clicked()</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>cxxflagsClicked()</slot>
+ </connection>
+ <connection>
+ <sender>cxxservice_combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>cxxserviceChanged()</slot>
+ </connection>
+ <connection>
+ <sender>addconfig_button</sender>
+ <signal>clicked()</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>configAdded()</slot>
+ </connection>
+ <connection>
+ <sender>removeconfig_button</sender>
+ <signal>clicked()</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>configRemoved()</slot>
+ </connection>
+ <connection>
+ <sender>config_combo</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>configChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>config_combo</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>configComboTextChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>builddir_button</sender>
+ <signal>clicked()</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>builddirClicked()</slot>
+ </connection>
+ <connection>
+ <sender>configargs_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>builddir_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>cbinary_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>cflags_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>cxxbinary_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>cxxflags_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>f77binary_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>f77flags_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>topsourcedir_button</sender>
+ <signal>clicked()</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>topsourcedirClicked()</slot>
+ </connection>
+ <connection>
+ <sender>topsourcedir_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>cppflags_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+ <connection>
+ <sender>ldflags_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>configure_options_widget</receiver>
+ <slot>setDirty()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>configargs_edit</tabstop>
+ <tabstop>builddir_edit</tabstop>
+ <tabstop>builddir_button</tabstop>
+ <tabstop>topsourcedir_edit</tabstop>
+ <tabstop>topsourcedir_button</tabstop>
+ <tabstop>cppflags_edit</tabstop>
+ <tabstop>ldflags_edit</tabstop>
+ <tabstop>tabwidget</tabstop>
+ <tabstop>config_combo</tabstop>
+ <tabstop>addconfig_button</tabstop>
+ <tabstop>removeconfig_button</tabstop>
+ <tabstop>cservice_combo</tabstop>
+ <tabstop>cbinary_edit</tabstop>
+ <tabstop>cflags_edit</tabstop>
+ <tabstop>cflags_button</tabstop>
+ <tabstop>cxxservice_combo</tabstop>
+ <tabstop>cxxbinary_edit</tabstop>
+ <tabstop>cxxflags_edit</tabstop>
+ <tabstop>cxxflags_button</tabstop>
+ <tabstop>f77service_combo</tabstop>
+ <tabstop>f77binary_edit</tabstop>
+ <tabstop>f77flags_edit</tabstop>
+ <tabstop>f77flags_button</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">builddirClicked()</slot>
+ <slot access="protected">cflagsClicked()</slot>
+ <slot access="protected">configAdded()</slot>
+ <slot access="protected">configChanged(const QString&amp;)</slot>
+ <slot access="protected">configComboTextChanged(const QString&amp;)</slot>
+ <slot access="protected">configRemoved()</slot>
+ <slot access="protected">cserviceChanged()</slot>
+ <slot access="protected">cxxflagsClicked()</slot>
+ <slot access="protected">cxxserviceChanged()</slot>
+ <slot access="protected">f77flagsClicked()</slot>
+ <slot access="protected">f77serviceChanged()</slot>
+ <slot access="protected">setDirty()</slot>
+ <slot access="protected">topsourcedirClicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/autotools/fileselectorwidget.cpp b/buildtools/autotools/fileselectorwidget.cpp
new file mode 100644
index 00000000..65b87bf7
--- /dev/null
+++ b/buildtools/autotools/fileselectorwidget.cpp
@@ -0,0 +1,243 @@
+/****************************************************************************
+ * Copyright (C) 2001 by Hugo Varotto *
+ * hugo@varotto-usa.com *
+ * *
+ * Based on Kate's fileselector widget by *
+ * Matt Newell *
+ * (C) 2001 by Matt Newell *
+ * newellm@proaxis.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qstrlist.h>
+#include <qtooltip.h>
+#include <qregexp.h>
+
+#include <kxmlguiclient.h>
+#include <kiconloader.h>
+#include <kurlcombobox.h>
+#include <kurlcompletion.h>
+#include <kprotocolinfo.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kcombobox.h>
+
+#include <kdebug.h>
+
+#include "fileselectorwidget.h"
+#include <kdiroperator.h>
+#include <kcombiview.h>
+#include <kfilepreview.h>
+#include <kfileview.h>
+#include <kfileitem.h>
+#include <kimagefilepreview.h>
+
+#include "autoprojectwidget.h"
+#include "autoprojectpart.h"
+#include "kdevlanguagesupport.h"
+
+#include "kfilednddetailview.h"
+#include "kfiledndiconview.h"
+
+KDnDDirOperator::KDnDDirOperator ( const KURL &urlName, QWidget* parent, const char* name ) : KDirOperator ( urlName, parent, name )
+{
+
+}
+
+KFileView* KDnDDirOperator::createView( QWidget* parent, KFile::FileView view )
+{
+ KFileView* new_view = 0L;
+
+ if( (view & KFile::Detail) == KFile::Detail ) {
+ new_view = new KFileDnDDetailView( parent, "detail view");
+ }
+ else if ((view & KFile::Simple) == KFile::Simple ) {
+ new_view = new KFileDnDIconView( parent, "simple view");
+ new_view->setViewName( i18n("Short View") );
+ }
+
+ return new_view;
+}
+
+
+FileSelectorWidget::FileSelectorWidget(AutoProjectPart* part, KFile::Mode mode, QWidget* parent, const char* name ) : QWidget(parent, name)
+{
+ m_part = part;
+
+ // widgets and layout
+ QVBoxLayout* lo = new QVBoxLayout(this);
+
+ QHBox *hlow = new QHBox (this);
+ lo->addWidget(hlow);
+
+ home = new QPushButton( hlow );
+ home->setPixmap(SmallIcon("gohome"));
+ QToolTip::add(home, i18n("Home directory"));
+ up = new QPushButton( /*i18n("&Up"),*/ hlow );
+ up->setPixmap(SmallIcon("up"));
+ QToolTip::add(up, i18n("Up one level"));
+ back = new QPushButton( /*i18n("&Back"),*/ hlow );
+ back->setPixmap(SmallIcon("back"));
+ QToolTip::add(back, i18n("Previous directory"));
+ forward = new QPushButton( /*i18n("&Next"),*/ hlow );
+ forward->setPixmap(SmallIcon("forward"));
+ QToolTip::add(forward, i18n("Next directory"));
+
+ // HACK
+ QWidget* spacer = new QWidget(hlow);
+ hlow->setStretchFactor(spacer, 1);
+ hlow->setMaximumHeight(up->height());
+
+ cmbPath = new KURLComboBox( KURLComboBox::Directories, true, this, "path combo" );
+ cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
+ KURLCompletion* cmpl = new KURLCompletion();
+ cmbPath->setCompletionObject( cmpl );
+ lo->addWidget(cmbPath);
+
+ dir = new KDnDDirOperator(KURL(), this, "operator");
+ dir->setView(KFile::Simple);
+ dir->setMode(mode);
+
+ lo->addWidget(dir);
+ lo->setStretchFactor(dir, 2);
+
+ QHBox* filterBox = new QHBox(this);
+ filterIcon = new QLabel(filterBox);
+ filterIcon->setPixmap( BarIcon("filter") );
+ filter = new KHistoryCombo(filterBox, "filter");
+ filter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
+ filterBox->setStretchFactor(filter, 2);
+ lo->addWidget(filterBox);
+
+ // slots and signals
+ connect( filter, SIGNAL( textChanged(const QString&) ), SLOT( slotFilterChanged(const QString&) ) );
+ connect( filter, SIGNAL( activated(const QString&) ), SLOT( slotFilterChanged(const QString&) ) );
+ connect( filter, SIGNAL( returnPressed(const QString&) ), SLOT( filterReturnPressed(const QString&) ) );
+
+ connect( home, SIGNAL( clicked() ), dir, SLOT( home() ) );
+ connect( up, SIGNAL( clicked() ), dir, SLOT( cdUp() ) );
+ connect( back, SIGNAL( clicked() ), dir, SLOT( back() ) );
+ connect( forward, SIGNAL( clicked() ), dir, SLOT( forward() ) );
+
+ connect( cmbPath, SIGNAL( urlActivated( const KURL& )), this, SLOT( cmbPathActivated( const KURL& ) ));
+ //connect( cmbPath, SIGNAL( returnPressed( const QString& )), this, SLOT( cmbPathReturnPressed( const QString& ) ));
+ connect( dir, SIGNAL(urlEntered(const KURL&)), this, SLOT(dirUrlEntered(const KURL&)) );
+
+ connect( dir, SIGNAL(finishedLoading()), this, SLOT(dirFinishedLoading()) );
+
+// dirUrlEntered( dir->url() );
+
+ QStringList list;
+
+ /* read the file patterns from the project DOM */
+ QDomElement docEl = m_part->projectDom()->documentElement();
+ QDomElement fileviewEl = docEl.namedItem("kdevfileview").toElement();
+ QDomElement groupsEl = fileviewEl.namedItem("groups").toElement();
+ QDomElement groupEl = groupsEl.firstChild().toElement();
+
+ while ( !groupEl.isNull() )
+ {
+ if (groupEl.tagName() == "group")
+ {
+ list << groupEl.attribute("pattern").replace ( QRegExp ( ";" ), " " ) + " (" + groupEl.attribute("name") + ")";
+ }
+ groupEl = groupEl.nextSibling().toElement();
+ }
+
+ filter->setHistoryItems ( list );
+
+}
+
+
+FileSelectorWidget::~FileSelectorWidget()
+{
+}
+
+void FileSelectorWidget::dragEnterEvent ( QDragEnterEvent* /*ev*/ )
+{
+}
+
+void FileSelectorWidget::dropEvent ( QDropEvent* /*ev*/ )
+{
+ kdDebug ( 9020 ) << "Dropped" << endl;
+
+ QString path = "Something was dropped in the Destination directory file-selector";
+
+ emit dropped ( path );
+
+}
+
+void FileSelectorWidget::filterReturnPressed ( const QString& nf )
+{
+ // KURL u ( m_part->project()->projectDirectory() );
+ setDir ( nf );
+}
+
+void FileSelectorWidget::slotFilterChanged( const QString & nf )
+{
+ dir->setNameFilter( nf );
+ dir->updateDir();
+}
+
+void FileSelectorWidget::cmbPathActivated( const KURL& u )
+{
+ dir->setURL( u, true );
+}
+
+void FileSelectorWidget::cmbPathReturnPressed( const QString& u )
+{
+ dir->setFocus();
+ dir->setURL( KURL(u), true );
+}
+
+
+void FileSelectorWidget::dirUrlEntered( const KURL& u )
+{
+ cmbPath->removeURL( u );
+ QStringList urls = cmbPath->urls();
+ urls.prepend( u.url() );
+ while ( urls.count() >= (uint)cmbPath->maxItems() )
+ urls.remove( urls.last() );
+ cmbPath->setURLs( urls );
+}
+
+
+void FileSelectorWidget::dirFinishedLoading()
+{
+ // HACK - enable the nav buttons
+ // have to wait for diroperator...
+ up->setEnabled( dir->actionCollection()->action( "up" )->isEnabled() );
+ back->setEnabled( dir->actionCollection()->action( "back" )->isEnabled() );
+ forward->setEnabled( dir->actionCollection()->action( "forward" )->isEnabled() );
+ home->setEnabled( dir->actionCollection()->action( "home" )->isEnabled() );
+}
+
+
+void FileSelectorWidget::focusInEvent(QFocusEvent*)
+{
+ dir->setFocus();
+}
+
+void FileSelectorWidget::setDir( KURL u )
+{
+ dir->setURL(u, true);
+}
+
+void FileSelectorWidget::setDir(const QString& path)
+{
+ KURL u ( path );
+ dir->setURL ( u, true );
+}
+
+
+#include "fileselectorwidget.moc"
+
diff --git a/buildtools/autotools/fileselectorwidget.h b/buildtools/autotools/fileselectorwidget.h
new file mode 100644
index 00000000..7a981194
--- /dev/null
+++ b/buildtools/autotools/fileselectorwidget.h
@@ -0,0 +1,96 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _FILESELECTORWIDGET_H_
+#define _FILESELECTORWIDGET_H_
+
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qstrlist.h>
+#include <qtooltip.h>
+
+#include <klistview.h>
+#include <qvbox.h>
+#include <qwidget.h>
+#include <kfile.h>
+#include <kurlcombobox.h>
+#include <kurlcompletion.h>
+#include <kcombobox.h>
+#include <kprotocolinfo.h>
+
+#include <kfileview.h>
+#include <kfileitem.h>
+
+#include <kdiroperator.h>
+
+class AutoProjectPart;
+class SubprojectItem;
+class KFile;
+
+class KDnDDirOperator : public KDirOperator
+{
+ Q_OBJECT
+
+public:
+ KDnDDirOperator ( const KURL& urlName = KURL(), QWidget *parent = 0, const char* name = 0 );
+
+protected:
+ virtual KFileView* createView( QWidget* parent, KFile::FileView view );
+};
+
+class FileSelectorWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ FileSelectorWidget( AutoProjectPart* part, KFile::Mode, QWidget* parent = 0, const char* name = 0 );
+ ~FileSelectorWidget();
+
+ KDnDDirOperator * dirOperator()
+ {
+ return dir;
+ }
+
+public slots:
+ void slotFilterChanged( const QString& );
+ void setDir( KURL );
+ void setDir( const QString& );
+
+private slots:
+ void cmbPathActivated( const KURL& u );
+ void cmbPathReturnPressed( const QString& u );
+ void dirUrlEntered( const KURL& u );
+ void dirFinishedLoading();
+ void filterReturnPressed( const QString& nf );
+
+protected:
+ void focusInEvent( QFocusEvent* );
+ void dragEnterEvent ( QDragEnterEvent* ev );
+ void dropEvent ( QDropEvent* ev );
+
+private:
+ KURLComboBox *cmbPath;
+ KHistoryCombo * filter;
+ QLabel* filterIcon;
+ KDnDDirOperator * dir;
+ QPushButton *home, *up, *back, *forward;
+ AutoProjectPart* m_part;
+
+signals:
+ void dropped ( const QString& );
+
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
+
diff --git a/buildtools/autotools/kdevautoproject.desktop b/buildtools/autotools/kdevautoproject.desktop
new file mode 100644
index 00000000..bc366556
--- /dev/null
+++ b/buildtools/autotools/kdevautoproject.desktop
@@ -0,0 +1,97 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Automake Project
+Comment[br]=Raktres Automake
+Comment[ca]=Projecte Automake
+Comment[da]=Automake-projekt
+Comment[de]=Automake-Projekt fĂźr KDevelop
+Comment[el]=Έργο Automake
+Comment[es]=Proyecto de Automake
+Comment[et]=Automake'i project
+Comment[eu]=Automake proiektua
+Comment[fa]=پروژۀ Automake
+Comment[fr]=Projet avec Automake
+Comment[ga]=Comhad tionscadail Automake
+Comment[gl]=Proxecto Automake
+Comment[hi]=ऑटोमेक परियोजना
+Comment[hu]=Automake-projekt
+Comment[is]=Automake verkefni
+Comment[it]=Progetto per automake
+Comment[ja]=Automake プロジェクト
+Comment[ms]=Projek Automake
+Comment[nds]=Automake-Projekt
+Comment[ne]=स्वत: निर्माण परियोजना
+Comment[nl]=Automake-project
+Comment[pa]=ਆਟੋਮੈਕ ਪ੍ਰੋਜੈਕਟ
+Comment[pl]=Projekt: Automake
+Comment[pt]=Projecto Automake
+Comment[pt_BR]=Projeto Automake
+Comment[ru]=Проект Automake
+Comment[sk]=Automake projekt
+Comment[sl]=Projekt automake
+Comment[sr]=Automake пројекат
+Comment[sr@Latn]=Automake projekat
+Comment[sv]=Automake-projekt
+Comment[ta]=ஆட்டோமேக் பிராஜக்ட்
+Comment[tg]=Лоиҳаи Automake
+Comment[tr]=Automake Projesi
+Comment[uz]=Automake loyihasi
+Comment[uz@cyrillic]=Automake НОКиҳаси
+Comment[zh_CN]=Automake 工程
+Comment[zh_TW]=Automake 專楈
+Name=KDevAutoProject
+Name[da]=KDevelop Automake-projekt
+Name[de]=Automake-Projekt (KDevelop)
+Name[hi]=के-डेव-ऑटो-परियोजना
+Name[nds]=Automake-Projekt (KDevelop)
+Name[ne]=केडीई विकास स्वत: परियोजना
+Name[pl]=KDevProjektAuto
+Name[pt_BR]=KDevAutoProjeto
+Name[sk]=KDevAutoProjekt
+Name[sv]=KDevelop autoprojekt
+Name[ta]=கெடெவ்ஆட்டோ பிராஜக்ட்
+Name[tg]=Лоиҳаи KDevAuto
+Name[zh_TW]=KDevelop Automake 專楈
+GenericName=Automake Project
+GenericName[br]=Raktres Automake
+GenericName[ca]=Projecte Automake
+GenericName[da]=Automake-projekt
+GenericName[de]=Automake-Projekt
+GenericName[el]=Έργο Automake
+GenericName[es]=Proyecto de Automake
+GenericName[et]=Automake'i projekt
+GenericName[eu]=Automake proiektua
+GenericName[fa]=پروژۀ Automake
+GenericName[fr]=Projet avec Automake
+GenericName[ga]=Comhad tionscadail Automake
+GenericName[gl]=Proxecto Automake
+GenericName[hi]=ऑटोमेक परियोजना
+GenericName[hu]=Automake-projekt
+GenericName[it]=Progetto Automake
+GenericName[ja]=Automake プロジェクト
+GenericName[ms]=Projek Automake
+GenericName[nds]=Automake-Projekt
+GenericName[ne]=स्वत: निर्माण परियोजना
+GenericName[nl]=Automake-project
+GenericName[pl]=Projekt: Automake
+GenericName[pt]=Projecto de Automake
+GenericName[pt_BR]=Projeto Automake
+GenericName[ru]=Проект Automake
+GenericName[sk]=Automake projekt
+GenericName[sl]=Projekt automake
+GenericName[sr]=Automake пројекат
+GenericName[sr@Latn]=Automake projekat
+GenericName[sv]=Automake-projekt
+GenericName[ta]=ஆட்டோமேக் பிராஜக்ட்
+GenericName[tg]=Лоиҳаи Automake
+GenericName[tr]=Automake Projesi
+GenericName[uz]=Automake loyihasi
+GenericName[uz@cyrillic]=Automake НОКиҳаси
+GenericName[zh_CN]=Automake 工程
+GenericName[zh_TW]=Automake 專楈
+ServiceTypes=KDevelop/Project
+Icon=make
+X-KDE-Library=libkdevautoproject
+X-KDevelop-Version=5
+X-KDevelop-Args=
diff --git a/buildtools/autotools/kdevautoproject.rc b/buildtools/autotools/kdevautoproject.rc
new file mode 100644
index 00000000..89571c11
--- /dev/null
+++ b/buildtools/autotools/kdevautoproject.rc
@@ -0,0 +1,30 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevAutoProject" version="2">
+<MenuBar>
+ <Menu name="project" >
+ <Action name="project_addtranslation" />
+ <Action name="project_configuration" />
+ </Menu>
+ <Menu name="build" >
+ <Action name="build_build" />
+ <Action name="build_buildactivetarget" />
+ <Action name="build_compilefile" />
+ <Action name="build_configure" />
+ <Action name="build_makefilecvs" />
+ <Action name="build_install" />
+ <Action name="build_install_kdesu" />
+ <Separator/>
+ <Action name="build_clean" />
+ <Action name="build_distclean" />
+ <Action name="build_messages" />
+ <Separator/>
+ <Action name="build_execute" />
+ </Menu>
+</MenuBar>
+<ToolBar name="buildToolBar" noMerge="1">
+ <Action name="build_build" group="build_operations" />
+ <Action name="build_buildactivetarget" group="build_operations" />
+ <Action name="build_execute" group="build_operations" />
+</ToolBar>
+</kpartgui>
+
diff --git a/buildtools/autotools/kdevkdeautoproject.desktop b/buildtools/autotools/kdevkdeautoproject.desktop
new file mode 100644
index 00000000..235f3071
--- /dev/null
+++ b/buildtools/autotools/kdevkdeautoproject.desktop
@@ -0,0 +1,92 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=KDE Automake Project
+Comment[br]=Raktres KDE Automake
+Comment[ca]=Projecte Automake per al KDE
+Comment[da]=KDE Automake-projekt
+Comment[de]=KDE-Automake-Projekt fĂźr KDevelop
+Comment[el]=Έργο KDE Automake
+Comment[es]=Proyecto de Automake de KDE
+Comment[et]=KDE automake'i projekt
+Comment[eu]=KDE automake proiektua
+Comment[fa]=پروژۀ KDE Automake
+Comment[fr]=Projet Automake pour KDE
+Comment[ga]=Tionscadal Automake KDE
+Comment[gl]=Proxecto Automake de KDE
+Comment[hi]=केडीई ऑटोमेक परियोजना
+Comment[hu]=KDE Automake-projekt
+Comment[is]=KDE Automake verkefni
+Comment[it]=Progetto KDE per automake
+Comment[ja]=KDE Automake プロジェクト
+Comment[ms]=Projek Automake KDE
+Comment[nds]=Automake-Projekt vun KDE
+Comment[ne]=केडीई स्वत: निर्माण परियोजना
+Comment[nl]=KDE Automake-project
+Comment[pt]=Projecto Automake do KDE
+Comment[pt_BR]=Projeto Automake do KDE
+Comment[ru]=Проект KDE Automake
+Comment[sk]=KDE Automake projekt
+Comment[sl]=Projekt KDE Automake
+Comment[sr]=KDE-ов Automake пројекат
+Comment[sr@Latn]=KDE-ov Automake projekat
+Comment[sv]=KDE Automake-projekt
+Comment[ta]=KDE ஆட்டோமேக் பிராஜக்ட்
+Comment[tg]=Лоиҳаи KDE Automake
+Comment[tr]=KDE Automake Projesi
+Comment[zh_CN]=KDE Automake 工程
+Comment[zh_TW]=KDE Automake 專楈
+Name=KDevKDEAutoProject
+Name[da]=KDevelop KDE Automake-projekt
+Name[de]=KDE-Automake-Projekt (KDevelop)
+Name[hi]=के-डेव-केडीई-ऑटो-परियोजना
+Name[nds]=Automake-Projekt (KDE/KDevelop)
+Name[ne]=केडीई विकास केडीई स्वत: परियोजना
+Name[pl]=KDevProjektKDEAuto
+Name[pt_BR]=KDevKDEAutoProjeto
+Name[sk]=KDevAutoProjekt
+Name[sv]=KDevelop KDE-autoprojekt
+Name[ta]=கெடெவ்ஆட்டோ பிராஜக்ட்
+Name[tg]=Лоиҳаи худкори KDevKDEAuto
+Name[zh_TW]=KDevelop KDE Automake 專楈
+GenericName=KDE Automake Project
+GenericName[br]=Raktres KDE Automake
+GenericName[ca]=Projecte Automake per al KDE
+GenericName[cs]=KDE Automake projekt
+GenericName[da]=KDE Automake-projekt
+GenericName[de]=KDE-Automake-Projekt
+GenericName[el]=Έργο KDE Automake
+GenericName[es]=Proyecto de Automake de KDE
+GenericName[et]=KDE automake'i projekt
+GenericName[eu]=KDE automake proiektua
+GenericName[fa]=پروژۀ KDE Automake
+GenericName[fr]=Projet avec Automake pour KDE
+GenericName[ga]=Tionscadal Automake KDE
+GenericName[gl]=Proxecto Automake de KDE
+GenericName[hi]=केडीई ऑटोमेक परियोजना
+GenericName[hu]=KDE Automake-projekt
+GenericName[it]=Progetto KDE Automake
+GenericName[ja]=KDE Automake プロジェクト
+GenericName[ms]=Projek Automake KDE
+GenericName[nds]=Automake-Projekt vun KDE
+GenericName[ne]=केडीई स्वत: निर्माण परियोजना
+GenericName[nl]=KDE Automake-project
+GenericName[pl]=Projekt: KDE Automake
+GenericName[pt]=Projecto KDE com Automake
+GenericName[pt_BR]=Projeto Automake do KDE
+GenericName[ru]=Проект KDE Automake
+GenericName[sk]=KDE Automake projekt
+GenericName[sl]=Projekt KDE Automake
+GenericName[sr]=KDE-ов Automake пројекат
+GenericName[sr@Latn]=KDE-ov Automake projekat
+GenericName[sv]=KDE Automake-projekt
+GenericName[ta]=KDE ஆட்டோமேக் பிராஜக்ட்
+GenericName[tg]=Лоиҳаи KDE Automake
+GenericName[tr]=KDE Automake Projesi
+GenericName[zh_CN]=KDE Automake 工程
+GenericName[zh_TW]=KDE Automake 專楈
+ServiceTypes=KDevelop/Project
+Icon=make
+X-KDE-Library=libkdevautoproject
+X-KDevelop-Version=5
+X-KDevelop-Args=kde
diff --git a/buildtools/autotools/kfilednddetailview.cpp b/buildtools/autotools/kfilednddetailview.cpp
new file mode 100644
index 00000000..c75022fb
--- /dev/null
+++ b/buildtools/autotools/kfilednddetailview.cpp
@@ -0,0 +1,212 @@
+/***************************************************************************
+* kfilednddetailview.cpp - description
+* -------------------
+* begin : Wed Nov 1 2000
+* copyright : (C) 2000 by Bj�n Sahlstr�
+* email : kbjorn@users.sourceforge.net
+***************************************************************************/
+
+/***************************************************************************
+* *
+* 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. *
+* *
+***************************************************************************/
+
+//////////////////////////////////////////////////////
+// Qt specific includes
+#include <qptrlist.h>
+#include <qapplication.h>
+//////////////////////////////////////////////////////
+// KDE specific includes
+#include <kfileitem.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+//////////////////////////////////////////////////////
+// Application specific includes
+#include "kfilednddetailview.h"
+
+#ifndef AUTO_OPEN_TIME
+#define AUTO_OPEN_TIME
+ static int autoOpenTime = 750;
+#endif
+//-----------------------------------------------
+KFileDnDDetailView::KFileDnDDetailView(QWidget *parent, const char *name )
+ : KFileDetailView(parent,name), m_autoOpenTimer( this ),
+ m_autoOpenTime( autoOpenTime ), m_useAutoOpenTimer( true ),
+ m_dropItem(0), m_dndEnabled( true )
+{
+ setAutoUpdate( true );
+ setDnDEnabled( true );
+ useAutoOpenTimer( true );
+}
+//-----------------------------------------------
+KFileDnDDetailView::~KFileDnDDetailView(){
+}
+//-----------------------------------------------
+void KFileDnDDetailView::readConfig( KConfig* config, const QString& group ) {
+ KConfigGroupSaver cs( config, group );
+ bool dnd = config->readBoolEntry("DragAndDrop", true );
+ setDnDEnabled( dnd );
+ KFileDetailView::readConfig( config, group );
+}
+//-----------------------------------------------
+void KFileDnDDetailView::writeConfig( KConfig* config, const QString& group ) {
+ KConfigGroupSaver cs( config, group );
+ config->writeEntry("DragAndDrop", m_dndEnabled );
+ KFileDetailView::writeConfig( config, group );
+}
+//-----------------------------------------------
+void KFileDnDDetailView::slotOpenFolder(){
+ if( m_useAutoOpenTimer ) {
+ m_autoOpenTimer.stop();
+ if( !m_dropItem )
+ return;
+ }
+ KFileItemListIterator it( * KFileView::items() );
+ for( ; it.current() ;++it ){
+ if( (*it)->name() == m_dropItem->text(0) ) {
+ if( (*it)->isFile() )
+ return;
+ else if( (*it)->isDir() || (*it)->isLink()) {
+ sig->activate( (*it) );
+ return;
+ }
+ }
+ }
+}
+//-----------------------------------------------
+void KFileDnDDetailView::contentsDragEnterEvent( QDragEnterEvent *e ) {
+
+ kdDebug (9020) << "KFileDnDDetailView::contentsDragEnterEvent" << endl;
+
+ if ( ! acceptDrag( e ) ) {
+ e->accept( false );
+ return;
+ }
+ e->acceptAction();
+ QListViewItem *i = itemAt( contentsToViewport( e->pos() ) );
+ if ( i && m_useAutoOpenTimer ) {
+ m_dropItem = i;
+ m_autoOpenTimer.start( m_autoOpenTime );
+ }
+}
+//-----------------------------------------------
+void KFileDnDDetailView::contentsDragMoveEvent( QDragMoveEvent *e ) {
+
+ kdDebug (9020) << "KFileDnDDetailView::contentsDragMoveEvent" << endl;
+
+ if ( ! acceptDrag( e ) ) {
+ e->accept( false );
+ return;
+ }
+ e->acceptAction();
+ QListViewItem *i = itemAt( contentsToViewport( e->pos() ) );
+ if( ! m_useAutoOpenTimer )
+ return;
+ if ( i ) {
+ if ( i != m_dropItem ) {
+ m_autoOpenTimer.stop();
+ m_dropItem = i;
+ m_autoOpenTimer.start( m_autoOpenTime );
+ }
+ }
+ else
+ m_autoOpenTimer.stop();
+}
+//-----------------------------------------------
+void KFileDnDDetailView::contentsDragLeaveEvent( QDragLeaveEvent* ) {
+
+ kdDebug (9020) << "KFileDnDDetailView::contentsDragLeaveEvent" << endl;
+
+ if( m_useAutoOpenTimer ) {
+ m_autoOpenTimer.stop();
+ m_dropItem = 0L;
+ }
+}
+//-----------------------------------------------
+void KFileDnDDetailView::contentsDropEvent( QDropEvent* e ) {
+
+ kdDebug (9020) << "KFileDndDetailView::contentsDropEvent" << endl;
+
+ if( m_useAutoOpenTimer ) {
+ m_autoOpenTimer.stop();
+ m_dropItem = 0L;
+ }
+ if( ! acceptDrag( e ) ) {
+ e->acceptAction( false );
+ return;
+ }
+ e->acceptAction();
+ // the drop was accepted so lets emit this to the outside world
+ KURL::List urls;
+ KURLDrag::decode( e, urls );
+ emit dropped( e );
+ emit dropped( this, e );
+ emit dropped( this, urls );
+}
+//-----------------------------------------------
+void KFileDnDDetailView::startDrag(){
+
+ kdDebug (9020) << "KFileDnDDetailView::startDrag()" << endl;
+
+ // create a list of the URL:s that we want to drag
+ KURL::List urls;
+ KFileItemListIterator it( * KFileView::selectedItems() );
+ for ( ; it.current(); ++it ){
+ urls.append( (*it)->url() );
+ }
+ QPixmap pixmap;
+ if( urls.count() > 1 ){
+ pixmap = DesktopIcon( "kmultiple", 16 );
+ }
+ if( pixmap.isNull() )
+ pixmap = currentFileItem()->pixmap( 16 );
+ QPoint hotspot;
+ hotspot.setX( pixmap.width() / 2 );
+ hotspot.setY( pixmap.height() / 2 );
+ m_dragObject = KURLDrag::newDrag( urls, widget() );
+ m_dragObject->setPixmap( pixmap, hotspot );
+ m_dragObject->drag(); // start the drag
+}
+//-----------------------------------------------
+QDragObject* KFileDnDDetailView::dragObject() const {
+ return m_dragObject;
+}
+//-----------------------------------------------
+bool KFileDnDDetailView::acceptDrag(QDropEvent* e ) const {
+ return KURLDrag::canDecode( e ) &&
+ ( e->action() == QDropEvent::Copy
+ || e->action() == QDropEvent::Move
+ || e->action() == QDropEvent::Link );
+}
+//-----------------------------------------------
+void KFileDnDDetailView::setAutoOpenTime( const int& time ){
+ m_autoOpenTime = time;
+ useAutoOpenTimer();
+}
+//-----------------------------------------------
+void KFileDnDDetailView::useAutoOpenTimer( bool use ){
+ m_useAutoOpenTimer = use;
+ if( use )
+ connect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) );
+ else {
+ disconnect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) );
+ m_dropItem = 0L;
+ m_autoOpenTimer.stop();
+ }
+}
+//-----------------------------------------------
+void KFileDnDDetailView::setDnDEnabled( bool useDnD ){
+ m_dndEnabled = useDnD;
+ setDragEnabled( useDnD );
+ setDropVisualizer( useDnD );
+ setAcceptDrops( useDnD );
+ viewport()->setAcceptDrops( useDnD );
+}
+//-----------------------------------------------
+#ifndef NO_INCLUDE_MOCFILES
+#include "kfilednddetailview.moc"
+#endif
diff --git a/buildtools/autotools/kfilednddetailview.h b/buildtools/autotools/kfilednddetailview.h
new file mode 100644
index 00000000..ecb232c6
--- /dev/null
+++ b/buildtools/autotools/kfilednddetailview.h
@@ -0,0 +1,136 @@
+/***************************************************************************
+* kfilednddetailview.h - description
+* -------------------
+* begin : Wed Nov 1 2000
+* copyright : (C) 2000 by Björn Sahlström
+* email : kbjorn@users.sourceforge.net
+***************************************************************************/
+
+/***************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+**************************************************************************/
+
+#ifndef KFILEDNDDETAILVIEW_H
+#define KFILEDNDDETAILVIEW_H
+
+//////////////////////////////////////////////////////////////////////
+// Qt specific include files
+#include <qwidget.h>
+#include <qtimer.h>
+//////////////////////////////////////////////////////////////////////
+// KDE specific include files
+#include <kfiledetailview.h>
+#include <kurldrag.h>
+
+
+/**
+ *This is a fileview inherited from @ref KFileDetailView.
+ *It adds "drag and drop" handling to the view suitable for a @ref KFileDetailView.
+ * No special setup is needed, just connect to the @ref dropped signals
+ * and the view will take care of the rest.
+ *@short "Drag and drop" aware @ref KFileDetailView
+ *@author Björn Sahlström
+ */
+
+class KFileDnDDetailView : public KFileDetailView
+{
+ Q_OBJECT
+public:
+ /** */
+ KFileDnDDetailView( QWidget *parent = 0, const char *name = 0 );
+ /** */
+ virtual ~KFileDnDDetailView();
+ /**
+ * Set this to true if Drag'n drop should be enabled or not, default is enabled
+ */
+ void setDnDEnabled( bool );
+ /**
+ * @returns wether DnD is enabled or not.
+ */
+ bool isDnDEnabled() const
+ {
+ return m_dndEnabled;
+ }
+ /**
+ *Sets the auto open time, which means the time that will
+ *elapse before a directory is automatically opened after entered by DnD.
+ *Only need to call this if you want to change the predefined time that is 750 ms.
+ *This also calls @ref #useAutoOpenTimer so no need to call this to.
+ */
+ void setAutoOpenTime( const int& time );
+ /**
+ *Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false.
+ *By default this is turned ON.
+ */
+ void useAutoOpenTimer( bool on = true );
+ /**
+ *@returns true if auto open functionallity is turned ON (default), otherwhise false
+ *@see #useAutoOpenTimer
+ *@see #setAutoOpenTime
+ */
+ bool isAutoOpening() const
+ {
+ return m_useAutoOpenTimer;
+ }
+ /** */
+ virtual void readConfig( KConfig*, const QString& group = QString::null );
+ /** */
+ virtual void writeConfig( KConfig*, const QString& group = QString::null );
+signals: // Signals
+ /**
+ * Emitted whenever an decodable item is dropped in the view.
+ * Note: The @ref QDropEvent contains a @ref KURLDrag object.
+ */
+ void dropped( QDropEvent* );
+ /**
+ * Emitted whenever an decodable item is dropped in the view
+ * Note: The @ref QDropEvent contains a @ref KURLDrag object.
+ */
+ void dropped( KFileView*, QDropEvent* );
+ /**
+ * Emitted whenever an decodable item is dropped in the view.
+ *@param urls contains a list of all dropped @ref KURL
+ */
+ void dropped( KFileView*, KURL::List& urls );
+protected slots: // Protected slots
+ /**
+ * Called when the auto timer times out. Open the current folder.
+ */
+ void slotOpenFolder();
+protected: //Protected Methods
+ /** */
+ virtual void contentsDragEnterEvent( QDragEnterEvent *e );
+ /** */
+ virtual void contentsDragMoveEvent( QDragMoveEvent *e );
+ /** */
+ virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
+ /** */
+ virtual void contentsDropEvent( QDropEvent* e );
+ /**
+ * Create dragobject encoding the current selection and starts the drag
+ */
+ virtual void startDrag();
+ /**
+ * @returns the dragObject
+ */
+ virtual QDragObject* dragObject() const;
+ /**
+ * @returns true if we can decode the drag and support the action
+ */
+ virtual bool acceptDrag( QDropEvent* event ) const;
+protected: // Private attributes
+ QTimer m_autoOpenTimer;
+ int m_autoOpenTime;
+ bool m_useAutoOpenTimer;
+ QListViewItem* m_dropItem;
+ KURLDrag* m_dragObject;
+ bool m_dndEnabled;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/kfiledndiconview.cpp b/buildtools/autotools/kfiledndiconview.cpp
new file mode 100644
index 00000000..47bb32a9
--- /dev/null
+++ b/buildtools/autotools/kfiledndiconview.cpp
@@ -0,0 +1,194 @@
+/***************************************************************************
+* kfiledndiconview.cpp - description
+* -------------------
+* begin : Wed Nov 1 2000
+* copyright : (C) 2000 by Björn Sahlström
+* email : kbjorn@users.sourceforge.net
+***************************************************************************/
+
+/***************************************************************************
+* *
+* 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. *
+* *
+***************************************************************************/
+
+//////////////////////////////////////////////////////
+// Qt specific includes
+#include <qptrlist.h>
+#include <qapplication.h>
+//////////////////////////////////////////////////////
+// KDE specific includes
+#include <kfileitem.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+//////////////////////////////////////////////////////
+// Application specific includes
+#include "kfiledndiconview.h"
+
+#ifndef AUTO_OPEN_TIME
+#define AUTO_OPEN_TIME
+ static int autoOpenTime = 750;
+#endif
+//-----------------------------------------------
+KFileDnDIconView::KFileDnDIconView( QWidget *parent, const char *name )
+ : KFileIconView(parent,name), m_autoOpenTimer( this ),
+ m_autoOpenTime( autoOpenTime ), m_useAutoOpenTimer( true ),
+ m_dropItem(0), m_dndEnabled( true )
+{
+ setDnDEnabled( true );
+ setAutoUpdate( true );
+ useAutoOpenTimer( true );
+}
+//-----------------------------------------------
+KFileDnDIconView::~KFileDnDIconView(){
+}
+//-----------------------------------------------
+void KFileDnDIconView::readConfig( KConfig* config, const QString& group ) {
+ KConfigGroupSaver cs( config, group );
+ bool dnd = config->readBoolEntry("EnableDND", true );
+ setDnDEnabled( dnd );
+ KFileIconView::readConfig( config, group );
+}
+//-----------------------------------------------
+void KFileDnDIconView::writeConfig( KConfig* config, const QString& group ) {
+ KConfigGroupSaver cs( config, group );
+ config->writeEntry("EnableDND", m_dndEnabled );
+ KFileIconView::writeConfig( config, group );
+}
+//-----------------------------------------------
+void KFileDnDIconView::slotOpenFolder(){
+ if( m_useAutoOpenTimer ) {
+ m_autoOpenTimer.stop();
+ if( !m_dropItem )
+ return;
+ }
+ KFileItemListIterator it( * KFileView::items() );
+ for( ; it.current() ;++it ){
+ if( (*it)->name() == m_dropItem->text() ) {
+ if( (*it)->isFile() )
+ return;
+ else if( (*it)->isDir() || (*it)->isLink()) {
+ sig->activate( (*it) );
+ return;
+ }
+ }
+ }
+}
+//-----------------------------------------------
+void KFileDnDIconView::contentsDragEnterEvent( QDragEnterEvent *e ) {
+ if ( ! acceptDrag( e ) ) { // can we decode this ?
+ e->accept( false ); // No
+ return;
+ }
+ e->acceptAction(); // Yes
+ QIconViewItem *i = findItem( contentsToViewport( e->pos() ) );
+ if ( i && m_useAutoOpenTimer) { // are we over an item ?
+ m_dropItem = i; // set new m_dropItem
+ m_autoOpenTimer.start( m_autoOpenTime ); // restart timer
+ }
+}
+//-----------------------------------------------
+void KFileDnDIconView::contentsDragMoveEvent( QDragMoveEvent *e ) {
+ if ( ! acceptDrag( e ) ) { // can we decode this ?
+ e->accept( false ); // No
+ return;
+ }
+ e->acceptAction(); // Yes
+ QIconViewItem *i = findItem( contentsToViewport( e->pos() ) );
+ if( ! m_useAutoOpenTimer )
+ return;
+ if ( i ) { // are we over an item ?
+ if ( i != m_dropItem ) { // if so, is it a new one ?
+ m_autoOpenTimer.stop(); // stop timer
+ m_dropItem = i; // set new m_dropItem
+ m_autoOpenTimer.start( m_autoOpenTime ); // restart timer
+ }
+ }
+ else
+ m_autoOpenTimer.stop(); // stop timer
+}
+//-----------------------------------------------
+void KFileDnDIconView::contentsDragLeaveEvent( QDragLeaveEvent* ) {
+ if( m_useAutoOpenTimer ) {
+ m_autoOpenTimer.stop();
+ m_dropItem = 0L;
+ }
+}
+//-----------------------------------------------
+void KFileDnDIconView::contentsDropEvent( QDropEvent* e ) {
+ if( m_useAutoOpenTimer ) {
+ m_autoOpenTimer.stop();
+ m_dropItem = 0L;
+ }
+ if( ! acceptDrag( e ) ) {
+ e->acceptAction( false );
+ return;
+ }
+ e->acceptAction();
+ // the drop was accepted so lets emit this
+ KURL::List urls;
+ KURLDrag::decode( e, urls );
+ emit dropped( e );
+}
+//-----------------------------------------------
+void KFileDnDIconView::startDrag(){
+ if ( ! currentItem() ) // is there any selected items ?
+ return; // nope
+ dragObject()->dragCopy(); // start the drag
+}
+//-----------------------------------------------
+QDragObject* KFileDnDIconView::dragObject() {
+ // create a list of the URL:s that we want to drag
+ KURL::List urls;
+ KFileItemListIterator it( * KFileView::selectedItems() );
+ for ( ; it.current(); ++it ){
+ urls.append( (*it)->url() );
+ }
+ QPixmap pixmap;
+ if( urls.count() > 1 )
+ pixmap = DesktopIcon( "kmultiple", iconSize() );
+ if( pixmap.isNull() )
+ pixmap = currentFileItem()->pixmap( iconSize() );
+ QPoint hotspot;
+ hotspot.setX( pixmap.width() / 2 );
+ hotspot.setY( pixmap.height() / 2 );
+ QDragObject* myDragObject = KURLDrag::newDrag( urls, widget() );
+ myDragObject->setPixmap( pixmap, hotspot );
+ return myDragObject;
+}
+//-----------------------------------------------
+void KFileDnDIconView::setAutoOpenTime( const int& time ){
+ m_autoOpenTime = time;
+ useAutoOpenTimer();
+}
+//-----------------------------------------------
+void KFileDnDIconView::useAutoOpenTimer( bool use ){
+ m_useAutoOpenTimer = use;
+ if ( use )
+ connect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) );
+ else {
+ disconnect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) );
+ m_dropItem = 0L;
+ m_autoOpenTimer.stop();
+ }
+}
+//-----------------------------------------------
+void KFileDnDIconView::setDnDEnabled( bool useDnD ){
+ m_dndEnabled = useDnD;
+ setAcceptDrops( useDnD );
+ viewport()->setAcceptDrops( useDnD );
+}
+//-----------------------------------------------
+bool KFileDnDIconView::acceptDrag(QDropEvent* e ) const {
+ return KURLDrag::canDecode( e ) &&
+ ( e->action() == QDropEvent::Copy
+ || e->action() == QDropEvent::Move
+ || e->action() == QDropEvent::Link );
+}
+//-----------------------------------------------
+#ifndef NO_INCLUDE_MOCFILES
+#include "kfiledndiconview.moc"
+#endif
diff --git a/buildtools/autotools/kfiledndiconview.h b/buildtools/autotools/kfiledndiconview.h
new file mode 100644
index 00000000..65edd91a
--- /dev/null
+++ b/buildtools/autotools/kfiledndiconview.h
@@ -0,0 +1,128 @@
+/**************************************************************************
+* kfiledndiconview.h - description
+* -------------------
+* begin : Wed Nov 1 2000
+* copyright : (C) 2000 by Björn Sahlström
+* email : kbjorn@users.sourceforge.net
+***************************************************************************/
+
+/***************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+**************************************************************************/
+
+#ifndef KFILEDNDICONVIEW_H
+#define KFILEDNDICONVIEW_H
+
+#include <qwidget.h>
+#include <qtimer.h>
+#include <kfileiconview.h>
+#include <kurldrag.h>
+
+/**
+ * This is a fileview inherited from @ref KFileIconView.
+ * It adds "drag and drop" suitable for a @ref KFileIconView
+ * No special setup is needed, just connect to the @ref dropped signals
+ * and the view will take care of the rest.
+ * @short Drag and drop" aware @ref KFileIconView
+ * @author Björn Sahlström
+*/
+
+class KFileDnDIconView : public KFileIconView
+{
+ Q_OBJECT
+public: // Public methods
+
+ KFileDnDIconView( QWidget *parent = 0, const char *name = 0 );
+ virtual ~KFileDnDIconView();
+
+ /**
+ * Set if Drag'n drop should be enabled or not, default is enabled.
+ */
+ void setDnDEnabled( bool );
+
+ /**
+ * @returns wether DnD is enabled or not.
+ */
+ bool isDnDEnabled() const
+ {
+ return m_dndEnabled;
+ }
+
+ /**
+ * Sets the auto open time, which means the time that will
+ * elapse before a directory is automatically opened after entered by DnD.
+ * Only need to call this if you want to change the predefined time that is 750 ms.
+ * This also calls @ref #useAutoOpenTimer so no need to call this to.
+ */
+ void setAutoOpenTime( const int& time );
+
+ /**
+ * Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false.
+ * By default this is turned ON.
+ */
+ void useAutoOpenTimer( bool on = true );
+
+ /**
+ * @returns true if auto open functionallity is turned ON (default), otherwhise false
+ * @see #useAutoOpenTimer
+ * @see #setAutoOpenTime
+ */
+ bool isAutoOpening() const
+ {
+ return m_useAutoOpenTimer;
+ }
+
+ virtual void readConfig( KConfig*, const QString& group = QString::null );
+ virtual void writeConfig( KConfig*, const QString& group = QString::null );
+signals:
+
+ /**
+ * Emitted whenever an decodable item is dropped in the view.
+ * Note: The @ref QDropEvent contains a @ref KURLDrag object.
+ */
+ void dropped( QDropEvent* );
+
+protected slots:
+ /**
+ * Called when the auto timer times out. Open the current folder.
+ */
+ void slotOpenFolder();
+
+protected:
+ virtual void contentsDragEnterEvent( QDragEnterEvent *e );
+ virtual void contentsDragMoveEvent( QDragMoveEvent *e );
+ virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
+ virtual void contentsDropEvent( QDropEvent* e );
+
+ /**
+ * Creates a @ref QDragObject containing all urls of the selected @ref KFileItem of the view,
+ * @returns the @ref QDragObject
+ */
+ virtual QDragObject* dragObject();
+
+ /**
+ *Creates the drag item and starts the drag
+ */
+ virtual void startDrag();
+
+ /**
+ *@returns true if we can decode the drag and support the action
+ */
+ virtual bool acceptDrag( QDropEvent* event ) const;
+
+protected:
+
+ QTimer m_autoOpenTimer;
+ int m_autoOpenTime;
+ bool m_useAutoOpenTimer;
+ QIconViewItem* m_dropItem;
+ bool m_dndEnabled;
+};
+#endif
+// kate: indent-mode csands; tab-width 4; auto-insert-doxygen on;
+
diff --git a/buildtools/autotools/kimporticonview.cpp b/buildtools/autotools/kimporticonview.cpp
new file mode 100644
index 00000000..9b64d3ee
--- /dev/null
+++ b/buildtools/autotools/kimporticonview.cpp
@@ -0,0 +1,87 @@
+/***************************************************************************
+ -------------------
+ begin : 19.01.2003
+ copyright : (C) 2002 by Victor Röder
+ email : victor_roeder@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qfontmetrics.h>
+#include <qpainter.h>
+#include <qrect.h>
+#include <qwidget.h>
+
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kwordwrap.h>
+
+#include "kimporticonview.h"
+
+
+KImportIconView::KImportIconView(const QString& strIntro, QWidget *parent, const char *name)
+ : KFileDnDIconView(parent, name)
+{
+ m_strIntro = strIntro;
+ m_bDropped = false;
+
+ setAcceptDrops ( true );
+}
+
+
+KImportIconView::~KImportIconView()
+{
+}
+
+void KImportIconView::drawContents ( QPainter *p, int cx, int cy, int cw, int ch )
+{
+ if ( !m_bDropped)
+ {
+ QIconView::drawContents ( p, cx, cy, cw, ch );
+
+ p->save();
+ QFont font ( p->font() );
+ font.setBold ( true );
+ font.setFamily ( "Helvetica [Adobe]" );
+ font.setPointSize ( 10 );
+ p->setFont ( font );
+ p->setPen ( QPen ( KGlobalSettings::highlightColor() ) );
+
+ QRect rect = frameRect();
+ QFontMetrics fm ( p->font() );
+ rect.setLeft ( rect.left() + 30 );
+ rect.setRight ( rect.right() - 30 );
+
+ resizeContents ( contentsWidth(), contentsHeight() );
+
+ // word-wrap the string
+ KWordWrap* wordWrap1 = KWordWrap::formatText( fm, rect, AlignHCenter | WordBreak, m_strIntro );
+ KWordWrap* wordWrap2 = KWordWrap::formatText( fm, rect, AlignHCenter | WordBreak, i18n("Or just use the buttons.") );
+
+ QRect introRect1 = wordWrap1->boundingRect();
+ QRect introRect2 = wordWrap2->boundingRect();
+
+ wordWrap1->drawText ( p, ( ( frameRect().right() - introRect1.right() ) / 2 ), ( ( frameRect().bottom() - introRect1.bottom() ) / 2 ) - 20, AlignHCenter | AlignVCenter );
+ wordWrap2->drawText ( p, ( ( frameRect().right() - introRect2.right() ) / 2 ), ( ( frameRect().bottom() - introRect2.bottom() ) / 2 ) + introRect1.bottom(), AlignHCenter | AlignVCenter );
+
+ p->restore();
+ }
+ else
+ {
+ QIconView::drawContents ( p, cx, cy, cw, ch );
+ }
+}
+
+void KImportIconView::somethingDropped ( bool dropped )
+{
+ m_bDropped = dropped;
+}
+
+#include "kimporticonview.moc"
diff --git a/buildtools/autotools/kimporticonview.h b/buildtools/autotools/kimporticonview.h
new file mode 100644
index 00000000..100fc33e
--- /dev/null
+++ b/buildtools/autotools/kimporticonview.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ -------------------
+ begin : 19.01.2003
+ copyright : (C) 2002 by Victor Röder
+ email : victor_roeder@gmx.de
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KIMPORTICONVIEW_H
+#define KIMPORTICONVIEW_H
+
+#include <qwidget.h>
+
+#include "kfiledndiconview.h"
+
+class KImportIconView : public KFileDnDIconView
+{
+ Q_OBJECT
+
+public:
+ KImportIconView( const QString& strIntro, QWidget *parent, const char *name );
+ virtual ~KImportIconView();
+
+ void somethingDropped ( bool dropped );
+
+protected:
+ void drawContents ( QPainter *p, int cx, int cy, int cw, int ch );
+
+private:
+ QString m_strIntro;
+ bool m_bDropped;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
+
diff --git a/buildtools/autotools/makefilehandler.cpp b/buildtools/autotools/makefilehandler.cpp
new file mode 100644
index 00000000..03ad5277
--- /dev/null
+++ b/buildtools/autotools/makefilehandler.cpp
@@ -0,0 +1,166 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+* *
+***************************************************************************
+*/
+
+#include <qdir.h>
+#include <qglobal.h>
+#include <qmap.h>
+#include <qregexp.h>
+#include <qstring.h>
+#include <qvaluelist.h>
+
+#include <kdebug.h>
+
+#include <autotoolsast.h>
+#include <autotoolsdriver.h>
+
+#include "makefilehandler.h"
+
+typedef QValueList<AutoTools::AST*> ASTList;
+
+class MakefileHandler::Private
+{
+public:
+ QMap<QString, AutoTools::ProjectAST*> projects;
+ QMap<QString, QString> folderToFileMap;
+};
+
+MakefileHandler::MakefileHandler()
+{
+ d = new MakefileHandler::Private;
+}
+
+MakefileHandler::~MakefileHandler()
+{
+ delete d;
+}
+
+void MakefileHandler::parse( const QString& folder, bool recursive )
+{
+ //look for either Makefile.am.in, Makefile.am, or Makefile.in, in that order
+ AutoTools::ProjectAST* ast;
+ int ret = -1;
+ QString filePath = folder + "/Makefile.am.in";
+ if ( QFile::exists( filePath ) )
+ ret = AutoTools::Driver::parseFile( filePath, &ast );
+ else
+ {
+ filePath = folder + "/Makefile.am";
+ if ( QFile::exists( filePath ) )
+ ret = AutoTools::Driver::parseFile( filePath, &ast );
+ else
+ {
+ filePath = folder + "/Makefile.in";
+ if ( QFile::exists( filePath ) )
+ ret = AutoTools::Driver::parseFile( filePath, &ast );
+ else
+ kdDebug(9020) << k_funcinfo << "no appropriate file to parse in "
+ << folder << endl;
+ }
+ }
+
+ if ( ret != 0 )
+ {
+ return;
+ }
+
+ kdDebug(9020) << k_funcinfo << filePath << " was parsed correctly. Adding information" << endl;
+ Q_ASSERT( ast != 0 );
+ d->projects[filePath] = ast;
+ d->folderToFileMap[folder] = filePath;
+
+ if ( recursive && ast && ast->hasChildren() )
+ {
+ QValueList<AutoTools::AST*> astChildList = ast->children();
+ QValueList<AutoTools::AST*>::iterator it(astChildList.begin()), clEnd(astChildList.end());
+ for ( ; it != clEnd; ++it )
+ {
+ if ( (*it)->nodeType() == AutoTools::AST::AssignmentAST )
+ {
+ AutoTools::AssignmentAST* assignment = static_cast<AutoTools::AssignmentAST*>( (*it) );
+ if ( assignment->scopedID == "SUBDIRS" )
+ {
+ QString list = assignment->values.join( QString::null );
+ list.simplifyWhiteSpace();
+ kdDebug(9020) << k_funcinfo << "subdirs is " << list << endl;
+ QStringList subdirList = QStringList::split( " ", list );
+ QStringList::iterator vit = subdirList.begin();
+ for ( ; vit != subdirList.end(); ++vit )
+ {
+ QString realDir = ( *vit );
+ if ( realDir.startsWith( "\\" ) )
+ realDir.remove( 0, 1 );
+
+ realDir = realDir.stripWhiteSpace();
+ if ( realDir != "." && realDir != ".." && !realDir.isEmpty() )
+ {
+ if ( isVariable( realDir ) )
+ {
+ kdDebug(9020) << k_funcinfo << "'" << realDir << "' is a variable" << endl;
+ realDir = resolveVariable( realDir, ast );
+ }
+
+ kdDebug(9020) << k_funcinfo << "Beginning parsing of '" << realDir << "'" << endl;
+ parse( folder + '/' + realDir, recursive );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+AutoTools::ProjectAST* MakefileHandler::astForFolder( const QString& folderPath )
+{
+ if ( d->folderToFileMap.contains( folderPath ) )
+ {
+ QString filePath = d->folderToFileMap[folderPath];
+ return d->projects[filePath];
+ }
+ else
+ return 0;
+}
+
+bool MakefileHandler::isVariable( const QString& item ) const
+{
+ if ( item.contains( QRegExp( "(\\$\\([a-zA-Z0-9_-]*\\)|@[a-zA-Z0-9_-]*@)" ) ) )
+ return true;
+ else
+ return false;
+}
+
+QString MakefileHandler::resolveVariable( const QString& variable, AutoTools::ProjectAST* ast )
+{
+ if ( !ast )
+ return variable;
+
+ kdDebug(9020) << k_funcinfo << "attempting to resolve '" << variable << "'"<< endl;
+ ASTList childList = ast->children();
+ ASTList::iterator it( childList.begin() ), clEnd( childList.end() );
+ for ( ; it != clEnd; ++it )
+ {
+ if ( ( *it )->nodeType() == AutoTools::AST::AssignmentAST )
+ {
+ AutoTools::AssignmentAST* assignment = static_cast<AutoTools::AssignmentAST*>( ( *it ) );
+ if ( variable.find( assignment->scopedID ) != -1 )
+ {
+ kdDebug(9020) << k_funcinfo << "Resolving variable '" << variable << "' to '"
+ << assignment->values.join( QString::null ).stripWhiteSpace() << "'" << endl;
+ return assignment->values.join( QString::null ).stripWhiteSpace();
+ }
+ }
+ }
+
+ return variable;
+}
+//kate: space-indent on; indent-width 4;
diff --git a/buildtools/autotools/makefilehandler.h b/buildtools/autotools/makefilehandler.h
new file mode 100644
index 00000000..77045fe9
--- /dev/null
+++ b/buildtools/autotools/makefilehandler.h
@@ -0,0 +1,76 @@
+/*
+ KDevelop Autotools Support
+ Copyright (c) 2005 by Matt Rogers <mattr@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. *
+* *
+***************************************************************************
+*/
+#ifndef MAKEFILEHANDLER_H
+#define MAKEFILEHANDLER_H
+
+/**
+ * This class is responsible for taking the data from the Makefile.am parser
+ * and providing various data list view items can use in the automake manager
+ * widget
+ * @author Matt Rogers
+ */
+namespace AutoTools {
+class ProjectAST;
+}
+
+class MakefileHandler
+{
+public:
+ MakefileHandler();
+ ~MakefileHandler();
+
+ /**
+ * Parse a folder that has supported makefiles in it. The following files
+ * will be looked for in the following order:
+ * \li Makefile.am.in
+ * \li Makefile.am
+ * \li Makefile.in
+ *
+ * \param folder, the folder to parse
+ * \param recursive if true, subfolders will be parsed - defaults to true
+ */
+ void parse( const QString& folder, bool recursive = true );
+
+ /**
+ * Get the AST for a certain path
+ * \param folderPath the path of the folder to get an AST for
+ * \return the AST that represents a particular folder
+ */
+ AutoTools::ProjectAST* astForFolder( const QString& folderPath );
+
+ /**
+ * Check if a string is an automake variable
+ * \return true if it is an automake variable, false otherwise
+ */
+ bool isVariable( const QString& item ) const;
+
+ /**
+ * Find the value for the variable specified by \p variable
+ * \param variable The name of the variable to look for
+ * \param ast the AST to use to look for the variable in
+ * \return the value to substitute for the variable
+ */
+ QString resolveVariable( const QString& variable,
+ AutoTools::ProjectAST* ast );
+
+
+private:
+ class Private;
+ Private* d;
+};
+
+#endif
+
+//kate: space-indent on; indent-width 4;
+
diff --git a/buildtools/autotools/managecustomcommand.cpp b/buildtools/autotools/managecustomcommand.cpp
new file mode 100644
index 00000000..7d111965
--- /dev/null
+++ b/buildtools/autotools/managecustomcommand.cpp
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo <adymo@kdevelop.org> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * This 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 Library 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 "managecustomcommand.h"
+
+#include <qtable.h>
+
+#include <klocale.h>
+
+ManageCustomCommand::ManageCustomCommand(QWidget *parent, const char *name)
+ :ManageCustomBuildCommandsBase(parent, name)
+{
+}
+
+void ManageCustomCommand::addButton_clicked()
+{
+ commandsTable->setNumRows(commandsTable->numRows() + 1);
+ setRowProperties(commandsTable->numRows()-1);
+}
+
+void ManageCustomCommand::removeButton_clicked()
+{
+ commandsTable->removeRow(commandsTable->currentRow());
+}
+
+void ManageCustomCommand::setRowProperties(int row)
+{
+ commandsTable->setItem(row, 2,
+ new QComboTableItem(commandsTable, QStringList::split(",",
+ i18n("this is a list of items in the combobox",
+ "Make target,Make target (as root),Make command,Make command (as root),Command,Command (as root)"))));
+}
+
+#include "managecustomcommand.moc"
diff --git a/buildtools/autotools/managecustomcommand.h b/buildtools/autotools/managecustomcommand.h
new file mode 100644
index 00000000..cda5e54a
--- /dev/null
+++ b/buildtools/autotools/managecustomcommand.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+* Copyright (C) 2004 by Alexander Dymo <adymo@kdevelop.org> *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU Library General Public License as *
+* published by the Free Software Foundation; either version 2 of the *
+* License, or (at your option) any later version. *
+* *
+* This 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 Library 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 MANAGECUSTOMCOMMAND_H
+#define MANAGECUSTOMCOMMAND_H
+
+#include "managecustomcommandsbase.h"
+
+class ManageCustomCommand: public ManageCustomBuildCommandsBase
+{
+ Q_OBJECT
+public:
+ ManageCustomCommand( QWidget *parent = 0, const char *name = 0 );
+
+ void setRowProperties( int row );
+public slots:
+ virtual void addButton_clicked();
+ virtual void removeButton_clicked();
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/managecustomcommandsbase.ui b/buildtools/autotools/managecustomcommandsbase.ui
new file mode 100644
index 00000000..43164ef5
--- /dev/null
+++ b/buildtools/autotools/managecustomcommandsbase.ui
@@ -0,0 +1,125 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ManageCustomBuildCommandsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ManageCustomBuildCommandsBase</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>435</width>
+ <height>218</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>addButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>removeButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ <widget class="QTable" row="0" column="0" rowspan="3" colspan="1">
+ <column>
+ <property name="text">
+ <string>Menu Text</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Command</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Command Type</string>
+ </property>
+ <property name="pixmap">
+ <pixmap></pixmap>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>commandsTable</cstring>
+ </property>
+ <property name="numRows">
+ <number>0</number>
+ </property>
+ <property name="numCols">
+ <number>3</number>
+ </property>
+ <property name="rowMovingEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>SingleRow</enum>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>addButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ManageCustomBuildCommandsBase</receiver>
+ <slot>addButton_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>removeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ManageCustomBuildCommandsBase</receiver>
+ <slot>removeButton_clicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>commandsTable</tabstop>
+ <tabstop>addButton</tabstop>
+ <tabstop>removeButton</tabstop>
+</tabstops>
+<slots>
+ <slot>addButton_clicked()</slot>
+ <slot>removeButton_clicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/buildtools/autotools/misc.cpp b/buildtools/autotools/misc.cpp
new file mode 100644
index 00000000..97c449e7
--- /dev/null
+++ b/buildtools/autotools/misc.cpp
@@ -0,0 +1,999 @@
+/***************************************************************************
+* Copyright (C) 2001-2002 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#include <qdir.h>
+#include <qfile.h>
+#include <qregexp.h>
+#include <qtextstream.h>
+#include <qdict.h>
+
+#include <kdebug.h>
+#include <kparts/componentfactory.h>
+#include <kservice.h>
+
+#include "misc.h"
+
+#include "kdevcompileroptions.h"
+
+
+static KDevCompilerOptions *createCompilerOptions( const QString &name, QObject *parent )
+{
+ KService::Ptr service = KService::serviceByDesktopName( name );
+ if ( !service )
+ {
+ kdDebug( 9020 ) << "Can't find service " << name << endl;
+ return 0;
+ }
+
+
+ KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library()));
+ if (!factory) {
+ QString errorMessage = KLibLoader::self()->lastErrorMessage();
+ kdDebug(9020) << "There was an error loading the module " << service->name() << endl <<
+ "The diagnostics is:" << endl << errorMessage << endl;
+ exit(1);
+ }
+
+ QStringList args;
+ QVariant prop = service->property("X-KDevelop-Args");
+ if (prop.isValid())
+ args = QStringList::split(" ", prop.toString());
+
+ QObject *obj = factory->create(parent, service->name().latin1(),
+ "KDevCompilerOptions", args);
+
+ if (!obj->inherits("KDevCompilerOptions")) {
+ kdDebug(9020) << "Component does not inherit KDevCompilerOptions" << endl;
+ return 0;
+ }
+ KDevCompilerOptions *dlg = (KDevCompilerOptions*) obj;
+
+ return dlg;
+
+/*
+ QStringList args;
+ QVariant prop = service->property( "X-KDevelop-Args" );
+ if ( prop.isValid() )
+ args = QStringList::split( " ", prop.toString() );
+
+ return KParts::ComponentFactory
+ ::createInstanceFromService<KDevCompilerOptions>( service, parent,
+ service->name().latin1(), args );*/
+}
+
+
+QString AutoProjectTool::execFlagsDialog( const QString &compiler, const QString &flags, QWidget *parent )
+{
+ KDevCompilerOptions * plugin = createCompilerOptions( compiler, parent );
+
+ if ( plugin )
+ {
+ QString newflags = plugin->exec( parent, flags );
+ delete plugin;
+ return newflags;
+ }
+ return QString::null;
+}
+
+
+QString AutoProjectTool::canonicalize( const QString &str )
+{
+ QString res;
+ for ( uint i = 0; i < str.length(); ++i )
+ res += ( str[ i ].isLetterOrNumber() || str[ i ] == '@' ) ? str[ i ] : QChar( '_' );
+
+ kdDebug(9020) << k_funcinfo << "normalized '" << str << "' to '" << res << "'" << endl;
+ return res;
+}
+
+
+/**
+ * Read the Makefile.am and return a map of all the variables.
+ * Will take notice of backslash and += constructs.
+ * @param fileName
+ * @param variables
+ */
+void AutoProjectTool::parseMakefileam(const QString &fileName, QMap<QString, QString> *variables)
+{
+ QFile f(fileName);
+ if (!f.open(IO_ReadOnly))
+ {
+ return ;
+ }
+ QTextStream stream(&f);
+
+ QRegExp re("^(#kdevelop:[ \t]*)?([A-Za-z][@A-Za-z0-9_]*)[ \t]*([:\\+]?=)[ \t]*(.*)$");
+
+ QString last;
+ bool multiLine = false;
+ while (!stream.atEnd())
+ {
+ QString s = stream.readLine().stripWhiteSpace();
+ if (re.exactMatch(s))
+ {
+ QString lhs = re.cap(2);
+ QString rhs = re.cap(4);
+ if (rhs[ rhs.length() - 1 ] == '\\')
+ {
+ multiLine = true;
+ last = lhs;
+ rhs[rhs.length() - 1] = ' ';
+ }
+
+ // The need for stripWhiteSpace seems to be a Qt bug.
+ // make our list nice and neat.
+ QStringList bits = QStringList::split(" ", rhs);
+ rhs = bits.join(" ");
+ if (re.cap(3) == "+=")
+ {
+ ((*variables)[lhs] += ' ') += rhs;
+ }
+ else
+ {
+ variables->insert(lhs, rhs);
+ }
+ }
+ else if (multiLine)
+ {
+ if (s[s.length()-1] == '\\')
+ {
+ s[s.length()-1] = ' ';
+ }
+ else
+ {
+ multiLine = false;
+ }
+ QStringList bits = QStringList::split(" ", s);
+ ((*variables)[last] += ' ') += bits.join(" ");
+ }
+ }
+ f.close();
+
+ QMap<QString, QString> list;
+
+ for (QMap<QString, QString>::iterator iter = variables->begin();iter != variables->end();iter++)
+ {
+ QStringList items = QStringList::split(" ", iter.data());
+ QMap<QString, QString> unique;
+ for (uint i = 0;i < items.size();i++)
+ {
+ unique.insert(items[i], "");
+ }
+ QString line;
+ for (QMap<QString, QString>::iterator it = unique.begin();it != unique.end();it++)
+ {
+ line += it.key() + ' ';
+ }
+ if (line.length() > 1)
+ {
+ line.setLength(line.length() - 1);
+ }
+
+ list.insert(iter.key(), line);
+ }
+ *variables = list;
+}
+
+/**
+ * Add entries to a variable. Will just add the variables to the existing line, removing duplicates
+ * Will preserve += constructs and make sure that the variable only has one copy of the value across
+ * all += constructs
+ * @param fileName
+ * @param variables key=value string of entries to add
+ */
+void AutoProjectTool::addToMakefileam(const QString &fileName, QMap<QString, QString> variables)
+{
+ AutoProjectTool::addRemoveMakefileam(fileName, variables, true);
+}
+
+/**
+ * Set entries to a variable. Will set the variables to the existing line, removing duplicates
+ * Will preserve += constructs and make sure that the variable only has one copy of the value across
+ * all += constructs
+ * Adds line if it does not exist.
+ * @param fileName
+ * @param variables key=value string of entries to add
+ */
+void AutoProjectTool::setMakefileam ( const QString &fileName, QMap<QString, QString> variables )
+{
+ for ( QMap<QString, QString>::Iterator it0 = variables.begin(); it0 != variables.end(); ++it0 )
+ {
+ kdDebug ( 9020 ) << "key (set): " << it0.key() << "=" << it0.data() << endl;
+ }
+
+ // input file reading
+ QFile fin ( fileName );
+ if ( !fin.open ( IO_ReadOnly ) )
+ {
+ return ;
+ }
+ QTextStream ins ( &fin );
+
+ // output file writing.
+ QFile fout ( fileName + "#" );
+ if ( !fout.open ( IO_WriteOnly ) )
+ {
+ fin.close();
+ return ;
+ }
+ QTextStream outs ( &fout );
+
+ // variables
+ QRegExp re ( "^(#kdevelop:[ \t]*)?([A-Za-z][@A-Za-z0-9_]*)[ \t]*([:\\+]?=)[ \t]*(.*)$" );
+
+ bool multiLine = false;
+ QString lastLhs;
+ QMap<QString, QString> seenLhs;
+ while ( !fin.atEnd() )
+ {
+ QString s = ins.readLine();
+ if ( re.exactMatch ( s ) )
+ {
+ QString lhs = re.cap ( 2 );
+ bool notFound = ( variables.find ( lhs ) == variables.end() );
+
+ if ( notFound )
+ {
+ if ( seenLhs.find ( lhs ) == seenLhs.end() )
+ {
+ // not interested in this line at all
+ // write it out as is..
+ outs << s << endl;
+ }
+ // we have seen this variable, but since we are setting the
+ // whole line - we skip this as it will be a += line.
+ }
+ else
+ {
+ // we are interested in this line..
+ QString rhs = re.cap ( 4 ).stripWhiteSpace();
+ if ( rhs[ rhs.length() - 1 ] == '\\' )
+ {
+ // save it for when we have the whole line..
+ multiLine = true;
+ lastLhs = lhs;
+ }
+ else
+ {
+ // deal with it now - a single line
+ // we are adding our interested values to this line and writing it
+ // now write the line out if it is not going to be empty.
+ QString newLine ( lhs );
+ newLine += " = ";
+ bool added = false;
+ int len = newLine.length();
+ QStringList variableList = QStringList::split ( ' ', variables[lhs] );
+ for ( uint count = 0; count < variableList.size(); count++ )
+ {
+ len += variableList[count].length() + 1;
+ if ( len > 80 )
+ {
+ newLine += "\\\n\t";
+ len = 8;
+ }
+ newLine += variableList[count];
+ newLine += ' ';
+ added = true;
+
+ }
+ // only print it out if there was a value to add..
+ if ( added )
+ {
+ newLine.setLength ( newLine.length() - 1 );
+ outs << newLine << endl;
+ }
+ seenLhs[lhs] = "done";
+ variables.erase ( lhs );
+ }
+ }
+ }
+ else if ( multiLine )
+ {
+ s = s.stripWhiteSpace();
+ // we are only here if were interested in this line..
+ if ( s[s.length()-1] == '\\' )
+ {
+ s.setLength ( s.length() - 1 );
+ // still more multi line we wait for..
+ }
+ else
+ {
+ // end of the multi line..
+ multiLine = false;
+ }
+
+ if ( !multiLine )
+ {
+ // we are adding our interested values to this line and writing it
+ // now write the line out if it is not going to be empty.
+ QString newLine ( lastLhs );
+ newLine += " = ";
+ bool added = false;
+ int len = newLine.length();
+ QStringList variableList = QStringList::split ( ' ', variables[lastLhs] );
+ for ( uint count = 0; count < variableList.size(); count++ )
+ {
+ len += variableList[count].length() + 1;
+ if ( len > 80 )
+ {
+ newLine += "\\\n\t";
+ len = 8;
+ }
+ newLine += variableList[count];
+ newLine += ' ';
+ added = true;
+ }
+ // only print it out if there was a value to add..
+ if ( added )
+ {
+ newLine.setLength ( newLine.length() - 1 );
+ outs << newLine << endl;
+ }
+ seenLhs[lastLhs] = "done";
+ variables.erase ( lastLhs );
+ lastLhs.setLength ( 0 );
+ }
+ }
+ else
+ {
+ // can write this line out..
+ // not a match, not a multi line,
+ outs << s << endl;
+ }
+ }
+
+ for ( QMap<QString, QString>::Iterator it0 = variables.begin(); it0 != variables.end(); ++it0 )
+ {
+ QString newLine ( it0.key() );
+ newLine += " = ";
+ bool added = false;
+ int len = newLine.length();
+ QStringList variableList = QStringList::split ( ' ', it0.data() );
+ for ( uint count = 0; count < variableList.size(); count++ )
+ {
+ len += variableList[count].length() + 1;
+ if ( len > 80 )
+ {
+ newLine += "\\\n\t";
+ len = 8;
+ }
+ newLine += variableList[count];
+ newLine += ' ';
+ added = true;
+
+ }
+ // only print it out if there was a value to add..
+ if ( added )
+ {
+ newLine.setLength ( newLine.length() - 1 );
+ outs << newLine << endl;
+ }
+ }
+
+ fin.close();
+ fout.close();
+
+ QDir().rename ( fileName + "#", fileName );
+}
+
+
+/**
+ * Add entries to a variable. Will just add the variables to the existing line, removing duplicates
+ * Will preserve += constructs and make sure that the variable only has one copy of the value across
+ * all += constructs
+ * @param fileName
+ * @param variables key=value string of entries to add
+ * @param add true= add these key,value pairs, false = remove. You can have empty values for an add - the whole line is
+ * removed. For adding, we will not add an empty line.
+ */
+void AutoProjectTool::addRemoveMakefileam(const QString &fileName, QMap<QString, QString> variables, bool add)
+{
+ // input file reading
+ QFile fin(fileName);
+ if (!fin.open(IO_ReadOnly))
+ {
+ return ;
+ }
+ QTextStream ins(&fin);
+
+ // output file writing.
+ QFile fout(fileName + "#");
+ if (!fout.open(IO_WriteOnly))
+ {
+ fin.close();
+ return ;
+ }
+ QTextStream outs(&fout);
+
+ // variables
+ QRegExp re("^(#kdevelop:[ \t]*)?([A-Za-z][@A-Za-z0-9_]*)[ \t]*([:\\+]?=)[ \t]*(.*)$");
+
+ // build key=map of values to add
+ // map can be empty.we never add an empty key, but do remove empty keys from the file..
+ QDict< QMap<QString, bool> > interest;
+ for (QMap<QString, QString>::Iterator it0 = variables.begin(); it0 != variables.end(); ++it0)
+ {
+ kdDebug(9020) << "key (" << add<<"): " << it0.key() << "="<< it0.data() << endl;
+
+ QMap<QString, bool>* set = new QMap<QString, bool>();
+ if (!it0.data().stripWhiteSpace().isEmpty())
+ {
+ QStringList variableList = QStringList::split(' ', it0.data());
+
+ for (uint i = 0; i < variableList.count(); i++)
+ {
+ set->insert(variableList[i], true);
+ }
+ }
+ interest.insert(it0.key(), set);
+ }
+
+ bool multiLine = false;
+ QString lastLhs;
+ QStringList lastRhs;
+ QMap<QString, QString> seenLhs;
+ while (!fin.atEnd())
+ {
+ QString s = ins.readLine();
+ if (re.exactMatch(s))
+ {
+ QString lhs = re.cap(2);
+ QMap<QString, bool>* ourRhs = interest.find(lhs);
+
+ if (!ourRhs)
+ {
+ // not interested in this line at all
+ // write it out as is..
+ outs << s << endl;
+ }
+ else
+ {
+ // we are interested in this line..
+ QString rhs = re.cap(4).stripWhiteSpace();
+ if (rhs[ rhs.length() - 1 ] == '\\')
+ {
+ // save it for when we have the whole line..
+ multiLine = true;
+ lastLhs = lhs;
+ rhs.setLength(rhs.length() - 1);
+ lastRhs += QStringList::split(" ", rhs);
+ }
+ else
+ {
+ // deal with it now.
+
+ QStringList bits = QStringList::split(" ", rhs);
+ if (add)
+ {
+ // we are adding our interested values to this line and writing it
+
+ // add this line to we we want to add to remove duplicates.
+ for (uint index = 0; index < bits.size(); index++)
+ {
+ QMap<QString, bool>::iterator findEntry = ourRhs->find(bits[index]);
+ if (findEntry == ourRhs->end())
+ {
+ // we haven't seen it, so add it, so we don't add it again later..
+ ourRhs->insert(bits[index], true);
+ }
+ // else we have this value in our 'to add list' , it is either already been
+ // added, so we don't want to add it again, or it hasn't been added, in which
+ // case we will do so soon. so we can ignore this now..
+ }
+ // now write the line out if it is not going to be empty.
+ QString newLine(lhs);
+ if (seenLhs.find(lhs) == seenLhs.end())
+ {
+ newLine += " = ";
+ seenLhs[lhs] = "";
+ }
+ else
+ {
+ newLine += " += ";
+ }
+
+ int len = newLine.length();
+ bool added = false;
+ QValueList<QString> keys = ourRhs->keys();
+ for (uint count = 0; count < keys.size(); count++)
+ {
+ // if out entry is true, add it..
+ if ((*ourRhs)[keys[count]])
+ {
+ added = true;
+ len += keys[count].length() + 1;
+ if (len > 80)
+ {
+ newLine += "\\\n\t";
+ len = 8;
+ }
+ newLine += keys[count];
+ newLine += ' ';
+ // set our value so we don't add it again.
+ (*ourRhs)[keys[count]] = false;
+ }
+ }
+ // only print it out if there was a value to add..
+ if (added)
+ {
+ newLine.setLength(newLine.length() - 1);
+ outs << newLine << endl;
+ }
+ }
+ else
+ {
+ // we are removing our interested values from this line
+
+ // special case - no values, remove the line..
+ if (!ourRhs->empty())
+ {
+ // check if any of these values are down to remove.
+ QString newLine(lhs);
+ if (seenLhs.find(lhs) == seenLhs.end())
+ {
+ newLine += " = ";
+ seenLhs[lhs] = "";
+ }
+ else
+ {
+ newLine += " += ";
+ }
+
+ int len = newLine.length();
+ bool added = false;
+ for (QStringList::Iterator posIter = bits.begin(); posIter != bits.end();posIter++)
+ {
+ QMap<QString, bool>::iterator findEntry = ourRhs->find(*posIter);
+ if (findEntry == ourRhs->end())
+ {
+ // we do not want to remove it..
+ added = true;
+ len += (*posIter).length() + 1;
+ if (len > 80)
+ {
+ newLine += "\\\n\t";
+ len = 8;
+ }
+ newLine += (*posIter);
+ newLine += ' ';
+ }
+ // else we have this value in our 'to remove list', so don't add it.
+ }
+ // only print it out if there was a value on it..
+ if (added)
+ {
+ newLine.setLength(newLine.length() - 1);
+ outs << newLine << endl;
+ }
+ }
+ }//if (add)
+ }//if ( rhs[ rhs.length() - 1 ] == '\\' )
+ }//if ( found == interest.end())
+ }
+ else if (multiLine)
+ {
+ s = s.stripWhiteSpace();
+ // we are only here if were interested in this line..
+ if (s[s.length()-1] == '\\')
+ {
+ s.setLength(s.length() - 1);
+ // still more multi line we wait for..
+ }
+ else
+ {
+ // end of the multi line..
+ multiLine = false;
+ }
+ lastRhs += QStringList::split(" ", s);
+
+ if (!multiLine)
+ {
+ // now we have to deal with this multiLine value..
+ // ourRhs will always be a value, as we only get multiLine if we're interested in it..
+ QMap<QString, bool>* ourRhs = interest.find(lastLhs);
+
+ if (add)
+ {
+ // we are adding our interested values to this line and writing it
+
+ // add this line to we we want to add to remove duplicates.
+ for (uint index = 0; index < lastRhs.size(); index++)
+ {
+ QMap<QString, bool>::iterator findEntry = ourRhs->find(lastRhs[index]);
+ if (findEntry == ourRhs->end())
+ {
+ // we haven't seen it, so add it, so we don't add it again later..
+ ourRhs->insert(lastRhs[index], true);
+ }
+ // else we have this value in our 'to add list' , it is either already been
+ // added, so we don't want to add it again, or it hasn't been added, in which
+ // case we will do so soon. so we can ignore this now..
+ }
+ // now write the line out if it is not going to be empty.
+ QString newLine(lastLhs);
+ if (seenLhs.find(lastLhs) == seenLhs.end())
+ {
+ newLine += " = ";
+ seenLhs[lastLhs] = "";
+ }
+ else
+ {
+ newLine += " += ";
+ }
+
+ int len = newLine.length();
+ bool added = false;
+ QValueList<QString> keys = ourRhs->keys();
+ for (uint count = 0; count < keys.size(); count++)
+ {
+ // if out entry is true, add it..
+ if ((*ourRhs)[keys[count]])
+ {
+ added = true;
+ len += keys[count].length() + 1;
+ if (len > 80)
+ {
+ newLine += "\\\n\t";
+ len = 8;
+ }
+ newLine += keys[count];
+ newLine += ' ';
+ // set our value so we don't add it again.
+ (*ourRhs)[keys[count]] = false;
+ }
+ }
+ // only print it out if there was a value to add..
+ if (added)
+ {
+ newLine.setLength(newLine.length() - 1);
+ outs << newLine << endl;
+ }
+ }
+ else
+ {
+ // we are removing our interested values from this line
+ // special case - no values, remove the line..
+ if (!ourRhs->empty())
+ {
+ // check if any of these values are down to remove.
+ QString newLine(lastLhs);
+ if (seenLhs.find(lastLhs) == seenLhs.end())
+ {
+ newLine += " = ";
+ seenLhs[lastLhs] = "";
+ }
+ else
+ {
+ newLine += " += ";
+ }
+ int len = newLine.length();
+ bool added = false;
+ for (QStringList::Iterator posIter = lastRhs.begin(); posIter != lastRhs.end();posIter++)
+ {
+ QMap<QString, bool>::iterator findEntry = ourRhs->find(*posIter);
+ if (findEntry == ourRhs->end())
+ {
+ // we do not want to remove it..
+ added = true;
+ len += (*posIter).length() + 1;
+ if (len > 80)
+ {
+ newLine += "\\\n\t";
+ len = 8;
+ }
+ newLine += (*posIter);
+ newLine += ' ';
+ }
+ // else we have this value in our 'to remove list', so don't add it.
+ }
+ // only print it out if there was a value on it..
+ if (added)
+ {
+ newLine.setLength(newLine.length() - 1);
+ outs << newLine << endl;
+ }
+ }
+ }
+
+ lastLhs.setLength(0);
+ lastRhs.clear();
+ }
+ }
+ else
+ {
+ // can write this line out..
+ // not a match, not a multi line,
+ outs << s << endl;
+ }
+ }
+
+ if (add)
+ {
+ QDictIterator<QMap<QString, bool> > it(interest);
+ for (; it.current(); ++it)
+ {
+ QString lhs = it.currentKey();
+ QMap<QString, bool>* ourRhs = it.current();
+
+ QString newLine(lhs);
+ if (seenLhs.find(lhs) == seenLhs.end())
+ {
+ newLine += " = ";
+ seenLhs[lastLhs] = "";
+ }
+ else
+ {
+ newLine += " += ";
+ }
+ int len = newLine.length();
+ bool added = false;
+ QValueList<QString> keys = ourRhs->keys();
+ for (uint count = 0; count < keys.size(); count++)
+ {
+ if ((*ourRhs)[keys[count]])
+ {
+ added = true;
+ len += keys[count].length() + 1;
+ if (len > 80)
+ {
+ newLine += "\\\n\t";
+ len = 8;
+ }
+ newLine += keys[count];
+ newLine += ' ';
+ // set our value so we don't add it again.
+ (*ourRhs)[keys[count]] = false;
+ }
+ }
+ // only print it out if there was a value to add..
+ if (added)
+ {
+ newLine.setLength(newLine.length() - 1);
+ outs << newLine << endl;
+ }
+ }
+ }
+ interest.setAutoDelete(true);
+ interest.clear();
+
+ fin.close();
+ fout.close();
+
+ QDir().rename(fileName + "#", fileName);
+}
+
+/**
+ * Any items in the map will be removed from the Makefile.am
+ * Empty lines are removed. eg. foo_LDDADD if empty is removed.
+ * @param fileName full path to Makefile.am
+ * @param variables lines to remove items from.
+ */
+void AutoProjectTool::removeFromMakefileam(const QString &fileName, QMap <QString, QString> variables)
+{
+ AutoProjectTool::addRemoveMakefileam(fileName, variables, false);
+}
+
+
+/**
+ * Open the file and parse out the AC_OUTPUT line. following backslash continue lines..
+ * @param configureinpath
+ * @return list of all the values
+ */
+QStringList AutoProjectTool::configureinLoadMakefiles(QString configureinpath)
+{
+ QFile configurein(configureinpath);
+
+ if (!configurein.open(IO_ReadOnly))
+ {
+ kdDebug(9020) << k_funcinfo << " - couldn't open file: " << configureinpath << endl;
+ return QStringList();
+ }
+
+ QTextStream stream(&configurein);
+ QStringList list;
+
+ QString ac_match("^AC_OUTPUT");
+
+ QRegExp ac_regex(ac_match);
+ bool multiLine = false;
+ QChar cont('\\');
+ QRegExp close("\\)");
+ QRegExp open("\\(");
+ while (!stream.eof())
+ {
+ QString line = stream.readLine().stripWhiteSpace();
+ if (multiLine)
+ {
+ if (close.search(line) >= 0)
+ {
+ line = line.replace(close.search(line), 1, "");
+ list += QStringList::split(" ", line);
+ break;
+ }
+ else
+ {
+ if (line.endsWith(cont))
+ {
+ line.setLength(line.length() - 1);
+ }
+ list += QStringList::split(" ", line);
+ }
+ }
+ else if (ac_regex.search(line) >= 0)
+ {
+ line = line.replace(ac_regex.search(line), ac_match.length() - 1, "");
+
+ if (open.search(line) >= 0)
+ {
+ line = line.replace(open.search(line), 1, "");
+ }
+
+ if (line.endsWith(cont))
+ {
+ line.setLength(line.length() - 1);
+ multiLine = true;
+ }
+ else
+ {
+ if (close.search(line) >= 0)
+ {
+ line = line.replace(close.search(line), 1, "");
+ }
+ }
+
+ list = QStringList::split(" ", line);
+
+ if (!multiLine)
+ {
+ break;
+ }
+ }
+ }
+
+ configurein.close();
+
+ // make a new object on the heap
+ return list;
+
+}
+
+/**
+ * Write the items to the AC_OUTPUT line. This replaces the exiting line.
+ * @param configureinpath
+ * @param makefiles
+ */
+void AutoProjectTool::configureinSaveMakefiles(QString fileName, QStringList makefiles)
+{
+ // input file reading
+ QFile fin(fileName);
+ if (!fin.open(IO_ReadOnly))
+ {
+ return ;
+ }
+ QTextStream ins(&fin);
+
+ // output file writing.
+ QFile fout(fileName + "#");
+ if (!fout.open(IO_WriteOnly))
+ {
+ fin.close();
+ return ;
+ }
+ QTextStream outs(&fout);
+
+ // remove duplicates if any..
+ QMap<QString, QString> toAdd;
+ for (uint i = 0; i < makefiles.size();i++)
+ {
+ toAdd.insert(makefiles[i].stripWhiteSpace(), "");
+ }
+
+ QString ac_match("^AC_OUTPUT");
+ QRegExp ac_regex(ac_match);
+ bool multiLine = false;
+ QChar cont('\\');
+ QRegExp close("\\)");
+ QRegExp open("\\(");
+ bool done = false;
+ while (!fin.atEnd())
+ {
+ QString line = ins.readLine();
+ if (done)
+ {
+ outs << line << endl;
+ }
+ else
+ {
+ if (multiLine)
+ {
+ line = line.stripWhiteSpace();
+ if (close.search(line) >= 0)
+ {
+ int len = 10;
+ QString acline("AC_OUTPUT(");
+ for (QMap<QString, QString>::iterator iter = toAdd.begin();iter != toAdd.end();iter++)
+ {
+ len += iter.key().length();
+ if (len > 80)
+ {
+ acline += "\\\n\t";
+ len = 8;
+ }
+ acline += iter.key();
+ acline += ' ';
+ }
+ acline.setLength(acline.length() - 1);
+ acline = acline.append(")");
+ outs << acline << endl;
+ done = true;
+ }
+ else
+ {
+ if (line.endsWith(cont))
+ {
+ line.setLength(line.length() - 1);
+ }
+ }
+ }
+ else if (ac_regex.search(line) >= 0)
+ {
+ line = line.stripWhiteSpace();
+ line = line.replace(ac_regex.search(line), ac_match.length() - 1, "");
+ if (line.endsWith(cont))
+ {
+ line.setLength(line.length() - 1);
+ multiLine = true;
+ }
+ if (open.search(line) >= 0)
+ {
+ line = line.replace(open.search(line), 1, "");
+ }
+ if (close.search(line) >= 0)
+ {
+ line = line.replace(close.search(line), 1, "");
+ }
+
+ if (!multiLine)
+ {
+ int len = 10;
+ QString acline("AC_OUTPUT(");
+ for (QMap<QString, QString>::iterator iter = toAdd.begin();iter != toAdd.end();iter++)
+ {
+ len += iter.key().length();
+ if (len > 80)
+ {
+ acline += "\\\n\t";
+ len = 8;
+ }
+ acline += iter.key();
+ acline += ' ';
+ }
+ acline.setLength(acline.length() - 1);
+ acline = acline.append(")");
+ outs << acline << endl;
+ done = true;
+ }
+ }
+ else
+ {
+ outs << line << endl;
+ }
+ }
+ }
+
+ fin.close();
+ fout.close();
+
+ QDir().rename(fileName + "#", fileName);
+
+}
+
+//kate: indent-mode csands; space-indent off; tab-width 4;
diff --git a/buildtools/autotools/misc.h b/buildtools/autotools/misc.h
new file mode 100644
index 00000000..9db9919e
--- /dev/null
+++ b/buildtools/autotools/misc.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+* Copyright (C) 2001-2002 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _MISC_H_
+#define _MISC_H_
+
+#include <qcstring.h>
+#include <qmap.h>
+#include <qwidget.h>
+
+/**
+ * Very small helper class. It has just static methods.
+ */
+class AutoProjectTool
+{
+public:
+
+ /**
+ * Loads the compiler options plugin for the given compiler, executes the dialog
+ * with some initial flags, and returns the new flags.
+ */
+ static QString execFlagsDialog( const QString &compiler, const QString &flags, QWidget *parent );
+
+ /**
+ * Returns the canonicalized version of a file name, i.e.
+ * the file name with special characters replaced by underscores
+ */
+ static QString canonicalize( const QString &str );
+
+ /**
+ * Parses a Makefile.am and stores its variable assignments
+ * in a map.
+ */
+ static void parseMakefileam( const QString &filename, QMap<QString, QString> *variables );
+
+ static void addToMakefileam( const QString &filename, QMap<QString, QString> variables );
+ static void removeFromMakefileam( const QString &filename, QMap<QString, QString> variables );
+ static void setMakefileam ( const QString &fileName, QMap<QString, QString> variables );
+
+ static void addRemoveMakefileam(const QString &fileName, QMap<QString, QString> variables, bool add);
+
+ /**
+ * Parses configure.in and splits AC_OUTPUT into a QStringList
+ */
+ static QStringList configureinLoadMakefiles( QString configureinpath );
+
+ /**
+ * Receives a QStringList and puts it into
+ * configure.in as arguments to AC_OUTPUT
+ */
+ static void configureinSaveMakefiles( QString configureinpath, QStringList makefiles );
+
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
+
diff --git a/buildtools/autotools/removefiledlg.cpp b/buildtools/autotools/removefiledlg.cpp
new file mode 100644
index 00000000..2c3bc37f
--- /dev/null
+++ b/buildtools/autotools/removefiledlg.cpp
@@ -0,0 +1,182 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "removefiledlg.h"
+
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+#include <qfile.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qregexp.h>
+
+#include <kbuttonbox.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <ksqueezedtextlabel.h>
+
+#include "autolistviewitems.h"
+
+#include "misc.h"
+#include "autoprojectpart.h"
+#include "autoprojectwidget.h"
+#include "autodetailsview.h"
+
+static bool fileListContains(const QPtrList<FileItem> &list, const QString &name)
+{
+ QPtrListIterator<FileItem> it(list);
+ for (; it.current(); ++it)
+ if ((*it)->text(0) == name)
+ return true;
+ return false;
+}
+
+
+RemoveFileDialog::RemoveFileDialog(AutoProjectWidget *widget, AutoProjectPart* part, SubprojectItem *spitem,
+ TargetItem *item, const QString &filename,
+ QWidget *parent, const char *name)
+ : RemoveFileDlgBase(parent, name, true)
+{
+ removeFromTargetsCheckBox = 0;
+
+ QStringList targets;
+
+ QPtrListIterator<TargetItem> it(spitem->targets);
+ for (; it.current(); ++it)
+ if (fileListContains((*it)->sources, filename))
+ targets.append((*it)->name);
+
+ if (targets.count() > 1)
+ {
+ removeFromTargetsCheckBox = new QCheckBox( fileGroupBox, "removeFromTargetsCheckBox" );
+ removeFromTargetsCheckBox->setMinimumSize( QSize( 0, 45 ) );
+ fileLayout->addWidget( removeFromTargetsCheckBox );
+
+ QString joinedtargets = " *" + targets.join("\n *");
+ removeFromTargetsCheckBox->setText ( i18n ( "The file %1 is still used by the following targets:\n%2\n"
+ "Remove it from all of them?").arg(filename).arg(joinedtargets) );
+ setMinimumSize(QSize(size().width(), size().height() + removeFromTargetsCheckBox->size().height()*2) );
+ }
+
+ removeLabel->setText ( i18n ( "Do you really want to remove <b>%1</b>?" ).arg ( filename ) );
+
+ directoryLabel->setText ( spitem->path );
+ if ( item->name.isEmpty() )
+ targetLabel->setText ( i18n ( "%1 in %2" ).arg ( item->primary ).arg ( item->prefix ) );
+ else
+ targetLabel->setText ( item->name );
+
+ connect ( removeButton, SIGNAL ( clicked() ), this, SLOT ( accept() ) );
+ connect ( cancelButton, SIGNAL ( clicked() ), this, SLOT ( reject() ) );
+
+ setIcon ( SmallIcon ( "editdelete.png" ) );
+
+ m_widget = widget;
+ m_part = part;
+ subProject = spitem;
+ target = item;
+ fileName = filename;
+}
+
+
+RemoveFileDialog::~RemoveFileDialog()
+{}
+
+
+void RemoveFileDialog::accept()
+{
+ m_widget->emitRemovedFile ( subProject->path.mid ( m_part->projectDirectory().length() + 1 ) + "/" + fileName );
+
+ QMap<QString,QString> replaceMap;
+
+ if (removeFromTargetsCheckBox && removeFromTargetsCheckBox->isChecked()) {
+ QPtrListIterator<TargetItem> it(subProject->targets);
+ for (; it.current(); ++it) {
+ if ((*it) != target && fileListContains((*it)->sources, fileName)) {
+ FileItem *fitem = static_cast<FileItem*>((*it)->firstChild());
+ while (fitem) {
+ FileItem *nextitem = static_cast<FileItem*>(fitem->nextSibling());
+ if (fitem->text(0) == fileName) {
+ QListView *lv = fitem->listView();
+ lv->setSelected(fitem, false);
+ (*it)->sources.remove(fitem);
+ }
+ fitem = nextitem;
+ }
+ QString canontargetname = AutoProjectTool::canonicalize((*it)->name);
+ QString varname;
+ if( (*it)->primary == "PROGRAMS" || (*it)->primary == "LIBRARIES" || (*it)->primary == "LTLIBRARIES" )
+ varname = canontargetname + "_SOURCES";
+ else
+ varname = (*it)->prefix + "_" + (*it)->primary;
+ QStringList sources = QStringList::split(QRegExp("[ \t\n]"), subProject->variables[varname]);
+ sources.remove(fileName);
+ subProject->variables[varname] = sources.join(" ");
+ replaceMap.insert(varname, fileName);
+ }
+ }
+ }
+
+ QString fileItemName;
+ FileItem *fitem = static_cast<FileItem*>(target->firstChild());
+ while (fitem) {
+ if (fitem->text(0) == fileName) {
+ QListView *lv = fitem->listView();
+ lv->setSelected(fitem, false);
+ fileItemName = fitem->name;
+ target->sources.remove(fitem);
+ break;
+ }
+ fitem = static_cast<FileItem*>(fitem->nextSibling());
+ }
+ QString canontargetname = AutoProjectTool::canonicalize(target->name);
+ QString varname;
+ if( target->primary == "PROGRAMS" || target->primary == "LIBRARIES" || target->primary == "LTLIBRARIES" )
+ varname = canontargetname + "_SOURCES";
+ else
+ varname = target->prefix + "_" + target->primary;
+ QStringList sources = QStringList::split(QRegExp("[ \t\n]"), subProject->variables[varname]);
+ sources.remove(fileName);
+ subProject->variables[varname] = sources.join(" ");
+ replaceMap.insert(varname, fileName);
+
+ AutoProjectTool::removeFromMakefileam(subProject->path + "/Makefile.am", replaceMap);
+
+// review configuration cleanup in the project file after removing subclassing related source
+ QDomDocument &dom = *(m_part->projectDom());
+
+ QDomElement el = dom.documentElement();
+ QDomNode el2 = el.namedItem("kdevautoproject");
+ QDomNode el3 = el2.namedItem("subclassing");
+
+ QDomNode n = el3.firstChild();
+ QValueList<QDomNode> nodesToRemove;
+ while ( !n.isNull() ) {
+ QDomNamedNodeMap attr = n.attributes();
+ QString fpath = subProject->path + QString("/") + fileItemName;
+ QString relpath = fpath.remove(0, m_part->projectDirectory().length());
+ if ((attr.item(0).nodeValue() == relpath)
+ || (attr.item(1).nodeValue() == relpath) )
+ nodesToRemove.append(n);
+ n = n.nextSibling();
+ }
+ QValueList<QDomNode>::iterator it;
+ for ( it = nodesToRemove.begin(); it != nodesToRemove.end(); ++it )
+ el3.removeChild(*it);
+
+ if (removeCheckBox->isChecked())
+ QFile::remove(subProject->path + "/" + fileName);
+
+ QDialog::accept();
+}
+
+#include "removefiledlg.moc"
diff --git a/buildtools/autotools/removefiledlg.h b/buildtools/autotools/removefiledlg.h
new file mode 100644
index 00000000..ab843dda
--- /dev/null
+++ b/buildtools/autotools/removefiledlg.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _REMOVEFILEDLG_H_
+#define _REMOVEFILEDLG_H_
+
+#include <qdialog.h>
+
+#include "removefiledlgbase.h"
+
+class QCheckBox;
+class AutoProjectWidget;
+class AutoProjectPart;
+class SubprojectItem;
+class TargetItem;
+
+
+class RemoveFileDialog : public RemoveFileDlgBase
+{
+ Q_OBJECT
+
+public:
+ RemoveFileDialog( AutoProjectWidget *widget, AutoProjectPart* part, SubprojectItem *spitem,
+ TargetItem *item, const QString &filename,
+ QWidget *parent = 0, const char *name = 0 );
+ ~RemoveFileDialog();
+
+protected:
+ virtual void accept();
+
+private:
+ QCheckBox *removeFromTargetsCheckBox;
+ //QCheckBox *removefromdisk_box;
+
+ AutoProjectWidget* m_widget;
+ AutoProjectPart *m_part;
+ SubprojectItem *subProject;
+ TargetItem *target;
+ QString fileName;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/removefiledlgbase.ui b/buildtools/autotools/removefiledlgbase.ui
new file mode 100644
index 00000000..d7b66011
--- /dev/null
+++ b/buildtools/autotools/removefiledlgbase.ui
@@ -0,0 +1,233 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>RemoveFileDlgBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>RemoveFileDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>447</width>
+ <height>284</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Remove File From This Target</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>buttonSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>247</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>fileGroupBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>&amp;File Information</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>fileLayout</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>removeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[REMOVE QUESTION]</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>removeCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Also &amp;remove it from disk</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>noticeLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Note:&lt;/b&gt; You will not be able to undelete the file.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>targetBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Subproject Information</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>targetLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>[TARGET NAME]</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>directoryStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Directory:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>targetStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Target:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>directoryLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>[DIRECTORY NAME]</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<tabstops>
+ <tabstop>removeCheckBox</tabstop>
+ <tabstop>removeButton</tabstop>
+ <tabstop>cancelButton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">ksqueezedtextlabel.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/buildtools/autotools/removetargetdlg.cpp b/buildtools/autotools/removetargetdlg.cpp
new file mode 100644
index 00000000..6104e404
--- /dev/null
+++ b/buildtools/autotools/removetargetdlg.cpp
@@ -0,0 +1,279 @@
+/***************************************************************************
+ -------------------
+ begin : 21.11.2002
+ copyright : (C) 2002 by Victor R�er
+ email : victor_roeder@gmx.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "removetargetdlg.h"
+
+#include <qapplication.h>
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+#include <qfile.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qregexp.h>
+
+#include <kbuttonbox.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <klistbox.h>
+#include <kprogress.h>
+#include <ksqueezedtextlabel.h>
+#include <klocale.h>
+
+#include "autolistviewitems.h"
+
+#include "misc.h"
+
+#include "autoprojectpart.h"
+#include "autoprojectwidget.h"
+
+
+RemoveTargetDialog::RemoveTargetDialog( AutoProjectWidget *widget, AutoProjectPart* part, SubprojectItem *spitem,
+ TargetItem *titem, QWidget* parent, const char* name )
+ : RemoveTargetDlgBase ( parent, name, true, 0 )
+{
+ removeLabel->setText ( i18n ( "Do you really want to remove <b>%1</b><br>with <b>all files</b> that are attached to it<br>and <b>all dependencies</b>?" ).arg ( titem->name ) );
+ directoryLabel->setText ( spitem->path );
+
+ if ( titem->name.isEmpty() )
+ targetLabel->setText ( i18n ( "%1 in %2" ).arg ( titem->primary ).arg ( titem->prefix ) );
+ else
+ targetLabel->setText ( titem->name );
+
+ connect ( removeButton, SIGNAL ( clicked() ), this, SLOT ( accept() ) );
+ connect ( cancelButton, SIGNAL ( clicked() ), this, SLOT ( reject() ) );
+
+ setIcon ( SmallIcon ( "editdelete" ) );
+
+ progressBar->hide();
+
+ m_spitem = spitem;
+ m_titem = titem;
+ m_widget = widget;
+ m_part = part;
+
+ //kdDebug ( 9020 ) << "+++++ " << titem->primary << " " << titem->prefix << " " << titem->name << endl;
+
+ init();
+}
+
+
+RemoveTargetDialog::~RemoveTargetDialog()
+{
+}
+
+void RemoveTargetDialog::init()
+{
+ QPtrList <SubprojectItem> subprojectItems = m_widget->allSubprojectItems();
+
+ TargetItem* titem = 0;
+
+ for ( SubprojectItem* spitem = subprojectItems.first(); spitem; spitem = subprojectItems.next() )
+ {
+ if ( m_titem->name.isEmpty() )
+ break;
+
+ for ( titem = spitem->targets.first(); titem; titem = spitem->targets.next() )
+ {
+ if ( m_titem->name == titem->name )
+ continue;
+
+ if ( titem->primary == "LTLIBRARIES" || titem->primary == "PROGRAMS"
+ || titem->primary == "LIBRARIES" || titem->primary == "JAVA" )
+ {
+ QString canonname = AutoProjectTool::canonicalize ( titem->name );
+
+ if ( spitem->variables[canonname + "_LIBADD"].contains ( m_titem->name ) > 0 ||
+ spitem->variables[canonname + "_LDADD"].contains ( m_titem->name ) > 0 )
+ {
+ dependencyListBox->insertItem ( SmallIcon ( "target_kdevelop" ), spitem->path + " (" + titem->name + ")" );
+
+ dependentSubprojects.append ( spitem );
+ }
+ }
+ }
+ }
+
+ if ( dependencyListBox->count() == 0 )
+ dependencyListBox->insertItem ( i18n("no dependency", "<none>") );
+}
+
+void RemoveTargetDialog::accept ()
+{
+ progressBar->show();
+ progressBar->setFormat ( i18n ( "Removing Target... %p%" ) );
+
+ qApp->processEvents();
+
+ QString canonname = AutoProjectTool::canonicalize ( m_titem->name );
+ QString varname = m_titem->prefix + "_" + m_titem->primary;
+
+ SubprojectItem* spitem = 0;
+ TargetItem* titem = 0;
+
+ QMap <QString, QString> removeMap;
+ QMap <QString, QString> replaceMap;
+
+ // Remove dependencies to other targets first (stored by init() in 'dependentTargets')
+ for ( spitem = dependentSubprojects.first(); spitem; spitem = dependentSubprojects.next() )
+ {
+ for ( titem = spitem->targets.first(); titem; titem = spitem->targets.next() )
+ {
+ QString curVarname;
+ QString curCanonname = AutoProjectTool::canonicalize ( titem->name );
+ QStringList dependencies;
+
+ if ( spitem->variables[curCanonname + "_LIBADD"].contains ( m_titem->name ) )
+ curVarname = curCanonname + "_LIBADD";
+ else
+ curVarname = curCanonname + "_LDADD";
+
+ dependencies = QStringList::split(QRegExp("[ \t\n]"), spitem->variables[curVarname]);
+
+ //QStringList::Iterator it = dependencies.begin();
+
+ for ( uint i = 0; i < dependencies.size(); ++i )
+ {
+ QString s = dependencies[i];
+ if ( s.contains ( m_titem->name ) > 0 )
+ dependencies.remove ( s );
+ }
+
+ // if we removed the last entry of "blabla_LDADD" or "blabla_LIBADD", remove the complete line
+ if ( dependencies.count() == 0 )
+ {
+ removeMap.insert ( curVarname, "" );
+ AutoProjectTool::removeFromMakefileam ( spitem->path + "/Makefile.am", removeMap );
+ removeMap.clear();
+ }
+ else
+ {
+ spitem->variables[curVarname] = dependencies.join ( " " );
+ replaceMap.insert ( curVarname, spitem->variables[curVarname] );
+ AutoProjectTool::addToMakefileam ( spitem->path + "/Makefile.am", replaceMap );
+ replaceMap.clear();
+ }
+ }
+ }
+
+ // handling am_edit stuff
+ if ( m_titem->primary == "KDEICON" )
+ removeMap.insert ( "KDE_ICON", "" );
+ else if ( m_titem->primary == "KDEDOCS" )
+ removeMap.insert ( "KDE_DOCS", "" );
+ else
+ {
+ // if we have bin_PROGRAMS = [target to be deleted] [other target]
+ // delete only the [target to be deleted], not the whole line!
+ QStringList targets = QStringList::split(QRegExp("[ \t\n]"), m_spitem->variables[varname]);
+
+ if ( targets.count() > 1 )
+ {
+ targets.remove ( m_titem->name );
+ m_spitem->variables[varname] = targets.join ( " " );
+ replaceMap.insert ( varname, m_spitem->variables[varname] );
+ AutoProjectTool::addToMakefileam ( m_spitem->path + "/Makefile.am", replaceMap );
+ replaceMap.clear();
+ }
+ else
+ {
+ removeMap.insert ( varname, m_titem->name );
+ }
+ }
+
+ // if we have no such line containing blabla_SOURCES, blabla_LDFLAGS, etc.
+ // they are ignored
+ removeMap.insert ( canonname + "_SOURCES", "" );
+
+ // remove from our internal list
+ m_spitem->variables.erase(canonname+"_SOURCES");
+
+ if ( m_titem->primary == "PROGRAMS" || m_titem->primary == "LTLIBRARIES" )
+ {
+ removeMap.insert ( canonname + "_LDFLAGS", "" );
+ removeMap.insert ( canonname + "_DEPENDENCIES", "" );
+ removeMap.insert ( canonname + "_LDADD", "" );
+ removeMap.insert ( canonname + "_LIBADD", "" );
+ }
+
+ AutoProjectTool::removeFromMakefileam ( m_spitem->path + "/Makefile.am", removeMap );
+
+ removeMap.clear();
+
+ // if we have another "blabla_PROGRAMS" or "blabla_LTLIBRARIES" target in the same subproject
+ // check if it has an empty "blabla_LIBADD"-entry
+ if ( m_titem->primary == "PROGRAMS" || m_titem->primary == "LTLIBRARIES" )
+ {
+ for ( titem = m_spitem->targets.first(); titem; titem = m_spitem->targets.next() )
+ {
+ //kdDebug (9020) << "******** " << m_spitem->subdir << endl;
+ if ( titem->primary == "PROGRAMS" || titem->primary == "LTLIBRARIES" )
+ {
+ QString curCanonname = AutoProjectTool::canonicalize ( titem->name );
+
+ if ( m_spitem->variables[curCanonname + "_LIBADD"].isEmpty() )
+ {
+ removeMap.insert ( curCanonname + "_LIBADD", "" );
+
+ //kdDebug (9020) << "Removing from " << m_spitem->subdir << " " << curCanonname << "_LIBADD" << endl;
+
+ AutoProjectTool::removeFromMakefileam ( m_spitem->path + "/Makefile.am", removeMap );
+
+ removeMap.clear();
+ }
+ }
+ }
+ }
+
+
+ progressBar->setTotalSteps ( m_titem->sources.count() );
+
+ QStringList fileList;
+
+ for ( FileItem* fitem = m_titem->sources.first(); fitem; fitem = m_titem->sources.next() )
+ {
+ if (removeCheckBox->isChecked())
+ {
+ // before removing the files, check if they are mentioned in "noinst_HEADERS = blabla1.h blabla2.h"
+ QStringList noInstHeaders = QStringList::split ( QRegExp ( "[ \t\n]" ), m_spitem->variables["noinst_HEADERS"] );
+
+ if ( noInstHeaders.contains ( fitem->name ) )
+ {
+ noInstHeaders.remove ( fitem->name );
+
+ m_spitem->variables["noinst_HEADERS"] = noInstHeaders.join ( " " );
+ replaceMap.insert ( "noinst_HEADERS", m_spitem->variables["noinst_HEADERS"] );
+ AutoProjectTool::addToMakefileam ( m_spitem->path + "/Makefile.am", replaceMap );
+ replaceMap.clear();
+ }
+
+ QFile::remove(m_spitem->path + "/" + fitem->name);
+ }
+
+ fileList.append ( m_spitem->path.mid ( m_part->projectDirectory().length() + 1 ) + "/" + fitem->name );
+
+ qApp->processEvents();
+
+ progressBar->setValue ( progressBar->value() + 1 );
+ }
+
+ m_widget->emitRemovedFiles ( fileList );
+
+ m_spitem->targets.remove ( m_titem );
+
+
+ QDialog::accept();
+}
diff --git a/buildtools/autotools/removetargetdlg.h b/buildtools/autotools/removetargetdlg.h
new file mode 100644
index 00000000..6953d2bf
--- /dev/null
+++ b/buildtools/autotools/removetargetdlg.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ -------------------
+ begin : 21.11.2002
+ copyright : (C) 2002 by Victor Röder
+ email : victor_roeder@gmx.de
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _REMOVETARGETDLG_H_
+#define _REMOVETARGETDLG_H_
+
+#include "removetargetdlgbase.h"
+
+#include <qptrlist.h>
+
+class AutoProjectWidget;
+class AutoProjectPart;
+class SubprojectItem;
+class TargetItem;
+
+/**
+ *
+ * KDevelop Authors
+ **/
+class RemoveTargetDialog : public RemoveTargetDlgBase
+{
+
+public:
+ RemoveTargetDialog( AutoProjectWidget *widget, AutoProjectPart* part, SubprojectItem *spitem,
+ TargetItem *titem, QWidget* parent = 0, const char* name = 0 );
+ ~RemoveTargetDialog();
+
+private:
+ SubprojectItem* m_spitem;
+ TargetItem* m_titem;
+ AutoProjectWidget* m_widget;
+ AutoProjectPart* m_part;
+
+ QPtrList <SubprojectItem> dependentSubprojects;
+
+protected:
+ void init ();
+ virtual void accept();
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
diff --git a/buildtools/autotools/removetargetdlgbase.ui b/buildtools/autotools/removetargetdlgbase.ui
new file mode 100644
index 00000000..8e3660d3
--- /dev/null
+++ b/buildtools/autotools/removetargetdlgbase.ui
@@ -0,0 +1,264 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>RemoveTargetDlgBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>RemoveTargetDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>472</width>
+ <height>477</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Remove Target From [SUBPROJECT]</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>targetBox</cstring>
+ </property>
+ <property name="title">
+ <string>Subproject Information</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KSqueezedTextLabel" row="0" column="1">
+ <property name="name">
+ <cstring>directoryLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>[TARGET DIRECTORY]</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>targetLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[TARGET NAME]</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>directoryStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Directory:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>targetStaticLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Target:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>fileGroupBox</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>140</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>&amp;Target Information</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>removeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[REMOVE QUESTION]</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>removeCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Also &amp;remove it from disk</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Note:&lt;/b&gt; You will not be able to undo this operation. Please check your Makefile.am afterwards.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>&amp;Dependencies to Other Subprojects</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox" row="0" column="0">
+ <property name="name">
+ <cstring>dependencyListBox</cstring>
+ </property>
+ <property name="dragAutoScroll">
+ <bool>false</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>NoSelection</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="KProgress" row="3" column="0">
+ <property name="name">
+ <cstring>progressBar</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="5" column="0">
+ <property name="name">
+ <cstring>buttonLayout</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>buttonSpacer</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>ksqueezedtextlabel.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>kprogress.h</includehint>
+</includehints>
+</UI>
diff --git a/buildtools/autotools/subprojectoptionsdlg.cpp b/buildtools/autotools/subprojectoptionsdlg.cpp
new file mode 100644
index 00000000..5ad6bf10
--- /dev/null
+++ b/buildtools/autotools/subprojectoptionsdlg.cpp
@@ -0,0 +1,404 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "subprojectoptionsdlg.h"
+
+#include <qdom.h>
+#include <qheader.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qregexp.h>
+#include <kbuttonbox.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <keditlistbox.h>
+#include <kinputdialog.h>
+#include <klocale.h>
+#include <knotifyclient.h>
+#include <kservice.h>
+#include <kurlrequesterdlg.h>
+#include <kurlrequester.h>
+#include <kurlcompletion.h>
+#include <kfiledialog.h>
+#include "domutil.h"
+#include "misc.h"
+#include "addprefixdlg.h"
+
+#include "autolistviewitems.h"
+
+#include "autoprojectpart.h"
+#include "autoprojectwidget.h"
+
+
+SubprojectOptionsDialog::SubprojectOptionsDialog(AutoProjectPart *part, AutoProjectWidget *widget,
+ SubprojectItem *item, QWidget *parent, const char *name)
+ : SubprojectOptionsDialogBase(parent, name, true)
+{
+ setCaption(i18n("Subproject Options for '%1'").arg(item->subdir));
+
+ subProject = item;
+ m_part = part;
+
+ QFontMetrics fm(cflags_edit->fontMetrics());
+ int wid = fm.width('X')*35;
+ cflags_edit->setMinimumWidth(wid);
+ cxxflags_edit->setMinimumWidth(wid);
+ fflags_edit->setMinimumWidth(wid);
+
+ QDomDocument &dom = *part->projectDom();
+ QString prefix = "/kdevautoproject/configurations/" + m_part->currentBuildConfig() + "/";
+
+ ccompiler = DomUtil::readEntry(dom, prefix + "ccompiler", "kdevgccoptions");
+ cxxcompiler = DomUtil::readEntry(dom, prefix + "cxxcompiler", "kdevgppoptions");
+ f77compiler = DomUtil::readEntry(dom, prefix + "f77compiler", "kdevg77options");
+
+ if (!KService::serviceByDesktopName(ccompiler))
+ cflags_button->setEnabled(false);
+ if (!KService::serviceByDesktopName(cxxcompiler))
+ cxxflags_button->setEnabled(false);
+ if (!KService::serviceByDesktopName(f77compiler))
+ fflags_button->setEnabled(false);
+
+ insideinc_listview->header()->hide();
+ outsideinc_listview->header()->hide();
+ buildorder_listview->header()->hide();
+
+ insideinc_listview->setSorting(-1);
+ outsideinc_listview->setSorting(-1);
+ prefix_listview->setSorting(-1);
+ buildorder_listview->setSorting(-1);
+
+ connect( prefix_listview, SIGNAL( doubleClicked ( QListViewItem *, const QPoint &, int ) ), this, SLOT( editPrefixClicked() ) );
+
+ // Insert all subdirectories as possible include directories
+ QStringList l = widget->allSubprojects();
+ QCheckListItem *lastItem = 0;
+ QStringList::ConstIterator it;
+ for (it = l.begin(); it != l.end(); ++it) {
+ kdDebug(9020) << "----------> subproject = " << (*it) << endl;
+ QString subProjectName = *it;
+
+ if( subProjectName.isEmpty() ){
+ subProjectName = QString::fromLatin1( "." );
+ }
+ QCheckListItem *clitem = new QCheckListItem(insideinc_listview, subProjectName, QCheckListItem::CheckBox);
+ if (lastItem)
+ clitem->moveItem(lastItem);
+ lastItem = clitem;
+ }
+
+ setIcon ( SmallIcon ( "configure" ) );
+
+ readConfig();
+}
+
+
+SubprojectOptionsDialog::~SubprojectOptionsDialog()
+{}
+
+
+void SubprojectOptionsDialog::readConfig()
+{
+
+ cflags_edit->setText(subProject->variables["AM_CFLAGS"]);
+ cxxflags_edit->setText(subProject->variables["AM_CXXFLAGS"]);
+ fflags_edit->setText(subProject->variables["AM_FFLAGS"]);
+
+ metasources_checkbox->setChecked(subProject->variables["METASOURCES"].stripWhiteSpace() == "AUTO");
+
+ QString includes = subProject->variables["INCLUDES"];
+ QStringList includeslist = QStringList::split(QRegExp("[ \t]"), QString(includes));
+
+ QListViewItem *lastItem = 0;
+ QStringList::Iterator it;
+ for (it = includeslist.begin(); it != includeslist.end(); ++it) {
+ QCheckListItem *clitem = static_cast<QCheckListItem*>(insideinc_listview->firstChild());
+ while (clitem) {
+ if (*it == ("-I$(top_srcdir)/" + clitem->text())) {
+ clitem->setOn(true);
+ break;
+ }
+ clitem = static_cast<QCheckListItem*>(clitem->nextSibling());
+ }
+ if (!clitem) {
+ QListViewItem *item = new QListViewItem(outsideinc_listview, *it);
+ if (lastItem)
+ item->moveItem(lastItem);
+ lastItem = item;
+ }
+ }
+
+ QMap<QString, QString>::ConstIterator it2;
+ for (it2 = subProject->prefixes.begin(); it2 != subProject->prefixes.end(); ++it2)
+ new QListViewItem(prefix_listview, it2.key(), it2.data());
+
+ QString subdirs = subProject->variables["SUBDIRS"];
+ kdDebug(9020) << "Subdirs variable: " << subdirs << endl;
+ QStringList subdirslist = QStringList::split(QRegExp("[ \t]"), QString(subdirs));
+ lastItem = 0;
+ for (it = subdirslist.begin(); it != subdirslist.end(); ++it) {
+ QListViewItem *item = new QListViewItem(buildorder_listview, *it);
+ if (lastItem)
+ item->moveItem(lastItem);
+ lastItem = item;
+ }
+}
+
+
+void SubprojectOptionsDialog::storeConfig()
+{
+ QMap<QString, QString> replaceMap;
+
+ QString old_cflags = subProject->variables["AM_CFLAGS"];
+ QString new_cflags = cflags_edit->text();
+ if (new_cflags != old_cflags) {
+ subProject->variables["AM_CFLAGS"] = new_cflags;
+ replaceMap.insert("AM_CFLAGS", new_cflags);
+ }
+
+ QString old_cxxflags = subProject->variables["AM_CXXFLAGS"];
+ QString new_cxxflags = cxxflags_edit->text();
+ if (new_cxxflags != old_cxxflags) {
+ subProject->variables["AM_CXXFLAGS"] = new_cxxflags;
+ replaceMap.insert("AM_CXXFLAGS", new_cxxflags);
+ }
+
+ QString old_fflags = subProject->variables["AM_FFLAGS"];
+ QString new_fflags = fflags_edit->text();
+ if (new_fflags != old_fflags) {
+ subProject->variables["AM_FFLAGS"] = new_fflags;
+ replaceMap.insert("AM_FFLAGS", new_fflags);
+ }
+
+ QString old_metasources = subProject->variables["METASOURCES"];
+ QString new_metasources = metasources_checkbox->isChecked() ? QString::fromLatin1("AUTO") : QString::null;
+ if (new_metasources != old_metasources) {
+ subProject->variables["METASOURCES"] = new_metasources;
+ replaceMap.insert("METASOURCES", new_metasources);
+ }
+
+ QStringList includeslist;
+ QCheckListItem *clitem = static_cast<QCheckListItem*>(insideinc_listview->firstChild());
+ while (clitem) {
+ if (clitem->isOn())
+ includeslist.append("-I$(top_srcdir)/" + clitem->text());
+ clitem = static_cast<QCheckListItem*>(clitem->nextSibling());
+ }
+ clitem = static_cast<QCheckListItem*>(outsideinc_listview->firstChild());
+ while (clitem) {
+ includeslist.append(clitem->text());
+ clitem = static_cast<QCheckListItem*>(clitem->nextSibling());
+ }
+ QString includes = includeslist.join(" ");
+ subProject->variables["INCLUDES"] = includes;
+ replaceMap.insert("INCLUDES", includes);
+
+ subProject->prefixes.clear();
+ for (QListViewItem *item = prefix_listview->firstChild();
+ item; item = item->nextSibling()) {
+ QString key = item->text(0);
+ QString data = item->text(1);
+ subProject->prefixes[key] = data;
+ replaceMap.insert(key + "dir", data);
+ }
+ /// \FIXME take removed prefixes into account
+
+ QStringList subdirslist;
+ for (QListViewItem *item = buildorder_listview->firstChild();
+ item; item = item->nextSibling())
+ subdirslist.append(item->text(0));
+ QString subdirs = subdirslist.join(" ");
+ kdDebug() << "New subdirs variable: " << subdirs << endl;
+ subProject->variables["SUBDIRS"] = subdirs;
+ replaceMap.insert("SUBDIRS", subdirs);
+
+ AutoProjectTool::setMakefileam(subProject->path + "/Makefile.am", replaceMap);
+}
+
+
+void SubprojectOptionsDialog::cflagsClicked()
+{
+ QString new_cflags = AutoProjectTool::execFlagsDialog(ccompiler, cflags_edit->text(), this);
+// if (!new_cflags.isNull())
+ cflags_edit->setText(new_cflags);
+}
+
+
+void SubprojectOptionsDialog::cxxFlagsClicked()
+{
+ QString new_cxxflags = AutoProjectTool::execFlagsDialog(cxxcompiler, cxxflags_edit->text(), this);
+// if (!new_cxxflags.isNull())
+ cxxflags_edit->setText(new_cxxflags);
+}
+
+
+void SubprojectOptionsDialog::fflagsClicked()
+{
+ QString new_fflags = AutoProjectTool::execFlagsDialog(f77compiler, fflags_edit->text(), this);
+// if (!new_fflags.isNull())
+ fflags_edit->setText(new_fflags);
+}
+
+
+void SubprojectOptionsDialog::insideMoveUpClicked()
+{
+ if (insideinc_listview->currentItem() == insideinc_listview->firstChild()) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ QListViewItem *item = insideinc_listview->firstChild();
+ while (item->nextSibling() != insideinc_listview->currentItem())
+ item = item->nextSibling();
+ item->moveItem(insideinc_listview->currentItem());
+}
+
+
+void SubprojectOptionsDialog::insideMoveDownClicked()
+{
+ if (insideinc_listview->currentItem() == 0 || insideinc_listview->currentItem()->nextSibling() == 0) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ insideinc_listview->currentItem()->moveItem(insideinc_listview->currentItem()->nextSibling());
+}
+
+
+void SubprojectOptionsDialog::outsideMoveUpClicked()
+{
+ if (outsideinc_listview->currentItem() == outsideinc_listview->firstChild()) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ QListViewItem *item = outsideinc_listview->firstChild();
+ while (item->nextSibling() != outsideinc_listview->currentItem())
+ item = item->nextSibling();
+ item->moveItem(outsideinc_listview->currentItem());
+}
+
+
+void SubprojectOptionsDialog::outsideMoveDownClicked()
+{
+ if (outsideinc_listview->currentItem() == 0 || outsideinc_listview->currentItem()->nextSibling() == 0) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ outsideinc_listview->currentItem()->moveItem(outsideinc_listview->currentItem()->nextSibling());
+}
+
+void SubprojectOptionsDialog::outsideAddClicked()
+{
+ KURLRequesterDlg dialog( "", i18n( "Add Include directory: Choose directory, give -Idirectory or use a variable with -I$(FOOBAR)" ), 0, 0 );
+ dialog.urlRequester() ->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
+ dialog.urlRequester() ->setURL( QString::null );
+ if ( dialog.exec() != QDialog::Accepted )
+ return ;
+ QString file = dialog.urlRequester() ->url();
+ if ( !file.isEmpty() )
+ {
+ if ( !file.isEmpty() )
+ {
+ if( file.startsWith("-I") )
+ new QListViewItem( outsideinc_listview, file );
+ else
+ {
+ new QListViewItem( outsideinc_listview, "-I"+file );
+ }
+ }
+ }
+}
+
+
+void SubprojectOptionsDialog::outsideEditClicked()
+{
+ if ( (outsideinc_listview->childCount()==0) || (outsideinc_listview->currentItem() == 0) )
+ return;
+ bool ok;
+ QString dir = KInputDialog::getText(i18n("Edit Include Directory"), i18n("Edit include directory:"),
+ outsideinc_listview->currentItem()-> text(0), &ok, 0);
+ if (ok && !dir.isEmpty())
+ outsideinc_listview->currentItem()-> setText(0, dir);
+}
+
+
+void SubprojectOptionsDialog::outsideRemoveClicked()
+{
+ delete outsideinc_listview->currentItem();
+}
+
+
+void SubprojectOptionsDialog::addPrefixClicked()
+{
+ AddPrefixDialog dlg;
+ if (!dlg.exec() || dlg.name().isEmpty() || dlg.path().isEmpty() )
+ return;
+
+ new QListViewItem(prefix_listview, dlg.name(), dlg.path());
+}
+
+
+void SubprojectOptionsDialog::editPrefixClicked()
+{
+ QListViewItem* lvItem = prefix_listview->currentItem();
+ if ( (prefix_listview->childCount()==0) || (lvItem == 0) )
+ return;
+ AddPrefixDialog dlg(lvItem-> text(0), lvItem-> text(1));
+ dlg.setCaption(i18n("Edit Prefix"));
+ if (!dlg.exec() || dlg.name().isEmpty() || dlg.path().isEmpty() )
+ return;
+ lvItem-> setText(0, dlg.name());
+ lvItem-> setText(1, dlg.path());
+}
+
+void SubprojectOptionsDialog::removePrefixClicked()
+{
+ delete prefix_listview->currentItem();
+}
+
+
+void SubprojectOptionsDialog::buildorderMoveUpClicked()
+{
+ if (buildorder_listview->currentItem() == buildorder_listview->firstChild()) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ QListViewItem *item = buildorder_listview->firstChild();
+ while (item->nextSibling() != buildorder_listview->currentItem())
+ item = item->nextSibling();
+ item->moveItem(buildorder_listview->currentItem());
+}
+
+
+void SubprojectOptionsDialog::buildorderMoveDownClicked()
+{
+ if (buildorder_listview->currentItem() == 0 || buildorder_listview->currentItem()->nextSibling() == 0) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ buildorder_listview->currentItem()->moveItem(buildorder_listview->currentItem()->nextSibling());
+}
+
+
+void SubprojectOptionsDialog::accept()
+{
+ storeConfig();
+ QDialog::accept();
+}
+
+#include "subprojectoptionsdlg.moc"
diff --git a/buildtools/autotools/subprojectoptionsdlg.h b/buildtools/autotools/subprojectoptionsdlg.h
new file mode 100644
index 00000000..7ec1fbf0
--- /dev/null
+++ b/buildtools/autotools/subprojectoptionsdlg.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _SUBPROJECTOPTIONSDLG_H_
+#define _SUBPROJECTOPTIONSDLG_H_
+
+#include "subprojectoptionsdlgbase.h"
+
+class AutoProjectPart;
+class AutoProjectWidget;
+class SubprojectItem;
+
+
+class SubprojectOptionsDialog : public SubprojectOptionsDialogBase
+{
+ Q_OBJECT
+
+public:
+ SubprojectOptionsDialog( AutoProjectPart *part, AutoProjectWidget *widget,
+ SubprojectItem *item, QWidget *parent = 0, const char *name = 0 );
+ ~SubprojectOptionsDialog();
+
+private:
+ virtual void cflagsClicked();
+ virtual void cxxFlagsClicked();
+ virtual void fflagsClicked();
+ virtual void insideMoveUpClicked();
+ virtual void insideMoveDownClicked();
+ virtual void outsideMoveUpClicked();
+ virtual void outsideMoveDownClicked();
+ virtual void outsideAddClicked();
+ virtual void outsideRemoveClicked();
+ virtual void outsideEditClicked();
+ virtual void addPrefixClicked();
+ virtual void editPrefixClicked();
+ virtual void removePrefixClicked();
+ virtual void buildorderMoveUpClicked();
+ virtual void buildorderMoveDownClicked();
+ virtual void accept();
+
+ void readConfig();
+ void storeConfig();
+
+ SubprojectItem *subProject;
+ AutoProjectWidget *m_widget;
+ AutoProjectPart *m_part;
+
+ QString ccompiler;
+ QString cxxcompiler;
+ QString f77compiler;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
+
diff --git a/buildtools/autotools/subprojectoptionsdlgbase.ui b/buildtools/autotools/subprojectoptionsdlgbase.ui
new file mode 100644
index 00000000..f2723e5a
--- /dev/null
+++ b/buildtools/autotools/subprojectoptionsdlgbase.ui
@@ -0,0 +1,989 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>SubprojectOptionsDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>sub project options widget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>442</width>
+ <height>437</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Subproject Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>subprojectoptions_tabwidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Co&amp;mpiler</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>cflags_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Compiler flags for C compiler (CFLA&amp;GS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>cflags_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cflags_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>cxxflags_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Compiler flags for C++ compiler (C&amp;XXFLAGS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>cxxflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>cxxflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cxxflags_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>fflags_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Compiler flags for Fortran compiler (&amp;FFLAGS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>fflags_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>fflags_button</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>30</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Includes</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>metasources_checkbox</cstring>
+ </property>
+ <property name="text">
+ <string>Automatically &amp;generate metasources</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>Layout9</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>insidemoveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>insidemovedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Down</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>insideinc_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Directories in&amp;side project:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>insideinc_listview</cstring>
+ </property>
+ </widget>
+ <widget class="QListView" row="1" column="0">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>insideinc_listview</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>Layout10</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsideadd_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsideedit_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsideremove_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsidemoveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move U&amp;p</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsidemovedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move Dow&amp;n</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Directories ou&amp;tside project:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>outsideinc_listview</cstring>
+ </property>
+ </widget>
+ <widget class="QListView" row="1" column="0">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>outsideinc_listview</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Prefixes</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="1" column="0">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Path</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>prefix_listview</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>prefixes_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>C&amp;ustom prefixes:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>prefix_listview</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>Layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addprefix_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>editprefix_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeprefix_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ <spacer>
+ <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>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Build Order</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>Layout9_2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer2_3_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buildmoveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buildmovedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Down</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3_2_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QListView" row="1" column="0">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>buildorder_listview</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>buildorder_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>O&amp;rder in which sub projects are built:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>buildorder_listview</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>cflags_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>cflagsClicked()</slot>
+ </connection>
+ <connection>
+ <sender>cxxflags_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>cxxFlagsClicked()</slot>
+ </connection>
+ <connection>
+ <sender>removeprefix_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>removePrefixClicked()</slot>
+ </connection>
+ <connection>
+ <sender>insidemoveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>insideMoveUpClicked()</slot>
+ </connection>
+ <connection>
+ <sender>insidemovedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>insideMoveDownClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsideadd_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>outsideAddClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsideedit_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>outsideEditClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsidemovedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>outsideMoveDownClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsidemoveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>outsideMoveUpClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsideremove_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>outsideRemoveClicked()</slot>
+ </connection>
+ <connection>
+ <sender>okbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>fflags_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>fflagsClicked()</slot>
+ </connection>
+ <connection>
+ <sender>buildmovedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>buildorderMoveDownClicked()</slot>
+ </connection>
+ <connection>
+ <sender>buildmoveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>buildorderMoveUpClicked()</slot>
+ </connection>
+ <connection>
+ <sender>addprefix_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>addPrefixClicked()</slot>
+ </connection>
+ <connection>
+ <sender>editprefix_button</sender>
+ <signal>clicked()</signal>
+ <receiver>sub project options widget</receiver>
+ <slot>editPrefixClicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>cflags_edit</tabstop>
+ <tabstop>cflags_button</tabstop>
+ <tabstop>cxxflags_edit</tabstop>
+ <tabstop>cxxflags_button</tabstop>
+ <tabstop>fflags_edit</tabstop>
+ <tabstop>fflags_button</tabstop>
+ <tabstop>subprojectoptions_tabwidget</tabstop>
+ <tabstop>metasources_checkbox</tabstop>
+ <tabstop>insideinc_listview</tabstop>
+ <tabstop>insidemoveup_button</tabstop>
+ <tabstop>insidemovedown_button</tabstop>
+ <tabstop>outsideinc_listview</tabstop>
+ <tabstop>outsideadd_button</tabstop>
+ <tabstop>outsideedit_button</tabstop>
+ <tabstop>outsideremove_button</tabstop>
+ <tabstop>outsidemoveup_button</tabstop>
+ <tabstop>outsidemovedown_button</tabstop>
+ <tabstop>prefix_listview</tabstop>
+ <tabstop>addprefix_button</tabstop>
+ <tabstop>editprefix_button</tabstop>
+ <tabstop>removeprefix_button</tabstop>
+ <tabstop>buildorder_listview</tabstop>
+ <tabstop>buildmoveup_button</tabstop>
+ <tabstop>buildmovedown_button</tabstop>
+ <tabstop>okbutton</tabstop>
+ <tabstop>cancelbutton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">buildorderMoveDownClicked()</slot>
+ <slot access="protected">cflagsClicked()</slot>
+ <slot access="protected">cxxFlagsClicked()</slot>
+ <slot access="protected">fflagsClicked()</slot>
+ <slot access="protected">insideMoveDownClicked()</slot>
+ <slot access="protected">insideMoveUpClicked()</slot>
+ <slot access="protected">buildorderMoveUpClicked()</slot>
+ <slot access="protected">outsideAddClicked()</slot>
+ <slot access="protected">outsideEditClicked()</slot>
+ <slot access="protected">outsideMoveDownClicked()</slot>
+ <slot access="protected">outsideMoveUpClicked()</slot>
+ <slot access="protected">outsideRemoveClicked()</slot>
+ <slot access="protected">removePrefixClicked()</slot>
+ <slot access="private">addPrefixClicked()</slot>
+ <slot access="private">editPrefixClicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/buildtools/autotools/targetoptionsdlg.cpp b/buildtools/autotools/targetoptionsdlg.cpp
new file mode 100644
index 00000000..c8d49c55
--- /dev/null
+++ b/buildtools/autotools/targetoptionsdlg.cpp
@@ -0,0 +1,357 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "targetoptionsdlg.h"
+
+#include <qcheckbox.h>
+#include <qheader.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qregexp.h>
+#include <klineedit.h>
+#include <kbuttonbox.h>
+#include <kdialog.h>
+#include <kinputdialog.h>
+#include <kurlrequesterdlg.h>
+#include <kurlrequester.h>
+#include <kurlcompletion.h>
+#include <klocale.h>
+#include <knotifyclient.h>
+#include <kfiledialog.h>
+#include "autolistviewitems.h"
+
+#include "misc.h"
+#include "autoprojectpart.h"
+#include "autoprojectwidget.h"
+#include "urlutil.h"
+
+TargetOptionsDialog::TargetOptionsDialog(AutoProjectWidget *widget, TargetItem *item,
+ QWidget *parent, const char *name)
+ : TargetOptionsDialogBase(parent, name, true)
+{
+ setCaption( i18n("Target Options for '%1'").arg(item->name) );
+ setIcon( SmallIcon("configure") );
+
+ target = item;
+ m_widget = widget;
+
+ if (item->primary == "PROGRAMS") {
+ insidelib_label->setText(i18n("Link convenience libraries inside project (LDADD)"));
+ outsidelib_label->setText(i18n("Link libraries outside project (LDADD)"));
+ }
+ else
+ argumentBox->setEnabled( false );
+// run_arguments_edit->setEnabled(false);
+
+ insidelib_listview->header()->hide();
+ outsidelib_listview->header()->hide();
+ insidelib_listview->setSorting(-1);
+ outsidelib_listview->setSorting(-1);
+
+
+ m_cwdEdit->completionObject()->setMode(KURLCompletion::DirCompletion);
+ m_cwdEdit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
+
+ // Insert all convenience libraries as possible linked libraries
+ QStringList l = widget->allLibraries();
+ QStringList::ConstIterator it;
+ QString fulltargetname = m_widget->subprojectDirectory() + "/" + item->name;
+ for (it = l.begin(); it != l.end(); ++it)
+ // Do not list the target itself (a target can not link with itself)
+ if ( !fulltargetname.endsWith(*it) )
+ (void) new QCheckListItem(insidelib_listview, *it, QCheckListItem::CheckBox);
+ readConfig();
+}
+
+
+TargetOptionsDialog::~TargetOptionsDialog()
+{}
+
+
+void TargetOptionsDialog::readConfig()
+{
+ QString flagsstr = target->ldflags;
+ flagsstr.replace(QRegExp("$(KDE_PLUGIN)"), "-avoid-version -module -no-undefined $(KDE_RPATH)");
+ QStringList l1 = QStringList::split(QRegExp("[ \t]"), flagsstr);
+ QStringList::Iterator l1it;
+
+ l1it = l1.find("-all-static");
+ if (l1it != l1.end()) {
+ allstatic_box->setChecked(true);
+ l1.remove(l1it);
+ }
+ l1it = l1.find("-avoid-version");
+ if (l1it != l1.end()) {
+ avoidversion_box->setChecked(true);
+ l1.remove(l1it);
+ }
+ l1it = l1.find("-module");
+ if (l1it != l1.end()) {
+ module_box->setChecked(true);
+ l1.remove(l1it);
+ }
+ l1it = l1.find("-no-undefined");
+ if (l1it != l1.end()) {
+ noundefined_box->setChecked(true);
+ l1.remove(l1it);
+ }
+ ldflagsother_edit->setText(l1.join(" "));
+ dependencies_edit->setText(target->dependencies);
+
+ QString addstr = (target->primary == "PROGRAMS")? target->ldadd : target->libadd;
+ QStringList l2 = QStringList::split(QRegExp("[ \t]"), addstr);
+
+ kdDebug(9020) << "ls=: " << addstr << endl;
+
+ bool inlistItem;
+ QListViewItem *lastItem = 0;
+ QStringList::Iterator l2it;
+ QCheckListItem *flitem = static_cast<QCheckListItem*>(insidelib_listview->firstChild());
+ for (l2it = l2.begin(); l2it != l2.end(); ++l2it) {
+ inlistItem = false;
+ QCheckListItem *clitem = static_cast<QCheckListItem*>(insidelib_listview->firstChild());
+ if (flitem) {
+ while (clitem) {
+ if (*l2it == ("$(top_builddir)/" + clitem->text())) {
+ clitem->setOn(true);
+ // move this item to the "top of the list"
+ if (flitem != clitem)
+ clitem->moveItem(flitem);
+ // move the "top of the list" one item down
+ flitem = static_cast<QCheckListItem*>(flitem->nextSibling());
+ inlistItem = true;
+ break;
+ }
+ clitem = static_cast<QCheckListItem*>(clitem->nextSibling());
+ }
+ }
+ if ( inlistItem == false ) {
+ QListViewItem *item = new QListViewItem(outsidelib_listview, *l2it);
+ if (lastItem)
+ item->moveItem(lastItem);
+ lastItem = item;
+ }
+ }
+
+ if (target->primary == "PROGRAMS")
+ {
+ run_arguments_edit->setText(DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/runarguments/" + target->name));
+ if( DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/cwd/" + target->name).isEmpty() )
+ {
+ m_cwdEdit->setURL( m_widget->m_part->buildDirectory()+"/"+URLUtil::getRelativePath(m_widget->m_part->topsourceDirectory(), m_widget->m_part->projectDirectory())+"/"+m_widget->activeDirectory() );
+ m_cwdEdit->fileDialog()->setURL( KURL::fromPathOrURL( m_widget->m_part->buildDirectory()+"/"+URLUtil::getRelativePath(m_widget->m_part->topsourceDirectory(), m_widget->m_part->projectDirectory())+"/"+m_widget->activeDirectory() ) );
+ }else
+ {
+ m_cwdEdit->setURL( DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/cwd/" + target->name) );
+ m_cwdEdit->fileDialog()->setURL( KURL::fromPathOrURL( DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/cwd/" + target->name) ) );
+ }
+ debug_arguments_edit->setText(DomUtil::readEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/debugarguments/" + target->name));
+ }
+}
+
+
+void TargetOptionsDialog::storeConfig()
+{
+ QStringList flagslist;
+ if (allstatic_box->isChecked())
+ flagslist.append("-all-static");
+ if (avoidversion_box->isChecked())
+ flagslist.append("-avoid-version");
+ if (module_box->isChecked())
+ flagslist.append("-module");
+ if (noundefined_box->isChecked())
+ flagslist.append("-no-undefined");
+ flagslist.append(ldflagsother_edit->text());
+ QString new_ldflags = flagslist.join(" ");
+
+ QStringList liblist;
+ QCheckListItem *clitem = static_cast<QCheckListItem*>(insidelib_listview->firstChild());
+ while (clitem) {
+ if( clitem->isOn() )
+ liblist.append("$(top_builddir)/" + clitem->text());
+ clitem = static_cast<QCheckListItem*>(clitem->nextSibling());
+ }
+ clitem = static_cast<QCheckListItem*>(outsidelib_listview->firstChild());
+ while (clitem) {
+ liblist.append(clitem->text());
+ clitem = static_cast<QCheckListItem*>(clitem->nextSibling());
+ }
+ QString new_addstr = liblist.join(" ");
+
+ QString canonname = AutoProjectTool::canonicalize(target->name);
+ QMap<QString, QString> replaceMap;
+
+ if (target->primary == "PROGRAMS") {
+ QString old_ldadd = target->ldadd;
+ if (new_addstr != old_ldadd) {
+ target->ldadd = new_addstr;
+ replaceMap.insert(canonname + "_LDADD", new_addstr);
+ }
+ }
+
+ if (target->primary == "LIBRARIES" || target->primary == "LTLIBRARIES") {
+ QString old_libadd = target->libadd;
+ if (new_addstr != old_libadd) {
+ target->libadd = new_addstr;
+ replaceMap.insert(canonname + "_LIBADD", new_addstr);
+ }
+ }
+
+ QString old_ldflags = target->ldflags;
+ if (new_ldflags != old_ldflags) {
+ target->ldflags = new_ldflags;
+ replaceMap.insert(canonname + "_LDFLAGS", new_ldflags);
+ }
+
+ QString new_dependencies = dependencies_edit->text();
+ QString old_dependencies = target->dependencies;
+ if (new_dependencies != old_dependencies) {
+ target->dependencies = new_dependencies;
+ if (!new_dependencies.isEmpty())
+ replaceMap.insert(canonname + "_DEPENDENCIES", new_dependencies);
+ }
+
+ // We can safely assume that this target is in the active sub project
+ AutoProjectTool::setMakefileam(m_widget->subprojectDirectory() + "/Makefile.am", replaceMap);
+
+ if (target->primary == "PROGRAMS")
+ {
+ DomUtil::writeEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/runarguments/" + target->name, run_arguments_edit->text());
+ DomUtil::writeEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/debugarguments/" + target->name, debug_arguments_edit->text());
+ DomUtil::writeEntry(*m_widget->m_part->projectDom(), "/kdevautoproject/run/cwd/" + target->name, m_cwdEdit->url());
+ }
+}
+
+
+void TargetOptionsDialog::insideMoveUpClicked()
+{
+ if (!insidelib_listview->currentItem())
+ return;
+ if (insidelib_listview->currentItem() == insidelib_listview->firstChild()) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ QListViewItem *item = insidelib_listview->firstChild();
+ while (item->nextSibling() != insidelib_listview->currentItem())
+ item = item->nextSibling();
+ item->moveItem(insidelib_listview->currentItem());
+}
+
+
+void TargetOptionsDialog::insideMoveDownClicked()
+{
+ if (!insidelib_listview->currentItem())
+ return;
+
+ if (insidelib_listview->currentItem()->nextSibling() == 0) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ insidelib_listview->currentItem()->moveItem(insidelib_listview->currentItem()->nextSibling());
+}
+
+
+void TargetOptionsDialog::outsideMoveUpClicked()
+{
+ if (!outsidelib_listview->currentItem())
+ return;
+ if (outsidelib_listview->currentItem() == outsidelib_listview->firstChild()) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ QListViewItem *item = outsidelib_listview->firstChild();
+ while (item->nextSibling() != outsidelib_listview->currentItem())
+ item = item->nextSibling();
+ item->moveItem(outsidelib_listview->currentItem());
+}
+
+
+void TargetOptionsDialog::outsideMoveDownClicked()
+{
+ if (!outsidelib_listview->currentItem())
+ return;
+ if (outsidelib_listview->currentItem()->nextSibling() == 0) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ outsidelib_listview->currentItem()->moveItem(outsidelib_listview->currentItem()->nextSibling());
+}
+
+
+void TargetOptionsDialog::outsideAddClicked()
+{
+ KURLRequesterDlg dialog( "", i18n( "Add Library: Choose the .a/.so file, give -l<libname> or use a variable with $(FOOBAR)" ), 0, 0 );
+ dialog.urlRequester() ->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly );
+ dialog.urlRequester() ->setFilter( "*.so|"+i18n("Shared Library (*.so)")+"\n*.a|"+i18n("Static Library (*.a)") );
+ dialog.urlRequester() ->setURL( QString::null );
+ dialog.urlRequester() ->completionObject() ->setDir( m_widget->selectedSubproject()->path );
+ dialog.urlRequester() ->fileDialog() ->setURL( KURL::fromPathOrURL( m_widget->selectedSubproject()->path ) );
+ if ( dialog.exec() != QDialog::Accepted )
+ return ;
+ QString file = dialog.urlRequester() ->url();
+ if ( !file.isEmpty() )
+ {
+ if ( !file.isEmpty() )
+ {
+ if( file.startsWith("-l") )
+ new QListViewItem( outsidelib_listview, file );
+ else
+ {
+ QFileInfo fi(file);
+ if( !fi.exists() )
+ new QListViewItem( outsidelib_listview, file );
+ if( fi.extension(false) == "a" )
+ {
+ new QListViewItem( outsidelib_listview, file );
+ }else if ( fi.extension(false) == "so" )
+ {
+ QString name = fi.fileName();
+ if( name.startsWith( "lib" ) )
+ name = name.mid(3);
+ name = "-l"+name.left( name.length() - 3 );
+ new QListViewItem( outsidelib_listview, name );
+ }
+ }
+ }
+ }
+}
+
+
+void TargetOptionsDialog::outsideEditClicked()
+{
+ if ( (outsidelib_listview->childCount()==0) || (outsidelib_listview->currentItem() == 0) )
+ return;
+ bool ok;
+ QString dir = KInputDialog::getText(i18n("Edit External Library"), i18n("Edit external library:"),
+ outsidelib_listview->currentItem()-> text(0), &ok, 0);
+ if (ok && !dir.isEmpty())
+ outsidelib_listview->currentItem()-> setText(0, dir);
+}
+
+
+void TargetOptionsDialog::outsideRemoveClicked()
+{
+ delete outsidelib_listview->currentItem();
+}
+
+
+void TargetOptionsDialog::accept()
+{
+ storeConfig();
+ QDialog::accept();
+}
+
+#include "targetoptionsdlg.moc"
+// kate: indent-mode csands; space-indent on; indent-width 4; replace-tabs on;
diff --git a/buildtools/autotools/targetoptionsdlg.h b/buildtools/autotools/targetoptionsdlg.h
new file mode 100644
index 00000000..c1dea20a
--- /dev/null
+++ b/buildtools/autotools/targetoptionsdlg.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+* Copyright (C) 2001 by Bernd Gehrmann *
+* bernd@kdevelop.org *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef _TARGETOPTIONSDLG_
+#define _TARGETOPTIONSDLG_
+
+#include "targetoptionsdlgbase.h"
+
+class AutoProjectWidget;
+class TargetItem;
+
+
+class TargetOptionsDialog : public TargetOptionsDialogBase
+{
+ Q_OBJECT
+
+public:
+ TargetOptionsDialog( AutoProjectWidget *widget, TargetItem *item,
+ QWidget *parent = 0, const char *name = 0 );
+ ~TargetOptionsDialog();
+
+private:
+ virtual void insideMoveUpClicked();
+ virtual void insideMoveDownClicked();
+ virtual void outsideMoveUpClicked();
+ virtual void outsideMoveDownClicked();
+ virtual void outsideAddClicked();
+ virtual void outsideEditClicked();
+ virtual void outsideRemoveClicked();
+ virtual void accept();
+
+ void readConfig();
+ void storeConfig();
+
+ TargetItem *target;
+ AutoProjectWidget *m_widget;
+};
+
+#endif
+// kate: indent-mode csands; tab-width 4;
+
diff --git a/buildtools/autotools/targetoptionsdlgbase.ui b/buildtools/autotools/targetoptionsdlgbase.ui
new file mode 100644
index 00000000..07487ac2
--- /dev/null
+++ b/buildtools/autotools/targetoptionsdlgbase.ui
@@ -0,0 +1,726 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>TargetOptionsDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>target_options_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>627</width>
+ <height>474</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Target Options</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget5</cstring>
+ </property>
+ <attribute name="title">
+ <string>Fl&amp;ags</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Li&amp;nker flags (LDFLAGS):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>allstatic_box</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout12</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>allstatic_box</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Do not link against shared libraries (-all-static)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>avoidversion_box</cstring>
+ </property>
+ <property name="text">
+ <string>Do not &amp;assign version numbers to libraries (-avoid-version)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>module_box</cstring>
+ </property>
+ <property name="text">
+ <string>Create a library that can &amp;be dynamically loaded (-module)</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>noundefined_box</cstring>
+ </property>
+ <property name="text">
+ <string>Library does not depend on external symbols (-no-&amp;undefined)</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout11</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>ldflagsother_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>O&amp;ther:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>ldflagsother_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>ldflagsother_edit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="2" column="2">
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Preferred</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer2</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>
+ <widget class="KLineEdit" row="4" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>dependencies_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>dependencies_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>E&amp;xplicit dependencies (DEPENDENCIES):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>dependencies_edit</cstring>
+ </property>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>Spacer3</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>
+ <spacer row="5" column="2">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget6</cstring>
+ </property>
+ <attribute name="title">
+ <string>Li&amp;braries</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>insidelib_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Lin&amp;k convenience libraries inside project (LIBADD):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>insidelib_listview</cstring>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>Spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>7</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QListView" row="4" column="0">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>outsidelib_listview</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>outsidelib_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Link libraries ou&amp;tside project (LIBADD):</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>outsidelib_listview</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>Layout9_3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>insidemoveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>insidemovedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Down</string>
+ </property>
+ </widget>
+ <spacer>
+ <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>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QListView" row="1" column="0">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>insidelib_listview</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="1">
+ <property name="name">
+ <cstring>Layout10_4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsideadd_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsideedit_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsideremove_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsidemoveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Mo&amp;ve Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>outsidemovedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move Dow&amp;n</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>arguments_page</cstring>
+ </property>
+ <attribute name="title">
+ <string>Ar&amp;guments</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>argumentBox</cstring>
+ </property>
+ <property name="title">
+ <string>Program Arguments (only valid for executable targets)</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>run_arguments_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>arguments_label_1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Run arguments:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>run_arguments_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="3" column="1">
+ <property name="name">
+ <cstring>m_cwdEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Working Directory:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>arguments_label_2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>&amp;Debug arguments:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>run_arguments_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>debug_arguments_edit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>120</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>okbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>insidemoveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>insideMoveUpClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsidemoveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>outsideMoveUpClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsidemovedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>outsideMoveDownClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsideadd_button</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>outsideAddClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsideedit_button</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>outsideEditClicked()</slot>
+ </connection>
+ <connection>
+ <sender>outsideremove_button</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>outsideRemoveClicked()</slot>
+ </connection>
+ <connection>
+ <sender>insidemovedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>target_options_dialog</receiver>
+ <slot>insideMoveDownClicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>allstatic_box</tabstop>
+ <tabstop>avoidversion_box</tabstop>
+ <tabstop>module_box</tabstop>
+ <tabstop>noundefined_box</tabstop>
+ <tabstop>ldflagsother_edit</tabstop>
+ <tabstop>dependencies_edit</tabstop>
+ <tabstop>tabWidget</tabstop>
+ <tabstop>insidelib_listview</tabstop>
+ <tabstop>insidemoveup_button</tabstop>
+ <tabstop>insidemovedown_button</tabstop>
+ <tabstop>outsidelib_listview</tabstop>
+ <tabstop>outsideadd_button</tabstop>
+ <tabstop>outsideedit_button</tabstop>
+ <tabstop>outsideremove_button</tabstop>
+ <tabstop>outsidemoveup_button</tabstop>
+ <tabstop>outsidemovedown_button</tabstop>
+ <tabstop>okbutton</tabstop>
+ <tabstop>cancelbutton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">insideMoveDownClicked()</slot>
+ <slot access="protected">insideMoveUpClicked()</slot>
+ <slot access="protected">outsideAddClicked()</slot>
+ <slot access="protected">outsideEditClicked()</slot>
+ <slot access="protected">outsideMoveDownClicked()</slot>
+ <slot access="protected">outsideMoveUpClicked()</slot>
+ <slot access="protected">outsideRemoveClicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>