diff --git a/bin/locale/cs_CZ.qm b/bin/locale/cs_CZ.qm index 4f432848a..d63994e7b 100644 Binary files a/bin/locale/cs_CZ.qm and b/bin/locale/cs_CZ.qm differ diff --git a/src/app/qupzilla.cpp b/src/app/qupzilla.cpp index 34206a0b1..3e4ce8091 100644 --- a/src/app/qupzilla.cpp +++ b/src/app/qupzilla.cpp @@ -964,7 +964,7 @@ void QupZilla::loadActionUrlInNewNotSelectedTab() } } -void QupZilla::loadFolderBookmarks(Menu *menu) +void QupZilla::loadFolderBookmarks(Menu* menu) { QString folder = BookmarksModel::fromTranslatedFolder(menu->title()); if (folder.isEmpty()) { diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 42663aefb..788ea59ff 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -224,7 +224,7 @@ void BookmarksToolbar::loadFolderBookmarksInTabs() return; } - foreach (Bookmark b, m_bookmarksModel->folderBookmarks(folder)) { + foreach(Bookmark b, m_bookmarksModel->folderBookmarks(folder)) { p_QupZilla->tabWidget()->addView(b.url, b.title, TabWidget::NewNotSelectedTab); } } @@ -476,7 +476,7 @@ void BookmarksToolbar::aboutToShowFolderMenu() menu->clear(); QString folder = menu->title(); - foreach (Bookmark b, m_bookmarksModel->folderBookmarks(folder)) { + foreach(Bookmark b, m_bookmarksModel->folderBookmarks(folder)) { if (b.title.length() > 40) { b.title.truncate(40); b.title += ".."; diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index 5047cef40..740f5b35a 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -99,6 +99,7 @@ void HistoryManager::contextMenuRequested(const QPoint &position) menu.addAction(tr("Open link in actual tab"), getQupZilla(), SLOT(loadActionUrl()))->setData(link); menu.addAction(tr("Open link in new tab"), this, SLOT(loadInNewTab()))->setData(link); menu.addSeparator(); + menu.addAction(tr("Copy address"), this, SLOT(copyUrl()))->setData(link); //Prevent choosing first option with double rightclick QPoint pos = QCursor::pos(); @@ -106,6 +107,13 @@ void HistoryManager::contextMenuRequested(const QPoint &position) menu.exec(p); } +void HistoryManager::copyUrl() +{ + if (QAction* action = qobject_cast(sender())) { + QApplication::clipboard()->setText(action->data().toUrl().toEncoded()); + } +} + void HistoryManager::deleteItem() { foreach(QTreeWidgetItem * item, ui->historyTree->selectedItems()) { diff --git a/src/history/historymanager.h b/src/history/historymanager.h index ede4e3452..05540f6ad 100644 --- a/src/history/historymanager.h +++ b/src/history/historymanager.h @@ -52,6 +52,7 @@ private slots: void clearHistory(); void contextMenuRequested(const QPoint &position); void loadInNewTab(); + void copyUrl(); void historyEntryAdded(const HistoryModel::HistoryEntry &entry); void historyEntryDeleted(const HistoryModel::HistoryEntry &entry); diff --git a/src/plugins/clicktoflash.cpp b/src/plugins/clicktoflash.cpp index 595d7fb2e..4d7fbef25 100644 --- a/src/plugins/clicktoflash.cpp +++ b/src/plugins/clicktoflash.cpp @@ -49,6 +49,10 @@ #include "globalfunctions.h" #include "qupzilla.h" +QUrl ClickToFlash::acceptedUrl; +QStringList ClickToFlash::acceptedArgNames; +QStringList ClickToFlash::acceptedArgValues; + ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, WebPage* parentPage) : QWidget() , m_argumentNames(argumentNames) @@ -95,6 +99,13 @@ ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNam QTimer::singleShot(0, this, SLOT(ensurePluginVisible())); } +bool ClickToFlash::isAlreadyAccepted(const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues) +{ + return (url == acceptedUrl && + argumentNames == acceptedArgNames && + argumentValues == acceptedArgValues); +} + void ClickToFlash::ensurePluginVisible() { // Well, kind of a dirty workaround, but it works. @@ -158,8 +169,21 @@ void ClickToFlash::findElement() return; } + QPoint objectPos = view->mapFromGlobal(m_toolButton->mapToGlobal(m_toolButton->pos())); + QWebFrame* objectFrame = view->page()->frameAt(objectPos); + QWebHitTestResult hitResult = objectFrame->hitTestContent(objectPos); + QWebElement hitElement = hitResult.element(); + + if (!hitElement.isNull()) { + m_element = hitElement; + return; + } + + // HitTestResult failed, trying to find element by src + // attribute in elements at all frames on page (less accurate) + QList frames; - frames.append(view->page()->frameAt(view->mapFromGlobal(m_toolButton->mapToGlobal(m_toolButton->pos())))); + frames.append(objectFrame); m_mainFrame = view->page()->mainFrame(); frames.append(m_mainFrame); @@ -196,6 +220,10 @@ void ClickToFlash::load() QWebElement substitute = m_element.clone(); substitute.setAttribute(QLatin1String("type"), "application/futuresplash"); m_element.replace(substitute); + + acceptedUrl = m_url; + acceptedArgNames = m_argumentNames; + acceptedArgValues = m_argumentValues; } } diff --git a/src/plugins/clicktoflash.h b/src/plugins/clicktoflash.h index 88e00b391..775af958c 100644 --- a/src/plugins/clicktoflash.h +++ b/src/plugins/clicktoflash.h @@ -66,6 +66,8 @@ public: explicit ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, WebPage* parentPage); ~ClickToFlash(); + static bool isAlreadyAccepted(const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues); + private slots: void load(); void customContextMenuRequested(const QPoint &pos); @@ -94,6 +96,11 @@ private: */ const QUrl m_url; + static QUrl acceptedUrl; + static QStringList acceptedArgNames; + static QStringList acceptedArgValues; + + WebPage* m_page; }; diff --git a/src/plugins/webpluginfactory.cpp b/src/plugins/webpluginfactory.cpp index f34c2161b..53196e4f7 100644 --- a/src/plugins/webpluginfactory.cpp +++ b/src/plugins/webpluginfactory.cpp @@ -36,7 +36,7 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons if (mime != "application/x-shockwave-flash") { if (mime != "application/futuresplash") { - qDebug() << "missing mimeType handler for: " << mime; + qDebug() << "WebPluginFactory::create missing mimeType handler for: " << mime; } return 0; } @@ -45,11 +45,16 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons return 0; } - //Click2Flash whitelist + // Click2Flash whitelist QStringList whitelist = mApp->plugins()->c2f_getWhiteList(); if (whitelist.contains(url.host()) || whitelist.contains("www." + url.host()) || whitelist.contains(url.host().remove("www."))) { return 0; } + // Click2Flash already accepted + if (ClickToFlash::isAlreadyAccepted(url, argumentNames, argumentValues)) { + qDebug() << "already accepted"; + return 0; + } WebPluginFactory* factory = const_cast(this); if (!factory) { diff --git a/src/sidebar/historysidebar.cpp b/src/sidebar/historysidebar.cpp index 3da85bedb..51a926d48 100644 --- a/src/sidebar/historysidebar.cpp +++ b/src/sidebar/historysidebar.cpp @@ -92,6 +92,7 @@ void HistorySideBar::contextMenuRequested(const QPoint &position) QMenu menu; menu.addAction(tr("Open link in actual tab"), p_QupZilla, SLOT(loadActionUrl()))->setData(link); menu.addAction(tr("Open link in new tab"), this, SLOT(loadInNewTab()))->setData(link); + menu.addSeparator(); menu.addAction(tr("Copy address"), this, SLOT(copyAddress()))->setData(link); //Prevent choosing first option with double rightclick diff --git a/translations/cs_CZ.ts b/translations/cs_CZ.ts index 3c4afd63f..ea200ac55 100644 --- a/translations/cs_CZ.ts +++ b/translations/cs_CZ.ts @@ -1513,30 +1513,39 @@ nebyl nalezen! Otevřít odkaz v novém panelu - - + Copy url to clipboard + Kopírovat adresu + + + + Copy address + Kopírovat adresu + + + + Today Dnes - - + + This Week Tento týden - - + + This Month Tento měsíc - + Confirmation Potvrzení - + Are you sure to delete all history? Opravdu chcete vymazat celou historii? @@ -1642,25 +1651,25 @@ nebyl nalezen! Otevřít odkaz v novém panelu - + Copy address Kopírovat adresu - - + + Today Dnes - - + + This Week Tento týden - - + + This Month Tento měsíc diff --git a/translations/de_DE.ts b/translations/de_DE.ts index 28b13468f..6439558c1 100644 --- a/translations/de_DE.ts +++ b/translations/de_DE.ts @@ -1509,30 +1509,35 @@ Link in neuem Tab öffnen - - + + Copy address + Link-Adresse kopieren + + + + Today Heute - - + + This Week Diese Woche - - + + This Month Dieser Monat - + Confirmation Bestätigung - + Are you sure to delete all history? Möchten Sie wirklich den gesamten Verlauf löschen? @@ -1638,25 +1643,25 @@ Link in neuem Tab öffnen - + Copy address Link-Adresse kopieren - - + + Today Heute - - + + This Week Diese Woche - - + + This Month Dieser Monat diff --git a/translations/empty.ts b/translations/empty.ts index ed34b86b5..2cb068fb4 100644 --- a/translations/empty.ts +++ b/translations/empty.ts @@ -1454,30 +1454,35 @@ - - + + Copy address + + + + + Today - - + + This Week - - + + This Month - + Confirmation - + Are you sure to delete all history? @@ -1583,25 +1588,25 @@ - + Copy address - - + + Today - - + + This Week - - + + This Month diff --git a/translations/es_ES.ts b/translations/es_ES.ts index ca6e828c2..1de923cb6 100644 --- a/translations/es_ES.ts +++ b/translations/es_ES.ts @@ -1508,30 +1508,35 @@ Abrir enlace en una nueva pestaña - - + + Copy address + Copiar dirección + + + + Today Hoy - - + + This Week Esta semana - - + + This Month Este mes - + Confirmation Confirmación - + Are you sure to delete all history? ¿Está seguro de eliminar todo el historial? @@ -1637,25 +1642,25 @@ Abrir enlace en una nueva pestaña - + Copy address Copiar dirección - - + + Today Hoy - - + + This Week Esta semana - - + + This Month Este mes diff --git a/translations/it_IT.ts b/translations/it_IT.ts index 1c967525e..20ba1f3b3 100644 --- a/translations/it_IT.ts +++ b/translations/it_IT.ts @@ -1500,30 +1500,35 @@ Apri collegamento in una nuova scheda - - + + Copy address + Copia indirizzo + + + + Today Oggi - - + + This Week Questa Settimana - - + + This Month Questo Mese - + Confirmation Conferma - + Are you sure to delete all history? Sei sicuro di voler cancellare tutta la cronologia? @@ -1629,25 +1634,25 @@ Apri collegamento in una nuova scheda - + Copy address Copia indirizzo - - + + Today Oggi - - + + This Week Questa Settimana - - + + This Month Questo Mese diff --git a/translations/nl_NL.ts b/translations/nl_NL.ts index eb78361a6..c4aa3d182 100644 --- a/translations/nl_NL.ts +++ b/translations/nl_NL.ts @@ -1509,30 +1509,35 @@ werd niet gevonden! Open link in nieuw tabblad - - + + Copy address + Kopieer adres + + + + Today Vandaag - - + + This Week Deze week - - + + This Month Deze maand - + Confirmation Bevestiging - + Are you sure to delete all history? Weet u zeker dat u alle geschiedenis wilt verwijderen? @@ -1638,25 +1643,25 @@ werd niet gevonden! Open link in nieuw tabblad - + Copy address Kopieer adres - - + + Today Vandaag - - + + This Week Deze week - - + + This Month Deze maand diff --git a/translations/pl_PL.ts b/translations/pl_PL.ts index 0d4f359bc..12e93da6a 100644 --- a/translations/pl_PL.ts +++ b/translations/pl_PL.ts @@ -1560,30 +1560,35 @@ p, li { white-space: pre-wrap; } Otwórz link w nowej karcie - - + + Copy address + + + + + Today Dziś - - + + This Week W tym tygodniu - - + + This Month W tym miesiącu - + Confirmation Potwierdź - + Are you sure to delete all history? Czy na pewno chcesz usunąć całą historię? @@ -1689,25 +1694,25 @@ p, li { white-space: pre-wrap; } Otwórz link w nowej karcie - + Copy address - - + + Today Dziś - - + + This Week W tym tygodniu - - + + This Month W tym miesiącu diff --git a/translations/sk_SK.ts b/translations/sk_SK.ts index 8b7fad194..fc47a8e0c 100644 --- a/translations/sk_SK.ts +++ b/translations/sk_SK.ts @@ -1214,6 +1214,10 @@ History História + + Copy address + Kopírovať adresu + HistoryModel diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index c0a04e29f..eeb096414 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -1506,30 +1506,35 @@ 在新标签打开链接 - - + + Copy address + 复制地址 + + + + Today 到今天 - - + + This Week 本周 - - + + This Month 本月 - + Confirmation 确认 - + Are you sure to delete all history? 确定删除所有历史吗? @@ -1635,25 +1640,25 @@ 在新标签打开链接 - + Copy address 复制地址 - - + + Today 到今天 - - + + This Week 本周 - - + + This Month 本月