All pastes #1328076 Raw Edit

neoclust

public text v1 · immutable
#1328076 ·published 2009-02-05 15:41 UTC
rendered paste body
Index: 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());@@ -693,4 +662,89 @@     } } +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);+    }+}+void Query::slotJoin()+{+    m_server->queue("JOIN " + getTextView()->currentChannel());+}++void Query::slotPing()+{+     sendQueryText(Preferences::self()->commandChar()+"CTCP "+name+" PING");+}++void Query::slotName()+{+    m_server->queue("NAMES " + getTextView()->currentChannel(), Server::LowPriority);+}++void Query::slotTopic()+{+    m_server->requestTopic(getTextView()->currentChannel());+}+ // #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);