[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kopete/protocols/irc
From:       Olivier Goffart <ogoffart () tiscalinet ! be>
Date:       2003-04-06 12:23:26
[Download RAW message or body]

CVS commit by ogoffart: 

add join channel action in the irc menu


  M +21 -1     ircaccount.cpp   1.21
  M +2 -0      ircaccount.h   1.11


--- kdenonbeta/kopete/protocols/irc/ircaccount.cpp  #1.20:1.21
@@ -21,4 +21,6 @@
 #include <kapplication.h>
 #include <kaboutdata.h>
+#include <klineeditdlg.h>
+#include <kmessagebox.h>
 
 #include "ircaccount.h"
@@ -39,4 +41,5 @@ IRCAccount::IRCAccount(const QString &ac
 {
         mManager = 0L;
+        mActionMenu = 0L;
         mProtocol = protocol;
 
@@ -76,5 +79,6 @@ KActionMenu *IRCAccount::actionMenu()
         QString menuTitle = QString::fromLatin1( " %1 <%2> " ).arg( accountId() \
).arg( mMySelf->onlineStatus().description() );  
-        KActionMenu *mActionMenu = new KActionMenu( accountId(), this );
+        delete mActionMenu;
+        mActionMenu = new KActionMenu( accountId(), this );
         mActionMenu->popupMenu()->insertTitle( mMySelf->onlineStatus().iconFor( \
                mMySelf ), menuTitle, 1 );
         mActionMenu->setIconSet( QIconSet ( mMySelf->onlineStatus().iconFor( mMySelf \
) ) ); @@ -82,4 +86,5 @@ KActionMenu *IRCAccount::actionMenu()
         mActionMenu->insert( actionOnline );
         mActionMenu->insert( actionOffline );
+        mActionMenu->insert( new KAction ( i18n("Join channel"), "", 0, this, \
SLOT(slotJoinChannel()), mActionMenu ));  
         return mActionMenu;
@@ -280,4 +285,19 @@ bool IRCAccount::addContactToMetaContact
 }
 
+void IRCAccount::slotJoinChannel()
+{
+        if(!isConnected())
+                return;
+
+        QString chan = KLineEditDlg::getText( i18n( "Kopete IRC Plugin" ),
+                i18n( "Please enter name of the channel you want to join:" ), \
QString::null); +        if( !chan.isNull() )
+        {
+                if( chan.startsWith( QString::fromLatin1("#") ) )
+                        findChannel( chan )->startChat();
+                else
+                        KMessageBox::error(0l, i18n("<qt>\"%1\" is an invaid \
channel. Channels must start with '#'.</qt>").arg(chan), i18n("Kopete IRC Plugin")); \
+        } +}
 
 #include "ircaccount.moc"

--- kdenonbeta/kopete/protocols/irc/ircaccount.h  #1.10:1.11
@@ -110,4 +110,5 @@ private slots:
         void slotNewPrivMessage(const QString &originating, const QString &target, \
const QString &message);  void slotContactDestroyed(KopeteContact *);
+        void slotJoinChannel();
 
 private:
@@ -124,4 +125,5 @@ private:
         KAction *actionOffline;
         KAction *actionAway;
+        KActionMenu *mActionMenu;
 
 };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic