summaryrefslogtreecommitdiff
authorwazlaf <wazlaf>2002-10-16 21:28:25 (UTC)
committer wazlaf <wazlaf>2002-10-16 21:28:25 (UTC)
commit98bf2fd8027b5e10a82c0f4bde27d7977b919bcc (patch) (unidiff)
treef512cd6b1d66ed69a33b57e2ffa07eb8a7e4dbb4
parentfd6aee0559a2f2f68b14f9913ebbf482c2561572 (diff)
downloadopie-98bf2fd8027b5e10a82c0f4bde27d7977b919bcc.zip
opie-98bf2fd8027b5e10a82c0f4bde27d7977b919bcc.tar.gz
opie-98bf2fd8027b5e10a82c0f4bde27d7977b919bcc.tar.bz2
qwhatsthis fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircservertab.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index a46f105..5aa447f 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -1,116 +1,116 @@
1#include <qpe/config.h> 1#include <qpe/config.h>
2#include <qtextstream.h> 2#include <qtextstream.h>
3#include <qwhatsthis.h> 3#include <qwhatsthis.h>
4#include "ircservertab.h" 4#include "ircservertab.h"
5 5
6IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { 6IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
7 m_server = server; 7 m_server = server;
8 m_session = new IRCSession(&m_server); 8 m_session = new IRCSession(&m_server);
9 m_mainWindow = mainWindow; 9 m_mainWindow = mainWindow;
10 m_close = FALSE; 10 m_close = FALSE;
11 m_lines = 0; 11 m_lines = 0;
12 m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); 12 m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>");
13 m_textview = new QTextView(this); 13 m_textview = new QTextView(this);
14 m_textview->setHScrollBarMode(QScrollView::AlwaysOff); 14 m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
15 m_textview->setVScrollBarMode(QScrollView::AlwaysOn); 15 m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
16 m_textview->setTextFormat(RichText); 16 m_textview->setTextFormat(RichText);
17 QWhatsThis::add(m_textview, tr("Server messages")); 17 QWhatsThis::add(m_textview, tr("Server messages"));
18 m_layout->add(m_textview); 18 m_layout->add(m_textview);
19 m_field = new IRCHistoryLineEdit(this); 19 m_field = new IRCHistoryLineEdit(this);
20 QWhatsThis::add(m_textview, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); 20 QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help"));
21 m_layout->add(m_field); 21 m_layout->add(m_field);
22 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 22 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
23 m_field->setFocus(); 23 m_field->setFocus();
24 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); 24 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
25 settingsChanged(); 25 settingsChanged();
26} 26}
27 27
28void IRCServerTab::appendText(QString text) { 28void IRCServerTab::appendText(QString text) {
29 /* not using append because it creates layout problems */ 29 /* not using append because it creates layout problems */
30 QString txt = m_textview->text() + text + "\n"; 30 QString txt = m_textview->text() + text + "\n";
31 if (m_maxLines > 0 && m_lines >= m_maxLines) { 31 if (m_maxLines > 0 && m_lines >= m_maxLines) {
32 int firstBreak = txt.find('\n'); 32 int firstBreak = txt.find('\n');
33 if (firstBreak != -1) { 33 if (firstBreak != -1) {
34 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); 34 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
35 } 35 }
36 } else { 36 } else {
37 m_lines++; 37 m_lines++;
38 } 38 }
39 m_textview->setText(txt); 39 m_textview->setText(txt);
40 m_textview->ensureVisible(0, m_textview->contentsHeight()); 40 m_textview->ensureVisible(0, m_textview->contentsHeight());
41 emit changed(this); 41 emit changed(this);
42} 42}
43 43
44IRCServerTab::~IRCServerTab() { 44IRCServerTab::~IRCServerTab() {
45 delete m_session; 45 delete m_session;
46} 46}
47 47
48void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { 48void IRCServerTab::removeChannelTab(IRCChannelTab *tab) {
49 m_channelTabs.remove(tab); 49 m_channelTabs.remove(tab);
50} 50}
51 51
52void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { 52void IRCServerTab::removeQueryTab(IRCQueryTab *tab) {
53 m_queryTabs.remove(tab); 53 m_queryTabs.remove(tab);
54} 54}
55 55
56void IRCServerTab::addQueryTab(IRCQueryTab *tab) { 56void IRCServerTab::addQueryTab(IRCQueryTab *tab) {
57 m_queryTabs.append(tab); 57 m_queryTabs.append(tab);
58} 58}
59 59
60QString IRCServerTab::title() { 60QString IRCServerTab::title() {
61 return "Server"; 61 return "Server";
62} 62}
63 63
64IRCSession *IRCServerTab::session() { 64IRCSession *IRCServerTab::session() {
65 return m_session; 65 return m_session;
66} 66}
67 67
68IRCServer *IRCServerTab::server() { 68IRCServer *IRCServerTab::server() {
69 return &m_server; 69 return &m_server;
70} 70}
71 71
72void IRCServerTab::settingsChanged() { 72void IRCServerTab::settingsChanged() {
73 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); 73 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
74 m_lines = 0; 74 m_lines = 0;
75} 75}
76 76
77void IRCServerTab::executeCommand(IRCTab *tab, QString line) { 77void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
78 QTextIStream stream(&line); 78 QTextIStream stream(&line);
79 QString command; 79 QString command;
80 stream >> command; 80 stream >> command;
81 command = command.upper().right(command.length()-1); 81 command = command.upper().right(command.length()-1);
82 82
83 if (command == "JOIN") { 83 if (command == "JOIN") {
84 QString channel; 84 QString channel;
85 stream >> channel; 85 stream >> channel;
86 if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { 86 if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) {
87 m_session->join(channel); 87 m_session->join(channel);
88 } else { 88 } else {
89 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); 89 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>");
90 } 90 }
91 } else if (command == "ME") { 91 } else if (command == "ME") {
92 QString text = line.right(line.length()-4); 92 QString text = line.right(line.length()-4);
93 if (text.length() > 0) { 93 if (text.length() > 0) {
94 if (tab->isA("IRCChannelTab")) { 94 if (tab->isA("IRCChannelTab")) {
95 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); 95 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
96 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); 96 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text);
97 } else if (tab->isA("IRCQueryTab")) { 97 } else if (tab->isA("IRCQueryTab")) {
98 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); 98 tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>");
99 m_session->sendAction(((IRCQueryTab *)tab)->person(), text); 99 m_session->sendAction(((IRCQueryTab *)tab)->person(), text);
100 } else { 100 } else {
101 tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>"); 101 tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>");
102 } 102 }
103 } 103 }
104 } else if (command == "MSG") { 104 } else if (command == "MSG") {
105 QString nickname; 105 QString nickname;
106 stream >> nickname; 106 stream >> nickname;
107 if (nickname.length() > 0) { 107 if (nickname.length() > 0) {
108 if (line.length() > 6 + nickname.length()) { 108 if (line.length() > 6 + nickname.length()) {
109 QString text = line.right(line.length()-nickname.length()-6); 109 QString text = line.right(line.length()-nickname.length()-6);
110 IRCPerson person; 110 IRCPerson person;
111 person.setNick(nickname); 111 person.setNick(nickname);
112 tab->appendText("<font color=\"" + m_textColor + "\">&gt;</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(nickname)+"</font><font color=\"" + m_textColor + "\">&lt; "+IRCOutput::toHTML(text)+"</font><br>"); 112 tab->appendText("<font color=\"" + m_textColor + "\">&gt;</font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(nickname)+"</font><font color=\"" + m_textColor + "\">&lt; "+IRCOutput::toHTML(text)+"</font><br>");
113 m_session->sendMessage(&person, text); 113 m_session->sendMessage(&person, text);
114 } 114 }
115 } 115 }
116 } else { 116 } else {