rendered paste bodyIndex: src/irc/query.cpp===================================================================--- src/irc/query.cpp (revision 921743)+++ src/irc/query.cpp (working copy)@@ -82,21 +82,35 @@ // link "Whois", "Ignore" ... menu items into ircview popup KMenu* popup=textView->getPopup(); popup->addSeparator();- popup->insertItem(i18n("&Whois"),Konversation::Whois);- popup->insertItem(i18n("&Version"),Konversation::Version);- popup->insertItem(i18n("&Ping"),Konversation::Ping);+ KAction *whoisAction = new KAction(i18n("&Whois"), popup);+ connect(whoisAction, SIGNAL(triggered(bool)), this, SLOT(slotWhoIs()));+ KAction *versionAction = new KAction(i18n("&Version"), popup);+ connect(versionAction, SIGNAL(triggered(bool)), this, SLOT(slotVersion()));+ KAction *pingAction = new KAction(i18n("&Ping"), popup);+ connect(pingAction, SIGNAL(triggered(bool)), this, SLOT(slotPing()));+ + popup->addAction(whoisAction);+ popup->addAction(versionAction);+ popup->addAction(pingAction); popup->addSeparator(); - popup->insertItem(i18n("Ignore"), Konversation::IgnoreNick);- popup->insertItem(i18n("Unignore"), Konversation::UnignoreNick);+ KAction *ignoreAction = new KAction(i18n("Ignore"), popup);+ connect(ignoreAction, SIGNAL(triggered(bool)), this, SLOT(slotIgnore()));+ KAction *unIgnoreAction = new KAction(i18n("Unignore"), popup);+ connect(unIgnoreAction, SIGNAL(triggered(bool)), this, SLOT(slotUnIgnore()));+ + popup->setItemVisible(Konversation::IgnoreNick, false); popup->setItemVisible(Konversation::UnignoreNick, false); if (KAuthorized::authorizeKAction("allow_downloading"))- popup->insertItem(SmallIcon("2rightarrow"),i18n("Send &File..."),Konversation::DccSend);+ {+ KAction *dccAction = new KAction(KIcon("arrow-right-double"),i18n("Send &File..."), popup);+ connect(dccAction, SIGNAL(triggered(bool)), this, SLOT(slotDcc()));+ }+ KAction *watchAction = new KAction(i18n("Add to Watched Nicks"), popup);+ connect(watchAction, SIGNAL(triggered(bool)), this, SLOT(slotWatch())); - popup->insertItem(i18n("Add to Watched Nicks"), Konversation::AddNotify);- // This box holds the input line KHBox* inputBox=new KHBox(this); inputBox->setObjectName("input_log_box");@@ -384,92 +398,47 @@ switch (id) { case Konversation::Whois:- sendQueryText(Preferences::self()->commandChar()+"WHOIS "+name+' '+name);+ slotWhoIs(); break;- case Konversation::IgnoreNick:- {- if (KMessageBox::warningContinueCancel(- this,- i18n("Do you want to ignore %1?",name),- i18n("Ignore"),- KGuiItem(i18n("Ignore")),- KStandardGuiItem::cancel(),- "IgnoreNick")- == KMessageBox::Continue)- {- sendQueryText(Preferences::self()->commandChar()+"IGNORE -ALL "+name);-- int rc = KMessageBox::questionYesNo(this,- i18n("Do you want to close this query after ignoring this nickname?"),- i18n("Close This Query"),- KGuiItem(i18n("Close")),- KGuiItem(i18n("Keep Open")),- "CloseQueryAfterIgnore");-- if (rc == KMessageBox::Yes && m_server)- QTimer::singleShot(0, this, SLOT(closeWithoutAsking()));- }-+ slotIgnore(); break;- } case Konversation::UnignoreNick:- {- if (KMessageBox::warningContinueCancel(- this,- i18n("Do you want to stop ignoring %1?", name),- i18n("Unignore"),- KGuiItem(i18n("Unignore")),- KStandardGuiItem::cancel(),- "UnignoreNick")- ==- KMessageBox::Continue)- {- sendQueryText(Preferences::self()->commandChar()+"UNIGNORE "+name);- }-+ slotUnIgnore(); break;- } case Konversation::AddNotify:- {- if (m_server->getServerGroup())- {- if (!Preferences::isNotify(m_server->getServerGroup()->id(), name))- Preferences::addNotify(m_server->getServerGroup()->id(),name);- }+ slotWatch(); break;- } case Konversation::DccSend:- sendQueryText(Preferences::self()->commandChar()+"DCC SEND "+name);+ slotDcc(); break;- case Konversation::Version:- sendQueryText(Preferences::self()->commandChar()+"CTCP "+name+" VERSION");+ slotVersion(); break;- case Konversation::Ping:- sendQueryText(Preferences::self()->commandChar()+"CTCP "+name+" PING");+ slotPing(); break;- case Konversation::Topic:- m_server->requestTopic(getTextView()->currentChannel());+ slotTopic(); break; case Konversation::Names:- m_server->queue("NAMES " + getTextView()->currentChannel(), Server::LowPriority);+ slotName(); break; case Konversation::Join:- m_server->queue("JOIN " + getTextView()->currentChannel());+ slotJoin(); break;- default:- kDebug() << "Query::popup(): Popup id " << id << " does not belong to me!" << endl;+ kDebug() << "Popup id " << id << " does not belong to me!" ; break; }+ // delete context menu nickname - // delete context menu nickname textView->clearContextNick(); } +++ void Query::sendFileMenu() { emit sendFile(getName());@@ -678,6 +647,7 @@ // show quit message of nick if we see it void Query::quitNick(const QString& reason) {+ QString name = textView->getContextNick(); QString displayReason = reason; if (displayReason.isEmpty())@@ -693,4 +663,111 @@ } } +void Query::slotWhoIs()+{+ QString name = textView->getContextNick();+ sendQueryText(Preferences::self()->commandChar() + "WHOIS " + name + ' ' + name);+ textView->clearContextNick();+}+void Query::slotVersion()+{+ QString name = textView->getContextNick();+ sendQueryText(Preferences::self()->commandChar() + "CTCP " + name + " VERSION");+ textView->clearContextNick();+}++void Query::slotPing()+{+ QString name = textView->getContextNick();+ sendQueryText(Preferences::self()->commandChar() + "CTCP " + name + " PING");+ textView->clearContextNick();+}++void Query::slotIgnore()+{+ QString name = textView->getContextNick();+ if (KMessageBox::warningContinueCancel( + this, + i18n("Do you want to ignore %1?",name),+ i18n("Ignore"),+ KGuiItem(i18n("Ignore")),+ KStandardGuiItem::cancel(),+ "IgnoreNick")+ == KMessageBox::Continue)+ {+ sendQueryText(Preferences::self()->commandChar()+"IGNORE -ALL "+name);+ + int rc = KMessageBox::questionYesNo(this,+ i18n("Do you want to close this query after ignoring this nickname?"),+ i18n("Close This Query"),+ KGuiItem(i18n("Close")),+ KGuiItem(i18n("Keep Open")),+ "CloseQueryAfterIgnore");+ if (rc == KMessageBox::Yes && m_server)+ QTimer::singleShot(0, this, SLOT(closeWithoutAsking()));+ }+ textView->clearContextNick();+} ++void Query::slotUnIgnore()+{+ QString name = textView->getContextNick();+ if (KMessageBox::warningContinueCancel(+ this,+ i18n("Do you want to stop ignoring %1?", name),+ i18n("Unignore"),+ KGuiItem(i18n("Unignore")),+ KStandardGuiItem::cancel(),+ "UnignoreNick") == KMessageBox::Continue)+ {+ sendQueryText(Preferences::self()->commandChar()+"UNIGNORE "+name);+ }+ textView->clearContextNick();+}++void Query::slotDcc()+{+ QString name = textView->getContextNick();+ sendQueryText(Preferences::self()->commandChar()+"DCC SEND "+name);+ textView->clearContextNick();+}++void Query::slotWatch()+{+ QString name = textView->getContextNick();+ if (m_server->getServerGroup())+ {+ if (!Preferences::isNotify(m_server->getServerGroup()->id(), name))+ Preferences::addNotify(m_server->getServerGroup()->id(),name);+ }+ textView->clearContextNick();+}+void Query::slotJoin()+{+ QString name = textView->getContextNick();+ m_server->queue("JOIN " + getTextView()->currentChannel());+ textView->clearContextNick();+}++void Query::slotPing()+{+ QString name = textView->getContextNick();+ sendQueryText(Preferences::self()->commandChar()+"CTCP "+name+" PING");+ textView->clearContextNick();+}++void Query::slotName()+{+ QString name = textView->getContextNick();+ m_server->queue("NAMES " + getTextView()->currentChannel(), Server::LowPriority);+ textView->clearContextNick();+}++void Query::slotTopic()+{+ QString name = textView->getContextNick();+ m_server->requestTopic(getTextView()->currentChannel());+ textView->clearContextNick();+}+ // #include "./irc/query.moc"Index: src/irc/query.h===================================================================--- src/irc/query.h (revision 921743)+++ src/irc/query.h (working copy)@@ -95,6 +95,17 @@ void nickInfoChanged(); void closeWithoutAsking(); virtual void serverOnline(bool online);+ void slotWhoIs();+ void slotVersion();+ void slotPing();+ void slotIgnore();+ void slotUnIgnore();+ void slotDcc();+ void slotWatch();+ void slotJoin();+ void slotName();+ void slotTopic();+ void slotPing(); protected: void setName(const QString& newName);