summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp4
-rw-r--r--noncore/net/opieirc/ircquerytab.cpp3
-rw-r--r--noncore/net/opieirc/ircservertab.cpp3
-rw-r--r--noncore/net/opieirc/irctab.cpp3
-rw-r--r--noncore/net/opieirc/opie-irc.control2
5 files changed, 13 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp
index f19e019..c1964c8 100644
--- a/noncore/net/opieirc/ircchanneltab.cpp
+++ b/noncore/net/opieirc/ircchanneltab.cpp
@@ -1,154 +1,156 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/resource.h> 2#include <qpe/resource.h>
3#include <qcursor.h> 3#include <qcursor.h>
4#include <stdio.h> 4#include <qwhatsthis.h>
5#include <qhbox.h> 5#include <qhbox.h>
6#include "ircchanneltab.h" 6#include "ircchanneltab.h"
7#include "ircservertab.h" 7#include "ircservertab.h"
8 8
9IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { 9IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
10 m_mainWindow = mainWindow; 10 m_mainWindow = mainWindow;
11 m_parentTab = parentTab; 11 m_parentTab = parentTab;
12 m_channel = channel; 12 m_channel = channel;
13 m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); 13 m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>");
14 QHBox *hbox = new QHBox(this); 14 QHBox *hbox = new QHBox(this);
15 m_textview = new QTextView(hbox); 15 m_textview = new QTextView(hbox);
16 m_textview->setHScrollBarMode(QScrollView::AlwaysOff); 16 m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
17 m_textview->setVScrollBarMode(QScrollView::AlwaysOn); 17 m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
18 m_listVisible = TRUE; 18 m_listVisible = TRUE;
19 m_listButton = new QPushButton(">", m_textview); 19 m_listButton = new QPushButton(">", m_textview);
20 m_textview->setCornerWidget(m_listButton); 20 m_textview->setCornerWidget(m_listButton);
21 m_textview->setTextFormat(RichText); 21 m_textview->setTextFormat(RichText);
22 QWhatsThis::add(m_textview, tr("Channel discussion"));
22 connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); 23 connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList()));
23 m_list = new IRCChannelList(m_channel, hbox); 24 m_list = new IRCChannelList(m_channel, hbox);
24 m_list->update(); 25 m_list->update();
25 m_list->setMaximumWidth(LISTWIDTH); 26 m_list->setMaximumWidth(LISTWIDTH);
26 m_field = new IRCHistoryLineEdit(this); 27 m_field = new IRCHistoryLineEdit(this);
28 QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion"));
27 m_popup = new QPopupMenu(m_list); 29 m_popup = new QPopupMenu(m_list);
28 m_lines = 0; 30 m_lines = 0;
29 /* Required so that embedded-style "right" clicks work */ 31 /* Required so that embedded-style "right" clicks work */
30 QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); 32 QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold);
31 connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); 33 connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &)));
32 34
33 /* Construct the popup menu */ 35 /* Construct the popup menu */
34 QPopupMenu *ctcpMenu = new QPopupMenu(m_list); 36 QPopupMenu *ctcpMenu = new QPopupMenu(m_list);
35 m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); 37 m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu);
36 m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); 38 m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery()));
37 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); 39 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing()));
38 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); 40 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion()));
39 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); 41 ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois()));
40 42
41 m_layout->add(hbox); 43 m_layout->add(hbox);
42 hbox->show(); 44 hbox->show();
43 m_layout->add(m_field); 45 m_layout->add(m_field);
44 m_field->setFocus(); 46 m_field->setFocus();
45 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 47 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
46 settingsChanged(); 48 settingsChanged();
47} 49}
48 50
49void IRCChannelTab::appendText(QString text) { 51void IRCChannelTab::appendText(QString text) {
50 /* not using append because it creates layout problems */ 52 /* not using append because it creates layout problems */
51 QString txt = m_textview->text() + text + "\n"; 53 QString txt = m_textview->text() + text + "\n";
52 if (m_maxLines > 0 && m_lines >= m_maxLines) { 54 if (m_maxLines > 0 && m_lines >= m_maxLines) {
53 int firstBreak = txt.find('\n'); 55 int firstBreak = txt.find('\n');
54 if (firstBreak != -1) { 56 if (firstBreak != -1) {
55 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); 57 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
56 } 58 }
57 } else { 59 } else {
58 m_lines++; 60 m_lines++;
59 } 61 }
60 m_textview->setText(txt); 62 m_textview->setText(txt);
61 m_textview->ensureVisible(0, m_textview->contentsHeight()); 63 m_textview->ensureVisible(0, m_textview->contentsHeight());
62 emit changed(this); 64 emit changed(this);
63} 65}
64 66
65IRCChannelTab::~IRCChannelTab() { 67IRCChannelTab::~IRCChannelTab() {
66 m_parentTab->removeChannelTab(this); 68 m_parentTab->removeChannelTab(this);
67} 69}
68 70
69void IRCChannelTab::processCommand() { 71void IRCChannelTab::processCommand() {
70 QString text = m_field->text(); 72 QString text = m_field->text();
71 if (text.length()>0) { 73 if (text.length()>0) {
72 if (session()->isSessionActive()) { 74 if (session()->isSessionActive()) {
73 if (text.startsWith("/") && !text.startsWith("//")) { 75 if (text.startsWith("/") && !text.startsWith("//")) {
74 /* Command mode */ 76 /* Command mode */
75 m_parentTab->executeCommand(this, text);; 77 m_parentTab->executeCommand(this, text);;
76 } else { 78 } else {
77 if (text.startsWith("//")) 79 if (text.startsWith("//"))
78 text = text.right(text.length()-1); 80 text = text.right(text.length()-1);
79 session()->sendMessage(m_channel, m_field->text()); 81 session()->sendMessage(m_channel, m_field->text());
80 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">&gt; "+IRCOutput::toHTML(m_field->text())+"</font><br>"); 82 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">&gt; "+IRCOutput::toHTML(m_field->text())+"</font><br>");
81 } 83 }
82 } else { 84 } else {
83 appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); 85 appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>");
84 } 86 }
85 } 87 }
86 m_field->clear(); 88 m_field->clear();
87} 89}
88 90
89void IRCChannelTab::settingsChanged() { 91void IRCChannelTab::settingsChanged() {
90 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); 92 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
91 m_lines = 0; 93 m_lines = 0;
92} 94}
93 95
94void IRCChannelTab::toggleList() { 96void IRCChannelTab::toggleList() {
95 if (m_listVisible) { 97 if (m_listVisible) {
96 m_list->setMaximumWidth(0); 98 m_list->setMaximumWidth(0);
97 m_listButton->setText("<"); 99 m_listButton->setText("<");
98 } else { 100 } else {
99 m_list->setMaximumWidth(LISTWIDTH); 101 m_list->setMaximumWidth(LISTWIDTH);
100 m_listButton->setText(">"); 102 m_listButton->setText(">");
101 } 103 }
102 m_listVisible = !m_listVisible; 104 m_listVisible = !m_listVisible;
103} 105}
104 106
105void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { 107void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) {
106 switch (mouse) { 108 switch (mouse) {
107 case 1: 109 case 1:
108 break; 110 break;
109 case 2: 111 case 2:
110 m_popup->popup(point); 112 m_popup->popup(point);
111 break; 113 break;
112 }; 114 };
113} 115}
114 116
115void IRCChannelTab::popupQuery() { 117void IRCChannelTab::popupQuery() {
116 if (m_list->currentItem() != -1) { 118 if (m_list->currentItem() != -1) {
117 IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); 119 IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text());
118 if (person) { 120 if (person) {
119 IRCQueryTab *tab = m_parentTab->getTabForQuery(person); 121 IRCQueryTab *tab = m_parentTab->getTabForQuery(person);
120 if (!tab) { 122 if (!tab) {
121 tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); 123 tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent());
122 m_parentTab->addQueryTab(tab); 124 m_parentTab->addQueryTab(tab);
123 m_mainWindow->addTab(tab); 125 m_mainWindow->addTab(tab);
124 } 126 }
125 } 127 }
126 } 128 }
127} 129}
128 130
129void IRCChannelTab::popupPing() { 131void IRCChannelTab::popupPing() {
130} 132}
131 133
132void IRCChannelTab::popupVersion() { 134void IRCChannelTab::popupVersion() {
133} 135}
134 136
135void IRCChannelTab::popupWhois() { 137void IRCChannelTab::popupWhois() {
136} 138}
137 139
138QString IRCChannelTab::title() { 140QString IRCChannelTab::title() {
139 return m_channel->channelname(); 141 return m_channel->channelname();
140} 142}
141 143
142IRCSession *IRCChannelTab::session() { 144IRCSession *IRCChannelTab::session() {
143 return m_parentTab->session(); 145 return m_parentTab->session();
144} 146}
145 147
146void IRCChannelTab::remove() { 148void IRCChannelTab::remove() {
147 if (session()->isSessionActive()) { 149 if (session()->isSessionActive()) {
148 session()->part(m_channel); 150 session()->part(m_channel);
149 } else { 151 } else {
150 m_mainWindow->killTab(this); 152 m_mainWindow->killTab(this);
151 } 153 }
152} 154}
153 155
154IRCChannel *IRCChannelTab::channel() { 156IRCChannel *IRCChannelTab::channel() {
diff --git a/noncore/net/opieirc/ircquerytab.cpp b/noncore/net/opieirc/ircquerytab.cpp
index 869e4f7..21a53dc 100644
--- a/noncore/net/opieirc/ircquerytab.cpp
+++ b/noncore/net/opieirc/ircquerytab.cpp
@@ -1,94 +1,97 @@
1#include <qhbox.h> 1#include <qhbox.h>
2#include <qwhatsthis.h>
2#include "ircquerytab.h" 3#include "ircquerytab.h"
3#include "ircservertab.h" 4#include "ircservertab.h"
4 5
5IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { 6IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
6 m_mainWindow = mainWindow; 7 m_mainWindow = mainWindow;
7 m_parentTab = parentTab; 8 m_parentTab = parentTab;
8 m_lines = 0; 9 m_lines = 0;
9 m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */ 10 m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */
10 m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>"); 11 m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>");
11 QHBox *hbox = new QHBox(this); 12 QHBox *hbox = new QHBox(this);
12 m_textview = new QTextView(hbox); 13 m_textview = new QTextView(hbox);
13 m_textview->setHScrollBarMode(QScrollView::AlwaysOff); 14 m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
14 m_textview->setVScrollBarMode(QScrollView::AlwaysOn); 15 m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
15 m_textview->setTextFormat(RichText); 16 m_textview->setTextFormat(RichText);
17 QWhatsThis::add(m_textview, tr("Private discussion"));
16 m_field = new IRCHistoryLineEdit(this); 18 m_field = new IRCHistoryLineEdit(this);
19 QWhatsThis::add(m_field, tr("Type your text here in order to send a message to the other person"));
17 m_layout->add(hbox); 20 m_layout->add(hbox);
18 hbox->show(); 21 hbox->show();
19 m_layout->add(m_field); 22 m_layout->add(m_field);
20 m_field->setFocus(); 23 m_field->setFocus();
21 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 24 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
22 settingsChanged(); 25 settingsChanged();
23} 26}
24 27
25void IRCQueryTab::appendText(QString text) { 28void IRCQueryTab::appendText(QString text) {
26 /* not using append because it creates layout problems */ 29 /* not using append because it creates layout problems */
27 QString txt = m_textview->text() + text + "\n"; 30 QString txt = m_textview->text() + text + "\n";
28 if (m_maxLines > 0 && m_lines >= m_maxLines) { 31 if (m_maxLines > 0 && m_lines >= m_maxLines) {
29 int firstBreak = txt.find('\n'); 32 int firstBreak = txt.find('\n');
30 if (firstBreak != -1) { 33 if (firstBreak != -1) {
31 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); 34 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
32 } 35 }
33 } else { 36 } else {
34 m_lines++; 37 m_lines++;
35 } 38 }
36 m_textview->setText(txt); 39 m_textview->setText(txt);
37 m_textview->ensureVisible(0, m_textview->contentsHeight()); 40 m_textview->ensureVisible(0, m_textview->contentsHeight());
38 emit changed(this); 41 emit changed(this);
39} 42}
40 43
41IRCQueryTab::~IRCQueryTab() { 44IRCQueryTab::~IRCQueryTab() {
42 m_parentTab->removeQueryTab(this); 45 m_parentTab->removeQueryTab(this);
43 delete m_person; 46 delete m_person;
44} 47}
45 48
46void IRCQueryTab::processCommand() { 49void IRCQueryTab::processCommand() {
47 QString text = m_field->text(); 50 QString text = m_field->text();
48 if (text.length()>0) { 51 if (text.length()>0) {
49 if (session()->isSessionActive()) { 52 if (session()->isSessionActive()) {
50 if (text.startsWith("/") && !text.startsWith("//")) { 53 if (text.startsWith("/") && !text.startsWith("//")) {
51 /* Command mode */ 54 /* Command mode */
52 m_parentTab->executeCommand(this, text);; 55 m_parentTab->executeCommand(this, text);;
53 } else { 56 } else {
54 if (text.startsWith("//")) 57 if (text.startsWith("//"))
55 text = text.right(text.length()-1); 58 text = text.right(text.length()-1);
56 session()->sendMessage(m_person, m_field->text()); 59 session()->sendMessage(m_person, m_field->text());
57 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">&gt; "+IRCOutput::toHTML(m_field->text())+"</font><br>"); 60 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">&gt; "+IRCOutput::toHTML(m_field->text())+"</font><br>");
58 } 61 }
59 } else { 62 } else {
60 appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); 63 appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>");
61 } 64 }
62 } 65 }
63 m_field->clear(); 66 m_field->clear();
64} 67}
65 68
66void IRCQueryTab::display(IRCOutput output) { 69void IRCQueryTab::display(IRCOutput output) {
67 if (output.type() == OUTPUT_QUERYPRIVMSG) { 70 if (output.type() == OUTPUT_QUERYPRIVMSG) {
68 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_otherColor + "\">"+m_person->nick()+"</font><font color=\"" + m_textColor + "\">&gt; " + output.htmlMessage() + "</font><br>"); 71 appendText("<font color=\"" + m_textColor + "\">&lt;</font><font color=\"" + m_otherColor + "\">"+m_person->nick()+"</font><font color=\"" + m_textColor + "\">&gt; " + output.htmlMessage() + "</font><br>");
69 } else if (output.type() == OUTPUT_QUERYACTION) { 72 } else if (output.type() == OUTPUT_QUERYACTION) {
70 appendText("<font color=\"" + m_otherColor + "\">" + output.htmlMessage() + "<br>"); 73 appendText("<font color=\"" + m_otherColor + "\">" + output.htmlMessage() + "<br>");
71 } 74 }
72} 75}
73 76
74void IRCQueryTab::settingsChanged() { 77void IRCQueryTab::settingsChanged() {
75 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); 78 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
76 m_lines = 0; 79 m_lines = 0;
77} 80}
78 81
79QString IRCQueryTab::title() { 82QString IRCQueryTab::title() {
80 return m_person->nick(); 83 return m_person->nick();
81} 84}
82 85
83IRCSession *IRCQueryTab::session() { 86IRCSession *IRCQueryTab::session() {
84 return m_parentTab->session(); 87 return m_parentTab->session();
85} 88}
86 89
87void IRCQueryTab::remove() { 90void IRCQueryTab::remove() {
88 m_mainWindow->killTab(this); 91 m_mainWindow->killTab(this);
89} 92}
90 93
91IRCPerson *IRCQueryTab::person() { 94IRCPerson *IRCQueryTab::person() {
92 return m_person; 95 return m_person;
93} 96}
94 97
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index 5d1e290..a46f105 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -1,145 +1,148 @@
1#include <qpe/config.h> 1#include <qpe/config.h>
2#include <qtextstream.h> 2#include <qtextstream.h>
3#include <qwhatsthis.h>
3#include "ircservertab.h" 4#include "ircservertab.h"
4 5
5IRCServerTab::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) {
6 m_server = server; 7 m_server = server;
7 m_session = new IRCSession(&m_server); 8 m_session = new IRCSession(&m_server);
8 m_mainWindow = mainWindow; 9 m_mainWindow = mainWindow;
9 m_close = FALSE; 10 m_close = FALSE;
10 m_lines = 0; 11 m_lines = 0;
11 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>");
12 m_textview = new QTextView(this); 13 m_textview = new QTextView(this);
13 m_textview->setHScrollBarMode(QScrollView::AlwaysOff); 14 m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
14 m_textview->setVScrollBarMode(QScrollView::AlwaysOn); 15 m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
15 m_textview->setTextFormat(RichText); 16 m_textview->setTextFormat(RichText);
17 QWhatsThis::add(m_textview, tr("Server messages"));
16 m_layout->add(m_textview); 18 m_layout->add(m_textview);
17 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"));
18 m_layout->add(m_field); 21 m_layout->add(m_field);
19 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); 22 connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
20 m_field->setFocus(); 23 m_field->setFocus();
21 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); 24 connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
22 settingsChanged(); 25 settingsChanged();
23} 26}
24 27
25void IRCServerTab::appendText(QString text) { 28void IRCServerTab::appendText(QString text) {
26 /* not using append because it creates layout problems */ 29 /* not using append because it creates layout problems */
27 QString txt = m_textview->text() + text + "\n"; 30 QString txt = m_textview->text() + text + "\n";
28 if (m_maxLines > 0 && m_lines >= m_maxLines) { 31 if (m_maxLines > 0 && m_lines >= m_maxLines) {
29 int firstBreak = txt.find('\n'); 32 int firstBreak = txt.find('\n');
30 if (firstBreak != -1) { 33 if (firstBreak != -1) {
31 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); 34 txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1));
32 } 35 }
33 } else { 36 } else {
34 m_lines++; 37 m_lines++;
35 } 38 }
36 m_textview->setText(txt); 39 m_textview->setText(txt);
37 m_textview->ensureVisible(0, m_textview->contentsHeight()); 40 m_textview->ensureVisible(0, m_textview->contentsHeight());
38 emit changed(this); 41 emit changed(this);
39} 42}
40 43
41IRCServerTab::~IRCServerTab() { 44IRCServerTab::~IRCServerTab() {
42 delete m_session; 45 delete m_session;
43} 46}
44 47
45void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { 48void IRCServerTab::removeChannelTab(IRCChannelTab *tab) {
46 m_channelTabs.remove(tab); 49 m_channelTabs.remove(tab);
47} 50}
48 51
49void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { 52void IRCServerTab::removeQueryTab(IRCQueryTab *tab) {
50 m_queryTabs.remove(tab); 53 m_queryTabs.remove(tab);
51} 54}
52 55
53void IRCServerTab::addQueryTab(IRCQueryTab *tab) { 56void IRCServerTab::addQueryTab(IRCQueryTab *tab) {
54 m_queryTabs.append(tab); 57 m_queryTabs.append(tab);
55} 58}
56 59
57QString IRCServerTab::title() { 60QString IRCServerTab::title() {
58 return "Server"; 61 return "Server";
59} 62}
60 63
61IRCSession *IRCServerTab::session() { 64IRCSession *IRCServerTab::session() {
62 return m_session; 65 return m_session;
63} 66}
64 67
65IRCServer *IRCServerTab::server() { 68IRCServer *IRCServerTab::server() {
66 return &m_server; 69 return &m_server;
67} 70}
68 71
69void IRCServerTab::settingsChanged() { 72void IRCServerTab::settingsChanged() {
70 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); 73 m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>");
71 m_lines = 0; 74 m_lines = 0;
72} 75}
73 76
74void IRCServerTab::executeCommand(IRCTab *tab, QString line) { 77void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
75 QTextIStream stream(&line); 78 QTextIStream stream(&line);
76 QString command; 79 QString command;
77 stream >> command; 80 stream >> command;
78 command = command.upper().right(command.length()-1); 81 command = command.upper().right(command.length()-1);
79 82
80 if (command == "JOIN") { 83 if (command == "JOIN") {
81 QString channel; 84 QString channel;
82 stream >> channel; 85 stream >> channel;
83 if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { 86 if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) {
84 m_session->join(channel); 87 m_session->join(channel);
85 } else { 88 } else {
86 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); 89 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>");
87 } 90 }
88 } else if (command == "ME") { 91 } else if (command == "ME") {
89 QString text = line.right(line.length()-4); 92 QString text = line.right(line.length()-4);
90 if (text.length() > 0) { 93 if (text.length() > 0) {
91 if (tab->isA("IRCChannelTab")) { 94 if (tab->isA("IRCChannelTab")) {
92 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>");
93 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); 96 m_session->sendAction(((IRCChannelTab *)tab)->channel(), text);
94 } else if (tab->isA("IRCQueryTab")) { 97 } else if (tab->isA("IRCQueryTab")) {
95 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>");
96 m_session->sendAction(((IRCQueryTab *)tab)->person(), text); 99 m_session->sendAction(((IRCQueryTab *)tab)->person(), text);
97 } else { 100 } else {
98 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>");
99 } 102 }
100 } 103 }
101 } else if (command == "MSG") { 104 } else if (command == "MSG") {
102 QString nickname; 105 QString nickname;
103 stream >> nickname; 106 stream >> nickname;
104 if (nickname.length() > 0) { 107 if (nickname.length() > 0) {
105 if (line.length() > 6 + nickname.length()) { 108 if (line.length() > 6 + nickname.length()) {
106 QString text = line.right(line.length()-nickname.length()-6); 109 QString text = line.right(line.length()-nickname.length()-6);
107 IRCPerson person; 110 IRCPerson person;
108 person.setNick(nickname); 111 person.setNick(nickname);
109 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>");
110 m_session->sendMessage(&person, text); 113 m_session->sendMessage(&person, text);
111 } 114 }
112 } 115 }
113 } else { 116 } else {
114 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>"); 117 tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>");
115 } 118 }
116} 119}
117 120
118void IRCServerTab::processCommand() { 121void IRCServerTab::processCommand() {
119 QString text = m_field->text(); 122 QString text = m_field->text();
120 if (text.startsWith("/") && !text.startsWith("//")) { 123 if (text.startsWith("/") && !text.startsWith("//")) {
121 /* Command mode */ 124 /* Command mode */
122 executeCommand(this, text); 125 executeCommand(this, text);
123 } 126 }
124 m_field->clear(); 127 m_field->clear();
125} 128}
126 129
127void IRCServerTab::doConnect() { 130void IRCServerTab::doConnect() {
128 m_session->beginSession(); 131 m_session->beginSession();
129} 132}
130 133
131void IRCServerTab::remove() { 134void IRCServerTab::remove() {
132 /* Close requested */ 135 /* Close requested */
133 if (m_session->isSessionActive()) { 136 if (m_session->isSessionActive()) {
134 /* While there is a running session */ 137 /* While there is a running session */
135 m_close = TRUE; 138 m_close = TRUE;
136 m_session->endSession(); 139 m_session->endSession();
137 } else { 140 } else {
138 /* Session has previously been closed */ 141 /* Session has previously been closed */
139 m_channelTabs.first(); 142 m_channelTabs.first();
140 while (m_channelTabs.current() != 0) { 143 while (m_channelTabs.current() != 0) {
141 m_mainWindow->killTab(m_channelTabs.current()); 144 m_mainWindow->killTab(m_channelTabs.current());
142 } 145 }
143 m_queryTabs.first(); 146 m_queryTabs.first();
144 while (m_queryTabs.current() != 0) { 147 while (m_queryTabs.current() != 0) {
145 m_mainWindow->killTab(m_queryTabs.current()); 148 m_mainWindow->killTab(m_queryTabs.current());
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp
index 0bb9d4c..8a869d6 100644
--- a/noncore/net/opieirc/irctab.cpp
+++ b/noncore/net/opieirc/irctab.cpp
@@ -1,36 +1,39 @@
1#include <qpe/resource.h> 1#include <qpe/resource.h>
2#include <qpixmap.h> 2#include <qpixmap.h>
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qwhatsthis.h>
4#include "irctab.h" 5#include "irctab.h"
5 6
6QString IRCTab::m_errorColor; 7QString IRCTab::m_errorColor;
7QString IRCTab::m_serverColor; 8QString IRCTab::m_serverColor;
8QString IRCTab::m_textColor; 9QString IRCTab::m_textColor;
9QString IRCTab::m_backgroundColor; 10QString IRCTab::m_backgroundColor;
10QString IRCTab::m_selfColor; 11QString IRCTab::m_selfColor;
11QString IRCTab::m_otherColor; 12QString IRCTab::m_otherColor;
12QString IRCTab::m_notificationColor; 13QString IRCTab::m_notificationColor;
13int IRCTab::m_maxLines; 14int IRCTab::m_maxLines;
14 15
15IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { 16IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) {
16 m_layout = new QVBoxLayout(this); 17 m_layout = new QVBoxLayout(this);
17 QHBoxLayout *descLayout = new QHBoxLayout(m_layout); 18 QHBoxLayout *descLayout = new QHBoxLayout(m_layout);
18 descLayout->setMargin(5); 19 descLayout->setMargin(5);
19 m_description = new QLabel(tr("Missing description"), this); 20 m_description = new QLabel(tr("Missing description"), this);
21 QWhatsThis::add(m_description, tr("Description of the tab's content"));
20 descLayout->addWidget(m_description); 22 descLayout->addWidget(m_description);
21 descLayout->setStretchFactor(m_description, 5); 23 descLayout->setStretchFactor(m_description, 5);
22 QPushButton *close = new QPushButton(this); 24 QPushButton *close = new QPushButton(this);
25 QWhatsThis::add(close, tr("Close this tab"));
23 close->setPixmap(Resource::loadPixmap("close")); 26 close->setPixmap(Resource::loadPixmap("close"));
24 connect(close, SIGNAL(clicked()), this, SLOT(remove())); 27 connect(close, SIGNAL(clicked()), this, SLOT(remove()));
25 descLayout->addWidget(close); 28 descLayout->addWidget(close);
26 descLayout->setStretchFactor(m_description, 1); 29 descLayout->setStretchFactor(m_description, 1);
27} 30}
28 31
29 32
30void IRCTab::setID(int id) { 33void IRCTab::setID(int id) {
31 m_id = id; 34 m_id = id;
32} 35}
33 36
34int IRCTab::id() { 37int IRCTab::id() {
35 return m_id; 38 return m_id;
36} 39}
diff --git a/noncore/net/opieirc/opie-irc.control b/noncore/net/opieirc/opie-irc.control
index aada957..0bcdecd 100644
--- a/noncore/net/opieirc/opie-irc.control
+++ b/noncore/net/opieirc/opie-irc.control
@@ -1,8 +1,8 @@
1Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop 1Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop help/en/html/opieirc.html help/en/html/opieirc
2Priority: optional 2Priority: optional
3Section: Communications 3Section: Communications
4Maintainer: Wenzel Jakob <root@wazlaf.de> 4Maintainer: Wenzel Jakob <root@wazlaf.de>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION)
8Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer 8Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer