Patch for select main program

Amilcar do Carmo Lucas amilcar at ida.ing.tu-bs.de
Tue May 13 11:33:07 UTC 2003


This is a nice patch but it doesn't work! :(

The whole problem is that the run target is actually relative to the 
buildDirectory and not the project directory

I don't have the time right now to fix it, and it should use KURL 
instead anyways, so please do not commit!

Amilcar


DUCLOS Andre wrote:

>Hi,
>
>(My english is poor..)
>
>A path for improve the select main program.
>
>Test please.
>
>Thanks.
>
>
>
>Index: lib/project/runoptionswidget.cpp
>===================================================================
>RCS file: /home/kde/kdevelop/lib/project/runoptionswidget.cpp,v
>retrieving revision 1.10
>diff -u -r1.10 runoptionswidget.cpp
>--- lib/project/runoptionswidget.cpp	2 Apr 2003 16:38:28 -0000	1.10
>+++ lib/project/runoptionswidget.cpp	11 May 2003 15:23:02 -0000
>@@ -18,6 +18,7 @@
> #include <qlistview.h>
> #include <qgroupbox.h>
> #include <qcheckbox.h>
>+#include <kdebug.h>
>
> #include "domutil.h"
> #include "environmentvariableswidget.h"
>@@ -54,17 +55,46 @@
>
> void RunOptionsWidget::browseMainProgram()
> {
>-  QString path = KFileDialog::getOpenFileName(m_projectDirectory,
>-                               i18n("*|All Files"),
>-                               this,
>-                               i18n("Select main program
>executable."));
>-
>-  if (path.find(m_projectDirectory)==0)
>-  {
>-    path.remove(0,m_projectDirectory.length()+1);
>-    path = "./" + path;
>-  }
>-  mainprogram_edit->setText(path);
>+	KFileDialog *dlg = new KFileDialog(m_projectDirectory, QString::null,
>this, QString::null, true);
>+	QStringList filters;
>+	filters << "application/x-executable"
>+		<< "application/x-shellscript"
>+		<< "application/x-perl"
>+		<< "application/x-python";
>+	dlg->setMimeFilter(filters);
>+	dlg->setCaption(i18n("Select main program executable."));
>+	kdDebug(9000) << "Project dir : " << m_projectDirectory << endl;
>+	kdDebug(9000) << "Main program : " << mainprogram_edit->text() <<
>endl;
>+	QString path = mainprogram_edit->text().stripWhiteSpace();
>+	if (!path.isEmpty())
>+	{
>+		QString dir;
>+		if ((path.length() > 2) && (path.left(2) == "./"))
>+			path = path.mid(2);
>+		int pos = path.findRev("/");
>+		if (path.left(1) != "/")
>+			dir = m_projectDirectory + "/" + path.left(pos);
>+		else
>+			dir = path.left(pos);
>+		dlg->setURL(dir);
>+		dlg->setSelection(path.mid(pos + 1));
>+		kdDebug(9000) << " with path : " << dir << endl;
>+		kdDebug(9000) << " with name : " << path.mid(pos + 1) << endl;
>+	}
>+	if (dlg->exec())
>+	{
>+		path = dlg->selectedFile().stripWhiteSpace();
>+		if (!path.isEmpty())
>+		{
>+			if (path.find(m_projectDirectory)==0)
>+			{
>+    				path.remove(0,m_projectDirectory.length()+1);
>+    				path = "./" + path;
>+  			}
>+  			mainprogram_edit->setText(path);
>+		}
>+	}
>+	delete dlg;
> }
> 
> #include "runoptionswidget.moc"
>
>
>
>  
>







More information about the KDevelop-devel mailing list