~ubuntu-branches/ubuntu/oneiric/arora/oneiric

« back to all changes in this revision

Viewing changes to src/tabwidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sune Vuorela
  • Date: 2008-06-29 22:41:06 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080629224106-71n3f1419hlrp5of
Tags: 0.2-1
* Finally a upstream release.
* Use make install instead of handpicking files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
429
429
            this, SLOT(webViewUrlChanged(const QUrl &)));
430
430
    connect(webView->page(), SIGNAL(windowCloseRequested()),
431
431
            this, SLOT(windowCloseRequested()));
432
 
    connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
433
 
            this, SIGNAL(geometryChangeRequested(const QRect &)));
434
432
    connect(webView->page(), SIGNAL(printRequested(QWebFrame *)),
435
433
            this, SIGNAL(printRequested(QWebFrame *)));
 
434
    connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)),
 
435
            this, SLOT(geometryChangeRequestedCheck(const QRect &)));
436
436
    connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)),
437
 
            this, SIGNAL(menuBarVisibilityChangeRequested(bool)));
 
437
            this, SLOT(menuBarVisibilityChangeRequestedCheck(bool)));
438
438
    connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)),
439
 
            this, SIGNAL(statusBarVisibilityChangeRequested(bool)));
 
439
            this, SLOT(statusBarVisibilityChangeRequestedCheck(bool)));
440
440
    connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)),
441
 
            this, SIGNAL(toolBarVisibilityChangeRequested(bool)));
 
441
            this, SLOT(toolBarVisibilityChangeRequestedCheck(bool)));
442
442
 
443
443
    WebViewWithSearch *webViewWithSearch = new WebViewWithSearch(webView, this);
444
444
    addTab(webViewWithSearch, tr("(Untitled)"));
459
459
    return webView;
460
460
}
461
461
 
 
462
void TabWidget::geometryChangeRequestedCheck(const QRect &geometry)
 
463
{
 
464
    if (count() == 1)
 
465
        emit geometryChangeRequested(geometry);
 
466
}
 
467
 
 
468
void TabWidget::menuBarVisibilityChangeRequestedCheck(bool visible)
 
469
{
 
470
    if (count() == 1)
 
471
        emit menuBarVisibilityChangeRequested(visible);
 
472
}
 
473
 
 
474
void TabWidget::statusBarVisibilityChangeRequestedCheck(bool visible)
 
475
{
 
476
    if (count() == 1)
 
477
        emit statusBarVisibilityChangeRequested(visible);
 
478
}
 
479
 
 
480
void TabWidget::toolBarVisibilityChangeRequestedCheck(bool visible)
 
481
{
 
482
    if (count() == 1)
 
483
        emit toolBarVisibilityChangeRequested(visible);
 
484
}
 
485
 
462
486
void TabWidget::reloadAllTabs()
463
487
{
464
488
    for (int i = 0; i < count(); ++i) {
509
533
    if (index < 0 || index >= count())
510
534
        return;
511
535
    WebView *tab = makeNewTab();
512
 
    tab->setUrl(webView(index)->url());
 
536
    tab->loadUrl(webView(index)->url());
513
537
}
514
538
 
515
539
// When index is -1 index chooses the current tab
560
584
 
561
585
QLabel *TabWidget::animationLabel(int index, bool addMovie)
562
586
{
563
 
#if QT_VERSION >= 0x040500
 
587
#if QT_VERSION < 0x040500
 
588
    Q_UNUSED(index);
 
589
    Q_UNUSED(addMovie);
 
590
    return 0;
 
591
#else
564
592
    if (-1 == index)
565
593
        return 0;
566
594
    QTabBar::ButtonPosition side = m_tabBar->freeSide();
634
662
    WebView *webView = qobject_cast<WebView*>(sender());
635
663
    int index = webViewIndex(webView);
636
664
    if (-1 != index) {
 
665
        QString tabTitle = title;
637
666
        if (title.isEmpty())
638
 
            setTabText(index, webView->url().toString());
639
 
        else
640
 
            setTabText(index, title);
 
667
            tabTitle = webView->url().toString();
 
668
        tabTitle.replace(QLatin1Char('&'), QLatin1String("&&"));
 
669
        setTabText(index, tabTitle);
641
670
    }
642
671
    if (currentIndex() == index)
643
672
        emit setCurrentTitle(title);
682
711
    loadUrl(url, NewTab);
683
712
}
684
713
 
685
 
 
 
714
#if QT_VERSION < 0x040500
686
715
void TabWidget::contextMenuEvent(QContextMenuEvent *event)
687
716
{
688
717
    if (!childAt(event->pos())) {
692
721
    QTabWidget::contextMenuEvent(event);
693
722
}
694
723
 
695
 
#if QT_VERSION < 0x040500
696
724
void TabWidget::mouseDoubleClickEvent(QMouseEvent *event)
697
725
{
698
726
    m_tabBar->mouseDoubleClickEvent(event);
737
765
    }
738
766
 
739
767
    if (webView) {
740
 
        webView->loadUrl(url);
 
768
        webView->loadUrl(url, title);
741
769
        webView->setFocus();
742
 
        if (!title.isEmpty()) {
743
 
            int tabIndex = webViewIndex(webView);
744
 
            setTabText(tabIndex, title);
745
 
        }
746
770
    }
747
771
}
748
772