[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdebase
From: David Faure <faure () kde ! org>
Date: 2005-04-07 13:30:01
Message-ID: 20050407133001.687DC643 () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
Use mimetypes to detect SVG files
M +3 -4 kcontrol/background/bgdialog.cpp 1.65
M +2 -1 kcontrol/background/bgrender.cpp 1.13
M +3 -4 kcontrol/background/bgwallpaper.cpp 1.13
M +10 -8 libkonq/konq_operations.cc 1.164
--- kdebase/libkonq/konq_operations.cc #1.163:1.164
@@ -536,13 +536,15 @@ void KonqOperations::doFileCopy()
KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent());
bool bSetWallpaper = false;
- if (iconView && iconView->maySetWallpaper() &&
- (lst.count() == 1) &&
- ((!KImageIO::type(lst.first().path()).isEmpty()) ||
- (KImageIO::isSupported(KMimeType::findByURL(lst.first())->name(), KImageIO::Reading)) ||
- lst.first().fileName().endsWith(".svg") ||
- lst.first().fileName().endsWith(".svgz")))
+ if ( iconView && iconView->maySetWallpaper() && lst.count() == 1 )
+ {
+ KURL url = lst.first();
+ KMimeType::Ptr mime = KMimeType::findByURL( url );
+ if ( ( !KImageIO::type(url.path()).isEmpty() ) ||
+ ( KImageIO::isSupported(mime->name(), KImageIO::Reading) ) ||
+ mime->is( "image/svg+xml" ) )
{
bSetWallpaper = true;
}
+ }
// Check what the source can do
--- kdebase/kcontrol/background/bgdialog.cpp #1.64:1.65
@@ -499,10 +499,9 @@ void BGDialog::slotWallpaperSelection()
dlg.setPreviewWidget(previewWidget);
- QString pattern = KImageIO::pattern();
+ QStringList mimeTypes = KImageIO::mimeTypes( KImageIO::Reading );
#ifdef HAVE_LIBART
- pattern = "*.svg *.svgz " + pattern;
- pattern += i18n("\n*.svg *.SVG *.svgz *.SVGZ|Scalable Vector Graphics");
+ mimeTypes += "image/svg+xml";
#endif
- dlg.setFilter(pattern);
+ dlg.setFilter( mimeTypes.join( " " ) );
dlg.setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly );
dlg.setCaption( i18n("Select Wallpaper") );
--- kdebase/kcontrol/background/bgrender.cpp #1.12:1.13
@@ -26,4 +26,5 @@
#include <ktempfile.h>
#include <kcursor.h>
+#include <kmimetype.h>
#ifdef HAVE_LIBART
@@ -294,5 +295,5 @@ wp_load:
}
- if (file.endsWith(".svg") || file.endsWith(".svgz")) {
+ if ( KMimeType::findByPath( file )->is( "image/svg+xml" ) ) {
#ifdef HAVE_LIBART
// Special stuff for SVG icons
--- kdebase/kcontrol/background/bgwallpaper.cpp #1.12:1.13
@@ -145,12 +145,11 @@ void BGMultiWallpaperDialog::setEnabledM
void BGMultiWallpaperDialog::slotAdd()
{
- QString pattern = KImageIO::pattern();
+ QStringList mimeTypes = KImageIO::mimeTypes( KImageIO::Reading );
#ifdef HAVE_LIBART
- pattern = "*.svg *.svgz " + pattern;
- pattern += i18n("\n*.svg *.SVG *.svgz *.SVGZ|Scalable Vector Graphics");
+ mimeTypes += "image/svg+xml";
#endif
KFileDialog fileDialog(KGlobal::dirs()->findDirs("wallpaper", "").first(),
- pattern, this,
+ mimeTypes.join( " " ), this,
0L, true);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic