Diffstat (limited to 'noncore/net/opieirc/ircchanneltab.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index 4675265..c1695db 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp | |||
@@ -1,2 +1,5 @@ | |||
1 | #include <qpe/qpeapplication.h> | ||
2 | #include <qpe/resource.h> | ||
3 | #include <qcursor.h> | ||
1 | #include <qhbox.h> | 4 | #include <qhbox.h> |
2 | #include "ircchanneltab.h" | 5 | #include "ircchanneltab.h" |
@@ -21,4 +24,16 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
21 | m_list->setMaximumWidth(LISTWIDTH); | 24 | m_list->setMaximumWidth(LISTWIDTH); |
22 | m_field = new QLineEdit(this); | 25 | m_field = new QLineEdit(this); |
26 | m_popup = new QPopupMenu(m_list); | ||
27 | /* Required so that embedded-style "right" clicks work */ | ||
28 | QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); | ||
29 | connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); | ||
30 | /* Construct the popup menu */ | ||
31 | QPopupMenu *ctcpMenu = new QPopupMenu(m_list); | ||
32 | m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); | ||
33 | m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); | ||
34 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); | ||
35 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); | ||
36 | ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); | ||
37 | |||
23 | m_layout->add(hbox); | 38 | m_layout->add(hbox); |
24 | hbox->show(); | 39 | hbox->show(); |
@@ -26,5 +41,5 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW | |||
26 | m_field->setFocus(); | 41 | m_field->setFocus(); |
27 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); | 42 | connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); |
28 | 43 | settingsChanged(); | |
29 | } | 44 | } |
30 | 45 | ||
@@ -50,8 +65,8 @@ void IRCChannelTab::processCommand() { | |||
50 | text = text.right(text.length()-1); | 65 | text = text.right(text.length()-1); |
51 | session()->sendMessage(m_channel, m_field->text()); | 66 | session()->sendMessage(m_channel, m_field->text()); |
52 | appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+IRCOutput::toHTML(m_field->text())+"<br>"); | 67 | 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>"); |
53 | } | 68 | } |
54 | } else { | 69 | } else { |
55 | appendText("<font color=\"#ff0000\">"+tr("Disconnected")+"</font><br>"); | 70 | appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); |
56 | } | 71 | } |
57 | } | 72 | } |
@@ -59,4 +74,8 @@ void IRCChannelTab::processCommand() { | |||
59 | } | 74 | } |
60 | 75 | ||
76 | void IRCChannelTab::settingsChanged() { | ||
77 | m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); | ||
78 | } | ||
79 | |||
61 | void IRCChannelTab::toggleList() { | 80 | void IRCChannelTab::toggleList() { |
62 | if (m_listVisible) { | 81 | if (m_listVisible) { |
@@ -70,4 +89,37 @@ void IRCChannelTab::toggleList() { | |||
70 | } | 89 | } |
71 | 90 | ||
91 | void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { | ||
92 | switch (mouse) { | ||
93 | case 1: | ||
94 | break; | ||
95 | case 2: | ||
96 | m_popup->popup(point); | ||
97 | break; | ||
98 | }; | ||
99 | } | ||
100 | |||
101 | void IRCChannelTab::popupQuery() { | ||
102 | if (m_list->currentItem() != -1) { | ||
103 | IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); | ||
104 | if (person) { | ||
105 | IRCQueryTab *tab = m_parentTab->getTabForQuery(person); | ||
106 | if (!tab) { | ||
107 | tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); | ||
108 | m_parentTab->addQueryTab(tab); | ||
109 | m_mainWindow->addTab(tab); | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | } | ||
114 | |||
115 | void IRCChannelTab::popupPing() { | ||
116 | } | ||
117 | |||
118 | void IRCChannelTab::popupVersion() { | ||
119 | } | ||
120 | |||
121 | void IRCChannelTab::popupWhois() { | ||
122 | } | ||
123 | |||
72 | QString IRCChannelTab::title() { | 124 | QString IRCChannelTab::title() { |
73 | return m_channel->channelname(); | 125 | return m_channel->channelname(); |