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

Merge pull request #208 from pejakm/master

Added icons and "Send Media Address" menu entry to Audio/Video elements
This commit is contained in:
David Rosca 2012-01-21 23:57:48 -08:00
commit eb00897025
3 changed files with 12 additions and 8 deletions

View File

@ -342,7 +342,7 @@ void QupZilla::setupMenu()
m_menuFile = new QMenu(tr("&File")); m_menuFile = new QMenu(tr("&File"));
m_menuFile->addAction(QIcon::fromTheme("window-new"), tr("&New Window"), this, SLOT(newWindow()))->setShortcut(QKeySequence("Ctrl+N")); m_menuFile->addAction(QIcon::fromTheme("window-new"), tr("&New Window"), this, SLOT(newWindow()))->setShortcut(QKeySequence("Ctrl+N"));
m_menuFile->addAction(QIcon(":/icons/menu/popup.png"), tr("New Tab"), this, SLOT(addTab()))->setShortcut(QKeySequence("Ctrl+T")); m_menuFile->addAction(QIcon(":/icons/menu/popup.png"), tr("New Tab"), this, SLOT(addTab()))->setShortcut(QKeySequence("Ctrl+T"));
m_menuFile->addAction(tr("Open Location"), this, SLOT(openLocation()))->setShortcut(QKeySequence("Ctrl+L")); m_menuFile->addAction(QIcon::fromTheme("document-open-remote"), tr("Open Location"), this, SLOT(openLocation()))->setShortcut(QKeySequence("Ctrl+L"));
m_menuFile->addAction(QIcon::fromTheme("document-open"), tr("Open &File"), this, SLOT(openFile()))->setShortcut(QKeySequence("Ctrl+O")); m_menuFile->addAction(QIcon::fromTheme("document-open"), tr("Open &File"), this, SLOT(openFile()))->setShortcut(QKeySequence("Ctrl+O"));
m_menuFile->addAction(tr("Close Tab"), m_tabWidget, SLOT(closeTab()))->setShortcut(QKeySequence("Ctrl+W")); m_menuFile->addAction(tr("Close Tab"), m_tabWidget, SLOT(closeTab()))->setShortcut(QKeySequence("Ctrl+W"));
m_actionCloseWindow = m_menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close Window"), this, SLOT(close())); m_actionCloseWindow = m_menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close Window"), this, SLOT(close()));
@ -350,7 +350,7 @@ void QupZilla::setupMenu()
m_menuFile->addSeparator(); m_menuFile->addSeparator();
m_menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), this, SLOT(savePage()))->setShortcut(QKeySequence("Ctrl+S")); m_menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), this, SLOT(savePage()))->setShortcut(QKeySequence("Ctrl+S"));
m_menuFile->addAction(tr("Save Page Screen"), this, SLOT(savePageScreen())); m_menuFile->addAction(tr("Save Page Screen"), this, SLOT(savePageScreen()));
m_menuFile->addAction(tr("Send Link..."), this, SLOT(sendLink())); m_menuFile->addAction(QIcon::fromTheme("mail-message-new"), tr("Send Link..."), this, SLOT(sendLink()));
m_menuFile->addAction(QIcon::fromTheme("document-print"), tr("&Print"), this, SLOT(printPage())); m_menuFile->addAction(QIcon::fromTheme("document-print"), tr("&Print"), this, SLOT(printPage()));
m_menuFile->addSeparator(); m_menuFile->addSeparator();
m_menuFile->addSeparator(); m_menuFile->addSeparator();

View File

