Diffstat (limited to 'noncore/net/opieirc/ircchanneltab.cpp') (more/less context) (ignore 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 +1,4 @@ +#include <qpe/qpeapplication.h> +#include <qpe/resource.h> +#include <qcursor.h> #include <qhbox.h> @@ -22,2 +25,14 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW m_field = new QLineEdit(this); + m_popup = new QPopupMenu(m_list); + /* Required so that embedded-style "right" clicks work */ + QPEApplication::setStylusOperation(m_list->viewport(), QPEApplication::RightOnHold); + connect(m_list, SIGNAL(mouseButtonPressed(int, QListBoxItem *, const QPoint&)), this, SLOT(mouseButtonPressed(int, QListBoxItem *, const QPoint &))); + /* Construct the popup menu */ + QPopupMenu *ctcpMenu = new QPopupMenu(m_list); + m_popup->insertItem(Resource::loadPixmap("opieirc/ctcp"), tr("CTCP"), ctcpMenu); + m_popup->insertItem(Resource::loadPixmap("opieirc/query"), tr("Query"), this, SLOT(popupQuery())); + ctcpMenu->insertItem(Resource::loadPixmap("opieirc/ping"), tr("Ping"), this, SLOT(popupPing())); + ctcpMenu->insertItem(Resource::loadPixmap("opieirc/version"), tr("Version"), this, SLOT(popupVersion())); + ctcpMenu->insertItem(Resource::loadPixmap("opieirc/whois"), tr("Whois"), this, SLOT(popupWhois())); + m_layout->add(hbox); @@ -27,3 +42,3 @@ IRCChannelTab::IRCChannelTab(IRCChannel *channel, IRCServerTab *parentTab, MainW connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand())); - + settingsChanged(); } @@ -51,6 +66,6 @@ void IRCChannelTab::processCommand() { session()->sendMessage(m_channel, m_field->text()); - appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+IRCOutput::toHTML(m_field->text())+"<br>"); + 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>"); } } else { - appendText("<font color=\"#ff0000\">"+tr("Disconnected")+"</font><br>"); + appendText("<font color=\"" + m_errorColor + "\">"+tr("Disconnected")+"</font><br>"); } @@ -60,2 +75,6 @@ void IRCChannelTab::processCommand() { +void IRCChannelTab::settingsChanged() { + m_textview->setText("<qt bgcolor=\"" + m_backgroundColor + "\"/>"); +} + void IRCChannelTab::toggleList() { @@ -71,2 +90,35 @@ void IRCChannelTab::toggleList() { +void IRCChannelTab::mouseButtonPressed(int mouse, QListBoxItem *, const QPoint &point) { + switch (mouse) { + case 1: + break; + case 2: + m_popup->popup(point); + break; + }; +} + +void IRCChannelTab::popupQuery() { + if (m_list->currentItem() != -1) { + IRCPerson *person = session()->getPerson(m_list->item(m_list->currentItem())->text()); + if (person) { + IRCQueryTab *tab = m_parentTab->getTabForQuery(person); + if (!tab) { + tab = new IRCQueryTab(person, m_parentTab, m_mainWindow, (QWidget *)parent()); + m_parentTab->addQueryTab(tab); + m_mainWindow->addTab(tab); + } + } + } +} + +void IRCChannelTab::popupPing() { +} + +void IRCChannelTab::popupVersion() { +} + +void IRCChannelTab::popupWhois() { +} + QString IRCChannelTab::title() { |