diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/kopete/contactlist/kopetegrouplistaction.cpp | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/kopete/contactlist/kopetegrouplistaction.cpp')
-rw-r--r-- | kopete/kopete/contactlist/kopetegrouplistaction.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/kopete/kopete/contactlist/kopetegrouplistaction.cpp b/kopete/kopete/contactlist/kopetegrouplistaction.cpp new file mode 100644 index 00000000..1556f9b6 --- /dev/null +++ b/kopete/kopete/contactlist/kopetegrouplistaction.cpp @@ -0,0 +1,66 @@ +/* + kopetegrouplistcation.cpp - the action used for Move To and copy To + + Copyright (c) 2002-2004 by Olivier Goffart <ogoffart @ kde.org> + Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org> + + Kopete (c) 2001-2005 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ +/* This code was previously in libkopete/ui/kopetestdactions.cpp */ + +#include "kopetegrouplistaction.h" + +#include <kdebug.h> +#include <kguiitem.h> +#include <klocale.h> +#include <kaction.h> +#include <kwin.h> +#include <kcmultidialog.h> + +#include "kopetecontactlist.h" +#include "kopetegroup.h" + +KopeteGroupListAction::KopeteGroupListAction( const QString &text, const QString &pix, const KShortcut &cut, const QObject *receiver, + const char *slot, QObject *parent, const char *name ) +: KListAction( text, pix, cut, parent, name ) +{ + connect( this, SIGNAL( activated() ), receiver, slot ); + + connect( Kopete::ContactList::self(), SIGNAL( groupAdded( Kopete::Group * ) ), this, SLOT( slotUpdateList() ) ); + connect( Kopete::ContactList::self(), SIGNAL( groupRemoved( Kopete::Group * ) ), this, SLOT( slotUpdateList() ) ); + connect( Kopete::ContactList::self(), SIGNAL( groupRenamed(Kopete::Group*, const QString& ) ), this, SLOT( slotUpdateList() ) ); + slotUpdateList(); +} + +KopeteGroupListAction::~KopeteGroupListAction() +{ +} + +void KopeteGroupListAction::slotUpdateList() +{ + QStringList groupList; + + // Add groups to our list + QPtrList<Kopete::Group> groups = Kopete::ContactList::self()->groups(); + for ( Kopete::Group *it = groups.first(); it; it = groups.next() ) + { + if(it->type() == Kopete::Group::Normal) + groupList.append( it->displayName() ); + } + + groupList.sort(); + groupList.prepend(QString::null); //add a separator; + groupList.prepend( i18n("Top Level") ); //the top-level group, with the id 0 + setItems( groupList ); +} + +#include "kopetegrouplistaction.moc" |