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
remotes/origin/KDE/4.0
Pino Toscano 20 years ago
parent e43d62afff
commit 2bd05e79d5
  1. 5
      core/document.cpp
  2. 1
      core/document.h
  3. 5
      core/generator.cpp
  4. 3
      core/generator.h
  5. 33
      ui/pageview.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;

@ -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; };

@ -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;

@ -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.

@ -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 )

Loading…
Cancel
Save