1
/***************************************************************************
2
* Copyright (C) 2001-2002 by Bernd Gehrmann *
5
* Copyright (C) 2002 by Victor Roeder *
6
* victor_roeder@gmx.de *
8
* This program is free software; you can redistribute it and/or modify *
9
* it under the terms of the GNU General Public License as published by *
10
* the Free Software Foundation; either version 2 of the License, or *
11
* (at your option) any later version. *
13
***************************************************************************/
17
#include "autoprojectpart.h"
18
#include "autolistviewitems.h"
19
#include "configureoptionswidget.h"
20
#include "addtranslationdlg.h"
21
#include "addicondlg.h"
22
#include "autoprojectwidget.h"
26
#include <qfileinfo.h>
27
#include <qpopupmenu.h>
28
#include <qstringlist.h>
29
#include <qwhatsthis.h>
31
#include <qgroupbox.h>
34
#include <kapplication.h>
38
#include <kdialogbase.h>
39
#include <kiconloader.h>
41
#include <kmessagebox.h>
42
#include <kparts/part.h>
43
#include <kdeversion.h>
48
#include <kdevmakefrontend.h>
49
#include <kdevappfrontend.h>
50
#include <kdevmainwindow.h>
51
#include <kdevpartcontroller.h>
52
#include <makeoptionswidget.h>
53
#include <runoptionswidget.h>
54
#include <envvartools.h>
56
#include <configwidgetproxy.h>
57
#include <kdevplugininfo.h>
60
#define CONFIGURE_OPTIONS 1
62
#define MAKE_OPTIONS 3
64
static const KDevPluginInfo data("kdevautoproject");
66
K_EXPORT_COMPONENT_FACTORY( libkdevautoproject, AutoProjectFactory( data ) )
68
AutoProjectPart::AutoProjectPart(QObject *parent, const char *name, const QStringList &args)
69
: KDevBuildTool(&data, parent, name ? name : "AutoProjectPart")
70
, m_lastCompilationFailed(false)
72
setInstance(AutoProjectFactory::instance());
74
setXMLFile("kdevautoproject.rc");
76
m_executeAfterBuild = false;
77
m_isKDE = (args[0] == "kde");
78
m_needMakefileCvs = false;
80
m_widget = new AutoProjectWidget(this, m_isKDE);
81
m_widget->setIcon(SmallIcon( info()->icon() ));
82
m_widget->setCaption(i18n("Automake Manager"));
83
QWhatsThis::add(m_widget, i18n("<b>Automake manager</b><p>"
84
"The project tree consists of two parts. The 'overview' "
85
"in the upper half shows the subprojects, each one having a "
86
"Makefile.am. The 'details' view in the lower half shows the "
87
"targets and files for the subproject selected in the overview."));
89
mainWindow()->embedSelectViewRight(m_widget, i18n("Automake Manager"), i18n("Automake manager"));
92
action = new KAction( i18n("Add Translation..."), 0,
93
this, SLOT(slotAddTranslation()),
94
actionCollection(), "project_addtranslation" );
95
action->setToolTip(i18n("Add translation"));
96
action->setWhatsThis(i18n("<b>Add translation</b><p>Creates .po file for the selected language."));
97
action->setGroup("autotools");
101
action->setEnabled(false);
103
action = new KAction( i18n("&Build Project"), "make_kdevelop", Key_F8,
104
this, SLOT(slotBuild()),
105
actionCollection(), "build_build" );
106
action->setToolTip(i18n("Build project"));
107
action->setWhatsThis(i18n("<b>Build project</b><p>Runs <b>make</b> from the project directory.<br>"
108
"Environment variables and make arguments can be specified "
109
"in the project settings dialog, <b>Make Options</b> tab."));
110
action->setGroup("autotools");
112
action = new KAction( i18n("Build &Active Target"), "make_kdevelop", Key_F7,
113
this, SLOT(slotBuildActiveTarget()),
114
actionCollection(), "build_buildactivetarget" );
115
action->setToolTip(i18n("Build active target"));
116
action->setWhatsThis(i18n("<b>Build active target</b><p>Constructs a series of make commands to build an active target. "
117
"Also builds dependent targets.<br>"
118
"Environment variables and make arguments can be specified "
119
"in the project settings dialog, <b>Make Options</b> tab."));
120
action->setGroup("autotools");
122
action = new KAction( i18n("Compile &File"), "make_kdevelop",
123
this, SLOT(slotCompileFile()),
124
actionCollection(), "build_compilefile" );
125
action->setToolTip(i18n("Compile file"));
126
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>"
127
"Environment variables and make arguments can be specified "
128
"in the project settings dialog, <b>Make Options</b> tab."));
129
action->setGroup("autotools");
131
action = new KAction( i18n("Run Configure"), 0,
132
this, SLOT(slotConfigure()),
133
actionCollection(), "build_configure" );
134
action->setToolTip(i18n("Run configure"));
135
action->setWhatsThis(i18n("<b>Run configure</b><p>Executes <b>configure</b> with flags, arguments "
136
"and environment variables specified in the project settings dialog, "
137
"<b>Configure Options</b> tab."));
138
action->setGroup("autotools");
140
action = new KAction( i18n("Run automake && friends"), 0,
141
this, SLOT(slotMakefilecvs()),
142
actionCollection(), "build_makefilecvs" );
143
action->setToolTip(i18n("Run automake && friends"));
144
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."));
145
action->setGroup("autotools");
147
action = new KAction( i18n("Install"), 0,
148
this, SLOT(slotInstall()),
149
actionCollection(), "build_install" );
150
action->setToolTip(i18n("Install"));
151
action->setWhatsThis(i18n("<b>Install</b><p>Runs <b>make install</b> command from the project directory.<br>"
152
"Environment variables and make arguments can be specified "
153
"in the project settings dialog, <b>Make Options</b> tab."));
154
action->setGroup("autotools");
156
action = new KAction( i18n("Install (as root user)"), 0,
157
this, SLOT(slotInstallWithKdesu()),
158
actionCollection(), "build_install_kdesu" );
159
action->setToolTip(i18n("Install as root user"));
160
action->setWhatsThis(i18n("<b>Install</b><p>Runs <b>make install</b> command from the project directory with root privileges.<br>"
161
"It is executed via kdesu command.<br>"
162
"Environment variables and make arguments can be specified "
163
"in the project settings dialog, <b>Make Options</b> tab."));
164
action->setGroup("autotools");
166
action = new KAction( i18n("&Clean Project"), 0,
167
this, SLOT(slotClean()),
168
actionCollection(), "build_clean" );
169
action->setToolTip(i18n("Clean project"));
170
action->setWhatsThis(i18n("<b>Clean project</b><p>Runs <b>make clean</b> command from the project directory.<br>"
171
"Environment variables and make arguments can be specified "
172
"in the project settings dialog, <b>Make Options</b> tab."));
173
action->setGroup("autotools");
175
action = new KAction( i18n("&Distclean"), 0,
176
this, SLOT(slotDistClean()),
177
actionCollection(), "build_distclean" );
178
action->setToolTip(i18n("Distclean"));
179
action->setWhatsThis(i18n("<b>Distclean</b><p>Runs <b>make distclean</b> command from the project directory.<br>"
180
"Environment variables and make arguments can be specified "
181
"in the project settings dialog, <b>Make Options</b> tab."));
182
action->setGroup("autotools");
184
action = new KAction( i18n("Make Messages && Merge"), 0,
185
this, SLOT(slotMakeMessages()),
186
actionCollection(), "build_messages" );
187
action->setToolTip(i18n("Make messages && merge"));
188
action->setWhatsThis(i18n("<b>Make messages && merge</b><p>Runs <b>make package-messages</b> command from the project directory.<br>"
189
"Environment variables and make arguments can be specified "
190
"in the project settings dialog, <b>Make Options</b> tab."));
191
action->setGroup("autotools");
194
action->setEnabled(false);
196
buildConfigAction = new KSelectAction( i18n("Build Configuration"), 0,
197
actionCollection(), "project_configuration" );
198
buildConfigAction->setToolTip(i18n("Build configuration menu"));
199
buildConfigAction->setWhatsThis(i18n("<b>Build configuration menu</b><p>Allows to switch between project build configurations.<br>"
200
"Build configuration is a set of build and top source directory settings, "
201
"configure flags and arguments, compiler flags, etc.<br>"
202
"Modify build configurations in project settings dialog, <b>Configure Options</b> tab."));
203
buildConfigAction->setGroup("autotools");
205
QDomDocument &dom = *projectDom();
206
if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/run/disable_default")) {
207
//ok we handle the execute in this kpart
208
action = new KAction( i18n("Execute Program"), "exec", SHIFT+Key_F9,
209
this, SLOT(slotExecute()),
210
actionCollection(), "build_execute" );
211
action->setToolTip(i18n("Execute program"));
212
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."));
213
action->setGroup("autotools");
216
connect( buildConfigAction, SIGNAL(activated(const QString&)),
217
this, SLOT(slotBuildConfigChanged(const QString&)) );
218
connect( buildConfigAction->popupMenu(), SIGNAL(aboutToShow()),
219
this, SLOT(slotBuildConfigAboutToShow()) );
221
// connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(projectConfigWidget(KDialogBase*)) );
223
_configProxy = new ConfigWidgetProxy( core() );
224
_configProxy->createProjectConfigPage( i18n("Configure Options"), CONFIGURE_OPTIONS, info()->icon() );
225
_configProxy->createProjectConfigPage( i18n("Run Options"), RUN_OPTIONS, info()->icon() );
226
_configProxy->createProjectConfigPage( i18n("Make Options"), MAKE_OPTIONS, info()->icon() );
227
connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
228
this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
231
connect( makeFrontend(), SIGNAL(commandFinished(const QString&)),
232
this, SLOT(slotCommandFinished(const QString&)) );
233
connect( makeFrontend(), SIGNAL(commandFailed(const QString&)),
234
this, SLOT(slotCommandFailed(const QString&)) );
242
AutoProjectPart::~AutoProjectPart()
246
mainWindow()->removeView(m_widget);
253
void AutoProjectPart::insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int pagenumber )
255
switch ( pagenumber )
257
case CONFIGURE_OPTIONS:
259
ConfigureOptionsWidget *w2 = new ConfigureOptionsWidget(this, page );
260
connect( dlg, SIGNAL(okClicked()), w2, SLOT(accept()) );
266
QDomDocument &dom = *projectDom();
267
if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/run/disable_default"))
269
//ok we handle the execute in this kpart
270
RunOptionsWidget *w3 = new RunOptionsWidget(*projectDom(), "/kdevautoproject", buildDirectory(), page );
271
connect( dlg, SIGNAL(okClicked()), w3, SLOT(accept()) );
278
MakeOptionsWidget *w4 = new MakeOptionsWidget(*projectDom(), "/kdevautoproject", page );
279
connect( dlg, SIGNAL(okClicked()), w4, SLOT(accept()) );
285
void AutoProjectPart::openProject(const QString &dirName, const QString &projectName)
287
m_projectName = projectName;
288
m_projectPath =dirName;
290
m_widget->openProject(dirName);
292
QDomDocument &dom = *projectDom();
293
QString activeTarget = DomUtil::readEntry(dom, "/kdevautoproject/general/activetarget");
294
kdDebug(9020) << k_funcinfo << "activeTarget " << activeTarget << endl;
295
if (!activeTarget.isEmpty())
296
m_widget->setActiveTarget(activeTarget);
299
KMessageBox::information( m_widget, i18n("No active target specified, running the application will\n"
300
"not work until you make a target active in the Automake Manager\n"
301
"on the right side or use the Main Program options under\n"
302
"Project -> Project Options -> Run Options"), i18n("No active target specified"), "kdevelop_open_project_no_active_target");
305
KDevProject::openProject( dirName, projectName );
309
void AutoProjectPart::closeProject()
311
m_widget->closeProject();
315
QString AutoProjectPart::projectDirectory() const
317
return m_projectPath;
321
QString AutoProjectPart::projectName() const
323
return m_projectName;
327
/** Retuns a PairList with the run environment variables */
328
DomUtil::PairList AutoProjectPart::runEnvironmentVars() const
330
return DomUtil::readPairListEntry(*projectDom(), "/kdevautoproject/run/envvars", "envvar", "name", "value");
334
/** Retuns the currently selected run directory
335
* If no main Program was selected in the Run Options dialog
336
* use the currently active target instead to calculate it.
337
* The returned string can be:
338
* if /kdevautoproject/run/directoryradio == executable
339
* The directory where the executable is
340
* if /kdevautoproject/run/directoryradio == build
341
* The directory where the executable is relative to build directory
342
* if /kdevautoproject/run/directoryradio == custom
343
* The custom directory absolute path
345
QString AutoProjectPart::runDirectory() const
348
QDomDocument &dom = *projectDom();
351
if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() )
353
cwd = defaultRunDirectory("kdevautoproject");
356
cwd = DomUtil::readEntry( dom, "/kdevautoproject/run/cwd/"+m_widget->activeTarget()->name );
359
cwd = buildDirectory() +"/"+ URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) +"/"+m_widget->activeDirectory();
365
/** Retuns the currently selected main program
366
* If no main Program was selected in the Run Options dialog
367
* use the currently active target instead.
368
* The returned string can be:
369
* if /kdevautoproject/run/directoryradio == executable
370
* The executable name
371
* if /kdevautoproject/run/directoryradio == build
372
* The path to executable relative to build directory
373
* if /kdevautoproject/run/directoryradio == custom or relative == false
374
* The absolute path to executable
377
QString AutoProjectPart::mainProgram() const
379
QDomDocument * dom = projectDom();
381
if ( !dom ) return QString();
383
if( DomUtil::readBoolEntry(*dom, "/kdevautoproject/run/useglobalprogram", false) )
385
QString DomMainProgram = DomUtil::readEntry(*dom, "/kdevautoproject/run/mainprogram");
387
if ( DomMainProgram.isEmpty() ) return QString();
389
if ( DomMainProgram.startsWith("/") ) // assume absolute path
391
return DomMainProgram;
393
else // assume builddir relative path
395
QString relprojectpath = URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() );
396
if( !relprojectpath.isEmpty() )
397
relprojectpath = "/" + relprojectpath;
398
return buildDirectory() + relprojectpath + "/" + DomMainProgram;
402
else // If no Main Program was specified, return the active target
404
TargetItem* titem = m_widget->activeTarget();
407
KMessageBox::error( m_widget, i18n("There is no active target.\n"
408
"Unable to determine the main program."), i18n("No active target found") );
409
kdDebug ( 9020 ) << k_funcinfo << "Error! : There's no active target! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl;
410
return QString::null;
413
if ( titem->primary != "PROGRAMS" ) {
414
KMessageBox::error( m_widget, i18n("Active target \"%1\" is not binary ( %2 ).\n"
415
"Unable to determine the main program. If you want this\n"
416
"to be the active target, set a main program under\n"
417
"Project -> Project Options -> Run Options").arg(titem->name).arg(titem->primary), i18n("Active target is not a library") );
418
kdDebug ( 9020 ) << k_funcinfo << "Error! : Active target isn't binary (" << titem->primary << ") ! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl;
419
return QString::null;
422
QString relprojectpath = URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() );
423
if( !relprojectpath.isEmpty() )
424
relprojectpath = "/" + relprojectpath;
425
return buildDirectory() + relprojectpath + "/" + activeDirectory() + "/" + titem->name;
430
/** Retuns a QString with the debug command line arguments */
431
QString AutoProjectPart::debugArguments() const
433
QDomDocument &dom = *projectDom();
435
if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() )
437
return DomUtil::readEntry(dom, "/kdevautoproject/run/globaldebugarguments");
440
return DomUtil::readEntry(dom, "/kdevautoproject/run/debugarguments/" + m_widget->activeTarget()->name);
445
/** Retuns a QString with the run command line arguments */
446
QString AutoProjectPart::runArguments() const
448
QDomDocument &dom = *projectDom();
450
if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) || !m_widget->activeTarget() )
452
return DomUtil::readEntry(dom, "/kdevautoproject/run/programargs");
455
return DomUtil::readEntry(dom, "/kdevautoproject/run/runarguments/" + m_widget->activeTarget()->name);
460
QString AutoProjectPart::activeDirectory() const
462
return m_widget->activeDirectory();
466
QStringList AutoProjectPart::allFiles() const
468
return m_widget->allFiles();
472
void AutoProjectPart::setWantautotools()
474
QDomDocument &dom = *projectDom();
475
QDomElement el = DomUtil::elementByPath(dom, "/kdevautoproject/make");
476
if ( el.namedItem("envvars").isNull() ) {
477
DomUtil::PairList list;
478
list << DomUtil::Pair("WANT_AUTOCONF_2_5", "1");
479
list << DomUtil::Pair("WANT_AUTOMAKE_1_6", "1");
480
DomUtil::writePairListEntry(dom, "/kdevautoproject/make/envvars", "envvar", "name", "value", list);
485
QString AutoProjectPart::makeEnvironment() const
487
// Get the make environment variables pairs into the environstr string
488
// in the form of: "ENV_VARIABLE=ENV_VALUE"
489
// Note that we quote the variable value due to the possibility of
491
DomUtil::PairList envvars =
492
DomUtil::readPairListEntry(*projectDom(), "/kdevautoproject/make/envvars", "envvar", "name", "value");
495
DomUtil::PairList::ConstIterator it;
496
for (it = envvars.begin(); it != envvars.end(); ++it)
498
environstr += (*it).first;
500
environstr += EnvVarTools::quote((*it).second);
504
KConfigGroup grp( kapp->config(), "MakeOutputView" );
505
if( grp.readBoolEntry( "ForceCLocale", true ) )
506
environstr += "LC_MESSAGES="+EnvVarTools::quote("C")+" "+"LC_CTYPE="+EnvVarTools::quote("C")+" ";
512
void AutoProjectPart::addFile(const QString &fileName)
514
QStringList fileList;
515
fileList.append ( fileName );
517
this->addFiles ( fileList );
520
void AutoProjectPart::addFiles ( const QStringList& fileList )
522
QString directory, name;
523
QStringList::ConstIterator it;
524
bool messageBoxShown = false;
526
for ( it = fileList.begin(); it != fileList.end(); ++it )
528
int pos = ( *it ).findRev('/');
531
directory = ( *it ).left(pos);
532
name = ( *it ).mid(pos+1);
540
if (directory != m_widget->activeDirectory() ||
543
if ( !messageBoxShown )
545
KMessageBox::information(m_widget, i18n("The directory you selected is not the active directory.\n"
546
"You should 'activate' the target you're currently working on in Automake Manager.\n"
547
"Just right-click a target and choose 'Make Target Active'."),
548
i18n ( "No Active Target Found" ), "No automake manager active target warning" );
549
messageBoxShown = true;
554
m_widget->addFiles(fileList);
557
void AutoProjectPart::removeFile(const QString &fileName)
559
QStringList fileList;
560
fileList.append ( fileName );
562
this->removeFiles ( fileList );
565
void AutoProjectPart::removeFiles ( const QStringList& fileList )
567
/// \FIXME m_widget->removeFiles does nothing!
568
m_widget->removeFiles ( fileList );
570
emit removedFilesFromProject ( fileList );
573
QStringList AutoProjectPart::allBuildConfigs() const
575
QDomDocument &dom = *projectDom();
577
QStringList allConfigs;
578
allConfigs.append("default");
580
QDomNode node = dom.documentElement().namedItem("kdevautoproject").namedItem("configurations");
581
QDomElement childEl = node.firstChild().toElement();
582
while (!childEl.isNull())
584
QString config = childEl.tagName();
585
kdDebug(9020) << k_funcinfo << "Found config " << config << endl;
586
if (config != "default")
587
allConfigs.append(config);
588
childEl = childEl.nextSibling().toElement();
595
QString AutoProjectPart::currentBuildConfig() const
597
QDomDocument &dom = *projectDom();
599
QString config = DomUtil::readEntry(dom, "/kdevautoproject/general/useconfiguration");
600
if (config.isEmpty() || !allBuildConfigs().contains(config))
607
QString AutoProjectPart::buildDirectory() const
609
QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/";
611
QString builddir = DomUtil::readEntry(*projectDom(), prefix + "builddir");
612
if (builddir.isEmpty())
613
return topsourceDirectory();
614
else if (builddir.startsWith("/"))
617
return projectDirectory() + "/" + builddir;
620
QString AutoProjectPart::topsourceDirectory() const
622
QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/";
624
QString topsourcedir = DomUtil::readEntry(*projectDom(), prefix + "topsourcedir");
625
if (topsourcedir.isEmpty())
626
return projectDirectory();
627
else if (topsourcedir.startsWith("/"))
630
return projectDirectory() + "/" + topsourcedir;
633
QString AutoProjectPart::constructMakeCommandLine(const QString &dir, const QString &target) const
638
kdDebug(9020) << k_funcinfo << "Looking for Makefile in " << dir << endl;
639
if ( !QFile::exists(dir + "/GNUmakefile") && !QFile::exists(dir + "/makefile")
640
&& ! QFile::exists(dir + "/Makefile") )
642
if (!QFile::exists(buildDirectory() + "/configure"))
644
int r = KMessageBox::questionYesNo(m_widget, i18n("%1\nThere is no Makefile in this directory\n"
645
"and no configure script for this project.\n"
646
"Run automake & friends and configure first?").arg(buildDirectory()), QString::null, i18n("Run Them"), i18n("Do Not Run"));
647
if (r == KMessageBox::No)
648
return QString::null;
649
preCommand = makefileCvsCommand();
650
if (preCommand.isNull())
651
return QString::null;
652
preCommand += " && ";
653
preCommand += configureCommand() + " && ";
657
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"));
658
if (r == KMessageBox::No)
659
return QString::null;
660
preCommand = configureCommand() + " && ";
663
QDomDocument &dom = *projectDom();
665
QString cmdline = DomUtil::readEntry(dom, "/kdevautoproject/make/makebin");
666
int prio = DomUtil::readIntEntry(dom, "/kdevautoproject/make/prio");
668
kdDebug(9020) << k_funcinfo << "nice = " << prio<< endl;
671
nice = QString("nice -n%1 ").arg(prio);
674
if (cmdline.isEmpty())
675
cmdline = MAKE_COMMAND;
676
if (!DomUtil::readBoolEntry(dom, "/kdevautoproject/make/abortonerror"))
678
bool runmultiple = DomUtil::readBoolEntry(dom, "/kdevautoproject/make/runmultiplejobs");
679
int jobs = DomUtil::readIntEntry(dom, "/kdevautoproject/make/numberofjobs");
680
if (runmultiple && jobs != 0)
683
cmdline += QString::number(jobs);
685
if (DomUtil::readBoolEntry(dom, "/kdevautoproject/make/dontact"))
690
cmdline.prepend(nice);
691
cmdline.prepend(makeEnvironment());
693
QString dircmd = "cd ";
694
dircmd += KProcess::quote(dir);
697
return preCommand + dircmd + cmdline;
701
void AutoProjectPart::startMakeCommand(const QString &dir, const QString &target, bool withKdesu)
703
if (partController()->saveAllFiles()==false)
704
return; //user cancelled
705
kdDebug(9020) << "startMakeCommand:" << dir << ": "<< target << endl;
706
m_buildCommand = constructMakeCommandLine(dir, target);
709
m_buildCommand = "kdesu -t -c '" + m_buildCommand + "'";
711
if (!m_buildCommand.isNull())
712
makeFrontend()->queueCommand(dir, m_buildCommand);
716
/** Adds the make command for the libraries that the target depends on
717
* to the make frontend queue (this is a recursive function) */
718
bool AutoProjectPart::queueInternalLibDependenciesBuild(TargetItem* titem, QStringList& alreadyScheduledDeps)
721
QString addstr = (titem->primary == "PROGRAMS")? titem->ldadd : titem->libadd;
722
QStringList l2 = QStringList::split(QRegExp("[ \t]"), addstr); // list of dependencies
723
QString tdir; // temp target directory
724
QString tname; // temp target name
725
QString tcmd; // temp command line
726
QStringList::Iterator l2it;
727
for (l2it = l2.begin(); l2it != l2.end(); ++l2it)
729
QString dependency = *l2it;
730
if (dependency.startsWith("$(top_builddir)/"))
732
// These are the internal libraries
733
dependency.remove("$(top_builddir)/");
735
if( !alreadyScheduledDeps.contains(*l2it) )
737
alreadyScheduledDeps << *l2it;
738
tdir = buildDirectory();
739
if (!tdir.endsWith("/") && !tdir.isEmpty())
741
int pos = dependency.findRev('/');
748
tdir += dependency.left(pos+1);
749
tname = dependency.mid(pos+1);
751
kdDebug(9020) << "Scheduling : <" << tdir << "> target <" << tname << ">" << endl;
752
// Recursively queue the dependencies for building
753
SubprojectItem *spi = m_widget->subprojectItemForPath( dependency.left(pos) );
756
QPtrList< TargetItem > tl = spi->targets;
757
// Cycle through the list of targets to find the one we're looking for
758
TargetItem *ti = tl.first();
761
if (ti->name == tname)
763
// found it: queue it and stop looking
764
if( !queueInternalLibDependenciesBuild(ti, alreadyScheduledDeps) )
773
kdDebug(9020) << "queueInternalLibDependenciesBuild:" << tdir << ": "<< tname << endl;
774
tcmd = constructMakeCommandLine(tdir, tname);
777
makeFrontend()->queueCommand( tdir, tcmd);
781
//Message box about circular deps.
782
tdir = buildDirectory();
783
if (!tdir.endsWith("/") && !tdir.isEmpty())
785
int pos = dependency.findRev('/');
792
tdir += dependency.left(pos+1);
793
tname = dependency.mid(pos+1);
795
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") );
804
void AutoProjectPart::slotBuild()
806
//m_lastCompilationFailed = false;
808
if( m_needMakefileCvs )
812
m_needMakefileCvs = false;
815
startMakeCommand(buildDirectory(), QString::fromLatin1(""));
819
void AutoProjectPart::buildTarget(QString relpath, TargetItem* titem)
825
//m_lastCompilationFailed = false;
827
// Calculate the complete name of the target and store it in name
828
QString name = titem->name;
829
if ( titem->primary == "KDEDOCS" )
830
name = "index.cache.bz2";
832
// Calculate the full path of the target and store it in path
833
QString path = buildDirectory();
834
if (!path.endsWith("/") && !path.isEmpty())
836
if (relpath.at(0) == '/')
837
path += relpath.mid(1);
841
// Save all files once
842
partController()->saveAllFiles();
844
// Add the make command for the libraries that the target depends on to the make frontend queue
845
// if this recursive behavour is un-wanted comment the next line
847
if( !queueInternalLibDependenciesBuild(titem, deps) )
850
// Calculate the "make" command line for the target
851
//QString relpath = dir.path().mid( projectDirectory().length() );
852
m_runProg=buildDirectory() + "/" + relpath+"/"+name;
853
kdDebug(9020) << "buildTarget:" << buildDirectory()<< endl;
854
kdDebug(9020) << "buildTarget:" << relpath << " " << path << ": "<< name << " : " << m_runProg << endl;
855
QString tcmd = constructMakeCommandLine( path, name );
860
m_buildCommand = tcmd;
861
makeFrontend()->queueCommand( path, tcmd);
866
void AutoProjectPart::slotBuildActiveTarget()
868
// Get a pointer to the active target
869
TargetItem* titem = m_widget->activeTarget();
875
buildTarget( URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + activeDirectory(), titem);
879
void AutoProjectPart::slotCompileFile()
881
KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
882
if (!part || !part->url().isLocalFile())
885
QString fileName = part->url().path();
886
QFileInfo fi(fileName);
887
QString sourceDir = fi.dirPath();
888
QString baseName = fi.baseName(true);
889
kdDebug(9020) << "Compiling " << fileName
890
<< " in dir " << sourceDir
891
<< " with baseName " << baseName << endl;
893
QString projectDir = projectDirectory();
894
if (!sourceDir.startsWith(projectDir)) {
895
KMessageBox::sorry(m_widget, i18n("Can only compile files in directories which belong to the project."));
899
QString buildDir = buildDirectory() + sourceDir.mid(projectDir.length());
900
QString target = baseName + ".lo";
901
kdDebug(9020) << "builddir " << buildDir << ", target " << target << endl;
903
startMakeCommand(buildDir, target);
906
QString AutoProjectPart::configureCommand() const
908
QDomDocument &dom = *projectDom();
909
QString prefix = "/kdevautoproject/configurations/" + currentBuildConfig() + "/";
911
QString cmdline = "\"" + topsourceDirectory();
912
cmdline += "/configure\"";
913
QString cc = DomUtil::readEntry(dom, prefix + "ccompilerbinary");
915
cmdline.prepend(QString("CC=%1 ").arg(cc));
916
QString cflags = DomUtil::readEntry(dom, prefix + "cflags");
917
if (!cflags.isEmpty())
918
cmdline.prepend(QString("CFLAGS=\"%1\" ").arg(cflags));
919
QString cxx = DomUtil::readEntry(dom, prefix + "cxxcompilerbinary");
921
cmdline.prepend(QString("CXX=%1 ").arg(cxx));
922
QString cxxflags = DomUtil::readEntry(dom, prefix + "cxxflags");
923
if (!cxxflags.isEmpty())
924
cmdline.prepend(QString("CXXFLAGS=\"%1\" ").arg(cxxflags));
925
QString f77 = DomUtil::readEntry(dom, prefix + "f77compilerbinary");
927
cmdline.prepend(QString("F77=%1 ").arg(f77));
928
QString fflags = DomUtil::readEntry(dom, prefix + "f77flags");
929
if (!fflags.isEmpty())
930
cmdline.prepend(QString("FFLAGS=\"%1\" ").arg(fflags));
931
QString cppflags = DomUtil::readEntry(dom, prefix + "cppflags");
932
if (!cppflags.isEmpty())
933
cmdline.prepend(QString("CPPFLAGS=\"%1\" ").arg(cppflags));
934
QString ldflags = DomUtil::readEntry(dom, prefix + "ldflags");
935
if (!ldflags.isEmpty())
936
cmdline.prepend(QString("LDFLAGS=\"%1\" ").arg(ldflags));
938
QString configargs = DomUtil::readEntry(dom, prefix + "configargs");
939
if (!configargs.isEmpty()) {
941
cmdline += configargs;
944
DomUtil::PairList envvars =
945
DomUtil::readPairListEntry(*projectDom(), prefix + "envvars", "envvar", "name", "value");
948
DomUtil::PairList::ConstIterator it;
949
for (it = envvars.begin(); it != envvars.end(); ++it) {
950
environstr += (*it).first;
952
environstr += EnvVarTools::quote((*it).second);
955
cmdline.prepend(environstr);
957
QString builddir = buildDirectory();
960
// if the build directory doesn't exist, add it's creation to the configureCommand
961
if ( !QFile::exists(builddir)) {
963
dircmd += KProcess::quote(builddir);
967
// add "cd into the build directory" to the configureCommand
969
dircmd += KProcess::quote(builddir);
972
return dircmd + cmdline;
975
void AutoProjectPart::slotConfigure()
977
QString cmdline = configureCommand();
978
if (cmdline.isNull())
981
makeFrontend()->queueCommand(buildDirectory(), cmdline);
984
QString AutoProjectPart::makefileCvsCommand() const
986
kdDebug(9020) << "makefileCvsCommand: runDirectory :" << runDirectory() << ":" <<endl;
987
kdDebug(9020) << "makefileCvsCommand: topsourceDirectory :" << topsourceDirectory() << ":" <<endl;
988
kdDebug(9020) << "makefileCvsCommand: makeEnvironment :" << makeEnvironment() << ":" <<endl;
989
kdDebug(9020) << "makefileCvsCommand: currentBuildConfig :" << currentBuildConfig() << ":" <<endl;
992
QString cmdline = DomUtil::readEntry(*projectDom(), "/kdevautoproject/make/makebin");
993
if (cmdline.isEmpty())
994
cmdline = MAKE_COMMAND;
996
int prio = DomUtil::readIntEntry(*projectDom(), "/kdevautoproject/make/prio");
998
kdDebug(9020) << "makefileCvsCommand() nice = " << prio<< endl;
1000
nice = QString("nice -n%1 ").arg(prio);
1003
if (QFile::exists(topsourceDirectory() + "/Makefile.cvs"))
1004
cmdline += " -f Makefile.cvs";
1005
else if (QFile::exists(topsourceDirectory() + "/Makefile.dist"))
1006
cmdline += " -f Makefile.dist";
1007
else if (QFile::exists(topsourceDirectory() + "/autogen.sh"))
1008
cmdline = "./autogen.sh";
1010
KMessageBox::sorry(m_widget, i18n("There is neither a Makefile.cvs file nor an "
1011
"autogen.sh script in the project directory."));
1012
return QString::null;
1015
cmdline.prepend(nice);
1016
cmdline.prepend(makeEnvironment());
1018
QString dircmd = "cd ";
1019
dircmd += KProcess::quote(topsourceDirectory());
1022
return dircmd + cmdline;
1025
void AutoProjectPart::slotMakefilecvs()
1027
QString cmdline = makefileCvsCommand();
1028
if ( cmdline.isNull() )
1031
makeFrontend()->queueCommand(projectDirectory(), cmdline);
1035
void AutoProjectPart::slotInstall()
1037
startMakeCommand(buildDirectory(), QString::fromLatin1("install"));
1041
void AutoProjectPart::slotInstallWithKdesu()
1043
// First issue "make" to build the entire project with the current user
1044
// This way we make sure all files are up to date before we do the "make install"
1047
// After that issue "make install" with the root user
1048
startMakeCommand(buildDirectory(), QString::fromLatin1("install"), true);
1052
void AutoProjectPart::slotClean()
1054
startMakeCommand(buildDirectory(), QString::fromLatin1("clean"));
1058
void AutoProjectPart::slotDistClean()
1060
startMakeCommand(buildDirectory(), QString::fromLatin1("distclean"));
1064
void AutoProjectPart::slotMakeMessages()
1066
startMakeCommand(buildDirectory(), QString::fromLatin1("package-messages"));
1070
/** Checks if the currently selected main program or,
1071
* if no main Program was selected in the Run Options dialog,
1072
* the currently active target is up-to-date and builds it if necessary.
1073
* In the end checks if the program is already running and if not calls the
1074
* slotExecute2() function to execute it or asks the user what to do.
1076
void AutoProjectPart::slotExecute()
1078
partController()->saveAllFiles();
1079
QDomDocument &dom = *projectDom();
1081
m_runProg=m_runProg.isEmpty()?mainProgram():m_runProg;
1084
if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autocompile", true) && isDirty() ){
1085
m_executeAfterBuild = true;
1086
if ( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/useglobalprogram", false) ){
1087
// A Main Program was specified, build all targets because we don't know which is it
1088
kdDebug(9020) << "slotExecute: before slotBuild" << endl;
1093
// If no Main Program was specified, build the active target
1094
kdDebug(9020) << "slotExecute: before slotBuildActiveTarget" << endl;
1095
slotBuildActiveTarget();
1100
if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autoinstall", false) && isDirty() ){
1101
m_executeAfterBuild = true;
1103
if( DomUtil::readBoolEntry(dom, "/kdevautoproject/run/autokdesu", false) ){
1104
//slotInstallWithKdesu assumes that it hasn't just been build...
1105
kdDebug(9020) << "slotExecute: before startMakeCommand" << endl;
1106
_auto ? slotInstallWithKdesu() : startMakeCommand(buildDirectory(), QString::fromLatin1("install"), true);
1109
kdDebug(9020) << "slotExecute: before slotInstall" << endl;
1116
m_runProg.truncate(0);
1120
if (appFrontend()->isRunning()) {
1121
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)
1123
connect(appFrontend(), SIGNAL(processExited()), SLOT(slotExecute2()));
1124
appFrontend()->stopApplication();
1127
kdDebug(9020) << "slotExecute: before slotExecute2" << endl;
1131
void AutoProjectPart::executeTarget(const QDir& dir, const TargetItem* titem)
1133
m_executeAfterBuild=true;
1134
partController()->saveAllFiles();
1136
bool is_dirty = false;
1137
QDateTime t = QFileInfo(dir , titem->name ).lastModified();
1138
QPtrListIterator<FileItem> it( titem->sources );
1139
for( ; it.current() ; ++it )
1141
if( t < QFileInfo(dir , (*it)->name).lastModified())
1145
if( DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/autocompile", true) && is_dirty )
1147
connect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteTargetAfterBuild(const QString&)) );
1148
connect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotNotExecuteTargetAfterBuildFailed(const QString&)) );
1150
m_runProg=titem->name;
1151
m_executeTargetAfterBuild.first = dir;
1152
m_executeTargetAfterBuild.second = const_cast<TargetItem*>(titem);
1154
QString relpath = "/" + URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + m_widget->selectedSubproject()->subdir;
1155
kdDebug(9020) << "executeTarget: before buildTarget " << relpath << endl;
1156
buildTarget(relpath, const_cast<TargetItem*>(titem));
1161
bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/terminal");
1163
QString program = environString();
1166
KMessageBox::error( m_widget, i18n("There is no active target.\n"
1167
"Unable to determine the main program"), i18n("No active target found") );
1168
kdDebug ( 9020 ) << k_funcinfo << "Error! : There's no active target! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl;
1169
program += titem->name;
1170
}else if ( titem->primary != "PROGRAMS" ) {
1171
KMessageBox::error( m_widget, i18n("Active target \"%1\" is not binary ( %2 ).\n"
1172
"Unable to determine the main program. If you want this\n"
1173
"to be the active target, set a main program under\n"
1174
"Project -> Project Options -> Run Options").arg(titem->name).arg(titem->primary), i18n("Active target is not a library") );
1175
kdDebug ( 9020 ) << k_funcinfo << "Error! : Active target isn't binary (" << titem->primary << ") ! -> Unable to determine the main program in AutoProjectPart::mainProgram()" << endl;
1176
program += titem->name;
1178
program += buildDirectory() + "/" + URLUtil::getRelativePath( topsourceDirectory(), projectDirectory() ) + "/" + m_widget->selectedSubproject()->relativePath()+ "/" + titem->name;
1180
QString args = DomUtil::readEntry(*projectDom(), "/kdevautoproject/run/runarguments/" + titem->name);
1182
program += " " + args;
1183
kdDebug(9020) << "executeTarget:cmd=" << dir.path() << " " << program << endl;
1184
appFrontend()->startAppCommand(dir.path(), program ,inTerminal);
1185
m_executeAfterBuild=false;
1189
void AutoProjectPart::slotExecuteTargetAfterBuild(const QString& command)
1191
kdDebug(9020) << "slotExecuteTargetAfterBuild " << command << endl;
1192
if ( m_executeAfterBuild && constructMakeCommandLine(m_executeTargetAfterBuild.first.path(), m_executeTargetAfterBuild.second->name) == command )
1194
disconnect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteAfterTargetBuild()) );
1195
disconnect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotExecuteAfterTargetBuildFailed()) );
1196
kdDebug(9020) << "slotExecuteTargetAfterBuild " << endl;
1197
executeTarget(m_executeTargetAfterBuild.first, m_executeTargetAfterBuild.second);
1202
void AutoProjectPart::slotNotExecuteTargetAfterBuildFailed(const QString& command)
1204
kdDebug(9020) << "executeTargetAfterBuildFailed" << endl;
1205
if ( constructMakeCommandLine(m_executeTargetAfterBuild.first.path(), m_executeTargetAfterBuild.second->name) == command )
1207
m_executeAfterBuild=false;
1208
disconnect( makeFrontend(), SIGNAL(commandFinished(const QString&)), this, SLOT(slotExecuteTargetAfterBuild()) );
1209
disconnect( makeFrontend(), SIGNAL(commandFailed(const QString&)), this, SLOT(slotNotExecuteTargetAfterBuildFailed()) );
1214
/* Get the run environment variables pairs into the environstr string
1215
* in the form of: "ENV_VARIABLE=ENV_VALUE"
1216
* Note that we quote the variable value due to the possibility of
1217
* embedded spaces. */
1218
QString AutoProjectPart::environString() const
1220
DomUtil::PairList envvars = runEnvironmentVars();
1222
DomUtil::PairList::ConstIterator it;
1223
for (it = envvars.begin(); it != envvars.end(); ++it) {
1224
environstr += (*it).first;
1226
environstr += EnvVarTools::quote((*it).second);
1232
/** Executes the currently selected main program.
1233
* If no main Program was selected in the Run Options dialog
1234
* the currently active target is executed instead.
1236
void AutoProjectPart::slotExecute2()
1238
disconnect(appFrontend(), SIGNAL(processExited()), this, SLOT(slotExecute2()));
1240
if (m_runProg.isEmpty()){
1241
// Do not execute non executable targets
1245
QString program = environString();
1246
// Adds the ./ that is necessary to execute the program in bash shells
1247
if (!m_runProg.startsWith("/")){
1250
program += m_runProg;
1251
program += " " + runArguments();
1253
bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevautoproject/run/terminal");
1255
kdDebug(9020) << "slotExecute2: runDirectory: <" << runDirectory() << ">" <<endl;
1256
kdDebug(9020) << "slotExecute2: environstr : <" << environString() << ">" <<endl;
1257
kdDebug(9020) << "slotExecute2: mainProgram : <" << mainProgram() << ">" <<endl;
1258
kdDebug(9020) << "slotExecute2: runArguments: <" << runArguments() << ">" <<endl;
1259
kdDebug(9020) << "slotExecute2: program : <" << program << ">" <<endl;
1261
appFrontend()->startAppCommand(runDirectory(), program, inTerminal);
1262
m_executeAfterBuild=false;
1263
m_runProg.truncate(0);
1267
void AutoProjectPart::slotAddTranslation()
1269
AddTranslationDialog dlg(this, m_widget);
1274
void AutoProjectPart::slotBuildConfigChanged(const QString &config)
1276
DomUtil::writeEntry(*projectDom(), "/kdevautoproject/general/useconfiguration", config);
1277
kdDebug(9020) << "Changed used configuration to " << config << endl;
1281
void AutoProjectPart::slotBuildConfigAboutToShow()
1283
QStringList l = allBuildConfigs();
1284
buildConfigAction->setItems(l);
1285
buildConfigAction->setCurrentItem(l.findIndex(currentBuildConfig()));
1288
void AutoProjectPart::restorePartialProjectSession ( const QDomElement* el )
1290
m_widget->restoreSession ( el );
1293
void AutoProjectPart::savePartialProjectSession ( QDomElement* el )
1295
QDomDocument domDoc = el->ownerDocument();
1297
KMessageBox::information ( 0, "Hallo, Welt!" );
1299
kdDebug ( 9020 ) << k_funcinfo << "1" << endl;
1301
if ( domDoc.isNull() )
1303
kdDebug ( 9020 ) << k_funcinfo << "2" << endl;
1307
kdDebug ( 9020 ) << k_funcinfo << "3" << endl;
1309
m_widget->saveSession ( el );
1312
void AutoProjectPart::slotCommandFinished( const QString& command )
1314
kdDebug(9020) << k_funcinfo << endl;
1316
if( m_buildCommand != command )
1319
m_buildCommand = QString::null;
1321
m_timestamp.clear();
1322
QStringList fileList = allFiles();
1323
QStringList::Iterator it = fileList.begin();
1324
while( it != fileList.end() ){
1325
QString fileName = *it;
1328
m_timestamp[ fileName ] = QFileInfo( projectDirectory(), fileName ).lastModified();
1331
emit projectCompiled();
1333
// reset the "last compilation has failed" flag
1334
m_lastCompilationFailed = false;
1336
if( m_executeAfterBuild ){
1341
void AutoProjectPart::slotCommandFailed( const QString& /*command*/ )
1343
kdDebug(9020) << "slotCommandFinished " << k_funcinfo << endl;
1345
m_lastCompilationFailed = true;
1346
m_executeAfterBuild=false;
1349
bool AutoProjectPart::isDirty()
1351
if (m_lastCompilationFailed) return true;
1353
QStringList fileList = allFiles();
1354
QStringList::Iterator it = fileList.begin();
1355
while( it != fileList.end() ){
1356
QString fileName = *it;
1359
QMap<QString, QDateTime>::Iterator it = m_timestamp.find( fileName );
1360
QDateTime t = QFileInfo( projectDirectory(), fileName ).lastModified();
1361
if( it == m_timestamp.end() || *it != t ){
1369
void AutoProjectPart::needMakefileCvs( )
1371
m_needMakefileCvs = true;
1374
bool AutoProjectPart::isKDE() const
1379
KDevProject::Options AutoProjectPart::options() const
1381
return UsesAutotoolsBuildSystem;
1384
QStringList recursiveATFind( const QString &currDir, const QString &baseDir )
1386
kdDebug(9020) << "Dir " << currDir << endl;
1387
QStringList fileList;
1389
if( !currDir.contains( "/..") && !currDir.contains("/.") )
1392
QStringList dirList = dir.entryList(QDir::Dirs );
1393
QStringList::Iterator idx = dirList.begin();
1394
for( ; idx != dirList.end(); ++idx )
1396
fileList += recursiveATFind( currDir + "/" + (*idx),baseDir );
1398
QStringList newFiles = dir.entryList("*.am *.in");
1399
idx = newFiles.begin();
1400
for( ; idx != newFiles.end(); ++idx )
1402
QString file = currDir + "/" + (*idx);
1403
fileList.append( file.remove( baseDir ) );
1412
\fn AutoProjectPart::distFiles() const
1414
QStringList AutoProjectPart::distFiles() const
1416
QStringList sourceList = allFiles();
1417
// Scan current source directory for any .pro files.
1418
QString projectDir = projectDirectory();
1419
QDir dir(projectDir);
1420
QDir admin(projectDir +"/admin");
1421
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");
1422
QStringList adminFiles = admin.entryList(QDir::Files);
1423
QStringList::Iterator idx = adminFiles.begin();
1424
for( ; idx != adminFiles.end(); ++idx)
1426
files.append( "admin/" + (*idx) );
1428
QStringList srcDirs = dir.entryList(QDir::Dirs);
1429
idx = srcDirs.begin();
1430
for(; idx != srcDirs.end(); ++idx)
1432
sourceList += recursiveATFind( projectDirectory() + "/" + (*idx), projectDirectory());
1434
return sourceList + files;
1437
void AutoProjectPart::startSimpleMakeCommand( const QString & dir, const QString & command, bool withKdesu )
1439
if (partController()->saveAllFiles()==false)
1440
return; //user cancelled
1442
// m_buildCommand = constructMakeCommandLine(dir, target);
1444
QString cmdline = command;
1445
cmdline.prepend(makeEnvironment());
1447
QString dircmd = "cd ";
1448
dircmd += KProcess::quote(dir);
1451
m_buildCommand = dircmd + cmdline;
1454
m_buildCommand = "kdesu -t -c '" + m_buildCommand + "'";
1456
if (!m_buildCommand.isNull())
1457
makeFrontend()->queueCommand(dir, m_buildCommand);
1460
QString AutoProjectPart::getAutoConfFile(const QString& dir){
1462
QFile inFile(dir + "/configure.in");
1463
QFile acFile(dir + "/configure.ac");
1464
if ( inFile.exists()){
1465
return inFile.name();
1466
}else if (acFile.exists()){
1467
return acFile.name();
1469
return acFile.name();;
1472
#include "autoprojectpart.moc"
1474
// kate: space-indent on; indent-width 4;