distributionlistwidget.h
00001 /* 00002 This file is part of KAddressBook. 00003 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 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 00019 As a special exception, permission is given to link this program 00020 with any edition of TQt, and distribute the resulting executable, 00021 without including the source code for TQt in the source distribution. 00022 */ 00023 00024 #ifndef DISTRIBUTIONLISTWIDGET_H 00025 #define DISTRIBUTIONLISTWIDGET_H 00026 00027 #include <config.h> // for KDEPIM_NEW_DISTRLISTS 00028 #include <kdialogbase.h> 00029 #include <klistview.h> 00030 00031 #include "extensionwidget.h" 00032 00033 class TQButtonGroup; 00034 class TQComboBox; 00035 class TQListView; 00036 00037 class DistributionListView; 00038 00039 namespace KAB { 00040 class Core; 00041 } 00042 00043 namespace KABC { 00044 class AddressBook; 00045 class DistributionListManager; 00046 } 00047 00048 class DistributionListWidget : public KAB::ExtensionWidget 00049 { 00050 Q_OBJECT 00051 TQ_OBJECT 00052 00053 public: 00054 DistributionListWidget( KAB::Core*, TQWidget *parent, const char *name = 0 ); 00055 virtual ~DistributionListWidget(); 00056 00057 void contactsSelectionChanged(); 00058 00059 TQString title() const; 00060 TQString identifier() const; 00061 00062 public slots: 00063 void save(); 00064 void dropped( TQDropEvent*, TQListViewItem* ); 00065 00066 void removeContact(); 00067 00068 private slots: 00069 void createList(); 00070 void editList(); 00071 void removeList(); 00072 void addContact(); 00073 void changeEmail(); 00074 void updateNameCombo(); 00075 void updateContactView(); 00076 void selectionContactViewChanged(); 00077 00078 private: 00079 #ifdef KDEPIM_NEW_DISTRLISTS 00080 void changed( const KABC::Addressee& dist ); 00081 #else 00082 void changed(); 00083 #endif 00084 bool alreadyExists( const TQString& distrListName ) const; 00085 00086 protected: 00087 void dropEvent( TQDropEvent* ); 00088 00089 private: 00090 TQComboBox *mNameCombo; 00091 TQLabel *mEntryCountLabel; 00092 DistributionListView *mContactView; 00093 00094 #ifndef KDEPIM_NEW_DISTRLISTS 00095 KABC::DistributionListManager *mManager; 00096 #endif 00097 TQPushButton *mCreateListButton; 00098 TQPushButton *mEditListButton; 00099 TQPushButton *mRemoveListButton; 00100 TQPushButton *mChangeEmailButton; 00101 TQPushButton *mAddContactButton; 00102 TQPushButton *mRemoveContactButton; 00103 }; 00104 00108 class DistributionListView : public KListView 00109 { 00110 Q_OBJECT 00111 TQ_OBJECT 00112 00113 public: 00114 DistributionListView( TQWidget *parent, const char* name = 0 ); 00115 00116 protected: 00117 void dragEnterEvent( TQDragEnterEvent *e ); 00118 void dropEvent( TQDropEvent *e ); 00119 void viewportDragMoveEvent( TQDragMoveEvent *e ); 00120 void viewportDropEvent( TQDropEvent *e ); 00121 }; 00122 00126 class EmailSelector : public KDialogBase 00127 { 00128 public: 00129 EmailSelector( const TQStringList &emails, const TQString ¤t, 00130 TQWidget *parent ); 00131 00132 TQString selected() const; 00133 00134 static TQString getEmail( const TQStringList &emails, const TQString ¤t, 00135 TQWidget *parent, bool &canceled ); 00136 00137 private: 00138 TQButtonGroup *mButtonGroup; 00139 TQMap<int, TQString> mEmailMap; 00140 }; 00141 00142 #endif