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 class QPushButton;
00039 
00040 namespace KABC {
00041     class DistributionListManager;
00042 }
00043 
00044 namespace KAB {
00045 namespace DistributionListNg {
00046 
00047 class ListBox : public KListBox
00048 {
00049     Q_OBJECT
00050 public:
00051     ListBox( QWidget* parent = 0 );
00052 
00053 signals:
00054 
00055     void dropped( const QString &listName, const KABC::Addressee::List &addressees );
00056 
00057 protected:
00058     //override
00059     void dragEnterEvent( QDragEnterEvent *event );
00060     //override
00061     void dragMoveEvent( QDragMoveEvent *event );
00062     //override
00063     void dropEvent( QDropEvent *event );
00064 };
00065 
00066 class MainWidget : public KAB::ExtensionWidget
00067 {
00068     Q_OBJECT
00069 
00070 public:
00071     explicit MainWidget( KAB::Core *core, QWidget *parent = 0, const char *name = 0 );
00072 
00073     //impl
00074     QString title() const;
00075 
00076     //impl
00077     QString identifier() const;
00078 
00079 
00080 private:
00081     void changed( const KABC::Addressee& );
00082 
00083 private slots:
00084 
00085     void deleteSelectedDistributionList();
00086     void editSelectedDistributionList();
00087 
00088     void contextMenuRequested( QListBoxItem *item, const QPoint &point );
00089     void updateEntries();
00090     void itemSelected( int index );
00091     void contactsDropped( const QString &listName, const KABC::Addressee::List &addressees );
00092 
00093 private:
00094     ListBox *mListBox;
00095     QStringList mCurrentEntries;
00096     QPushButton *mAddButton;
00097     QPushButton *mEditButton;
00098     QPushButton *mRemoveButton;
00099 };
00100 
00101 } // namespace DistributionListNg
00102 } // namespace KAB
00103 
00104 #endif // KAB_DISTRIBUTIONLISTNG_MAINWIDGET_H
KDE Home | KDE Accessibility Home | Description of Access Keys