From db7d8ff608ec4fc811ed2cab5925dd3138b5b419 Mon Sep 17 00:00:00 2001 From: David Palacio Date: Thu, 5 May 2011 20:51:05 +0000 Subject: [PATCH] Test if the file is readable if it is a regular file. *REVIEW: 6667 svn path=/trunk/KDE/kdegraphics/okular/; revision=1230523 --- core/document.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/document.cpp b/core/document.cpp index 589888121..8af184070 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -1538,9 +1538,9 @@ bool Document::openDocument( const QString & docFile, const KUrl& url, const KMi if ( mime.count() <= 0 ) return false; - // docFile is always local so we can use QFile on it - QFile fileReadTest( docFile ); - if ( !fileReadTest.open( QIODevice::ReadOnly ) ) + // docFile is always local so we can use QFileInfo on it + QFileInfo fileReadTest( docFile ); + if ( fileReadTest.isFile() && !fileReadTest.isReadable() ) { d->m_docFileName.clear(); return false; @@ -1553,7 +1553,6 @@ bool Document::openDocument( const QString & docFile, const KUrl& url, const KMi QString fn = url.fileName(); document_size = fileReadTest.size(); fn = QString::number( document_size ) + '.' + fn + ".xml"; - fileReadTest.close(); QString newokular = "okular/docdata/" + fn; QString newokularfile = KStandardDirs::locateLocal( "data", newokular ); if ( !QFile::exists( newokularfile ) )