Bug 121242 - mimelnk/x-image-raw.desktop conflicts with kdegraphics-3.5.x
Summary: mimelnk/x-image-raw.desktop conflicts with kdegraphics-3.5.x
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Portability-Interroperability (show other bugs)
Version: 0.8.1
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-02 18:12 UTC by Jonathan Marten
Modified: 2017-07-31 15:46 UTC (History)
4 users (show)

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


Attachments
File patterns fix (1.80 KB, patch)
2006-02-02 18:29 UTC, Jonathan Marten
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2006-02-02 18:12:19 UTC
Version:           0.8.1 (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
OS:                Linux

The application installs the MIME type image/x-raw which, among the long list of file extensions recognised, defines: *.tif, *.TIFF and *.TIF (twice).  Depending on the order in which the types are scanned, this can override the standard MIME type for TIFF files (image/tiff).  If this happens, opening a TIFF image will ask for an application (since image/x-raw is not in showfoto's MIME type list, probably this is another bug) instead of opening in the user's standard image viewer.

Suggest that the TIFF extensions should be removed from this MIME type.

There are also other possibly clashing file types in this list:
*.PBM, *.PCX, *.PGM, *.XBM, *.XCF, *.TGA, *.PPM, *.PSD, *.XPM, *.EPS, *.EXR, *.JP2.  None of these should be assumed to be RAW images.
Comment 1 Rex Dieter 2006-02-02 18:20:41 UTC
Agreed, confirmed.
Comment 2 Rex Dieter 2006-02-02 18:27:06 UTC
Nevermind, just checked my digikam-0.8.1 install, no image/x-raw mimetype to be found (here).  As a matter of fact, 
rpm -q -f /usr/share/mimelink/image/x-image-raw.desktop
kdegraphics-3.5.1
and it contains:
Patterns=*.crw;*.CRW;*.cr2,*.CR2;*.nef;*.NEF;*.mrw;*.MRW;

So, it appears your mimetypes are biffed and vary from factory-defaults.
Comment 3 Jonathan Marten 2006-02-02 18:29:36 UTC
Created attachment 14497 [details]
File patterns fix

Also sets default application for RAW files (AFAIK the Exec= is not allowed in
a MIME type file) and adds the MIME type to those supported by showfoto.
Comment 4 Jonathan Marten 2006-02-02 18:35:19 UTC
Strange (comment #2)... my 0.8.1 source seems to have digikam-0.8.1/digikam/showfoto/mimetypes/x-raw.desktop which installs as $KDEDIR/share/mimelnk/image/x-raw.desktop.  I haven't modified anything from the downloaded source.  I have a full install of kdegraphics (KDE 3.5.0), and there is no /usr/share/mimelink/image/x-image-raw.desktop 

Comment 5 Jonathan Marten 2006-02-02 18:41:23 UTC
Sorry, my mistake, there is indeed an x-image-raw which comes from kdegraphics.  However, in this case there is still duplication and a file pattern clash between x-raw (from digikam) and x-image-raw (from kdegraphics).
Comment 6 Rex Dieter 2006-02-02 18:44:37 UTC
I've come to the same conclusion.  Sorry for the confusion.
Comment 7 Rex Dieter 2006-02-02 18:54:48 UTC
Since mimelnk/x-image-raw.desktop conflicts with kdegraphics-3.5.x, the easiest fix would be to simply remove it from digikam.

Alternatively, if you don't want to require use of kde(graphics) >= 3.5, only install the mimelnk file if not already present.  If kept, as originally suggested, 
Patterns=
should be cleaned up.
Comment 8 Rex Dieter 2006-02-07 14:05:03 UTC
FYI, looks like koffice-1.4.90 includes an x-image-raw.desktop too (bug #121536).

Looks like it should be moved to kdelibs.
Comment 9 Nicolas Goutte 2006-02-08 01:44:15 UTC
SVN commit 506967 by goutte:

image/x-raw is now defined in kdelibs
CCBUG:121536
CCBUG:121242


 M  +1 -4      Makefile.am  
 D             x-image-raw.desktop  


--- trunk/KDE/kdegraphics/kfile-plugins/raw/Makefile.am #506966:506967
@@ -18,10 +18,7 @@
 services_DATA = kfile_raw.desktop
 servicesdir = $(kde_servicesdir)
 
-mimetypeimagedatadir = $(kde_mimedir)/image
-mimetypeimagedata_DATA = x-image-raw.desktop
-
 magicdir = $(kde_confdir)/magic
 magic_DATA = x-image-raw.magic 
 
-EXTRA_DIST = $(mimetypeimagedata_DATA) $(magic_DATA)
+EXTRA_DIST = $(magic_DATA)
Comment 10 Nicolas Goutte 2006-02-08 02:10:25 UTC
To comment #7: to avoid mimetype conflicts, you can check the KDE version on which the application is built and install the mimetypes if KDE is too old.

You can look at what I had done in KOffice: trunk/koffice/configure.in.in (everythign having kde32 kde33 kde34 ) and trunk/koffice/mimetypes/Makefile.am where it selects subdirectories of mimetypes depending on the KDE version.

For the image/x-raw mimetype, it is now defined in kdelibs.

Have a nice day!
Comment 11 Achim Bohnet 2006-02-09 01:20:54 UTC
Hi Nicolas,

so AFAICS, xraw.magic and x-image-raw.desktop are moved from kdegrahics
to kdelibs in trunk and 3_5_stable, right?

Can you add the additional extentions (all supported by dcraw which
is used by kio plugins, krita and digikam).   You'll find them at

https://ach@svn.kde.org/home/kde/trunk/extragear/graphics/digikam/showfoto/mimetypes/x-raw.desktop

with kde 3.5 there is one conflict:  x-hdr.desktop and x-raw.desktop both
use .hdr in patterns.   Too late tonight to check for pattern conflicts in
trunk and 3_5_stable.  Maybe this weekend.

FWIW, testing magic:  Gilles has some test raw files at http://digikam3rdparty.free.fr/Images_2_Test_DImg/RAW/

Achim
Comment 12 Nicolas Goutte 2006-02-09 19:59:22 UTC
On Thursday 09 February 2006 01:20, Achim Bohnet wrote:
(...)
> Hi Nicolas,
>
> so AFAICS, xraw.magic and x-image-raw.desktop are moved from kdegrahics
> to kdelibs in trunk and 3_5_stable, right?


Yes!

>
> Can you add the additional extentions (all supported by dcraw which
> is used by kio plugins, krita and digikam).   You'll find them at
>
> https://ach svn kde
> org/home/kde/trunk/extragear/graphics/digikam/showfoto/mimetypes/x-raw
> desktop


If you have time, you can add them yourself.

(I have just moved the mimetype before one of the classical reasons of not 
moving a mime types happen (nobody to do it, applying the message freeze, 
etc.))

>
> with kde 3.5 there is one conflict:  x-hdr.desktop and x-raw.desktop both
> use .hdr in patterns.  


Well, so the conflict has existed before the move too. :-(

Are RAW *.hdr files covered by a pattern? If yes, the perhaps the *.hdr 
pattern should be removed there.

> Too late tonight to check for pattern conflicts in
> trunk and 3_5_stable.  Maybe this weekend.


Yes, it would be nice if somebody could double check the pattern rules. I have 
only checked that the TIFF-like ones where not like TIFF ones (so for files 
starting in II or MM).

If you have time, you (or somebody else) should check the freedesktop.org 
mimetype database and chekc if mime type and pattern rules exist there. If 
not, create a bug report at freedesktop.org, please.

>
> FWIW, testing magic:  Gilles has some test raw files at
> http://digikam3rdparty.free.fr/Images_2_Test_DImg/RAW/
>
> Achim


Have a nice day!
Comment 13 Nicolas Goutte 2006-02-23 03:07:58 UTC
SVN commit 512608 by goutte:

- add file patterns from Krita
- change the comment to show "Image" instead of "File"
  (as other relevant image mime types)
CCMAIL:kde-i18n-doc@kde.org
CCBUG:121536
CCBUG:121242


 M  +2 -2      x-raw.desktop  


--- branches/KDE/3.5/kdelibs/mimetypes/image/x-raw.desktop #512607:512608
@@ -3,8 +3,8 @@
 Type=MimeType
 MimeType=image/x-raw
 Icon=image
-Patterns=*.crw;*.CRW;*.cr2,*.CR2;*.nef;*.NEF;*.mrw;*.MRW;
-Comment=RAW Camera File
+Patterns=*.raw;*.RAW;*.dcr;*.DCR;*.dng;*.DNG;*.crw;*.CRW;*.cr2,*.CR2;*.nef;*.NEF;*.mrw;*.MRW;
+Comment=RAW Camera Image
 Comment[br]=Restr kamera kriz
 Comment[ca]=Fitxer de càmera RAW
 Comment[cs]=RAW soubor z fotoaparátu
Comment 14 Rex Dieter 2006-03-30 04:48:04 UTC
*** Bug 124428 has been marked as a duplicate of this bug. ***
Comment 15 Rex Dieter 2006-05-11 14:28:10 UTC
FYI, digikam-0.8.2-rc1 still installs a x-raw.desktop which conflicts with kdelibs-3.5.2+ (and kdegraphics < 3.5.2 and koffice < 1.5.0).  See koffice bug #121536 comment #6 for an example of the autoconf/automake magic to fix.
Comment 16 Achim Bohnet 2006-05-11 16:14:00 UTC
Yeah, I know that it's still in.  For debian/kubuntu pkgs we
just delete the file before packing the .deb.

Someone knows who to tweak the Makefile magic to make the install
conditional like

if KDE < 3.5.2 then
	XIMAGERAW = x-image-raw.desktop
else
	XIMAGERAW = 
fi

desktopfiles = a.desktop b.desktop $(XIMAGERAW)


Achim
Comment 17 caulier.gilles 2006-05-15 13:31:32 UTC
SVN commit 541016 by cgilles:

digikam from trunk : showfoto and image/x-raw type mime :

- removed x-raw.desktop file in conflict with KDE3.5.2 
- add a rule into Showfoto::slotOpenFile() to detect witch KDE release we use :
 * if KDE >= 3.5.2 --> we use image/x-raw pattern from KDE.
 * if KDE < 3.5.2 --> we construct a new pattern from stcrach.

IMPORTANT : this code have been tested under Mandriva 2006.0 official using KDE 3.4.2. It's untested with KDE > 3.4.2. Please give me a feedback if all is ok to close this file !

CCMAIL: digikam-devel@kde.org
CCBUGS: 121242

 D             mimetypes (directory)  
 M  +28 -7     showfoto.cpp  
 M  +1 -1      showfoto.desktop  


--- trunk/extragear/graphics/digikam/showfoto/showfoto.cpp #541015:541016
@@ -387,16 +387,37 @@
     if (m_currentItem && !promptUserSave(m_currentItem->url()))
         return;
 
-    QString mimetypes = KImageIO::mimeTypes(KImageIO::Reading).join(" ");
+    QString fileformats;
     
-    // Added RAW file format type mimes supported by dcraw program.
-    mimetypes.append (" image/x-raw");
+#if KDE_IS_VERSION(3,5,2)
+    //-- With KDE version >= 3.5.2, "image/x-raw" type mime exist ------------------------------
     
-    KURL::List urls =  KFileDialog::getOpenURLs(m_lastOpenedDirectory.path(),
-                                                mimetypes,
-                                                this,
-                                                i18n("Open Images"));
+    fileformats = KImageIO::mimeTypes(KImageIO::Reading).join(" ");
+#else
+    //-- with KDE version < 3.5.2, we need to add all camera RAW file formats ------------------
+    
+    QStringList patternList = QStringList::split('\n', KImageIO::pattern(KImageIO::Reading));
+    
+    // All Pictures from list must been always the first entry given by KDE API
+    QString allPictures = patternList[0];
+    
+    // Add RAW file format to All Pictures" type mime and remplace current.
+    allPictures.insert(allPictures.find("|"), QString(raw_file_extentions));
+    patternList.remove(patternList[0]);
+    patternList.prepend(allPictures);
+    
+    // Added RAW file formats supported by dcraw program like a type mime. 
+    // Nota: we cannot use here "image/x-raw" type mime from KDE because it 
+    // will be only available for KDE 3.5.2, not before (see file #121242 in B.K.O).
+    patternList.append(QString("\n%1|Camera RAW files").arg(QString(raw_file_extentions)));
+    
+    fileformats = patternList.join("\n");
+#endif
 
+    kdDebug () << "fileformats=" << fileformats << endl;   
+    
+    KURL::List urls =  KFileDialog::getOpenURLs(m_lastOpenedDirectory.path(), fileformats, this, i18n("Open Images"));
+
     if (!urls.isEmpty())
     {
         m_bar->clear();
--- trunk/extragear/graphics/digikam/showfoto/showfoto.desktop #541015:541016
@@ -59,7 +59,7 @@
 Exec=showfoto %i %m -caption "%c" %U
 Icon=showfoto
 Type=Application
-MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/png;image/tiff;image/x-bmp;image/x-psd;image/x-eim;image/x-portable-bitmap;image/x-portable-pixmap;image/x-portable-greymap
+MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/png;image/tiff;image/x-bmp;image/x-psd;image/x-eim;image/x-portable-bitmap;image/x-portable-pixmap;image/x-portable-greymap;image/x-raw
 Terminal=false
 Categories=Qt;KDE;Graphics;
 DocPath=showfoto/index.html
Comment 18 caulier.gilles 2006-05-15 13:38:15 UTC
SVN commit 541017 by cgilles:

digikam from stable : showfoto and image/x-raw type mime :

- removed x-raw.desktop file in conflict with KDE3.5.2 
- add a rule into Showfoto::slotOpenFile() to detect witch KDE release we use :
 * if KDE >= 3.5.2 --> we use image/x-raw pattern from KDE.
 * if KDE < 3.5.2 --> we construct a new pattern from sctrach.

IMPORTANT : this code have been tested under Mandriva 2006.0 official using KDE 3.4.2. It's untested with KDE > 3.4.2. Please give me a feedback if all is ok to close this file !

CCMAIL: digikam-devel@kde.org
CCBUGS: 121242

 D             mimetypes (directory)  
 M  +29 -8     showfoto.cpp  
 M  +1 -1      showfoto.desktop  


--- branches/stable/extragear/graphics/digikam/showfoto/showfoto.cpp #541016:541017
@@ -587,15 +587,36 @@
     if (!promptUserSave())
         return;
 
-    QString mimetypes = KImageIO::mimeTypes(KImageIO::Reading).join(" ");
+    QString fileformats;
+    
+#if KDE_IS_VERSION(3,5,2)
+    //-- With KDE version >= 3.5.2, "image/x-raw" type mime exist ------------------------------
+    
+    fileformats = KImageIO::mimeTypes(KImageIO::Reading).join(" ");
+#else
+    //-- with KDE version < 3.5.2, we need to add all camera RAW file formats ------------------
+    
+    QStringList patternList = QStringList::split('\n', KImageIO::pattern(KImageIO::Reading));
+    
+    // All Pictures from list must been always the first entry given by KDE API
+    QString allPictures = patternList[0];
+    
+    // Add RAW file format to All Pictures" type mime and remplace current.
+    allPictures.insert(allPictures.find("|"), QString(raw_file_extentions));
+    patternList.remove(patternList[0]);
+    patternList.prepend(allPictures);
+    
+    // Added RAW file formats supported by dcraw program like a type mime. 
+    // Nota: we cannot use here "image/x-raw" type mime from KDE because it 
+    // will be only available for KDE 3.5.2, not before (see file #121242 in B.K.O).
+    patternList.append(QString("\n%1|Camera RAW files").arg(QString(raw_file_extentions)));
+    
+    fileformats = patternList.join("\n");
+#endif
 
-    // Added RAW file format type mimes supported by dcraw program.
-    mimetypes.append (" image/x-raw");
-      
-    KURL::List urls =  KFileDialog::getOpenURLs(m_lastOpenedDirectory.path(),
-                                                mimetypes,
-                                                this,
-                                                i18n("Open Images"));
+    kdDebug () << "fileformats=" << fileformats << endl;   
+    
+    KURL::List urls =  KFileDialog::getOpenURLs(m_lastOpenedDirectory.path(), fileformats, this, i18n("Open Images"));
 
     if (!urls.isEmpty())
     {
--- branches/stable/extragear/graphics/digikam/showfoto/showfoto.desktop #541016:541017
@@ -57,7 +57,7 @@
 Exec=showfoto %i %m -caption "%c" %U
 Icon=showfoto
 Type=Application
-MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/png;image/tiff;image/x-bmp;image/x-psd;image/x-eim;image/x-portable-bitmap;image/x-portable-pixmap;image/x-portable-greymap
+MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;image/png;image/tiff;image/x-bmp;image/x-psd;image/x-eim;image/x-portable-bitmap;image/x-portable-pixmap;image/x-portable-greymap;image/x-raw
 Terminal=false
 Categories=Qt;KDE;Graphics;
 DocPath=showfoto/index.html
Comment 19 caulier.gilles 2006-05-15 13:57:20 UTC
Nicolas,

IMPORTANT : your pattern in standard KDE x-raw.desktop file is uncomplete :

http://websvn.kde.org/branches/KDE/3.5/kdelibs/mimetypes/image/x-raw.desktop?rev=539607&view=auto

We have :

*.raw;*.RAW;*.dcr;*.DCR;*.dng;*.DNG;*.crw;*.CRW;*.cr2,*.CR2;*.nef;*.NEF;*.mrw;*.MRW;

The real RAW file format pattern supported by dcraw is :

*.bay *.bmq *.cr2 *.crw *.cs1 *.dc2 *.dcr *.dng *.erf *.fff *.hdr *.k25 *.kdc *.mdc *.mos *.mrw *.nef *.orf *.pef *.pxn *.raf *.raw *.rdc *.sr2 *.srf *.x3f

... This list come from dcraw source code itself !!! Please update...

Gilles Caulier

Comment 20 caulier.gilles 2006-05-15 14:00:50 UTC
Nicolas,

Same problem into KDE 4.0 :

http://websvn.kde.org/trunk/KDE/kdelibs/mimetypes/image/x-raw.desktop?rev=512649&view=auto

Gilles Caulier
Comment 21 caulier.gilles 2006-06-09 09:06:42 UTC
The KDE RAW file mime type have been fixed by Laurent Montel into svn.

Thanks to him (:=)))

I close this file now.

Gilles Caulier