-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 17 | ||||
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.h | 20 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.cpp | 53 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmisc.h | 27 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.cpp | 15 | ||||
-rw-r--r-- | noncore/net/opieirc/ircquerytab.h | 6 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 15 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.h | 4 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.cpp | 60 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsettings.h | 18 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/irctab.h | 3 | ||||
-rw-r--r-- | noncore/net/opieirc/ircversion.h | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/net/opieirc/opie-irc.control | 3 |
16 files changed, 186 insertions, 66 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index ddd6cf1..f19e019 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -1,126 +1,139 @@ | |||
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 <qhbox.h> | 5 | #include <qhbox.h> |
5 | #include "ircchanneltab.h" | 6 | #include "ircchanneltab.h" |
6 | #include "ircservertab.h" | 7 | #include "ircservertab.h" |
7 | 8 | ||
8 | IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 9 | IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
9 | m_mainWindow = mainWindow; | 10 | m_mainWindow = mainWindow; |
10 | m_parentTab = parentTab; | 11 | m_parentTab = parentTab; |
11 | m_channel = channel; | 12 | m_channel = channel; |
12 | m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); | 13 | m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); |
13 | QHBox *hbox = new QHBox(this); | 14 | QHBox *hbox = new QHBox(this); |
14 | m_textview = new QTextView(hbox); | 15 | m_textview = new QTextView(hbox); |
15 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 16 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
16 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 17 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
17 | m_listVisible = TRUE; | 18 | m_listVisible = TRUE; |
18 | m_listButton = new QPushButton(">", m_textview); | 19 | m_listButton = new QPushButton(">", m_textview); |
19 | m_textview->setCornerWidget(m_listButton); | 20 | m_textview->setCornerWidget(m_listButton); |
20 | m_textview->setTextFormat(RichText); | 21 | m_textview->setTextFormat(RichText); |
21 | connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); | 22 | connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); |
22 | m_list = new IRCChannelList(m_channel, hbox); | 23 | m_list = new IRCChannelList(m_channel, hbox); |
23 | m_list->update(); | 24 | m_list->update(); |
24 | m_list->setMaximumWidth(LISTWIDTH); | 25 | m_list->setMaximumWidth(LISTWIDTH); |
25 | m_field = new QLineEdit(this); | 26 | m_field = new IRCHistoryLineEdit(this); |
26 | m_popup = new QPopupMenu(m_list); | 27 | m_popup = new QPopupMenu(m_list); |
28 | m_lines = 0; | ||
27 | /* Required so that embedded-style "right" clicks work */ | 29 | /* Required so that embedded-style "right" clicks work */ |
28 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); | 30 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); |
29 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); | 31 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); |
32 | |||
30 | /* Construct the popup menu */ | 33 | /* Construct the popup menu */ |
31 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); | 34 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); |
32 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); | 35 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); |
33 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); | 36 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); |
34 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); | 37 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); |
35 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); | 38 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); |
36 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); | 39 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); |
37 | 40 | ||
38 | m_layout->add(hbox); | 41 | m_layout->add(hbox); |
39 | hbox->show(); | 42 | hbox->show(); |
40 | m_layout->add(m_field); | 43 | m_layout->add(m_field); |
41 | m_field->setFocus(); | 44 | m_field->setFocus(); |
42 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 45 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
43 | settingsChanged(); | 46 | settingsChanged(); |
44 | } | 47 | } |
45 | 48 | ||
46 | void IRCChannelTab::appendText(QString text) { | 49 | void IRCChannelTab::appendText(QString text) { |
47 | /* not using append because it creates layout problems */ | 50 | /* not using append because it creates layout problems */ |
48 | m_textview->setText(m_textview->text() + text); | 51 | QString txt = m_textview->text() + text + "\n"; |
52 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | ||
53 | int firstBreak = txt.find('\n'); | ||
54 | if (firstBreak != -1) { | ||
55 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | ||
56 | } | ||
57 | } else { | ||
58 | m_lines++; | ||
59 | } | ||
60 | m_textview->setText(txt); | ||
49 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 61 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
50 | emit changed(this); | 62 | emit changed(this); |
51 | } | 63 | } |
52 | 64 | ||
53 | IRCChannelTab::~IRCChannelTab() { | 65 | IRCChannelTab::~IRCChannelTab() { |
54 | m_parentTab->removeChannelTab(this); | 66 | m_parentTab->removeChannelTab(this); |
55 | } | 67 | } |
56 | 68 | ||
57 | void IRCChannelTab::processCommand() { | 69 | void IRCChannelTab::processCommand() { |
58 | QString text = m_field->text(); | 70 | QString text = m_field->text(); |
59 | if (text.length()>0) { | 71 | if (text.length()>0) { |
60 | if (session()->isSessionActive()) { | 72 | if (session()->isSessionActive()) { |
61 | if (text.startsWith("/") && !text.startsWith("//")) { | 73 | if (text.startsWith("/") && !text.startsWith("//")) { |
62 | /* Command mode */ | 74 | /* Command mode */ |
63 | m_parentTab->executeCommand(this, text);; | 75 | m_parentTab->executeCommand(this, text);; |
64 | } else { | 76 | } else { |
65 | if (text.startsWith("//")) | 77 | if (text.startsWith("//")) |
66 | text = text.right(text.length()-1); | 78 | text = text.right(text.length()-1); |
67 | session()->sendMessage(m_channel, m_field->text()); | 79 | session()->sendMessage(m_channel, m_field->text()); |
68 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+IRCOutput::toHTML(m_field->text())+"</font><br>"); | 80 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+IRCOutput::toHTML(m_field->text())+"</font><br>"); |
69 | } | 81 | } |
70 | } else { | 82 | } else { |
71 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); | 83 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); |
72 | } | 84 | } |
73 | } | 85 | } |
74 | m_field->clear(); | 86 | m_field->clear(); |
75 | } | 87 | } |
76 | 88 | ||
77 | void IRCChannelTab::settingsChanged() { | 89 | void IRCChannelTab::settingsChanged() { |
78 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 90 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
91 | m_lines = 0; | ||
79 | } | 92 | } |
80 | 93 | ||
81 | void IRCChannelTab::toggleList() { | 94 | void IRCChannelTab::toggleList() { |
82 | if (m_listVisible) { | 95 | if (m_listVisible) { |
83 | m_list->setMaximumWidth(0); | 96 | m_list->setMaximumWidth(0); |
84 | m_listButton->setText("<"); | 97 | m_listButton->setText("<"); |
85 | } else { | 98 | } else { |
86 | m_list->setMaximumWidth(LISTWIDTH); | 99 | m_list->setMaximumWidth(LISTWIDTH); |
87 | m_listButton->setText(">"); | 100 | m_listButton->setText(">"); |
88 | } | 101 | } |
89 | m_listVisible = !m_listVisible; | 102 | m_listVisible = !m_listVisible; |
90 | } | 103 | } |
91 | 104 | ||
92 | void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { | 105 | void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { |
93 | switch (mouse) { | 106 | switch (mouse) { |
94 | case 1: | 107 | case 1: |
95 | break; | 108 | break; |
96 | case 2: | 109 | case 2: |
97 | m_popup->popup(point); | 110 | m_popup->popup(point); |
98 | break; | 111 | break; |
99 | }; | 112 | }; |
100 | } | 113 | } |
101 | 114 | ||
102 | void IRCChannelTab::popupQuery() { | 115 | void IRCChannelTab::popupQuery() { |
103 | if (m_list->currentItem() != -1) { | 116 | if (m_list->currentItem() != -1) { |
104 | IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); | 117 | IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); |
105 | if (person) { | 118 | if (person) { |
106 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); | 119 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); |
107 | if (!tab) { | 120 | if (!tab) { |
108 | tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); | 121 | tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); |
109 | m_parentTab->addQueryTab(tab); | 122 | m_parentTab->addQueryTab(tab); |
110 | m_mainWindow->addTab(tab); | 123 | m_mainWindow->addTab(tab); |
111 | } | 124 | } |
112 | } | 125 | } |
113 | } | 126 | } |
114 | } | 127 | } |
115 | 128 | ||
116 | void IRCChannelTab::popupPing() { | 129 | void IRCChannelTab::popupPing() { |
117 | } | 130 | } |
118 | 131 | ||
119 | void IRCChannelTab::popupVersion() { | 132 | void IRCChannelTab::popupVersion() { |
120 | } | 133 | } |
121 | 134 | ||
122 | void IRCChannelTab::popupWhois() { | 135 | void IRCChannelTab::popupWhois() { |
123 | } | 136 | } |
124 | 137 | ||
125 | QString IRCChannelTab::title() { | 138 | QString IRCChannelTab::title() { |
126 | return m_channel->channelname(); | 139 | return m_channel->channelname(); |
diff --git a/noncore/net/opieirc/ircchanneltab.h b/noncore/net/opieirc/ircchanneltab.h index 971614b..a03ee3e 100644 --- a/noncore/net/opieirc/ircchanneltab.h +++ b/noncore/net/opieirc/ircchanneltab.h | |||
@@ -1,70 +1,72 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCCHANNELTAB_H | 21 | #ifndef __IRCCHANNELTAB_H |
22 | #define __IRCCHANNELTAB_H | 22 | #define __IRCCHANNELTAB_H |
23 | 23 | ||
24 | #include <qpopupmenu.h> | 24 | #include <qpopupmenu.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include "irctab.h" | 26 | #include "irctab.h" |
27 | #include "ircsession.h" | 27 | #include "ircsession.h" |
28 | #include "ircmisc.h" | ||
28 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
29 | #include "ircchannellist.h" | 30 | #include "ircchannellist.h" |
30 | 31 | ||
31 | #define LISTWIDTH 70 | 32 | #define LISTWIDTH 70 |
32 | 33 | ||
33 | class IRCServerTab; | 34 | class IRCServerTab; |
34 | class IRCChannelTab : public IRCTab { | 35 | class IRCChannelTab : public IRCTab { |
35 | Q_OBJECT | 36 | Q_OBJECT |
36 | public: | 37 | public: |
37 | /* IRCTab implementation */ | 38 | /* IRCTab implementation */ |
38 | IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 39 | IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
39 | ~IRCChannelTab(); | 40 | ~IRCChannelTab(); |
40 | QString title(); | 41 | QString title(); |
41 | IRCSession *session(); | 42 | IRCSession *session(); |
42 | IRCChannel *channel(); | 43 | IRCChannel *channel(); |
43 | IRCChannelList *list(); | 44 | IRCChannelList *list(); |
44 | public: | 45 | public: |
45 | void appendText(QString text); | 46 | void appendText(QString text); |
46 | public slots: | 47 | public slots: |
47 | void remove(); | 48 | void remove(); |
48 | void settingsChanged(); | 49 | void settingsChanged(); |
49 | protected slots: | 50 | protected slots: |
50 | void processCommand(); | 51 | void processCommand(); |
51 | void toggleList(); | 52 | void toggleList(); |
52 | void mouseButtonPressed(int mouse, QListBoxItem *item, const QPoint &point); | 53 | void mouseButtonPressed(int mouse, QListBoxItem *item, const QPoint &point); |
53 | /* Popup slots */ | 54 | /* Popup slots */ |
54 | void popupQuery(); | 55 | void popupQuery(); |
55 | void popupPing(); | 56 | void popupPing(); |
56 | void popupVersion(); | 57 | void popupVersion(); |
57 | void popupWhois(); | 58 | void popupWhois(); |
58 | protected: | 59 | protected: |
59 | IRCServerTab *m_parentTab; | 60 | IRCServerTab *m_parentTab; |
60 | IRCChannel *m_channel; | 61 | IRCChannel *m_channel; |
61 | IRCChannelList *m_list; | 62 | IRCChannelList *m_list; |
62 | QPushButton *m_listButton; | 63 | QPushButton *m_listButton; |
63 | MainWindow *m_mainWindow; | 64 | MainWindow *m_mainWindow; |
64 | QTextView *m_textview; | 65 | QTextView *m_textview; |
65 | QLineEdit *m_field; | 66 | IRCHistoryLineEdit *m_field; |
66 | QPopupMenu *m_popup; | 67 | QPopupMenu *m_popup; |
67 | bool m_listVisible; | 68 | bool m_listVisible; |
69 | int m_lines; | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | #endif /* __IRCCHANNELTAB_H */ | 72 | #endif /* __IRCCHANNELTAB_H */ |
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index a95c64e..e8d3b1a 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp | |||
@@ -472,50 +472,50 @@ void IRCMessageParser::parseNumericalNames(IRCMessage *message) { | |||
472 | m_session->addPerson(person); | 472 | m_session->addPerson(person); |
473 | } | 473 | } |
474 | chan_person->person = person; | 474 | chan_person->person = person; |
475 | chan_person->flags = flag; | 475 | chan_person->flags = flag; |
476 | channel->addPerson(chan_person); | 476 | channel->addPerson(chan_person); |
477 | } | 477 | } |
478 | } else { | 478 | } else { |
479 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Server message with unknown channel"))); | 479 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Server message with unknown channel"))); |
480 | } | 480 | } |
481 | } | 481 | } |
482 | 482 | ||
483 | void IRCMessageParser::parseNumericalEndOfNames(IRCMessage *message) { | 483 | void IRCMessageParser::parseNumericalEndOfNames(IRCMessage *message) { |
484 | /* Done syncing to channel */ | 484 | /* Done syncing to channel */ |
485 | IRCChannel *channel = m_session->getChannel(message->param(1).lower()); | 485 | IRCChannel *channel = m_session->getChannel(message->param(1).lower()); |
486 | if (channel) { | 486 | if (channel) { |
487 | channel->setHasPeople(TRUE); | 487 | channel->setHasPeople(TRUE); |
488 | /* Yes, we want the names before anything happens inside the GUI */ | 488 | /* Yes, we want the names before anything happens inside the GUI */ |
489 | IRCOutput output(OUTPUT_SELFJOIN, tr("You joined channel ") + channel->channelname()); | 489 | IRCOutput output(OUTPUT_SELFJOIN, tr("You joined channel ") + channel->channelname()); |
490 | output.addParam(channel); | 490 | output.addParam(channel); |
491 | emit outputReady(output); | 491 | emit outputReady(output); |
492 | } else { | 492 | } else { |
493 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Server message with unknown channel"))); | 493 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Server message with unknown channel"))); |
494 | } | 494 | } |
495 | } | 495 | } |
496 | 496 | ||
497 | 497 | ||
498 | void IRCMessageParser::parseNumericalNicknameInUse(IRCMessage *) { | 498 | void IRCMessageParser::parseNumericalNicknameInUse(IRCMessage *) { |
499 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname is in use, please reconnect with a different nickname"))); | 499 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname is in use, please reconnect with a different nickname"))); |
500 | m_session->endSession(); | 500 | m_session->endSession(); |
501 | } | 501 | } |
502 | 502 | ||
503 | void IRCMessageParser::parseNumericalNoSuchNick(IRCMessage *) { | 503 | void IRCMessageParser::parseNumericalNoSuchNick(IRCMessage *) { |
504 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname"))); | 504 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname"))); |
505 | } | 505 | } |
506 | 506 | ||
507 | void IRCMessageParser::parseNumericalTopic(IRCMessage *message) { | 507 | void IRCMessageParser::parseNumericalTopic(IRCMessage *message) { |
508 | IRCChannel *channel = m_session->getChannel(message->param(1).lower()); | 508 | IRCChannel *channel = m_session->getChannel(message->param(1).lower()); |
509 | if (channel) { | 509 | if (channel) { |
510 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + channel->channelname() + " is \"" + message->param(2) + "\"")); | 510 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + channel->channelname() + " is \"" + message->param(2) + "\"")); |
511 | output.addParam(channel); | 511 | output.addParam(channel); |
512 | emit outputReady(output); | 512 | emit outputReady(output); |
513 | } else { | 513 | } else { |
514 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + message->param(1) + " is \"" + message->param(2) + "\"")); | 514 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + message->param(1) + " is \"" + message->param(2) + "\"")); |
515 | output.addParam(0); | 515 | output.addParam(0); |
516 | emit outputReady(output); | 516 | emit outputReady(output); |
517 | } | 517 | } |
518 | } | 518 | } |
519 | 519 | ||
520 | void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *message) { | 520 | void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *) { |
521 | } | 521 | } |
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp index dd7292c..2e7f316 100644 --- a/noncore/net/opieirc/ircmisc.cpp +++ b/noncore/net/opieirc/ircmisc.cpp | |||
@@ -1,66 +1,97 @@ | |||
1 | #include <opie/colordialog.h> | 1 | #include <opie/colordialog.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include "ircmisc.h" | 4 | #include "ircmisc.h" |
5 | 5 | ||
6 | IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) { | 6 | IRCColorLabel::IRCColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QLabel(parent, name, f) { |
7 | m_color = color; | 7 | m_color = color; |
8 | setAlignment(AlignVCenter | AlignCenter); | 8 | setAlignment(AlignVCenter | AlignCenter); |
9 | setFrameStyle(QFrame::StyledPanel); | 9 | setFrameStyle(QFrame::StyledPanel); |
10 | setFrameShadow(QFrame::Sunken); | 10 | setFrameShadow(QFrame::Sunken); |
11 | setBackgroundColor(m_color); | 11 | setBackgroundColor(m_color); |
12 | } | 12 | } |
13 | 13 | ||
14 | void IRCColorLabel::mousePressEvent(QMouseEvent *) { | 14 | void IRCColorLabel::mousePressEvent(QMouseEvent *) { |
15 | m_color = OColorDialog::getColor(m_color); | 15 | m_color = OColorDialog::getColor(m_color); |
16 | setBackgroundColor(m_color); | 16 | setBackgroundColor(m_color); |
17 | } | 17 | } |
18 | 18 | ||
19 | QColor IRCColorLabel::color() { | 19 | QColor IRCColorLabel::color() { |
20 | return m_color; | 20 | return m_color; |
21 | } | 21 | } |
22 | 22 | ||
23 | IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { | 23 | IRCFramedColorLabel::IRCFramedColorLabel(QColor color, QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { |
24 | QVBoxLayout *layout = new QVBoxLayout(this, 10, 0); | 24 | QVBoxLayout *layout = new QVBoxLayout(this, 10, 0); |
25 | m_label = new IRCColorLabel(color, this); | 25 | m_label = new IRCColorLabel(color, this); |
26 | layout->addWidget(m_label); | 26 | layout->addWidget(m_label); |
27 | } | 27 | } |
28 | 28 | ||
29 | QColor IRCFramedColorLabel::color() { | 29 | QColor IRCFramedColorLabel::color() { |
30 | return m_label->color(); | 30 | return m_label->color(); |
31 | } | 31 | } |
32 | 32 | ||
33 | |||
33 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { | 34 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { |
34 | } | 35 | } |
35 | 36 | ||
36 | int IRCTabBar::insertTab(QTab *tab, int index = -1) { | 37 | int IRCTabBar::insertTab(QTab *tab, int index = -1) { |
37 | if (m_colors.size() == (unsigned int)count()) | 38 | /* FIXME: find some nicer way to do this */ |
38 | m_colors.resize(m_colors.size() * 2 + 1); | 39 | QExtTab *ext = new QExtTab(); |
39 | if (index == -1) | 40 | ext->color = black; |
40 | m_colors.insert(count(), &black); | 41 | ext->label = tab->text(); |
41 | else | 42 | ext->r = tab->rect(); |
42 | m_colors.insert(index, &black); | 43 | ext->enabled = tab->isEnabled(); |
43 | return QTabBar::insertTab(tab, index); | 44 | ext->iconset = tab->iconSet(); |
45 | delete tab; | ||
46 | return QTabBar::insertTab(ext, index); | ||
44 | } | 47 | } |
45 | 48 | ||
46 | void IRCTabBar::setTabColor(int index, const QColor *color) { | 49 | void IRCTabBar::setTabColor(int index, QColor color) { |
47 | m_colors.insert(index, color); | 50 | ((QExtTab *)tab(index))->color = color; |
48 | update(); | 51 | update(); |
49 | } | 52 | } |
50 | 53 | ||
51 | void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { | 54 | void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const { |
52 | QRect r = br; | 55 | QRect r = br; |
53 | QTabBar::paintLabel(p, br, t, focus); | 56 | QTabBar::paintLabel(p, br, t, focus); |
54 | if (t->id == currentTab()) | 57 | if (t->id == currentTab()) |
55 | r.setBottom(r.bottom() - style().defaultFrameWidth()); | 58 | r.setBottom(r.bottom() - style().defaultFrameWidth()); |
56 | p->setPen(*m_colors.at(t->id)); | 59 | p->setPen(((QExtTab *)t)->color); |
57 | p->drawText(r, AlignCenter | ShowPrefix, t->label); | 60 | p->drawText(r, AlignCenter | ShowPrefix, t->label); |
58 | } | 61 | } |
59 | 62 | ||
60 | IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { | 63 | IRCTabWidget::IRCTabWidget(QWidget *parent, const char *name) : QTabWidget(parent, name) { |
61 | setTabBar(new IRCTabBar(this, "tab control")); | 64 | setTabBar(new IRCTabBar(this, "tab control")); |
62 | } | 65 | } |
63 | 66 | ||
64 | void IRCTabWidget::setTabColor(int index, const QColor *color) { | 67 | void IRCTabWidget::setTabColor(int index, QColor color) { |
65 | ((IRCTabBar *)tabBar())->setTabColor(index, color); | 68 | ((IRCTabBar *)tabBar())->setTabColor(index, color); |
66 | } | 69 | } |
70 | |||
71 | |||
72 | IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLineEdit(parent, name) { | ||
73 | m_index = -1; | ||
74 | } | ||
75 | |||
76 | void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { | ||
77 | int key = event->key(); | ||
78 | if (key == Key_Up) { | ||
79 | if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) { | ||
80 | m_index++; | ||
81 | setText(m_history[m_index]); | ||
82 | } | ||
83 | } else if (key == Key_Down) { | ||
84 | if (m_history.count() > 0 && m_index > 0) { | ||
85 | m_index--; | ||
86 | setText(m_history[m_index]); | ||
87 | } | ||
88 | if (m_index == 0) { | ||
89 | m_index = -1; | ||
90 | setText(""); | ||
91 | } | ||
92 | } else if (key == Key_Return) { | ||
93 | m_history.prepend(text()); | ||
94 | m_index = -1; | ||
95 | } | ||
96 | QLineEdit::keyPressEvent(event); | ||
97 | } | ||
diff --git a/noncore/net/opieirc/ircmisc.h b/noncore/net/opieirc/ircmisc.h index 4df6ce0..7151e6b 100644 --- a/noncore/net/opieirc/ircmisc.h +++ b/noncore/net/opieirc/ircmisc.h | |||
@@ -1,72 +1,91 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCMISC_H | 21 | #ifndef __IRCMISC_H |
22 | #define __IRCMISC_H | 22 | #define __IRCMISC_H |
23 | 23 | ||
24 | #include <qtabwidget.h> | 24 | #include <qtabwidget.h> |
25 | #include <qlineedit.h> | ||
25 | #include <qtabbar.h> | 26 | #include <qtabbar.h> |
26 | #include <qlabel.h> | 27 | #include <qlabel.h> |
27 | #include <qcolor.h> | 28 | #include <qcolor.h> |
28 | #include <qvector.h> | 29 | #include <qarray.h> |
29 | 30 | ||
30 | /* IRCFramedColorLabel is used to display a color */ | 31 | /* IRCFramedColorLabel is used to display a color */ |
31 | 32 | ||
32 | class IRCColorLabel : public QLabel { | 33 | class IRCColorLabel : public QLabel { |
33 | Q_OBJECT | 34 | Q_OBJECT |
34 | public: | 35 | public: |
35 | IRCColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 36 | IRCColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
36 | QColor color(); | 37 | QColor color(); |
37 | void mousePressEvent(QMouseEvent *event); | 38 | void mousePressEvent(QMouseEvent *event); |
38 | protected: | 39 | protected: |
39 | QColor m_color; | 40 | QColor m_color; |
40 | }; | 41 | }; |
41 | 42 | ||
42 | class IRCFramedColorLabel : public QWidget { | 43 | class IRCFramedColorLabel : public QWidget { |
43 | Q_OBJECT | 44 | Q_OBJECT |
44 | public: | 45 | public: |
45 | IRCFramedColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 46 | IRCFramedColorLabel(QColor color, QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
46 | QColor color(); | 47 | QColor color(); |
47 | protected: | 48 | protected: |
48 | IRCColorLabel *m_label; | 49 | IRCColorLabel *m_label; |
49 | }; | 50 | }; |
50 | 51 | ||
51 | /* Custom colored QTabWidget */ | 52 | /* Custom colored QTabWidget */ |
52 | 53 | ||
54 | class QExtTab : public QTab { | ||
55 | public: | ||
56 | QColor color; | ||
57 | }; | ||
58 | |||
53 | class IRCTabWidget : public QTabWidget { | 59 | class IRCTabWidget : public QTabWidget { |
54 | Q_OBJECT | 60 | Q_OBJECT |
55 | public: | 61 | public: |
56 | IRCTabWidget(QWidget *parent = 0, const char *name = 0); | 62 | IRCTabWidget(QWidget *parent = 0, const char *name = 0); |
57 | void setTabColor(int index, const QColor *color); | 63 | void setTabColor(int index, QColor color); |
58 | }; | 64 | }; |
59 | 65 | ||
60 | class IRCTabBar : public QTabBar { | 66 | class IRCTabBar : public QTabBar { |
61 | Q_OBJECT | 67 | Q_OBJECT |
62 | public: | 68 | public: |
63 | IRCTabBar(QWidget *parent = 0, const char *name = 0); | 69 | IRCTabBar(QWidget *parent = 0, const char *name = 0); |
64 | void setTabColor(int index, const QColor *color); | 70 | void setTabColor(int index, QColor color); |
65 | protected: | 71 | protected: |
66 | void paintLabel(QPainter*, const QRect&, QTab*, bool) const; | 72 | void paintLabel(QPainter*, const QRect&, QTab*, bool) const; |
67 | int insertTab(QTab *, int index = -1); | 73 | int insertTab(QTab *, int index = -1); |
68 | protected: | 74 | protected: |
69 | QVector<QColor> m_colors; | 75 | QArray<QColor> m_colors; |
76 | }; | ||
77 | |||
78 | /* A QLineEdit with history functionality */ | ||
79 | |||
80 | class IRCHistoryLineEdit : public QLineEdit { | ||
81 | Q_OBJECT | ||
82 | public: | ||
83 | IRCHistoryLineEdit(QWidget *parent = 0, const char *name = 0); | ||
84 | protected: | ||
85 | void keyPressEvent(QKeyEvent *); | ||
86 | protected: | ||
87 | QStringList m_history; | ||
88 | int m_index; | ||
70 | }; | 89 | }; |
71 | 90 | ||
72 | #endif /* __IRCMISC_H */ | 91 | #endif /* __IRCMISC_H */ |
diff --git a/noncore/net/opieirc/ircquerytab.cpp b/noncore/net/opieirc/ircquerytab.cpp index b946174..869e4f7 100644 --- a/noncore/net/opieirc/ircquerytab.cpp +++ b/noncore/net/opieirc/ircquerytab.cpp | |||
@@ -1,83 +1,94 @@ | |||
1 | #include <qhbox.h> | 1 | #include <qhbox.h> |
2 | #include "ircquerytab.h" | 2 | #include "ircquerytab.h" |
3 | #include "ircservertab.h" | 3 | #include "ircservertab.h" |
4 | 4 | ||
5 | IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 5 | IRCQueryTab::IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
6 | m_mainWindow = mainWindow; | 6 | m_mainWindow = mainWindow; |
7 | m_parentTab = parentTab; | 7 | m_parentTab = parentTab; |
8 | m_lines = 0; | ||
8 | m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */ | 9 | m_person = new IRCPerson(*person); /* We need this (the person might sign off and the original IRCPerson gets deleted) */ |
9 | m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>"); | 10 | m_description->setText(tr("Talking to ") + " <b>" + person->nick() + "</b>"); |
10 | QHBox *hbox = new QHBox(this); | 11 | QHBox *hbox = new QHBox(this); |
11 | m_textview = new QTextView(hbox); | 12 | m_textview = new QTextView(hbox); |
12 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 13 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
13 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 14 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
14 | m_textview->setTextFormat(RichText); | 15 | m_textview->setTextFormat(RichText); |
15 | m_field = new QLineEdit(this); | 16 | m_field = new IRCHistoryLineEdit(this); |
16 | m_layout->add(hbox); | 17 | m_layout->add(hbox); |
17 | hbox->show(); | 18 | hbox->show(); |
18 | m_layout->add(m_field); | 19 | m_layout->add(m_field); |
19 | m_field->setFocus(); | 20 | m_field->setFocus(); |
20 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 21 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
21 | settingsChanged(); | 22 | settingsChanged(); |
22 | } | 23 | } |
23 | 24 | ||
24 | void IRCQueryTab::appendText(QString text) { | 25 | void IRCQueryTab::appendText(QString text) { |
25 | /* not using append because it creates layout problems */ | 26 | /* not using append because it creates layout problems */ |
26 | m_textview->setText(m_textview->text() + text); | 27 | QString txt = m_textview->text() + text + "\n"; |
28 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | ||
29 | int firstBreak = txt.find('\n'); | ||
30 | if (firstBreak != -1) { | ||
31 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | ||
32 | } | ||
33 | } else { | ||
34 | m_lines++; | ||
35 | } | ||
36 | m_textview->setText(txt); | ||
27 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 37 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
28 | emit changed(this); | 38 | emit changed(this); |
29 | } | 39 | } |
30 | 40 | ||
31 | IRCQueryTab::~IRCQueryTab() { | 41 | IRCQueryTab::~IRCQueryTab() { |
32 | m_parentTab->removeQueryTab(this); | 42 | m_parentTab->removeQueryTab(this); |
33 | delete m_person; | 43 | delete m_person; |
34 | } | 44 | } |
35 | 45 | ||
36 | void IRCQueryTab::processCommand() { | 46 | void IRCQueryTab::processCommand() { |
37 | QString text = m_field->text(); | 47 | QString text = m_field->text(); |
38 | if (text.length()>0) { | 48 | if (text.length()>0) { |
39 | if (session()->isSessionActive()) { | 49 | if (session()->isSessionActive()) { |
40 | if (text.startsWith("/") && !text.startsWith("//")) { | 50 | if (text.startsWith("/") && !text.startsWith("//")) { |
41 | /* Command mode */ | 51 | /* Command mode */ |
42 | m_parentTab->executeCommand(this, text);; | 52 | m_parentTab->executeCommand(this, text);; |
43 | } else { | 53 | } else { |
44 | if (text.startsWith("//")) | 54 | if (text.startsWith("//")) |
45 | text = text.right(text.length()-1); | 55 | text = text.right(text.length()-1); |
46 | session()->sendMessage(m_person, m_field->text()); | 56 | session()->sendMessage(m_person, m_field->text()); |
47 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+IRCOutput::toHTML(m_field->text())+"</font><br>"); | 57 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_selfColor + "\">"+m_parentTab->server()->nick()+"</font><font color=\"" + m_textColor + "\">> "+IRCOutput::toHTML(m_field->text())+"</font><br>"); |
48 | } | 58 | } |
49 | } else { | 59 | } else { |
50 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); | 60 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); |
51 | } | 61 | } |
52 | } | 62 | } |
53 | m_field->clear(); | 63 | m_field->clear(); |
54 | } | 64 | } |
55 | 65 | ||
56 | void IRCQueryTab::display(IRCOutput output) { | 66 | void IRCQueryTab::display(IRCOutput output) { |
57 | if (output.type() == OUTPUT_QUERYPRIVMSG) { | 67 | if (output.type() == OUTPUT_QUERYPRIVMSG) { |
58 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_otherColor + "\">"+m_person->nick()+"</font><font color=\"" + m_textColor + "\">> " + output.htmlMessage() + "</font><br>"); | 68 | appendText("<font color=\"" + m_textColor + "\"><</font><font color=\"" + m_otherColor + "\">"+m_person->nick()+"</font><font color=\"" + m_textColor + "\">> " + output.htmlMessage() + "</font><br>"); |
59 | } else if (output.type() == OUTPUT_QUERYACTION) { | 69 | } else if (output.type() == OUTPUT_QUERYACTION) { |
60 | appendText("<font color=\"" + m_otherColor + "\">" + output.htmlMessage() + "<br>"); | 70 | appendText("<font color=\"" + m_otherColor + "\">" + output.htmlMessage() + "<br>"); |
61 | } | 71 | } |
62 | } | 72 | } |
63 | 73 | ||
64 | void IRCQueryTab::settingsChanged() { | 74 | void IRCQueryTab::settingsChanged() { |
65 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 75 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
76 | m_lines = 0; | ||
66 | } | 77 | } |
67 | 78 | ||
68 | QString IRCQueryTab::title() { | 79 | QString IRCQueryTab::title() { |
69 | return m_person->nick(); | 80 | return m_person->nick(); |
70 | } | 81 | } |
71 | 82 | ||
72 | IRCSession *IRCQueryTab::session() { | 83 | IRCSession *IRCQueryTab::session() { |
73 | return m_parentTab->session(); | 84 | return m_parentTab->session(); |
74 | } | 85 | } |
75 | 86 | ||
76 | void IRCQueryTab::remove() { | 87 | void IRCQueryTab::remove() { |
77 | m_mainWindow->killTab(this); | 88 | m_mainWindow->killTab(this); |
78 | } | 89 | } |
79 | 90 | ||
80 | IRCPerson *IRCQueryTab::person() { | 91 | IRCPerson *IRCQueryTab::person() { |
81 | return m_person; | 92 | return m_person; |
82 | } | 93 | } |
83 | 94 | ||
diff --git a/noncore/net/opieirc/ircquerytab.h b/noncore/net/opieirc/ircquerytab.h index 07fa57f..f9cc8e1 100644 --- a/noncore/net/opieirc/ircquerytab.h +++ b/noncore/net/opieirc/ircquerytab.h | |||
@@ -1,52 +1,54 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCQUERYTAB_H | 21 | #ifndef __IRCQUERYTAB_H |
22 | #define __IRCQUERYTAB_H | 22 | #define __IRCQUERYTAB_H |
23 | 23 | ||
24 | #include "ircsession.h" | ||
25 | #include "mainwindow.h" | 24 | #include "mainwindow.h" |
25 | #include "ircsession.h" | ||
26 | #include "ircmisc.h" | ||
26 | 27 | ||
27 | class IRCServerTab; | 28 | class IRCServerTab; |
28 | class IRCQueryTab : public IRCTab { | 29 | class IRCQueryTab : public IRCTab { |
29 | Q_OBJECT | 30 | Q_OBJECT |
30 | public: | 31 | public: |
31 | /* IRCTab implementation */ | 32 | /* IRCTab implementation */ |
32 | IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 33 | IRCQueryTab(IRCPerson *person, IRCServerTab *parentTab, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
33 | ~IRCQueryTab(); | 34 | ~IRCQueryTab(); |
34 | QString title(); | 35 | QString title(); |
35 | IRCSession *session(); | 36 | IRCSession *session(); |
36 | IRCPerson *person(); | 37 | IRCPerson *person(); |
37 | void appendText(QString text); | 38 | void appendText(QString text); |
38 | public slots: | 39 | public slots: |
39 | void remove(); | 40 | void remove(); |
40 | void processCommand(); | 41 | void processCommand(); |
41 | void display(IRCOutput output); | 42 | void display(IRCOutput output); |
42 | void settingsChanged(); | 43 | void settingsChanged(); |
43 | protected: | 44 | protected: |
44 | bool m_close; | 45 | bool m_close; |
45 | MainWindow *m_mainWindow; | 46 | MainWindow *m_mainWindow; |
46 | IRCServerTab *m_parentTab; | 47 | IRCServerTab *m_parentTab; |
47 | IRCPerson *m_person; | 48 | IRCPerson *m_person; |
48 | QTextView *m_textview; | 49 | QTextView *m_textview; |
49 | QLineEdit *m_field; | 50 | IRCHistoryLineEdit *m_field; |
51 | int m_lines; | ||
50 | }; | 52 | }; |
51 | 53 | ||
52 | #endif /* __IRCQUERYTAB_H */ | 54 | #endif /* __IRCQUERYTAB_H */ |
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 4ed5364..5d1e290 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp | |||
@@ -1,108 +1,119 @@ | |||
1 | #include <qpe/config.h> | 1 | #include <qpe/config.h> |
2 | #include <qtextstream.h> | 2 | #include <qtextstream.h> |
3 | #include "ircservertab.h" | 3 | #include "ircservertab.h" |
4 | 4 | ||
5 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 5 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
6 | m_server = server; | 6 | m_server = server; |
7 | m_session = new IRCSession(&m_server); | 7 | m_session = new IRCSession(&m_server); |
8 | m_mainWindow = mainWindow; | 8 | m_mainWindow = mainWindow; |
9 | m_close = FALSE; | 9 | m_close = FALSE; |
10 | m_lines = 0; | ||
10 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); | 11 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); |
11 | m_textview = new QTextView(this); | 12 | m_textview = new QTextView(this); |
12 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 13 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
13 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 14 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
14 | m_textview->setTextFormat(RichText); | 15 | m_textview->setTextFormat(RichText); |
15 | m_layout->add(m_textview); | 16 | m_layout->add(m_textview); |
16 | m_field = new QLineEdit(this); | 17 | m_field = new IRCHistoryLineEdit(this); |
17 | m_layout->add(m_field); | 18 | m_layout->add(m_field); |
18 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 19 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
19 | m_field->setFocus(); | 20 | m_field->setFocus(); |
20 | connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); | 21 | connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); |
21 | settingsChanged(); | 22 | settingsChanged(); |
22 | } | 23 | } |
23 | 24 | ||
24 | void IRCServerTab::appendText(QString text) { | 25 | void IRCServerTab::appendText(QString text) { |
25 | /* not using append because it creates layout problems */ | 26 | /* not using append because it creates layout problems */ |
26 | m_textview->setText(m_textview->text() + text); | 27 | QString txt = m_textview->text() + text + "\n"; |
28 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | ||
29 | int firstBreak = txt.find('\n'); | ||
30 | if (firstBreak != -1) { | ||
31 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | ||
32 | } | ||
33 | } else { | ||
34 | m_lines++; | ||
35 | } | ||
36 | m_textview->setText(txt); | ||
27 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 37 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
28 | emit changed(this); | 38 | emit changed(this); |
29 | } | 39 | } |
30 | 40 | ||
31 | IRCServerTab::~IRCServerTab() { | 41 | IRCServerTab::~IRCServerTab() { |
32 | delete m_session; | 42 | delete m_session; |
33 | } | 43 | } |
34 | 44 | ||
35 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { | 45 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { |
36 | m_channelTabs.remove(tab); | 46 | m_channelTabs.remove(tab); |
37 | } | 47 | } |
38 | 48 | ||
39 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { | 49 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { |
40 | m_queryTabs.remove(tab); | 50 | m_queryTabs.remove(tab); |
41 | } | 51 | } |
42 | 52 | ||
43 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { | 53 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { |
44 | m_queryTabs.append(tab); | 54 | m_queryTabs.append(tab); |
45 | } | 55 | } |
46 | 56 | ||
47 | QString IRCServerTab::title() { | 57 | QString IRCServerTab::title() { |
48 | return "Server"; | 58 | return "Server"; |
49 | } | 59 | } |
50 | 60 | ||
51 | IRCSession *IRCServerTab::session() { | 61 | IRCSession *IRCServerTab::session() { |
52 | return m_session; | 62 | return m_session; |
53 | } | 63 | } |
54 | 64 | ||
55 | IRCServer *IRCServerTab::server() { | 65 | IRCServer *IRCServerTab::server() { |
56 | return &m_server; | 66 | return &m_server; |
57 | } | 67 | } |
58 | 68 | ||
59 | void IRCServerTab::settingsChanged() { | 69 | void IRCServerTab::settingsChanged() { |
60 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | 70 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); |
71 | m_lines = 0; | ||
61 | } | 72 | } |
62 | 73 | ||
63 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | 74 | void IRCServerTab::executeCommand(IRCTab *tab, QString line) { |
64 | QTextIStream stream(&line); | 75 | QTextIStream stream(&line); |
65 | QString command; | 76 | QString command; |
66 | stream >> command; | 77 | stream >> command; |
67 | command = command.upper().right(command.length()-1); | 78 | command = command.upper().right(command.length()-1); |
68 | 79 | ||
69 | if (command == "JOIN") { | 80 | if (command == "JOIN") { |
70 | QString channel; | 81 | QString channel; |
71 | stream >> channel; | 82 | stream >> channel; |
72 | if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { | 83 | if (channel.length() > 0 && (channel.startsWith("#") || channel.startsWith("+"))) { |
73 | m_session->join(channel); | 84 | m_session->join(channel); |
74 | } else { | 85 | } else { |
75 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); | 86 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown channel format!</font><br>"); |
76 | } | 87 | } |
77 | } else if (command == "ME") { | 88 | } else if (command == "ME") { |
78 | QString text = line.right(line.length()-4); | 89 | QString text = line.right(line.length()-4); |
79 | if (text.length() > 0) { | 90 | if (text.length() > 0) { |
80 | if (tab->isA("IRCChannelTab")) { | 91 | if (tab->isA("IRCChannelTab")) { |
81 | tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); | 92 | tab->appendText("<font color=\"" + m_selfColor + "\">*" + IRCOutput::toHTML(m_server.nick()) + " " + IRCOutput::toHTML(text) + "</font><br>"); |
82 | m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); | 93 | m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); |
83 | } else if (tab->isA("IRCQueryTab")) { | 94 | } else if (tab->isA("IRCQueryTab")) { |
84 | 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>"); |
85 | m_session->sendAction(((IRCQueryTab *)tab)->person(), text); | 96 | m_session->sendAction(((IRCQueryTab *)tab)->person(), text); |
86 | } else { | 97 | } else { |
87 | tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>"); | 98 | tab->appendText("<font color=\"" + m_errorColor + "\">Invalid tab for this command</font><br>"); |
88 | } | 99 | } |
89 | } | 100 | } |
90 | } else if (command == "MSG") { | 101 | } else if (command == "MSG") { |
91 | QString nickname; | 102 | QString nickname; |
92 | stream >> nickname; | 103 | stream >> nickname; |
93 | if (nickname.length() > 0) { | 104 | if (nickname.length() > 0) { |
94 | if (line.length() > 6 + nickname.length()) { | 105 | if (line.length() > 6 + nickname.length()) { |
95 | QString text = line.right(line.length()-nickname.length()-6); | 106 | QString text = line.right(line.length()-nickname.length()-6); |
96 | IRCPerson person; | 107 | IRCPerson person; |
97 | person.setNick(nickname); | 108 | person.setNick(nickname); |
98 | tab->appendText("<font color=\"" + m_textColor + "\">></font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(nickname)+"</font><font color=\"" + m_textColor + "\">< "+IRCOutput::toHTML(text)+"</font><br>"); | 109 | tab->appendText("<font color=\"" + m_textColor + "\">></font><font color=\"" + m_otherColor + "\">"+IRCOutput::toHTML(nickname)+"</font><font color=\"" + m_textColor + "\">< "+IRCOutput::toHTML(text)+"</font><br>"); |
99 | m_session->sendMessage(&person, text); | 110 | m_session->sendMessage(&person, text); |
100 | } | 111 | } |
101 | } | 112 | } |
102 | } else { | 113 | } else { |
103 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>"); | 114 | tab->appendText("<font color=\"" + m_errorColor + "\">Unknown command</font><br>"); |
104 | } | 115 | } |
105 | } | 116 | } |
106 | 117 | ||
107 | void IRCServerTab::processCommand() { | 118 | void IRCServerTab::processCommand() { |
108 | QString text = m_field->text(); | 119 | QString text = m_field->text(); |
diff --git a/noncore/net/opieirc/ircservertab.h b/noncore/net/opieirc/ircservertab.h index 698689a..8d24cba 100644 --- a/noncore/net/opieirc/ircservertab.h +++ b/noncore/net/opieirc/ircservertab.h | |||
@@ -1,73 +1,75 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCSERVERTAB_H | 21 | #ifndef __IRCSERVERTAB_H |
22 | #define __IRCSERVERTAB_H | 22 | #define __IRCSERVERTAB_H |
23 | 23 | ||
24 | #include "irctab.h" | 24 | #include "irctab.h" |
25 | #include "ircsession.h" | 25 | #include "ircsession.h" |
26 | #include "mainwindow.h" | 26 | #include "mainwindow.h" |
27 | #include "ircchanneltab.h" | 27 | #include "ircchanneltab.h" |
28 | #include "ircquerytab.h" | 28 | #include "ircquerytab.h" |
29 | #include "ircmisc.h" | ||
29 | 30 | ||
30 | class IRCServerTab : public IRCTab { | 31 | class IRCServerTab : public IRCTab { |
31 | Q_OBJECT | 32 | Q_OBJECT |
32 | public: | 33 | public: |
33 | /* IRCTab implementation */ | 34 | /* IRCTab implementation */ |
34 | IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 35 | IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
35 | ~IRCServerTab(); | 36 | ~IRCServerTab(); |
36 | QString title(); | 37 | QString title(); |
37 | IRCSession *session(); | 38 | IRCSession *session(); |
38 | IRCServer *server(); | 39 | IRCServer *server(); |
39 | 40 | ||
40 | /* Start the server session */ | 41 | /* Start the server session */ |
41 | void doConnect(); | 42 | void doConnect(); |
42 | /* Remove tabs from the internal tab lists */ | 43 | /* Remove tabs from the internal tab lists */ |
43 | void removeChannelTab(IRCChannelTab *tab); | 44 | void removeChannelTab(IRCChannelTab *tab); |
44 | void removeQueryTab(IRCQueryTab *tab); | 45 | void removeQueryTab(IRCQueryTab *tab); |
45 | /* Return tabs from the internal tab lists */ | 46 | /* Return tabs from the internal tab lists */ |
46 | IRCChannelTab *getTabForChannel(IRCChannel *channel); | 47 | IRCChannelTab *getTabForChannel(IRCChannel *channel); |
47 | IRCQueryTab *getTabForQuery(IRCPerson *person); | 48 | IRCQueryTab *getTabForQuery(IRCPerson *person); |
48 | /* Add tabs to the internal tab lists */ | 49 | /* Add tabs to the internal tab lists */ |
49 | void addQueryTab(IRCQueryTab *tab); | 50 | void addQueryTab(IRCQueryTab *tab); |
50 | /* Execute a user command such as /join, /msg etc */ | 51 | /* Execute a user command such as /join, /msg etc */ |
51 | void executeCommand(IRCTab *tab, QString line); | 52 | void executeCommand(IRCTab *tab, QString line); |
52 | protected: | 53 | protected: |
53 | void appendText(QString text); | 54 | void appendText(QString text); |
54 | public slots: | 55 | public slots: |
55 | void remove(); | 56 | void remove(); |
56 | void processCommand(); | 57 | void processCommand(); |
57 | void settingsChanged(); | 58 | void settingsChanged(); |
58 | protected slots: | 59 | protected slots: |
59 | void display(IRCOutput output); | 60 | void display(IRCOutput output); |
60 | protected: | 61 | protected: |
62 | int m_lines; | ||
61 | bool m_close; | 63 | bool m_close; |
62 | IRCServer m_server; | 64 | IRCServer m_server; |
63 | IRCSession *m_session; | 65 | IRCSession *m_session; |
64 | MainWindow *m_mainWindow; | 66 | MainWindow *m_mainWindow; |
65 | QTextView *m_textview; | 67 | QTextView *m_textview; |
66 | QLineEdit *m_field; | 68 | IRCHistoryLineEdit *m_field; |
67 | /* Channel tabs associated with this server tab */ | 69 | /* Channel tabs associated with this server tab */ |
68 | QList<IRCChannelTab> m_channelTabs; | 70 | QList<IRCChannelTab> m_channelTabs; |
69 | /* Query tabs associated with this server tab */ | 71 | /* Query tabs associated with this server tab */ |
70 | QList<IRCQueryTab> m_queryTabs; | 72 | QList<IRCQueryTab> m_queryTabs; |
71 | }; | 73 | }; |
72 | 74 | ||
73 | #endif /* __IRCSERVERTAB_H */ | 75 | #endif /* __IRCSERVERTAB_H */ |
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp index d1fef67..1903e87 100644 --- a/noncore/net/opieirc/ircsettings.cpp +++ b/noncore/net/opieirc/ircsettings.cpp | |||
@@ -1,71 +1,95 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qvalidator.h> | ||
3 | #include <qscrollview.h> | ||
2 | #include "ircsettings.h" | 4 | #include "ircsettings.h" |
3 | #include "irctab.h" | 5 | #include "irctab.h" |
4 | #include "ircmisc.h" | 6 | #include "ircmisc.h" |
5 | #include <stdio.h> | ||
6 | 7 | ||
7 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags f) : QDialog(parent, name, modal, f) { | 8 | IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags f) : QDialog(parent, name, modal, f) { |
9 | setCaption("Settings"); | ||
8 | m_config = new Config("OpieIRC"); | 10 | m_config = new Config("OpieIRC"); |
9 | m_config->setGroup("OpieIRC"); | 11 | m_config->setGroup("OpieIRC"); |
10 | 12 | QHBoxLayout *l = new QHBoxLayout(this, 2, 2); | |
11 | setCaption("Settings"); | 13 | QTabWidget *tw = new QTabWidget(this); |
12 | QGridLayout *layout = new QGridLayout(this, 7, 2, 5, 0); | 14 | l->addWidget(tw); |
13 | QLabel *label = new QLabel(tr("Background color :"), this); | 15 | /* General Configuration */ |
16 | QWidget *widget = new QWidget(tw); | ||
17 | QGridLayout *layout = new QGridLayout(widget, 1, 2, 5, 0); | ||
18 | QLabel *label = new QLabel(tr("Lines displayed :"), widget); | ||
19 | layout->addWidget(label, 0, 0); | ||
20 | m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), widget); | ||
21 | QIntValidator *validator = new QIntValidator(this); | ||
22 | validator->setTop(10000); | ||
23 | validator->setBottom(0); | ||
24 | m_lines->setValidator(validator); | ||
25 | layout->addWidget(m_lines, 0, 1); | ||
26 | tw->addTab(widget, tr("General")); | ||
27 | |||
28 | /* Color configuration */ | ||
29 | QScrollView *view = new QScrollView(tw); | ||
30 | view->setResizePolicy(QScrollView::AutoOneFit); | ||
31 | widget = new QWidget(view->viewport()); | ||
32 | view->addChild(widget); | ||
33 | layout = new QGridLayout(widget, 7, 2, 5, 0); | ||
34 | label = new QLabel(tr("Background color :"), widget); | ||
14 | layout->addWidget(label, 0, 0); | 35 | layout->addWidget(label, 0, 0); |
15 | m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), this); | 36 | m_background = new IRCFramedColorLabel(QColor(m_config->readEntry("BackgroundColor", "#FFFFFF")), widget); |
16 | layout->addWidget(m_background, 0, 1); | 37 | layout->addWidget(m_background, 0, 1); |
17 | label = new QLabel(tr("Normal text color :"), this); | 38 | label = new QLabel(tr("Normal text color :"), widget); |
18 | layout->addWidget(label, 1, 0); | 39 | layout->addWidget(label, 1, 0); |
19 | m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), this); | 40 | m_text = new IRCFramedColorLabel(m_config->readEntry("TextColor", "#000000"), widget); |
20 | layout->addWidget(m_text, 1, 1); | 41 | layout->addWidget(m_text, 1, 1); |
21 | label = new QLabel(tr("Error color :"), this); | 42 | label = new QLabel(tr("Error color :"), widget); |
22 | layout->addWidget(label, 2, 0); | 43 | layout->addWidget(label, 2, 0); |
23 | m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), this); | 44 | m_error = new IRCFramedColorLabel(m_config->readEntry("ErrorColor", "#FF0000"), widget); |
24 | layout->addWidget(m_error, 2, 1); | 45 | layout->addWidget(m_error, 2, 1); |
25 | label = new QLabel(tr("Text written by yourself :"), this); | 46 | label = new QLabel(tr("Text written by yourself :"), widget); |
26 | layout->addWidget(label, 3, 0); | 47 | layout->addWidget(label, 3, 0); |
27 | m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), this); | 48 | m_self = new IRCFramedColorLabel(m_config->readEntry("SelfColor", "#CC0000"), widget); |
28 | layout->addWidget(m_self, 3, 1); | 49 | layout->addWidget(m_self, 3, 1); |
29 | label = new QLabel(tr("Text written by others :"), this); | 50 | label = new QLabel(tr("Text written by others :"), widget); |
30 | layout->addWidget(label, 4, 0); | 51 | layout->addWidget(label, 4, 0); |
31 | m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), this); | 52 | m_other = new IRCFramedColorLabel(m_config->readEntry("OtherColor", "#0000BB"), widget); |
32 | layout->addWidget(m_other, 4, 1); | 53 | layout->addWidget(m_other, 4, 1); |
33 | label = new QLabel(tr("Text written by the server :"), this); | 54 | label = new QLabel(tr("Text written by the server :"), widget); |
34 | layout->addWidget(label, 5, 0); | 55 | layout->addWidget(label, 5, 0); |
35 | m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), this); | 56 | m_server = new IRCFramedColorLabel(m_config->readEntry("ServerColor", "#0000FF"), widget); |
36 | layout->addWidget(m_server, 5, 1); | 57 | layout->addWidget(m_server, 5, 1); |
37 | label = new QLabel(tr("Notifications :"), this); | 58 | label = new QLabel(tr("Notifications :"), widget); |
38 | layout->addWidget(label, 6, 0); | 59 | layout->addWidget(label, 6, 0); |
39 | m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), this); | 60 | m_notification = new IRCFramedColorLabel(m_config->readEntry("NotificationColor", "#AAE300"), widget); |
40 | layout->addWidget(m_notification, 6, 1); | 61 | layout->addWidget(m_notification, 6, 1); |
62 | tw->addTab(view, tr("Colors")); | ||
41 | showMaximized(); | 63 | showMaximized(); |
42 | } | 64 | } |
43 | 65 | ||
44 | QString IRCSettings::getColorString(QWidget *widget) { | 66 | QString IRCSettings::getColorString(QWidget *widget) { |
45 | QColor color = ((IRCFramedColorLabel *)widget)->color(); | 67 | QColor color = ((IRCFramedColorLabel *)widget)->color(); |
46 | QString temp; | 68 | QString temp; |
47 | temp.sprintf("#%02x%02x%02x", color.red(), color.green(), color.blue()); | 69 | temp.sprintf("#%02x%02x%02x", color.red(), color.green(), color.blue()); |
48 | return temp; | 70 | return temp; |
49 | } | 71 | } |
50 | 72 | ||
51 | void IRCSettings::accept() { | 73 | void IRCSettings::accept() { |
52 | IRCTab::m_backgroundColor = getColorString(m_background); | 74 | IRCTab::m_backgroundColor = getColorString(m_background); |
53 | IRCTab::m_textColor = getColorString(m_text); | 75 | IRCTab::m_textColor = getColorString(m_text); |
54 | IRCTab::m_errorColor = getColorString(m_error); | 76 | IRCTab::m_errorColor = getColorString(m_error); |
55 | IRCTab::m_selfColor = getColorString(m_self); | 77 | IRCTab::m_selfColor = getColorString(m_self); |
56 | IRCTab::m_otherColor = getColorString(m_other); | 78 | IRCTab::m_otherColor = getColorString(m_other); |
57 | IRCTab::m_serverColor = getColorString(m_server); | 79 | IRCTab::m_serverColor = getColorString(m_server); |
58 | IRCTab::m_notificationColor = getColorString(m_notification); | 80 | IRCTab::m_notificationColor = getColorString(m_notification); |
81 | IRCTab::m_maxLines = m_lines->text().toInt(); | ||
59 | m_config->writeEntry("BackgroundColor", getColorString(m_background)); | 82 | m_config->writeEntry("BackgroundColor", getColorString(m_background)); |
60 | m_config->writeEntry("TextColor", getColorString(m_text)); | 83 | m_config->writeEntry("TextColor", getColorString(m_text)); |
61 | m_config->writeEntry("ErrorColor", getColorString(m_error)); | 84 | m_config->writeEntry("ErrorColor", getColorString(m_error)); |
62 | m_config->writeEntry("SelfColor", getColorString(m_self)); | 85 | m_config->writeEntry("SelfColor", getColorString(m_self)); |
63 | m_config->writeEntry("OtherColor", getColorString(m_other)); | 86 | m_config->writeEntry("OtherColor", getColorString(m_other)); |
64 | m_config->writeEntry("ServerColor", getColorString(m_server)); | 87 | m_config->writeEntry("ServerColor", getColorString(m_server)); |
65 | m_config->writeEntry("NotificationColor", getColorString(m_notification)); | 88 | m_config->writeEntry("NotificationColor", getColorString(m_notification)); |
89 | m_config->writeEntry("Lines", m_lines->text()); | ||
66 | QDialog::accept(); | 90 | QDialog::accept(); |
67 | } | 91 | } |
68 | 92 | ||
69 | IRCSettings::~IRCSettings() { | 93 | IRCSettings::~IRCSettings() { |
70 | delete m_config; | 94 | delete m_config; |
71 | } | 95 | } |
diff --git a/noncore/net/opieirc/ircsettings.h b/noncore/net/opieirc/ircsettings.h index 1d3aeb7..190abaf 100644 --- a/noncore/net/opieirc/ircsettings.h +++ b/noncore/net/opieirc/ircsettings.h | |||
@@ -1,46 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCSETTINGS_H | 21 | #ifndef __IRCSETTINGS_H |
22 | #define __IRCSETTINGS_H | 22 | #define __IRCSETTINGS_H |
23 | 23 | ||
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qdialog.h> | 25 | #include <qdialog.h> |
26 | #include <qlineedit.h> | ||
26 | 27 | ||
27 | class IRCSettings : public QDialog { | 28 | class IRCSettings : public QDialog { |
28 | Q_OBJECT | 29 | Q_OBJECT |
29 | public: | 30 | public: |
30 | IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0); | 31 | IRCSettings(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0); |
31 | QString getColorString(QWidget *widget); | 32 | QString getColorString(QWidget *widget); |
32 | ~IRCSettings(); | 33 | ~IRCSettings(); |
33 | protected slots: | 34 | protected slots: |
34 | void accept(); | 35 | void accept(); |
35 | protected: | 36 | protected: |
36 | Config *m_config; | 37 | Config *m_config; |
37 | QWidget *m_background; | 38 | QWidget *m_background; |
38 | QWidget *m_text; | 39 | QWidget *m_text; |
39 | QWidget *m_error; | 40 | QWidget *m_error; |
40 | QWidget *m_self; | 41 | QWidget *m_self; |
41 | QWidget *m_server; | 42 | QWidget *m_server; |
42 | QWidget *m_other; | 43 | QWidget *m_other; |
43 | QWidget *m_notification; | 44 | QWidget *m_notification; |
45 | QLineEdit *m_lines; | ||
44 | }; | 46 | }; |
45 | 47 | ||
46 | #endif /* __IRCSETTINGS_H */ | 48 | #endif /* __IRCSETTINGS_H */ |
diff --git a/noncore/net/opieirc/irctab.cpp b/noncore/net/opieirc/irctab.cpp index a4dd7e2..0bb9d4c 100644 --- a/noncore/net/opieirc/irctab.cpp +++ b/noncore/net/opieirc/irctab.cpp | |||
@@ -1,36 +1,36 @@ | |||
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 "irctab.h" | 4 | #include "irctab.h" |
5 | 5 | ||
6 | QString IRCTab::m_errorColor; | 6 | QString IRCTab::m_errorColor; |
7 | QString IRCTab::m_serverColor; | 7 | QString IRCTab::m_serverColor; |
8 | QString IRCTab::m_textColor; | 8 | QString IRCTab::m_textColor; |
9 | QString IRCTab::m_backgroundColor; | 9 | QString IRCTab::m_backgroundColor; |
10 | QString IRCTab::m_selfColor; | 10 | QString IRCTab::m_selfColor; |
11 | QString IRCTab::m_otherColor; | 11 | QString IRCTab::m_otherColor; |
12 | QString IRCTab::m_notificationColor; | 12 | QString IRCTab::m_notificationColor; |
13 | 13 | int IRCTab::m_maxLines; | |
14 | 14 | ||
15 | IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { | 15 | IRCTab::IRCTab(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) { |
16 | m_layout = new QVBoxLayout(this); | 16 | m_layout = new QVBoxLayout(this); |
17 | QHBoxLayout *descLayout = new QHBoxLayout(m_layout); | 17 | QHBoxLayout *descLayout = new QHBoxLayout(m_layout); |
18 | descLayout->setMargin(5); | 18 | descLayout->setMargin(5); |
19 | m_description = new QLabel(tr("Missing description"), this); | 19 | m_description = new QLabel(tr("Missing description"), this); |
20 | descLayout->addWidget(m_description); | 20 | descLayout->addWidget(m_description); |
21 | descLayout->setStretchFactor(m_description, 5); | 21 | descLayout->setStretchFactor(m_description, 5); |
22 | QPushButton *close = new QPushButton(this); | 22 | QPushButton *close = new QPushButton(this); |
23 | close->setPixmap(Resource::loadPixmap("close")); | 23 | close->setPixmap(Resource::loadPixmap("close")); |
24 | connect(close, SIGNAL(clicked()), this, SLOT(remove())); | 24 | connect(close, SIGNAL(clicked()), this, SLOT(remove())); |
25 | descLayout->addWidget(close); | 25 | descLayout->addWidget(close); |
26 | descLayout->setStretchFactor(m_description, 1); | 26 | descLayout->setStretchFactor(m_description, 1); |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | void IRCTab::setID(int id) { | 30 | void IRCTab::setID(int id) { |
31 | m_id = id; | 31 | m_id = id; |
32 | } | 32 | } |
33 | 33 | ||
34 | int IRCTab::id() { | 34 | int IRCTab::id() { |
35 | return m_id; | 35 | return m_id; |
36 | } | 36 | } |
diff --git a/noncore/net/opieirc/irctab.h b/noncore/net/opieirc/irctab.h index e3a1857..7a2d0a2 100644 --- a/noncore/net/opieirc/irctab.h +++ b/noncore/net/opieirc/irctab.h | |||
@@ -1,63 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCTAB_H | 21 | #ifndef __IRCTAB_H |
22 | #define __IRCTAB_H | 22 | #define __IRCTAB_H |
23 | 23 | ||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qtextview.h> | 25 | #include <qtextview.h> |
26 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include "ircsession.h" | 29 | #include "ircsession.h" |
30 | 30 | ||
31 | /* This is the base class for any tabs which need to be integrated into | 31 | /* This is the base class for any tabs which need to be integrated into |
32 | the main GUI tab widget */ | 32 | the main GUI tab widget */ |
33 | 33 | ||
34 | class IRCTab : public QWidget { | 34 | class IRCTab : public QWidget { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | public: | 36 | public: |
37 | IRCTab(QWidget *parent = 0, const char *name = 0, WFlags f = 0); | 37 | IRCTab(QWidget *parent = 0, const char *name = 0, WFlags f = 0); |
38 | /* The ID is required to store the position of this IRCTab inside the IRCTabWidget */ | ||
38 | void setID(int id); | 39 | void setID(int id); |
39 | int id(); | 40 | int id(); |
40 | virtual QString title() = 0; | 41 | virtual QString title() = 0; |
41 | virtual IRCSession *session() = 0; | 42 | virtual IRCSession *session() = 0; |
42 | virtual void appendText(QString text) = 0; | 43 | virtual void appendText(QString text) = 0; |
43 | signals: | 44 | signals: |
44 | void changed(IRCTab *); | 45 | void changed(IRCTab *); |
45 | public slots: | 46 | public slots: |
46 | virtual void remove() = 0; | 47 | virtual void remove() = 0; |
47 | virtual void settingsChanged() = 0; | 48 | virtual void settingsChanged() = 0; |
48 | protected: | 49 | protected: |
49 | QLabel *m_description; | 50 | QLabel *m_description; |
50 | QVBoxLayout *m_layout; | 51 | QVBoxLayout *m_layout; |
51 | int m_id; | 52 | int m_id; |
52 | public: | 53 | public: |
53 | /* Configuration shared accross all instances - contains HTML style colors (#rrggbb) */ | 54 | /* Configuration shared accross all instances - contains HTML style colors (#rrggbb) */ |
54 | static QString m_errorColor; | 55 | static QString m_errorColor; |
55 | static QString m_serverColor; | 56 | static QString m_serverColor; |
56 | static QString m_textColor; | 57 | static QString m_textColor; |
57 | static QString m_backgroundColor; | 58 | static QString m_backgroundColor; |
58 | static QString m_selfColor; | 59 | static QString m_selfColor; |
59 | static QString m_otherColor; | 60 | static QString m_otherColor; |
60 | static QString m_notificationColor; | 61 | static QString m_notificationColor; |
62 | /* Max number of lines to be displayed */ | ||
63 | static int m_maxLines; | ||
61 | }; | 64 | }; |
62 | 65 | ||
63 | #endif /* __IRCTAB_H */ | 66 | #endif /* __IRCTAB_H */ |
diff --git a/noncore/net/opieirc/ircversion.h b/noncore/net/opieirc/ircversion.h index f0f196e..ec6acfa 100644 --- a/noncore/net/opieirc/ircversion.h +++ b/noncore/net/opieirc/ircversion.h | |||
@@ -1,27 +1,27 @@ | |||
1 | /* | 1 | /* |
2 | OpieIRC - An embedded IRC client | 2 | OpieIRC - An embedded IRC client |
3 | Copyright (C) 2002 Wenzel Jakob | 3 | Copyright (C) 2002 Wenzel Jakob |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef __IRCVERSION_H | 21 | #ifndef __IRCVERSION_H |
22 | #define __IRCVERSION_H | 22 | #define __IRCVERSION_H |
23 | 23 | ||
24 | #define APP_VERSION "OpieIRC 0.3" | 24 | #define APP_VERSION "OpieIRC 0.4" |
25 | #define APP_COPYSTR "(c) 2002 by Wenzel Jakob" | 25 | #define APP_COPYSTR "(c) 2002 by Wenzel Jakob" |
26 | 26 | ||
27 | #endif /* __IRCVERSION_H */ | 27 | #endif /* __IRCVERSION_H */ |
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp index fe59c3b..bb03a1c 100644 --- a/noncore/net/opieirc/mainwindow.cpp +++ b/noncore/net/opieirc/mainwindow.cpp | |||
@@ -1,83 +1,84 @@ | |||
1 | #include <qpe/qpemenubar.h> | 1 | #include <qpe/qpemenubar.h> |
2 | #include <qpe/resource.h> | 2 | #include <qpe/resource.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | 5 | ||
6 | #include "mainwindow.h" | 6 | #include "mainwindow.h" |
7 | #include "ircservertab.h" | 7 | #include "ircservertab.h" |
8 | #include "ircserverlist.h" | 8 | #include "ircserverlist.h" |
9 | #include "ircsettings.h" | 9 | #include "ircsettings.h" |
10 | 10 | ||
11 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { | 11 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags f) : QMainWindow(parent, name, f) { |
12 | setCaption(tr("IRC Client")); | 12 | setCaption(tr("IRC Client")); |
13 | m_tabWidget = new IRCTabWidget(this); | 13 | m_tabWidget = new IRCTabWidget(this); |
14 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); | 14 | connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *))); |
15 | setCentralWidget(m_tabWidget); | 15 | setCentralWidget(m_tabWidget); |
16 | setToolBarsMovable(FALSE); | 16 | setToolBarsMovable(FALSE); |
17 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 17 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
18 | QPopupMenu *irc = new QPopupMenu(this); | 18 | QPopupMenu *irc = new QPopupMenu(this); |
19 | menuBar->insertItem(tr("IRC"), irc); | 19 | menuBar->insertItem(tr("IRC"), irc); |
20 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); | 20 | QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0); |
21 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); | 21 | connect(a, SIGNAL(activated()), this, SLOT(newConnection())); |
22 | a->addTo(irc); | 22 | a->addTo(irc); |
23 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); | 23 | a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0); |
24 | connect(a, SIGNAL(activated()), this, SLOT(settings())); | 24 | connect(a, SIGNAL(activated()), this, SLOT(settings())); |
25 | a->addTo(irc); | 25 | a->addTo(irc); |
26 | loadSettings(); | 26 | loadSettings(); |
27 | } | 27 | } |
28 | 28 | ||
29 | void MainWindow::loadSettings() { | 29 | void MainWindow::loadSettings() { |
30 | Config config("OpieIRC"); | 30 | Config config("OpieIRC"); |
31 | config.setGroup("OpieIRC"); | 31 | config.setGroup("OpieIRC"); |
32 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); | 32 | IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF"); |
33 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); | 33 | IRCTab::m_textColor = config.readEntry("TextColor", "#000000"); |
34 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); | 34 | IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000"); |
35 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); | 35 | IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000"); |
36 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); | 36 | IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB"); |
37 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); | 37 | IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF"); |
38 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); | 38 | IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300"); |
39 | IRCTab::m_maxLines = config.readNumEntry("Lines", 100); | ||
39 | } | 40 | } |
40 | 41 | ||
41 | void MainWindow::selected(QWidget *) { | 42 | void MainWindow::selected(QWidget *) { |
42 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), &black); | 43 | m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black); |
43 | } | 44 | } |
44 | 45 | ||
45 | void MainWindow::addTab(IRCTab *tab) { | 46 | void MainWindow::addTab(IRCTab *tab) { |
46 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); | 47 | connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *))); |
47 | m_tabWidget->addTab(tab, tab->title()); | 48 | m_tabWidget->addTab(tab, tab->title()); |
48 | m_tabWidget->showPage(tab); | 49 | m_tabWidget->showPage(tab); |
49 | tab->setID(m_tabWidget->currentPageIndex()); | 50 | tab->setID(m_tabWidget->currentPageIndex()); |
50 | m_tabs.append(tab); | 51 | m_tabs.append(tab); |
51 | } | 52 | } |
52 | 53 | ||
53 | void MainWindow::changeEvent(IRCTab *tab) { | 54 | void MainWindow::changeEvent(IRCTab *tab) { |
54 | if (tab->id() != m_tabWidget->currentPageIndex()) | 55 | if (tab->id() != m_tabWidget->currentPageIndex()) |
55 | m_tabWidget->setTabColor(tab->id(), &blue); | 56 | m_tabWidget->setTabColor(tab->id(), blue); |
56 | } | 57 | } |
57 | 58 | ||
58 | void MainWindow::killTab(IRCTab *tab) { | 59 | void MainWindow::killTab(IRCTab *tab) { |
59 | m_tabWidget->removePage(tab); | 60 | m_tabWidget->removePage(tab); |
60 | m_tabs.remove(tab); | 61 | m_tabs.remove(tab); |
61 | /* there might be nicer ways to do this .. */ | 62 | /* there might be nicer ways to do this .. */ |
62 | delete tab; | 63 | delete tab; |
63 | } | 64 | } |
64 | 65 | ||
65 | void MainWindow::newConnection() { | 66 | void MainWindow::newConnection() { |
66 | IRCServerList list(this, "ServerList", TRUE); | 67 | IRCServerList list(this, "ServerList", TRUE); |
67 | if (list.exec() == QDialog::Accepted && list.hasServer()) { | 68 | if (list.exec() == QDialog::Accepted && list.hasServer()) { |
68 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); | 69 | IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget); |
69 | addTab(serverTab); | 70 | addTab(serverTab); |
70 | serverTab->doConnect(); | 71 | serverTab->doConnect(); |
71 | } | 72 | } |
72 | } | 73 | } |
73 | 74 | ||
74 | void MainWindow::settings() { | 75 | void MainWindow::settings() { |
75 | IRCSettings settings(this, "Settings", TRUE); | 76 | IRCSettings settings(this, "Settings", TRUE); |
76 | if (settings.exec() == QDialog::Accepted) { | 77 | if (settings.exec() == QDialog::Accepted) { |
77 | QListIterator<IRCTab> it(m_tabs); | 78 | QListIterator<IRCTab> it(m_tabs); |
78 | for (; it.current(); ++it) { | 79 | for (; it.current(); ++it) { |
79 | /* Inform all tabs about the new settings */ | 80 | /* Inform all tabs about the new settings */ |
80 | it.current()->settingsChanged(); | 81 | it.current()->settingsChanged(); |
81 | } | 82 | } |
82 | } | 83 | } |
83 | } | 84 | } |
diff --git a/noncore/net/opieirc/opie-irc.control b/noncore/net/opieirc/opie-irc.control index 9e93991..aada957 100644 --- a/noncore/net/opieirc/opie-irc.control +++ b/noncore/net/opieirc/opie-irc.control | |||
@@ -1,9 +1,8 @@ | |||
1 | Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop | 1 | Files: bin/opieirc pics/opieirc apps/Applications/opieirc.desktop |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: Communications | 3 | Section: Communications |
4 | Maintainer: Wenzel Jakob <root@wazlaf.de> | 4 | Maintainer: Wenzel Jakob <root@wazlaf.de> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: The Opie IRC client lets you chat on your favorite | 8 | Description: The Opie IRC client lets you chat on your favorite IRC server using your handheld computer |
9 | IRC server using your zaurus or ipaq | ||