mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[sourceviewer] Option to load edited source code in page.
Also fixed showing AdBlock css rules when reloading source.
This commit is contained in:
parent
dfb69be90e
commit
fc41e1516d
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -68,6 +68,7 @@ SourceViewer::SourceViewer(QWebFrame* frame, const QString &selectedHtml)
|
|||||||
QzTools::centerWidgetToParent(this, frame->page()->view());
|
QzTools::centerWidgetToParent(this, frame->page()->view());
|
||||||
|
|
||||||
QMenu* menuFile = new QMenu(tr("File"));
|
QMenu* menuFile = new QMenu(tr("File"));
|
||||||
|
menuFile->addAction(tr("Load in page"), this, SLOT(loadInPage()));
|
||||||
menuFile->addAction(QIcon::fromTheme("document-save"), tr("Save as..."), this, SLOT(save()))->setShortcut(QKeySequence("Ctrl+S"));
|
menuFile->addAction(QIcon::fromTheme("document-save"), tr("Save as..."), this, SLOT(save()))->setShortcut(QKeySequence("Ctrl+S"));
|
||||||
menuFile->addSeparator();
|
menuFile->addSeparator();
|
||||||
menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close"), this, SLOT(close()))->setShortcut(QKeySequence("Ctrl+W"));
|
menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close"), this, SLOT(close()))->setShortcut(QKeySequence("Ctrl+W"));
|
||||||
@ -130,6 +131,17 @@ void SourceViewer::pasteAvailable()
|
|||||||
m_actionPaste->setEnabled(m_sourceEdit->canPaste());
|
m_actionPaste->setEnabled(m_sourceEdit->canPaste());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SourceViewer::loadInPage()
|
||||||
|
{
|
||||||
|
if (m_frame) {
|
||||||
|
m_frame.data()->setHtml(m_sourceEdit->toPlainText(), m_frame.data()->baseUrl());
|
||||||
|
m_statusBar->showMessage(tr("Source loaded in page"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_statusBar->showMessage(tr("Cannot load in page. Page has been closed."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SourceViewer::loadSource()
|
void SourceViewer::loadSource()
|
||||||
{
|
{
|
||||||
m_actionUndo->setEnabled(false);
|
m_actionUndo->setEnabled(false);
|
||||||
@ -187,7 +199,7 @@ void SourceViewer::reload()
|
|||||||
{
|
{
|
||||||
if (m_frame) {
|
if (m_frame) {
|
||||||
m_sourceEdit->clear();
|
m_sourceEdit->clear();
|
||||||
m_sourceEdit->setPlainText(m_frame.data()->toHtml());
|
loadSource();
|
||||||
|
|
||||||
m_statusBar->showMessage(tr("Source reloaded"));
|
m_statusBar->showMessage(tr("Source reloaded"));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -42,6 +42,7 @@ private slots:
|
|||||||
void undoAvailable(bool available);
|
void undoAvailable(bool available);
|
||||||
void pasteAvailable();
|
void pasteAvailable();
|
||||||
|
|
||||||
|
void loadInPage();
|
||||||
void loadSource();
|
void loadSource();
|
||||||
void save();
|
void save();
|
||||||
void findText();
|
void findText();
|
||||||
|
@ -4198,6 +4198,18 @@ After adding or removing certificate paths, it is neccessary to restart QupZilla
|
|||||||
<source>Enter line number</source>
|
<source>Enter line number</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Load in page</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Source loaded in page</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Cannot load in page. Page has been closed.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SourceViewerSearch</name>
|
<name>SourceViewerSearch</name>
|
||||||
|
Loading…
Reference in New Issue
Block a user