summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircchannellist.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircchannellist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchannellist.cpp37
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
5IRCChannelList::IRCChannelList(IRCChannel *channel, QWidget *parent, const char *name, WFlags f) : QListBox(parent, name, f) {
6 m_channel = channel;
7}
8
9void 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
31bool 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}