summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-06-27 00:39:22 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-06-27 00:39:22 +0200
commit571ed588fce9b66911f0144ffd6b8ed149fdd873 (patch)
tree6aaa74e529da02221a7f0c79daeeec85cf4a7a9b
parentSet URL on initial load just when it comes from main frame (diff)
downloadrekonq-571ed588fce9b66911f0144ffd6b8ed149fdd873.tar.xz
Added "wheel" case to the general zoom management
This should fix the problem that zoom changes are not saved when applied with the wheel CCBUG: 223188
-rw-r--r--src/webtab/webtab.cpp31
-rw-r--r--src/webtab/webtab.h3
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();