Diffstat (limited to 'noncore/net/opieirc/ircchanneltab.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index c96a365..754442a 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -29,49 +29,65 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
29 | 29 | ||
30 | void IRCChannelTab::appendText(QString text) { | 30 | void IRCChannelTab::appendText(QString text) { |
31 | /* not using append because it creates layout problems */ | 31 | /* not using append because it creates layout problems */ |
32 | m_textview->setText(m_textview->text() + text); | 32 | m_textview->setText(m_textview->text() + text); |
33 | m_textview->ensureVisible(0, m_textview->contentsHeight()); | 33 | m_textview->ensureVisible(0, m_textview->contentsHeight()); |
34 | } | 34 | } |
35 | 35 | ||
36 | IRCChannelTab::~IRCChannelTab() { | 36 | IRCChannelTab::~IRCChannelTab() { |
37 | m_parentTab->removeChannelTab(this); | 37 | m_parentTab->removeChannelTab(this); |
38 | } | 38 | } |
39 | 39 | ||
40 | void IRCChannelTab::processCommand() { | 40 | void IRCChannelTab::processCommand() { |
41 | if (m_field->text().length()>0) { | 41 | QString text = m_field->text(); |
42 | session()->sendMessage(m_channel, m_field->text()); | 42 | if (text.length()>0) { |
43 | appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+m_field->text()+"<br>"); | 43 | if (session()->isSessionActive()) { |
44 | m_field->clear(); | 44 | if (text.startsWith("/") && !text.startsWith("//")) { |
45 | /* Command mode */ | ||
46 | m_parentTab->executeCommand(this, text);; | ||
47 | } else { | ||
48 | if (session()->isSessionActive()) { | ||
49 | session()->sendMessage(m_channel, m_field->text()); | ||
50 | appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+m_field->text()+"<br>"); | ||
51 | } | ||
52 | } | ||
53 | } else { | ||
54 | appendText("<font color=\"#ff0000\">"+tr("Disconnected")+"</font><br>"); | ||
55 | } | ||
45 | } | 56 | } |
57 | m_field->clear(); | ||
46 | } | 58 | } |
47 | 59 | ||
48 | void IRCChannelTab::toggleList() { | 60 | void IRCChannelTab::toggleList() { |
49 | if (m_listVisible) { | 61 | if (m_listVisible) { |
50 | m_list->setMaximumWidth(0); | 62 | m_list->setMaximumWidth(0); |
51 | m_listButton->setText("<"); | 63 | m_listButton->setText("<"); |
52 | } else { | 64 | } else { |
53 | m_list->setMaximumWidth(LISTWIDTH); | 65 | m_list->setMaximumWidth(LISTWIDTH); |
54 | m_listButton->setText(">"); | 66 | m_listButton->setText(">"); |
55 | } | 67 | } |
56 | m_listVisible = !m_listVisible; | 68 | m_listVisible = !m_listVisible; |
57 | } | 69 | } |
58 | 70 | ||
59 | QString IRCChannelTab::title() { | 71 | QString IRCChannelTab::title() { |
60 | return m_channel->channelname(); | 72 | return m_channel->channelname(); |
61 | } | 73 | } |
62 | 74 | ||
63 | IRCSession *IRCChannelTab::session() { | 75 | IRCSession *IRCChannelTab::session() { |
64 | return m_parentTab->session(); | 76 | return m_parentTab->session(); |
65 | } | 77 | } |
66 | 78 | ||
67 | void IRCChannelTab::remove() { | 79 | void IRCChannelTab::remove() { |
68 | session()->part(m_channel); | 80 | if (session()->isSessionActive()) { |
81 | session()->part(m_channel); | ||
82 | } else { | ||
83 | m_mainWindow->killTab(this); | ||
84 | } | ||
69 | } | 85 | } |
70 | 86 | ||
71 | IRCChannel *IRCChannelTab::channel() { | 87 | IRCChannel *IRCChannelTab::channel() { |
72 | return m_channel; | 88 | return m_channel; |
73 | } | 89 | } |
74 | 90 | ||
75 | IRCChannelList *IRCChannelTab::list() { | 91 | IRCChannelList *IRCChannelTab::list() { |
76 | return m_list; | 92 | return m_list; |
77 | } | 93 | } |