summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/findbar.cpp13
-rw-r--r--src/findbar.h5
-rw-r--r--src/mainwindow.cpp9
-rw-r--r--src/zoombar.cpp15
-rw-r--r--src/zoombar.h7
5 files changed, 46 insertions, 3 deletions
diff --git a/src/findbar.cpp b/src/findbar.cpp
index 10b63186..5d88dc1b 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -185,3 +185,16 @@ void FindBar::hide()
QWidget::hide();
emit(searchString(m_lineEdit->text()));
}
+
+
+void FindBar::setVisible(bool visible)
+{
+ emit visibilityChanged(visible);
+ QWidget::setVisible(visible);
+}
+
+
+void FindBar::toggleVisibility()
+{
+ setVisible(!isVisible());
+}
diff --git a/src/findbar.h b/src/findbar.h
index 83334b4f..63b2949b 100644
--- a/src/findbar.h
+++ b/src/findbar.h
@@ -58,9 +58,14 @@ public:
public slots:
void show();
void hide();
+ void toggleVisibility();
signals:
void searchString(const QString &);
+ void visibilityChanged(bool);
+
+protected:
+ void setVisible(bool visible);
private:
KLineEdit *m_lineEdit;
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4d6883ef..e547e8e3 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -294,10 +294,12 @@ void MainWindow::setupActions()
KStandardAction::print(this, SLOT(printRequested()), actionCollection());
KStandardAction::quit(this , SLOT(close()), actionCollection());
- a = KStandardAction::find(m_findBar, SLOT(show()), actionCollection());
+ a = KStandardAction::find(m_findBar, SLOT(toggleVisibility()), actionCollection());
KShortcut findShortcut = KStandardShortcut::find();
findShortcut.setAlternate(Qt::Key_Slash);
a->setShortcut(findShortcut);
+ a->setCheckable(true);
+ connect(m_findBar, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool)));
KStandardAction::findNext(this, SLOT(findNext()) , actionCollection());
KStandardAction::findPrev(this, SLOT(findPrevious()) , actionCollection());
@@ -457,7 +459,10 @@ void MainWindow::setupTools()
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print)));
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Find)));
- toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Zoom)));
+ QAction *action = actionByName(KStandardAction::name(KStandardAction::Zoom));
+ action->setCheckable(true);
+ connect (m_zoomBar, SIGNAL(visibilityChanged(bool)), action, SLOT(setChecked(bool)));
+ toolsMenu->addAction(action);
toolsMenu->addAction(actionByName(QL1S("encodings")));
diff --git a/src/zoombar.cpp b/src/zoombar.cpp
index 1b52ae7b..c85e607a 100644
--- a/src/zoombar.cpp
+++ b/src/zoombar.cpp
@@ -100,7 +100,7 @@ void ZoomBar::setupActions(MainWindow *window)
a = window->actionCollection()->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut()));
a = window->actionCollection()->addAction(KStandardAction::ActualSize, this, SLOT(zoomNormal()));
a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_0));
- a = window->actionCollection()->addAction(KStandardAction::Zoom, this, SLOT(show()));
+ a = window->actionCollection()->addAction(KStandardAction::Zoom, this, SLOT(toggleVisibility()));
a->setIcon(KIcon("page-zoom"));
a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Y));
@@ -165,3 +165,16 @@ void ZoomBar::setValue(int value)
m_zoomSlider->setValue(value);
Application::instance()->mainWindow()->currentTab()->view()->setZoomFactor(QVariant(m_zoomSlider->value()).toReal() / 10); // Don't allox max +1 values
}
+
+
+void ZoomBar::setVisible(bool visible)
+{
+ emit visibilityChanged(visible);
+ QWidget::setVisible(visible);
+}
+
+
+void ZoomBar::toggleVisibility()
+{
+ setVisible(!isVisible());
+}
diff --git a/src/zoombar.h b/src/zoombar.h
index 03bff085..8e8d9aba 100644
--- a/src/zoombar.h
+++ b/src/zoombar.h
@@ -60,6 +60,13 @@ public slots:
void setupActions(MainWindow *window);
void updateSlider(int webview);
void setValue(int value);
+ void toggleVisibility();
+
+signals:
+ void visibilityChanged(bool);
+
+protected:
+ void setVisible(bool visible);
private:
QToolButton *m_zoomIn;