Bug 63787 - trollproject: Relative url's to files subdirs are handled wrong.
Summary: trollproject: Relative url's to files subdirs are handled wrong.
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: QMake (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-06 09:50 UTC by Stephan Heigl
Modified: 2003-11-18 20:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Heigl 2003-09-06 09:50:32 UTC
Version:            (using KDE KDE 3.1.1)
Installed from:    Compiled From Sources
Compiler:          gcc 3.3.1 
OS:          Linux

When maintaining one .pro file for the whole project and not having a separate .pro for each subdir KDevelop/Gideon (latest CVS) just links to the file as if it was in the projects root dir when creating a new file (header/source doesn't matter). The file is created in the right directory, but the link in the header/source listbox discharges the path.

example:

/ project root (there's the .pro file)

Insert new File -> subdir/File.h
Then we get a new entry in the listbox linking to
/ File.h instead of subdir/File.h
Comment 1 Amilcar do Carmo Lucas 2003-09-06 13:02:34 UTC
Please specify your version. Are you using CVS HEAD? If not, please update. 
Comment 2 Stephan Heigl 2003-09-06 13:19:13 UTC
It's CVS HEAD (from 01-sept-2003). 
Comment 3 Alexander Dymo 2003-11-18 20:31:18 UTC
Subject: kdevelop/buildtools/qmake

CVS commit by dymo: 

Allow to use relative paths with "new file" wizard.
CCMAIL: 63787-done@bugs.kde.org


  M +25 -0     trollprojectwidget.cpp   1.141


--- kdevelop/buildtools/qmake/trollprojectwidget.cpp  #1.140:1.141
@@ -1632,4 +1632,29 @@ void TrollProjectWidget::addFiles( QStri
         noPathFileName = info.fileName();
 
+    GroupItem *gitem = 0;
+    QPtrListIterator<GroupItem> it(m_shownSubproject->groups);
+    for (; it.current(); ++it)
+    {
+        if ((*it)->groupType == GroupItem::groupTypeForExtension(ext))
+        {
+            gitem = *it;
+            break;
+        }
+    }
+    if (gitem && !noPathTruncate)
+    {
+        QString addName;
+        if (fileName.startsWith("/"))
+            addName = URLUtil::relativePath(gitem->owner->path, fileName);
+        else
+            addName = URLUtil::relativePath(gitem->owner->relpath, "/" + fileName);
+        if (!addName.isEmpty())
+        {
+            if (addName[0] == '/')
+                addName = addName.mid(1);
+            noPathFileName = addName;
+        }
+    }
+
     addFileToCurrentSubProject(GroupItem::groupTypeForExtension(ext), noPathFileName);
     updateProjectFile(m_shownSubproject);