summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-04-03 18:58:59 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-04-15 00:04:36 +0200
commit07f202805bc7f18dc382f490dfdc54a5185f6582 (patch)
tree3c61a15189f33fb346e41b2e83d61bef1a556d03 /src/urlbar
parentfixuifiles (diff)
downloadrekonq-07f202805bc7f18dc382f490dfdc54a5185f6582.tar.xz
urlbar look change
Move SSL icon in place of left urlbar favicon (as usually major browsers do). Remove positive and negative background when https page is visited.
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/sslwidget.cpp24
-rw-r--r--src/urlbar/urlbar.cpp68
-rw-r--r--src/urlbar/urlbar.h2
3 files changed, 52 insertions, 42 deletions
diff --git a/src/urlbar/sslwidget.cpp b/src/urlbar/sslwidget.cpp
index a9d3e9b6..8e336219 100644
--- a/src/urlbar/sslwidget.cpp
+++ b/src/urlbar/sslwidget.cpp
@@ -42,6 +42,9 @@
#include <QTextDocument>
+const int c_dim = 16;
+
+
SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
: QMenu(parent)
, m_url(url)
@@ -83,7 +86,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
if (cert.isNull())
{
label->setText(i18n("Warning: this site is NOT carrying a certificate."));
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-low").pixmap(c_dim));
layout->addWidget(label, rows++, 1);
}
else
@@ -93,7 +96,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
label->setText(i18n("The certificate for this site is valid and has been verified by:\n%1.",
Qt::escape(cert.issuerInfo(QSslCertificate::CommonName))));
- imageLabel->setPixmap(KIcon("security-high").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-high").pixmap(c_dim));
}
else
{
@@ -106,7 +109,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
label->setText(i18n("The certificate for this site is NOT valid, for the following reasons:\n%1.", c));
label->setTextFormat(Qt::RichText);
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-low").pixmap(c_dim));
}
layout->addWidget(label, rows++, 1);
@@ -138,7 +141,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
label->setText(i18n("Your connection to %1 is NOT encrypted.\n", m_url.host()));
layout->addWidget(label, rows++ , 1);
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-low").pixmap(c_dim));
}
else
{
@@ -152,22 +155,22 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
if (vers == QL1S("SSLv3"))
{
sslVersion = QL1S("SSL 3.0");
- imageLabel->setPixmap(KIcon("security-high").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-high").pixmap(c_dim));
}
else if (vers == QL1S("SSLv2"))
{
sslVersion = QL1S("SSL 2.0");
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-low").pixmap(c_dim));
}
else if (vers == QL1S("TLSv1"))
{
sslVersion = QL1S("TLS 1.0");
- imageLabel->setPixmap(KIcon("security-high").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-high").pixmap(c_dim));
}
else
{
sslVersion = i18n("Unknown");
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
+ imageLabel->setPixmap(KIcon("security-low").pixmap(c_dim));
}
label = new QLabel(this);
@@ -210,15 +213,14 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
HistoryItem() :
hList.first() ;
+ imageLabel->setPixmap(KIcon("dialog-information").pixmap(c_dim));
if (firstVisit.visitCount == 1)
{
label->setText(i18n("It is your first time visiting this site."));
- imageLabel->setPixmap(KIcon("security-medium").pixmap(32));
}
else
{
label->setText(i18n("You just visited this site.\nYour first visit was on %1.\n", firstVisit.firstDateTimeVisit.toString()));
- imageLabel->setPixmap(KIcon("security-high").pixmap(32));
}
layout->addWidget(label, rows++, 1);
@@ -229,7 +231,7 @@ void SSLWidget::showAt(const QPoint &pos)
{
adjustSize();
- QPoint p(pos.x() - width(), pos.y() + 10);
+ QPoint p(pos.x(), pos.y() + 10);
move(p);
show();
}
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 60f8f63d..46b7889b 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -152,8 +152,7 @@ UrlBar::UrlBar(QWidget *parent)
connect(_tab, SIGNAL(urlChanged(QUrl)), this, SLOT(setQUrl(QUrl)));
connect(_tab, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
- connect(_tab, SIGNAL(loadStarted()), this, SLOT(clearRightIcons()));
- connect(_tab, SIGNAL(iconChanged()), this, SLOT(refreshFavicon()));
+ connect(_tab, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
// bookmark icon
connect(BookmarkManager::self(), SIGNAL(bookmarksUpdated()), this, SLOT(updateRightIcons()));
@@ -184,7 +183,6 @@ void UrlBar::setQUrl(const QUrl& url)
clearFocus();
KLineEdit::setUrl(url);
setCursorPosition(0);
- refreshFavicon();
}
@@ -238,14 +236,6 @@ void UrlBar::paintEvent(QPaintEvent *event)
int progr = _tab->progress();
if (progr == 0 || progr == 100)
{
- if (_tab->url().scheme() == QL1S("https"))
- {
- backgroundColor = _tab->page()->hasSslValid()
- ? colorScheme.background(KColorScheme::PositiveBackground).color()
- : colorScheme.background(KColorScheme::NegativeBackground).color();
-
- foregroundColor = colorScheme.foreground(KColorScheme::NormalText).color();
- }
p.setBrush(QPalette::Base, backgroundColor);
p.setBrush(QPalette::Text, foregroundColor);
}
@@ -298,8 +288,12 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
QString currentText = text().trimmed();
if (currentText.isEmpty())
+ {
+ disconnect(_icon);
+ _icon->setIcon(KIcon("arrow-right"));
return KLineEdit::keyPressEvent(event);
-
+ }
+
// this handles the Modifiers + Return key combinations
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
{
@@ -367,14 +361,23 @@ void UrlBar::dropEvent(QDropEvent *event)
}
+void UrlBar::loadStarted()
+{
+ _icon->setIcon(KIcon("text-html"));
+ clearRightIcons();
+}
+
+
void UrlBar::loadFinished()
{
+ refreshFavicon();
+
if (_tab->url().scheme() == QL1S("about"))
{
update();
return;
}
-
+
// show bookmark info
IconButton *bt = addRightIcon(UrlBar::BK);
connect(bt, SIGNAL(clicked(QPoint)), this, SLOT(manageBookmarks()));
@@ -397,14 +400,6 @@ void UrlBar::loadFinished()
connect(bt, SIGNAL(clicked(QPoint)), this, SLOT(showRSSInfo(QPoint)));
}
- // show SSL
- if (_tab->url().scheme() == QL1S("https"))
- {
- // NOTE: the choice for the right SSL icon is done in the addRightIcon method
- IconButton *bt = addRightIcon(UrlBar::SSL);
- connect(bt, SIGNAL(clicked(QPoint)), _tab->page(), SLOT(showSSLInfo(QPoint)));
- }
-
// Show adblock
if (AdBlockManager::self()->isEnabled())
{
@@ -526,12 +521,6 @@ IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
rightIcon->setIcon(KIcon("application-rss+xml"));
rightIcon->setToolTip(i18n("List all available RSS feeds"));
break;
- case UrlBar::SSL:
- _tab->page()->hasSslValid()
- ? rightIcon->setIcon(KIcon("object-locked"))
- : rightIcon->setIcon(KIcon("object-unlocked"));
- rightIcon->setToolTip(i18n("Show SSL Info"));
- break;
case UrlBar::BK:
if (BookmarkManager::self()->bookmarkForUrl(_tab->url()).isNull())
{
@@ -627,6 +616,7 @@ void UrlBar::detectTypedString(const QString &typed)
{
if (typed.count() == 1)
{
+ _icon->setIcon(KIcon("arrow-right"));
QTimer::singleShot(0, this, SLOT(suggest()));
return;
}
@@ -648,20 +638,38 @@ void UrlBar::suggest()
void UrlBar::refreshFavicon()
{
+ disconnect(_icon);
+
+ const QString scheme = _tab->url().protocol();
+
if (_tab->page()->settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
_icon->setIcon(KIcon("view-media-artist"));
return;
}
+
+ if (scheme == QL1S("https"))
+ {
+ if (_tab->page()->hasSslValid())
+ {
+ _icon->setIcon(KIcon("security-high"));
+ }
+ else
+ {
+ _icon->setIcon(KIcon("security-low"));
+ }
+
+ connect(_icon, SIGNAL(clicked(QPoint)), _tab->page(), SLOT(showSSLInfo(QPoint)));
+ return;
+ }
- KUrl u = _tab->url();
- if (u.scheme() == QL1S("about"))
+ if (scheme == QL1S("about"))
{
_icon->setIcon(KIcon("arrow-right"));
return;
}
- _icon->setIcon(IconManager::self()->iconForUrl(u));
+ _icon->setIcon(KIcon("text-html"));
}
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index cce5cd46..08651705 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -80,7 +80,6 @@ public:
{
KGet = 0x00000001,
RSS = 0x00000010,
- SSL = 0x00000100,
BK = 0x00001000,
SearchEngine = 0x00010000,
Favorite = 0x00100000,
@@ -102,6 +101,7 @@ public Q_SLOTS:
private Q_SLOTS:
void loadRequestedUrl(const KUrl& url, Rekonq::OpenType = Rekonq::CurrentTab);
+ void loadStarted();
void loadFinished();
void clearRightIcons();