summaryrefslogtreecommitdiff
blob: 9a28e5c3c1836fb47717ab6a05bf6452581f79e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff -Nur kdevelop-3.3.0.orig/buildtools/custommakefiles/customprojectpart.cpp kdevelop-3.3.0/buildtools/custommakefiles/customprojectpart.cpp
--- kdevelop-3.3.0.orig/buildtools/custommakefiles/customprojectpart.cpp	2005-09-10 10:21:46.000000000 +0200
+++ kdevelop-3.3.0/buildtools/custommakefiles/customprojectpart.cpp	2005-11-24 21:26:16.000000000 +0100
@@ -187,17 +187,17 @@
     m_contextRemoveFiles.clear();
 
     if( fcontext->urls().size() == 1 )
-    {
-        QString contextFileName = URLUtil::canonicalPath(fcontext->urls().first().fileName());
-        bool inProject = project()->isProjectFile(contextFileName);
-        QString popupstr = QFileInfo(contextFileName).fileName();
-        if (contextFileName.startsWith(projectDirectory()+ "/"))
-            contextFileName.remove(0, projectDirectory().length()+1);
+   {
+      QString canContextFileName =URLUtil::canonicalPath(fcontext->urls().first().path());
+      QString relContextFileName =URLUtil::extractPathNameRelative(URLUtil::canonicalPath(project()->projectDirectory()), canContextFileName);
+      QString popupstr =fcontext->urls().first().fileName();
+    
+        bool inProject = project()->isProjectFile(canContextFileName);
 
         popup->insertSeparator();
         if (inProject)
         {
-	    m_contextRemoveFiles << contextFileName;
+	    m_contextRemoveFiles << relContextFileName;
             int id = popup->insertItem( i18n("Remove %1 From Project").arg(popupstr),
                                this, SLOT(slotRemoveFromProject()) );
             popup->setWhatsThis(id, i18n("<b>Remove from project</b><p>Removes current file from the list of files in project. "
@@ -205,7 +205,7 @@
         }
         else
         {
-	    m_contextAddFiles << contextFileName;
+	    m_contextAddFiles << relContextFileName;
             int id = popup->insertItem( i18n("Add %1 to Project").arg(popupstr),
                                this, SLOT(slotAddToProject()) );
             popup->setWhatsThis(id, i18n("<b>Add to project</b><p>Adds current file to the list of files in project. "
@@ -219,14 +219,12 @@
 	{
 	    if ((*it).isLocalFile())
 	    {
-	    	QString path(URLUtil::canonicalPath((*it).path()));
-		QString relPath( path );
-                if (relPath.startsWith(projectDirectory()+ "/"))
-                    relPath.remove(0, projectDirectory().length()+1);
-		if (project()->isProjectFile(path))
-		    m_contextRemoveFiles << relPath;
-		else
-		    m_contextAddFiles << relPath;
+	    	QString canPath(URLUtil::canonicalPath((*it).path()));
+         QString relPath =URLUtil::extractPathNameRelative(URLUtil::canonicalPath(project()->projectDirectory()), canPath);
+         if (project()->isProjectFile(canPath))
+            m_contextRemoveFiles << relPath;
+         else
+            m_contextAddFiles << relPath;
 	    }
 	}
 
@@ -505,8 +503,8 @@
 	QStringList::ConstIterator it;
 
 	for ( it = fileList.begin(); it != fileList.end(); ++it )
-	{
-		m_sourceFiles.append ( *it );
+   {
+      m_sourceFiles.append (*it);
 	}
 	
 	saveProject();