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., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, 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 KABC_EXPORT 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 KABC_EXPORT AddresseeDialog : public KDialogBase
00084 {
00085     Q_OBJECT
00086 
00087   public:
00094     AddresseeDialog( QWidget *parent=0, bool multiple=false );
00095 
00099     virtual ~AddresseeDialog();
00100 
00106     Addressee addressee();
00107 
00111     Addressee::List addressees();
00112 
00120     static Addressee getAddressee( QWidget *parent );
00121 
00129     static Addressee::List getAddressees( QWidget *parent );
00130 
00131   private slots:
00132     void selectItem( const QString & );
00133     void updateEdit( QListViewItem *item );
00134     void addSelected( QListViewItem *item );
00135     void removeSelected();
00136 
00137   protected slots:
00138     void addressBookChanged();
00139 
00140   private:
00141     void loadAddressBook();
00142     void addCompletionItem( const QString &str, QListViewItem *item );
00143 
00144     bool mMultiple;
00145 
00146     KListView *mAddresseeList;
00147     KLineEdit *mAddresseeEdit;
00148 
00149     KListView *mSelectedList;
00150 
00151     AddressBook *mAddressBook;
00152 
00153     QDict<QListViewItem> mItemDict;
00154     QDict<QListViewItem> mSelectedDict;
00155 
00156     class AddresseeDialogPrivate;
00157     AddresseeDialogPrivate *d;
00158 };
00159 
00160 }
00161 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys