Merge lp:~mardy/signon-ui/sizing into lp:signon-ui

Proposed by Alberto Mardegan on 2013-03-21
Status: Merged
Approved by: Alberto Mardegan on 2013-03-21
Approved revision: 82
Merged at revision: 82
Proposed branch: lp:~mardy/signon-ui/sizing
Merge into: lp:signon-ui
Prerequisite: lp:~mardy/signon-ui/lp1111507
Diff against target: 59 lines (+28/-0)
1 file modified
src/browser-request.cpp (+28/-0)
To merge this branch: bzr merge lp:~mardy/signon-ui/sizing
Reviewer Review Type Date Requested Status
David King (community) 2013-03-21 Approve on 2013-03-21
PS Jenkins bot (community) continuous-integration Approve on 2013-03-21
Review via email: mp+154623@code.launchpad.net

Commit message

Allow configuring scrollbar behaviour

Add configuration options to force the visibility of vertical and horizontal scrollbars.

Description of the change

Allow configuring scrollbar behaviour

Add configuration options to force the visibility of vertical and horizontal scrollbars.

To post a comment you must log in.
David King (amigadave) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/browser-request.cpp'
2--- src/browser-request.cpp 2013-03-21 08:26:24 +0000
3+++ src/browser-request.cpp 2013-03-21 08:26:24 +0000
4@@ -48,6 +48,8 @@
5 namespace SignOnUi {
6
7 static const QString keyPreferredWidth = QString("PreferredWidth");
8+static const QString keyHorizontalScrollBar = QString("HorizontalScrollBar");
9+static const QString keyVerticalScrollBar = QString("VerticalScrollBar");
10 static const QString keyTextSizeMultiplier = QString("TextSizeMultiplier");
11 static const QString keyUserAgent = QString("UserAgent");
12 static const QString keyViewportWidth = QString("ViewportWidth");
13@@ -59,6 +61,8 @@
14 static const QString keyInternalLinksPattern = QString("InternalLinksPattern");
15 static const QString keyExternalLinksPattern = QString("ExternalLinksPattern");
16 static const QString keyAllowedUrls = QString("AllowedUrls");
17+static const QString valueAlwaysOn = QString("alwaysOn");
18+static const QString valueAlwaysOff = QString("alwaysOff");
19
20 /* Additional session-data keys we support. */
21 static const QString keyCookies = QString("Cookies");
22@@ -579,6 +583,18 @@
23 q->setWidget(m_dialog);
24 }
25
26+static Qt::ScrollBarPolicy scrollPolicyFromValue(const QVariant &value)
27+{
28+ QString stringValue = value.toString();
29+ if (stringValue == valueAlwaysOn) {
30+ return Qt::ScrollBarAlwaysOn;
31+ } else if (stringValue == valueAlwaysOff) {
32+ return Qt::ScrollBarAlwaysOff;
33+ } else {
34+ return Qt::ScrollBarAsNeeded;
35+ }
36+}
37+
38 void BrowserRequestPrivate::setupViewForUrl(const QUrl &url)
39 {
40 QString host = url.host();
41@@ -617,6 +633,18 @@
42 m_webView->setZoomFactor(m_settings->value(keyZoomFactor).toReal());
43 }
44
45+ if (m_settings->contains(keyHorizontalScrollBar)) {
46+ Qt::ScrollBarPolicy policy =
47+ scrollPolicyFromValue(m_settings->value(keyHorizontalScrollBar));
48+ page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, policy);
49+ }
50+
51+ if (m_settings->contains(keyVerticalScrollBar)) {
52+ Qt::ScrollBarPolicy policy =
53+ scrollPolicyFromValue(m_settings->value(keyVerticalScrollBar));
54+ page->mainFrame()->setScrollBarPolicy(Qt::Vertical, policy);
55+ }
56+
57 page->setExternalLinksPattern(m_settings->value(keyExternalLinksPattern).
58 toString());
59 page->setInternalLinksPattern(m_settings->value(keyInternalLinksPattern).

Subscribers

People subscribed via source and target branches

to all changes: