mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Fixed problem with showing green (secured) info on unsecured page, when
leaving secured one.
This commit is contained in:
parent
74d146ead6
commit
b49a133bbe
@ -148,6 +148,8 @@ void QupZilla::postLaunch()
|
||||
void QupZilla::setupUi()
|
||||
{
|
||||
setContentsMargins(0,0,0,0);
|
||||
m_tabWidget = new TabWidget(this);
|
||||
setCentralWidget(m_tabWidget);
|
||||
|
||||
m_navigation = new QToolBar(this);
|
||||
m_navigation->setWindowTitle(tr("Navigation"));
|
||||
@ -186,11 +188,10 @@ void QupZilla::setupUi()
|
||||
m_navigation->addAction(m_buttonStop);
|
||||
m_navigation->addAction(m_buttonHome);
|
||||
|
||||
m_locationBar = new LocationBar(this);
|
||||
m_searchLine = new WebSearchBar(this);
|
||||
|
||||
m_navigationSplitter = new QSplitter(m_navigation);
|
||||
m_navigationSplitter->addWidget(m_locationBar);
|
||||
m_navigationSplitter->addWidget(m_tabWidget->locationBars());
|
||||
m_navigationSplitter->addWidget(m_searchLine);
|
||||
|
||||
m_navigationSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
@ -229,9 +230,6 @@ void QupZilla::setupUi()
|
||||
m_bookmarksToolbar = new BookmarksToolbar(this);
|
||||
addToolBar(m_bookmarksToolbar);
|
||||
insertToolBarBreak(m_bookmarksToolbar);
|
||||
|
||||
m_tabWidget = new TabWidget(this);
|
||||
setCentralWidget(m_tabWidget);
|
||||
}
|
||||
|
||||
void QupZilla::setupMenu()
|
||||
@ -365,7 +363,6 @@ void QupZilla::setupMenu()
|
||||
aboutToShowToolsMenu();
|
||||
aboutToShowHelpMenu();
|
||||
|
||||
connect(m_locationBar, SIGNAL(returnPressed()), this, SLOT(urlEnter()));
|
||||
connect(m_buttonBack, SIGNAL(triggered()), this, SLOT(goBack()));
|
||||
connect(m_buttonNext, SIGNAL(triggered()), this, SLOT(goNext()));
|
||||
connect(m_buttonStop, SIGNAL(triggered()), this, SLOT(stop()));
|
||||
@ -502,7 +499,7 @@ void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state)
|
||||
case MainApplication::ReloadSettings:
|
||||
loadSettings();
|
||||
m_tabWidget->loadSettings();
|
||||
m_locationBar->loadSettings();
|
||||
// m_locationBar->loadSettings();
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -513,6 +510,9 @@ void QupZilla::receiveMessage(MainApplication::MessageType mes, bool state)
|
||||
|
||||
void QupZilla::refreshHistory(int index)
|
||||
{
|
||||
if (mApp->isClosing())
|
||||
return;
|
||||
|
||||
QWebHistory* history;
|
||||
if (index == -1)
|
||||
history = weView()->page()->history();
|
||||
@ -856,9 +856,9 @@ void QupZilla::loadActionUrl()
|
||||
|
||||
void QupZilla::urlEnter()
|
||||
{
|
||||
if (m_locationBar->text().isEmpty())
|
||||
if (locationBar()->text().isEmpty())
|
||||
return;
|
||||
loadAddress(QUrl(WebView::guessUrlFromString(m_locationBar->text())));
|
||||
loadAddress(QUrl(WebView::guessUrlFromString(locationBar()->text())));
|
||||
weView()->setFocus();
|
||||
}
|
||||
|
||||
@ -1180,7 +1180,6 @@ QupZilla::~QupZilla()
|
||||
delete m_adblockIcon;
|
||||
delete m_menuBack;
|
||||
delete m_menuForward;
|
||||
delete m_locationBar;
|
||||
delete m_searchLine;
|
||||
delete m_bookmarksToolbar;
|
||||
delete m_webSearchToolbar;
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
|
||||
inline WebView* weView() const { WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_tabWidget->currentIndex())); if (!webTab) return 0; return webTab->view(); }
|
||||
inline WebView* weView(int index) const { WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index)); if (!webTab) return 0; return webTab->view(); }
|
||||
inline LocationBar* locationBar() { return m_locationBar; }
|
||||
inline LocationBar* locationBar() { return (LocationBar*) m_tabWidget->locationBars()->currentWidget(); }
|
||||
inline TabWidget* tabWidget() { return m_tabWidget; }
|
||||
inline BookmarksToolbar* bookmarksToolbar() { return m_bookmarksToolbar; }
|
||||
inline StatusBarMessage* statusBarMessage() { return m_statusBarMessage; }
|
||||
@ -126,7 +126,7 @@ public slots:
|
||||
void refreshHistory(int index=-1);
|
||||
void loadActionUrl();
|
||||
void bookmarkPage();
|
||||
void loadAddress(QUrl url) { weView()->load(url); m_locationBar->setText(url.toEncoded()); }
|
||||
void loadAddress(QUrl url) { weView()->load(url); locationBar()->setText(url.toEncoded()); }
|
||||
void showSource();
|
||||
void showPageInfo();
|
||||
void receiveMessage(MainApplication::MessageType mes, bool state);
|
||||
@ -173,7 +173,7 @@ private slots:
|
||||
void bookmarkAllTabs();
|
||||
void newWindow() { mApp->makeNewWindow(false); }
|
||||
|
||||
void openLocation() { m_locationBar->setFocus(); m_locationBar->selectAll(); }
|
||||
void openLocation() { locationBar()->setFocus(); locationBar()->selectAll(); }
|
||||
void openFile();
|
||||
void savePage();
|
||||
void sendLink() { QDesktopServices::openUrl(QUrl("mailto:?body="+weView()->url().toString())); }
|
||||
@ -236,7 +236,6 @@ private:
|
||||
WebSearchBar* m_searchLine;
|
||||
SearchToolBar* m_webSearchToolbar;
|
||||
BookmarksToolbar* m_bookmarksToolbar;
|
||||
LocationBar* m_locationBar;
|
||||
TabWidget* m_tabWidget;
|
||||
QPointer<SideBar> m_sideBar;
|
||||
StatusBarMessage* m_statusBarMessage;
|
||||
|
@ -29,12 +29,13 @@
|
||||
#include "progressbar.h"
|
||||
#include "statusbarmessage.h"
|
||||
|
||||
LocationBar::LocationBar(QupZilla* mainClass, QWidget* parent)
|
||||
: LineEdit(parent)
|
||||
LocationBar::LocationBar(QupZilla* mainClass)
|
||||
: LineEdit()
|
||||
,m_selectAllOnDoubleClick(false)
|
||||
,m_addComWithCtrl(false)
|
||||
,m_addCountryWithAlt(false)
|
||||
,p_QupZilla(mainClass)
|
||||
,m_webView(0)
|
||||
{
|
||||
m_siteIcon = new QToolButton(this);
|
||||
m_siteIcon->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
@ -83,14 +84,16 @@ LocationBar::LocationBar(QupZilla* mainClass, QWidget* parent)
|
||||
// LocationPopup* com = new LocationPopup(this);
|
||||
connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdit()));
|
||||
connect(this, SIGNAL(textEdited(QString)), m_locationCompleter, SLOT(refreshCompleter(QString)));
|
||||
connect(this, SIGNAL(returnPressed()), this, SLOT(urlEnter()));
|
||||
connect(m_locationCompleter->popup(), SIGNAL(clicked(QModelIndex)), p_QupZilla, SLOT(urlEnter()));
|
||||
connect(m_siteIcon, SIGNAL(clicked()), this, SLOT(showSiteInfo()));
|
||||
// connect(down, SIGNAL(clicked(QPoint)), com, SLOT(show()));
|
||||
connect(m_goButton, SIGNAL(clicked(QPoint)), p_QupZilla, SLOT(urlEnter()));
|
||||
connect(m_goButton, SIGNAL(clicked(QPoint)), this, SLOT(urlEnter()));
|
||||
connect(m_rssIcon, SIGNAL(clicked(QPoint)), this, SLOT(rssIconClicked()));
|
||||
|
||||
setStyleSheet("QLineEdit { background: transparent; border-image: url(:/icons/locationbar/lineedit.png); border-width:4; color:black;}");
|
||||
setLeftMargin(33);
|
||||
clearIcon();
|
||||
// setLeftMargin(m_siteIcon->sizeHint().width()+1);
|
||||
}
|
||||
|
||||
@ -103,6 +106,14 @@ void LocationBar::loadSettings()
|
||||
m_addCountryWithAlt = settings.value("AddCountryDomainWithAltKey",true).toBool();
|
||||
}
|
||||
|
||||
void LocationBar::urlEnter()
|
||||
{
|
||||
m_webView->setFocus();
|
||||
QUrl guessedUrl = WebView::guessUrlFromString(text());
|
||||
m_webView->load(guessedUrl);
|
||||
setText(guessedUrl.toString());
|
||||
}
|
||||
|
||||
void LocationBar::textEdit()
|
||||
{
|
||||
m_locationCompleter->popup()->setUpdatesEnabled(false);
|
||||
@ -147,15 +158,20 @@ void LocationBar::showSiteInfo()
|
||||
|
||||
void LocationBar::rssIconClicked()
|
||||
{
|
||||
QList<QPair<QString,QString> > _rss = p_QupZilla->weView()->getRss();
|
||||
QList<QPair<QString,QString> > _rss = m_webView->getRss();
|
||||
|
||||
RSSWidget* rss = new RSSWidget(p_QupZilla->weView(), _rss, this);
|
||||
RSSWidget* rss = new RSSWidget(m_webView, _rss, this);
|
||||
rss->showAt(this);
|
||||
}
|
||||
|
||||
void LocationBar::showRSSIcon(bool state)
|
||||
{
|
||||
m_rssIcon->setVisible(state);
|
||||
}
|
||||
|
||||
void LocationBar::showUrl(const QUrl &url, bool empty)
|
||||
{
|
||||
if (/*hasFocus() || (*/url.isEmpty() && empty/*)*/)
|
||||
if (hasFocus() || (url.isEmpty() && empty))
|
||||
return;
|
||||
|
||||
if (url.toEncoded()!=text()) {
|
||||
@ -163,29 +179,24 @@ void LocationBar::showUrl(const QUrl &url, bool empty)
|
||||
setCursorPosition(0);
|
||||
}
|
||||
|
||||
WebView* view = p_QupZilla->weView();
|
||||
setPrivacy(view->webPage()->sslCertificate().isValid());
|
||||
|
||||
if (view->isLoading()) {
|
||||
p_QupZilla->ipLabel()->hide();
|
||||
p_QupZilla->progressBar()->setVisible(true);
|
||||
p_QupZilla->progressBar()->setValue(view->getLoading());
|
||||
p_QupZilla->buttonStop()->setVisible(true);
|
||||
p_QupZilla->buttonReload()->setVisible(false);
|
||||
} else {
|
||||
p_QupZilla->progressBar()->setVisible(false);
|
||||
p_QupZilla->buttonStop()->setVisible(false);
|
||||
p_QupZilla->buttonReload()->setVisible(true);
|
||||
p_QupZilla->ipLabel()->show();
|
||||
}
|
||||
// if (m_webView->isLoading()) {
|
||||
// p_QupZilla->ipLabel()->hide();
|
||||
// p_QupZilla->progressBar()->setVisible(true);
|
||||
// p_QupZilla->progressBar()->setValue(m_webView->getLoading());
|
||||
// p_QupZilla->buttonStop()->setVisible(true);
|
||||
// p_QupZilla->buttonReload()->setVisible(false);
|
||||
// } else {
|
||||
// p_QupZilla->progressBar()->setVisible(false);
|
||||
// p_QupZilla->buttonStop()->setVisible(false);
|
||||
// p_QupZilla->buttonReload()->setVisible(true);
|
||||
// p_QupZilla->ipLabel()->show();
|
||||
// }
|
||||
|
||||
p_QupZilla->statusBarMessage()->clearMessage();
|
||||
|
||||
hideGoButton();
|
||||
|
||||
m_bookmarkIcon->checkBookmark(url);
|
||||
m_rssIcon->setVisible(view->hasRss());
|
||||
|
||||
}
|
||||
|
||||
void LocationBar::siteIconChanged()
|
||||
@ -194,16 +205,21 @@ void LocationBar::siteIconChanged()
|
||||
QIcon icon_;
|
||||
// if (!p_QupZilla->weView()->isLoading())
|
||||
// icon_ = p_QupZilla->weView()->animationLoading( p_QupZilla->tabWidget()->currentIndex(), false)->pixmap();
|
||||
icon_ = p_QupZilla->weView()->siteIcon();
|
||||
icon_ = m_webView->siteIcon();
|
||||
|
||||
if (icon_.isNull()) {
|
||||
m_siteIcon->setIcon(QIcon(QIcon::fromTheme("text-plain").pixmap(16,16)));
|
||||
clearIcon();
|
||||
} else {
|
||||
// QIcon icon(*icon_);
|
||||
m_siteIcon->setIcon(QIcon(icon_.pixmap(16,16)));
|
||||
}
|
||||
}
|
||||
|
||||
void LocationBar::clearIcon()
|
||||
{
|
||||
m_siteIcon->setIcon(QIcon(QWebSettings::webGraphic(QWebSettings::DefaultFrameIconGraphic)));
|
||||
}
|
||||
|
||||
void LocationBar::setPrivacy(bool state)
|
||||
{
|
||||
if (state)
|
||||
@ -256,7 +272,7 @@ void LocationBar::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
void LocationBar::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
showUrl(p_QupZilla->weView()->url());
|
||||
setText(m_webView->url().toEncoded());
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
|
@ -37,13 +37,16 @@ class LineEdit;
|
||||
class LocationCompleter;
|
||||
class ClickableLabel;
|
||||
class BookmarkIcon;
|
||||
class WebView;
|
||||
class LocationBar : public LineEdit
|
||||
{
|
||||
Q_OBJECT;
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LocationBar(QupZilla* mainClass, QWidget* parent = 0);
|
||||
explicit LocationBar(QupZilla* mainClass);
|
||||
~LocationBar();
|
||||
|
||||
void setWebView(WebView* view) { m_webView = view; }
|
||||
|
||||
void loadSettings();
|
||||
|
||||
public slots:
|
||||
@ -56,6 +59,9 @@ private slots:
|
||||
void showPopup();
|
||||
void showSiteInfo();
|
||||
void rssIconClicked();
|
||||
void urlEnter();
|
||||
void clearIcon();
|
||||
void showRSSIcon(bool state);
|
||||
|
||||
private:
|
||||
void focusOutEvent(QFocusEvent* e);
|
||||
@ -75,6 +81,7 @@ private:
|
||||
bool m_addComWithCtrl;
|
||||
bool m_addCountryWithAlt;
|
||||
QupZilla* p_QupZilla;
|
||||
WebView* m_webView;
|
||||
LocationCompleter* m_locationCompleter;
|
||||
|
||||
bool m_rssIconVisible;
|
||||
|
@ -37,8 +37,7 @@ void Updater::start()
|
||||
void Updater::startDownloadingUpdateInfo(const QUrl &url)
|
||||
{
|
||||
QNetworkAccessManager* manager = new QNetworkAccessManager();
|
||||
QNetworkReply* reply;
|
||||
reply=manager->get(QNetworkRequest(QUrl(url)));
|
||||
manager->get(QNetworkRequest(QUrl(url)));
|
||||
|
||||
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downCompleted(QNetworkReply*)));
|
||||
}
|
||||
|
@ -234,8 +234,7 @@ void RSSManager::loadFeedInNewTab()
|
||||
|
||||
void RSSManager::beginToLoadSlot(const QUrl &url)
|
||||
{
|
||||
QNetworkReply* reply;
|
||||
reply=m_networkManager->get(QNetworkRequest(QUrl(url)));
|
||||
m_networkManager->get(QNetworkRequest(QUrl(url)));
|
||||
|
||||
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(finished(QNetworkReply*)));
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "webtab.h"
|
||||
#include "clickablelabel.h"
|
||||
#include "closedtabsmanager.h"
|
||||
#include "progressbar.h"
|
||||
|
||||
class NewTabButton : public QToolButton
|
||||
{
|
||||
@ -60,7 +61,6 @@ private:
|
||||
style()->drawItemPixmap(&p, r, Qt::AlignCenter, pix);
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
class TabListButton : public QToolButton
|
||||
@ -97,19 +97,20 @@ private:
|
||||
|
||||
TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) :
|
||||
QTabWidget(parent)
|
||||
,p_QupZilla(mainClass)
|
||||
,m_lastTabIndex(0)
|
||||
,m_isClosingToLastTabIndex(false)
|
||||
,m_closedTabsManager(new ClosedTabsManager(this))
|
||||
, p_QupZilla(mainClass)
|
||||
, m_lastTabIndex(0)
|
||||
, m_isClosingToLastTabIndex(false)
|
||||
, m_closedTabsManager(new ClosedTabsManager(this))
|
||||
, m_locationBars(new QStackedWidget())
|
||||
{
|
||||
m_tabBar = new TabBar(p_QupZilla);
|
||||
setTabBar(m_tabBar);
|
||||
setObjectName("tabWidget");
|
||||
setStyleSheet("QTabBar::tab{ max-width:250px; }");
|
||||
|
||||
connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
||||
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
||||
connect(this, SIGNAL(currentChanged(int)), p_QupZilla, SLOT(refreshHistory()));
|
||||
connect(this, SIGNAL(currentChanged(int)), p_QupZilla->locationBar(), SLOT(siteIconChanged()));
|
||||
// connect(this, SIGNAL(currentChanged(int)), p_QupZilla->locationBar(), SLOT(siteIconChanged()));
|
||||
|
||||
connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
|
||||
connect(m_tabBar, SIGNAL(backTab(int)), this, SLOT(backTab(int)));
|
||||
@ -212,10 +213,15 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se
|
||||
if (url.isEmpty())
|
||||
url = m_urlOnNewTab;
|
||||
|
||||
int index = addTab(new WebTab(p_QupZilla),"");
|
||||
LocationBar* locBar = new LocationBar(p_QupZilla);
|
||||
m_locationBars->addWidget(locBar);
|
||||
int index = addTab(new WebTab(p_QupZilla, locBar),"");
|
||||
WebView* webView = weView(index);
|
||||
locBar->setWebView(webView);
|
||||
|
||||
setTabText(index, title);
|
||||
weView(index)->animationLoading(index, true)->movie()->stop();
|
||||
weView(index)->animationLoading(index, false)->setPixmap(_iconForUrl(url).pixmap(16,16));
|
||||
webView->animationLoading(index, true)->movie()->stop();
|
||||
webView->animationLoading(index, false)->setPixmap(_iconForUrl(url).pixmap(16,16));
|
||||
|
||||
if (openIn == TabWidget::NewSelectedTab) {
|
||||
setCurrentIndex(index);
|
||||
@ -230,18 +236,22 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se
|
||||
tabBar()->setTabsClosable(false);
|
||||
else tabBar()->setTabsClosable(true);
|
||||
|
||||
connect(weView(index), SIGNAL(siteIconChanged()), p_QupZilla->locationBar(), SLOT(siteIconChanged()));
|
||||
connect(weView(index), SIGNAL(showUrl(QUrl)), p_QupZilla->locationBar(), SLOT(showUrl(QUrl)));
|
||||
connect(weView(index), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
|
||||
connect(weView(index), SIGNAL(changed()), mApp, SLOT(setChanged()));
|
||||
connect(weView(index), SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString)));
|
||||
// connect(weView(index), SIGNAL(siteIconChanged()), p_QupZilla->locationBar(), SLOT(siteIconChanged()));
|
||||
// connect(weView(index), SIGNAL(showUrl(QUrl)), p_QupZilla->locationBar(), SLOT(showUrl(QUrl)));
|
||||
connect(webView, SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
|
||||
connect(webView, SIGNAL(changed()), mApp, SLOT(setChanged()));
|
||||
connect(webView, SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString)));
|
||||
|
||||
if (url.isValid())
|
||||
weView(index)->load(url);
|
||||
webView->load(url);
|
||||
|
||||
if (selectLine)
|
||||
p_QupZilla->locationBar()->setFocus();
|
||||
if (openIn == NewSelectedTab)
|
||||
|
||||
if (openIn == NewSelectedTab) {
|
||||
m_isClosingToLastTabIndex = true;
|
||||
m_locationBars->setCurrentWidget(locBar);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
@ -264,26 +274,28 @@ void TabWidget::closeTab(int index)
|
||||
if (index == -1)
|
||||
index = currentIndex();
|
||||
|
||||
if (weView(index)) {
|
||||
disconnect(weView(index), SIGNAL(siteIconChanged()), p_QupZilla->locationBar(), SLOT(siteIconChanged()));
|
||||
disconnect(weView(index), SIGNAL(showUrl(QUrl)), p_QupZilla->locationBar(), SLOT(showUrl(QUrl)));
|
||||
disconnect(weView(index), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
|
||||
disconnect(weView(index), SIGNAL(changed()), mApp, SLOT(setChanged()));
|
||||
disconnect(weView(index), SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString)));
|
||||
//Save last tab url and history
|
||||
m_closedTabsManager->saveView(weView(index));
|
||||
WebView* webView = weView(index);
|
||||
if (!webView)
|
||||
return;
|
||||
|
||||
if (m_isClosingToLastTabIndex && m_lastTabIndex < count())
|
||||
setCurrentIndex(m_lastTabIndex);
|
||||
m_locationBars->removeWidget(webView->webTab()->locationBar());
|
||||
// disconnect(weView(index), SIGNAL(siteIconChanged()), p_QupZilla->locationBar(), SLOT(siteIconChanged()));
|
||||
// disconnect(weView(index), SIGNAL(showUrl(QUrl)), p_QupZilla->locationBar(), SLOT(showUrl(QUrl)));
|
||||
disconnect(webView, SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
|
||||
disconnect(webView, SIGNAL(changed()), mApp, SLOT(setChanged()));
|
||||
disconnect(webView, SIGNAL(ipChanged(QString)), p_QupZilla->ipLabel(), SLOT(setText(QString)));
|
||||
//Save last tab url and history
|
||||
m_closedTabsManager->saveView(webView);
|
||||
|
||||
delete weView(index);
|
||||
removeTab(index);
|
||||
if (m_isClosingToLastTabIndex && m_lastTabIndex < count())
|
||||
setCurrentIndex(m_lastTabIndex);
|
||||
|
||||
if (count() == 1 && m_hideCloseButtonWithOneTab)
|
||||
tabBar()->setTabsClosable(false);
|
||||
if (count() == 1 && m_hideTabBarWithOneTab)
|
||||
tabBar()->setVisible(false);
|
||||
}
|
||||
delete widget(index);
|
||||
|
||||
if (count() == 1 && m_hideCloseButtonWithOneTab)
|
||||
tabBar()->setTabsClosable(false);
|
||||
if (count() == 1 && m_hideTabBarWithOneTab)
|
||||
tabBar()->setVisible(false);
|
||||
|
||||
// if (count() < 1)
|
||||
// p_QupZilla->close();
|
||||
@ -296,24 +308,40 @@ void TabWidget::tabMoved(int before, int after)
|
||||
m_isClosingToLastTabIndex = false;
|
||||
}
|
||||
|
||||
void TabWidget::tabChanged(int index)
|
||||
void TabWidget::currentTabChanged(int index)
|
||||
{
|
||||
if (index < 0)
|
||||
return;
|
||||
|
||||
m_isClosingToLastTabIndex = false;
|
||||
WebView* webView = weView();
|
||||
|
||||
QString title = p_QupZilla->weView()->title();
|
||||
QString title = webView->title();
|
||||
if (title.isEmpty())
|
||||
title = tr("No Named Page");
|
||||
|
||||
p_QupZilla->setWindowTitle(title + " - QupZilla");
|
||||
p_QupZilla->locationBar()->showUrl(weView()->url(),false);
|
||||
p_QupZilla->ipLabel()->setText(weView()->getIp());
|
||||
// p_QupZilla->locationBar()->showUrl(weView()->url(),false);
|
||||
|
||||
m_locationBars->setCurrentWidget(webView->webTab()->locationBar());
|
||||
p_QupZilla->ipLabel()->setText(webView->getIp());
|
||||
|
||||
if (webView->isLoading()) {
|
||||
p_QupZilla->ipLabel()->hide();
|
||||
p_QupZilla->progressBar()->setVisible(true);
|
||||
p_QupZilla->progressBar()->setValue(webView->getLoading());
|
||||
p_QupZilla->buttonStop()->setVisible(true);
|
||||
p_QupZilla->buttonReload()->setVisible(false);
|
||||
} else {
|
||||
p_QupZilla->progressBar()->setVisible(false);
|
||||
p_QupZilla->buttonStop()->setVisible(false);
|
||||
p_QupZilla->buttonReload()->setVisible(true);
|
||||
p_QupZilla->ipLabel()->show();
|
||||
}
|
||||
|
||||
if (p_QupZilla->inspectorDock() && p_QupZilla->inspectorDock()->isVisible())
|
||||
p_QupZilla->showInspector();
|
||||
weView()->setFocus();
|
||||
webView->setFocus();
|
||||
|
||||
m_tabBar->updateCloseButton(index);
|
||||
}
|
||||
@ -541,9 +569,6 @@ bool TabWidget::restoreState(const QByteArray &state)
|
||||
|
||||
TabWidget::~TabWidget()
|
||||
{
|
||||
int index = currentIndex();
|
||||
closeAllButCurrent(index);
|
||||
closeTab(index);
|
||||
delete m_menuTabs;
|
||||
delete m_buttonAddTab;
|
||||
delete m_buttonListTabs;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QToolButton>
|
||||
#include <QStylePainter>
|
||||
#include <QStackedWidget>
|
||||
|
||||
class QupZilla;
|
||||
class WebView;
|
||||
@ -54,6 +55,7 @@ public:
|
||||
inline ClosedTabsManager* closedTabsManager() { return m_closedTabsManager; }
|
||||
bool canRestoreTab();
|
||||
QList<WebTab*> allTabs(bool withPinned = true);
|
||||
QStackedWidget* locationBars() { return m_locationBars; }
|
||||
|
||||
|
||||
public slots:
|
||||
@ -72,7 +74,7 @@ public slots:
|
||||
private slots:
|
||||
void aboutToShowTabsMenu();
|
||||
void actionChangeIndex();
|
||||
void tabChanged(int index);
|
||||
void currentTabChanged(int index);
|
||||
void tabMoved(int before, int after);
|
||||
|
||||
private:
|
||||
@ -93,6 +95,8 @@ private:
|
||||
NewTabButton* m_buttonAddTab;
|
||||
TabListButton* m_buttonListTabs;
|
||||
ClosedTabsManager* m_closedTabsManager;
|
||||
|
||||
QStackedWidget* m_locationBars;
|
||||
};
|
||||
|
||||
#endif // TABWIDGET_H
|
||||
|
@ -33,12 +33,25 @@ WebPage::WebPage(WebView* parent, QupZilla* mainClass)
|
||||
,m_view(parent)
|
||||
,m_blockAlerts(false)
|
||||
,m_lastUploadLocation(QDir::homePath())
|
||||
,m_secureStatus(false)
|
||||
// ,m_isOpeningNextWindowAsNewTab(false)
|
||||
{
|
||||
setForwardUnsupportedContent(true);
|
||||
setPluginFactory(new WebPluginFactory(this));
|
||||
connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), SLOT(handleUnsupportedContent(QNetworkReply*)));
|
||||
connect(this, SIGNAL(loadStarted()), this, SLOT(loadingStarted()));
|
||||
connect(this, SIGNAL(loadProgress(int)), this, SLOT(progress(int)));
|
||||
}
|
||||
|
||||
void WebPage::progress(int prog)
|
||||
{
|
||||
Q_UNUSED(prog)
|
||||
bool secStatus = sslCertificate().isValid();
|
||||
|
||||
if (secStatus != m_secureStatus) {
|
||||
m_secureStatus = secStatus;
|
||||
emit privacyChanged(sslCertificate().isValid());
|
||||
}
|
||||
}
|
||||
|
||||
void WebPage::loadingStarted()
|
||||
@ -76,7 +89,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
|
||||
void WebPage::setSSLCertificate(const QSslCertificate &cert)
|
||||
{
|
||||
// if (cert != m_SslCert) -- crashing on linux :-|
|
||||
m_SslCert = cert;
|
||||
m_SslCert = cert;
|
||||
}
|
||||
|
||||
QSslCertificate WebPage::sslCertificate()
|
||||
|
@ -57,10 +57,14 @@ public:
|
||||
void addAdBlockRule(const QString &filter, const QUrl &url);
|
||||
QList<AdBlockedEntry> adBlockedEntries() { return m_adBlockedEntries; }
|
||||
|
||||
signals:
|
||||
void privacyChanged(bool status);
|
||||
|
||||
protected slots:
|
||||
QWebPage* createWindow(QWebPage::WebWindowType type);
|
||||
void handleUnsupportedContent(QNetworkReply* url);
|
||||
void loadingStarted();
|
||||
void progress(int prog);
|
||||
|
||||
private:
|
||||
virtual bool supportsExtension(Extension extension) const { return (extension == ErrorPageExtension); }
|
||||
@ -78,6 +82,8 @@ private:
|
||||
QList<AdBlockedEntry> m_adBlockedEntries;
|
||||
bool m_blockAlerts;
|
||||
QString m_lastUploadLocation;
|
||||
|
||||
bool m_secureStatus;
|
||||
// bool m_isOpeningNextWindowAsNewTab;
|
||||
};
|
||||
|
||||
|
@ -18,12 +18,15 @@
|
||||
#include "webtab.h"
|
||||
#include "qupzilla.h"
|
||||
#include "webview.h"
|
||||
#include "webpage.h"
|
||||
#include "tabbar.h"
|
||||
#include "locationbar.h"
|
||||
|
||||
WebTab::WebTab(QupZilla* mainClass, QWidget* parent)
|
||||
:QWidget(parent)
|
||||
WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar)
|
||||
:QWidget()
|
||||
,p_QupZilla(mainClass)
|
||||
,m_view(0)
|
||||
,m_locationBar(locationBar)
|
||||
,m_pinned(false)
|
||||
{
|
||||
m_layout = new QVBoxLayout(this);
|
||||
@ -36,6 +39,12 @@ WebTab::WebTab(QupZilla* mainClass, QWidget* parent)
|
||||
setAutoFillBackground(true); // We don't want this transparent
|
||||
|
||||
connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*)));
|
||||
connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(siteIconChanged()));
|
||||
connect(m_view, SIGNAL(loadStarted()), m_locationBar, SLOT(clearIcon()));
|
||||
connect(m_view, SIGNAL(loadFinished(bool)), m_locationBar, SLOT(siteIconChanged()));
|
||||
connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl)));
|
||||
connect(m_view, SIGNAL(rssChanged(bool)), m_locationBar, SLOT(showRSSIcon(bool)));
|
||||
connect(m_view->webPage(), SIGNAL(privacyChanged(bool)), m_locationBar, SLOT(setPrivacy(bool)));
|
||||
}
|
||||
|
||||
void WebTab::showNotification(QWidget* notif)
|
||||
@ -74,5 +83,6 @@ void WebTab::pinTab(int index)
|
||||
|
||||
WebTab::~WebTab()
|
||||
{
|
||||
delete m_locationBar;
|
||||
delete m_view;
|
||||
}
|
||||
|
@ -24,17 +24,21 @@
|
||||
#include "webview.h"
|
||||
|
||||
class QupZilla;
|
||||
class LocationBar;
|
||||
class WebTab : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WebTab(QupZilla* mainClass, QWidget* parent = 0);
|
||||
explicit WebTab(QupZilla* mainClass, LocationBar* locationBar);
|
||||
~WebTab();
|
||||
WebView* view() { return m_view; }
|
||||
bool isPinned() { return m_pinned; }
|
||||
void pinTab(int index);
|
||||
void setPinned(bool state) { m_pinned = state; }
|
||||
|
||||
void setLocationBar(LocationBar* bar) { m_locationBar = bar; }
|
||||
LocationBar* locationBar() { return m_locationBar; }
|
||||
|
||||
private slots:
|
||||
void showNotification(QWidget* notif);
|
||||
|
||||
@ -43,6 +47,7 @@ private:
|
||||
QupZilla* p_QupZilla;
|
||||
QPointer<WebView> m_view;
|
||||
QVBoxLayout* m_layout;
|
||||
LocationBar* m_locationBar;
|
||||
|
||||
bool m_pinned;
|
||||
};
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "iconprovider.h"
|
||||
#include "webtab.h"
|
||||
#include "statusbarmessage.h"
|
||||
#include "progressbar.h"
|
||||
|
||||
WebView::WebView(QupZilla* mainClass, WebTab* webTab)
|
||||
: QWebView()
|
||||
@ -44,6 +45,7 @@ WebView::WebView(QupZilla* mainClass, WebTab* webTab)
|
||||
,m_wantsClose(false)
|
||||
,m_page(new WebPage(this, p_QupZilla))
|
||||
,m_webTab(webTab)
|
||||
,m_locationBar(0)
|
||||
,m_mouseTrack(false)
|
||||
,m_navigationVisible(false)
|
||||
,m_mouseWheelEnabled(true)
|
||||
@ -137,6 +139,14 @@ void WebView::setProgress(int prog)
|
||||
emit showUrl(url());
|
||||
}
|
||||
checkRss();
|
||||
|
||||
if (isCurrent()) {
|
||||
p_QupZilla->ipLabel()->hide();
|
||||
p_QupZilla->progressBar()->setVisible(true);
|
||||
p_QupZilla->progressBar()->setValue(m_progress);
|
||||
p_QupZilla->buttonStop()->setVisible(true);
|
||||
p_QupZilla->buttonReload()->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void WebView::loadStarted()
|
||||
@ -231,6 +241,13 @@ void WebView::loadFinished(bool state)
|
||||
titleChanged();
|
||||
mApp->autoFill()->completePage(this);
|
||||
QHostInfo::lookupHost(url().host(), this, SLOT(setIp(QHostInfo)));
|
||||
|
||||
if (isCurrent()) {
|
||||
p_QupZilla->progressBar()->setVisible(false);
|
||||
p_QupZilla->buttonStop()->setVisible(false);
|
||||
p_QupZilla->buttonReload()->setVisible(true);
|
||||
p_QupZilla->ipLabel()->show();
|
||||
}
|
||||
}
|
||||
|
||||
void WebView::titleChanged()
|
||||
@ -354,6 +371,8 @@ void WebView::checkRss()
|
||||
continue;
|
||||
m_rss.append(QPair<QString,QString>(title, href));
|
||||
}
|
||||
|
||||
emit rssChanged(!m_rss.isEmpty());
|
||||
}
|
||||
|
||||
void WebView::mousePressEvent(QMouseEvent* event)
|
||||
|
@ -36,7 +36,7 @@ class TabWidget;
|
||||
class WebPage;
|
||||
class NetworkManagerProxy;
|
||||
class WebTab;
|
||||
|
||||
class LocationBar;
|
||||
class WebView : public QWebView
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -61,6 +61,9 @@ public:
|
||||
QList<QPair<QString,QString> > getRss() { return m_rss; } //FIXME: Make RSS as struct
|
||||
void setMouseWheelEnabled(bool state) { m_mouseWheelEnabled = state; }
|
||||
|
||||
void setLocationBar(LocationBar* bar) { m_locationBar = bar; }
|
||||
LocationBar* locationBar() { return m_locationBar; }
|
||||
|
||||
static QUrl guessUrlFromString(const QString &string);
|
||||
static bool isUrlValid(const QUrl &url);
|
||||
int tabIndex() const;
|
||||
@ -134,6 +137,7 @@ private:
|
||||
WebPage* m_page;
|
||||
WebTab* m_webTab;
|
||||
NetworkManagerProxy* m_networkProxy;
|
||||
LocationBar* m_locationBar;
|
||||
|
||||
bool m_mouseTrack;
|
||||
bool m_navigationVisible;
|
||||
@ -143,12 +147,12 @@ private:
|
||||
signals:
|
||||
void showUrl(QUrl url);
|
||||
void siteIconChanged();
|
||||
void setPrivacy(bool state);
|
||||
void wantsCloseTab(int index);
|
||||
void changed();
|
||||
void ipChanged(QString ip);
|
||||
void showNotification(QWidget* notif);
|
||||
void viewportResized(QSize size);
|
||||
void rssChanged(bool state);
|
||||
};
|
||||
|
||||
#endif // WEBVIEW_H
|
||||
|
Loading…
Reference in New Issue
Block a user