Commit 2b8427a5 authored by Albert Astals Cid's avatar Albert Astals Cid

Add bool KPDFDocument::isOpened() const and use it so that the user can not...

Add bool KPDFDocument::isOpened() const and use it so that the user can not begin a find-ahead search if no document is loaded

svn path=/trunk/kdegraphics/kpdf/; revision=378613
parent 5e9dff37
/***************************************************************************
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
* Copyright (C) 2004-2005 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -129,7 +129,11 @@ bool KPDFDocument::openDocument( const QString & docFile )
bool openOk = generator->loadDocument( docFile, pages_vector );
QApplication::restoreOverrideCursor();
if ( !openOk || pages_vector.size() <= 0 )
{
delete generator;
generator = 0;
return openOk;
}
// 2. load Additional Data (our bookmarks and metadata) about the document
loadDocumentInfo();
......@@ -231,6 +235,11 @@ void KPDFDocument::reparseConfig()
}
bool KPDFDocument::isOpened() const
{
return generator;
}
const DocumentInfo * KPDFDocument::documentInfo() const
{
return generator ? generator->documentInfo() : NULL;
......
/***************************************************************************
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
* Copyright (C) 2004-2005 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -60,6 +60,7 @@ class KPDFDocument : public QObject // only for a private slot..
void reparseConfig();
// query methods (const ones)
bool isOpened() const;
const DocumentInfo * documentInfo() const;
const DocumentSynopsis * documentSynopsis() const;
const KPDFPage * page( uint page ) const;
......
......@@ -548,7 +548,7 @@ void PageView::keyPressEvent( QKeyEvent * e )
return;
}
}
else if(e->key() == '/')
else if(e->key() == '/' && d->document->isOpened())
{
d->findString="";
d->messageWindow->display(i18n("Starting -- find text as you type"), PageViewMessage::Info, 3000);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment