mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Introduce LocationBarPopup as base for - popups in the location bar.
The switch is needed due to palette problems on some color schemes (e.g. inverted look for popupmenus or tooltips), which could lead to unreadable text.
This commit is contained in:
parent
eb82df9aef
commit
f3221c70d6
@ -29,7 +29,7 @@
|
||||
#include <QTimer>
|
||||
|
||||
BookmarksWidget::BookmarksWidget(QupZilla* mainClass, WebView* view, QWidget* parent)
|
||||
: QMenu(parent)
|
||||
: LocationBarPopup(parent)
|
||||
, ui(new Ui::BookmarksWidget)
|
||||
, p_QupZilla(mainClass)
|
||||
, m_url(view->url())
|
||||
@ -39,7 +39,6 @@ BookmarksWidget::BookmarksWidget(QupZilla* mainClass, WebView* view, QWidget* pa
|
||||
, m_edited(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
// The locationbar's direction is direction of its text,
|
||||
// it dynamically changes and so, it's not good choice for this widget.
|
||||
@ -53,14 +52,6 @@ BookmarksWidget::BookmarksWidget(QupZilla* mainClass, WebView* view, QWidget* pa
|
||||
tr("Remove from Speed Dial"));
|
||||
|
||||
loadBookmark();
|
||||
|
||||
if (mApp->currentStyle() == "gtk+" || mApp->currentStyle() == "bespin") {
|
||||
// Use light color for QLabels with problematic styles
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::WindowText, QToolTip::palette().color(QPalette::ToolTipText));
|
||||
ui->label->setPalette(pal);
|
||||
ui->label_2->setPalette(pal);
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarksWidget::loadBookmark()
|
||||
@ -140,17 +131,6 @@ void BookmarksWidget::on_saveRemove_clicked(bool)
|
||||
QTimer::singleShot(hideDelay, this, SLOT(close()));
|
||||
}
|
||||
|
||||
|
||||
void BookmarksWidget::showAt(QWidget* _parent)
|
||||
{
|
||||
layout()->invalidate();
|
||||
layout()->activate();
|
||||
|
||||
QPoint p = _parent->mapToGlobal(QPoint(0, 0));
|
||||
move((p.x() + _parent->width()) - width(), p.y() + _parent->height());
|
||||
|
||||
show();
|
||||
}
|
||||
BookmarksWidget::~BookmarksWidget()
|
||||
{
|
||||
delete ui;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QMenu>
|
||||
|
||||
#include "qz_namespace.h"
|
||||
#include "locationbarpopup.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -33,13 +34,12 @@ class SpeedDial;
|
||||
class BookmarksModel;
|
||||
class QupZilla;
|
||||
|
||||
class QT_QUPZILLA_EXPORT BookmarksWidget : public QMenu
|
||||
class QT_QUPZILLA_EXPORT BookmarksWidget : public LocationBarPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BookmarksWidget(QupZilla* mainClass, WebView* view, QWidget* parent = 0);
|
||||
~BookmarksWidget();
|
||||
void showAt(QWidget* _parent);
|
||||
|
||||
signals:
|
||||
void bookmarkDeleted();
|
||||
|
@ -53,6 +53,7 @@ SOURCES += \
|
||||
history/historymanager.cpp \
|
||||
navigation/websearchbar.cpp \
|
||||
navigation/locationbar.cpp \
|
||||
navigation/locationbarpopup.cpp \
|
||||
network/networkmanagerproxy.cpp \
|
||||
network/networkmanager.cpp \
|
||||
other/updater.cpp \
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <QWebFrame>
|
||||
|
||||
RSSWidget::RSSWidget(WebView* view, QWidget* parent)
|
||||
: QMenu(parent)
|
||||
: LocationBarPopup(parent)
|
||||
, ui(new Ui::RSSWidget)
|
||||
, m_view(view)
|
||||
{
|
||||
@ -59,32 +59,8 @@ RSSWidget::RSSWidget(WebView* view, QWidget* parent)
|
||||
ui->gridLayout->addWidget(label, i, 0);
|
||||
ui->gridLayout->addWidget(button, i, 1);
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(addRss()));
|
||||
|
||||
if (mApp->currentStyle() == "gtk+" || mApp->currentStyle() == "bespin") {
|
||||
// Use light color for QLabels with problematic styles
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::WindowText, QToolTip::palette().color(QPalette::ToolTipText));
|
||||
ui->label_2->setPalette(pal);
|
||||
label->setPalette(pal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RSSWidget::showAt(QWidget* _parent)
|
||||
{
|
||||
layout()->invalidate();
|
||||
layout()->activate();
|
||||
|
||||
const QPoint &widgetPos = _parent->mapToGlobal(QPoint(0, 0));
|
||||
|
||||
QPoint newPos;
|
||||
newPos.setX(widgetPos.x() + _parent->width() - width());
|
||||
newPos.setY(widgetPos.y() + _parent->height());
|
||||
|
||||
move(newPos);
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
void RSSWidget::addRss()
|
||||
{
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QMenu>
|
||||
|
||||
#include "qz_namespace.h"
|
||||
#include "locationbarpopup.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -29,7 +30,7 @@ class RSSWidget;
|
||||
|
||||
class WebView;
|
||||
|
||||
class QT_QUPZILLA_EXPORT RSSWidget : public QMenu
|
||||
class QT_QUPZILLA_EXPORT RSSWidget : public LocationBarPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -37,8 +38,6 @@ public:
|
||||
explicit RSSWidget(WebView* view, QWidget* parent = 0);
|
||||
~RSSWidget();
|
||||
|
||||
void showAt(QWidget* _parent);
|
||||
|
||||
private slots:
|
||||
void addRss();
|
||||
|
||||
|
@ -26,13 +26,15 @@
|
||||
#include <QSqlQuery>
|
||||
|
||||
SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent)
|
||||
: QMenu(parent)
|
||||
: LocationBarPopup(parent)
|
||||
, ui(new Ui::SiteInfoWidget)
|
||||
, p_QupZilla(mainClass)
|
||||
{
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
|
||||
setPopupAlignment(Qt::AlignLeft);
|
||||
|
||||
WebView* view = p_QupZilla->weView();
|
||||
WebPage* webPage = view->page();
|
||||
QUrl url = view->url();
|
||||
@ -80,25 +82,6 @@ SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent)
|
||||
}
|
||||
}
|
||||
connect(ui->pushButton, SIGNAL(clicked()), p_QupZilla, SLOT(showPageInfo()));
|
||||
|
||||
if (mApp->currentStyle() == "gtk+" || mApp->currentStyle() == "bespin") {
|
||||
// Use light color for QLabels with problematic styles
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::WindowText, QToolTip::palette().color(QPalette::Inactive, QPalette::ToolTipText));
|
||||
ui->historyLabel->setPalette(pal);
|
||||
ui->secureLabel->setPalette(pal);
|
||||
}
|
||||
}
|
||||
|
||||
void SiteInfoWidget::showAt(QWidget* _parent)
|
||||
{
|
||||
layout()->invalidate();
|
||||
layout()->activate();
|
||||
|
||||
QPoint p = _parent->mapToGlobal(QPoint(0, 0));
|
||||
move(p.x(), p.y() + _parent->height());
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
SiteInfoWidget::~SiteInfoWidget()
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QMenu>
|
||||
|
||||
#include "qz_namespace.h"
|
||||
#include <locationbarpopup.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -29,15 +30,13 @@ class SiteInfoWidget;
|
||||
|
||||
class QupZilla;
|
||||
|
||||
class QT_QUPZILLA_EXPORT SiteInfoWidget : public QMenu
|
||||
class QT_QUPZILLA_EXPORT SiteInfoWidget : public LocationBarPopup
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SiteInfoWidget(QupZilla* mainClass, QWidget* parent = 0);
|
||||
~SiteInfoWidget();
|
||||
|
||||
void showAt(QWidget* _parent);
|
||||
|
||||
private:
|
||||
Ui::SiteInfoWidget* ui;
|
||||
QupZilla* p_QupZilla;
|
||||
|
Loading…
Reference in New Issue
Block a user