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

[PopupWindow] Fixed edit actions in menu

WebView now has all edit-functions as public signals, so we can
connect it directly (instead of triggering page action in separate
slot in PopupWindow)
This commit is contained in:
nowrep 2014-04-04 17:09:04 +02:00
parent 5c2c90ae6d
commit b7016a70ee
2 changed files with 6 additions and 43 deletions

View File

@ -67,14 +67,14 @@ PopupWindow::PopupWindow(PopupWebView* view)
m_menuBar->addMenu(menuFile);
m_menuEdit = new QMenu(tr("Edit"));
m_menuEdit->addAction(QIcon::fromTheme("edit-undo"), tr("&Undo"), this, SLOT(editUndo()))->setShortcut(QKeySequence("Ctrl+Z"));
m_menuEdit->addAction(QIcon::fromTheme("edit-redo"), tr("&Redo"), this, SLOT(editRedo()))->setShortcut(QKeySequence("Ctrl+Shift+Z"));
m_menuEdit->addAction(QIcon::fromTheme("edit-undo"), tr("&Undo"), m_view, SLOT(editUndo()))->setShortcut(QKeySequence("Ctrl+Z"));
m_menuEdit->addAction(QIcon::fromTheme("edit-redo"), tr("&Redo"), m_view, SLOT(editRedo()))->setShortcut(QKeySequence("Ctrl+Shift+Z"));
m_menuEdit->addSeparator();
m_menuEdit->addAction(QIcon::fromTheme("edit-cut"), tr("&Cut"), this, SLOT(editCut()))->setShortcut(QKeySequence("Ctrl+X"));
m_menuEdit->addAction(QIcon::fromTheme("edit-copy"), tr("C&opy"), this, SLOT(editCopy()))->setShortcut(QKeySequence("Ctrl+C"));
m_menuEdit->addAction(QIcon::fromTheme("edit-paste"), tr("&Paste"), this, SLOT(editPaste()))->setShortcut(QKeySequence("Ctrl+V"));
m_menuEdit->addAction(QIcon::fromTheme("edit-cut"), tr("&Cut"), m_view, SLOT(editCut()))->setShortcut(QKeySequence("Ctrl+X"));
m_menuEdit->addAction(QIcon::fromTheme("edit-copy"), tr("C&opy"), m_view, SLOT(editCopy()))->setShortcut(QKeySequence("Ctrl+C"));
m_menuEdit->addAction(QIcon::fromTheme("edit-paste"), tr("&Paste"), m_view, SLOT(editPaste()))->setShortcut(QKeySequence("Ctrl+V"));
m_menuEdit->addSeparator();
m_menuEdit->addAction(QIcon::fromTheme("edit-select-all"), tr("Select All"), m_view, SLOT(selectAll()))->setShortcut(QKeySequence("Ctrl+A"));
m_menuEdit->addAction(QIcon::fromTheme("edit-select-all"), tr("Select All"), m_view, SLOT(editSelectAll()))->setShortcut(QKeySequence("Ctrl+A"));
m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F"));
connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu()));
connect(m_menuEdit, SIGNAL(aboutToHide()), this, SLOT(aboutToHideEditMenu()));
@ -214,11 +214,6 @@ void PopupWindow::closeEvent(QCloseEvent* event)
event->accept();
}
void PopupWindow::editSelectAll()
{
m_view->editSelectAll();
}
void PopupWindow::aboutToShowEditMenu()
{
m_menuEdit->actions().at(0)->setEnabled(m_view->pageAction(QWebPage::Undo)->isEnabled());
@ -260,31 +255,6 @@ void PopupWindow::searchOnPage()
m_search->focusSearchLine();
}
void PopupWindow::editUndo()
{
m_view->triggerPageAction(QWebPage::Undo);
}
void PopupWindow::editRedo()
{
m_view->triggerPageAction(QWebPage::Redo);
}
void PopupWindow::editCut()
{
m_view->triggerPageAction(QWebPage::Cut);
}
void PopupWindow::editCopy()
{
m_view->triggerPageAction(QWebPage::Copy);
}
void PopupWindow::editPaste()
{
m_view->triggerPageAction(QWebPage::Paste);
}
void PopupWindow::titleChanged()
{
setWindowTitle(tr("%1 - QupZilla").arg(m_view->title()));

View File

@ -59,13 +59,6 @@ private slots:
void loadProgress(int value);
void loadFinished();
void editUndo();
void editRedo();
void editCut();
void editCopy();
void editPaste();
void editSelectAll();
void aboutToShowEditMenu();
void aboutToHideEditMenu();