Bug 55989

Summary: Auto-completing for href argument is problematic
Product: quanta Reporter: Thibaut Cousin <kde>
Component: generalAssignee: András Manţia <amantia>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Thibaut Cousin 2003-03-15 13:05:13 UTC
Version:           3.1 (using KDE 3.1.0)
Compiler:          gcc version 3.2
OS:          Linux (i686) release 2.4.20-4GB-athlon

First, I saw a seemingly similar bug reported, but this one is in fact a new one.

With auto-completion activated when I type a href in a <a> tag, I get a list of files. This is very nice, but this list is useless if I'm not in the root directory of my website. Example:

The root directory of my site is (locally) ~/public_html with a index.html file. There is a subdirectory with two files:
~/public_html/index.html
~/public_html/linux/linux1.html
~/public_html/linux/linux2.html

If I create a link in index.html to linux1.html, the auto-completion for href is OK.

But if I create a link in linux1.html to linux2.html, there is a problem. The autocompletion menu gives me "file:linux/linux2.html". But this will not work when I already am in the linux directory. I would need "file:linux2.html".

Conclusion: the choices given by the auto-completion menu should have paths relative to the working directory, not relative to the root directory of the site.

By the way, is it really necessary to put this "file:" string first? It is OK when I work locally, but I'm not sure it is a good idea once the site is on a web server.

I hope I was clear...

Thanks for your attention!
Comment 1 András Manţia 2003-03-25 18:32:40 UTC
Subject: quanta

CVS commit by amantia: 

Show files with relative path to the current document in "url" autocompletion.

CCMAIL: 55989-done@bugs.kde.org


  M +4 -0      ChangeLog   1.140
  M +8 -8      quanta.kdevelop   1.27
  M +11 -0     quanta/document.cpp   1.127


--- quanta/ChangeLog  #1.139:1.140
@@ -16,4 +16,7 @@
     - make the Apply button in Configure Toolbars dialog work as expected
     - fix ocassional crash when pressing Ctrl-H while viewing the documentation
+    - replace > with &gt; when pasting as HTML quoted [#56234]
+    - fix shortcut for Color dialog [#56235]
+    - store the upload options in the project file [#56237]
   - new features:
     - "Replace selection" for script actions replaces the selection if
@@ -45,4 +48,5 @@
       some message. Implements wish #55645.
     - allow the user to decide about opening of files with unknown type
+    - show files with relative path to the current document in "url" autocompletion
   - new DCOP interfaces:
   - changed behavior:

--- quanta/quanta.kdevelop  #1.26:1.27
@@ -32,5 +32,5 @@
       <numberofjobs>1</numberofjobs>
       <dontact>false</dontact>
-      <makebin/>
+      <makebin></makebin>
     </make>
     <compiler>
@@ -142,5 +142,5 @@
       <programargs>--nologo</programargs>
       <gdbpath>/usr/bin/</gdbpath>
-      <breakonloadinglibs>true</breakonloadinglibs>
+      <breakonloadinglibs>false</breakonloadinglibs>
       <separatetty>false</separatetty>
       <floatingtoolbar>false</floatingtoolbar>
@@ -174,6 +174,6 @@
     <filetemplates>
       <choosefiles>false</choosefiles>
-      <interfaceURL/>
-      <implementationURL/>
+      <interfaceURL></interfaceURL>
+      <implementationURL></implementationURL>
       <interfacesuffix>.h</interfacesuffix>
       <implementationsuffix>.cpp</implementationsuffix>
@@ -187,11 +187,11 @@
   <kdevcvs>
     <cvsoptions>-f</cvsoptions>
-    <commitoptions/>
+    <commitoptions></commitoptions>
     <updateoptions>-dP</updateoptions>
-    <addoptions/>
+    <addoptions></addoptions>
     <removeoptions>-f</removeoptions>
     <diffoptions>-u3 -p</diffoptions>
-    <logoptions/>
-    <rshoptions/>
+    <logoptions></logoptions>
+    <rshoptions></rshoptions>
   </kdevcvs>
   <kdevfilecreate>

--- quanta/quanta/document.cpp  #1.126:1.127
@@ -1574,4 +1574,8 @@ QStringList* Document::tagAttributeValue
     AttributeList* attrs = QuantaCommon::tagAttributes(dtdName, tag);
     Attribute *attr;
+    KURL u;
+    KURL base = QExtFileInfo::toRelative(url(), baseURL);
+    base.setPath("/"+base.directory(false, false));
+    QString s;
     if (attrs)
     {
@@ -1585,4 +1589,11 @@ QStringList* Document::tagAttributeValue
             {
               values = new QStringList(project->fileNameList(true).toStringList());
+              for (uint i = 0; i < values->count(); i++)
+              {
+                u = (*values)[i];
+                u.setPath("/"+u.path());
+                u = QExtFileInfo::toRelative(u, base);
+                (*values)[i] = u.path();
+              }
               values->append("mailto:" + project->email);
             } else