summaryrefslogtreecommitdiff
path: root/src/urlbar/completionwidget.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-08-29 00:03:54 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-08-29 00:03:54 +0200
commit584c8b2ba78071a805c0960841c636a331671ab3 (patch)
tree9d3db9b692799a39dd2772b662b378f1b5cac4e1 /src/urlbar/completionwidget.cpp
parentrekonq 0.5.82 (diff)
downloadrekonq-584c8b2ba78071a805c0960841c636a331671ab3.tar.xz
First fixes, 4 suggestions
Diffstat (limited to 'src/urlbar/completionwidget.cpp')
-rw-r--r--src/urlbar/completionwidget.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index c1f5d83b..bd907fa9 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -79,6 +79,8 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString
int i = 0;
foreach(const UrlSearchItem &item, _list)
{
+ kDebug() << "ITEM URL: " << item.url;
+ kDebug() << "ITEM TYPE: " << item.type;
ListItem *suggestion = ListItemFactory::create(item, text, this);
suggestion->setBackgroundRole(i % 2 ? QPalette::AlternateBase : QPalette::Base);
connect(suggestion,
@@ -95,28 +97,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)
return;
_isSuggesting = true;
+
+ kDebug() << "LIST COUNT: " << list.count();
+ UrlSearchList sugList = list.mid(0,4);
+ kDebug() << "SUGLIST COUNT: " << sugList.count();
- // 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;
- }
- }
+// // 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;
+// }
+// }
// add new suggestions to the list
int i = _list.count();
- Q_FOREACH(const UrlSearchItem &item, list)
+ Q_FOREACH(const UrlSearchItem &item, sugList)
{
ListItem *suggestion = ListItemFactory::create(item, text, this);
suggestion->setBackgroundRole(i % 2 ? QPalette::AlternateBase : QPalette::Base);
@@ -129,8 +132,8 @@ void CompletionWidget::updateSearchList(const UrlSearchList &list, const QString
suggestion->setObjectName(QString::number(i++));
layout()->addWidget(suggestion);
}
- _suggestionsNumber = list.count();
- _list.append(list);
+ _suggestionsNumber = sugList.count();
+ _list.append(sugList);
sizeAndPosition();
_isSuggesting = false;
}
@@ -218,6 +221,7 @@ void CompletionWidget::clear()
delete child;
}
_currentIndex = 0;
+// _suggestionsNumber = 0;
}