Commit 8ca2498d authored by Simone Gaiarin's avatar Simone Gaiarin
Browse files

Make annotation toolbar visibility changed connection unique

parent 5d968d51
......@@ -99,7 +99,6 @@ public:
void slotQuickToolSelected(int favToolId);
void slotSetColor(AnnotationColor colorType, const QColor &color = QColor());
void slotSelectAnnotationFont();
void slotAnnotationToolBarVisibilityChanged(bool visible);
bool isQuickToolAction(QAction *aTool);
bool isQuickToolStamp(int toolId);
void assertToolBarExists(KParts::MainWindow *mw, const QString &toolBarName);
......@@ -515,14 +514,6 @@ void AnnotationActionHandlerPrivate::slotSelectAnnotationFont()
}
}
void AnnotationActionHandlerPrivate::slotAnnotationToolBarVisibilityChanged(bool visible)
{
aShowToolBar->setEnabled(!visible);
if (!visible && !isQuickToolAction(agTools->checkedAction())) {
q->deselectAllAnnotationActions();
}
}
bool AnnotationActionHandlerPrivate::isQuickToolAction(QAction *aTool)
{
return quickTools.contains(aTool);
......@@ -800,8 +791,7 @@ void AnnotationActionHandler::setupAnnotationToolBarVisibilityAction()
d->assertToolBarExists(mw, QStringLiteral("quickAnnotationToolBar"));
KToolBar *annotationToolBar = mw->toolBar(QStringLiteral("annotationToolBar"));
connect(
annotationToolBar, &QToolBar::visibilityChanged, this, [this](bool visible) { d->slotAnnotationToolBarVisibilityChanged(visible); }, Qt::UniqueConnection);
connect(annotationToolBar, &QToolBar::visibilityChanged, this, &AnnotationActionHandler::slotAnnotationToolBarVisibilityChanged, Qt::UniqueConnection);
// show action
connect(d->aShowToolBar, &QAction::triggered, annotationToolBar, &KToolBar::show, Qt::UniqueConnection);
// hide action
......@@ -860,4 +850,12 @@ void AnnotationActionHandler::deselectAllAnnotationActions()
}
}
void AnnotationActionHandler::slotAnnotationToolBarVisibilityChanged(bool visible)
{
d->aShowToolBar->setEnabled(!visible);
if (!visible && !d->isQuickToolAction(d->agTools->checkedAction())) {
deselectAllAnnotationActions();
}
}
#include "moc_annotationactionhandler.cpp"
......@@ -45,6 +45,9 @@ public:
signals:
void ephemeralStampWarning();
private slots:
void slotAnnotationToolBarVisibilityChanged(bool visible);
private:
class AnnotationActionHandlerPrivate *d;
};
......
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