summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2008-12-10 00:48:57 +0100
committerAndrea Diamantini <adjam7@gmail.com>2008-12-10 00:48:57 +0100
commit332491c515a72ed173592a73562e7567e71e782f (patch)
tree3d02c97c6b79cab835048702b082d07d366480e8
parentnothing important (diff)
parentAdded Completion to new urlbar. ready for merge.. (diff)
downloadrekonq-332491c515a72ed173592a73562e7567e71e782f.tar.xz
merging newurlbar branch
Merge branch 'newurlbar'
-rw-r--r--src/tabwidget.cpp10
-rw-r--r--src/tabwidget.h8
-rw-r--r--src/urlbar.cpp46
-rw-r--r--src/urlbar.h17
4 files changed, 40 insertions, 41 deletions
diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp
index 72574596..58ea75c0 100644
--- a/src/tabwidget.cpp
+++ b/src/tabwidget.cpp
@@ -286,7 +286,7 @@ void TabWidget::clear()
// clear the line edit history
for (int i = 0; i < m_lineEdits->count(); ++i)
{
- KLineEdit *qLineEdit = lineEdit(i);
+ QLineEdit *qLineEdit = lineEdit(i);
qLineEdit->setText(qLineEdit->text());
}
}
@@ -409,7 +409,7 @@ QWidget *TabWidget::lineEditStack() const
}
-KLineEdit *TabWidget::currentLineEdit() const
+QLineEdit *TabWidget::currentLineEdit() const
{
return lineEdit(m_lineEdits->currentIndex());
}
@@ -421,7 +421,7 @@ WebView *TabWidget::currentWebView() const
}
-KLineEdit *TabWidget::lineEdit(int index) const
+QLineEdit *TabWidget::lineEdit(int index) const
{
UrlBar *urlLineEdit = qobject_cast<UrlBar*>(m_lineEdits->widget(index));
if (urlLineEdit)
@@ -465,7 +465,7 @@ WebView *TabWidget::newTab(bool makeCurrent)
{
// line edit
UrlBar *urlLineEdit = new UrlBar;
- KLineEdit *lineEdit = urlLineEdit->lineEdit();
+ QLineEdit *lineEdit = urlLineEdit->lineEdit();
if (!m_lineEditCompleter && count() > 0)
{
HistoryCompletionModel *completionModel = new HistoryCompletionModel(this);
@@ -544,7 +544,7 @@ void TabWidget::reloadAllTabs()
void TabWidget::lineEditReturnPressed()
{
- if (KLineEdit *lineEdit = qobject_cast<KLineEdit*>(sender()))
+ if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()))
{
emit loadPage(lineEdit->text());
if (m_lineEdits->currentWidget() == lineEdit)
diff --git a/src/tabwidget.h b/src/tabwidget.h
index 020376e1..27cc4611 100644
--- a/src/tabwidget.h
+++ b/src/tabwidget.h
@@ -110,10 +110,12 @@ private:
// KDE Includes
#include <KUrl>
-#include <KLineEdit>
#include <KMenu>
#include <KTabWidget>
+// Qt Includes
+#include <QLineEdit>
+
QT_BEGIN_NAMESPACE
class QCompleter;
class QMenu;
@@ -160,10 +162,10 @@ public:
KAction *previousTabAction() const;
QWidget *lineEditStack() const;
- KLineEdit *currentLineEdit() const;
+ QLineEdit *currentLineEdit() const;
WebView *currentWebView() const;
WebView *webView(int index) const;
- KLineEdit *lineEdit(int index) const;
+ QLineEdit *lineEdit(int index) const;
int webViewIndex(WebView *webView) const;
QByteArray saveState() const;
diff --git a/src/urlbar.cpp b/src/urlbar.cpp
index 098ba027..9be6bca0 100644
--- a/src/urlbar.cpp
+++ b/src/urlbar.cpp
@@ -23,31 +23,19 @@
#include "browserapplication.h"
-// Qt Includes
-#include <QtGui>
-
-UrlBar::UrlBar(QWidget *parent)
- : QWidget(parent)
+UrlBar::UrlBar(KHistoryComboBox *parent)
+ : KHistoryComboBox(true, 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 );
+
+ // 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();
}
@@ -57,7 +45,7 @@ UrlBar::~UrlBar()
}
-KLineEdit *UrlBar::lineEdit()
+QLineEdit *UrlBar::lineEdit()
{
return m_lineEdit;
}
@@ -67,7 +55,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 +74,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 );
}
@@ -101,3 +92,10 @@ QLinearGradient UrlBar::generateGradient(const QColor &color) const
gradient.setColorAt(1, m_defaultBaseColor);
return gradient;
}
+
+
+void UrlBar::prova()
+{
+ m_lineEdit->selectAll();
+}
+
diff --git a/src/urlbar.h b/src/urlbar.h
index 5d766a92..d0f80f17 100644
--- a/src/urlbar.h
+++ b/src/urlbar.h
@@ -24,36 +24,35 @@
#include "webview.h"
// KDE Includes
-#include <KLineEdit>
-#include <KComboBox>
+#include <KHistoryComboBox>
// Qt Includes
-#include <QWidget>
-#include <QLabel>
+#include <QtGui>
-class UrlBar : public QWidget
+class UrlBar : public KHistoryComboBox
{
Q_OBJECT
public:
- UrlBar(QWidget *parent = 0);
+ UrlBar(KHistoryComboBox *parent = 0);
~UrlBar();
- KLineEdit *lineEdit();
+ QLineEdit *lineEdit();
void setWebView(WebView *webView);
private slots:
void webViewUrlChanged(const QUrl &url);
void webViewIconChanged();
+ void prova();
+
private:
QLinearGradient generateGradient(const QColor &color) const;
WebView *m_webView;
- QLabel *m_iconLabel;
- KLineEdit *m_lineEdit;
+ QLineEdit *m_lineEdit;
QColor m_defaultBaseColor;
};