mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
[popupwindow] Show locationbar's icons also in popup windows.
This commit is contained in:
parent
23690d4154
commit
06b582a37e
@ -1,6 +1,6 @@
|
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,6 +20,10 @@
|
||||
#include "toolbutton.h"
|
||||
#include "qztools.h"
|
||||
#include "iconprovider.h"
|
||||
#include "bookmarkicon.h"
|
||||
#include "autofillicon.h"
|
||||
#include "rssicon.h"
|
||||
#include "webpage.h"
|
||||
|
||||
#include <QMovie>
|
||||
#include <QLabel>
|
||||
@ -50,22 +54,43 @@ PopupLocationBar::PopupLocationBar(QWidget* parent)
|
||||
m_siteIcon->setIcon(qIconProvider->emptyWebIcon());
|
||||
m_siteIcon->setFixedSize(26, 26);
|
||||
|
||||
m_bookmarkIcon = new BookmarkIcon(this);
|
||||
m_rssIcon = new RssIcon(this);
|
||||
m_autofillIcon = new AutoFillIcon(this);
|
||||
|
||||
m_loadingAnimation = new QLabel(this);
|
||||
QMovie* movie = new QMovie(":icons/other/progress.gif", QByteArray(), m_loadingAnimation);
|
||||
m_loadingAnimation->setMovie(movie);
|
||||
m_loadingAnimation->setFixedSize(20, 26);
|
||||
m_loadingAnimation->setFixedSize(16, 26);
|
||||
|
||||
QWidget* rightSpacer = new QWidget(this);
|
||||
rightSpacer->setFixedWidth(3);
|
||||
|
||||
addWidget(m_siteIcon, LineEdit::LeftSide);
|
||||
addWidget(m_autofillIcon, LineEdit::RightSide);
|
||||
addWidget(m_bookmarkIcon, LineEdit::RightSide);
|
||||
addWidget(m_rssIcon, LineEdit::RightSide);
|
||||
addWidget(m_loadingAnimation, LineEdit::RightSide);
|
||||
addWidget(rightSpacer, LineEdit::RightSide);
|
||||
setLeftMargin(20);
|
||||
|
||||
setFixedHeight(26);
|
||||
setReadOnly(true);
|
||||
|
||||
// Hide icons by default
|
||||
m_rssIcon->hide();
|
||||
m_autofillIcon->hide();
|
||||
}
|
||||
|
||||
void PopupLocationBar::setView(PopupWebView* view)
|
||||
{
|
||||
m_view = view;
|
||||
|
||||
m_bookmarkIcon->setWebView(m_view);
|
||||
m_rssIcon->setWebView(m_view);
|
||||
m_autofillIcon->setWebView(m_view);
|
||||
|
||||
connect(m_view, SIGNAL(rssChanged(bool)), this, SLOT(showRSSIcon(bool)));
|
||||
}
|
||||
|
||||
void PopupLocationBar::startLoading()
|
||||
@ -73,6 +98,8 @@ void PopupLocationBar::startLoading()
|
||||
m_loadingAnimation->show();
|
||||
m_loadingAnimation->movie()->start();
|
||||
|
||||
m_autofillIcon->hide();
|
||||
|
||||
updateTextMargins();
|
||||
}
|
||||
|
||||
@ -81,6 +108,15 @@ void PopupLocationBar::stopLoading()
|
||||
m_loadingAnimation->hide();
|
||||
m_loadingAnimation->movie()->stop();
|
||||
|
||||
m_bookmarkIcon->checkBookmark(m_view->url());
|
||||
|
||||
WebPage* page = qobject_cast<WebPage*>(m_view->page());
|
||||
|
||||
if (page && page->hasMultipleUsernames()) {
|
||||
m_autofillIcon->setFormData(page->autoFillData());
|
||||
m_autofillIcon->show();
|
||||
}
|
||||
|
||||
updateTextMargins();
|
||||
}
|
||||
|
||||
@ -90,7 +126,14 @@ void PopupLocationBar::showUrl(const QUrl &url)
|
||||
setCursorPosition(0);
|
||||
}
|
||||
|
||||
void PopupLocationBar::showIcon()
|
||||
void PopupLocationBar::showSiteIcon()
|
||||
{
|
||||
m_siteIcon->setIcon(m_view->icon());
|
||||
}
|
||||
|
||||
void PopupLocationBar::showRSSIcon(bool state)
|
||||
{
|
||||
m_rssIcon->setVisible(state);
|
||||
|
||||
updateTextMargins();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -26,6 +26,9 @@ class QLabel;
|
||||
|
||||
class PopupSiteIcon;
|
||||
class PopupWebView;
|
||||
class AutoFillIcon;
|
||||
class BookmarkIcon;
|
||||
class RssIcon;
|
||||
|
||||
class QT_QUPZILLA_EXPORT PopupLocationBar : public LineEdit
|
||||
{
|
||||
@ -42,16 +45,19 @@ public:
|
||||
void startLoading();
|
||||
void stopLoading();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void showUrl(const QUrl &url);
|
||||
void showIcon();
|
||||
void showSiteIcon();
|
||||
void showRSSIcon(bool state);
|
||||
|
||||
private:
|
||||
PopupWebView* m_view;
|
||||
PopupSiteIcon* m_siteIcon;
|
||||
QLabel* m_loadingAnimation;
|
||||
|
||||
PopupSiteIcon* m_siteIcon;
|
||||
AutoFillIcon* m_autofillIcon;
|
||||
BookmarkIcon* m_bookmarkIcon;
|
||||
RssIcon* m_rssIcon;
|
||||
};
|
||||
|
||||
#endif // POPUPLOCATIONBAR_H
|
||||
|
@ -114,7 +114,7 @@ PopupWindow::PopupWindow(PopupWebView* view)
|
||||
connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*)));
|
||||
connect(m_view, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged()));
|
||||
connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl)));
|
||||
connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showIcon()));
|
||||
connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showSiteIcon()));
|
||||
connect(m_view, SIGNAL(statusBarMessage(QString)), this, SLOT(showStatusBarMessage(QString)));
|
||||
connect(m_view, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
|
||||
connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));
|
||||
@ -154,11 +154,11 @@ PopupWebView* PopupWindow::webView()
|
||||
|
||||
void PopupWindow::showNotification(QWidget* notif)
|
||||
{
|
||||
if (m_layout->count() > 3) {
|
||||
delete m_layout->itemAt(1)->widget();
|
||||
if (m_layout->count() > 4) {
|
||||
delete m_layout->itemAt(2)->widget();
|
||||
}
|
||||
|
||||
m_layout->insertWidget(1, notif);
|
||||
m_layout->insertWidget(2, notif);
|
||||
notif->show();
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,8 @@
|
||||
- with menubar
|
||||
</p>
|
||||
<p>
|
||||
<a href="javascript:window.open('popup.html', '_blank', 'status=yes')">Popup 7</a>
|
||||
- with statusbar
|
||||
<a href="javascript:window.open('http://blog.qupzilla.com', '_blank', 'status=yes')">Popup 7</a>
|
||||
- with statusbar (blog.qupzilla.com)
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
|
Loading…
Reference in New Issue
Block a user