@ -314,7 +314,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
findText(""); findText("");
} }
m_menu->addAction(QIcon(":/icons/menu/popup.png"), tr("Open link in new &tab"), this, SLOT(openUrlInNewTab()))->setData(r.linkUrl()); m_menu->addAction(QIcon(":/icons/menu/popup.png"), tr("Open link in new &tab"), this, SLOT(openUrlInNewTab()))->setData(r.linkUrl());
m_menu->addAction(tr("Open link in new &window"), this, SLOT(openUrlInNewWindow()))->setData(r.linkUrl()); m_menu->addAction(QIcon::fromTheme("window-new"), tr("Open link in new &window"), this, SLOT(openUrlInNewWindow()))->setData(r.linkUrl());
m_menu->addSeparator(); m_menu->addSeparator();
m_menu->addAction(IconProvider::fromTheme("user-bookmarks"), tr("B&ookmark link"), this, SLOT(bookmarkLink()))->setData(r.linkUrl()); m_menu->addAction(IconProvider::fromTheme("user-bookmarks"), tr("B&ookmark link"), this, SLOT(bookmarkLink()))->setData(r.linkUrl());
m_menu->addAction(QIcon::fromTheme("document-save"), tr("&Save link as..."), this, SLOT(downloadLinkToDisk()))->setData(r.linkUrl()); m_menu->addAction(QIcon::fromTheme("document-save"), tr("&Save link as..."), this, SLOT(downloadLinkToDisk()))->setData(r.linkUrl());
@ -322,6 +322,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
m_menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy link address"), this, SLOT(copyLinkToClipboard()))->setData(r.linkUrl()); m_menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy link address"), this, SLOT(copyLinkToClipboard()))->setData(r.linkUrl());
m_menu->addSeparator(); m_menu->addSeparator();
if (!selectedText().isEmpty()) { if (!selectedText().isEmpty()) {
pageAction(QWebPage::Copy)->setIcon(QIcon::fromTheme("edit-copy"));
m_menu->addAction(pageAction(QWebPage::Copy)); m_menu->addAction(pageAction(QWebPage::Copy));
} }
} }
@ -339,6 +340,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
m_menu->addSeparator(); m_menu->addSeparator();
//menu->addAction(tr("Block image"), this, SLOT(blockImage()))->setData(r.imageUrl().toString()); //menu->addAction(tr("Block image"), this, SLOT(blockImage()))->setData(r.imageUrl().toString());
if (!selectedText().isEmpty()) { if (!selectedText().isEmpty()) {
pageAction(QWebPage::Copy)->setIcon(QIcon::fromTheme("edit-copy"));
m_menu->addAction(pageAction(QWebPage::Copy)); m_menu->addAction(pageAction(QWebPage::Copy));
} }
} }
@ -416,6 +418,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
if (!selectedText().isEmpty()) { if (!selectedText().isEmpty()) {
QString selectedText = page()->selectedText(); QString selectedText = page()->selectedText();
pageAction(QWebPage::Copy)->setIcon(QIcon::fromTheme("edit-copy"));
m_menu->addAction(pageAction(QWebPage::Copy)); m_menu->addAction(pageAction(QWebPage::Copy));
m_menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, SLOT(sendLinkByMail()))->setData(selectedText); m_menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send text..."), this, SLOT(sendLinkByMail()))->setData(selectedText);
m_menu->addSeparator(); m_menu->addSeparator();
@ -423,7 +426,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
QString langCode = mApp->getActiveLanguage().left(2); QString langCode = mApp->getActiveLanguage().left(2);
QUrl googleTranslateUrl = QUrl(QString("http://translate.google.com/#auto|%1|%2").arg(langCode, selectedText)); QUrl googleTranslateUrl = QUrl(QString("http://translate.google.com/#auto|%1|%2").arg(langCode, selectedText));
m_menu->addAction(QIcon(":icons/menu/translate.png"), tr("Google Translate"), this, SLOT(openUrlInNewTab()))->setData(googleTranslateUrl); m_menu->addAction(QIcon(":icons/menu/translate.png"), tr("Google Translate"), this, SLOT(openUrlInNewTab()))->setData(googleTranslateUrl);
m_menu->addAction(tr("Dictionary"), this, SLOT(openUrlInNewTab()))->setData("http://" + (langCode != "" ? langCode + "." : langCode) + "wiktionary.org/wiki/Special:Search?search=" + selectedText); m_menu->addAction(QIcon::fromTheme("accessories-dictionary"), tr("Dictionary"), this, SLOT(openUrlInNewTab()))->setData("http://" + (langCode != "" ? langCode + "." : langCode) + "wiktionary.org/wiki/Special:Search?search=" + selectedText);
m_menu->addSeparator(); m_menu->addSeparator();
QString selectedString = selectedText.trimmed(); QString selectedString = selectedText.trimmed();

View File

@ -380,11 +380,12 @@ QMenu *WebView::createMediaContextMenu(const QWebHitTestResult &hitTest)
bool muted = m_mediaElement.evaluateJavaScript("this.muted").toBool(); bool muted = m_mediaElement.evaluateJavaScript("this.muted").toBool();
QUrl videoUrl = m_mediaElement.evaluateJavaScript("this.currentSrc").toUrl(); QUrl videoUrl = m_mediaElement.evaluateJavaScript("this.currentSrc").toUrl();
menu->addAction(paused ? tr("Un&pause") : tr("&Pause"), this, SLOT(pauseMedia())); menu->addAction(paused ? tr("&Play") : tr("&Pause"), this, SLOT(pauseMedia()))->setIcon(QIcon::fromTheme(paused ? "media-playback-start" : "media-playback-pause"));
menu->addAction(muted ? tr("Un&mute") : tr("&Mute"), this, SLOT(muteMedia())); menu->addAction(muted ? tr("Un&mute") : tr("&Mute"), this, SLOT(muteMedia()))->setIcon(QIcon::fromTheme(muted ? "audio-volume-muted" : "audio-volume-high"));
menu->addSeparator(); menu->addSeparator();
menu->addAction(tr("Copy Media &Address"), this, SLOT(copyLinkToClipboard()))->setData(videoUrl); menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy Media Address"), this, SLOT(copyLinkToClipboard()))->setData(videoUrl);
menu->addAction(tr("&Download Media To Disk"), this, SLOT(downloadLinkToDisk()))->setData(videoUrl); menu->addAction(QIcon::fromTheme("mail-message-new"), tr("&Send Media Address"), this, SLOT(sendLinkByMail()))->setData(videoUrl);
menu->addAction(QIcon::fromTheme("download"), tr("&Download Media To Disk"), this, SLOT(downloadLinkToDisk()))->setData(videoUrl);
return menu; return menu;
} }