Commit d8f9800d authored by Albert Astals Cid's avatar Albert Astals Cid

Make the drawing tools be actions instead of tool buttons

3 benefits:
 * We can set the shortcut in the edit shortcuts dialog as before
 * Shortcuts can be activated without showing the topbar as before
 * Drawing in the toppbar is exactly as the other actions
parent 81f80ac3
......@@ -258,7 +258,7 @@ set(okularpart_SRCS
ui/annotationwidgets.cpp
ui/bookmarklist.cpp
ui/debug_ui.cpp
ui/drawingtoolselectaction.cpp
ui/drawingtoolactions.cpp
ui/fileprinterpreview.cpp
ui/findbar.cpp
ui/formwidgets.cpp
......
#!/bin/sh
$EXTRACTRC *.rc */*.rc >> rc.cpp || exit 11
$EXTRACTRC $(find conf/ -name "*.ui") $(find core/ -name "*.ui") $(find ui/ -name "*.ui") $(ls . | grep -E '\.ui') >> rc.cpp || exit 12
$EXTRACTATTR --attr=tool,name ui/data/drawingtools.xml >> rc.cpp || exit 13
$XGETTEXT $(find conf/ -name "*.cpp" -o -name "*.h") $(find core/ -name "*.cpp" -o -name "*.h") $(find ui/ -name "*.cpp" -o -name "*.h") $(find shell/ -name "*.cpp" -o -name "*.h") $(ls . | grep -E '\.cpp$') $(ls . | grep -E '\.h$') -o $podir/okular.pot
......@@ -10,6 +10,7 @@
#include "editdrawingtooldialog.h"
#include <KColorButton>
#include <KLineEdit>
#include <KLocalizedString>
#include <QDialogButtonBox>
......@@ -39,32 +40,42 @@ EditDrawingToolDialog::EditDrawingToolDialog( const QDomElement &initialState, Q
mainLayout->addWidget( widget );
mainLayout->addWidget( buttonBox );
QLabel *tmplabel = new QLabel( i18n( "Color:" ), widget );
m_name = new KLineEdit( widget );
mainLayout->addWidget( m_name );
QLabel *tmplabel = new QLabel( i18n( "&Name:" ), widget );
mainLayout->addWidget( tmplabel );
tmplabel->setBuddy( m_name );
widgetLayout->addWidget( tmplabel, 0, 0, Qt::AlignRight );
widgetLayout->addWidget( m_name, 0, 1 );
tmplabel = new QLabel( i18n( "Color:" ), widget );
widgetLayout->addWidget( tmplabel, 1, 0, Qt::AlignRight );
m_colorBn = new KColorButton( this );
m_colorBn->setObjectName( QStringLiteral("colorbutton") );
widgetLayout->addWidget( m_colorBn, 0, 1, Qt::AlignRight );
widgetLayout->addWidget( m_colorBn, 1, 1, Qt::AlignRight );
tmplabel = new QLabel( i18n( "&Pen Width:" ), widget );
widgetLayout->addWidget( tmplabel, 1, 0, Qt::AlignRight );
widgetLayout->addWidget( tmplabel, 2, 0, Qt::AlignRight );
m_penWidth = new QSpinBox( widget );
m_penWidth->setObjectName( QStringLiteral("penWidth") );
m_penWidth->setRange( 0, 50 );
m_penWidth->setSuffix( i18nc( "Suffix for the pen width, eg '10 px'", " px" ) );
tmplabel->setBuddy( m_penWidth );
widgetLayout->addWidget( m_penWidth, 1, 1 );
widgetLayout->addWidget( m_penWidth, 2, 1 );
tmplabel = new QLabel( i18n( "&Opacity:" ), widget );
widgetLayout->addWidget( tmplabel, 2, 0, Qt::AlignRight );
widgetLayout->addWidget( tmplabel, 3, 0, Qt::AlignRight );
m_opacity = new QSpinBox( widget );
m_opacity->setObjectName( QStringLiteral("opacity") );
m_opacity->setRange( 0, 100 );
m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) );
tmplabel->setBuddy( m_opacity );
widgetLayout->addWidget( m_opacity, 2, 1 );
widgetLayout->addWidget( m_opacity, 3, 1 );
if ( initialState.isNull() )
{
......@@ -78,12 +89,19 @@ EditDrawingToolDialog::EditDrawingToolDialog( const QDomElement &initialState, Q
setWindowTitle( i18n("Edit drawing tool") );
loadTool( initialState );
}
m_name->setFocus();
}
EditDrawingToolDialog::~EditDrawingToolDialog()
{
}
QString EditDrawingToolDialog::name() const
{
return m_name->text();
}
QDomDocument EditDrawingToolDialog::toolXml() const
{
QDomDocument doc;
......@@ -119,4 +137,9 @@ void EditDrawingToolDialog::loadTool( const QDomElement &toolElement )
m_penWidth->setValue( annotationElement.attribute( QStringLiteral("width"), QStringLiteral("2") ).toInt() );
m_opacity->setValue( annotationElement.attribute( QStringLiteral("opacity"), QStringLiteral("1.0") ).toDouble() * 100 );
if ( toolElement.attribute( QStringLiteral("default"), QStringLiteral("false") ) == QLatin1String("true") )
m_name->setText( i18n( toolElement.attribute( QStringLiteral("name") ).toLatin1().constData() ) );
else
m_name->setText( toolElement.attribute( QStringLiteral("name") ) );
}
......@@ -14,6 +14,7 @@
#include <QDomElement>
class KColorButton;
class KLineEdit;
class QSpinBox;
......@@ -26,9 +27,12 @@ public:
QDomDocument toolXml() const;
QString name() const;
private:
void loadTool( const QDomElement &toolElement );
KLineEdit *m_name;
KColorButton *m_colorBn;
QSpinBox *m_penWidth;
QSpinBox *m_opacity;
......
......@@ -11,9 +11,12 @@
#include "editdrawingtooldialog.h"
#include <KLocalizedString>
#include <QDebug>
#include <QDomElement>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QPainter>
// Used to store tools' XML description in m_list's items
......@@ -84,7 +87,14 @@ void WidgetDrawingTools::setTools( const QStringList &items )
const QDomElement toolElement = entryParser.documentElement();
if ( toolElement.tagName() == QLatin1String("tool") )
{
QListWidgetItem * listEntry = new QListWidgetItem( m_list );
const QString name = toolElement.attribute( QStringLiteral("name") );
QString itemText;
if ( toolElement.attribute( QStringLiteral("default"), QStringLiteral("false") ) == QLatin1String("true") )
itemText = i18n( name.toLatin1().constData() );
else
itemText = name;
QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list );
listEntry->setData( ToolXmlRole, qVariantFromValue( toolXml ) );
listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) );
}
......@@ -93,6 +103,28 @@ void WidgetDrawingTools::setTools( const QStringList &items )
updateButtons();
}
QString WidgetDrawingTools::defaultName() const
{
int nameIndex = 1;
bool freeNameFound = false;
QString candidateName;
while (!freeNameFound)
{
candidateName = i18n("Default Drawing Tool #%1", nameIndex);
int i = 0;
for ( ; i < m_list->count(); ++i )
{
QListWidgetItem * listEntry = m_list->item( i );
if (candidateName == listEntry->text()) {
break;
}
}
freeNameFound = i == m_list->count();
++nameIndex;
}
return candidateName;
}
void WidgetDrawingTools::slotAdd()
{
EditDrawingToolDialog dlg( QDomElement(), this );
......@@ -101,11 +133,30 @@ void WidgetDrawingTools::slotAdd()
return;
const QDomDocument rootDoc = dlg.toolXml();
const QDomElement toolElement = rootDoc.documentElement();
QDomElement toolElement = rootDoc.documentElement();
QString itemText = dlg.name().trimmed();
if (itemText.isEmpty()) {
itemText = defaultName();
}
for ( int i = 0; i < m_list->count(); ++i )
{
QListWidgetItem * listEntry = m_list->item( i );
if (itemText == listEntry->text()) {
QMessageBox::information( this, i18n("Duplicated Name"), i18n("There's already a tool with that name. Using a default one") );
itemText = defaultName();
break;
}
}
// Store name attribute only if the user specified a customized name
toolElement.setAttribute( QStringLiteral("name"), itemText );
// Create list entry and attach XML string as data
const QString toolXml = rootDoc.toString( -1 );
QListWidgetItem * listEntry = new QListWidgetItem( m_list );
QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list );
listEntry->setData( ToolXmlRole, qVariantFromValue( toolXml ) );
listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) );
......@@ -122,7 +173,7 @@ void WidgetDrawingTools::slotEdit()
QDomDocument doc;
doc.setContent( listEntry->data( ToolXmlRole ).value<QString>() );
const QDomElement toolElement = doc.documentElement();
QDomElement toolElement = doc.documentElement();
EditDrawingToolDialog dlg( toolElement, this );
......@@ -130,9 +181,26 @@ void WidgetDrawingTools::slotEdit()
return;
doc = dlg.toolXml();
toolElement = doc.documentElement();
QString itemText = dlg.name();
for ( int i = 0; i < m_list->count(); ++i )
{
QListWidgetItem * auxListEntry = m_list->item( i );
if (itemText == auxListEntry->text() && auxListEntry != listEntry) {
QMessageBox::information( this, i18n("Duplicated Name"), i18n("There's already a tool with that name. Using a default one") );
itemText = defaultName();
break;
}
}
// Store name attribute only if the user specified a customized name
toolElement.setAttribute( QStringLiteral("name"), itemText );
// Edit list entry and attach XML string as data
const QString toolXml = doc.toString( -1 );
listEntry->setText( itemText );
listEntry->setData( ToolXmlRole, qVariantFromValue( toolXml ) );
listEntry->setData( Qt::DecorationRole, colorDecorationFromToolDescription( toolXml ) );
......
......@@ -22,6 +22,8 @@ public:
QStringList tools() const Q_DECL_OVERRIDE;
void setTools( const QStringList& items ) Q_DECL_OVERRIDE;
QString defaultName() const;
protected slots:
void slotAdd() Q_DECL_OVERRIDE;
......
......@@ -73,6 +73,7 @@
#include "aboutdata.h"
#include "extensions.h"
#include "ui/debug_ui.h"
#include "ui/drawingtoolactions.h"
#include "ui/pageview.h"
#include "ui/toc.h"
#include "ui/searchwidget.h"
......@@ -691,6 +692,7 @@ void Part::setupViewerActions()
m_exportAsMenu = 0;
m_exportAsText = 0;
m_exportAsDocArchive = 0;
m_presentationDrawingActions = 0;
m_aboutBackend = ac->addAction("help_about_backend");
m_aboutBackend->setText(i18n("About Backend"));
......@@ -816,6 +818,8 @@ void Part::setupActions()
blackscreenAction->setIcon( QIcon::fromTheme( "view-presentation" ) );
blackscreenAction->setEnabled( false );
m_presentationDrawingActions = new DrawingToolActions( ac );
QAction *eraseDrawingAction = new QAction( i18n( "Erase Drawings" ), ac );
ac->addAction( "presentation_erase_drawings", eraseDrawingAction );
eraseDrawingAction->setIcon( QIcon::fromTheme( "draw-eraser" ) );
......@@ -2358,6 +2362,13 @@ void Part::slotNewConfig()
m_reviewsWidget->reparseConfig();
setWindowTitleFromDocument ();
if ( m_presentationDrawingActions ) {
m_presentationDrawingActions->reparseConfig();
if (factory()) {
factory()->refreshActionProperties();
}
}
}
......@@ -2511,7 +2522,7 @@ void Part::slotShowPresentation()
{
if ( !m_presentationWidget )
{
m_presentationWidget = new PresentationWidget( widget(), m_document, actionCollection() );
m_presentationWidget = new PresentationWidget( widget(), m_document, m_presentationDrawingActions, actionCollection() );
}
}
......@@ -2528,7 +2539,7 @@ void Part::slotTogglePresentation()
if ( m_document->isOpened() )
{
if ( !m_presentationWidget )
m_presentationWidget = new PresentationWidget( widget(), m_document, actionCollection() );
m_presentationWidget = new PresentationWidget( widget(), m_document, m_presentationDrawingActions, actionCollection() );
else delete (PresentationWidget*) m_presentationWidget;
}
}
......
......@@ -64,6 +64,7 @@ class MiniBarLogic;
class FileKeeper;
class Reviews;
class BookmarkList;
class DrawingToolActions;
namespace Okular
{
......@@ -328,6 +329,7 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
QAction *m_reload;
QMenu *m_exportAsMenu;
QAction *m_closeFindBar;
DrawingToolActions *m_presentationDrawingActions;
bool m_actionsSearched;
BrowserExtension *m_bExtension;
......
......@@ -8,32 +8,32 @@ Engine/DrawingTools Types [specific attributes]:
Ink [width]
-->
<drawingTools>
<tool id="1">
<tool id="1" name="Red" default="true">
<engine color="#ff0000">
<annotation type="Ink" color="#ff0000" width="2" />
</engine>
</tool>
<tool id="2">
<tool id="2" name="Green" default="true">
<engine color="#00ff00">
<annotation type="Ink" color="#00ff00" width="2" />
</engine>
</tool>
<tool id="3">
<tool id="3" name="Blue" default="true">
<engine color="#0000ff">
<annotation type="Ink" color="#0000ff" width="2" />
</engine>
</tool>
<tool id="4">
<tool id="4" name="Yellow" default="true">
<engine color="#ffff00">
<annotation type="Ink" color="#ffff00" width="2" />
</engine>
</tool>
<tool id="5">
<tool id="5" name="Black" default="true">
<engine color="#000000">
<annotation type="Ink" color="#000000" width="2" />
</engine>
</tool>
<tool id="6">
<tool id="6" name="White" default="true">
<engine color="#ffffff">
<annotation type="Ink" color="#ffffff" width="2" />
</engine>
......
/***************************************************************************
* Copyright (C) 2015 by Laurent Montel <montel@kde.org> *
* Copyright (C) 2015 by Albert Astals Cid <aacid@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -7,22 +8,22 @@
* (at your option) any later version. *
***************************************************************************/
#include "drawingtoolselectaction.h"
#include "drawingtoolactions.h"
#include "debug_ui.h"
#include "settings.h"
#include <KActionCollection>
#include <KLocalizedString>
#include <QHBoxLayout>
#include <QAction>
#include <QPainter>
#include <QToolButton>
class ColorButton : public QToolButton
class ColorAction : public QAction
{
public:
explicit ColorButton( QWidget *parent = Q_NULLPTR )
: QToolButton( parent )
explicit ColorAction( KActionCollection *parent )
: QAction( parent )
{
}
......@@ -52,44 +53,50 @@ public:
}
};
DrawingToolSelectAction::DrawingToolSelectAction( QObject *parent )
: QWidgetAction( parent )
DrawingToolActions::DrawingToolActions( KActionCollection *parent )
: QObject( parent )
{
QWidget *mainWidget = new QWidget;
m_layout = new QHBoxLayout( mainWidget );
m_layout->setContentsMargins( 0, 0, 0, 0 );
loadTools();
}
setDefaultWidget( mainWidget );
DrawingToolActions::~DrawingToolActions()
{
}
QList<QAction*> DrawingToolActions::actions() const
{
return m_actions;
}
DrawingToolSelectAction::~DrawingToolSelectAction()
void DrawingToolActions::reparseConfig()
{
qDeleteAll(m_actions);
m_actions.clear();
loadTools();
}
void DrawingToolSelectAction::toolButtonClicked()
void DrawingToolActions::actionTriggered()
{
QAbstractButton *button = qobject_cast<QAbstractButton*>( sender() );
QAction *action = qobject_cast<QAction*>( sender() );
if ( button ) {
if ( button->isChecked() ) {
Q_FOREACH ( QAbstractButton *btn, m_buttons )
if ( action ) {
if ( action->isChecked() ) {
Q_FOREACH ( QAction *btn, m_actions )
{
if ( button != btn ) {
if ( action != btn ) {
btn->setChecked( false );
}
}
emit changeEngine( button->property( "__document" ).value<QDomElement>() );
emit changeEngine( action->property( "__document" ).value<QDomElement>() );
} else {
emit changeEngine( QDomElement() );
}
}
}
void DrawingToolSelectAction::loadTools()
void DrawingToolActions::loadTools()
{
const QStringList drawingTools = Okular::Settings::drawingTools();
......@@ -104,8 +111,6 @@ void DrawingToolSelectAction::loadTools()
qCWarning(OkularUiDebug) << "Skipping malformed quick selection XML in QuickSelectionTools setting";
}
int shortcutCounter = 0;
// Create the AnnotationToolItems from the XML dom tree
QDomNode drawingDescription = drawingDefinition.firstChild();
while ( drawingDescription.isElement() )
......@@ -113,10 +118,21 @@ void DrawingToolSelectAction::loadTools()
const QDomElement toolElement = drawingDescription.toElement();
if ( toolElement.tagName() == "tool" )
{
QString tooltip;
QString width;
QString colorStr;
QString opacity;
const QString name = toolElement.attribute( QStringLiteral("name") );
if ( toolElement.attribute( QStringLiteral("default"), QStringLiteral("false") ) == QLatin1String("true") )
{
tooltip = i18n( name.toLatin1().constData() );
}
else
{
tooltip = name;
}
const QDomNodeList engineNodeList = toolElement.elementsByTagName( "engine" );
if ( engineNodeList.size() > 0 )
{
......@@ -149,34 +165,29 @@ void DrawingToolSelectAction::loadTools()
annElem.setAttribute( QStringLiteral("width"), width );
annElem.setAttribute( QStringLiteral("opacity"), opacity );
const QString description = i18n("Toggle Drawing Tool:\n color: %1\n pen width: %2\n opacity: %3%", colorStr, width, opacity.toDouble() * 100);
shortcutCounter++;
const QString shortcut = (shortcutCounter < 10 ? i18n( "Ctrl+%1", shortcutCounter ) :
shortcutCounter == 10 ? i18n( "Ctrl+0" ) :
QString());
createToolButton( description, colorStr, root, shortcut );
const QString text = i18n("Drawing Tool: %1", tooltip);
createToolAction( text, tooltip, colorStr, width, opacity, root );
}
drawingDescription = drawingDescription.nextSibling();
}
}
void DrawingToolSelectAction::createToolButton( const QString &description, const QString &colorName, const QDomElement &root, const QString &shortcut )
void DrawingToolActions::createToolAction( const QString &text, const QString &toolName, const QString &colorName, const QString &width, const QString &opacity, const QDomElement &root )
{
ColorButton *button = new ColorButton;
button->setToolTip( description );
button->setCheckable( true );
button->setColor( QColor( colorName ) );
KActionCollection *ac = static_cast<KActionCollection*>( parent() );
ColorAction *action = new ColorAction( ac );
action->setText( text );
action->setToolTip( toolName );
action->setCheckable( true );
action->setColor( QColor( colorName ) );
action->setEnabled( false );
if ( !shortcut.isEmpty() )
button->setShortcut( QKeySequence( shortcut ) );
action->setProperty( "__document", QVariant::fromValue<QDomElement>( root ) );
button->setProperty( "__document", QVariant::fromValue<QDomElement>( root ) );
m_actions.append( action );
m_buttons.append( button );
m_layout->addWidget( button );
ac->addAction( QString("presentation_drawing_%1").arg( toolName ), action );
connect( button, SIGNAL(clicked()), SLOT(toolButtonClicked()) );
connect( action, &QAction::triggered, this, &DrawingToolActions::actionTriggered );
}
/***************************************************************************
* Copyright (C) 2015 by Laurent Montel <montel@kde.org> *
* Copyright (C) 2015 by Albert Astals Cid <aacid@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef DRAWINGTOOLSELECTACTION_H
#define DRAWINGTOOLSELECTACTION_H
#ifndef DRAWINGTOOLACTIONS_H
#define DRAWINGTOOLACTIONS_H
#include <QDomDocument>
#include <QWidgetAction>
#include <QObject>
class QAbstractButton;
class QButtonGroup;
class QHBoxLayout;
class QAction;
class KActionCollection;
class DrawingToolSelectAction : public QWidgetAction
class DrawingToolActions : public QObject
{
Q_OBJECT
public:
explicit DrawingToolSelectAction( QObject *parent = Q_NULLPTR );
~DrawingToolSelectAction();
explicit DrawingToolActions( KActionCollection *parent );
~DrawingToolActions();
QList<QAction*> actions() const;
void reparseConfig();
signals:
void changeEngine( const QDomElement &doc );
void actionsRecreated();
private slots:
void toolButtonClicked();
void actionTriggered();
private:
void loadTools();
void createToolButton( const QString &description, const QString &colorName, const QDomElement &root, const QString &shortcut = QString() );
void createToolAction( const QString &text, const QString &toolName, const QString &colorName, const QString &width, const QString &opacity, const QDomElement &root );
QList<QAbstractButton*> m_buttons;
QHBoxLayout *m_layout;
QList<QAction*> m_actions;
};
Q_DECLARE_METATYPE( QDomElement )
#endif // DRAWINGTOOLSELECTACTION_H
#endif // DRAWINGTOOLACTIONS_H
......@@ -8,7 +8,6 @@
***************************************************************************/
#include "presentationwidget.h"
#include "drawingtoolselectaction.h"
// qt/kde includes
#include <QtCore/qloggingcategory.h>
......@@ -51,6 +50,7 @@
// local includes
#include "annotationtools.h"
#include "debug_ui.h"
#include "drawingtoolactions.h"
#include "guiutils.h"
#include "pagepainter.h"
#include "presentationsearchbar.h"
......@@ -132,7 +132,7 @@ class PresentationToolBar : public QToolBar
};
PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc, KActionCollection * collection )
PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc, DrawingToolActions * drawingToolActions, KActionCollection * collection )
: QWidget( 0 /* must be null, to have an independent widget */, Qt::FramelessWindowHint ),
m_pressedLink( 0 ), m_handCursor( false ), m_drawingEngine( 0 ),
m_parentWidget( parent ),
......@@ -191,10 +191,14 @@ PresentationWidget::PresentationWidget( QWidget * parent, Okular::Document * doc
m_topBar->addAction( eraseDrawingAct );
addAction( eraseDrawingAct );
m_drawingToolAction = new DrawingToolSelectAction( this );
connect( m_drawingToolAction, &DrawingToolSelectAction::changeEngine, this, &PresentationWidget::slotChangeDrawingToolEngine );
m_topBar->addAction( m_drawingToolAction );
addAction( m_drawingToolAction );
foreach(QAction *action, drawingToolActions->actions())
{
action->setEnabled( true );
m_topBar->addAction( action );
addAction( action );
}
connect( drawingToolActions, &DrawingToolActions::changeEngine, this, &PresentationWidget::slotChangeDrawingToolEngine );
connect( drawingToolActions, &DrawingToolActions::actionsRecreated, this, &PresentationWidget::slotAddDrawingToolActions );
QDesktopWidget *desktop = QApplication::desktop();
if ( desktop->numScreens() > 1 )
......@@ -280,15 +284,12 @@ PresentationWidget::~PresentationWidget()
// remove this widget from document observer
m_document->removeObserver( this );
QAction *eraseDrawingAct = m_ac->action( "presentation_erase_drawings" );
eraseDrawingAct->setEnabled( false );
QAction *playPauseAction = m_ac->action( "presentation_play_pause" );
playPauseAction->setEnabled( false );
foreach( QAction *action, m_topBar->actions() )
{
action->setChecked( false );
action->setEnabled( false );
}
QAction *blackScreenAct = m_ac->action( "switch_blackscreen_mode" );
blackScreenAct->setChecked( false );
blackScreenAct->setEnabled( false );
delete m_drawingEngine;
// delete frames
......@@ -1504,6 +1505,15 @@ void PresentationWidget::slotChangeDrawingToolEngine( const QDomElement &element
}
}
void PresentationWidget::slotAddDrawingToolActions()
{
DrawingToolActions *drawingToolActions = qobject_cast<DrawingToolActions*>(sender());
foreach(QAction *action, drawingToolActions->actions()) {
action->setEnabled( true );
m_topBar->addAction( action );
addAction( action );
}
}
void PresentationWidget::clearDrawings()
{
......
......@@ -22,12 +22,12 @@
class QLineEdit;
class QToolBar;
class QTimer;
class DrawingToolSelectAction;
class KActionCollection;
class KSelectAction;
class SmoothPathEngine;
struct PresentationFrame;
class PresentationSearchBar;
class DrawingToolActions;
namespace Okular {
class Action;
......@@ -47,7 +47,7 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
{
Q_OBJECT
public:
PresentationWidget( QWidget * parent, Okular::Document * doc, KActionCollection * collection );
PresentationWidget( QWidget * parent, Okular::Document * doc, DrawingToolActions * drawingToolActions, KActionCollection * collection );
~PresentationWidget();
// inherited from DocumentObserver
......@@ -137,7 +137,6 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver