diff options
Diffstat (limited to 'src/webtab')
-rw-r--r-- | src/webtab/webtab.cpp | 31 | ||||
-rw-r--r-- | src/webtab/webtab.h | 3 |
2 files changed, 19 insertions, 15 deletions
diff --git a/src/webtab/webtab.cpp b/src/webtab/webtab.cpp index a304a68c..7d576025 100644 --- a/src/webtab/webtab.cpp +++ b/src/webtab/webtab.cpp @@ -117,7 +117,8 @@ WebTab::WebTab(QWidget *parent, bool isPrivateBrowsing) connect(view(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(urlChanged(QUrl))); connect(view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); connect(view(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); - + connect(view(), SIGNAL(zoomChanged(int)), this, SIGNAL(setZoom(int))); + connect(page(), SIGNAL(initialUrl(QUrl)), this, SIGNAL(urlChanged(QUrl))); if (!parent) @@ -436,12 +437,7 @@ void WebTab::zoomIn() view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10); - // set zoom factor - KSharedConfig::Ptr config = KGlobal::config(); - KConfigGroup group(config, "Zoom"); - group.writeEntry(url().host(), m_zoomFactor); - - emit infoToShow(i18n("Zooming: %1%", QString::number(m_zoomFactor * 10))); + setZoom(m_zoomFactor); } @@ -456,12 +452,7 @@ void WebTab::zoomOut() m_zoomFactor--; view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10); - // set zoom factor - KSharedConfig::Ptr config = KGlobal::config(); - KConfigGroup group(config, "Zoom"); - group.writeEntry(url().host(), m_zoomFactor); - - emit infoToShow(i18n("Zooming: %1%", QString::number(m_zoomFactor * 10))); + setZoom(m_zoomFactor); } @@ -469,13 +460,25 @@ void WebTab::zoomDefault() { m_zoomFactor = 10; view()->setZoomFactor(QVariant(m_zoomFactor).toReal() / 10); + + setZoom(m_zoomFactor); +} + +void WebTab::setZoom(int zoomFactor) +{ + // This is needed because of the WebView zoomChanged signal... + m_zoomFactor = zoomFactor; + // set zoom factor KSharedConfig::Ptr config = KGlobal::config(); KConfigGroup group(config, "Zoom"); group.writeEntry(url().host(), m_zoomFactor); - emit infoToShow(i18n("Default zoom: %1%", QString::number(m_zoomFactor * 10))); + if (m_zoomFactor == 10) + emit infoToShow(i18n("Default zoom: %1%", QString::number(m_zoomFactor * 10))); + else + emit infoToShow(i18n("Zooming: %1%", QString::number(m_zoomFactor * 10))); } diff --git a/src/webtab/webtab.h b/src/webtab/webtab.h index 9fa40659..338503a0 100644 --- a/src/webtab/webtab.h +++ b/src/webtab/webtab.h @@ -110,7 +110,8 @@ private Q_SLOTS: void zoomIn(); void zoomOut(); void zoomDefault(); - + void setZoom(int); + // webapp slots per title & icon void webAppTitleChanged(QString); void webAppIconChanged(); |