Commit 9c207ace authored by Enrico Ros's avatar Enrico Ros

applying patch_070,071

svn path=/branches/kpdf/annotations/kdegraphics/kpdf/; revision=425017
parent 14f5e894
......@@ -355,7 +355,10 @@ bool Part::openFile()
// if the 'StartFullScreen' flag is set, start presentation
if ( m_document->getMetaData( "StartFullScreen" ) == "yes" )
{
KMessageBox::information( m_presentationWidget, i18n("The document is going to be launched on presentation mode because the file requested it."), QString::null, "autoPresentationWarning" );
slotShowPresentation();
}
return true;
}
......@@ -757,8 +760,8 @@ void Part::slotShowProperties()
void Part::slotShowPresentation()
{
slotHidePresentation();
m_presentationWidget = new PresentationWidget( m_document );
if ( !m_presentationWidget )
m_presentationWidget = new PresentationWidget( widget(), m_document );
}
void Part::slotHidePresentation()
......
......@@ -20,6 +20,8 @@
#include <klocale.h>
#include <kiconloader.h>
#include <kimageeffect.h>
#include <kmessagebox.h>
#include <kwin.h>
// system includes
#include <stdlib.h>
......@@ -46,9 +48,8 @@ struct PresentationFrame
};
PresentationWidget::PresentationWidget( KPDFDocument * doc )
: QWidget( 0, "presentationWidget", WDestructiveClose | WStyle_NoBorder |
WStyle_StaysOnTop | WShowModal ), m_document( doc ), m_frameIndex( -1 )
PresentationWidget::PresentationWidget( QWidget * parent, KPDFDocument * doc )
: QDialog( parent, "presentationWidget", true, WDestructiveClose | WStyle_NoBorder), m_document( doc ), m_frameIndex( -1 )
{
// set look and geometry
setBackgroundMode( Qt::NoBackground );
......@@ -168,6 +169,13 @@ bool PresentationWidget::canUnloadPixmap( int pageNumber )
// <widget events>
bool PresentationWidget::event ( QEvent * e )
{
if (e -> type() == QEvent::WindowDeactivate) KWin::clearState(winId(), NET::StaysOnTop);
else if (e -> type() == QEvent::WindowActivate) KWin::setState(winId(), NET::StaysOnTop);
return QDialog::event(e);
}
void PresentationWidget::keyPressEvent( QKeyEvent * e )
{
if (m_width == -1) return;
......@@ -272,6 +280,9 @@ void PresentationWidget::paintEvent( QPaintEvent * pe )
// show summary if requested
if ( Settings::slidesShowSummary() )
generatePage();
// inform user on how to exit from presentation mode
KMessageBox::information( this, i18n("There are two ways of exiting presentation mode, you can press either ESC key or click with the quit button that appears when placing the mouse in the top-right corner. Of course you can cycle windows (Alt+TAB by default)"), QString::null, "presentationInfo" );
}
// check painting rect consistancy
......
......@@ -10,7 +10,7 @@
#ifndef _KPDF_PRESENTATIONWIDGET_H_
#define _KPDF_PRESENTATIONWIDGET_H_
#include <qwidget.h>
#include <qdialog.h>
#include <qpixmap.h>
#include <qstringlist.h>
#include <qvaluevector.h>
......@@ -29,11 +29,11 @@ class PresentationFrame;
*
* This is a fullscreen widget that displays
*/
class PresentationWidget : public QWidget, public DocumentObserver
class PresentationWidget : public QDialog, public DocumentObserver
{
Q_OBJECT
public:
PresentationWidget( KPDFDocument * doc );
PresentationWidget( QWidget * parent, KPDFDocument * doc );
~PresentationWidget();
// inherited from DocumentObserver
......@@ -45,6 +45,7 @@ class PresentationWidget : public QWidget, public DocumentObserver
protected:
// widget events
bool event( QEvent * e );
void keyPressEvent( QKeyEvent * e );
void wheelEvent( QWheelEvent * e );
void mousePressEvent( QMouseEvent * e );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment