summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/webpage.cpp12
-rw-r--r--src/webtab.cpp2
-rw-r--r--src/zoombar.cpp42
-rw-r--r--src/zoombar.h19
4 files changed, 51 insertions, 24 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp
index c074f1ad..7a7793ec 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -532,7 +532,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
void WebPage::loadStarted()
{
- // HACK:
+ // HACK:
// Chinese encoding Fix. See BUG: 251264
// Use gb18030 instead of gb2312
if(settings()->defaultTextEncoding() == QL1S("gb2312"))
@@ -545,6 +545,16 @@ void WebPage::loadFinished(bool ok)
{
Q_UNUSED(ok);
+ // set zoom factor
+ QString val;
+ KSharedConfig::Ptr config = KGlobal::config();
+ KConfigGroup group( config, "Zoom" );
+ val = group.readEntry(_loadingUrl.host(), QString("10"));
+
+ int value = val.toInt();
+ kDebug() << "ZOOM VALUE: " << _loadingUrl.host() << value;
+ mainFrame()->setZoomFactor(QVariant(value).toReal() / 10); // Don't allox max +1 values
+
// Provide site icon. Can this be moved to loadStarted??
Application::iconManager()->provideIcon(this, _loadingUrl);
diff --git a/src/webtab.cpp b/src/webtab.cpp
index 1305747e..67a5f3b7 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -54,6 +54,7 @@
// Qt Includes
#include <QtGui/QVBoxLayout>
+
WebTab::WebTab(QWidget *parent)
: QWidget(parent)
, m_webView(new WebView(this))
@@ -169,6 +170,7 @@ void WebTab::createPreviewSelectorBar(int index)
connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), m_previewSelectorBar.data(), SLOT(verifyUrl()), Qt::UniqueConnection);
}
+
void WebTab::insertBar(NotificationBar *bar)
{
qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, bar);
diff --git a/src/zoombar.cpp b/src/zoombar.cpp
index a895466a..86791266 100644
--- a/src/zoombar.cpp
+++ b/src/zoombar.cpp
@@ -40,6 +40,8 @@
#include <KIcon>
#include <KLocalizedString>
#include <KStandardAction>
+#include <KConfig>
+#include <KConfigGroup>
// Qt Includes
#include <QtGui/QHBoxLayout>
@@ -47,6 +49,7 @@
#include <QtGui/QSlider>
#include <QtGui/QToolButton>
+
ZoomBar::ZoomBar(QWidget *parent)
: QWidget(parent)
,m_zoomIn(new QToolButton(this))
@@ -84,8 +87,6 @@ ZoomBar::ZoomBar(QWidget *parent)
m_zoomOut->setAutoRaise(true);
m_zoomNormal->setAutoRaise(true);
- // layout->setSpacing(0);
- // layout->setMargin(0);
layout->addWidget(m_zoomOut);
layout->addWidget(m_zoomSlider, 8);
layout->addWidget(m_zoomIn);
@@ -101,6 +102,15 @@ ZoomBar::ZoomBar(QWidget *parent)
}
+ZoomBar::~ZoomBar()
+{
+ delete m_zoomIn;
+ delete m_zoomOut;
+ delete m_zoomNormal;
+ delete m_zoomSlider;
+}
+
+
void ZoomBar::setupActions(MainWindow *window)
{
KAction *a;
@@ -118,15 +128,6 @@ void ZoomBar::setupActions(MainWindow *window)
}
-ZoomBar::~ZoomBar()
-{
- delete m_zoomIn;
- delete m_zoomOut;
- delete m_zoomNormal;
- delete m_zoomSlider;
-}
-
-
void ZoomBar::show()
{
// show findbar if not visible
@@ -134,7 +135,7 @@ void ZoomBar::show()
{
emit visibilityChanged(true);
QWidget::show();
- m_zoomSlider->setValue(Application::instance()->mainWindow()->currentTab()->view()->zoomFactor()*10);
+ m_zoomSlider->setValue(Application::instance()->mainWindow()->currentTab()->view()->zoomFactor()*10);
}
}
@@ -168,7 +169,7 @@ void ZoomBar::updateSlider(int webview)
{
WebTab *tab = 0;
if (!Application::instance()->mainWindowList().isEmpty())
- tab = Application::instance()->mainWindow()->mainView()->webTab(webview);
+ tab = Application::instance()->mainWindow()->mainView()->webTab(webview);
if (!tab)
return;
@@ -181,8 +182,10 @@ void ZoomBar::setValue(int value)
{
m_zoomSlider->setValue(value);
m_percentage->setText(i18nc("percentage of the website zoom", "%1%", QString::number(value*10)));
- // Don't allox max +1 values
- Application::instance()->mainWindow()->currentTab()->view()->setZoomFactor(QVariant(m_zoomSlider->value()).toReal() / 10);
+
+ WebTab *tab = Application::instance()->mainWindow()->currentTab();
+ saveZoomValue(tab->url().host(), value);
+ tab->view()->setZoomFactor(QVariant(value).toReal() / 10); // Don't allox max +1 values
}
@@ -190,3 +193,12 @@ void ZoomBar::toggleVisibility()
{
isVisible() ? hide() : show();
}
+
+
+void ZoomBar::saveZoomValue(const QString &host, int value)
+{
+ KSharedConfig::Ptr config = KGlobal::config();
+ KConfigGroup group( config, "Zoom" );
+ group.writeEntry(host, QString::number(value) );
+ config->sync();
+}
diff --git a/src/zoombar.h b/src/zoombar.h
index 533946f8..d31ac85a 100644
--- a/src/zoombar.h
+++ b/src/zoombar.h
@@ -34,7 +34,7 @@
// Qt Includes
#include <QtGui/QWidget>
-#include <QLabel>
+#include <QtGui/QLabel>
// Forward Declarations
class MainWindow;
@@ -51,7 +51,7 @@ public:
ZoomBar(QWidget *parent);
~ZoomBar();
-public slots:
+public Q_SLOTS:
void show();
void hide();
@@ -63,15 +63,18 @@ public slots:
void setValue(int value);
void toggleVisibility();
-signals:
+private:
+ void saveZoomValue(const QString &, int);
+
+Q_SIGNALS:
void visibilityChanged(bool);
private:
- QToolButton *m_zoomIn;
- QToolButton *m_zoomOut;
- QToolButton *m_zoomNormal;
- QSlider *m_zoomSlider;
- QLabel *m_percentage;
+ QToolButton *m_zoomIn;
+ QToolButton *m_zoomOut;
+ QToolButton *m_zoomNormal;
+ QSlider *m_zoomSlider;
+ QLabel *m_percentage;
};
#endif