summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircchannellist.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircchannellist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchannellist.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/noncore/net/opieirc/ircchannellist.cpp b/noncore/net/opieirc/ircchannellist.cpp
index 4e13dee..6bef318 100644
--- a/noncore/net/opieirc/ircchannellist.cpp
+++ b/noncore/net/opieirc/ircchannellist.cpp
@@ -11,22 +11,23 @@ void IRCChannelList::update() {
11 QPixmap voice = Resource::loadPixmap("opieirc/voice"); 11 QPixmap voice = Resource::loadPixmap("opieirc/voice");
12 QListIterator<IRCChannelPerson> it = m_channel->people(); 12 QListIterator<IRCChannelPerson> it = m_channel->people();
13 clear(); 13 clear();
14 for (; it.current(); ++it) { 14 for (; it.current(); ++it) {
15 IRCChannelPerson *person = it.current(); 15 IRCChannelPerson *person = it.current();
16 if (person->flags & PERSON_FLAG_OP) { 16 if (person->flags & PERSON_FLAG_OP) {
17 insertItem(op, person->person->nick()); 17 insertItem(op, "1" + person->person->nick());
18 } else if (person->flags & PERSON_FLAG_HALFOP) { 18 } else if (person->flags & PERSON_FLAG_HALFOP) {
19 insertItem(op, person->person->nick()); 19 insertItem(op, "2" + person->person->nick());
20 } else if (person->flags & PERSON_FLAG_VOICE) { 20 } else if (person->flags & PERSON_FLAG_VOICE) {
21 insertItem(voice, person->person->nick()); 21 insertItem(voice, "3" + person->person->nick());
22 } else { 22 } else {
23 insertItem(person->person->nick()); 23 insertItem("4" + person->person->nick());
24 } 24 }
25 } 25 }
26 sort(); 26 sort();
27 adjustNicks();
27} 28}
28 29
29 30
30bool IRCChannelList::hasPerson(QString nick) { 31bool IRCChannelList::hasPerson(QString nick) {
31 for (unsigned int i=0; i<count(); i++) { 32 for (unsigned int i=0; i<count(); i++) {
32 if (text(i) == nick) 33 if (text(i) == nick)
@@ -42,6 +43,23 @@ bool IRCChannelList::removePerson(QString nick) {
42 return TRUE; 43 return TRUE;
43 } 44 }
44 } 45 }
45 return FALSE; 46 return FALSE;
46} 47}
47 48
49void IRCChannelList::adjustNicks() {
50 QString txt;
51 QPixmap pm;
52
53 for(unsigned int i=0; i<count(); i++) {
54 txt = text(i).remove(0,1);
55 if(pixmap(i)) {
56 pm = *pixmap(i);
57 removeItem(i);
58 insertItem(pm, txt, i);
59 }
60 else {
61 removeItem(i);
62 insertItem(txt,i);
63 }
64 }
65}