From 22f4427d614344550ca6949695aa3456d3789165 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 9 Dec 2008 01:28:57 +0100 Subject: made the urlbar a KHistoryComboBox. Really beautiful widget!! --- src/urlbar.cpp | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) (limited to 'src/urlbar.cpp') diff --git a/src/urlbar.cpp b/src/urlbar.cpp index 098ba027..e45c0bb0 100644 --- a/src/urlbar.cpp +++ b/src/urlbar.cpp @@ -23,30 +23,14 @@ #include "browserapplication.h" -// Qt Includes -#include - -UrlBar::UrlBar(QWidget *parent) - : QWidget(parent) +UrlBar::UrlBar(KHistoryComboBox *parent) + : KHistoryComboBox(parent) , m_webView(0) - , m_iconLabel(0) , m_lineEdit(0) { - // icon - m_iconLabel = new QLabel; - m_iconLabel->resize(16, 16); - - m_lineEdit = new KLineEdit; - - QHBoxLayout *layout = new QHBoxLayout; - layout->addWidget(m_iconLabel); - layout->addWidget(m_lineEdit); - setLayout(layout); - - m_defaultBaseColor = palette().color(QPalette::Base); -// setPalette( QPalette(Qt::white) ); - setAutoFillBackground( false ); + m_lineEdit = new QLineEdit; + setLineEdit( m_lineEdit ); webViewIconChanged(); } @@ -57,7 +41,7 @@ UrlBar::~UrlBar() } -KLineEdit *UrlBar::lineEdit() +QLineEdit *UrlBar::lineEdit() { return m_lineEdit; } @@ -67,7 +51,6 @@ void UrlBar::setWebView(WebView *webView) { Q_ASSERT(!m_webView); m_webView = webView; -// m_iconLabel->m_webView = webView; connect(webView, SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewIconChanged())); connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); @@ -87,7 +70,11 @@ void UrlBar::webViewIconChanged() KUrl url = (m_webView) ? m_webView->url() : KUrl(); QIcon icon = BrowserApplication::instance()->icon(url); QPixmap pixmap(icon.pixmap(16, 16)); - m_iconLabel->setPixmap(pixmap); + QIcon urlIcon = QIcon(pixmap); + + // FIXME simple hack to show Icon in the urlbar, as calling changeUrl() doesn't affect it + removeItem( 0 ); + insertUrl( 0 , urlIcon , url ); } -- cgit v1.2.1 From d1edeb480f8539d2a132c5ab9f4e4b2a99d8d2a0 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 10 Dec 2008 00:48:03 +0100 Subject: Added Completion to new urlbar. ready for merge.. --- src/urlbar.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/urlbar.cpp') diff --git a/src/urlbar.cpp b/src/urlbar.cpp index e45c0bb0..9be6bca0 100644 --- a/src/urlbar.cpp +++ b/src/urlbar.cpp @@ -25,13 +25,17 @@ UrlBar::UrlBar(KHistoryComboBox *parent) - : KHistoryComboBox(parent) + : KHistoryComboBox(true, parent) , m_webView(0) , m_lineEdit(0) { m_lineEdit = new QLineEdit; setLineEdit( m_lineEdit ); - + + // add every item to history + connect( this, SIGNAL( activated( const QString& )), this, SLOT( addToHistory( const QString& ))); + + connect( this, SIGNAL( activated(int) ), this, SLOT( prova() ) ); webViewIconChanged(); } @@ -88,3 +92,10 @@ QLinearGradient UrlBar::generateGradient(const QColor &color) const gradient.setColorAt(1, m_defaultBaseColor); return gradient; } + + +void UrlBar::prova() +{ + m_lineEdit->selectAll(); +} + -- cgit v1.2.1