void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers) { QWebHistory *history = currentTab()->view()->history(); QWebHistoryItem *item = 0; if (currentTab()->page()->isOnRekonqPage()) { item = new QWebHistoryItem(history->currentItem()); } else { if (history->canGoBack()) { item = new QWebHistoryItem(history->backItem()); } } if(!item) return; if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier) { Application::instance()->loadUrl(item->url(), Rekonq::NewTab); } else { history->goToItem(*item); } updateActions(); }
void NavigationBar::goBackInNewTab() { QWebHistory* history = m_window->weView()->page()->history(); if (!history->canGoBack()) { return; } loadHistoryItemInNewTab(history->backItem()); }
void NavigationBar::goBackInNewTab() { QWebHistory* history = p_QupZilla->weView()->page()->history(); if (!history->canGoBack()) { return; } int itemIndex = WebHistoryWrapper::indexOfItem(history->items(), history->backItem()); if (itemIndex == -1) { return; } goAtHistoryIndexInNewTab(itemIndex); }
void MyTextBrowser::moveContent(int pos) { if(pos >= '\t' || pos < 0) { activateWindow(); char text[16]; text[0] = pos & 0x0ff; text[1] = '\0'; int modifiers = pos & 0x07fffff00; int key = pos & 0x0ff; if ((pos & 0x0ff) == '\t') key = Qt::Key_Tab; else if((pos & 0x0ff) == 0x0d) key = Qt::Key_Return; QKeyEvent pressEvent( QEvent::KeyPress, (Qt::Key) key, (Qt::KeyboardModifiers) modifiers, text); QKeyEvent releaseEvent(QEvent::KeyRelease, (Qt::Key) key, (Qt::KeyboardModifiers) modifiers, text); if((pos & 0x0ff) == '\t') QWidget::setFocus(Qt::TabFocusReason); keyPressEvent(&pressEvent); keyReleaseEvent(&releaseEvent); return; } #ifdef NO_WEBKIT char buf[MAX_PRINTF_LENGTH]; QString myurl; if(opt.arg_debug) printf("moveContent(%d)\n", pos); if (pos == 0 && homeIsSet) { myurl = home; setSource(QUrl(home)); } else if(pos == 1) { forward(); myurl = source().path(); } else if(pos == 2) { backward(); myurl = source().path(); } else if(pos == 3) { reload(); myurl = source().path(); } #else char buf[MAX_PRINTF_LENGTH]; QString myurl; QWebHistory *hist; if(opt.arg_debug) printf("moveContent(%d)\n", pos); if (pos == 0 && homeIsSet) { myurl = home; load(home); } else if(pos == 1) { hist = history(); if(hist != NULL && hist->canGoForward()) myurl = hist->forwardItem().url().toString(); forward(); } else if(pos == 2) { hist = history(); if(hist != NULL && hist->canGoBack()) myurl = hist->backItem().url().toString(); back(); } else if(pos == 3) { hist = history(); if(hist != NULL) myurl = hist->currentItem().url().toString(); reload(); } #endif if(myurl.isEmpty()) return; if(opt.arg_debug) printf("moveContent(%s)\n", (const char *) myurl.toUtf8()); if(myurl.length()+40 > MAX_PRINTF_LENGTH) return; sprintf(buf,"text(%d,\"%s\")\n", id,decode(myurl)); tcp_send(s,buf,strlen(buf)); }