summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/urlbar/completionwidget.cpp17
-rw-r--r--src/urlbar/completionwidget.h18
-rw-r--r--src/urlbar/lineedit.h3
-rw-r--r--src/urlbar/listitem.cpp19
-rw-r--r--src/urlbar/listitem.h3
-rw-r--r--src/urlbar/urlresolver.h2
6 files changed, 29 insertions, 33 deletions
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
index 3a54f890..27fcfbad 100644
--- a/src/urlbar/completionwidget.cpp
+++ b/src/urlbar/completionwidget.cpp
@@ -28,6 +28,9 @@
#include "completionwidget.h"
#include "completionwidget.moc"
+// Local Includes
+#include "application.h"
+
// KDE Includes
#include <KGlobalSettings>
#include <KDebug>
@@ -41,16 +44,17 @@
#include <QEvent>
#include <QKeyEvent>
+// Defines
#define MAX_ELEMENTS 9
-#include "application.h"
+
CompletionWidget::CompletionWidget( QWidget *parent)
-:QFrame( parent, Qt::ToolTip)
+ :QFrame( parent, Qt::ToolTip)
, _parent(parent)
, _currentIndex(-1)
{
QPalette p(palette());
- p.setColor(QPalette::Background, Qt::white); //todo: choose the correct color
+ p.setColor(QPalette::Background, Qt::white); // TODO: choose the correct color
setPalette(p);
setFrameStyle(QFrame::Panel);
setLayoutDirection(Qt::LeftToRight);
@@ -126,10 +130,6 @@ void CompletionWidget::up()
widget->activate();
}
-KUrl CompletionWidget::currentUrl()
-{
- return _list.at(_currentIndex).url;
-}
void CompletionWidget::down()
{
@@ -150,6 +150,7 @@ void CompletionWidget::down()
widget->activate();
}
+
void CompletionWidget::clear()
{
QLayoutItem *child;
@@ -216,7 +217,7 @@ bool CompletionWidget::eventFilter( QObject *o, QEvent *e )
case Qt::Key_Enter:
case Qt::Key_Return:
hide();
- emit chosenUrl(currentUrl().url(), Rekonq::CurrentTab);
+ emit chosenUrl(_list.at(_currentIndex).url, Rekonq::CurrentTab);
ev->accept();
return true;
break;
diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h
index 64d33189..a714bb17 100644
--- a/src/urlbar/completionwidget.h
+++ b/src/urlbar/completionwidget.h
@@ -33,32 +33,26 @@
#include "urlresolver.h"
#include "listitem.h"
-// Qt Includes
-#include <QFrame>
-
// KDE Includes
#include <KLineEdit>
-// Forward Declarations
-class KUrl;
+// Qt Includes
+#include <QFrame>
class CompletionWidget : public QFrame
{
-Q_OBJECT
+ Q_OBJECT
public:
CompletionWidget(QWidget *parent);
void insertSearchList(const UrlSearchList &list);
void popup();
-
- void up();
- void down();
void clear();
+
virtual bool eventFilter(QObject *obj, QEvent *ev);
void setVisible(bool visible);
- KUrl currentUrl();
private slots:
void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton);
@@ -68,7 +62,9 @@ signals:
private:
void sizeAndPosition();
-
+ void up();
+ void down();
+
QWidget *_parent;
UrlSearchList _list;
diff --git a/src/urlbar/lineedit.h b/src/urlbar/lineedit.h
index d76a5fcb..67ded052 100644
--- a/src/urlbar/lineedit.h
+++ b/src/urlbar/lineedit.h
@@ -47,12 +47,9 @@ public:
explicit LineEdit(QWidget *parent = 0);
virtual ~LineEdit();
-
protected:
virtual void keyPressEvent(QKeyEvent*);
virtual void mouseDoubleClickEvent(QMouseEvent *);
-
-
};
#endif // LINEEDIT_H
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
index d9837c7e..ee63a156 100644
--- a/src/urlbar/listitem.cpp
+++ b/src/urlbar/listitem.cpp
@@ -46,9 +46,10 @@
#include <QFile>
#include <QMouseEvent>
+
ListItem::ListItem(const UrlSearchItem &item, QWidget *parent)
- : QWidget(parent),
- m_option()
+ : QWidget(parent)
+ , m_option()
{
QHBoxLayout *hLayout = new QHBoxLayout;
QVBoxLayout *vLayout = new QVBoxLayout;
@@ -101,6 +102,7 @@ ListItem::ListItem(const UrlSearchItem &item, QWidget *parent)
deactivate();
}
+
ListItem::~ListItem()
{
disconnect();
@@ -130,16 +132,17 @@ QString ListItem::guessNameFromUrl(QUrl url)
void ListItem::activate()
{
m_option.state |= QStyle::State_Selected;
- repaint();
+ update();
}
void ListItem::deactivate()
{
m_option.state &= ~QStyle::State_Selected;
- repaint();
+ update();
}
+
void ListItem::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
@@ -152,23 +155,25 @@ void ListItem::paintEvent(QPaintEvent *event)
}
}
+
void ListItem::enterEvent(QEvent *e)
{
m_option.state |= QStyle::State_MouseOver;
- repaint();
+ update();
QWidget::enterEvent(e);
}
+
void ListItem::leaveEvent(QEvent *e)
{
m_option.state &= ~QStyle::State_MouseOver;
- repaint();
+ update();
QWidget::enterEvent(e);
}
+
void ListItem::mousePressEvent(QMouseEvent *e)
{
emit itemClicked(this, e->button());
QWidget::mousePressEvent(e);
}
-
diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h
index ac476d4b..1e7b0805 100644
--- a/src/urlbar/listitem.h
+++ b/src/urlbar/listitem.h
@@ -34,7 +34,7 @@ class UrlSearchItem;
class ListItem : public QWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
ListItem(const UrlSearchItem &item, QWidget *parent = 0);
@@ -55,5 +55,4 @@ protected:
private:
QStyleOptionViewItemV4 m_option;
QString guessNameFromUrl(QUrl url);
-
};
diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h
index 4231aaab..3033fc38 100644
--- a/src/urlbar/urlresolver.h
+++ b/src/urlbar/urlresolver.h
@@ -32,8 +32,6 @@
#include <QString>
#include <QList>
-// Forward Declarations
-class KUrl;
class UrlSearchItem
{