summaryrefslogtreecommitdiffstats
path: root/konversation/src/ignorelistviewitem.cpp
blob: b1a4a7fd7799a60a67608f620db74ad1a1551308 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
*/

/*
  begin:     Die Jun 25 2002
  copyright: (C) 2002 by Dario Abatianni
  email:     eisfuchs@tigress.com
*/

#include "ignorelistviewitem.h"
#include "ignore.h"

#include <tdelocale.h>
#include <kdebug.h>


IgnoreListViewItem::IgnoreListViewItem(TQListView* parent,const TQString& name,int newFlags):
TDEListViewItem(parent,name)
{
    setFlags(newFlags);
}

IgnoreListViewItem::~IgnoreListViewItem()
{
}

void IgnoreListViewItem::setFlag(int flag,bool active)
{
    if(active) m_flags|=flag;
    else m_flags &= ~flag; //any bits that are set in flag will cause those bits in flags to be set to 0
    setFlags(m_flags);
}

void IgnoreListViewItem::setFlags(int newFlags)
{
    m_flags=newFlags;

    TQString flagsStr;
    if(m_flags & Ignore::Channel) flagsStr += i18n("Channel") + ' ';
    if(m_flags & Ignore::Query) flagsStr += i18n("Query") + ' ';
    if(m_flags & Ignore::Notice) flagsStr += i18n("Notice") + ' ';
    if(m_flags & Ignore::CTCP) flagsStr += i18n("CTCP") + ' ';
    if(m_flags & Ignore::DCC) flagsStr += i18n("DCC") + ' ';
    if(m_flags & Ignore::Exception) flagsStr += i18n("Exception") + ' ';
    setText(1,flagsStr);
}

IgnoreListViewItem* IgnoreListViewItem::itemBelow()
{
    return (IgnoreListViewItem*) TQListViewItem::itemBelow();
}