[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/kphotoalbum
From:       Jesper Pedersen <blackie () blackie ! dk>
Date:       2010-10-22 18:17:12
Message-ID: 20101022181712.24F4CAC897 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1188584 by blackie:

I don't remember if I actually sent this in.  If you right click on an
image in the viewer and accidentally hover over Run Program (on the
selection), it is extremely slow.  I tracked that down to the Run
Program code looking at all the files to determine the set of MIME
types in order to select appropriate programs to populate the menu
with.

If we make the assumption that MIME type is determined solely by the
extension (which is probably reasonable for this purpose), we can
speed matters up tremendously.

 M  +6 -0      ChangeLog  
 M  +8 -1      MainWindow/ExternalPopup.cpp  


--- trunk/extragear/graphics/kphotoalbum/ChangeLog #1188583:1188584
@@ -1,3 +1,9 @@
+2010-10-22  Jesper K. Pedersen  <blackie@kdab.com>
+
+	* Bugfix: If you right click on an
+	image in the viewer and accidentally hover over Run Program (on the
+	selection), it is extremely slow. Thanks to Robert Krawitz for a patch
+
 2010-09-08  Miika Turkia <miika.turkia@gmail.com>
 
 	* Patch to display filter button correctly, enable collapsing super
--- trunk/extragear/graphics/kphotoalbum/MainWindow/ExternalPopup.cpp #1188583:1188584
@@ -167,15 +167,22 @@
 
 QString MainWindow::ExternalPopup::mimeType( const QString& file )
 {
-    return KFileItem( KFileItem::Unknown, KFileItem::Unknown, KUrl(file) ).mimetype();
+    return KMimeType::findByPath(file, 0, true)->name();
 }
 
 Utilities::StringSet MainWindow::ExternalPopup::mimeTypes( const QStringList& files )
 {
     StringSet res;
+    StringSet extensions;
     for( QStringList::ConstIterator fileIt = files.begin(); fileIt != files.end(); ++fileIt ) {
+       QString baseFileName = *fileIt;
+       int extStart = baseFileName.lastIndexOf(QChar::fromLatin1('.'));
+       baseFileName.remove(0, extStart);
+       if (! extensions.contains(baseFileName)) {
         res.insert( mimeType( *fileIt ) );
+           extensions.insert( baseFileName );
     }
+    }
     return res;
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic