Test if the file is readable if it is a regular file.

*REVIEW: 6667

svn path=/trunk/KDE/kdegraphics/okular/; revision=1230523
remotes/origin/KDE/4.7
David Palacio 15 years ago
parent fedc888dd5
commit db7d8ff608
  1. 7
      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 ) )

Loading…
Cancel
Save