mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-24 18:35:37 +00:00
when i said all linked i lied because i still had to commit that ;-)
svn path=/branches/work/kde4/playground/graphics/okular/; revision=522271
This commit is contained in:
parent
9db38ffa47
commit
7ae1f13b3f
|
@ -1,6 +1,6 @@
|
||||||
SUBDIRS = conf core ui shell generators
|
SUBDIRS = conf core ui shell generators
|
||||||
|
|
||||||
INCLUDES = $(all_includes) $(FREETYPE_CFLAGS)
|
INCLUDES = -I conf $(all_includes) $(FREETYPE_CFLAGS)
|
||||||
|
|
||||||
METASOURCES = AUTO
|
METASOURCES = AUTO
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
kde_module_LTLIBRARIES = \
|
kde_module_LTLIBRARIES = \
|
||||||
libokularGenerator_kimgio.la
|
libokularGenerator_kimgio.la
|
||||||
|
|
||||||
INCLUDES = -I../../ $(all_includes)
|
INCLUDES = -I$(srcdir)/../.. -I../../ $(all_includes)
|
||||||
|
|
||||||
libokularGenerator_kimgio_la_LIBADD = ../../core/liboKularcore.la \
|
libokularGenerator_kimgio_la_LIBADD = ../../core/liboKularcore.la \
|
||||||
../../conf/liboKularconf.la $(LIB_KDEUI)
|
../../conf/liboKularconf.la $(LIB_KDEUI)
|
||||||
|
|
|
@ -26,7 +26,7 @@ KIMGIOGenerator::~KIMGIOGenerator()
|
||||||
delete m_pix;
|
delete m_pix;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KIMGIOGenerator::loadDocument( const QString & fileName, QValueVector<KPDFPage*> & pagesVector )
|
bool KIMGIOGenerator::loadDocument( const QString & fileName, QVector<KPDFPage*> & pagesVector )
|
||||||
{
|
{
|
||||||
m_pix = new QPixmap(fileName);
|
m_pix = new QPixmap(fileName);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class KIMGIOGenerator : public Generator
|
||||||
virtual ~KIMGIOGenerator();
|
virtual ~KIMGIOGenerator();
|
||||||
|
|
||||||
// [INHERITED] load a document and fill up the pagesVector
|
// [INHERITED] load a document and fill up the pagesVector
|
||||||
bool loadDocument( const QString & fileName, QValueVector<KPDFPage*> & pagesVector );
|
bool loadDocument( const QString & fileName, QVector<KPDFPage*> & pagesVector );
|
||||||
|
|
||||||
// [INHERITED] perform actions on document / pages
|
// [INHERITED] perform actions on document / pages
|
||||||
bool canGeneratePixmap( bool async );
|
bool canGeneratePixmap( bool async );
|
||||||
|
@ -34,7 +34,7 @@ class KIMGIOGenerator : public Generator
|
||||||
bool supportsSearching() { return false; };
|
bool supportsSearching() { return false; };
|
||||||
bool supportsRotation() { return false; };
|
bool supportsRotation() { return false; };
|
||||||
bool prefersInternalSearching() { return false; };
|
bool prefersInternalSearching() { return false; };
|
||||||
void setOrientation(QValueVector<KPDFPage*> & pagesVector, int orientation) {;};
|
void setOrientation(QVector<KPDFPage*> & pagesVector, int orientation) {;};
|
||||||
RegularAreaRect* findText(const QString&, SearchDir, bool, const RegularAreaRect*, KPDFPage*)
|
RegularAreaRect* findText(const QString&, SearchDir, bool, const RegularAreaRect*, KPDFPage*)
|
||||||
{ return 0; };
|
{ return 0; };
|
||||||
QString * getText(const RegularAreaRect*, KPDFPage*) { return 0; };
|
QString * getText(const RegularAreaRect*, KPDFPage*) { return 0; };
|
||||||
|
|
77
part.cpp
77
part.cpp
|
@ -42,12 +42,13 @@
|
||||||
#include <kparts/genericfactory.h>
|
#include <kparts/genericfactory.h>
|
||||||
#include <k3urldrag.h>
|
#include <k3urldrag.h>
|
||||||
#include <kfiledialog.h>
|
#include <kfiledialog.h>
|
||||||
|
#include <kfind.h>
|
||||||
#include <kmessagebox.h>
|
#include <kmessagebox.h>
|
||||||
#include <kfinddialog.h>
|
#include <kfinddialog.h>
|
||||||
#include <knuminput.h>
|
#include <knuminput.h>
|
||||||
#include <kiconloader.h>
|
#include <kiconloader.h>
|
||||||
#include <kio/netaccess.h>
|
#include <kio/netaccess.h>
|
||||||
#include <k3popupmenu.h>
|
#include <kmenu.h>
|
||||||
#include <kxmlguiclient.h>
|
#include <kxmlguiclient.h>
|
||||||
#include <kxmlguifactory.h>
|
#include <kxmlguifactory.h>
|
||||||
#include <ktrader.h>
|
#include <ktrader.h>
|
||||||
|
@ -84,14 +85,14 @@ using namespace oKular;
|
||||||
Part::Part(QWidget *parentWidget, const char *widgetName,
|
Part::Part(QWidget *parentWidget, const char *widgetName,
|
||||||
QObject *parent, const char *name,
|
QObject *parent, const char *name,
|
||||||
const QStringList & /*args*/ )
|
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_showMenuBarAction(0), m_showFullScreenAction(0), m_actionsSearched(false),
|
||||||
m_searchStarted(false)
|
m_searchStarted(false)
|
||||||
{
|
{
|
||||||
// connect the started signal to tell the job the mimetypes we like
|
// connect the started signal to tell the job the mimetypes we like
|
||||||
connect(this, SIGNAL(started(KIO::Job *)), this, SLOT(setMimeTypes(KIO::Job *)));
|
connect(this, SIGNAL(started(KIO::Job *)), this, SLOT(setMimeTypes(KIO::Job *)));
|
||||||
// load catalog for translation
|
// load catalog for translation
|
||||||
KGlobal::locale()->insertCatalogue("oKular");
|
KGlobal::locale()->insertCatalog("oKular");
|
||||||
|
|
||||||
// create browser extension (for printing when embedded into browser)
|
// create browser extension (for printing when embedded into browser)
|
||||||
m_bExtension = new BrowserExtension(this);
|
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( openURL(const KUrl &) ), this, SLOT( openURLFromDocument(const KUrl &) ) );
|
||||||
connect( m_document, SIGNAL( close() ), this, SLOT( close() ) );
|
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() ) );
|
connect( m_document, SIGNAL( quit() ), parent, SLOT( slotQuit() ) );
|
||||||
else
|
else
|
||||||
connect( m_document, SIGNAL( quit() ), this, SLOT( cannotQuit() ) );
|
connect( m_document, SIGNAL( quit() ), this, SLOT( cannotQuit() ) );
|
||||||
|
@ -282,7 +283,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
||||||
m_pageView->setupActions( ac );
|
m_pageView->setupActions( ac );
|
||||||
|
|
||||||
// apply configuration (both internal settings and GUI configured items)
|
// apply configuration (both internal settings and GUI configured items)
|
||||||
QValueList<int> splitterSizes = KpdfSettings::splitterSizes();
|
QList<int> splitterSizes = KpdfSettings::splitterSizes();
|
||||||
if ( !splitterSizes.count() )
|
if ( !splitterSizes.count() )
|
||||||
{
|
{
|
||||||
// the first time use 1/10 for the panel and 9/10 for the pageView
|
// 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_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
|
// we didn't find an instance of this dialog, so lets create it
|
||||||
KConfigDialog * dialog = new KConfigDialog( m_pageView, "generator_prefs", KpdfSettings::self() );
|
KConfigDialog * dialog = new KConfigDialog( m_pageView, "generator_prefs", KpdfSettings::self() );
|
||||||
|
|
||||||
QDictIterator<Generator> it(m_loadedGenerators);
|
QHashIterator<QString, Generator*> it(m_loadedGenerators);
|
||||||
for( ; it.current(); ++it )
|
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
|
// (for now dont FIXME) keep us informed when the user changes settings
|
||||||
|
@ -784,7 +784,7 @@ void Part::slotFind()
|
||||||
{
|
{
|
||||||
m_searchStarted = true;
|
m_searchStarted = true;
|
||||||
m_document->resetSearch( PART_SEARCH_ID );
|
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 ) );
|
KPDFDocument::NextMatch, true, qRgb( 255, 255, 64 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -804,7 +804,7 @@ void Part::slotSaveFileAs()
|
||||||
{
|
{
|
||||||
if ( KIO::NetAccess::exists( saveURL, false, widget() ) )
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -856,8 +856,8 @@ void Part::slotNewConfig()
|
||||||
m_searchWidget->setShown( showSearch );
|
m_searchWidget->setShown( showSearch );
|
||||||
|
|
||||||
// Main View (pageView)
|
// Main View (pageView)
|
||||||
QScrollView::ScrollBarMode scrollBarMode = KpdfSettings::showScrollBars() ?
|
Q3ScrollView::ScrollBarMode scrollBarMode = KpdfSettings::showScrollBars() ?
|
||||||
QScrollView::AlwaysOn : QScrollView::AlwaysOff;
|
Q3ScrollView::AlwaysOn : Q3ScrollView::AlwaysOff;
|
||||||
if ( m_pageView->hScrollBarMode() != scrollBarMode )
|
if ( m_pageView->hScrollBarMode() != scrollBarMode )
|
||||||
{
|
{
|
||||||
m_pageView->setHScrollBarMode( scrollBarMode );
|
m_pageView->setHScrollBarMode( scrollBarMode );
|
||||||
|
@ -911,18 +911,18 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point)
|
||||||
if (!m_actionsSearched)
|
if (!m_actionsSearched)
|
||||||
{
|
{
|
||||||
// the quest for options_show_menubar
|
// the quest for options_show_menubar
|
||||||
KXMLGUIClient *client;
|
#warning need to port the quest for options_show_menubar
|
||||||
|
/* KXMLGUIClient *client;
|
||||||
KActionCollection *ac;
|
KActionCollection *ac;
|
||||||
KActionPtrList::const_iterator it, end, begin;
|
KActionPtrList::const_iterator it, end, begin;
|
||||||
KActionPtrList actions;
|
KActionPtrList actions;
|
||||||
|
|
||||||
if (factory())
|
if (factory())
|
||||||
{
|
{
|
||||||
QPtrList<KXMLGUIClient> clients(factory()->clients());
|
QList<KXMLGUIClient*> clients(factory()->clients());
|
||||||
QPtrListIterator<KXMLGUIClient> clientsIt( clients );
|
for(int i = 0 ; (!m_showMenuBarAction || !m_showFullScreenAction) && i < clients.size(); ++i)
|
||||||
for( ; (!m_showMenuBarAction || !m_showFullScreenAction) && clientsIt.current(); ++clientsIt)
|
|
||||||
{
|
{
|
||||||
client = clientsIt.current();
|
client = clients.at(i);
|
||||||
ac = client->actionCollection();
|
ac = client->actionCollection();
|
||||||
actions = ac->actions();
|
actions = ac->actions();
|
||||||
end = actions.end();
|
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);
|
if (QString((*it)->name()) == "fullscreen") m_showFullScreenAction = (KToggleAction*)(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
m_actionsSearched = true;
|
m_actionsSearched = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KMenu *popup = new KMenu( widget() );
|
||||||
KPopupMenu *popup = new KPopupMenu( widget(), "rmb popup" );
|
QAction *toggleBookmark, *fitPageWidth;
|
||||||
|
toggleBookmark = 0;
|
||||||
|
fitPageWidth = 0;
|
||||||
if (page)
|
if (page)
|
||||||
{
|
{
|
||||||
popup->insertTitle( i18n( "Page %1" ).arg( page->number() + 1 ) );
|
popup->addTitle( i18n( "Page %1" ).arg( page->number() + 1 ) );
|
||||||
if ( page->hasBookmark() )
|
if ( page->hasBookmark() )
|
||||||
popup->insertItem( SmallIcon("bookmark"), i18n("Remove Bookmark"), 1 );
|
toggleBookmark = popup->addAction( QIcon(SmallIcon("bookmark")), i18n("Remove Bookmark") );
|
||||||
else
|
else
|
||||||
popup->insertItem( SmallIcon("bookmark_add"), i18n("Add Bookmark"), 1 );
|
toggleBookmark = popup->addAction( QIcon(SmallIcon("bookmark_add")), i18n("Add Bookmark") );
|
||||||
if ( m_pageView->canFitPageWidth() )
|
if ( m_pageView->canFitPageWidth() )
|
||||||
popup->insertItem( SmallIcon("viewmagfit"), i18n("Fit Width"), 2 );
|
fitPageWidth = popup->addAction( QIcon(SmallIcon("viewmagfit")), i18n("Fit Width") );
|
||||||
//popup->insertItem( SmallIcon("view_fit_width"), i18n("Zoom This"), 2 );
|
|
||||||
//popup->insertItem( SmallIcon("pencil"), i18n("Edit"), 3 );
|
//popup->insertItem( SmallIcon("pencil"), i18n("Edit"), 3 );
|
||||||
//popup->setItemEnabled( 3, false );
|
//popup->setItemEnabled( 3, false );
|
||||||
reallyShow = true;
|
reallyShow = true;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
//Albert says: I have not ported this as i don't see it does anything
|
//Albert says: I have not ported this as i don't see it does anything
|
||||||
if ( d->mouseOnRect ) // and rect->objectType() == ObjectRect::Image ...
|
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()))
|
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_showMenuBarAction && !m_showMenuBarAction->isChecked()) m_showMenuBarAction->plug(popup);
|
||||||
if (m_showFullScreenAction && m_showFullScreenAction->isChecked()) m_showFullScreenAction->plug(popup);
|
if (m_showFullScreenAction && m_showFullScreenAction->isChecked()) m_showFullScreenAction->plug(popup);
|
||||||
reallyShow = true;
|
reallyShow = true;
|
||||||
|
@ -972,17 +973,9 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point)
|
||||||
|
|
||||||
if (reallyShow)
|
if (reallyShow)
|
||||||
{
|
{
|
||||||
switch ( popup->exec(point) )
|
QAction *res = popup->exec(point);
|
||||||
{
|
if (res == toggleBookmark) m_document->toggleBookmark( page->number() );
|
||||||
case 1:
|
else if (res == fitPageWidth) m_pageView->fitPageWidth( page->number() );
|
||||||
m_document->toggleBookmark( page->number() );
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
m_pageView->fitPageWidth( page->number() );
|
|
||||||
break;
|
|
||||||
// case 3: // switch to edit mode
|
|
||||||
// break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
delete popup;
|
delete popup;
|
||||||
}
|
}
|
||||||
|
@ -1075,7 +1068,7 @@ void Part::psTransformEnded()
|
||||||
* BrowserExtension class
|
* BrowserExtension class
|
||||||
*/
|
*/
|
||||||
BrowserExtension::BrowserExtension(Part* parent)
|
BrowserExtension::BrowserExtension(Part* parent)
|
||||||
: KParts::BrowserExtension( parent, "KPDF::BrowserExtension" )
|
: KParts::BrowserExtension( parent )
|
||||||
{
|
{
|
||||||
emit enableAction("print", true);
|
emit enableAction("print", true);
|
||||||
setURLDropHandlingEnabled(true);
|
setURLDropHandlingEnabled(true);
|
||||||
|
|
16
part.h
16
part.h
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include <kparts/browserextension.h>
|
#include <kparts/browserextension.h>
|
||||||
#include <kparts/part.h>
|
#include <kparts/part.h>
|
||||||
#include <qguardedptr.h>
|
#include <qpointer.h>
|
||||||
#include "core/observer.h"
|
#include "core/observer.h"
|
||||||
#include "core/document.h"
|
#include "core/document.h"
|
||||||
#include "dcop.h"
|
#include "dcop.h"
|
||||||
|
@ -146,11 +146,11 @@ private:
|
||||||
QWidget *m_leftPanel;
|
QWidget *m_leftPanel;
|
||||||
QToolBox *m_toolBox;
|
QToolBox *m_toolBox;
|
||||||
SearchWidget *m_searchWidget;
|
SearchWidget *m_searchWidget;
|
||||||
QGuardedPtr<ThumbnailList> m_thumbnailList;
|
QPointer<ThumbnailList> m_thumbnailList;
|
||||||
QGuardedPtr<PageView> m_pageView;
|
QPointer<PageView> m_pageView;
|
||||||
QGuardedPtr<TOC> m_toc;
|
QPointer<TOC> m_toc;
|
||||||
QGuardedPtr<MiniBar> m_miniBar;
|
QPointer<MiniBar> m_miniBar;
|
||||||
QGuardedPtr<PresentationWidget> m_presentationWidget;
|
QPointer<PresentationWidget> m_presentationWidget;
|
||||||
|
|
||||||
// document watcher (and reloader) variables
|
// document watcher (and reloader) variables
|
||||||
KDirWatch *m_watcher;
|
KDirWatch *m_watcher;
|
||||||
|
@ -179,8 +179,8 @@ private:
|
||||||
bool m_searchStarted;
|
bool m_searchStarted;
|
||||||
BrowserExtension *m_bExtension;
|
BrowserExtension *m_bExtension;
|
||||||
|
|
||||||
// QDict: key is the name of the generator
|
// QHash: key is the name of the generator
|
||||||
QDict<Generator> m_loadedGenerators;
|
QHash<QString, Generator*> m_loadedGenerators;
|
||||||
// list of names of the generators that have settings
|
// list of names of the generators that have settings
|
||||||
QStringList m_generatorsWithSettings;
|
QStringList m_generatorsWithSettings;
|
||||||
QStringList m_supportedMimeTypes;
|
QStringList m_supportedMimeTypes;
|
||||||
|
|
Loading…
Reference in a new issue