author | ar <ar> | 2004-09-09 14:08:16 (UTC) |
---|---|---|
committer | ar <ar> | 2004-09-09 14:08:16 (UTC) |
commit | 4e798036b423bcb8800f125357591e48b84594c8 (patch) (unidiff) | |
tree | 910654191df3bbf0972a35c05b3057455f895a81 | |
parent | b3259d2dcf3599828a4eaa0d8de8148ca1839aef (diff) | |
download | opie-4e798036b423bcb8800f125357591e48b84594c8.zip opie-4e798036b423bcb8800f125357591e48b84594c8.tar.gz opie-4e798036b423bcb8800f125357591e48b84594c8.tar.bz2 |
- fix compile problems
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index 7610058..581f9a5 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -1,101 +1,103 @@ | |||
1 | #include <qpe/resource.h> | 1 | #include <qpe/resource.h> |
2 | #include <qwhatsthis.h> | 2 | #include <qwhatsthis.h> |
3 | #include <qhbox.h> | 3 | #include <qhbox.h> |
4 | |||
4 | #include "ircchanneltab.h" | 5 | #include "ircchanneltab.h" |
5 | #include "ircservertab.h" | 6 | #include "ircservertab.h" |
7 | #include "ircmessageparser.h" | ||
6 | 8 | ||
7 | 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) { |
8 | m_mainWindow = mainWindow; | 10 | m_mainWindow = mainWindow; |
9 | m_parentTab = parentTab; | 11 | m_parentTab = parentTab; |
10 | m_channel = channel; | 12 | m_channel = channel; |
11 | m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); | 13 | m_description->setText(tr("Talking on channel") + " <b>" + channel->channelname() + "</b>"); |
12 | QHBox *hbox = new QHBox(this); | 14 | QHBox *hbox = new QHBox(this); |
13 | m_textview = new QTextView(hbox); | 15 | m_textview = new QTextView(hbox); |
14 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 16 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
15 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 17 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
16 | m_listVisible = TRUE; | 18 | m_listVisible = TRUE; |
17 | m_listButton = new QPushButton(">", m_textview); | 19 | m_listButton = new QPushButton(">", m_textview); |
18 | m_listButton->setFlat( true ); | 20 | m_listButton->setFlat( true ); |
19 | m_textview->setCornerWidget(m_listButton); | 21 | m_textview->setCornerWidget(m_listButton); |
20 | m_textview->setTextFormat(RichText); | 22 | m_textview->setTextFormat(RichText); |
21 | QWhatsThis::add(m_textview, tr("Channel discussion")); | 23 | QWhatsThis::add(m_textview, tr("Channel discussion")); |
22 | connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); | 24 | connect(m_listButton, SIGNAL(clicked()), this, SLOT(toggleList())); |
23 | m_list = new IRCChannelList(m_channel, hbox); | 25 | m_list = new IRCChannelList(m_channel, hbox); |
24 | m_list->update(); | 26 | m_list->update(); |
25 | m_list->setMaximumWidth(LISTWIDTH); | 27 | m_list->setMaximumWidth(LISTWIDTH); |
26 | m_field = new IRCHistoryLineEdit(this); | 28 | m_field = new IRCHistoryLineEdit(this); |
27 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); | 29 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); |
28 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); | 30 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); |
29 | connect(m_field, SIGNAL(closeTab()), this, SLOT(remove())); | 31 | connect(m_field, SIGNAL(closeTab()), this, SLOT(remove())); |
30 | connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); | 32 | connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); |
31 | 33 | ||
32 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); | 34 | QWhatsThis::add(m_field, tr("Type your message here to participate in the channel discussion")); |
33 | m_popup = new QPopupMenu(m_list); | 35 | m_popup = new QPopupMenu(m_list); |
34 | m_lines = 0; | 36 | m_lines = 0; |
35 | /* Required so that embedded-style "right" clicks work */ | 37 | /* Required so that embedded-style "right" clicks work */ |
36 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); | 38 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); |
37 | connect(m_list, SIGNAL(mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this, SLOT(mouseButtonPressed(int,QListBoxItem*,const QPoint&))); | 39 | connect(m_list, SIGNAL(mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this, SLOT(mouseButtonPressed(int,QListBoxItem*,const QPoint&))); |
38 | /* Construct the popup menu */ | 40 | /* Construct the popup menu */ |
39 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); | 41 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); |
40 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); | 42 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); |
41 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); | 43 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); |
42 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); | 44 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); |
43 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); | 45 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); |
44 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); | 46 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); |
45 | m_layout->add(hbox); | 47 | m_layout->add(hbox); |
46 | hbox->show(); | 48 | hbox->show(); |
47 | m_layout->add(m_field); | 49 | m_layout->add(m_field); |
48 | m_field->setFocus(); | 50 | m_field->setFocus(); |
49 | m_field->setActiveWindow(); | 51 | m_field->setActiveWindow(); |
50 | 52 | ||
51 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 53 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
52 | connect(m_list, SIGNAL(doubleClicked ( QListBoxItem * ) ), this, SLOT(popupQuery( QListBoxItem * ) )); | 54 | connect(m_list, SIGNAL(doubleClicked ( QListBoxItem * ) ), this, SLOT(popupQuery( QListBoxItem * ) )); |
53 | settingsChanged(); | 55 | settingsChanged(); |
54 | } | 56 | } |
55 | 57 | ||
56 | void IRCChannelTab::scrolling(){ | 58 | void IRCChannelTab::scrolling(){ |
57 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 59 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
58 | } | 60 | } |
59 | 61 | ||
60 | void IRCChannelTab::appendText(QString text) { | 62 | void IRCChannelTab::appendText(QString text) { |
61 | /* not using append because it creates layout problems */ | 63 | /* not using append because it creates layout problems */ |
62 | QString txt = m_textview->text() + IRCTab::appendTimestamp( text ); | 64 | QString txt = m_textview->text() + IRCTab::appendTimestamp( text ); |
63 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | 65 | if (m_maxLines > 0 && m_lines >= m_maxLines) { |
64 | int firstBreak = txt.find('\n'); | 66 | int firstBreak = txt.find('\n'); |
65 | if (firstBreak != -1) { | 67 | if (firstBreak != -1) { |
66 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | 68 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); |
67 | } | 69 | } |
68 | } else { | 70 | } else { |
69 | m_lines++; | 71 | m_lines++; |
70 | } | 72 | } |
71 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 73 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
72 | m_textview->setText(txt); | 74 | m_textview->setText(txt); |
73 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 75 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
74 | 76 | ||
75 | int p1, p2; | 77 | int p1, p2; |
76 | if ( text.contains( IRCMessageParser::tr("Received a CTCP PING from ") ) ) | 78 | if ( text.contains( IRCMessageParser::tr("Received a CTCP PING from ") ) ) |
77 | emit ping( title() ); | 79 | emit ping( title() ); |
78 | else if ( (p1 = text.find("ping", 0, false) )!= -1 && (p2 = text.find( m_parentTab->server()->nick(), 0,false )) != -1 ) { | 80 | else if ( (p1 = text.find("ping", 0, false) )!= -1 && (p2 = text.find( m_parentTab->server()->nick(), 0,false )) != -1 ) { |
79 | int col = text.findRev("color", -1, false); | 81 | int col = text.findRev("color", -1, false); |
80 | if ( col < p2 ) | 82 | if ( col < p2 ) |
81 | emit ping( title() ); | 83 | emit ping( title() ); |
82 | 84 | ||
83 | } | 85 | } |
84 | 86 | ||
85 | emit changed(this); | 87 | emit changed(this); |
86 | } | 88 | } |
87 | 89 | ||
88 | IRCChannelTab::~IRCChannelTab() { | 90 | IRCChannelTab::~IRCChannelTab() { |
89 | m_parentTab->removeChannelTab(this); | 91 | m_parentTab->removeChannelTab(this); |
90 | } | 92 | } |
91 | 93 | ||
92 | void IRCChannelTab::processCommand() { | 94 | void IRCChannelTab::processCommand() { |
93 | QString text = m_field->text(); | 95 | QString text = m_field->text(); |
94 | if (text.length()>0) { | 96 | if (text.length()>0) { |
95 | if (session()->isSessionActive()) { | 97 | if (session()->isSessionActive()) { |
96 | if (text.startsWith("/") && !text.startsWith("//")) { | 98 | if (text.startsWith("/") && !text.startsWith("//")) { |
97 | /* Command mode */ | 99 | /* Command mode */ |
98 | m_parentTab->executeCommand(this, text);; | 100 | m_parentTab->executeCommand(this, text);; |
99 | } else { | 101 | } else { |
100 | if (text.startsWith("//")) | 102 | if (text.startsWith("//")) |
101 | text = text.right(text.length()-1); | 103 | text = text.right(text.length()-1); |
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 5ca7a29..e031d4d 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp | |||
@@ -1,99 +1,101 @@ | |||
1 | #include <qtextstream.h> | 1 | #include <qtextstream.h> |
2 | #include <qwhatsthis.h> | 2 | #include <qwhatsthis.h> |
3 | |||
3 | #include "ircservertab.h" | 4 | #include "ircservertab.h" |
5 | #include "ircmessageparser.h" | ||
4 | 6 | ||
5 | 7 | ||
6 | bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) { | 8 | bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) { |
7 | return (text.contains(IRCMessageParser::tr("Received a CTCP PING from "))) || | 9 | return (text.contains(IRCMessageParser::tr("Received a CTCP PING from "))) || |
8 | (text.find("ping") != -1 && text.find( tab->server()->nick() != -1)); | 10 | (text.find("ping") != -1 && text.find( tab->server()->nick() != -1)); |
9 | } | 11 | } |
10 | 12 | ||
11 | 13 | ||
12 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { | 14 | IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) { |
13 | m_server = server; | 15 | m_server = server; |
14 | m_session = new IRCSession(&m_server); | 16 | m_session = new IRCSession(&m_server); |
15 | m_mainWindow = mainWindow; | 17 | m_mainWindow = mainWindow; |
16 | m_close = FALSE; | 18 | m_close = FALSE; |
17 | m_lines = 0; | 19 | m_lines = 0; |
18 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); | 20 | m_description->setText(tr("Connection to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>"); |
19 | m_textview = new QTextView(this); | 21 | m_textview = new QTextView(this); |
20 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); | 22 | m_textview->setHScrollBarMode(QScrollView::AlwaysOff); |
21 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); | 23 | m_textview->setVScrollBarMode(QScrollView::AlwaysOn); |
22 | m_textview->setTextFormat(RichText); | 24 | m_textview->setTextFormat(RichText); |
23 | QWhatsThis::add(m_textview, tr("Server messages")); | 25 | QWhatsThis::add(m_textview, tr("Server messages")); |
24 | m_layout->add(m_textview); | 26 | m_layout->add(m_textview); |
25 | m_field = new IRCHistoryLineEdit(this); | 27 | m_field = new IRCHistoryLineEdit(this); |
26 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); | 28 | connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab())); |
27 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); | 29 | connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab())); |
28 | connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab())); | 30 | connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab())); |
29 | connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); | 31 | connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus())); |
30 | 32 | ||
31 | QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); | 33 | QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help")); |
32 | m_layout->add(m_field); | 34 | m_layout->add(m_field); |
33 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 35 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
34 | connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); | 36 | connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput))); |
35 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); | 37 | connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling())); |
36 | settingsChanged(); | 38 | settingsChanged(); |
37 | 39 | ||
38 | m_field->setFocus(); | 40 | m_field->setFocus(); |
39 | m_field->setActiveWindow(); | 41 | m_field->setActiveWindow(); |
40 | 42 | ||
41 | } | 43 | } |
42 | 44 | ||
43 | void IRCServerTab::scrolling(){ | 45 | void IRCServerTab::scrolling(){ |
44 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 46 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
45 | } | 47 | } |
46 | 48 | ||
47 | 49 | ||
48 | void IRCServerTab::appendText(QString text) { | 50 | void IRCServerTab::appendText(QString text) { |
49 | /* not using append because it creates layout problems */ | 51 | /* not using append because it creates layout problems */ |
50 | QString txt = m_textview->text() + IRCTab::appendTimestamp( text ); | 52 | QString txt = m_textview->text() + IRCTab::appendTimestamp( text ); |
51 | 53 | ||
52 | 54 | ||
53 | 55 | ||
54 | if (m_maxLines > 0 && m_lines >= m_maxLines) { | 56 | if (m_maxLines > 0 && m_lines >= m_maxLines) { |
55 | int firstBreak = txt.find('\n'); | 57 | int firstBreak = txt.find('\n'); |
56 | if (firstBreak != -1) { | 58 | if (firstBreak != -1) { |
57 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); | 59 | txt = "<qt bgcolor=\"" + m_backgroundColor + "\"/>" + txt.right(txt.length() - (firstBreak + 1)); |
58 | } | 60 | } |
59 | } else { | 61 | } else { |
60 | m_lines++; | 62 | m_lines++; |
61 | } | 63 | } |
62 | m_textview->setText(txt); | 64 | m_textview->setText(txt); |
63 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 65 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
64 | emit changed(this); | 66 | emit changed(this); |
65 | } | 67 | } |
66 | 68 | ||
67 | IRCServerTab::~IRCServerTab() { | 69 | IRCServerTab::~IRCServerTab() { |
68 | delete m_session; | 70 | delete m_session; |
69 | } | 71 | } |
70 | 72 | ||
71 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { | 73 | void IRCServerTab::removeChannelTab(IRCChannelTab *tab) { |
72 | m_channelTabs.remove(tab); | 74 | m_channelTabs.remove(tab); |
73 | } | 75 | } |
74 | 76 | ||
75 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { | 77 | void IRCServerTab::removeQueryTab(IRCQueryTab *tab) { |
76 | m_queryTabs.remove(tab); | 78 | m_queryTabs.remove(tab); |
77 | } | 79 | } |
78 | 80 | ||
79 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { | 81 | void IRCServerTab::addQueryTab(IRCQueryTab *tab) { |
80 | m_queryTabs.append(tab); | 82 | m_queryTabs.append(tab); |
81 | } | 83 | } |
82 | 84 | ||
83 | QString IRCServerTab::title() { | 85 | QString IRCServerTab::title() { |
84 | return "Server"; | 86 | return "Server"; |
85 | } | 87 | } |
86 | 88 | ||
87 | IRCSession *IRCServerTab::session() { | 89 | IRCSession *IRCServerTab::session() { |
88 | return m_session; | 90 | return m_session; |
89 | } | 91 | } |
90 | /* | 92 | /* |
91 | QString *IRCServerTab::mynick() { | 93 | QString *IRCServerTab::mynick() { |
92 | return (*m_server->nick()); | 94 | return (*m_server->nick()); |
93 | } */ | 95 | } */ |
94 | 96 | ||
95 | IRCServer *IRCServerTab::server() { | 97 | IRCServer *IRCServerTab::server() { |
96 | return &m_server; | 98 | return &m_server; |
97 | } | 99 | } |
98 | 100 | ||
99 | void IRCServerTab::settingsChanged() { | 101 | void IRCServerTab::settingsChanged() { |