MiniWeb::MiniWeb(QWidget *parent) : KWebView(parent) { load(QUrl("about:blank")); connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this, SIGNAL(statusBarMessage(QString))); updateConfiguration(); m_vi_mode = true; m_loading = false; connect(this, SIGNAL(loadStarted()), this, SLOT(setLoading())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setNotLoading(bool))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setStatusLoaded(bool))); connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(setPageChanged())); connect(this, SIGNAL(linkMiddleOrCtrlClicked(KUrl)), this, SLOT(openInNewWindow(KUrl))); connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(download(QNetworkRequest))); }
void WebRenderMainWindow::newTab() { // You must make the webview based connections here, because this is the birthplace of new BrowserView BrowserView *newView = new BrowserView(0,isIncognitoMode()); connect(newView,SIGNAL(titleChanged(BrowserView*,QString)),this,SLOT(titleChangeHandler(BrowserView*,QString))); newView->getWebView()->page()->setForwardUnsupportedContent(true); connect(newView->getWebView(),SIGNAL(openInNewTab(QUrl)),this,SLOT(newTab(QUrl))); connect(newView->getWebView(),SIGNAL(openInNewWindow(QUrl)),this,SLOT(newWindow(QUrl))); connect(newView->getWebView()->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(handleDownloadRequest(QNetworkRequest))); connect(newView->getWebView()->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(handleDownloadRequest(QNetworkReply*))); ui->tabWidget->setCurrentIndex(ui->tabWidget->addTab(newView,"New Tab")); }
void WebRenderMainWindow::newTab(QUrl url) { BrowserView *newView = new BrowserView(0,isIncognitoMode()); newView->getWebView()->page()->setForwardUnsupportedContent(true); connect(newView,SIGNAL(titleChanged(BrowserView*,QString)),this,SLOT(titleChangeHandler(BrowserView*,QString))); connect(newView->getWebView(),SIGNAL(openInNewTab(QUrl)),this,SLOT(newTab(QUrl))); connect(newView->getWebView(),SIGNAL(openInNewWindow(QUrl)),this,SLOT(newWindow(QUrl))); connect(newView->getWebView()->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(handleDownloadRequest(QNetworkRequest))); connect(newView->getWebView()->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(handleDownloadRequest(QNetworkReply*))); ui->tabWidget->setCurrentIndex(ui->tabWidget->addTab(newView,"New Tab")); newView->getWebView()->load(url); }
void HistoryPanel::contextMenuItem(const QPoint &pos) { KMenu menu; KAction* action; action = new KAction(KIcon("tab-new"), i18n("Open"), this); connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInCurrentTab())); menu.addAction(action); action = new KAction(KIcon("tab-new"), i18n("Open in New Tab"), this); connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewTab())); menu.addAction(action); action = new KAction(KIcon("window-new"), i18n("Open in New Window"), this); connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewWindow())); menu.addAction(action); action = new KAction(KIcon("edit-copy"), i18n("Copy Link Address"), this); connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(copyToClipboard())); menu.addAction(action); menu.exec(panelTreeView()->mapToGlobal(pos)); }
void zoomWindow::contextMenu(QPoint) { QMenu *menu = new QMenu(this); if (!this->link.isEmpty()) { // Favoris if (m_favorites.contains(link, Qt::CaseInsensitive)) { menu->addAction(QIcon(":/images/icons/remove.png"), tr("Retirer des favoris"), this, SLOT(unfavorite())); menu->addAction(QIcon(":/images/icons/save.png"), tr("Choisir comme image"), this, SLOT(setfavorite())); } else { menu->addAction(QIcon(":/images/icons/add.png"), tr("Ajouter aux favoris"), this, SLOT(favorite())); } // Garder pour plus tard if (m_viewItLater.contains(link, Qt::CaseInsensitive)) { menu->addAction(QIcon(":/images/icons/remove.png"), tr("Ne pas garder pour plus tard"), this, SLOT(unviewitlater())); } else { menu->addAction(QIcon(":/images/icons/add.png"), tr("Garder pour plus tard"), this, SLOT(viewitlater())); } // Ignorer if (m_ignore.contains(link, Qt::CaseInsensitive)) { menu->addAction(QIcon(":/images/icons/showed.png"), tr("Ne plus ignorer"), this, SLOT(unignore())); } else { menu->addAction(QIcon(":/images/icons/hidden.png"), tr("Ignorer"), this, SLOT(ignore())); } menu->addSeparator(); // Onglets menu->addAction(QIcon(":/images/icons/tab-plus.png"), tr("Ouvrir dans un nouvel onglet"), this, SLOT(openInNewTab())); menu->addAction(QIcon(":/images/icons/window.png"), tr("Ouvrir dans une nouvelle fenêtre"), this, SLOT(openInNewWindow())); menu->addAction(QIcon(":/images/icons/browser.png"), tr("Ouvrir dans le navigateur"), this, SLOT(openInBrowser())); } menu->exec(QCursor::pos()); }