~ubuntu-branches/ubuntu/raring/konversation/raring-proposed

« back to all changes in this revision

Viewing changes to src/viewer/viewcontainer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-05-24 11:33:21 UTC
  • mfrom: (2.2.13 sid)
  • Revision ID: james.westby@ubuntu.com-20100524113321-b9txnlnyl0ojuy9u
Tags: 1.3~beta1-1ubuntu1
* Merge from Debian Unstable, remaining changes:
  - Add kubuntu_01_default_channels.diff, disable debian_channel.diff
  - Keep message indicator patches, libindicator-dev build-dep
  - Use the Kubuntu docpath (/usr/share/doc/kde)

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
 
169
169
    m_tabWidget->setTabReorderingEnabled(true);
170
170
    m_tabWidget->setTabCloseActivatePrevious(true);
171
 
#if QT_VERSION >= 0x040500
172
171
    m_tabWidget->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
173
 
#endif
174
172
 
175
173
    m_vbox->hide();    //m_tabWidget->hide();
176
174
 
180
178
    m_tabWidget->setCornerWidget(closeBtn, Qt::BottomRightCorner);
181
179
    connect(closeBtn, SIGNAL(clicked()), this, SLOT(closeCurrentView()));
182
180
 
183
 
    connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT (switchView(int)));
 
181
    connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT (viewSwitched(int)));
184
182
    connect(m_tabWidget, SIGNAL(closeRequest(QWidget*)), this, SLOT(closeView(QWidget*)));
185
183
    connect(m_tabWidget, SIGNAL(contextMenu(QWidget*, const QPoint&)), this, SLOT(showViewContextMenu(QWidget*, const QPoint&)));
186
184
    connect(m_tabWidget, SIGNAL(mouseMiddleClick(QWidget*)), this, SLOT(closeViewMiddleClick(QWidget*)));
396
394
    bool noTabBar = (Preferences::self()->tabPlacement()==Preferences::Left);
397
395
    m_tabWidget->setTabBarHidden(noTabBar);
398
396
 
399
 
#if KDE_IS_VERSION(4, 2, 85)
400
 
    m_tabWidget->setDocumentMode(noTabBar);
401
 
#endif
402
 
 
 
397
    m_tabWidget->setDocumentMode(true);
 
398
    
403
399
    if (Preferences::self()->customTabFont())
404
400
        m_tabWidget->setFont(Preferences::self()->tabFont());
405
401
    else
413
409
    else
414
410
        m_tabWidget->cornerWidget()->hide();
415
411
 
416
 
    //FIXME: Change to QTabBar::setTabsClosable() once we depend on Qt 4.5+
417
 
    m_tabWidget->setCloseButtonEnabled(Preferences::self()->closeButtons());
 
412
    m_tabWidget->tabBar()->setTabsClosable(Preferences::self()->closeButtons());
418
413
 
419
414
    m_tabWidget->setAutomaticResizeTabs(Preferences::self()->useMaxSizedTabs());
420
415
}
691
686
        action = actionCollection()->action("close_queries");
692
687
        if (action) action->setEnabled(false);
693
688
    }
 
689
 
 
690
    action = actionCollection()->action("last_focused_tab");
 
691
    if (action) action->setEnabled(m_lastFocusedView != 0);
694
692
}
695
693
 
696
694
void ViewContainer::updateFrontView()
1387
1385
    updateViewActions(m_tabWidget->currentIndex());
1388
1386
}
1389
1387
 
1390
 
void ViewContainer::switchView(int newIndex)
 
1388
void ViewContainer::viewSwitched(int newIndex)
1391
1389
{
1392
1390
    ChatWindow* view = static_cast<ChatWindow*>(m_tabWidget->widget(newIndex));
1393
1391
    if (!view) return;
1394
1392
 
 
1393
    m_lastFocusedView = m_currentView;
 
1394
    m_currentView = view;
 
1395
 
1395
1396
    emit viewChanged(view);
1396
1397
 
1397
1398
    if (m_frontView)
1476
1477
    goToView(m_tabWidget->currentIndex()-1);
1477
1478
}
1478
1479
 
 
1480
void ViewContainer::showNextActiveView()
 
1481
{
 
1482
    if (!m_activeViewOrderList.isEmpty())
 
1483
    {
 
1484
        ChatWindow* prev = m_activeViewOrderList.first();
 
1485
        ChatWindow* view = prev;
 
1486
 
 
1487
        QList<ChatWindow*>::ConstIterator it;
 
1488
 
 
1489
        for (it = m_activeViewOrderList.constBegin(); it != m_activeViewOrderList.constEnd(); ++it)
 
1490
        {
 
1491
            if ((*it)->currentTabNotification() < prev->currentTabNotification())
 
1492
                view = (*it);
 
1493
        }
 
1494
 
 
1495
        m_tabWidget->setCurrentIndex(m_tabWidget->indexOf(view));
 
1496
    }
 
1497
}
 
