Diffstat (limited to 'noncore/net/opieirc/ircchannellist.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircchannellist.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircchannellist.cpp b/noncore/net/opieirc/ircchannellist.cpp new file mode 100644 index 0000000..e592d05 --- a/dev/null +++ b/noncore/net/opieirc/ircchannellist.cpp | |||
@@ -0,0 +1,37 @@ | |||
1 | #include <qpe/resource.h> | ||
2 | #include <qpixmap.h> | ||
3 | #include "ircchannellist.h" | ||
4 | |||
5 | IRCChannelList::IRCChannelList(IRCChannel *channel, QWidget *parent, const char *name, WFlags f) : QListBox(parent, name, f) { | ||
6 | m_channel = channel; | ||
7 | } | ||
8 | |||
9 | void IRCChannelList::update() { | ||
10 | QPixmap op = Resource::loadPixmap("opieirc/op"); | ||
11 | QPixmap hop = Resource::loadPixmap("opieirc/hop"); | ||
12 | QPixmap voice = Resource::loadPixmap("opieirc/voice"); | ||
13 | QListIterator<IRCChannelPerson> it = m_channel->people(); | ||
14 | clear(); | ||
15 | for (; it.current(); ++it) { | ||
16 | IRCChannelPerson *person = it.current(); | ||
17 | if (person->flags & PERSON_FLAG_OP) { | ||
18 | insertItem(op, person->person->nick()); | ||
19 | } else if (person->flags & PERSON_FLAG_HALFOP) { | ||
20 | insertItem(op, person->person->nick()); | ||
21 | } else if (person->flags & PERSON_FLAG_VOICE) { | ||
22 | insertItem(voice, person->person->nick()); | ||
23 | } else { | ||
24 | insertItem(person->person->nick()); | ||
25 | } | ||
26 | } | ||
27 | sort(); | ||
28 | } | ||
29 | |||
30 | |||
31 | bool IRCChannelList::hasPerson(QString nick) { | ||
32 | for (unsigned int i=0; i<count(); i++) { | ||
33 | if (text(i) == nick) | ||
34 | return TRUE; | ||
35 | } | ||
36 | return FALSE; | ||
37 | } | ||