From 067b99a053b6f8b1ccab507be8e828b2f72a1e43 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 10 Feb 2010 10:57:57 +0100 Subject: Fix copyright for 0.4 beta release --- src/urlbar/lineedit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/urlbar/lineedit.cpp') diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp index f3c93e8e..db36bd0c 100644 --- a/src/urlbar/lineedit.cpp +++ b/src/urlbar/lineedit.cpp @@ -2,9 +2,9 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2009 by Andrea Diamantini +* Copyright (C) 2009-2010 by Andrea Diamantini * Copyright (C) 2009 by Paweł Prażak -* Copyright (C) 2009 by Lionel Chauvin +* Copyright (C) 2009-2010 by Lionel Chauvin * * * This program is free software; you can redistribute it and/or -- cgit v1.2.1 From 942c55b945443a2e6dd9a2d3660347fc2176630a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 29 Mar 2010 11:47:42 +0200 Subject: This commit merge all our work about new UrlBar. DISCLAIMER: this is far from perfect, but we finally have a good starting point to work on.. :) Jonas Gastal started working on it in the 0.3 times, startin from CompletionBase code .. .. I did some work on another idea, proposing (in code) a new "suggest engine" created from scratch... Lionel Chauvin finally merged our ideas and implemented what you are seeing (and improved it, too!).. - New suggestion items (Firefox style) - a mockup on the known urls (rekonq style) - for now, automatic Google and Wikipedia searches (more coming).. - a beautiful animation :) - quite all rough edges smoothed -------------------------------------------------------- Squashed commit of the following: commit d9cf43da421c7f6c71f78444ff1935c414468b98 commit 9dcb6e18f8a3e9ae8ef1cd1299d47d37393aa6e5 commit 6c4bf2b2040ea20c78c5703f20c6bc88b7e40169 commit 8488df67115d186489f34210b638c150c66f62d3 commit 066ab907661282b1ffa4cf640739c20b4c7b6556 commit c23e23cbca7ab3197c570651a95d3f8fea270d78 commit 60655b0a8685a76e2b8b7a457bfded974bc98b4c commit 9a8817db124b55f501c9e5d3415a975ee6f92d68 commit 61312b6b577a535a4d56758b3bd3ea38812d5139 commit b6a3f4ea12423a063eafa641cedd13b890b9d392 commit 5e8e2f851edb42bc2deed296c26c58c3d7570381 commit 2904d828f71ac8ff46a53e58da8f45b5aa16e7ef --------------------------------------------------------- --- src/urlbar/lineedit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/urlbar/lineedit.cpp') diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp index db36bd0c..f3c93e8e 100644 --- a/src/urlbar/lineedit.cpp +++ b/src/urlbar/lineedit.cpp @@ -2,9 +2,9 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2009-2010 by Andrea Diamantini +* Copyright (C) 2009 by Andrea Diamantini * Copyright (C) 2009 by Paweł Prażak -* Copyright (C) 2009-2010 by Lionel Chauvin +* Copyright (C) 2009 by Lionel Chauvin * * * This program is free software; you can redistribute it and/or -- cgit v1.2.1 From 80b37fa28d6c4e148ac0c69e91e07c1679866c54 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 30 Mar 2010 11:26:07 +0200 Subject: Cleaning urlbar API and improving animation WARNING: This is the best animation I could provide with the KComboBox class. In the KLineEdit derived it works perfectly. In the Combos there are some shadows on top :( Squashed commit of the following: commit 01e72a1996161028f8dbdc4e355daf00f954eace commit 8bc032d98a4987d3b01566ac520f5e8a1a095dd0 commit bc5cfd9f7d1b34f5af06dd7af6de8d3b2edb277b commit 73b4deac84d91fece407b9c700dcc61e36a34327 commit c55b753913b2619607c6aa11cabbf77ca3c84e3e commit b901fbe71b7539f65260c4fa9bbfb22f4ea997b9 commit 1de363d9614c1309ac1ac4a8eea7e70be7f2f3ed commit 76d6373f8b6c41f5c27b8404db2074f9bfc309c9 commit d741aa7109db016abc292d49fb45d15bb09e6c01 --- src/urlbar/lineedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/urlbar/lineedit.cpp') diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp index f3c93e8e..ac92b858 100644 --- a/src/urlbar/lineedit.cpp +++ b/src/urlbar/lineedit.cpp @@ -42,7 +42,7 @@ LineEdit::LineEdit(QWidget* parent) setMinimumWidth(200); setFocusPolicy(Qt::WheelFocus); setHandleSignals(true); - setClearButtonShown(true); + setClearButtonShown(false); } -- cgit v1.2.1 From 352168759ea96b35296eaf33790fbe073b69f69b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 5 Apr 2010 01:31:13 +0200 Subject: This commit is the first implementation of a new new new urlbar Here are its features: - KLineEdit based - ability to easily add "icons" :) - SSL informations shown (a-la firefox) - smoother animation - cleaner code - data QString, not KUrl based (Users type string, not urls!!!) --- src/urlbar/lineedit.cpp | 71 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 3 deletions(-) (limited to 'src/urlbar/lineedit.cpp') diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp index ac92b858..f7af1f61 100644 --- a/src/urlbar/lineedit.cpp +++ b/src/urlbar/lineedit.cpp @@ -30,24 +30,64 @@ #include "lineedit.h" #include "lineedit.moc" +// KDE Includes +#include +#include + // Qt Includes #include #include #include +#include +#include LineEdit::LineEdit(QWidget* parent) - : KLineEdit(parent) + : KLineEdit(parent) + , _icon( new IconButton(this) ) { + // cosmetic + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setMinimumWidth(200); - setFocusPolicy(Qt::WheelFocus); - setHandleSignals(true); + setMinimumHeight(26); + updateStyles(); + + // doesn't show the clear button setClearButtonShown(false); + + // trap Key_Enter & Key_Return events, while emitting the returnPressed signal + setTrapReturnKey(true); + + // insert decoded URLs + setUrlDropsEnabled(true); + + // accept focus, via tabbing, clicking & wheeling + setFocusPolicy(Qt::WheelFocus); + + // disable completion object (we have our own :) ) + setCompletionObject(0); } LineEdit::~LineEdit() { + delete _icon; +} + + +void LineEdit::updateStyles() +{ + adjustSize(); + _icon->adjustSize(); + if(_icon->toolButtonStyle() == Qt::ToolButtonIconOnly) + _icon->move( 4, 3); + else + _icon->move( 2, 1); + + int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); + setStyleSheet(QString("LineEdit { padding-left: %1px; } ").arg(_icon->sizeHint().width() + frameWidth + 1)); + + update(); } @@ -67,3 +107,28 @@ void LineEdit::mouseDoubleClickEvent(QMouseEvent *) { selectAll(); } + + +IconButton *LineEdit::iconButton() const +{ + return _icon; +} + + +void LineEdit::paintEvent(QPaintEvent *event) +{ + KLineEdit::paintEvent(event); + + if (text().isEmpty() && !hasFocus()) + { + QStyleOptionFrame option; + initStyleOption(&option); + QRect textRect = style()->subElementRect(QStyle::SE_LineEditContents, &option, this); + QPainter painter(this); + painter.setPen(Qt::gray); + painter.drawText( textRect, + Qt::AlignLeft | Qt::AlignVCenter, + i18n("Search Bookmarks, History, Google.. and the Kitchen Sink!") + ); + } +} -- cgit v1.2.1 From 43dc2695d62fd2e4fc01aff608bb2af3e8335040 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 8 Apr 2010 02:53:38 +0200 Subject: This is a really big commit, implementing the new urlbar - removed previous SSL animation, we have now a nice yellow lock :) - faster and cleaner animations - reenabled the old stacked widget, to avoid stupid refreshes and fix some regressions - implemented some "right icons": KGet, SSL, RSS. For now, just SSL is full featured - clean up the box :) Some old & unuseful files removed, some icons added - Pano's request: grey text shown everytime in the empty bar Again and again: this is not the first, but the second implementation of the new urlbar UI. About me this is clearly better than the first or the previous. But it needs love :D BUG: 230125 BUG: 231015 CCBUG: 228040 BUG: 227272 --- src/urlbar/lineedit.cpp | 97 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 22 deletions(-) (limited to 'src/urlbar/lineedit.cpp') diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp index f7af1f61..8e689a46 100644 --- a/src/urlbar/lineedit.cpp +++ b/src/urlbar/lineedit.cpp @@ -33,6 +33,8 @@ // KDE Includes #include #include +#include +#include // Qt Includes #include @@ -42,6 +44,18 @@ #include +IconButton::IconButton(QWidget *parent) + : QToolButton(parent) +{ + setToolButtonStyle(Qt::ToolButtonIconOnly); + setStyleSheet("IconButton { background-color:transparent; border: none; padding: 0px}"); + setCursor(Qt::ArrowCursor); +} + + +// ----------------------------------------------------------------------------------------------------------- + + LineEdit::LineEdit(QWidget* parent) : KLineEdit(parent) , _icon( new IconButton(this) ) @@ -49,8 +63,11 @@ LineEdit::LineEdit(QWidget* parent) // cosmetic setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setMinimumWidth(200); - setMinimumHeight(26); - updateStyles(); + setMinimumHeight(20); + + // initial style + _icon->move(4,6); + setStyleSheet( QString("LineEdit { padding: 0 0 0 %1px;} ").arg(_icon->sizeHint().width()) ); // doesn't show the clear button setClearButtonShown(false); @@ -75,22 +92,6 @@ LineEdit::~LineEdit() } -void LineEdit::updateStyles() -{ - adjustSize(); - _icon->adjustSize(); - if(_icon->toolButtonStyle() == Qt::ToolButtonIconOnly) - _icon->move( 4, 3); - else - _icon->move( 2, 1); - - int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - setStyleSheet(QString("LineEdit { padding-left: %1px; } ").arg(_icon->sizeHint().width() + frameWidth + 1)); - - update(); -} - - void LineEdit::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape) @@ -117,18 +118,70 @@ IconButton *LineEdit::iconButton() const void LineEdit::paintEvent(QPaintEvent *event) { + // you need this before our code to draw inside the line edit.. KLineEdit::paintEvent(event); - if (text().isEmpty() && !hasFocus()) - { + if (text().isEmpty()) + { QStyleOptionFrame option; initStyleOption(&option); QRect textRect = style()->subElementRect(QStyle::SE_LineEditContents, &option, this); QPainter painter(this); painter.setPen(Qt::gray); painter.drawText( textRect, - Qt::AlignLeft | Qt::AlignVCenter, - i18n("Search Bookmarks, History, Google.. and the Kitchen Sink!") + Qt::AlignCenter, + i18n("Search Bookmarks, History, Google.. just start typing here!") ); } } + + +IconButton *LineEdit::addRightIcon(LineEdit::icon ic) +{ + IconButton *rightIcon = new IconButton(this); + + switch(ic) + { + case LineEdit::KGet: + rightIcon->setIcon( QIcon(KStandardDirs::locate("data", "rekonq/pics/kget-icon.png")) ); + break; + case LineEdit::RSS: + rightIcon->setIcon( QIcon(KStandardDirs::locate("data", "rekonq/pics/rss-icon.png")) ); + break; + case LineEdit::SSL: + rightIcon->setIcon( QIcon(KStandardDirs::locate("data", "rekonq/pics/ssl-icon.png")) ); + break; + default: + kDebug() << "ERROR.. default non extant case!!"; + break; + } + + _rightIconsList << rightIcon; + int iconsCount = _rightIconsList.count(); + rightIcon->move( width() - 23*iconsCount, 6); + rightIcon->show(); + + return rightIcon; +} + + +void LineEdit::clearRightIcons() +{ + qDeleteAll(_rightIconsList); + _rightIconsList.clear(); +} + + +void LineEdit::resizeEvent(QResizeEvent *event) +{ + KLineEdit::resizeEvent(event); + + int iconsCount = _rightIconsList.count(); + int w = width(); + + for(int i = 0; i < iconsCount; ++i) + { + IconButton *bt = _rightIconsList.at(i); + bt->move( w - 23*(i+1), 6); + } +} -- cgit v1.2.1 From 49faf17ac19b0ff351f7c7812e8d1f85d7cf82fc Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 9 Apr 2010 01:09:17 +0200 Subject: Using oxygen icons, removing the other ones and adding some tooltips there :) --- src/urlbar/lineedit.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/urlbar/lineedit.cpp') diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp index 8e689a46..059a0178 100644 --- a/src/urlbar/lineedit.cpp +++ b/src/urlbar/lineedit.cpp @@ -143,13 +143,16 @@ IconButton *LineEdit::addRightIcon(LineEdit::icon ic) switch(ic) { case LineEdit::KGet: - rightIcon->setIcon( QIcon(KStandardDirs::locate("data", "rekonq/pics/kget-icon.png")) ); + rightIcon->setIcon( KIcon("download") ); + rightIcon->setToolTip( i18n("List all links with KGet") ); break; case LineEdit::RSS: - rightIcon->setIcon( QIcon(KStandardDirs::locate("data", "rekonq/pics/rss-icon.png")) ); + rightIcon->setIcon( KIcon("application-rss+xml") ); + rightIcon->setToolTip( i18n("List all available RSS feeds") ); break; case LineEdit::SSL: - rightIcon->setIcon( QIcon(KStandardDirs::locate("data", "rekonq/pics/ssl-icon.png")) ); + rightIcon->setIcon( KIcon("object-locked") ); + rightIcon->setToolTip( i18n("Show SSL Infos") ); break; default: kDebug() << "ERROR.. default non extant case!!"; -- cgit v1.2.1 From 7fedb0bcaf32ca5cb1de9e4815de08df7098426b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 9 Apr 2010 02:06:33 +0200 Subject: Fixing icons position and saving a couple of moveEvents --- src/urlbar/lineedit.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/urlbar/lineedit.cpp') diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp index 059a0178..09c158fa 100644 --- a/src/urlbar/lineedit.cpp +++ b/src/urlbar/lineedit.cpp @@ -63,10 +63,9 @@ LineEdit::LineEdit(QWidget* parent) // cosmetic setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setMinimumWidth(200); - setMinimumHeight(20); + setMinimumHeight(26); // initial style - _icon->move(4,6); setStyleSheet( QString("LineEdit { padding: 0 0 0 %1px;} ").arg(_icon->sizeHint().width()) ); // doesn't show the clear button @@ -177,7 +176,8 @@ void LineEdit::clearRightIcons() void LineEdit::resizeEvent(QResizeEvent *event) { - KLineEdit::resizeEvent(event); + int newHeight = ( height() - 19 )/2; + _icon->move(4, newHeight ); int iconsCount = _rightIconsList.count(); int w = width(); @@ -185,6 +185,9 @@ void LineEdit::resizeEvent(QResizeEvent *event) for(int i = 0; i < iconsCount; ++i) { IconButton *bt = _rightIconsList.at(i); - bt->move( w - 23*(i+1), 6); + bt->move( w - 25*(i+1), newHeight ); } + + KLineEdit::resizeEvent(event); + } -- cgit v1.2.1 From 1f8a013b182660c6f12c75f740cd5beac70f0949 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 19 Apr 2010 16:21:33 +0200 Subject: Fix urlbar string as suggested by Johannes Zellner --- src/urlbar/lineedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/urlbar/lineedit.cpp') diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp index 09c158fa..6236512f 100644 --- a/src/urlbar/lineedit.cpp +++ b/src/urlbar/lineedit.cpp @@ -129,7 +129,7 @@ void LineEdit::paintEvent(QPaintEvent *event) painter.setPen(Qt::gray); painter.drawText( textRect, Qt::AlignCenter, - i18n("Search Bookmarks, History, Google.. just start typing here!") + i18n("Search Bookmarks, History, Web.. just start typing here!") ); } } -- cgit v1.2.1