Bug 73463 - icon location for Desktop Entries
Summary: icon location for Desktop Entries
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 68507 224449 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-25 15:09 UTC by Pieter
Modified: 2015-05-28 17:33 UTC (History)
2 users (show)

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


Attachments
partial patch (701 bytes, patch)
2004-01-28 13:51 UTC, David Faure
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pieter 2004-01-25 15:09:12 UTC
Version:            (using KDE KDE 3.1.4)
Installed from:    RedHat RPMs
OS:          Linux

Using .directory files you can set an icon for a directory using for example

[Desktop Entry]
Icon = /mp3/rem/folder.jpg

We can only use absolute pathnames, or pathnames relative to some directory specified by the kde distribution (i.e. $KDEDIR/share/icons/). This is a problem if you want to move directories and want to keep the icon with the directory. 

It would be nice if there was some option to use the path of the directory itself, i.e something like

[Desktop Entry]
Icon = $LOCALDIR/folder.jpg
Comment 1 David Faure 2004-01-28 13:51:17 UTC
Created attachment 4394 [details]
partial patch

Based on the patch by Pieter, this turns ./foo.jpg into an absolute path when
parsing the .directory file.
But it doesn't seem to work, KMimeType::pixmap() passes the full path to
KIconLoader (which is necessary anyway, to apply icon effects etc.), and
KIconLoader returns an null pixmap. Needs debugging inside kiconloader... (no
time for that right now).
Comment 2 Pieter 2004-01-30 13:46:59 UTC
I tested the patch by David attached for KDE 3.1.5 (compiled with konstruct) and it works for me. The exact .directory file I used was 

[Desktop Entry]
Icon = ./.folder.png

with of course a corresponding image .folder.png present. I also cannot image that there is any problem in KIconLoader since KFolderType::icon() (which is affected by the patch) only passes a string to the rest of the program. Perhaps the image file was not present?

Could someone compile kdelibs with the patch and test if konqueror works?

thanks,
pieter



Comment 3 David Faure 2004-03-29 11:48:51 UTC
CVS commit by faure: 

Support for Icon=./foo.png in .directory files, bsaed on patch by Pieter Eendebak.
CCMAIL: 73463-done@bugs.kde.org


  M +8 -0      kmimetype.cpp   1.187


--- kdelibs/kio/kio/kmimetype.cpp  #1.186:1.187
@@ -631,4 +631,12 @@ QString KFolderType::icon( const KURL& _
     return KMimeType::icon( _url, _is_local );
 
+  if ( icon.startsWith( "./" ) ) {
+    // path is relative with respect to the location
+    // of the .directory file (#73463)
+    KURL v( _url );
+    v.addPath( icon.mid( 2 ) );
+    icon = v.path();
+  }
+
   return icon;
 }


Comment 4 Pascal Létourneau 2004-04-30 20:03:28 UTC
*** Bug 68507 has been marked as a duplicate of this bug. ***
Comment 5 Frank Reininghaus 2015-05-28 17:33:42 UTC
*** Bug 224449 has been marked as a duplicate of this bug. ***