1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

LocationBar: Don't paint cursor when showing most visited in popup.

This commit is contained in:
nowrep 2013-02-11 13:33:02 +01:00
parent 8a1502c9cf
commit 09cf53a292
5 changed files with 21 additions and 16 deletions

View File

@ -28,6 +28,7 @@ LocationCompleter::LocationCompleter(QObject* parent)
: QObject(parent)
, m_locationBar(0)
, m_ignoreCurrentChangedSignal(false)
, m_showingMostVisited(false)
{
if (!s_view) {
s_model = new LocationCompleterModel;
@ -43,28 +44,33 @@ void LocationCompleter::setLocationBar(LocationBar* locationBar)
m_locationBar = locationBar;
}
bool LocationCompleter::isPopupVisible()
bool LocationCompleter::showingMostVisited() const
{
return m_showingMostVisited;
}
bool LocationCompleter::isPopupVisible() const
{
return s_view->isVisible();
}
void LocationCompleter::closePopup()
{
m_showingMostVisited = false;
s_view->close();
}
void LocationCompleter::complete(const QString &string)
{
s_model->refreshCompletions(string);
m_showingMostVisited = string.isEmpty();
s_model->refreshCompletions(string);
showPopup();
}
void LocationCompleter::showMostVisited()
{
s_model->refreshCompletions(QString());
showPopup();
complete(QString());
}
void LocationCompleter::currentChanged(const QModelIndex &index)

View File

@ -36,7 +36,8 @@ public:
void setLocationBar(LocationBar* locationBar);
bool isPopupVisible();
bool showingMostVisited() const;
bool isPopupVisible() const;
void closePopup();
signals:
@ -58,6 +59,7 @@ private:
LocationBar* m_locationBar;
QString m_originalText;
bool m_ignoreCurrentChangedSignal;
bool m_showingMostVisited;
static LocationCompleterView* s_view;
static LocationCompleterModel* s_model;

View File

@ -85,7 +85,7 @@ LocationBar::LocationBar(QupZilla* mainClass)
connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdit()));
connect(m_goIcon, SIGNAL(clicked(QPoint)), this, SLOT(urlEnter()));
connect(down, SIGNAL(clicked(QPoint)), this, SLOT(showMostVisited()));
connect(down, SIGNAL(clicked(QPoint)), &m_completer, SLOT(showMostVisited()));
connect(mApp->searchEnginesManager(), SIGNAL(activeEngineChanged()), this, SLOT(updatePlaceHolderText()));
connect(mApp->searchEnginesManager(), SIGNAL(defaultEngineChanged()), this, SLOT(updatePlaceHolderText()));
connect(mApp, SIGNAL(message(Qz::AppMessageType, bool)), SLOT(onMessage(Qz::AppMessageType, bool)));
@ -226,11 +226,6 @@ void LocationBar::hideGoButton()
updateTextMargins();
}
void LocationBar::showMostVisited()
{
m_completer.complete(QString());
}
void LocationBar::showRSSIcon(bool state)
{
m_rssIcon->setVisible(state);
@ -577,8 +572,9 @@ void LocationBar::hideProgress()
void LocationBar::paintEvent(QPaintEvent* event)
{
if (m_completer.isPopupVisible()) {
// We need to draw cursor
if (m_completer.isPopupVisible() && !m_completer.showingMostVisited()) {
// We need to draw cursor when popup is visible
// But don't paint it if we are just showing most visited sites
LineEdit::paintEvent(event);
QStyleOptionFrameV3 option;

View File

@ -60,7 +60,6 @@ protected:
void paintEvent(QPaintEvent* event);
private slots:
void showMostVisited();
void textEdit();
void urlEnter();
void pasteAndGo();

View File

@ -20,7 +20,9 @@
#include <QWidget>
class NavigationContainer : public QWidget
#include "qzsettings.h"
class QT_QUPZILLA_EXPORT NavigationContainer : public QWidget
{
public:
explicit NavigationContainer(QWidget* parent = 0);