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 TQt, and distribute the resulting executable,
00020     without including the source code for TQt 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 <tdeabc/addressee.h>
00029 
00030 #include <tdelistbox.h>
00031 
00032 #include <tqstringlist.h>
00033 
00034 class TQDragEnterEvent;
00035 class TQDragMoveEvent;
00036 class TQDropEvent;
00037 class TQPoint;
00038 class TQPushButton;
00039 
00040 namespace TDEABC {
00041     class DistributionListManager;
00042 }
00043 
00044 namespace KAB {
00045 namespace DistributionListNg {
00046 
00047 class ListBox : public TDEListBox
00048 {
00049     Q_OBJECT
00050   
00051 public:
00052     ListBox( TQWidget* parent = 0 );
00053 
00054 signals:
00055 
00056     void dropped( const TQString &listName, const TDEABC::Addressee::List &addressees );
00057 
00058 protected:
00059     //override
00060     void dragEnterEvent( TQDragEnterEvent *event );
00061     //override
00062     void dragMoveEvent( TQDragMoveEvent *event );
00063     //override
00064     void dropEvent( TQDropEvent *event );
00065 };
00066 
00067 class MainWidget : public KAB::ExtensionWidget
00068 {
00069     Q_OBJECT
00070   
00071 
00072 public:
00073     explicit MainWidget( KAB::Core *core, TQWidget *parent = 0, const char *name = 0 );
00074 
00075     //impl
00076     TQString title() const;
00077 
00078     //impl
00079     TQString identifier() const;
00080 
00081 
00082 private:
00083     void changed( const TDEABC::Addressee& );
00084 
00085 private slots:
00086 
00087     void deleteSelectedDistributionList();
00088     void editSelectedDistributionList();
00089 
00090     void contextMenuRequested( TQListBoxItem *item, const TQPoint &point );
00091     void updateEntries();
00092     void itemSelected( int index );
00093     void contactsDropped( const TQString &listName, const TDEABC::Addressee::List &addressees );
00094 
00095 private:
00096     ListBox *mListBox;
00097     TQStringList mCurrentEntries;
00098     TQPushButton *mAddButton;
00099     TQPushButton *mEditButton;
00100     TQPushButton *mRemoveButton;
00101 };
00102 
00103 } // namespace DistributionListNg
00104 } // namespace KAB
00105 
00106 #endif // KAB_DISTRIBUTIONLISTNG_MAINWIDGET_H