diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-09-03 22:53:13 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-09-03 22:53:13 +0200 |
commit | f998ce11746f17694db006e915565bcdec5f81b9 (patch) | |
tree | 7a4b9d615f919d55fee30bc394aba7d16ad74b52 /src/urlbar.cpp | |
parent | Fix compilation and improved a (little) bit (diff) | |
download | rekonq-f998ce11746f17694db006e915565bcdec5f81b9.tar.xz |
Removed completion object from UrlBar
Inserted (and improved) in HistoryManager to let it available to
every class.
Diffstat (limited to 'src/urlbar.cpp')
-rw-r--r-- | src/urlbar.cpp | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/src/urlbar.cpp b/src/urlbar.cpp index 24df96f7..54aa0ecf 100644 --- a/src/urlbar.cpp +++ b/src/urlbar.cpp @@ -56,8 +56,6 @@ UrlBar::UrlBar(QWidget *parent) : KHistoryComboBox(true, parent) , m_lineEdit(new LineEdit) , m_progress(0) - , m_completion(0) - , m_completionModel(0) { setUrlDropsEnabled(true); setAutoDeleteCompletionObject(true); @@ -77,16 +75,12 @@ UrlBar::UrlBar(QWidget *parent) connect(this, SIGNAL(cleared()), SLOT(slotCleared())); // setup completion box - completionBox()->setTabHandling(true); // Konqueror bug #167135 - setCompletionObject(completion()); + setCompletionObject( Application::historyManager()->completionObject() ); // set dropdown list background QPalette p = view()->palette(); p.setColor(QPalette::Base, palette().color(QPalette::Base)); view()->setPalette(p); -/* - // set empty item with default icon - slotUpdateUrl();*/ } @@ -290,45 +284,3 @@ bool UrlBar::isLoading() } return true; } - - -KCompletion *UrlBar::completion() -{ - // make sure completion was created - if (!m_completion) - { - m_completion = new KCompletion(); - m_completion->setCompletionMode(KGlobalSettings::CompletionPopupAuto); - m_completion->setOrder(KCompletion::Weighted); - m_completion->setIgnoreCase(true); - - kDebug() << "Initialize completion list..."; - HistoryCompletionModel *model = completionModel(); - int count = model->rowCount(); - kDebug() << "...initialize history items" << count; - - // change order to insertion to avoid confusion of the addItem method - // in weighted it expects format string:number and it thinks http it the whole string - m_completion->setOrder(KCompletion::Insertion); - for (int i = 0; i < count; ++i) - { - QString item = model->data(model->index(i, 0)).toString(); - item.remove(QRegExp("^http://|/$")); - m_completion->addItem(item); - } - - m_completion->setOrder(KCompletion::Weighted); - } - return m_completion; -} - - -HistoryCompletionModel *UrlBar::completionModel() -{ - if (!m_completionModel) - { - m_completionModel = new HistoryCompletionModel(this); - m_completionModel->setSourceModel(Application::historyManager()->historyFilterModel()); - } - return m_completionModel; -} |