void WebView::contextMenuEvent ( QContextMenuEvent * event ) { QMenu menu; QPoint pos = event->pos(); QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent( pos ); if (!hitTest.linkElement().isNull()) { menu.addAction( pageAction(QWebPage::CopyLinkToClipboard) ); menu.addSeparator(); } if (hitTest.isContentEditable() || hitTest.isContentSelected()) { menu.addAction( pageAction(QWebPage::Copy) ); if (hitTest.isContentEditable()) menu.addAction( pageAction(QWebPage::Paste) ); menu.addSeparator(); } menu.addAction( pageAction(QWebPage::Back) ); menu.addAction( pageAction(QWebPage::Forward) ); menu.addAction( pageAction(QWebPage::Reload) ); menu.exec( event->globalPos() ); }
void WebView::contextMenuEvent(QContextMenuEvent *event) { QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); if (!r.linkUrl().isEmpty()) { QMenu menu(this); menu.addAction(pageAction(QWebPage::OpenLink)); // building a custom signal for external browser action QSignalMapper* signalMapper = new QSignalMapper (this); signalMapper->setProperty("url", QVariant(r.linkUrl())); connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(triggerContextMenuAction(int))); QAction* extAction = menu.addAction(tr("Open in External Browser")); connect (extAction, SIGNAL(triggered()), signalMapper, SLOT(map())); signalMapper->setMapping(extAction, QWebPage::OpenLink); QAction* newAction = menu.addAction(tr("Open in new window")); connect (newAction, SIGNAL(triggered()), signalMapper, SLOT(map())); signalMapper->setMapping(newAction, QWebPage::OpenLinkInNewWindow); menu.addAction(pageAction(QWebPage::DownloadLinkToDisk)); menu.addAction(pageAction(QWebPage::CopyLinkToClipboard)); menu.exec(mapToGlobal(event->pos())); return; }
void WebView::contextMenuEvent(QContextMenuEvent* event) { if (isLoading_) return; QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); QMenu *menu; if (!r.linkUrl().isEmpty()) { if (r.linkUrl().scheme() == "addnick") { event->ignore(); return; } menu = URLObject::getInstance()->createPopupMenu(r.linkUrl().toEncoded()); //menu->addAction(pageAction(QWebPage::CopyLinkToClipboard)); } else { menu = new QMenu(this); if (!page()->selectedText().isEmpty()) { menu->addAction(pageAction(QWebPage::Copy)); } else { if (!menu->isEmpty()) { menu->addSeparator(); } menu->addAction(pageAction(QWebPage::SelectAll)); } if (settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) { menu->addAction(pageAction(QWebPage::InspectElement)); } } menu->addAction(pageAction(QWebPage::Reload)); menu->exec(mapToGlobal(event->pos())); event->accept(); delete menu; }
void tab::contextMenuRequest(QPoint pos) { clickPos = pos; QMenu menu; QWebHitTestResult r = webView->page()->mainFrame()->hitTestContent(pos); if(!r.linkUrl().isEmpty()) { menu.addAction(tr("Open in New Tab"), this, SLOT(openLinkInNewTab())); menu.addAction(webView->pageAction(QWebPage::DownloadLinkToDisk)); menu.addAction(webView->pageAction(QWebPage::CopyLinkToClipboard)); } if(!r.imageUrl().isEmpty()) { menu.addSeparator(); menu.addAction(webView->pageAction(QWebPage::DownloadImageToDisk)); menu.addAction(webView->pageAction(QWebPage::CopyImageToClipboard)); menu.addAction(webView->pageAction(QWebPage::CopyImageUrlToClipboard)); } menu.addSeparator(); menu.addAction(webView->pageAction(QWebPage::InspectElement)); menu.exec(webView->mapToGlobal(pos)); }
QWebFrame *QtScrollerFilter::scrollingFrameAt_QWebView(QWebView *view, const QPoint &pos) const { if (!view->page()) return 0; QWebFrame *mainFrame = view->page()->mainFrame(); QWebHitTestResult hitTest = mainFrame->hitTestContent(pos); QWebFrame *hitFrame = hitTest.frame(); if (!hitFrame) return 0; QRect vsbrect = hitFrame->scrollBarGeometry(Qt::Vertical); QRect hsbrect = hitFrame->scrollBarGeometry(Qt::Horizontal); if (!vsbrect.isEmpty() && vsbrect.contains(hitTest.pos() - hitFrame->scrollPosition())) return 0; if (!hsbrect.isEmpty() && hsbrect.contains(hitTest.pos() - hitFrame->scrollPosition())) return 0; QSize range = hitFrame->contentsSize() - hitFrame->geometry().size(); while (hitFrame && range.width() <= 1 && range.height() <= 1) hitFrame = hitFrame->parentFrame(); return hitFrame; }
void SearchPage::showBrowserContextMenu(const QPoint &pos) { const QWebHitTestResult result = m_browser->page()->mainFrame()->hitTestContent(pos); const QString url = result.linkUrl().toString(); if (url.isEmpty()) { return; } QMenu menu(this); QAction *copyAction = menu.addAction(QIcon::fromTheme("edit-copy"), tr("&Copy URL")); QAction *addAction = menu.addAction(QIcon::fromTheme("list-add"), tr("&Add URL")); QAction *retrieveAction = menu.addAction(QIcon::fromTheme("folder-remote"), tr("&Retrieve URLs")); QAction *downloadAction = menu.addAction(QIcon::fromTheme("download"), tr("Retrieve &download requests")); QAction *action = menu.exec(m_browser->mapToGlobal(pos)); if (!action) { return; } if (action == copyAction) { copyUrl(url); } else if (action == addAction) { addUrl(url); } else if (action == retrieveAction) { retrieveUrls(url); } else if (action == downloadAction) { fetchDownloadRequests(url); } }
void CopyTitle::populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitTestResult &r) { m_view = view; if (!r.linkUrl().isEmpty() || r.isContentEditable()) { return; } QString title; if (!r.imageUrl().isEmpty()) { QString m_userFileName = r.imageUrl().toString().trimmed(); int pos = m_userFileName.lastIndexOf(QLatin1Char('/')); if (pos != -1) { int size = m_userFileName.size(); title = m_userFileName.right(size - pos - 1); } else { title += "image"; } } else { title = view->title(); } menu->addAction(QIcon::fromTheme("edit-copy"), !r.imageUrl().isEmpty() ? tr("Copy Image Name") : tr("Copy Page Title"), this, SLOT(copyPageTitle()))->setData(title); }
QString ViewWindow::anchorAt(const QPoint & pos) { QWebHitTestResult res = page()->currentFrame()->hitTestContent( pos ); if ( !res.linkUrl().isValid() ) return QString::null; return res.linkUrl().path(); }
void WBWebTrapWebView::trapElementAtPos(const QPoint& pos) { QWebHitTestResult htr = page()->currentFrame()->hitTestContent(pos); if (!htr.pixmap().isNull()) { emit pixmapCaptured(htr.pixmap(), false); } else if (mCurrentContentType == ObjectOrEmbed) { QString embedSelector = QString("document.elementFromPoint(%1, %2)").arg(pos.x()).arg(pos.y()); QVariant tagName = page()->currentFrame()->evaluateJavaScript(embedSelector + ".tagName"); QVariant innerHTML = page()->currentFrame()->evaluateJavaScript(embedSelector + ".innerHTML"); qDebug() << "innerHTML" << innerHTML; if (tagName.toString().toLower() == "object") { embedSelector = QString("document.elementFromPoint(%1, %2).getElementsByTagName('object')[0]") .arg(pos.x()).arg(pos.y()); } QString querySource = embedSelector + ".src"; QVariant resSource = page()->currentFrame()->evaluateJavaScript(querySource); qDebug() << "resSource" << resSource; QString source = resSource.toString(); QString queryType = embedSelector + ".type"; QVariant resType = page()->currentFrame()->evaluateJavaScript(queryType); QString type = resType.toString(); qDebug() << "resType" << resType; if (source.trimmed().length() > 0) { emit objectCaptured(QUrl(page()->currentFrame()->url().toString() + "/" + source), type, htr.boundingRect().width(), htr.boundingRect().height()); UBApplication::boardController->downloadURL(QUrl(source), QPointF(0.0, 0.0)); UBApplication::applicationController->showBoard(); } } else if (mCurrentContentType == Input) { QString embedCode = potentialEmbedCodeAtPos(pos); if (embedCode.length() > 0) { emit embedCodeCaptured(embedCode); } } else if (mCurrentContentType == ElementByQuery) { webElementCaptured(page()->currentFrame()->url(), mElementQuery); } }
void WebView::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::MidButton) { QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); if (!r.linkUrl().isEmpty()) { openLinkInNewWindow(r.linkUrl()); return; } } QWebView::mousePressEvent(event); }
static QMenu* createContextMenu(QWebPage* page, QPoint position) { QMenu* menu = page->createStandardContextMenu(); QWebHitTestResult r = page->mainFrame()->hitTestContent(position); if (!r.linkUrl().isEmpty()) { WebPage* webPage = qobject_cast<WebPage*>(page); QAction* newTabAction = menu->addAction("Open in Default &Browser", webPage, SLOT(openUrlInDefaultBrowser())); newTabAction->setData(r.linkUrl()); menu->insertAction(menu->actions().at(2), newTabAction); } return menu; }
void ClickToFlash::findElement() { if (!loadButton_) return; QPoint objectPos = page_->view()->mapFromGlobal(loadButton_->mapToGlobal(loadButton_->pos())); QWebFrame* objectFrame = page_->frameAt(objectPos); QWebHitTestResult hitResult; QWebElement hitElement; if (objectFrame) { hitResult = objectFrame->hitTestContent(objectPos); hitElement = hitResult.element(); } if (!hitElement.isNull() && (hitElement.tagName().compare("embed", Qt::CaseInsensitive) == 0 || hitElement.tagName().compare("object", Qt::CaseInsensitive) == 0)) { element_ = hitElement; return; } // HitTestResult failed, trying to find element by src // attribute in elements at all frames on page (less accurate) QList<QWebFrame*> frames; frames.append(objectFrame); frames.append(page_->mainFrame()); while (!frames.isEmpty()) { QWebFrame* frame = frames.takeFirst(); if (!frame) { continue; } QWebElement docElement = frame->documentElement(); QWebElementCollection elements; elements.append(docElement.findAll(QLatin1String("embed"))); elements.append(docElement.findAll(QLatin1String("object"))); foreach (const QWebElement &element, elements) { if (!checkElement(element) && !checkUrlOnElement(element)) { continue; } element_ = element; return; } frames += frame->childFrames(); } }
void ChannelsView::contextMenu(QMenu *menu, const QWebHitTestResult &result) { menu->addSeparator(); const QUrl url = result.linkUrl(); if (url.scheme() == LS("chat") && url.host() == LS("channel")) ChannelMenu::bind(menu, ChatUrls::channel(url), IChannelMenu::ChatViewScope); menu->addSeparator(); if (!result.isContentEditable()) { menu->removeAction(pageAction(QWebPage::SelectAll)); menu->addAction(pageAction(QWebPage::SelectAll)); } }
void csWebView::SendToCGLX() { //printf("Hello at x: %d y: %d\n", hit_pos.x(), hit_pos.y()); QWebFrame *tframe=page()->currentFrame (); QWebHitTestResult hitresult = tframe->hitTestContent ( hit_pos ); if(!hitresult.isNull()) { QPixmap img = hitresult.pixmap(); if(!img.isNull()) { //printf("Width: %d Height: %d Link: %s\n",img.width(), img.height(),hitresult.imageUrl().toString().toStdString().c_str()); emit send_image(img.width(), img.height() , hitresult.imageUrl()); } } }
virtual void contextMenuEvent(QContextMenuEvent* event) { QMenu* menu = page()->createStandardContextMenu(); QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); if (!r.linkUrl().isEmpty()) { QAction* newTabAction = menu->addAction(tr("Open in Default &Browser"), this, SLOT(openUrlInDefaultBrowser())); newTabAction->setData(r.linkUrl()); menu->insertAction(menu->actions().at(2), newTabAction); } menu->exec(mapToGlobal(event->pos())); delete menu; }
/*! Returns the area of the largest element at position (\a x,\a y) that is no larger than \a maxWidth by \a maxHeight pixels. May return an area larger in the case when no smaller element is at the position. */ QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxWidth, int maxHeight) const { QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x, y)); QRect hitRect = hit.boundingRect(); QWebElement element = hit.enclosingBlockElement(); if (maxWidth <= 0) maxWidth = INT_MAX; if (maxHeight <= 0) maxHeight = INT_MAX; while (!element.parent().isNull() && element.geometry().width() <= maxWidth && element.geometry().height() <= maxHeight) { hitRect = element.geometry(); element = element.parent(); } return hitRect; }
void WebView::contextMenuEvent(QContextMenuEvent *event) { QMenu *menu = new QMenu(this); QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); if (!r.linkUrl().isEmpty()) { menu->addAction(tr("Open in New &Window"), this, SLOT(openLinkInNewWindow())); menu->addAction(tr("Open in New &Tab"), this, SLOT(openLinkInNewTab())); menu->addSeparator(); menu->addAction(tr("Save Lin&k"), this, SLOT(downloadLinkToDisk())); menu->addAction(tr("&Bookmark This Link"), this, SLOT(bookmarkLink()))->setData(r.linkUrl().toString()); menu->addSeparator(); menu->addAction(tr("&Copy Link Location"), this, SLOT(copyLinkToClipboard())); if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) menu->addAction(pageAction(QWebPage::InspectElement)); } if (!r.imageUrl().isEmpty()) { if (!menu->isEmpty()) menu->addSeparator(); menu->addAction(tr("Open Image in New &Window"), this, SLOT(openImageInNewWindow())); menu->addAction(tr("Open Image in New &Tab"), this, SLOT(openImageInNewTab())); menu->addSeparator(); menu->addAction(tr("&Save Image"), this, SLOT(downloadImageToDisk())); menu->addAction(tr("&Copy Image"), this, SLOT(copyImageToClipboard())); menu->addAction(tr("C&opy Image Location"), this, SLOT(copyImageLocationToClipboard()))->setData(r.imageUrl().toString()); } #ifdef WEBKIT_TRUNK // i.e. Qt 4.5, but not in Qt 4.5 yet if (menu->isEmpty()) menu = page()->createStandardContextMenu(); #endif if (!menu->isEmpty()) { if (m_page->mainWindow()->menuBar()->isHidden()) { menu->addSeparator(); menu->addAction(m_page->mainWindow()->showMenuBarAction()); } menu->exec(mapToGlobal(event->pos())); delete menu; return; } delete menu; QWebView::contextMenuEvent(event); }
void AdiumThemeView::contextMenuEvent(QContextMenuEvent *event) { QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); QUrl url = r.linkUrl(); if (!url.isEmpty()) { // save current link url in openLinkAction m_openLinkAction->setData(url); QMenu menu(this); menu.addAction(m_openLinkAction); menu.addAction(pageAction(QWebPage::CopyLinkToClipboard)); menu.exec(mapToGlobal(event->pos())); } else { QWebView::contextMenuEvent(event); } }
bool HistoryChatView::onContextMenu(ChatView *view, QMenu *menu, const QWebHitTestResult &result) { ChatId id(view->id()); if (id.type() != ChatId::ChannelId && id.type() != ChatId::UserId) return false; const QWebElement block = result.enclosingBlockElement(); if (!block.hasClass("blocks") || block.hasClass("removed")) return false; const QWebElement container = block.parent(); const qint64 mdate = container.attribute(LS("data-mdate")).toLongLong(); if (!mdate) return false; id.init(container.attribute(LS("id")).toLatin1()); id.setDate(mdate); if (id.type() != ChatId::MessageId) return false; const int permissions = this->permissions(HistoryDB::get(id)); if (permissions == NoPermissions) return false; if (permissions & Remove) { QVariantList data; data << view->id() << (id.hasOid() ? ChatId::toBase32(id.oid().byteArray()) : id.toString()); menu->insertAction(menu->actions().first(), removeAction(data)); } return true; }
// needed for the spellCheck static QVariant execJScript(QWebHitTestResult result, const QString& script) { QWebElement element(result.element()); if (element.isNull()) return QVariant(); return element.evaluateJavaScript(script); }
void GraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* event) { pressPoint = event->pos(); if (pressTime) { pressTimer.start(pressTime, this); parent->setKeepMouseGrab(false); } else { grabMouse(); parent->setKeepMouseGrab(true); } QGraphicsWebView::mousePressEvent(event); QWebHitTestResult hit = page()->mainFrame()->hitTestContent(pressPoint.toPoint()); if (hit.isContentEditable()) parent->forceActiveFocus(); setFocus(); }
static PyObject *meth_QWebHitTestResult_isNull(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { QWebHitTestResult *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QWebHitTestResult, &sipCpp)) { bool sipRes; Py_BEGIN_ALLOW_THREADS sipRes = sipCpp->isNull(); Py_END_ALLOW_THREADS return PyBool_FromLong(sipRes); } }
void WebView::mousePressEvent ( QMouseEvent * event ) { if (isLoading_) return; QWebView::mousePressEvent(event); if (event->buttons() & Qt::LeftButton) { QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); QSize cs = page()->mainFrame()->contentsSize(); QSize vs = page()->viewportSize(); possibleDragging = r.isContentSelected() && QRect(QPoint(0,0), cs - QSize(cs.width()>vs.width()?1:0, cs.height()>vs.height()?1:0) * style()->pixelMetric(QStyle::PM_ScrollBarExtent) ).contains(event->pos()); dragStartPosition = event->pos(); } else { possibleDragging = false; } }
void WebView::contextMenuEvent(QContextMenuEvent *event) { QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); if (!r.linkUrl().isEmpty()) { QMenu menu(this); menu.addAction(pageAction(QWebPage::OpenLinkInNewWindow)); menu.addAction(tr("Open in New Tab"), this, SLOT(openLinkInNewTab())); menu.addSeparator(); menu.addAction(pageAction(QWebPage::DownloadLinkToDisk)); // Add link to bookmarks... menu.addSeparator(); menu.addAction(pageAction(QWebPage::CopyLinkToClipboard)); if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) menu.addAction(pageAction(QWebPage::InspectElement)); menu.exec(mapToGlobal(event->pos())); return; } QWebView::contextMenuEvent(event); }
QWebView *MyTextBrowser::createWindow(QWebPage::WebWindowType type) { QWebHitTestResult r = page()->mainFrame()->hitTestContent(pressPos); if(!r.linkUrl().isEmpty() && type == QWebPage::WebBrowserWindow) { QString cmd = opt.newwindow; if(cmd.isEmpty()) cmd = "pvbrowser"; cmd += " \""; cmd += r.linkUrl().toString();; cmd += "\""; #ifdef PVUNIX //cmd += " &"; int ret = system(cmd.toUtf8()); #endif #ifdef PVWIN32 int ret = mysystem(cmd.toUtf8()); #endif if(ret < 0) printf("ERROR system(%s)", (const char *) cmd.toUtf8()); } return NULL; }
void TestPlugin::populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitTestResult &r) { // Called from WebView when creating context menu m_view = view; QString title; if (!r.imageUrl().isEmpty()) { title += " on image"; } if (!r.linkUrl().isEmpty()) { title += " on link"; } if (r.isContentEditable()) { title += " on input"; } menu->addAction(tr("My first plugin action") + title, this, SLOT(actionSlot())); }
void HelpBrowser::onContextMenuRequest( const QPoint & pos ) { QMenu menu; QWebHitTestResult hitTest = mWebView->page()->mainFrame()->hitTestContent( pos ); if (!hitTest.linkElement().isNull()) { menu.addAction( mWebView->pageAction(QWebPage::CopyLinkToClipboard) ); } menu.addSeparator(); if (hitTest.isContentEditable() || hitTest.isContentSelected()) menu.addAction( mWebView->pageAction(QWebPage::Copy) ); if (hitTest.isContentEditable()) menu.addAction( mWebView->pageAction(QWebPage::Paste) ); if (hitTest.isContentSelected()) menu.addAction( mActions[Evaluate] ); menu.addSeparator(); menu.addAction( mWebView->pageAction(QWebPage::Back) ); menu.addAction( mWebView->pageAction(QWebPage::Forward) ); menu.addAction( mWebView->pageAction(QWebPage::Reload) ); menu.addSeparator(); menu.addAction( mActions[ZoomIn] ); menu.addAction( mActions[ZoomOut] ); menu.addAction( mActions[ResetZoom] ); menu.exec( mWebView->mapToGlobal(pos) ); }
QRectF WebContentAnimationItem::findZoomableRectForPoint(const QPointF& point) { QPointF zoomPoint = m_webView->mapFromParent(point); QWebHitTestResult hitResult = m_webView->page()->mainFrame()->hitTestContent(zoomPoint.toPoint()); QWebElement targetElement = hitResult.enclosingBlockElement(); while (!targetElement.isNull() && targetElement.geometry().width() < MinDoubleClickZoomTargetWidth) targetElement = targetElement.parent(); if (!targetElement.isNull()) { QRectF elementRect = targetElement.geometry(); qreal overMinWidth = elementRect.width() - ZoomableContentMinWidth; if (overMinWidth < 0) elementRect.adjust(overMinWidth / 2, 0, -overMinWidth / 2, 0); zoomPoint.setX(elementRect.x()); QRectF resultRect(zoomPoint, elementRect.size()); return QRectF(m_webView->mapToParent(resultRect.topLeft()), m_webView->mapToParent(resultRect.bottomRight())); } return QRectF(); }
void PIM_Handler::populateWebViewMenu(QMenu* menu, WebView* view, const QWebHitTestResult &hitTest) { m_view = view; m_element = hitTest.element(); if (!hitTest.isContentEditable()) { return; } if (!m_loaded) { loadSettings(); } QMenu* pimMenu = new QMenu(tr("Insert Personal Information")); pimMenu->setIcon(QIcon(":/PIM/data/PIM.png")); if (!m_allInfo[PI_FirstName].isEmpty() && !m_allInfo[PI_LastName].isEmpty()) { const QString fullname = m_allInfo[PI_FirstName] + " " + m_allInfo[PI_LastName]; QAction* action = pimMenu->addAction(fullname, this, SLOT(pimInsert())); action->setData(fullname); } for (int i = 0; i < PI_Max; ++i) { const QString info = m_allInfo[PI_Type(i)]; if (info.isEmpty()) { continue; } QAction* action = pimMenu->addAction(info, this, SLOT(pimInsert())); action->setData(info); action->setStatusTip(m_translations[PI_Type(i)]); } pimMenu->addSeparator(); pimMenu->addAction(tr("Edit"), this, SLOT(showSettings())); menu->addMenu(pimMenu); menu->addSeparator(); }
void ChatView::contextMenu(QMenu *menu, const QWebHitTestResult &result) { menu->addSeparator(); const QUrl url = result.linkUrl(); if (url.scheme() == LS("chat") && url.host() == LS("channel")) Hooks::ChannelMenu::bind(menu, ChatUrls::channel(url), Hooks::ChatViewScope); else Hooks::ChannelMenu::bind(menu, ChatClient::channels()->get(m_id), Hooks::ChatViewScope); menu->addSeparator(); QMenu *display = menu->addMenu(SCHAT_ICON(Gear), tr("Display")); display->addAction(m_seconds); display->addAction(m_service); developerMenu(display); display->removeAction(pageAction(QWebPage::Reload)); menu->addAction(m_autoscroll); menu->addSeparator(); ClientChannel channel = ChatClient::channels()->get(id()); if (channel && channel->data().value(LS("page")) == 1) menu->addAction(m_reload); else menu->addAction(m_clear); if (!result.isContentEditable()) { menu->removeAction(pageAction(QWebPage::SelectAll)); menu->addAction(pageAction(QWebPage::SelectAll)); } menu->removeAction(pageAction(QWebPage::Reload)); menu->removeAction(pageAction(QWebPage::InspectElement)); connect(menu, SIGNAL(triggered(QAction*)), SLOT(menuTriggered(QAction*))); ChatViewHooks::contextMenu(this, menu, result); }