~ubuntu-branches/ubuntu/lucid/konversation/lucid-updates

« back to all changes in this revision

Viewing changes to src/irc/channel.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Modestas Vainius
  • Date: 2009-05-15 11:24:24 UTC
  • mfrom: (1.15.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 47.
  • Revision ID: james.westby@ubuntu.com-20090515112424-b74i26lciabf4qnk
Tags: 1.1.75+svn968012-1
* New upstream development snapshot:
  - Last Changed Author: hein
  - Last Changed Rev: 968012
  - Last Changed Date: 2009-05-14 21:03:55 +0300
* Update README.source.
* Use dh --quilt instead of custom patch handling, build depend on
  quilt 0.46-7~.
* Update patches to upstream changes.
* Update konversation.install: remove docs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include <qsplitter.h>
43
43
#include <qcheckbox.h>
44
44
#include <qtimer.h>
45
 
#include <qcombobox.h>
46
45
#include <qtextcodec.h>
47
46
#include <qtoolbutton.h>
48
47
#include <qlayout.h>
61
60
#include <KColorScheme>
62
61
#include <kvbox.h>
63
62
#include <khbox.h>
 
63
#include <kcombobox.h>
64
64
 
65
65
bool nickTimestampLessThan(const Nick* nick1, const Nick* nick2)
66
66
{
239
239
    commandLineBox = new KHBox(this);
240
240
    commandLineBox->setSpacing(spacing());
241
241
 
242
 
    nicknameCombobox = new QComboBox(commandLineBox);
 
242
    nicknameCombobox = new KComboBox(commandLineBox);
243
243
    nicknameCombobox->setEditable(true);
244
 
    nicknameCombobox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
 
244
    nicknameCombobox->setSizeAdjustPolicy(KComboBox::AdjustToContents);
 
245
    KLineEdit* nicknameComboboxLineEdit = qobject_cast<KLineEdit*>(nicknameCombobox->lineEdit());
 
246
    if (nicknameComboboxLineEdit) nicknameComboboxLineEdit->setClearButtonShown(false);
245
247
    nicknameCombobox->setWhatsThis(i18n("<qt><p>This shows your current nick, and any alternatives you have set up.  If you select or type in a different nickname, then a request will be sent to the IRC server to change your nick.  If the server allows it, the new nickname will be selected.  If you type in a new nickname, you need to press 'Enter' at the end.</p><p>You can add change the alternative nicknames from the <em>Identities</em> option in the <em>File</em> menu.</p></qt>"));
246
248
 
247
249
    awayLabel = new QLabel(i18n("(away)"), commandLineBox);
1371
1373
        }
1372
1374
        else
1373
1375
        {
1374
 
            kWarning() << "Channel::removeNick(): Nickname " << channelNick->getNickname() << " not found!"<< endl;
 
1376
            kWarning() << "Nickname " << channelNick->getNickname() << " not found!"<< endl;
1375
1377
        }
1376
1378
    }
1377
1379
}
1378
1380
 
 
1381
void Channel::flushPendingNicks()
 
1382
{
 
1383
    if (m_processingTimer)
 
1384
    {
 
1385
        m_processingTimer->stop();
 
1386
    }
 
1387
 
 
1388
    while (!m_pendingChannelNickLists.isEmpty())
 
1389
    {
 
1390
        processPendingNicks();
 
1391
    }
 
1392
}
 
1393
 
1379
1394
void Channel::kickNick(ChannelNickPtr channelNick, const QString &kicker, const QString &reason)
1380
1395
{
1381
1396
    QString displayReason = reason;
1454
1469
 
1455
1470
        if(nick == 0)
1456
1471
        {
1457
 
            kWarning() << "Channel::kickNick(): Nickname " << channelNick->getNickname() << " not found!"<< endl;
 
1472
            kWarning() << "Nickname " << channelNick->getNickname() << " not found!"<< endl;
1458
1473
        }
1459
1474
        else
1460
1475
        {
1466
1481
 
1467
1482
Nick* Channel::getNickByName(const QString &lookname)
1468
1483
{
1469
 
    QString lcLookname = lookname.toLower();
 
1484
    QString lcLookname(lookname.toLower());
1470
1485
 
1471
1486
    foreach (Nick* nick, nicknameList)
1472
1487
    {
2118
2133
        quickButton->setDefinition(buttonText);
2119
2134
 
2120
2135
        // Add tool tips
2121
 
        QString toolTip=buttonText.replace("&","&amp;").
2122
 
            replace("<","&lt;").
2123
 
            replace(">","&gt;");
 
2136
        QString toolTip=buttonText.replace('&',"&amp;").
 
2137
            replace('<',"&lt;").
 
2138
            replace('>',"&gt;");
2124
2139
 
2125
2140
        quickButton->setToolTip(toolTip);
2126
2141
 
2367
2382
        connect(m_processingTimer, SIGNAL(timeout()), this, SLOT(processPendingNicks()));
2368
2383
    }
2369
2384
 
2370
 
    m_pendingChannelNickLists.append(pendingChannelNickList);
 
2385
    m_pendingChannelNickLists << pendingChannelNickList;
2371
2386
 
2372
2387
    if (!m_processingTimer->isActive())
2373
2388
        m_processingTimer->start(0);
2578
2593
        purgeNicks();
2579
2594
        getTextView()->setNickAndChannelContextMenusEnabled(false);
2580
2595
        nicknameCombobox->setEnabled(false);
2581
 
        topicLine->setText(QString::null);
 
2596
        topicLine->clear();
2582
2597
        clearModeList();
2583
2598
        clearBanList();
2584
2599
    }
2626
2641
                        (halfop ?  2 : 0) +
2627
2642
                        (voice  ?  1 : 0);
2628
2643
 
2629
 
    // Check if nick is already in the nicklist
2630
 
    if (!getNickByName(nickname))
2631
 
    {
2632
 
        ChannelNickPtr nick = m_server->addNickToJoinedChannelsList(getName(), nickname);
2633
 
        Q_ASSERT(nick);
2634
 
        nick->setMode(mode);
2635
 
 
2636
 
        fastAddNickname(nick);
2637
 
 
2638
 
        if (nick->isAdmin() || nick->isOwner() || nick->isOp() || nick->isHalfOp())
2639
 
            m_opsToAdd++;
2640
 
 
2641
 
        m_currentIndex++;
2642
 
    }
2643
 
    else
2644
 
    {
2645
 
        m_pendingChannelNickLists.first().pop_front();
2646
 
    }
 
2644
    ChannelNickPtr nick = m_server->addNickToJoinedChannelsList(getName(), nickname);
 
2645
    Q_ASSERT(nick);
 
2646
    nick->setMode(mode);
 
2647
 
 
2648
    fastAddNickname(nick);
 
2649
 
 
2650
    if (nick->isAdmin() || nick->isOwner() || nick->isOp() || nick->isHalfOp())
 
2651
        m_opsToAdd++;
 
2652
 
 
2653
    m_currentIndex++;
2647
2654
 
2648
2655
    if (m_pendingChannelNickLists.first().count() <= m_currentIndex)
2649
2656
    {