- update openDocument and freegui stuff

svn path=/trunk/playground/graphics/oKular/kpdf/; revision=455516
remotes/origin/okular3-playground
Piotr Szymanski 21 years ago
parent 402ec73285
commit 3cbcb2fb7f
  1. 16
      core/document.cpp
  2. 2
      core/document.h
  3. 4
      core/generator.h
  4. 8
      generators/ghostview/generator_ghostview.cpp
  5. 2
      generators/ghostview/generator_ghostview.h

@ -193,7 +193,7 @@ bool KPDFDocument::openDocument( const QString & docFile, const KURL & url )
}
QString propName=offers[hRank]->property("Name").toString();
bool cached=false;
bool m_usingCachedGenerator=false;
generator=m_loadedGenerators->take(propName);
if (!generator)
{
@ -221,14 +221,14 @@ bool KPDFDocument::openDocument( const QString & docFile, const KURL & url )
if ( offers[hRank]->property("[X-KDE-oKularHasInternalSettings]").toBool() )
{
m_loadedGenerators->insert(propName,generator);
cached=true;
m_usingCachedGenerator=true;
}
// end
}
else
{
generator -> setDocument( this );
cached=true;
m_usingCachedGenerator=true;
}
// connect error reporting signals
connect (generator,SIGNAL(error(QString&,int )),this,SIGNAL(error(QString&,int )));
@ -241,7 +241,7 @@ bool KPDFDocument::openDocument( const QString & docFile, const KURL & url )
QApplication::restoreOverrideCursor();
if ( !openOk || pages_vector.size() <= 0 )
{
if (!cached)
if (!m_usingCachedGenerator)
{
delete generator;
}
@ -319,8 +319,12 @@ void KPDFDocument::closeDocument()
if ( d->saveBookmarksTimer )
d->saveBookmarksTimer->stop();
// delete contents generator
delete generator;
generator->freeGUI();
if (!m_usingCachedGenerator)
{
// delete contents generator
delete generator;
}
generator = 0;
d->url = KURL();
// remove requests left in queue

@ -139,6 +139,7 @@ class KPDFDocument : public QObject
bool openRelativeFile( const QString & fileName );
QDict<Generator>* m_loadedGenerators ;
Generator * generator;
bool m_usingCachedGenerator;
QValueVector< KPDFPage * > pages_vector;
class KPDFDocumentPrivate * d;
@ -223,6 +224,7 @@ class DocumentInfo : public QDomDocument
*
* In the tree the tag name is the 'screen' name of the entry. A tag can have
* attributes. Here follows the list of tag attributes with meaning:
* - Icon: An icon to be set in the Lisview for the node
* - Viewport: A string description of the referred viewport
* - ViewportName: A 'named reference' to the viewport that must be converted
* using getMetaData( "NamedViewport", *viewport_name* )

@ -71,8 +71,8 @@ class Generator : public QObject
virtual void generateSyncTextPage( KPDFPage * page ) = 0;
// gui stuff
virtual QString getXMLFile() = 0;
virtual void setupGUI(KActionCollection * ac , QToolBox * tBox ) = 0;
virtual void setupGUI(KActionCollection * /*ac*/ , QToolBox * /*tBox*/ ) {;};
virtual void freeGUI( ) {;};
// capability querying
// provides internal search
virtual bool supportsSearching() = 0;

@ -221,6 +221,14 @@ void GSGenerator::setupGUI(KActionCollection * /*ac*/ , QToolBox * tBox )
}
}
void GSGenerator::freeGUI()
{
if ( GSSettings::messages() )
{
m_box->removeItem(m_logWindow);
}
}
bool GSGenerator::loadPages( QValueVector< KPDFPage * > & pagesVector )
{
unsigned int i, end=internalDoc->dsc() -> page_count();

@ -52,7 +52,7 @@ class GSGenerator : public Generator
QString getXMLFile() { return QString::null; };
void setupGUI(KActionCollection * /*ac*/ , QToolBox * /* tBox */) ;
void freeGUI() ;
// internal search and gettext
RegularAreaRect * findText( const QString & /* text*/, SearchDir /* dir*/, const bool /* strictCase*/,
const RegularAreaRect * /*lastRect*/, KPDFPage * /* page*/) { return 0L;} ;

Loading…
Cancel
Save