All pastes #1328011 Raw Edit

neoclust

public text v1 · immutable
#1328011 ·published 2009-02-05 14:26 UTC
rendered paste body
Index: src/irc/query.cpp===================================================================--- src/irc/query.cpp	(revision 921669)+++ 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");@@ -693,4 +707,70 @@     } } +void Query::slotWhoIs()+{+    sendQueryText(Preferences::self()->commandChar() + "WHOIS " + name + ' ' + name);+}+void Query::slotVersion()+{+    sendQueryText(Preferences::self()->commandChar() + "CTCP " + name + " VERSION");+}++void Query::slotPing()+{+    sendQueryText(Preferences::self()->commandChar() + "CTCP " + name + " PING");+}++void Query::slotIgnore()+{+    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()));+    }+}    ++void Query::slotUnIgnore()+{+    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);+    }+}++void Query::slotDcc()+{+    sendQueryText(Preferences::self()->commandChar()+"DCC SEND "+name);+}++void Query::slotWatch()+{+    if (m_server->getServerGroup())+    {+        if (!Preferences::isNotify(m_server->getServerGroup()->id(), name))+            Preferences::addNotify(m_server->getServerGroup()->id(),name);+    }+}+ // #include "./irc/query.moc"Index: src/irc/query.h===================================================================--- src/irc/query.h	(revision 921669)+++ src/irc/query.h	(working copy)@@ -95,6 +95,13 @@         void nickInfoChanged();         void closeWithoutAsking();         virtual void serverOnline(bool online);+        void slotWhoIs();+        void slotVersion();+        void slotPing();+        void slotIgnore();+        void slotUnIgnore();+        void slotDcc();+        void slotWatch();      protected:         void setName(const QString& newName);