summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/urlbar/completionwidget.cpp37
-rw-r--r--src/urlbar/completionwidget.h3
-rw-r--r--src/urlbar/urlbar.cpp7
-rw-r--r--src/urlbar/urlresolver.cpp8
4 files changed, 16 insertions, 39 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index c1f5d83b..12d34ad8 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -56,8 +56,7 @@ CompletionWidget::CompletionWidget(QWidget *parent)
, _parent(parent)
, _currentIndex(0)
, _searchEngine(SearchEngine::defaultEngine())
- , _suggestionsNumber(0)
- , _isSuggesting(false)
+ , _hasSuggestions(false)
{
setFrameStyle(QFrame::Panel);
setLayoutDirection(Qt::LeftToRight);
@@ -95,44 +94,29 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString
void CompletionWidget::updateSearchList(const UrlSearchList &list, const QString& text)
{
- kDebug() << "TYPED STRING: " << _typedString;
- kDebug() << "text from suggestion: " << text;
-
- if(_isSuggesting || !isVisible() || _typedString != text)
+ if(_hasSuggestions || _typedString != text || !isVisible())
return;
+ _hasSuggestions = true;
- _isSuggesting = true;
-
- // clean up eventual old suggestions
- if(_suggestionsNumber > 0)
- {
- int offset = _list.count();
- for(int i = offset; i < offset + _suggestionsNumber; ++i)
- {
- QLayoutItem *item = layout()->takeAt( i );
- delete item;
- }
- }
+ UrlSearchList sugList = list.mid(0,4);
// add new suggestions to the list
- int i = _list.count();
- Q_FOREACH(const UrlSearchItem &item, list)
+ int offset = _list.count();
+ Q_FOREACH(const UrlSearchItem &item, sugList)
{
ListItem *suggestion = ListItemFactory::create(item, text, this);
- suggestion->setBackgroundRole(i % 2 ? QPalette::AlternateBase : QPalette::Base);
+ suggestion->setBackgroundRole(offset % 2 ? QPalette::AlternateBase : QPalette::Base);
connect(suggestion,
SIGNAL(itemClicked(ListItem *, Qt::MouseButton, Qt::KeyboardModifiers)),
this,
SLOT(itemChosen(ListItem *, Qt::MouseButton, Qt::KeyboardModifiers)));
connect(this, SIGNAL(nextItemSubChoice()), suggestion, SLOT(nextItemSubChoice()));
- suggestion->setObjectName(QString::number(i++));
+ suggestion->setObjectName(QString::number(offset++));
layout()->addWidget(suggestion);
}
- _suggestionsNumber = list.count();
- _list.append(list);
+ _list.append(sugList);
sizeAndPosition();
- _isSuggesting = false;
}
@@ -192,8 +176,6 @@ void CompletionWidget::down()
void CompletionWidget::activateCurrentListItem()
{
- kDebug() << _currentIndex;
- kDebug() << _typedString;
UrlBar *bar = qobject_cast<UrlBar *>(_parent);
// activate "new" current
@@ -218,6 +200,7 @@ void CompletionWidget::clear()
delete child;
}
_currentIndex = 0;
+ _hasSuggestions = false;
}
diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h
index 29f80721..d9f9be49 100644
--- a/src/urlbar/completionwidget.h
+++ b/src/urlbar/completionwidget.h
@@ -91,8 +91,7 @@ private:
KService::Ptr _searchEngine;
QString _typedString;
- int _suggestionsNumber;
- bool _isSuggesting;
+ bool _hasSuggestions;
};
#endif // COMPLETION_WIDGET_H
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 0b966b74..f1729d53 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -500,12 +500,5 @@ void UrlBar::suggest()
void UrlBar::refreshFavicon()
{
- kDebug() << "------------------ REFRESH ME!!! -------------";
-// if( u.scheme() == QL1S("about") )
-// {
-// kDebug() << "ABOUT SCHEME...";
-// return;
-// }
-
_icon->setIcon(Application::iconManager()->iconForUrl(_tab->view()->url()));
}
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index 300f33ef..787546cd 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -45,7 +45,7 @@
#include <QByteArray>
// defines
-#define MAX_ELEMENTS 10
+#define MAX_ELEMENTS 8
#define MIN_SUGGESTIONS 3
// NOTE
@@ -133,10 +133,10 @@ UrlSearchList UrlResolver::orderedSearchItems()
//compute lists
computeSuggestions();
+ computeHistory();
computeQurlFromUserInput();
computeWebSearches();
computeBookmarks();
- computeHistory();
return orderLists();
}
@@ -263,6 +263,8 @@ UrlSearchList UrlResolver::orderLists()
historyCount = _history.count();
bookmarksCount = _bookmarks.count();
commonCount = common.count();
+
+ kDebug() << "HISTORY COUNT: " << historyCount;
//now fill the list to MAX_ELEMENTS
if(availableEntries > 0)
@@ -352,7 +354,7 @@ void UrlResolver::computeHistory()
void UrlResolver::computeBookmarks()
{
QList<KBookmark> found = Application::bookmarkProvider()->find(_typedString);
-
+ kDebug() << "FOUND: " << found.count();
Q_FOREACH(const KBookmark &b, found)
{
UrlSearchItem gItem(UrlSearchItem::Bookmark, b.url().url(), b.fullText());