mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Bring back show source support (using view-source: url)
This commit is contained in:
parent
b6fcfba09a
commit
7d9a07b379
@ -742,17 +742,11 @@ void BrowserWindow::showHistoryManager()
|
|||||||
mApp->browsingLibrary()->showHistory(this);
|
mApp->browsingLibrary()->showHistory(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWindow::showSource(QWebEngineFrame* frame, const QString &selectedHtml)
|
void BrowserWindow::showSource(WebView *view)
|
||||||
{
|
{
|
||||||
#if QTWEBENGINE_DISABLED
|
if (!view)
|
||||||
if (!frame) {
|
view = weView();
|
||||||
frame = weView()->page()->mainFrame();
|
view->showSource();
|
||||||
}
|
|
||||||
|
|
||||||
SourceViewer* source = new SourceViewer(frame, selectedHtml);
|
|
||||||
QzTools::centerWidgetToParent(source, this);
|
|
||||||
source->show();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SideBar* BrowserWindow::addSideBar()
|
SideBar* BrowserWindow::addSideBar()
|
||||||
|
@ -43,6 +43,7 @@ class BookmarksToolbar;
|
|||||||
class AutoFill;
|
class AutoFill;
|
||||||
class MainApplication;
|
class MainApplication;
|
||||||
class WebTab;
|
class WebTab;
|
||||||
|
class WebView;
|
||||||
class AdBlockIcon;
|
class AdBlockIcon;
|
||||||
class SideBar;
|
class SideBar;
|
||||||
class SideBarManager;
|
class SideBarManager;
|
||||||
@ -140,7 +141,7 @@ public slots:
|
|||||||
void bookmarkPage();
|
void bookmarkPage();
|
||||||
void bookmarkAllTabs();
|
void bookmarkAllTabs();
|
||||||
void loadAddress(const QUrl &url);
|
void loadAddress(const QUrl &url);
|
||||||
void showSource(QWebEngineFrame* frame = 0, const QString &selectedHtml = QString());
|
void showSource(WebView *view = Q_NULLPTR);
|
||||||
void printPage(QWebEngineFrame* frame = 0);
|
void printPage(QWebEngineFrame* frame = 0);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -30,9 +30,9 @@ class QUPZILLA_EXPORT PopupWebView : public WebView
|
|||||||
public:
|
public:
|
||||||
explicit PopupWebView(QWidget* parent = 0);
|
explicit PopupWebView(QWidget* parent = 0);
|
||||||
|
|
||||||
QWidget* overlayWidget();
|
QWidget* overlayWidget() Q_DECL_OVERRIDE;
|
||||||
void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position);
|
void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position) Q_DECL_OVERRIDE;
|
||||||
void openNewTab(Qz::NewTabPositionFlags position);
|
void openNewTab(Qz::NewTabPositionFlags position) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ PopupWindow::PopupWindow(PopupWebView* view)
|
|||||||
m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom &Out"), m_view, SLOT(zoomOut()))->setShortcut(QKeySequence("Ctrl+-"));
|
m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom &Out"), m_view, SLOT(zoomOut()))->setShortcut(QKeySequence("Ctrl+-"));
|
||||||
m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), m_view, SLOT(zoomReset()))->setShortcut(QKeySequence("Ctrl+0"));
|
m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), m_view, SLOT(zoomReset()))->setShortcut(QKeySequence("Ctrl+0"));
|
||||||
m_menuView->addSeparator();
|
m_menuView->addSeparator();
|
||||||
//m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), m_view, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U"));
|
m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), m_view, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U"));
|
||||||
m_menuBar->addMenu(m_menuView);
|
m_menuBar->addMenu(m_menuView);
|
||||||
|
|
||||||
// Make shortcuts available even with hidden menubar
|
// Make shortcuts available even with hidden menubar
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
#include "macwebviewscroller.h"
|
#include "macwebviewscroller.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
@ -626,18 +628,21 @@ void WebView::openActionUrl()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QTWEBENGINE_DISABLED
|
void WebView::showSource()
|
||||||
void WebView::showSource(QWebEngineFrame* frame, const QString &selectedHtml)
|
|
||||||
{
|
{
|
||||||
if (!frame) {
|
// view-source: doesn't work on itself and custom schemes
|
||||||
frame = page()->mainFrame();
|
if (url().scheme() == QL1S("view-source") || url().scheme() == QL1S("qupzilla")) {
|
||||||
|
page()->toHtml([](const QString &html) {
|
||||||
|
std::cout << html.toLocal8Bit().constData() << std::endl;
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceViewer* source = new SourceViewer(frame, selectedHtml);
|
QUrl u;
|
||||||
QzTools::centerWidgetToParent(source, this);
|
u.setScheme(QSL("view-source"));
|
||||||
source->show();
|
u.setPath(url().toString());
|
||||||
|
openUrlInNewTab(u, Qz::NT_SelectedTab);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void WebView::showSiteInfo()
|
void WebView::showSiteInfo()
|
||||||
{
|
{
|
||||||
|
@ -103,6 +103,7 @@ public slots:
|
|||||||
#if QTWEBENGINE_DISABLED
|
#if QTWEBENGINE_DISABLED
|
||||||
void printPage(QWebEngineFrame* frame = 0);
|
void printPage(QWebEngineFrame* frame = 0);
|
||||||
#endif
|
#endif
|
||||||
|
void showSource();
|
||||||
void sendPageByMail();
|
void sendPageByMail();
|
||||||
void savePageAs();
|
void savePageAs();
|
||||||
|
|
||||||
@ -126,9 +127,6 @@ protected slots:
|
|||||||
void downloadUrlToDisk();
|
void downloadUrlToDisk();
|
||||||
void copyImageToClipboard();
|
void copyImageToClipboard();
|
||||||
void openActionUrl();
|
void openActionUrl();
|
||||||
#if QTWEBENGINE_DISABLED
|
|
||||||
void showSource(QWebEngineFrame* frame = 0, const QString &selectedHtml = QString());
|
|
||||||
#endif
|
|
||||||
void showSiteInfo();
|
void showSiteInfo();
|
||||||
void searchSelectedText();
|
void searchSelectedText();
|
||||||
void searchSelectedTextInBackgroundTab();
|
void searchSelectedTextInBackgroundTab();
|
||||||
|
@ -47,7 +47,10 @@ public:
|
|||||||
QString getIp() const;
|
QString getIp() const;
|
||||||
int tabIndex() const;
|
int tabIndex() const;
|
||||||
|
|
||||||
QWidget* overlayWidget();
|
QWidget* overlayWidget() Q_DECL_OVERRIDE;
|
||||||
|
void closeView() Q_DECL_OVERRIDE;
|
||||||
|
void openNewTab(Qz::NewTabPositionFlags position) Q_DECL_OVERRIDE;
|
||||||
|
void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void wantsCloseTab(int);
|
void wantsCloseTab(int);
|
||||||
@ -58,10 +61,6 @@ public slots:
|
|||||||
void setAsCurrentTab();
|
void setAsCurrentTab();
|
||||||
void userLoadAction(const LoadRequest &req);
|
void userLoadAction(const LoadRequest &req);
|
||||||
|
|
||||||
void closeView();
|
|
||||||
void openNewTab(Qz::NewTabPositionFlags position);
|
|
||||||
void loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags position);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotLoadStarted();
|
void slotLoadStarted();
|
||||||
void slotLoadFinished();
|
void slotLoadFinished();
|
||||||
|
Loading…
Reference in New Issue
Block a user