addresseedialog.h
00001 /* 00002 This file is part of libkabc. 00003 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef KABC_ADDRESSEEDIALOG_H 00022 #define KABC_ADDRESSEEDIALOG_H 00023 00024 #include <qdict.h> 00025 00026 #include <kdialogbase.h> 00027 #include <klineedit.h> 00028 #include <klistview.h> 00029 00030 #include "addressbook.h" 00031 00032 namespace KABC { 00033 00037 class AddresseeItem : public QListViewItem 00038 { 00039 public: 00040 00046 enum columns { Name = 0, Email = 1 }; 00047 00054 AddresseeItem( QListView *parent, const Addressee &addressee ); 00055 00059 Addressee addressee() const { return mAddressee; } 00060 00064 virtual QString key( int column, bool ascending ) const; 00065 00066 private: 00067 Addressee mAddressee; 00068 }; 00069 00083 class AddresseeDialog : public KDialogBase 00084 { 00085 Q_OBJECT 00086 00087 public: 00093 AddresseeDialog( QWidget *parent=0, bool multiple=false ); 00094 00098 virtual ~AddresseeDialog(); 00099 00105 Addressee addressee(); 00106 00110 Addressee::List addressees(); 00111 00119 static Addressee getAddressee( QWidget *parent ); 00120 00128 static Addressee::List getAddressees( QWidget *parent ); 00129 00130 private slots: 00131 void selectItem( const QString & ); 00132 void updateEdit( QListViewItem *item ); 00133 void addSelected( QListViewItem *item ); 00134 void removeSelected(); 00135 00136 protected slots: 00137 void addressBookChanged(); 00138 00139 private: 00140 void loadAddressBook(); 00141 void addCompletionItem( const QString &str, QListViewItem *item ); 00142 00143 bool mMultiple; 00144 00145 KListView *mAddresseeList; 00146 KLineEdit *mAddresseeEdit; 00147 00148 KListView *mSelectedList; 00149 00150 AddressBook *mAddressBook; 00151 00152 QDict<QListViewItem> mItemDict; 00153 QDict<QListViewItem> mSelectedDict; 00154 00155 class AddresseeDialogPrivate; 00156 AddresseeDialogPrivate *d; 00157 }; 00158 00159 } 00160 #endif