Commit ac87494c authored by Pino Toscano's avatar Pino Toscano

As suggested by our usability expert Florian, add a bar above the page view...

As suggested by our usability expert Florian, add a bar above the page view showing in case the document has embedded files, that can be clsed with the X button.

svn path=/trunk/playground/graphics/okular/; revision=591837
parent 7fbf0569
......@@ -173,18 +173,22 @@ Part::Part(QWidget *parentWidget,
miniBarLayout->addWidget( m_miniBar );
// widgets: [] | [right 'pageView']
// QWidget * rightContainer = new QWidget( m_splitter );
// QVBoxLayout * rightLayout = new QVBoxLayout( rightContainer );
QWidget * rightContainer = new QWidget( m_splitter );
QVBoxLayout * rightLayout = new QVBoxLayout( rightContainer );
rightLayout->setMargin( 0 );
// KToolBar * rtb = new KToolBar( rightContainer, "mainToolBarSS" );
// rightLayout->addWidget( rtb );
m_pageView = new PageView( m_splitter, m_document );
m_topMessage = new PageViewTopMessage( rightContainer );
connect( m_topMessage, SIGNAL( action() ), this, SLOT( slotShowEmbeddedFiles() ) );
rightLayout->addWidget( m_topMessage );
m_pageView = new PageView( rightContainer, m_document );
m_pageView->setFocus(); //usability setting
connect( m_pageView, SIGNAL( urlDropped( const KUrl& ) ), SLOT( openUrlFromDocument( const KUrl & )));
connect( m_pageView, SIGNAL( rightClick(const Okular::Page *, const QPoint &) ), this, SLOT( slotShowMenu(const Okular::Page *, const QPoint &) ) );
connect( m_document, SIGNAL( error( const QString&, int ) ), m_pageView, SLOT( errorMessage( const QString&, int ) ) );
connect( m_document, SIGNAL( warning( const QString&, int ) ), m_pageView, SLOT( warningMessage( const QString&, int ) ) );
connect( m_document, SIGNAL( notice( const QString&, int ) ), m_pageView, SLOT( noticeMessage( const QString&, int ) ) );
// rightLayout->addWidget( m_pageView );
rightLayout->addWidget( m_pageView );
// add document observers
m_document->addObserver( this );
......@@ -549,7 +553,12 @@ bool Part::openFile()
m_saveAs->setEnabled( ok );
m_printPreview->setEnabled( ok );
m_showProperties->setEnabled( ok );
m_showEmbeddedFiles->setEnabled( ok && m_document->embeddedFiles() && m_document->embeddedFiles()->count() > 0);
bool hasEmbeddedFiles = ok && m_document->embeddedFiles() && m_document->embeddedFiles()->count() > 0;
m_showEmbeddedFiles->setEnabled( hasEmbeddedFiles );
if ( hasEmbeddedFiles )
m_topMessage->display( i18n( "This document has embedded files. <a href=\"okular:/embeddedfiles\">Click here to see them</a> or go to File -> Embedded Files." ) );
else
m_topMessage->hide();
m_showPresentation->setEnabled( ok );
if ( ok )
{
......
......@@ -43,6 +43,7 @@ class KPrinter;
class ThumbnailList;
class ThumbnailController;
class PageView;
class PageViewTopMessage;
class PresentationWidget;
class SearchWidget;
class TOC;
......@@ -157,6 +158,7 @@ private:
QWidget *m_leftPanel;
QToolBox *m_toolBox;
SearchWidget *m_searchWidget;
PageViewTopMessage * m_topMessage;
QPointer<ThumbnailList> m_thumbnailList;
QPointer<PageView> m_pageView;
QPointer<TOC> m_toc;
......
......@@ -11,9 +11,12 @@
#include <qapplication.h>
#include <qbitmap.h>
#include <qimage.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpainter.h>
#include <qevent.h>
#include <qtimer.h>
#include <qtoolbutton.h>
#include <qpushbutton.h>
#include <QStyleOptionButton>
#include <kacceleratormanager.h>
......@@ -227,6 +230,43 @@ void PageViewMessage::mousePressEvent( QMouseEvent * /*e*/ )
}
/************************/
/** PageViewTopMessage */
/************************/
PageViewTopMessage::PageViewTopMessage( QWidget * parent )
: QWidget( parent )
{
setAutoFillBackground( true );
QPalette pal = palette();
pal.setColor( QPalette::Active, QPalette::Window, Qt::yellow );
pal.setColor( QPalette::Inactive, QPalette::Window, Qt::yellow );
pal.setColor( QPalette::Disabled, QPalette::Window, Qt::yellow );
setPalette( pal );
QHBoxLayout * lay = new QHBoxLayout( this );
lay->setMargin( 4 );
m_label = new QLabel( this );
lay->addWidget( m_label );
m_label->setWordWrap( true );
connect( m_label, SIGNAL( linkActivated( const QString& ) ), this, SIGNAL( action() ) );
QToolButton * closeButton = new QToolButton( this );
lay->addWidget( closeButton );
closeButton->setAutoRaise( true );
closeButton->setIcon( closeButton->style()->standardIcon( QStyle::SP_TitleBarCloseButton ) );
closeButton->setIconSize( QSize( 32, 32 ) );
closeButton->setToolTip( i18n( "Close this message" ) );
connect( closeButton, SIGNAL( clicked() ), this, SLOT( hide() ) );
hide();
}
void PageViewTopMessage::display( const QString & message )
{
m_label->setText( message );
resize( minimumSizeHint() );
show();
}
/*********************/
/** PageViewToolBar */
/*********************/
......
......@@ -14,6 +14,7 @@
#include <qpixmap.h>
#include <qrect.h>
class QLabel;
class QTimer;
namespace Okular {
......@@ -75,6 +76,27 @@ class PageViewMessage : public QWidget
};
/**
* @short A widget that displays messages in the top part of the page view.
*
* ...
*/
class PageViewTopMessage : public QWidget
{
Q_OBJECT
public:
PageViewTopMessage( QWidget * parent );
void display( const QString & message );
signals:
void action();
private:
QLabel * m_label;
};
/**
* @short A widget containing exclusive buttons, that slides in from a side.
*
......
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