Commit 5860fc89 authored by Fabio D'Urso's avatar Fabio D'Urso
Browse files

Added shortcut to annotation config panel as review toolbar's context menu

parent c3f7fd52
......@@ -31,6 +31,7 @@ PreferencesDialog::PreferencesDialog( QWidget * parent, KConfigSkeleton * skelet
m_accessibility = new DlgAccessibility( this );
m_presentation = 0;
m_annotations = 0;
m_annotationsPage = 0;
m_editor = 0;
#ifdef OKULAR_DEBUG_CONFIGPAGE
m_debug = new DlgDebug( this );
......@@ -50,7 +51,8 @@ PreferencesDialog::PreferencesDialog( QWidget * parent, KConfigSkeleton * skelet
m_editor = new DlgEditor( this );
addPage( m_presentation, i18n("Presentation"), "view-presentation",
i18n("Options for Presentation Mode") );
addPage( m_annotations, i18n("Annotations"), "draw-freehand", i18n("Annotation Options") );
m_annotationsPage = addPage( m_annotations, i18n("Annotations"),
"draw-freehand", i18n("Annotation Options") );
addPage( m_editor, i18n("Editor"), "accessories-text-editor", i18n("Editor Options") );
}
#ifdef OKULAR_DEBUG_CONFIGPAGE
......@@ -58,3 +60,9 @@ PreferencesDialog::PreferencesDialog( QWidget * parent, KConfigSkeleton * skelet
#endif
setHelp("configure", "okular");
}
void PreferencesDialog::switchToAnnotationsPage()
{
if ( m_annotationsPage )
setCurrentPage( m_annotationsPage );
}
......@@ -31,6 +31,8 @@ class PreferencesDialog : public KConfigDialog
public:
PreferencesDialog( QWidget * parent, KConfigSkeleton * config, Okular::EmbedMode embedMode );
void switchToAnnotationsPage();
protected:
// void updateSettings(); // Called when OK/Apply is pressed.
// void updateWidgets(); // Called upon construction or when Reset is pressed
......@@ -46,6 +48,8 @@ class PreferencesDialog : public KConfigDialog
DlgAnnotations * m_annotations;
DlgEditor * m_editor;
DlgDebug * m_debug;
KPageWidgetItem * m_annotationsPage;
};
#endif
......@@ -817,6 +817,11 @@ void Part::setupActions()
ac->addAction( "presentation_erase_drawings", eraseDrawingAction );
eraseDrawingAction->setIcon( KIcon( "draw-eraser" ) );
eraseDrawingAction->setEnabled( false );
KAction *configureAnnotations = new KAction( i18n( "Configure Annotations..." ), ac );
ac->addAction( "options_configure_annotations", configureAnnotations );
configureAnnotations->setIcon( KIcon( "configure" ) );
connect(configureAnnotations, SIGNAL(triggered()), this, SLOT(slotAnnotationPreferences()));
}
Part::~Part()
......@@ -2170,6 +2175,18 @@ void Part::slotPreferences()
}
void Part::slotAnnotationPreferences()
{
// Create dialog
PreferencesDialog * dialog = new PreferencesDialog( m_pageView, Okular::Settings::self(), m_embedMode );
dialog->setAttribute( Qt::WA_DeleteOnClose );
// Show it
dialog->switchToAnnotationsPage();
dialog->show();
}
void Part::slotNewConfig()
{
// Apply settings here. A good policy is to check whether the setting has
......
......@@ -333,6 +333,7 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
private slots:
void slotGeneratorPreferences();
void slotAnnotationPreferences();
void slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled);
};
......
......@@ -754,6 +754,11 @@ void PageView::reparseConfig()
viewport()->update();
}
KActionCollection *PageView::actionCollection() const
{
return d->actionCollection;
}
KAction *PageView::toggleFormsAction() const
{
return d->aToggleForms;
......
......@@ -95,6 +95,7 @@ Q_OBJECT
void reparseConfig();
KActionCollection *actionCollection() const;
KAction *toggleFormsAction() const;
int contentAreaWidth() const;
......
......@@ -22,6 +22,7 @@
#include <qtimer.h>
#include <qtoolbutton.h>
#include <kacceleratormanager.h>
#include <kactioncollection.h>
#include <kcolorscheme.h>
#include <kiconloader.h>
#include <klocale.h>
......@@ -32,6 +33,7 @@
// local includes
#include "formwidgets.h"
#include "guiutils.h"
#include "pageview.h"
#include "videowidget.h"
#include "core/movie.h"
#include "core/page.h"
......@@ -504,7 +506,7 @@ public:
QLinkedList< ToolBarButton * > buttons;
};
PageViewToolBar::PageViewToolBar( QWidget * parent, QWidget * anchorWidget )
PageViewToolBar::PageViewToolBar( PageView * parent, QWidget * anchorWidget )
: QWidget( parent ), d( new ToolBarPrivate( this ) )
{
// initialize values of the private data storage structure
......@@ -519,6 +521,9 @@ PageViewToolBar::PageViewToolBar( QWidget * parent, QWidget * anchorWidget )
// apply a filter to get notified when anchor changes geometry
d->anchorWidget->installEventFilter( this );
setContextMenuPolicy( Qt::ActionsContextMenu );
addAction( parent->actionCollection()->action( "options_configure_annotations" ) );
}
PageViewToolBar::~PageViewToolBar()
......
......@@ -24,6 +24,7 @@ class QAction;
class QLabel;
class QTimer;
class FormWidgetIface;
class PageView;
class VideoWidget;
namespace Okular {
......@@ -192,7 +193,7 @@ class PageViewToolBar : public QWidget
{
Q_OBJECT
public:
PageViewToolBar( QWidget * parent, QWidget * anchorWidget );
PageViewToolBar( PageView * parent, QWidget * anchorWidget );
~PageViewToolBar();
// animated widget controls
......
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