コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: Fxrh/rekonq
void MainWindow::openNext(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers)
{
    QWebHistory *history = currentTab()->view()->history();
    QWebHistoryItem *item = 0;

    if (currentTab()->view()->page()->isOnRekonqPage())
    {
        item = new QWebHistoryItem(history->currentItem());
    }
    else
    {
        if (history->canGoForward())
        {
            item = new QWebHistoryItem(history->forwardItem());
        }
    }

    if(!item)
        return;

    if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
    {
        Application::instance()->loadUrl(item->url(), Rekonq::NewTab);
    }
    else
    {
        history->goToItem(*item);
    }

    updateActions();
}
コード例 #2
0
ファイル: navigationbar.cpp プロジェクト: AlexTalker/qupzilla
void NavigationBar::goForwardInNewTab()
{
    QWebHistory* history = m_window->weView()->page()->history();

    if (!history->canGoForward()) {
        return;
    }

    loadHistoryItemInNewTab(history->forwardItem());
}
コード例 #3
0
ファイル: navigationbar.cpp プロジェクト: naveen246/qupzilla
void NavigationBar::goForwardInNewTab()
{
    QWebHistory* history = p_QupZilla->weView()->page()->history();

    if (!history->canGoForward()) {
        return;
    }

    int itemIndex = WebHistoryWrapper::indexOfItem(history->items(), history->forwardItem());
    if (itemIndex == -1) {
        return;
    }

    goAtHistoryIndexInNewTab(itemIndex);
}
コード例 #4
0
ファイル: MyTextBrowser_v4.cpp プロジェクト: pvbrowser/pvb
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));
}