Commit 99a10e18 authored by Albert Astals Cid's avatar Albert Astals Cid

All fixes done in HEAD come to annotations branch

svn path=/branches/kpdf_annotations/kdegraphics/kpdf/; revision=395067
parent c6191c48
......@@ -111,6 +111,14 @@
<string>Show &amp;hints and info messages</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ObeyDRM</cstring>
</property>
<property name="text">
<string>&amp;Obey DRM limitations</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QLayoutWidget">
......@@ -223,7 +231,11 @@
<includes>
<include location="global" impldecl="in implementation">kdialog.h</include>
<include location="global" impldecl="in implementation">kiconloader.h</include>
<include location="local" impldecl="in implementation">dlggeneral.ui.h</include>
</includes>
<functions>
<function access="protected" specifier="non virtual">showEvent( QShowEvent * )</function>
</functions>
<pixmapfunction>DesktopIcon</pixmapfunction>
<layoutdefaults spacing="6" margin="11"/>
</UI>
......@@ -53,6 +53,9 @@
<entry key="WatchFile" type="Bool" >
<default>true</default>
</entry>
<entry key="ObeyDRM" type="Bool" >
<default>true</default>
</entry>
</group>
<group name="MainView" >
<entry key="ShowLeftPanel" type="Bool" >
......@@ -70,7 +73,7 @@
<entry key="ShowScrollBars" type="Bool" >
<default>true</default>
</entry>
<entry key="ViewContinous" type="Bool" >
<entry key="ViewContinuous" type="Bool" >
<default>true</default>
</entry>
<entry key="ViewColumns" type="UInt" >
......
......@@ -77,35 +77,41 @@ else
AC_DEFINE(HAVE_FSEEK64, 0)
fi
dnl #### Check for libt1
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
kpdf_have_t1lib=
KDE_CHECK_LIB(t1, T1_InitLib, [LIBT1="-lt1"; kpdf_have_t1lib=yes],
[
kpdf_have_t1lib=no
])
AC_SUBST(LIBT1)
if test $kpdf_have_t1lib = yes; then
AC_DEFINE_UNQUOTED(HAVE_T1LIB_H, 1, [Defines if your system has the t1 library])
else
AC_DEFINE_UNQUOTED(HAVE_T1LIB_H, 0, [Defines if your system has the t1 library])
fi
AC_LANG_RESTORE
dnl #### Enable the user to enable multithearind on xpdf
AC_ARG_ENABLE(multithreaded-kpdf,
AC_HELP_STRING([--enable-multithreaded-kpdf],[include support for multithreading in kpdf]),
AC_HELP_STRING([--enable-multithreaded-kpdf],[include support for multithreading in xpdf code inside kpdf. Has nothing to do with threaded generation of contents, this is configurable via a dialog inside the program itself]),
[
case $enableval in
yes)
AC_DEFINE(MULTITHREADED, 1, [Defines if use multithreading in kpdf])
AC_DEFINE(MULTITHREADED, 1, [Defines if use multithreading in xpdf code inside kpdf])
;;
no)
AC_DEFINE(MULTITHREADED, 0, [Defines if use multithreading in xpdf code inside kpdf])
;;
*)
AC_DEFINE(MULTITHREADED, 0, [Defines if use multithreading in kpdf])
AC_DEFINE(MULTITHREADED, 1, [Defines if use multithreading in xpdf code inside kpdf])
;;
esac
]
, AC_DEFINE(MULTITHREADED, 0, [Defines if use multithreading in kpdf])
, AC_DEFINE(MULTITHREADED, 0, [Defines if use multithreading in xpdf code inside kpdf])
)
dnl #### Enable the user to decide if he wants to force drm or not
AC_ARG_ENABLE(force-kpdf-drm,
AC_HELP_STRING([--enable-force-kpdf-drm],[Forces kpdf to check for DRM to decide if you can copy/print protected pdf. (default=no)]),
[
case $enableval in
yes)
AC_DEFINE(KPDF_FORCE_DRM, 1, [Defines if force the use DRM in kpdf])
;;
no)
AC_DEFINE(KPDF_FORCE_DRM, 0, [Defines if force the use DRM in kpdf])
;;
*)
AC_DEFINE(KPDF_FORCE_DRM, 1, [Defines if force the use DRM in kpdf])
;;
esac
]
, AC_DEFINE(KPDF_FORCE_DRM, 0, [Defines if force the use DRM in kpdf])
)
......@@ -140,8 +140,8 @@ bool KPDFDocument::openDocument( const QString & docFile, const KURL & url )
QString mimeName = mime->name();
if ( mimeName == "application/pdf" )
generator = new PDFGenerator( this );
else if ( mimeName == "application/postscript" )
kdError() << "PS generator not available" << endl;
/* else if ( mimeName == "application/postscript" )
kdError() << "PS generator not available" << endl;*/
else
{
kdWarning() << "Unknown mimetype '" << mimeName << "'." << endl;
......@@ -361,9 +361,9 @@ uint KPDFDocument::pages() const
return pages_vector.size();
}
bool KPDFDocument::okToPrint() const
bool KPDFDocument::isAllowed( int flags ) const
{
return generator ? generator->isAllowed( Generator::Print ) : false;
return generator ? generator->isAllowed( flags ) : false;
}
bool KPDFDocument::historyAtBegin() const
......@@ -1006,11 +1006,19 @@ void KPDFDocument::processLink( const KPDFLink * link )
kapp->invokeMailer( browse->url() );
else
{
QString url = browse->url();
// fix for #100366, documents with relative links that are the form of http:foo.pdf
if (url.find("http:") == 0 && url.find("http://") == -1 && url.right(4) == ".pdf")
{
openRelativeFile(url.mid(5));
return;
}
// get service for web browsing
KService::Ptr ptr = KServiceTypeProfile::preferredService("text/html", "Application");
KURL::List lst;
// append 'url' parameter to the service and run it
lst.append( browse->url() );
lst.append( url );
KRun::run( *ptr, lst );
}
} break;
......
......@@ -61,6 +61,9 @@ class KPDFDocument : public QObject
void removeObserver( DocumentObserver * pObserver );
void reparseConfig();
// enum definitions
enum Permission { AllowModify = 1, AllowCopy = 2, AllowPrint = 4, AllowNotes = 8 };
// query methods (const ones)
bool isOpened() const;
const DocumentInfo * documentInfo() const;
......@@ -69,7 +72,7 @@ class KPDFDocument : public QObject
const DocumentViewport & viewport() const;
uint currentPage() const;
uint pages() const;
bool okToPrint() const;
bool isAllowed( int /*Document::Permisison(s)*/ ) const;
bool historyAtBegin() const;
bool historyAtEnd() const;
QString getMetaData( const QString & key, const QString & option = QString() ) const;
......
......@@ -51,8 +51,7 @@ class Generator : public QObject
virtual const DocumentSynopsis * generateDocumentSynopsis() { return 0L; }
// DRM handling
enum Permissions { Modify = 1, Copy = 2, Print = 4, AddNotes = 8 };
virtual bool isAllowed( int /*permisisons*/ ) { return true; }
virtual bool isAllowed( int /*Document::Permisison(s)*/ ) { return true; }
// page contents generation
virtual bool canGeneratePixmap() = 0;
......
......@@ -13,6 +13,9 @@
#include <qevent.h>
#include <qimage.h>
#include <qapplication.h>
#include <qpaintdevicemetrics.h>
#include <qregexp.h>
#include <kapplication.h>
#include <klocale.h>
#include <kpassdlg.h>
#include <kwallet.h>
......@@ -38,6 +41,8 @@
#include "core/pagetransition.h"
#include "conf/settings.h"
#include <config.h>
// id for DATA_READY PDFPixmapGeneratorThread Event
#define TGE_DATAREADY_ID 6969
......@@ -244,6 +249,20 @@ const DocumentSynopsis * PDFGenerator::generateDocumentSynopsis()
return &docSyn;
}
bool PDFGenerator::isAllowed( int permissions )
{
#if !KPDF_FORCE_DRM
if (kapp->authorize("skip_drm") && !Settings::obeyDRM()) return true;
#endif
bool b = true;
if (permissions & KPDFDocument::AllowModify) b = b && pdfdoc->okToChange();
if (permissions & KPDFDocument::AllowCopy) b = b && pdfdoc->okToCopy();
if (permissions & KPDFDocument::AllowPrint) b = b && pdfdoc->okToPrint();
if (permissions & KPDFDocument::AllowNotes) b = b && pdfdoc->okToAddNotes();
return b;
}
bool PDFGenerator::canGeneratePixmap()
{
return ready;
......@@ -321,6 +340,28 @@ void PDFGenerator::generateSyncTextPage( KPDFPage * page )
bool PDFGenerator::print( KPrinter& printer )
{
QString ps = printer.option("PageSize");
if (ps.find(QRegExp("w\\d+h\\d+")) == 0)
{
// size not supported by Qt, KPrinter gives us the size as wWIDTHhHEIGHT
// remove the w
ps = ps.mid(1);
int hPos = ps.find("h");
globalParams->setPSPaperWidth(ps.left(hPos).toInt());
globalParams->setPSPaperHeight(ps.mid(hPos+1).toInt());
}
else
{
// size is supported by Qt, we get either the pageSize name or nothing because the default pageSize is used
QPrinter dummy(QPrinter::PrinterResolution);
dummy.setFullPage(true);
dummy.setPageSize((QPrinter::PageSize)(ps.isEmpty() ? KGlobal::locale()->pageSize() : pageNameToPageSize(ps)));
QPaintDeviceMetrics metrics(&dummy);
globalParams->setPSPaperWidth(metrics.width());
globalParams->setPSPaperHeight(metrics.height());
}
KTempFile tf( QString::null, ".ps" );
PSOutputDev *psOut = new PSOutputDev(tf.name().latin1(), pdfdoc->getXRef(), pdfdoc->getCatalog(), 1, pdfdoc->getNumPages(), psModePS);
......
......@@ -54,6 +54,9 @@ class PDFGenerator : public Generator
const DocumentInfo * generateDocumentInfo();
const DocumentSynopsis * generateDocumentSynopsis();
// [INHERITED] document informations
bool isAllowed( int permissions );
// [INHERITED] perform actions on document / pages
bool canGeneratePixmap();
void generatePixmap( PixmapRequest * request );
......
......@@ -49,6 +49,7 @@
#include <kpopupmenu.h>
#include <kxmlguiclient.h>
#include <kxmlguifactory.h>
#include <ktrader.h>
// local includes
#include "xpdf/GlobalParams.h"
......@@ -78,7 +79,7 @@ unsigned int Part::m_count = 0;
Part::Part(QWidget *parentWidget, const char *widgetName,
QObject *parent, const char *name,
const QStringList & /*args*/ )
: DCOPObject("kpdf"), KParts::ReadOnlyPart(parent, name), m_showMenuBarAction(0),
: DCOPObject("kpdf"), KParts::ReadOnlyPart(parent, name), m_showMenuBarAction(0), m_showFullScreenAction(0),
m_actionsSearched(false), m_searchStarted(false)
{
// load catalog for translation
......@@ -251,15 +252,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
connect( m_dirtyHandler, SIGNAL( timeout() ),this, SLOT( slotDoFileDirty() ) );
// [SPEECH] check for KTTSD presence and usability
Settings::setUseKTTSD( true );
DCOPClient * client = DCOPClient::mainClient();
// Albert says is this ever necessary?
// we already attached on Part constructor
if ( !client->isAttached() )
client->attach();
if ( !client->isApplicationRegistered("kttsd") )
if ( KApplication::startServiceByName( "KTTSD" ) )
Settings::setUseKTTSD( false );
KTrader::OfferList offers = KTrader::self()->query("DCOP/Text-to-Speech", "Name == 'KTTSD'");
Settings::setUseKTTSD( (offers.count() > 0) );
// set our XML-UI resource file
setXMLFile("part.rc");
......@@ -646,19 +640,23 @@ void Part::slotShowMenu(const KPDFPage *page, const QPoint &point)
KActionCollection *ac;
KActionPtrList::const_iterator it, end, begin;
KActionPtrList actions;
QPtrList<KXMLGUIClient> clients(factory()->clients());
QPtrListIterator<KXMLGUIClient> clientsIt( clients );
for( ; (!m_showMenuBarAction || !m_showFullScreenAction) && clientsIt.current(); ++clientsIt)
if (factory())
{
client = clientsIt.current();
ac = client->actionCollection();
actions = ac->actions();
end = actions.end();
begin = actions.begin();
for ( it = begin; it != end; ++it )
QPtrList<KXMLGUIClient> clients(factory()->clients());
QPtrListIterator<KXMLGUIClient> clientsIt( clients );
for( ; (!m_showMenuBarAction || !m_showFullScreenAction) && clientsIt.current(); ++clientsIt)
{
if (QString((*it)->name()) == "options_show_menubar") m_showMenuBarAction = (KToggleAction*)(*it);
if (QString((*it)->name()) == "fullscreen") m_showFullScreenAction = (KToggleAction*)(*it);
client = clientsIt.current();
ac = client->actionCollection();
actions = ac->actions();
end = actions.end();
begin = actions.begin();
for ( it = begin; it != end; ++it )
{
if (QString((*it)->name()) == "options_show_menubar") m_showMenuBarAction = (KToggleAction*)(*it);
if (QString((*it)->name()) == "fullscreen") m_showFullScreenAction = (KToggleAction*)(*it);
}
}
}
m_actionsSearched = true;
......@@ -762,7 +760,7 @@ void Part::slotPrint()
void Part::doPrint(KPrinter &printer)
{
if (!m_document->okToPrint())
if (!m_document->isAllowed(KPDFDocument::AllowPrint))
{
KMessageBox::error(widget(), i18n("Printing this document is not allowed."));
return;
......
......@@ -20,7 +20,7 @@
<Action name="zoom_fit_page"/>
<Action name="zoom_fit_rect"/>
<Separator/>
<Action name="view_continous"/>
<Action name="view_continuous"/>
<Action name="view_twopages"/>
</Menu>
<Menu name="go"><text>&amp;Go</text>
......@@ -57,7 +57,7 @@
<!--Action name="zoom_fit_width"/-->
<!--Action name="zoom_fit_page"/-->
<Separator/>
<Action name="view_continous"/>
<Action name="view_continuous"/>
<Action name="view_twopages"/>
<Separator/>
<Action name="mouse_drag"/>
......
......@@ -35,6 +35,7 @@
#include <kfiledialog.h>
#include <kimageeffect.h>
#include <kimageio.h>
#include <kapplication.h>
#include <kdebug.h>
// system includes
......@@ -66,7 +67,7 @@ public:
QValueVector< PageViewItem * > items;
QValueList< PageViewItem * > visibleItems;
// view layout (columns and continous in Settings), zoom and mouse
// view layout (columns and continuous in Settings), zoom and mouse
PageView::ZoomMode zoomMode;
float zoomFactor;
PageView::MouseMode mouseMode;
......@@ -107,7 +108,7 @@ public:
KToggleAction * aZoomFitPage;
KToggleAction * aZoomFitText;
KToggleAction * aViewTwoPages;
KToggleAction * aViewContinous;
KToggleAction * aViewContinuous;
KAction * aPrevAction;
};
......@@ -118,7 +119,7 @@ public:
* 160 - constructor and creating actions plus their connected slots (empty stuff)
* 70 - DocumentObserver inherited methodes (important)
* 550 - events: mouse, keyboard, drag/drop
* 170 - slotRelayoutPages: set contents of the scrollview on continous/single modes
* 170 - slotRelayoutPages: set contents of the scrollview on continuous/single modes
* 100 - zoom: zooming pages in different ways, keeping update the toolbar actions, etc..
* other misc functions: only slotRequestVisiblePixmaps and pickItemOnPoint noticeable,
* and many insignificant stuff like this comment :-)
......@@ -203,9 +204,9 @@ void PageView::setupActions( KActionCollection * ac )
connect( d->aViewTwoPages, SIGNAL( toggled( bool ) ), SLOT( slotTwoPagesToggled( bool ) ) );
d->aViewTwoPages->setChecked( Settings::viewColumns() > 1 );
d->aViewContinous = new KToggleAction( i18n("&Continous"), "view_text", 0, ac, "view_continous" );
connect( d->aViewContinous, SIGNAL( toggled( bool ) ), SLOT( slotContinousToggled( bool ) ) );
d->aViewContinous->setChecked( Settings::viewContinous() );
d->aViewContinuous = new KToggleAction( i18n("&Continuous"), "view_text", 0, ac, "view_continuous" );
connect( d->aViewContinuous, SIGNAL( toggled( bool ) ), SLOT( slotContinuousToggled( bool ) ) );
d->aViewContinuous->setChecked( Settings::viewContinuous() );
// Mouse-Mode actions
d->aMouseNormal = new KRadioAction( i18n("&Normal"), "mouse", 0, this, SLOT( slotSetMouseNormal() ), ac, "mouse_drag" );
......@@ -334,7 +335,7 @@ void PageView::notifyViewportChanged( bool smoothMove )
// relayout in "Single Pages" mode or if a relayout is pending
d->blockPixmapsRequest = true;
if ( !Settings::viewContinous() || d->dirtyLayout )
if ( !Settings::viewContinuous() || d->dirtyLayout )
slotRelayoutPages();
// restore viewport center or use default {x-center,v-top} alignment
......@@ -662,7 +663,7 @@ void PageView::keyPressEvent( QKeyEvent * e )
case Key_Up:
case Key_PageUp:
// if in single page mode and at the top of the screen, go to previous page
if ( Settings::viewContinous() || verticalScrollBar()->value() > verticalScrollBar()->minValue() )
if ( Settings::viewContinuous() || verticalScrollBar()->value() > verticalScrollBar()->minValue() )
{
if ( e->key() == Key_Up )
verticalScrollBar()->subtractLine();
......@@ -682,7 +683,7 @@ void PageView::keyPressEvent( QKeyEvent * e )
case Key_Down:
case Key_PageDown:
// if in single page mode and at the bottom of the screen, go to next page
if ( Settings::viewContinous() || verticalScrollBar()->value() < verticalScrollBar()->maxValue() )
if ( Settings::viewContinuous() || verticalScrollBar()->value() < verticalScrollBar()->maxValue() )
{
if ( e->key() == Key_Down )
verticalScrollBar()->addLine();
......@@ -984,6 +985,11 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
break;
case MouseSelect:{
if (d->mouseSelectionRect.isNull() && rightButton)
{
PageViewItem * pageItem = pickItemOnPoint( e->x(), e->y() );
emit rightClick( pageItem ? pageItem->page() : 0, e->globalPos() );
}
// if a selection is defined, display a popup
if ( (!leftButton && !d->aPrevAction) || (leftButton && d->aPrevAction) ||
d->mouseSelectionRect.isNull() )
......@@ -1028,6 +1034,8 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
{
menu.insertTitle( i18n( "Text (1 character)", "Text (%n characters)", selectedText.length() ) );
menu.insertItem( SmallIcon("editcopy"), i18n( "Copy to Clipboard" ), 1 );
if ( !d->document->isAllowed( KPDFDocument::AllowCopy ) )
menu.setItemEnabled( 1, false );
if ( Settings::useKTTSD() )
menu.insertItem( SmallIcon("kttsd"), i18n( "Speak Text" ), 2 );
}
......@@ -1086,23 +1094,36 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
DCOPClient * client = DCOPClient::mainClient();
// Albert says is this ever necessary?
// we already attached on Part constructor
if ( !client->isAttached() )
client->attach();
// serialize the text to speech (selectedText) and the
// preferred reader ("" is the default voice) ...
QByteArray data;
QDataStream arg( data, IO_WriteOnly );
arg << selectedText;
arg << QString();
QCString replyType;
QByteArray replyData;
// ..and send it to KTTSD
if (client->call( "kttsd", "KSpeech", "setText(QString,QString)", data, replyType, replyData, true ))
// if ( !client->isAttached() )
// client->attach();
// If KTTSD not running, start it.
if (!client->isApplicationRegistered("kttsd"))
{
QString error;
if (KApplication::startServiceByDesktopName("kttsd", QStringList(), &error))
{
d->messageWindow->display( i18n("Starting KTTSD Failed: %1").arg(error) );
Settings::setUseKTTSD(false);
}
}
if ( Settings::useKTTSD() )
{
QByteArray data2;
QDataStream arg2(data2, IO_WriteOnly);
arg2 << 0;
client->send("kttsd", "KSpeech", "startText(uint)", data2 );
// serialize the text to speech (selectedText) and the
// preferred reader ("" is the default voice) ...
QByteArray data;
QDataStream arg( data, IO_WriteOnly );
arg << selectedText;
arg << QString();
QCString replyType;
QByteArray replyData;
// ..and send it to KTTSD
if (client->call( "kttsd", "KSpeech", "setText(QString,QString)", data, replyType, replyData, true ))
{
QByteArray data2;
QDataStream arg2(data2, IO_WriteOnly);
arg2 << 0;
client->send("kttsd", "KSpeech", "startText(uint)", data2 );
}
}
}
}
......@@ -1138,7 +1159,7 @@ void PageView::wheelEvent( QWheelEvent *e )
else
slotZoomIn();
}
else if ( delta <= -120 && !Settings::viewContinous() && vScroll == verticalScrollBar()->maxValue() )
else if ( delta <= -120 && !Settings::viewContinuous() && vScroll == verticalScrollBar()->maxValue() )
{
// go to next page
if ( d->document->currentPage() < d->items.count() - 1 )
......@@ -1151,7 +1172,7 @@ void PageView::wheelEvent( QWheelEvent *e )
d->document->setViewport( newViewport );
}
}
else if ( delta >= 120 && !Settings::viewContinous() && vScroll == verticalScrollBar()->minValue() )
else if ( delta >= 120 && !Settings::viewContinuous() && vScroll == verticalScrollBar()->minValue() )
{
// go to prev page
if ( d->document->currentPage() > 0 )
......@@ -1502,7 +1523,7 @@ void PageView::updateCursor( const QPoint &p )
//BEGIN private SLOTS
void PageView::slotRelayoutPages()
// called by: notifySetup, viewportResizeEvent, slotTwoPagesToggled, slotContinousToggled, updateZoom
// called by: notifySetup, viewportResizeEvent, slotTwoPagesToggled, slotContinuousToggled, updateZoom
{
// set an empty container if we have no pages
int pageCount = d->items.count();
......@@ -1529,13 +1550,13 @@ void PageView::slotRelayoutPages()
fullHeight = 0;
QRect viewportRect( contentsX(), contentsY(), viewportWidth, viewportHeight );
// set all items geometry and resize contents. handle 'continous' and 'single' modes separately
if ( Settings::viewContinous() )
// set all items geometry and resize contents. handle 'continuous' and 'single' modes separately
if ( Settings::viewContinuous() )
{
// Here we find out column's width and row's height to compute a table
// so we can place widgets 'centered in virtual cells'.
int nCols = Settings::viewColumns(),
nRows = (int)ceilf( (float)pageCount / (float)nCols ),
nRows = (int)ceil( (float)pageCount / (float)nCols ),
* colWidth = new int[ nCols ],
* rowHeight = new int[ nRows ],
cIdx = 0,
......@@ -1596,7 +1617,7 @@ void PageView::slotRelayoutPages()
delete [] colWidth;
delete [] rowHeight;
}
else // viewContinous is FALSE
else // viewContinuous is FALSE
{
PageViewItem * currentItem = d->items[ QMAX( 0, (int)d->document->currentPage() ) ];
......@@ -1895,11 +1916,11 @@ void PageView::slotTwoPagesToggled( bool on )
}
}
void PageView::slotContinousToggled( bool on )
void PageView::slotContinuousToggled( bool on )
{
if ( Settings::viewContinous() != on )
if ( Settings::viewContinuous() != on )
{
Settings::setViewContinous( on );
Settings::setViewContinuous( on );
if ( d->document->pages() > 0 )
slotRelayoutPages();
}
......
......@@ -31,7 +31,7 @@ class PageViewItem;
class PageViewPrivate;
/**
* @short The main view. Handles zoom and continous mode.. oh, and page
* @short The main view. Handles zoom and continuous mode.. oh, and page
* @short display of course :-)
* ...
*/
......@@ -125,7 +125,7 @@ class PageView : public QScrollView, public DocumentObserver
void slotFitToPageToggled( bool );
void slotFitToTextToggled( bool );
void slotTwoPagesToggled( bool );
void slotContinousToggled( bool );
void slotContinuousToggled( bool );
void slotSetMouseNormal();
void slotSetMouseZoom();
void slotSetMouseSelect();
......
......@@ -52,25 +52,11 @@ PresentationWidget::PresentationWidget( KPDFDocument * doc )
{
// set look and geometry
setBackgroundMode( Qt::NoBackground );
QRect d = KGlobalSettings::desktopGeometry(this);
m_width = d.width();
m_height = d.height();
// create top toolbar
m_topBar = new KToolBar( this, "presentationBar" );
m_topBar->setIconSize( 32 );
m_topBar->setMovingEnabled( false );
m_topBar->insertButton( "1leftarrow", 2, SIGNAL( clicked() ), this, SLOT( slotPrevPage() ) );
m_topBar->insertButton( "1rightarrow", 3, SIGNAL( clicked() ), this, SLOT( slotNextPage() ) );
m_topBar->insertButton( "exit", 1, SIGNAL( clicked() ), this, SLOT( close() ) );
m_topBar->setGeometry( 0, 0, m_width, 32 + 10 );
m_topBar->alignItemRight( 1 );
m_topBar->hide();
// change topbar background color
QPalette p = m_topBar->palette();
p.setColor( QPalette::Active, QColorGroup::Button, Qt::gray );
p.setColor( QPalette::Active, QColorGroup::Background, Qt::darkGray );
m_topBar->setPalette( p );
m_width = -1;
// show widget and take control
showFullScreen();
// misc stuff
setMouseTracking( true );
......@@ -79,9 +65,6 @@ PresentationWidget::PresentationWidget( KPDFDocument * doc )
m_overlayHideTimer = new QTimer( this );
connect( m_overlayHideTimer, SIGNAL( timeout() ), this, SLOT( slotHideOverlay() ) );
// show widget and take control
showFullScreen();
// handle cursor appearance as specified in configuration
if ( Settings::slidesCursor() == Settings::EnumSlidesCursor::HiddenDelay )
{
......@@ -92,13 +75,6 @@ PresentationWidget::PresentationWidget( KPDFDocument * doc )
{
setCursor( KCursor::blankCursor() );
}
// register this observer in document. events will come immediately
m_document->addObserver( this );
// show summary if requested
if ( Settings::slidesShowSummary() )
generatePage();
}
PresentationWidget::~PresentationWidget()
......@@ -194,6 +170,8 @@ bool PresentationWidget::canUnloadPixmap( int pageNumber )
// <widget events>