1498
 
 
1499
void ViewContainer::showLastFocusedView()
 
1500
{
 
1501
    if (m_lastFocusedView)
 
1502
        showView(m_lastFocusedView);
 
1503
}
 
1504
 
 
1505
 
1479
1506
void ViewContainer::moveViewLeft()
1480
1507
{
1481
1508
    int index;
1567
1594
{
1568
1595
    if (view == m_frontView) m_frontView = 0;
1569
1596
 
 
1597
    if (view == m_lastFocusedView)
 
1598
    {
 
1599
        QAction* action = actionCollection()->action("last_focused_tab");
 
1600
        if (action) action->setEnabled(false);
 
1601
    }
 
1602
 
1570
1603
    if (m_tabWidget)
1571
1604
    {
1572
1605
        const int idx = m_tabWidget->indexOf(view);
1857
1890
    {
1858
1891
        nextPage=static_cast<ChatWindow*>(m_tabWidget->widget(i));
1859
1892
 
1860
 
        if(nextPage && nextPage->getTextView())
 
1893
        if (nextPage && nextPage->getTextView())
 
1894
        {
1861
1895
            nextPage->getTextView()->clear();
 
1896
            unsetViewNotification(nextPage);
 
1897
        }
1862
1898
    }
1863
1899
}
1864
1900
 
2087
2123
        Application *konvApp=static_cast<Application *>(KApplication::kApplication());
2088
2124
        connect(konvApp,SIGNAL(catchUrl(const QString&,const QString&,const QDateTime&)),
2089
2125
            m_urlCatcherPanel, SLOT(addUrl(const QString&,const QString&,const QDateTime&)) );
2090
 
        connect(m_urlCatcherPanel, SIGNAL(deleteUrl(const QString&,const QString&)),
2091
 
            konvApp, SLOT(deleteUrl(const QString&,const QString&)) );
 
2126
        connect(m_urlCatcherPanel, SIGNAL(deleteUrl(const QString&,const QString&,const QDateTime&)),
 
2127
            konvApp, SLOT(deleteUrl(const QString&,const QString&,const QDateTime&)) );
2092
2128
        connect(m_urlCatcherPanel, SIGNAL(clearUrlList()),
2093
2129
            konvApp, SLOT(clearUrlList()));
2094
2130
 
2195
2231
    connect(statusView, SIGNAL(sendFile()), server, SLOT(requestDccSend()));
2196
2232
    connect(server, SIGNAL(awayState(bool)), statusView, SLOT(indicateAway(bool)) );
2197
2233
 
2198
 
    // make sure that m_frontServer gets set on adding the first status panel, too,
2199
 
    // since there won't be a switchView happening
 
2234
    // Make sure that m_frontServer gets set on adding the first status panel, too,
 
2235
    // since there won't be a viewSwitched happening.
2200
2236
    if (!m_frontServer) setFrontServer(server);
2201
2237
 
2202
2238
    return statusView;
2226
2262
    else
2227
2263
        server = m_frontServer;
2228
2264
 
2229
 
    if (server) server->reconnect();
 
2265
    if (server) server->reconnectServer();
2230
2266
}
2231
2267
 
2232
2268
void ViewContainer::disconnectFrontServer()
2239
2275
        server = m_frontServer;
2240
2276
 
2241
2277
    if (server && server->isConnected())
2242
 
        server->disconnect();
 
2278
        server->disconnectServer();
2243
2279
}
2244
2280
 
2245
2281
void ViewContainer::showJoinChannelDialog()
2515
2551
    (dynamic_cast<KToggleAction*>(actionCollection()->action("open_nicksonline_window")))->setChecked(false);
2516
2552
}
2517
2553
 
2518
 
void ViewContainer::showNextActiveView()
2519
 
{
2520
 
    if (!m_activeViewOrderList.isEmpty())
2521
 
    {
2522
 
        ChatWindow* prev = m_activeViewOrderList.first();
2523
 
        ChatWindow* view = prev;
2524
 
 
2525
 
        QList<ChatWindow*>::ConstIterator it;
2526
 
 
2527
 
        for (it = m_activeViewOrderList.constBegin(); it != m_activeViewOrderList.constEnd(); ++it)
2528
 
        {
2529
 
            if ((*it)->currentTabNotification() < prev->currentTabNotification())
2530
 
                view = (*it);
2531
 
        }
2532
 
 
2533
 
        m_tabWidget->setCurrentIndex(m_tabWidget->indexOf(view));
2534
 
    }
2535
 
}
2536
 
 
2537
2554
/*!
2538
2555
    \fn ViewContainer::frontServerChanging(Server *newServer)
2539
2556