From 2bd05e79d50552c784de07dfddabfdab1781c2bf Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 29 Oct 2006 22:33:24 +0000 Subject: [PATCH] a generator can not block the gui events of the main page view, otherwise bad things will happen - it's also not really logic to allow such a thing, better think about something else if a generator wants to interact with the gui somehow svn path=/trunk/playground/graphics/okular/; revision=600225 --- core/document.cpp | 5 ----- core/document.h | 1 - core/generator.cpp | 5 ----- core/generator.h | 3 --- ui/pageview.cpp | 33 +-------------------------------- 5 files changed, 1 insertion(+), 46 deletions(-) diff --git a/core/document.cpp b/core/document.cpp index 0714c5bc5..614a31e09 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -484,11 +484,6 @@ bool Document::isOpened() const return generator; } -bool Document::handleEvent( QEvent * event ) -{ - return generator ? generator->handleEvent( event ) : true; -} - bool Document::canConfigurePrinter( ) const { return generator ? generator->canConfigurePrinter() : false; diff --git a/core/document.h b/core/document.h index f65a48128..f2e4f10e8 100644 --- a/core/document.h +++ b/core/document.h @@ -149,7 +149,6 @@ class OKULAR_EXPORT Document : public QObject void processLink( const Link * link ); bool canConfigurePrinter() const; bool print( KPrinter &printer ); - bool handleEvent (QEvent * event); // notifications sent by generator void requestDone( PixmapRequest * request ); // inline pagesVector() { return pages_vector; }; diff --git a/core/generator.cpp b/core/generator.cpp index 0fa104ee7..83acf4bb0 100644 --- a/core/generator.cpp +++ b/core/generator.cpp @@ -149,11 +149,6 @@ bool Generator::exportTo( const QString&, const ExportFormat& ) return false; } -bool Generator::handleEvent( QEvent* ) -{ - return true; -} - void Generator::setDocument( Document *document ) { d->m_document = document; diff --git a/core/generator.h b/core/generator.h index 9ee201ea4..ad44d0d31 100644 --- a/core/generator.h +++ b/core/generator.h @@ -310,9 +310,6 @@ class OKULAR_EXPORT Generator : public QObject */ virtual bool exportTo( const QString &fileName, const ExportFormat &format ); - // TODO: remove - virtual bool handleEvent (QEvent * /*event*/ ); - Q_SIGNALS: /** * This signal should be emitted whenever an error occured in the generator. diff --git a/ui/pageview.cpp b/ui/pageview.cpp index a44d3850c..8440c314e 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -714,8 +714,6 @@ bool PageView::canUnloadPixmap( int pageNumber ) //BEGIN widget events void PageView::contentsPaintEvent(QPaintEvent *pe) { - if ( d->document->handleEvent( pe ) ) - { // create the rect into contents from the clipped screen rect QRect viewportRect = viewport()->rect(); viewportRect.translate( horizontalScrollBar()->value(), verticalScrollBar()->value() ); @@ -867,12 +865,9 @@ void PageView::contentsPaintEvent(QPaintEvent *pe) } } } - } } -void PageView::resizeEvent( QResizeEvent * event) -{ -if (d->document->handleEvent( event ) ) +void PageView::resizeEvent( QResizeEvent * ) { if ( d->items.isEmpty() ) return; @@ -886,11 +881,8 @@ if (d->document->handleEvent( event ) ) } d->delayResizeTimer->start( 200 ); } -} void PageView::keyPressEvent( QKeyEvent * e ) -{ -if (d->document->handleEvent( e ) ) { e->accept(); @@ -1068,7 +1060,6 @@ if (d->document->handleEvent( e ) ) d->autoScrollTimer->stop(); } } -} void PageView::inputMethodEvent( QInputMethodEvent * e ) { @@ -1084,8 +1075,6 @@ void PageView::inputMethodEvent( QInputMethodEvent * e ) } void PageView::contentsMouseMoveEvent( QMouseEvent * e ) -{ -if (d->document->handleEvent( e ) ) { // don't perform any mouse action when no document is shown if ( d->items.isEmpty() ) @@ -1231,11 +1220,8 @@ if (d->document->handleEvent( e ) ) break; } } -} void PageView::contentsMousePressEvent( QMouseEvent * e ) -{ -if ( d->document->handleEvent( e ) ) { // don't perform any mouse action when no document is shown if ( d->items.isEmpty() ) @@ -1373,13 +1359,9 @@ if ( d->document->handleEvent( e ) ) break; } } -} void PageView::contentsMouseReleaseEvent( QMouseEvent * e ) { -if (d->document->handleEvent( e ) ) -{ - // don't perform any mouse action when no document is shown.. if ( d->items.isEmpty() ) { @@ -1737,11 +1719,8 @@ if (d->document->handleEvent( e ) ) // reset mouse press / 'drag start' position d->mousePressPos = QPoint(); } -} void PageView::wheelEvent( QWheelEvent *e ) -{ -if (d->document->handleEvent( e ) ) { // don't perform any mouse action when viewport is autoscrolling if ( d->viewportMoveActive ) @@ -1798,32 +1777,22 @@ if (d->document->handleEvent( e ) ) QPoint cp = widget()->mapFromGlobal(mapToGlobal(e->pos())); updateCursor(cp); } -} void PageView::dragEnterEvent( QDragEnterEvent * ev ) -{ -if (d->document->handleEvent( ev ) ) { ev->accept(); } -} void PageView::dragMoveEvent( QDragMoveEvent * ev ) { - if ( !d->document->handleEvent( ev ) ) - return; - ev->accept(); } void PageView::dropEvent( QDropEvent * ev ) -{ -if (d->document->handleEvent( ev ) ) { if ( KUrl::List::canDecode( ev->mimeData() ) ) emit urlDropped( KUrl::List::fromMimeData( ev->mimeData() ).first() ); } -} //END widget events QList< Okular::RegularAreaRect * > PageView::textSelections( const QPoint& start, const QPoint& end, int& firstpage )