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

List:       kde-commits
Subject:    [okular/KDE/4.11] generators/comicbook: Don't create pages for files that are not images
From:       Albert Astals Cid <aacid () kde ! org>
Date:       2013-11-30 22:07:45
Message-ID: E1VmshV-00035E-6c () scm ! kde ! org
[Download RAW message or body]

Git commit 55011e05880ab4d030ff0d00ac3b30697be4a794 by Albert Astals Cid.
Committed on 30/11/2013 at 22:05.
Pushed by aacid into branch 'KDE/4.11'.

Don't create pages for files that are not images

The zip in bug #328182 has one

M  +10   -4    generators/comicbook/document.cpp

http://commits.kde.org/okular/55011e05880ab4d030ff0d00ac3b30697be4a794

diff --git a/generators/comicbook/document.cpp b/generators/comicbook/document.cpp
index 3ba7483..93b948e 100644
--- a/generators/comicbook/document.cpp
+++ b/generators/comicbook/document.cpp
@@ -185,11 +185,17 @@ void Document::pages( QVector<Okular::Page*> * pagesVector )
             {
                 QSize pageSize = reader.size();
                 if ( !pageSize.isValid() ) {
-                    pageSize = reader.read().size();
+                    const QImage i = reader.read();
+                    if ( !i.isNull() )
+                        pageSize = i.size();
+                }
+                if ( pageSize.isValid() ) {
+                    pagesVector->replace( count, new Okular::Page( count, \
pageSize.width(), pageSize.height(), Okular::Rotation0 ) ); +                    \
mPageMap.append(file); +                    count++;
+                } else {
+                    kDebug() << "Ignoring" << file << "doesn't seem to be an image \
even if QImageReader::canRead returned true";  }
-                pagesVector->replace( count, new Okular::Page( count, \
                pageSize.width(), pageSize.height(), Okular::Rotation0 ) );
-                mPageMap.append(file);
-                count++;
             }
         }
     }


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

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