diff --git a/Makefile.am b/Makefile.am index a23596289..d27bceb5c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = conf core ui shell generators - -INCLUDES = $(all_includes) $(FREETYPE_CFLAGS) + +INCLUDES = -I conf $(all_includes) $(FREETYPE_CFLAGS) METASOURCES = AUTO diff --git a/generators/kimgio/Makefile.am b/generators/kimgio/Makefile.am index 8836ade80..c65cdf9e8 100644 --- a/generators/kimgio/Makefile.am +++ b/generators/kimgio/Makefile.am @@ -1,7 +1,7 @@ kde_module_LTLIBRARIES = \ libokularGenerator_kimgio.la -INCLUDES = -I../../ $(all_includes) +INCLUDES = -I$(srcdir)/../.. -I../../ $(all_includes) libokularGenerator_kimgio_la_LIBADD = ../../core/liboKularcore.la \ ../../conf/liboKularconf.la $(LIB_KDEUI) diff --git a/generators/kimgio/generator_kimgio.cpp b/generators/kimgio/generator_kimgio.cpp index c621da1d0..e2095a4ca 100644 --- a/generators/kimgio/generator_kimgio.cpp +++ b/generators/kimgio/generator_kimgio.cpp @@ -26,7 +26,7 @@ KIMGIOGenerator::~KIMGIOGenerator() delete m_pix; } -bool KIMGIOGenerator::loadDocument( const QString & fileName, QValueVector & pagesVector ) +bool KIMGIOGenerator::loadDocument( const QString & fileName, QVector & pagesVector ) { m_pix = new QPixmap(fileName); diff --git a/generators/kimgio/generator_kimgio.h b/generators/kimgio/generator_kimgio.h index c2ae3b503..a67a7facd 100644 --- a/generators/kimgio/generator_kimgio.h +++ b/generators/kimgio/generator_kimgio.h @@ -20,7 +20,7 @@ class KIMGIOGenerator : public Generator virtual ~KIMGIOGenerator(); // [INHERITED] load a document and fill up the pagesVector - bool loadDocument( const QString & fileName, QValueVector & pagesVector ); + bool loadDocument( const QString & fileName, QVector & pagesVector ); // [INHERITED] perform actions on document / pages bool canGeneratePixmap( bool async ); @@ -34,7 +34,7 @@ class KIMGIOGenerator : public Generator bool supportsSearching() { return false; }; bool supportsRotation() { return false; }; bool prefersInternalSearching() { return false; }; - void setOrientation(QValueVector & pagesVector, int orientation) {;}; + void setOrientation(QVector & pagesVector, int orientation) {;}; RegularAreaRect* findText(const QString&, SearchDir, bool, const RegularAreaRect*, KPDFPage*) { return 0; }; QString * getText(const RegularAreaRect*, KPDFPage*) { return 0; }; diff --git a/part.cpp b/part.cpp index 97f6675f0..616f34335 100644 --- a/part.cpp +++ b/part.cpp @@ -42,12 +42,13 @@ #include #include #include +#include #include #include #include #include #include -#include +#include #include #include #include @@ -84,14 +85,14 @@ using namespace oKular; Part::Part(QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const QStringList & /*args*/ ) - : DCOPObject("oKular"), KParts::ReadOnlyPart(parent, name), m_viewportDirty( 0 ), + : DCOPObject("oKular"), KParts::ReadOnlyPart(parent), m_viewportDirty( 0 ), m_showMenuBarAction(0), m_showFullScreenAction(0), m_actionsSearched(false), m_searchStarted(false) { // connect the started signal to tell the job the mimetypes we like connect(this, SIGNAL(started(KIO::Job *)), this, SLOT(setMimeTypes(KIO::Job *))); // load catalog for translation - KGlobal::locale()->insertCatalogue("oKular"); + KGlobal::locale()->insertCatalog("oKular"); // create browser extension (for printing when embedded into browser) m_bExtension = new BrowserExtension(this); @@ -108,7 +109,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName, connect( m_document, SIGNAL( openURL(const KUrl &) ), this, SLOT( openURLFromDocument(const KUrl &) ) ); connect( m_document, SIGNAL( close() ), this, SLOT( close() ) ); - if (parent && parent->metaObject()->slotNames(true).contains("slotQuit()")) + if ( parent && parent->metaObject()->indexOfSlot( SLOT( slotQuit() ) ) != -1 ) connect( m_document, SIGNAL( quit() ), parent, SLOT( slotQuit() ) ); else connect( m_document, SIGNAL( quit() ), this, SLOT( cannotQuit() ) ); @@ -282,7 +283,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName, m_pageView->setupActions( ac ); // apply configuration (both internal settings and GUI configured items) - QValueList splitterSizes = KpdfSettings::splitterSizes(); + QList splitterSizes = KpdfSettings::splitterSizes(); if ( !splitterSizes.count() ) { // the first time use 1/10 for the panel and 9/10 for the pageView @@ -391,8 +392,6 @@ void Part::fillGenerators() m_generatorsWithSettings << propName; } } - - m_loadedGenerators.setAutoDelete(true); } } @@ -409,10 +408,11 @@ void Part::slotGeneratorPreferences( ) // we didn't find an instance of this dialog, so lets create it KConfigDialog * dialog = new KConfigDialog( m_pageView, "generator_prefs", KpdfSettings::self() ); - QDictIterator it(m_loadedGenerators); - for( ; it.current(); ++it ) + QHashIterator it(m_loadedGenerators); + while(it.hasNext()) { - it.current()->addPages(dialog); + it.next(); + it.value()->addPages(dialog); } // (for now dont FIXME) keep us informed when the user changes settings @@ -784,7 +784,7 @@ void Part::slotFind() { m_searchStarted = true; m_document->resetSearch( PART_SEARCH_ID ); - m_document->searchText( PART_SEARCH_ID, dlg.pattern(), false, dlg.options() & KFindDialog::CaseSensitive, + m_document->searchText( PART_SEARCH_ID, dlg.pattern(), false, dlg.options() & KFind::CaseSensitive, KPDFDocument::NextMatch, true, qRgb( 255, 255, 64 ) ); } } @@ -804,7 +804,7 @@ void Part::slotSaveFileAs() { if ( KIO::NetAccess::exists( saveURL, false, widget() ) ) { - if (KMessageBox::warningContinueCancel( widget(), i18n("A file named \"%1\" already exists. Are you sure you want to overwrite it?").arg(saveURL.filename()), QString::null, i18n("Overwrite")) != KMessageBox::Continue) + if (KMessageBox::warningContinueCancel( widget(), i18n("A file named \"%1\" already exists. Are you sure you want to overwrite it?").arg(saveURL.fileName()), QString::null, i18n("Overwrite")) != KMessageBox::Continue) return; } @@ -856,8 +856,8 @@ void Part::slotNewConfig() m_searchWidget->setShown( showSearch ); // Main View (pageView) - QScrollView::ScrollBarMode scrollBarMode = KpdfSettings::showScrollBars() ? - QScrollView::AlwaysOn : QScrollView::AlwaysOff; + Q3ScrollView::ScrollBarMode scrollBarMode = KpdfSettings::showScrollBars() ? + Q3ScrollView::AlwaysOn : Q3ScrollView::AlwaysOff; if ( m_pageView->hScrollBarMode() != scrollBarMode ) { m_pageView->setHScrollBarMode( scrollBarMode ); @@ -911,18 +911,18 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point) if (!m_actionsSearched) { // the quest for options_show_menubar - KXMLGUIClient *client; +#warning need to port the quest for options_show_menubar +/* KXMLGUIClient *client; KActionCollection *ac; KActionPtrList::const_iterator it, end, begin; KActionPtrList actions; if (factory()) { - QPtrList clients(factory()->clients()); - QPtrListIterator clientsIt( clients ); - for( ; (!m_showMenuBarAction || !m_showFullScreenAction) && clientsIt.current(); ++clientsIt) + QList clients(factory()->clients()); + for(int i = 0 ; (!m_showMenuBarAction || !m_showFullScreenAction) && i < clients.size(); ++i) { - client = clientsIt.current(); + client = clients.at(i); ac = client->actionCollection(); actions = ac->actions(); end = actions.end(); @@ -933,26 +933,27 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point) if (QString((*it)->name()) == "fullscreen") m_showFullScreenAction = (KToggleAction*)(*it); } } - } + }*/ m_actionsSearched = true; } - - KPopupMenu *popup = new KPopupMenu( widget(), "rmb popup" ); + KMenu *popup = new KMenu( widget() ); + QAction *toggleBookmark, *fitPageWidth; + toggleBookmark = 0; + fitPageWidth = 0; if (page) { - popup->insertTitle( i18n( "Page %1" ).arg( page->number() + 1 ) ); - if ( page->hasBookmark() ) - popup->insertItem( SmallIcon("bookmark"), i18n("Remove Bookmark"), 1 ); + popup->addTitle( i18n( "Page %1" ).arg( page->number() + 1 ) ); + if ( page->hasBookmark() ) + toggleBookmark = popup->addAction( QIcon(SmallIcon("bookmark")), i18n("Remove Bookmark") ); else - popup->insertItem( SmallIcon("bookmark_add"), i18n("Add Bookmark"), 1 ); + toggleBookmark = popup->addAction( QIcon(SmallIcon("bookmark_add")), i18n("Add Bookmark") ); if ( m_pageView->canFitPageWidth() ) - popup->insertItem( SmallIcon("viewmagfit"), i18n("Fit Width"), 2 ); - //popup->insertItem( SmallIcon("view_fit_width"), i18n("Zoom This"), 2 ); + fitPageWidth = popup->addAction( QIcon(SmallIcon("viewmagfit")), i18n("Fit Width") ); //popup->insertItem( SmallIcon("pencil"), i18n("Edit"), 3 ); //popup->setItemEnabled( 3, false ); reallyShow = true; - } + } /* //Albert says: I have not ported this as i don't see it does anything if ( d->mouseOnRect ) // and rect->objectType() == ObjectRect::Image ... @@ -963,7 +964,7 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point) if ((m_showMenuBarAction && !m_showMenuBarAction->isChecked()) || (m_showFullScreenAction && m_showFullScreenAction->isChecked())) { - popup->insertTitle( i18n( "Tools" ) ); + popup->addTitle( i18n( "Tools" ) ); if (m_showMenuBarAction && !m_showMenuBarAction->isChecked()) m_showMenuBarAction->plug(popup); if (m_showFullScreenAction && m_showFullScreenAction->isChecked()) m_showFullScreenAction->plug(popup); reallyShow = true; @@ -972,17 +973,9 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point) if (reallyShow) { - switch ( popup->exec(point) ) - { - case 1: - m_document->toggleBookmark( page->number() ); - break; - case 2: - m_pageView->fitPageWidth( page->number() ); - break; - // case 3: // switch to edit mode - // break; - } + QAction *res = popup->exec(point); + if (res == toggleBookmark) m_document->toggleBookmark( page->number() ); + else if (res == fitPageWidth) m_pageView->fitPageWidth( page->number() ); } delete popup; } @@ -1075,7 +1068,7 @@ void Part::psTransformEnded() * BrowserExtension class */ BrowserExtension::BrowserExtension(Part* parent) - : KParts::BrowserExtension( parent, "KPDF::BrowserExtension" ) + : KParts::BrowserExtension( parent ) { emit enableAction("print", true); setURLDropHandlingEnabled(true); diff --git a/part.h b/part.h index 77f43bdcb..c5e11955c 100644 --- a/part.h +++ b/part.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include "core/observer.h" #include "core/document.h" #include "dcop.h" @@ -146,11 +146,11 @@ private: QWidget *m_leftPanel; QToolBox *m_toolBox; SearchWidget *m_searchWidget; - QGuardedPtr m_thumbnailList; - QGuardedPtr m_pageView; - QGuardedPtr m_toc; - QGuardedPtr m_miniBar; - QGuardedPtr m_presentationWidget; + QPointer m_thumbnailList; + QPointer m_pageView; + QPointer m_toc; + QPointer m_miniBar; + QPointer m_presentationWidget; // document watcher (and reloader) variables KDirWatch *m_watcher; @@ -179,8 +179,8 @@ private: bool m_searchStarted; BrowserExtension *m_bExtension; - // QDict: key is the name of the generator - QDict m_loadedGenerators; + // QHash: key is the name of the generator + QHash m_loadedGenerators; // list of names of the generators that have settings QStringList m_generatorsWithSettings; QStringList m_supportedMimeTypes;