1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[WebView] Option to add Undo/Redo menu actions to forms

This commit is contained in:
Mladen Pejaković 2014-01-04 19:00:01 +01:00
parent b891bf3914
commit 6b5f62ecf3
5 changed files with 23 additions and 0 deletions

View File

@ -51,6 +51,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

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

View File

@ -279,6 +279,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());
@ -962,6 +963,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

@ -1100,6 +1100,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()) {