1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Handling Ctrl+Middle clicks on links in keyReleaseEvent.

- fixes problems when you open link in new tab (with middle
  mouse click) and also paste text to focused input element
This commit is contained in:
nowrep 2012-01-24 19:12:31 +01:00
parent a09766a2ee
commit 16526b0177
33 changed files with 1056 additions and 1100 deletions

View File

@ -323,7 +323,7 @@ void QtWin::populateFrequentSites(IObjectCollection* collection, const QString &
{
HistoryModel* historyModel = mApp->history();
QList<HistoryEntry> mostList = historyModel->mostVisited(6);
foreach(const HistoryEntry &entry, mostList)
foreach(const HistoryEntry & entry, mostList)
collection->AddObject(CreateShellLink(entry.title, entry.url.toString(), appPath, " " + entry.url.toEncoded(), appPath, 1));
collection->AddObject(CreateShellLink("", "", "", "", "", 0)); //Spacer

View File

@ -46,7 +46,7 @@ void AdBlockIcon::showMenu(const QPoint &pos)
}
else {
menu.addAction(tr("Blocked URL (AdBlock Rule) - click to edit rule"))->setEnabled(false);
foreach(const WebPage::AdBlockedEntry &entry, entries) {
foreach(const WebPage::AdBlockedEntry & entry, entries) {
QString address = entry.url.toString().right(55);
menu.addAction(tr("%1 with (%2)").arg(address, entry.rule), manager, SLOT(showRule()))->setData(entry.rule);
}

View File

@ -120,7 +120,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
QString startProfile;
if (argc > 1) {
foreach(const CommandLineOptions::ActionPair &pair, cmdActions) {
foreach(const CommandLineOptions::ActionPair & pair, cmdActions) {
switch (pair.action) {
case Qz::CL_StartWithoutAddons:
noAddons = true;
@ -158,7 +158,7 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
}
if (isRunning()) {
foreach(const QString &message, messages) {
foreach(const QString & message, messages) {
sendMessage(message);
}
m_isExited = true;

View File

@ -786,7 +786,7 @@ void QupZilla::aboutToShowClosedTabsMenu()
{
m_menuClosedTabs->clear();
int i = 0;
foreach(const ClosedTabsManager::Tab &tab, m_tabWidget->closedTabsManager()->allClosedTabs()) {
foreach(const ClosedTabsManager::Tab & tab, m_tabWidget->closedTabsManager()->allClosedTabs()) {
QString title = tab.title;
if (title.length() > 40) {
title.truncate(40);
@ -836,7 +836,7 @@ void QupZilla::aboutToShowHistoryMostMenu()
QList<HistoryEntry> mostList = mApp->history()->mostVisited(10);
foreach(const HistoryEntry &entry, mostList) {
foreach(const HistoryEntry & entry, mostList) {
QString title = entry.title;
if (title.length() > 40) {
title.truncate(40);
@ -850,7 +850,7 @@ void QupZilla::aboutToShowHistoryMostMenu()
m_menuHistoryMost->addAction(act);
}
if (m_menuHistoryMost->isEmpty()){
if (m_menuHistoryMost->isEmpty()) {
m_menuHistoryMost->addAction(tr("Empty"))->setEnabled(false);
}
}
@ -964,7 +964,7 @@ void QupZilla::aboutToShowEncodingMenu()
qSort(available);
QString activeCodec = mApp->webSettings()->defaultTextEncoding();
foreach(const QByteArray &name, available) {
foreach(const QByteArray & name, available) {
if (QTextCodec::codecForName(name)->aliases().contains(name)) {
continue;
}
@ -1122,7 +1122,7 @@ void QupZilla::loadFolderBookmarks(Menu* menu)
return;
}
foreach(const Bookmark &b, mApp->bookmarksModel()->folderBookmarks(folder)) {
foreach(const Bookmark & b, mApp->bookmarksModel()->folderBookmarks(folder)) {
tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab);
}
}

View File

@ -265,7 +265,7 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
frames += frame->childFrames();
}
foreach(const QWebElement &formElement, allForms) {
foreach(const QWebElement & formElement, allForms) {
foreach(const QWebElement &inputElement, formElement.findAll("input[type=\"password\"]")) {
passwordName = inputElement.attribute("name");
passwordValue = getValueFromData(outgoingData, inputElement);

View File

@ -282,7 +282,7 @@ void BookmarksToolbar::loadFolderBookmarksInTabs()
return;
}
foreach(const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) {
foreach(const Bookmark & b, m_bookmarksModel->folderBookmarks(folder)) {
p_QupZilla->tabWidget()->addView(b.url, b.title, Qz::NT_NotSelectedTab);
}
}
@ -534,7 +534,7 @@ void BookmarksToolbar::aboutToShowFolderMenu()
menu->clear();
QString folder = menu->title();
foreach(const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) {
foreach(const Bookmark & b, m_bookmarksModel->folderBookmarks(folder)) {
QString title = b.title;
if (title.length() > 40) {
title.truncate(40);
@ -586,7 +586,7 @@ void BookmarksToolbar::refreshMostVisited()
m_menuMostVisited->clear();
QList<HistoryEntry> mostList = m_historyModel->mostVisited(10);
foreach(const HistoryEntry &entry, mostList) {
foreach(const HistoryEntry & entry, mostList) {
QString title = entry.title;
if (title.length() > 40) {
title.truncate(40);

View File

@ -93,7 +93,7 @@ void BookmarksImportDialog::startFetchingIcons()
ui->progressBar->setMaximum(m_exportedBookmarks.count());
int i = 0;
foreach(const Bookmark &b, m_exportedBookmarks) {
foreach(const Bookmark & b, m_exportedBookmarks) {
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setText(0, b.title);
item->setIcon(0, QWebSettings::globalSettings()->webGraphic(QWebSettings::DefaultFrameIconGraphic));
@ -263,7 +263,7 @@ void BookmarksImportDialog::addExportedBookmarks()
model->createFolder(m_exportedBookmarks.at(0).folder);
}
foreach(const Bookmark &b, m_exportedBookmarks) {
foreach(const Bookmark & b, m_exportedBookmarks) {
model->saveBookmark(b.url, b.title, IconProvider::iconFromImage(b.image), b.folder);
}

View File

@ -53,7 +53,7 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const
QList<QNetworkCookie> newList = cookieList;
foreach(const QNetworkCookie &cok, newList) {
foreach(const QNetworkCookie & cok, newList) {
if (m_allowCookiesFromDomain && !QString("." + url.host()).contains(cok.domain().remove("www."))) {
#ifdef COOKIE_DEBUG
qDebug() << "purged for domain mismatch" << cok;

View File

@ -73,7 +73,7 @@ void CookieManager::removeCookie()
if (current->text(1).isEmpty()) { //Remove whole cookie group
QString domain = current->whatsThis(0);
foreach(const QNetworkCookie &cok, m_cookies) {
foreach(const QNetworkCookie & cok, m_cookies) {
if (cok.domain() == domain || cok.domain() == domain.mid(1)) {
m_cookies.removeOne(cok);
}

View File

@ -121,7 +121,7 @@ void DownloadManager::timerEvent(QTimerEvent* event)
}
QTime remaining;
foreach(const QTime &time, remTimes) {
foreach(const QTime & time, remTimes) {
if (time > remaining) {
remaining = time;
}

View File

@ -55,7 +55,7 @@ int main(int argc, char* argv[])
if (argc > 1) {
CommandLineOptions cmd(argc, argv);
cmdActions = cmd.getActions();
foreach(const CommandLineOptions::ActionPair &pair, cmdActions) {
foreach(const CommandLineOptions::ActionPair & pair, cmdActions) {
switch (pair.action) {
case Qz::CL_ExitAction:
return 0;

View File

@ -58,7 +58,7 @@ QStringList LocationCompleter::splitPath(const QString &path) const
titleSearching = true;
}
QString prefix = url.mid(0, url.indexOf(path));
foreach(const QString &string, returned) {
foreach(const QString & string, returned) {
if (titleSearching) {
returned2.append(url);
}
@ -69,7 +69,7 @@ QStringList LocationCompleter::splitPath(const QString &path) const
return returned2;
}
else {
foreach(const QString &string, returned)
foreach(const QString & string, returned)
returned2.append("http://www.google.com/search?client=qupzilla&q=" + string);
return returned2;
}

View File

@ -109,7 +109,7 @@ void WebSearchBar::setupEngines()
m_boxSearchType->clearItems();
foreach(const SearchEngine &en, m_searchManager->allEngines()) {
foreach(const SearchEngine & en, m_searchManager->allEngines()) {
ButtonWithMenu::Item item;
item.icon = en.icon;
item.text = en.name;
@ -158,7 +158,7 @@ void WebSearchBar::completeMenuWithAvailableEngines(QMenu* menu)
QWebFrame* frame = view->page()->mainFrame();
QWebElementCollection elements = frame->documentElement().findAll(QLatin1String("link[rel=search]"));
foreach(const QWebElement &element, elements) {
foreach(const QWebElement & element, elements) {
if (element.attribute("type") != "application/opensearchdescription+xml") {
continue;
}
@ -204,7 +204,7 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
m_menu->clear();
int i = 0;
foreach(QAction* act, tempMenu->actions()) {
foreach(QAction * act, tempMenu->actions()) {
act->setParent(m_menu);
tempMenu->removeAction(act);
m_menu->addAction(act);

View File

@ -83,8 +83,8 @@ private:
SearchEnginesManager* m_searchManager;
QWeakPointer<SearchEnginesDialog> m_searchDialog;
QAction* m_pasteAndGoAction;
QMenu* m_menu;
QAction* m_pasteAndGoAction;
};

View File

@ -138,7 +138,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
}
int errorsIgnored = 0;
foreach(const QSslError &error, errors) {
foreach(const QSslError & error, errors) {
if (m_ignoredCerts.contains(error.certificate())) {
++errorsIgnored;
}
@ -160,7 +160,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
QString certs;
foreach(const QSslError &error, errors) {
foreach(const QSslError & error, errors) {
if (m_localCerts.contains(error.certificate())) {
continue;
}
@ -189,7 +189,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
return;
}
foreach(const QSslError &error, errors) {
foreach(const QSslError & error, errors) {
if (!m_localCerts.contains(error.certificate())) {
addLocalCertificate(error.certificate());
}
@ -414,7 +414,7 @@ void NetworkManager::loadCertificates()
//CA Certificates
m_caCerts = QSslSocket::defaultCaCertificates();
foreach(const QString &path, m_certPaths) {
foreach(const QString & path, m_certPaths) {
#ifdef Q_WS_WIN
// Used from Qt 4.7.4 qsslcertificate.cpp and modified because QSslCertificate::fromPath
// is kind of a bugged on Windows, it does work only with full path to cert file

View File

@ -159,7 +159,7 @@ void SearchEnginesDialog::reloadEngines()
{
ui->treeWidget->clear();
foreach(const SearchEngine &en, m_manager->allEngines()) {
foreach(const SearchEngine & en, m_manager->allEngines()) {
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setIcon(0, en.icon);
item->setText(0, en.name);

View File

@ -78,7 +78,7 @@ SearchEngine SearchEnginesManager::engineForShortcut(const QString &shortcut)
return returnEngine;
}
foreach(const Engine &en, m_allEngines) {
foreach(const Engine & en, m_allEngines) {
if (en.shortcut == shortcut) {
returnEngine = en;
break;
@ -326,7 +326,7 @@ void SearchEnginesManager::saveSettings()
QSqlQuery query;
query.exec("DELETE FROM search_engines");
foreach(const Engine &en, m_allEngines) {
foreach(const Engine & en, m_allEngines) {
query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters) VALUES (?, ?, ?, ?, ?, ?)");
query.bindValue(0, en.name);
query.bindValue(1, IconProvider::iconToBase64(en.icon));

View File

@ -205,7 +205,7 @@ void ClickToFlash::findElement()
elements.append(docElement.findAll(QLatin1String("embed")));
elements.append(docElement.findAll(QLatin1String("object")));
foreach(const QWebElement &element, elements) {
foreach(const QWebElement & element, elements) {
if (!checkElement(element) && !checkUrlOnElement(element)) {
continue;
}
@ -251,7 +251,7 @@ bool ClickToFlash::checkUrlOnElement(QWebElement el)
bool ClickToFlash::checkElement(QWebElement el)
{
if (m_argumentNames == el.attributeNames()) {
foreach(const QString &name, m_argumentNames) {
foreach(const QString & name, m_argumentNames) {
if (m_argumentValues.indexOf(el.attribute(name)) == -1) {
return false;
}
@ -271,7 +271,7 @@ void ClickToFlash::showInfo()
lay->addRow(new QLabel(tr("<b>Attribute Name</b>")), new QLabel(tr("<b>Value</b>")));
int i = 0;
foreach(const QString &name, m_argumentNames) {
foreach(const QString & name, m_argumentNames) {
QString value = m_argumentValues.at(i);
SqueezeLabelV2* valueLabel = new SqueezeLabelV2(value);
valueLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);

View File

@ -54,7 +54,7 @@ void Plugins::loadPlugins()
QDir pluginsDir = QDir(mApp->PLUGINSDIR);
foreach(const QString &fileName, pluginsDir.entryList(QDir::Files)) {
foreach(const QString & fileName, pluginsDir.entryList(QDir::Files)) {
m_availablePluginFileNames.append(fileName);
if (!m_allowedPluginFileNames.contains(fileName)) {

View File

@ -154,7 +154,7 @@ QString SpeedDial::initialScript()
QStringList entries = m_allPages.split("\";");
foreach(const QString &entry, entries) {
foreach(const QString & entry, entries) {
if (entry.isEmpty()) {
continue;
}

View File

@ -78,7 +78,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
settings.beginGroup("Language");
QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList();
foreach(const QString &code, langs) {
foreach(const QString & code, langs) {
QString code_ = code;
QLocale loc = QLocale(code_.replace("-", "_"));
QString label;

View File

@ -56,7 +56,7 @@ PluginsList::PluginsList(QWidget* parent)
QStringList whitelist = mApp->plugins()->c2f_getWhiteList();
ui->allowClick2Flash->setChecked(settings.value("Enable", true).toBool());
settings.endGroup();
foreach(const QString &site, whitelist) {
foreach(const QString & site, whitelist) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->whitelist);
item->setText(0, site);
}
@ -126,7 +126,7 @@ void PluginsList::refresh()
QStringList availablePlugins = mApp->plugins()->getAvailablePlugins();
QStringList allowedPlugins = mApp->plugins()->getAllowedPlugins();
foreach(const QString &fileName, availablePlugins) {
foreach(const QString & fileName, availablePlugins) {
PluginInterface* plugin = mApp->plugins()->getPlugin(fileName);
if (!plugin) {
continue;

View File

@ -160,7 +160,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->startProfile->addItem(actProfileName);
QDir profilesDir(mApp->PROFILEDIR + "profiles/");
QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach(const QString &name, list_) {
foreach(const QString & name, list_) {
if (actProfileName == name) {
continue;
}
@ -346,7 +346,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
QDir lanDir(mApp->TRANSLATIONSDIR);
QStringList list = lanDir.entryList(QStringList("*.qm"));
foreach(const QString &name, list) {
foreach(const QString & name, list) {
if (name.startsWith("qt_") || name == activeLanguage) {
continue;
}

View File

@ -76,7 +76,7 @@ void SSLManager::refreshCAList()
ui->caList->clear();
m_caCerts = QSslSocket::defaultCaCertificates();
foreach(const QSslCertificate &cert, m_caCerts) {
foreach(const QSslCertificate & cert, m_caCerts) {
QListWidgetItem* item = new QListWidgetItem(ui->caList);
item->setText(CertificateInfoWidget::certificateItemText(cert));
item->setWhatsThis(QString::number(m_caCerts.indexOf(cert)));
@ -93,7 +93,7 @@ void SSLManager::refreshLocalList()
ui->localList->clear();
m_localCerts = mApp->networkManager()->getLocalCertificates();
foreach(const QSslCertificate &cert, m_localCerts) {
foreach(const QSslCertificate & cert, m_localCerts) {
QListWidgetItem* item = new QListWidgetItem(ui->localList);
item->setText(CertificateInfoWidget::certificateItemText(cert));
item->setWhatsThis(QString::number(m_localCerts.indexOf(cert)));
@ -106,7 +106,7 @@ void SSLManager::refreshLocalList()
void SSLManager::refreshPaths()
{
foreach(const QString &path, mApp->networkManager()->certificatePaths()) {
foreach(const QString & path, mApp->networkManager()->certificatePaths()) {
ui->pathList->addItem(path);
}
}

View File

@ -42,7 +42,7 @@ ThemeManager::ThemeManager(QWidget* parent)
QDir themeDir(mApp->THEMESDIR);
QStringList list = themeDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
foreach(const QString &name, list) {
foreach(const QString & name, list) {
Theme themeInfo = parseTheme(name);
if (!themeInfo.isValid) {
continue;

View File

@ -134,7 +134,7 @@ void ButtonWithMenu::generateMenu()
{
m_menu->clear();
foreach(const Item &item, m_items) {
foreach(const Item & item, m_items) {
QVariant variant;
variant.setValue<Item>(item);
m_menu->addAction(item.icon, item.text, this, SLOT(setCurrentItem()))->setData(variant);

View File

@ -40,7 +40,7 @@ void IconProvider::saveIcon(WebView* view)
return;
}
foreach(const Icon &ic, m_iconBuffer) {
foreach(const Icon & ic, m_iconBuffer) {
if (ic.url == item.url && ic.image == item.image) {
return;
}
@ -51,7 +51,7 @@ void IconProvider::saveIcon(WebView* view)
QImage IconProvider::iconForUrl(const QUrl &url)
{
foreach(const Icon &ic, m_iconBuffer) {
foreach(const Icon & ic, m_iconBuffer) {
if (ic.url == url) {
return ic.image;
}
@ -70,7 +70,7 @@ QImage IconProvider::iconForUrl(const QUrl &url)
QImage IconProvider::iconForDomain(const QUrl &url)
{
foreach(const Icon &ic, m_iconBuffer) {
foreach(const Icon & ic, m_iconBuffer) {
if (ic.url.host() == url.host()) {
return ic.image;
}
@ -87,7 +87,7 @@ QImage IconProvider::iconForDomain(const QUrl &url)
void IconProvider::saveIconsToDatabase()
{
foreach(const Icon &ic, m_iconBuffer) {
foreach(const Icon & ic, m_iconBuffer) {
QSqlQuery query;
query.prepare("SELECT id FROM icons WHERE url = ?");
query.bindValue(0, ic.url.toEncoded(QUrl::RemoveFragment));

View File

@ -517,7 +517,7 @@ void TabWidget::restoreAllClosedTabs()
QList<ClosedTabsManager::Tab> closedTabs = m_closedTabsManager->allClosedTabs();
foreach(const ClosedTabsManager::Tab &tab, closedTabs) {
foreach(const ClosedTabsManager::Tab & tab, closedTabs) {
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab);
QDataStream historyStream(tab.history);
historyStream >> *weView(index)->history();
@ -541,28 +541,28 @@ bool TabWidget::canRestoreTab()
void TabWidget::aboutToShowClosedTabsMenu()
{
if (!m_closedInsteadOpened) {
aboutToShowTabsMenu();
aboutToShowTabsMenu();
}
else {
m_menuTabs->clear();
int i = 0;
foreach(const ClosedTabsManager::Tab &tab, this->closedTabsManager()->allClosedTabs()) {
QString title = tab.title;
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
m_menuTabs->addAction(_iconForUrl(tab.url), title, this, SLOT(restoreClosedTab()))->setData(i);
i++;
}
m_menuTabs->addSeparator();
if (i == 0) {
m_menuTabs->addAction(tr("Empty"))->setEnabled(false);
}
else {
m_menuTabs->addAction(tr("Restore All Closed Tabs"), this, SLOT(restoreAllClosedTabs()));
m_menuTabs->addAction(tr("Clear list"), this, SLOT(clearClosedTabsList()));
}
m_menuTabs->clear();
int i = 0;
foreach(const ClosedTabsManager::Tab & tab, this->closedTabsManager()->allClosedTabs()) {
QString title = tab.title;
if (title.length() > 40) {
title.truncate(40);
title += "..";
}
m_menuTabs->addAction(_iconForUrl(tab.url), title, this, SLOT(restoreClosedTab()))->setData(i);
i++;
}
m_menuTabs->addSeparator();
if (i == 0) {
m_menuTabs->addAction(tr("Empty"))->setEnabled(false);
}
else {
m_menuTabs->addAction(tr("Restore All Closed Tabs"), this, SLOT(restoreAllClosedTabs()));
m_menuTabs->addAction(tr("Clear list"), this, SLOT(clearClosedTabsList()));
}
}
}

View File

@ -27,7 +27,7 @@ QList<QWebHistoryItem> WebHistoryWrapper::forwardItems(int maxItems, QWebHistory
QUrl lastUrl = history->currentItem().url();
int count = 0;
foreach(const QWebHistoryItem &item, history->forwardItems(maxItems + 5)) {
foreach(const QWebHistoryItem & item, history->forwardItems(maxItems + 5)) {
if (item.url() == lastUrl || count == maxItems) {
continue;
}

View File

@ -289,7 +289,7 @@ void WebPage::cleanBlockedObjects()
{
QStringList findingStrings;
foreach(const AdBlockedEntry &entry, m_adBlockedEntries) {
foreach(const AdBlockedEntry & entry, m_adBlockedEntries) {
if (entry.url.toString().endsWith(".js")) {
continue;
}
@ -309,7 +309,7 @@ void WebPage::cleanBlockedObjects()
QWebElement docElement = mainFrame()->documentElement();
QWebElementCollection elements;
foreach(const QString &s, findingStrings) {
foreach(const QString & s, findingStrings) {
elements.append(docElement.findAll("*[src=\"" + s + "\"]"));
}

View File

@ -520,7 +520,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
QMenu* pageMenu = page()->createStandardContextMenu();
int i = 0;
foreach(QAction* act, pageMenu->actions()) {
foreach(QAction * act, pageMenu->actions()) {
if (act->isSeparator()) {
menu->addSeparator();
continue;
@ -771,35 +771,58 @@ void WebView::mousePressEvent(QMouseEvent* event)
break;
case Qt::MiddleButton: {
QWebFrame* frame = page()->frameAt(event->pos());
if (frame) {
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
if (isUrlValid(link)) {
openUrlInNewTab(link, m_newTabAfterActive ? Qz::NT_NotSelectedTab : Qz::NT_CleanTab);
event->accept();
return;
}
}
#ifdef Q_WS_WIN
else {
QWebFrame* frame = page()->frameAt(event->pos());
if (frame && frame->hitTestContent(event->pos()).linkUrl().isEmpty()) {
// Creating auto scroll on Windows
m_clickedUrl = QUrl();
QWebView::mouseDoubleClickEvent(event);
return;
}
#endif
}
case Qt::LeftButton: {
QWebFrame* frame = page()->frameAt(event->pos());
if (frame) {
m_clickedUrl = frame->hitTestContent(event->pos()).linkUrl();
}
}
default:
break;
}
QWebView::mousePressEvent(event);
}
void WebView::mouseReleaseEvent(QMouseEvent* event)
{
switch (event->button()) {
case Qt::MiddleButton: {
QWebFrame* frame = page()->frameAt(event->pos());
if (frame) {
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
if (m_clickedUrl == link && isUrlValid(link)) {
openUrlInNewTab(link, Qz::NT_NotSelectedTab);
event->accept();
return;
}
}
break;
}
case Qt::LeftButton: {
QWebFrame* frame = page()->frameAt(event->pos());
if (frame && event->modifiers() == Qt::ControlModifier) {
if (frame) {
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
if (isUrlValid(link)) {
openUrlInNewTab(link, m_newTabAfterActive ? Qz::NT_NotSelectedTab : Qz::NT_CleanTab);
event->accept();
return;
if (m_clickedUrl == link && event->modifiers() == Qt::ControlModifier) {
if (isUrlValid(link)) {
openUrlInNewTab(link, m_newTabAfterActive ? Qz::NT_NotSelectedTab : Qz::NT_CleanTab);
event->accept();
return;
}
}
}
@ -810,7 +833,7 @@ void WebView::mousePressEvent(QMouseEvent* event)
break;
}
QWebView::mousePressEvent(event);
QWebView::mouseReleaseEvent(event);
}
void WebView::keyPressEvent(QKeyEvent* event)

View File

@ -108,6 +108,7 @@ protected slots:
protected:
void wheelEvent(QWheelEvent* event);
void mousePressEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void keyPressEvent(QKeyEvent* event);
void resizeEvent(QResizeEvent* event);
@ -143,6 +144,7 @@ private:
QWebElement m_mediaElement;
QWebFrame* m_clickedFrame;
QUrl m_clickedUrl;
bool m_actionsHaveImages;
bool m_newTabAfterActive;

File diff suppressed because it is too large Load Diff