summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/listitem.cpp51
-rw-r--r--src/urlbar/urlbar.cpp18
-rw-r--r--src/urlbar/urlbar.h2
3 files changed, 38 insertions, 33 deletions
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index df9ef286..8406c792 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -465,7 +465,7 @@ SuggestionListItem::SuggestionListItem(const UrlSearchItem &item, const QString
hLayout->setSpacing(4);
hLayout->addWidget(new IconLabel(item.url, this));
- hLayout->addWidget(new TextLabel(item.title, SearchEngine::extractQuery(text), this));
+ hLayout->addWidget(new TextLabel(item.title, text, this));
hLayout->addWidget(new TypeIconLabel(item.type, this));
setLayout(hLayout);
@@ -502,32 +502,39 @@ BrowseListItem::BrowseListItem(const UrlSearchItem &item, const QString &text, Q
ListItem *ListItemFactory::create(const UrlSearchItem &item, const QString &text, QWidget *parent)
-{
- ListItem *newItem;
+{
+ if (item.type & UrlSearchItem::Search)
+ {
+ kDebug() << "Search";
+ return new SearchListItem(item, text, parent);
+ }
+
if (item.type & UrlSearchItem::Browse)
{
- newItem = new BrowseListItem(item, text, parent);
+ kDebug() << "Browse";
+ return new BrowseListItem(item, text, parent);
}
- else
+
+ if (item.type & UrlSearchItem::History)
{
- if (item.type & UrlSearchItem::Search)
- {
- newItem = new SearchListItem(item, text, parent);
- }
- else
- {
-
- if (item.type & UrlSearchItem::Suggestion)
- {
- newItem = new SuggestionListItem(item, text, parent);
- }
- else
- {
- newItem = new PreviewListItem(item, text, parent);
- }
- }
+ kDebug() << "History";
+ return new PreviewListItem(item, text, parent);
+ }
+
+ if (item.type & UrlSearchItem::Bookmark)
+ {
+ kDebug() << "Bookmark";
+ return new PreviewListItem(item, text, parent);
+ }
+
+ if (item.type & UrlSearchItem::Suggestion)
+ {
+ kDebug() << "Suggestion";
+ return new SuggestionListItem(item, text, parent);
}
- return newItem;
+ kDebug() << "Undefined";
+ return new PreviewListItem(item, text, parent);
+
}
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 3ec0b2fa..1f4a0367 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -79,7 +79,6 @@ void IconButton::mouseReleaseEvent(QMouseEvent* event)
UrlBar::UrlBar(QWidget *parent)
: KLineEdit(parent)
, _tab(0)
- , _privateMode(false)
, _icon(new IconButton(this))
, _suggestionTimer(new QTimer(this))
{
@@ -159,7 +158,7 @@ void UrlBar::paintEvent(QPaintEvent *event)
QColor backgroundColor;
QColor foregroundColor;
- if (_privateMode)
+ if (QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
backgroundColor = QColor(220, 220, 220); // light gray
foregroundColor = Qt::black;
@@ -289,12 +288,6 @@ void UrlBar::focusInEvent(QFocusEvent *event)
}
-void UrlBar::setPrivateMode(bool on)
-{
- _privateMode = on;
-}
-
-
void UrlBar::dropEvent(QDropEvent *event)
{
KLineEdit::dropEvent(event);
@@ -505,8 +498,15 @@ void UrlBar::suggest()
void UrlBar::refreshFavicon()
{
+ if(QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
+ {
+ _icon->setIcon(KIcon("view-media-artist"));
+ return;
+ }
+
KUrl u = _tab->url();
- if(u.scheme() == QL1S("about")) {
+ if(u.scheme() == QL1S("about"))
+ {
_icon->setIcon(KIcon("arrow-right"));
return;
}
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index dcd0ba5b..4cdd9d9c 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -89,7 +89,6 @@ public:
explicit UrlBar(QWidget *parent = 0);
~UrlBar();
- void setPrivateMode(bool on);
void activateSuggestions(bool);
public slots:
@@ -124,7 +123,6 @@ private:
QWeakPointer<CompletionWidget> _box;
WebTab *_tab;
- bool _privateMode;
IconButton *_icon;
IconButtonPointerList _rightIconsList;