1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 04:36:34 +01:00

Merge pull request #1129 from pejakm/undoredo

[WebView] Option to add Undo/Redo menu actions to forms
This commit is contained in:
David Rosca 2014-01-17 12:43:30 -08:00
commit b3031671bc
5 changed files with 23 additions and 0 deletions

View File

@ -52,6 +52,7 @@ void QzSettings::loadSettings()
allowJsHideMenuBar = settings.value("allowJavaScriptHideMenuBar", true).toBool();
allowJsHideStatusBar = settings.value("allowJavaScriptHideStatusBar", true).toBool();
allowJsHideToolBar = settings.value("allowJavaScriptHideToolBar", true).toBool();
enableFormsUndoRedo = settings.value("enableFormsUndoRedo", false).toBool();
settings.endGroup();
settings.beginGroup("Browser-Tabs-Settings");

View File

@ -53,6 +53,7 @@ public:
bool allowJsHideMenuBar;
bool allowJsHideStatusBar;
bool allowJsHideToolBar;
bool enableFormsUndoRedo;
QStringList autoOpenProtocols;
QStringList blockedProtocols;

View File

@ -281,6 +281,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->wheelScroll->setValue(settings.value("wheelScrollLines", qApp->wheelScrollLines()).toInt());
ui->defaultZoom->setValue(settings.value("DefaultZoom", 100).toInt());
ui->xssAuditing->setChecked(settings.value("XSSAuditing", false).toBool());
ui->formsUndoRedo->setChecked(settings.value("enableFormsUndoRedo", false).toBool());
//Cache
ui->pagesInCache->setValue(settings.value("maximumCachedPages", 3).toInt());
@ -965,6 +966,7 @@ void Preferences::saveSettings()
settings.setValue("LoadTabsOnActivation", ui->dontLoadTabsUntilSelected->isChecked());
settings.setValue("DefaultZoom", ui->defaultZoom->value());
settings.setValue("XSSAuditing", ui->xssAuditing->isChecked());
settings.setValue("enableFormsUndoRedo", ui->formsUndoRedo->isChecked());
#ifdef Q_OS_WIN
settings.setValue("CheckDefaultBrowser", ui->checkDefaultBrowser->isChecked());
#endif

View File

@ -1114,6 +1114,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="formsUndoRedo">
<property name="toolTip">
<string>If you disable this, it will still be accesible via standard Qt shortcuts</string>
</property>
<property name="text">
<string>Enable Undo/Redo for editable forms</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">

View File

@ -836,6 +836,15 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
QMenu* pageMenu = page()->createStandardContextMenu();
// Apparently createStandardContextMenu() can return null pointer
if (pageMenu) {
if (qzSettings->enableFormsUndoRedo) {
pageAction(QWebPage::Undo)->setIcon(QIcon::fromTheme("edit-undo"));
pageAction(QWebPage::Undo)->setText(tr("Undo"));
menu->addAction(pageAction(QWebPage::Undo));
pageAction(QWebPage::Redo)->setIcon(QIcon::fromTheme("edit-redo"));
pageAction(QWebPage::Redo)->setText(tr("Redo"));
menu->addAction(pageAction(QWebPage::Redo));
menu->addSeparator();
}
int i = 0;
foreach (QAction* act, pageMenu->actions()) {
if (act->isSeparator()) {