kaddressbook

distributionlistngwidget.h

00001 /*
00002     This file is part of KAddressBook.
00003     Copyright (c) 2007 Klaralvdalens Datakonsult AB <frank@kdab.net>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018     As a special exception, permission is given to link this program
00019     with any edition of Qt, and distribute the resulting executable,
00020     without including the source code for Qt in the source distribution.
00021 */
00022 
00023 #ifndef KAB_DISTRIBUTIONLISTNG_MAINWIDGET_H
00024 #define KAB_DISTRIBUTIONLISTNG_MAINWIDGET_H
00025 
00026 #include "extensionwidget.h"
00027 
00028 #include <kabc/addressee.h>
00029 
00030 #include <klistbox.h>
00031 
00032 #include <qstringlist.h>
00033 
00034 class QDragEnterEvent;
00035 class QDragMoveEvent;
00036 class QDropEvent;
00037 class QPoint;
00038 
00039 namespace KABC {
00040     class DistributionListManager;
00041 }
00042 
00043 namespace KAB {
00044 namespace DistributionListNg {
00045 
00046 class ListBox : public KListBox
00047 {
00048     Q_OBJECT
00049 public:
00050     ListBox( QWidget* parent = 0 );
00051 
00052 signals:
00053     
00054     void dropped( const QString &listName, const KABC::Addressee::List &addressees ); 
00055 
00056 protected:
00057     //override
00058     void dragEnterEvent( QDragEnterEvent *event );
00059     //override
00060     void dragMoveEvent( QDragMoveEvent *event ); 
00061     //override
00062     void dropEvent( QDropEvent *event );
00063 };
00064 
00065 class MainWidget : public KAB::ExtensionWidget
00066 {
00067     Q_OBJECT
00068 
00069 public:
00070     explicit MainWidget( KAB::Core *core, QWidget *parent = 0, const char *name = 0 );
00071 
00072     //impl
00073     QString title() const;
00074 
00075     //impl
00076     QString identifier() const;
00077 
00078 
00079 private:
00080     void changed( const KABC::Addressee& );
00081 
00082 private slots:
00083 
00084     void deleteSelectedDistributionList();    
00085     void editSelectedDistributionList();    
00086 
00087     void contextMenuRequested( QListBoxItem *item, const QPoint &point );
00088     void updateEntries();
00089     void itemSelected( int index );
00090     void contactsDropped( const QString &listName, const KABC::Addressee::List &addressees ); 
00091 
00092 private:
00093     ListBox *mListBox;
00094     QStringList mCurrentEntries;
00095 };
00096 
00097 } // namespace DistributionListNg
00098 } // namespace KAB
00099 
00100 #endif // KAB_DISTRIBUTIONLISTNG_MAINWIDGET_H
KDE Home | KDE Accessibility Home | Description of Access Keys