[Digikam-devel] branches/stable/extragear/graphics/digikam/showfoto

Gilles Caulier caulier.gilles at free.fr
Mon May 15 12:38:02 BST 2006


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 at 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



More information about the Digikam-devel mailing list