summaryrefslogtreecommitdiffabout
path: root/kabc/addresseedialog.h
authorzautrix <zautrix>2004-09-03 19:28:45 (UTC)
committer zautrix <zautrix>2004-09-03 19:28:45 (UTC)
commit7b3148175ea540f0d7b4bc79e05dd52f2cd47771 (patch) (unidiff)
tree5194240a1015a7fe9bab697233965dd807c464fd /kabc/addresseedialog.h
parent14399c0c21955d30b2d69684e0cf11edb9fd9b63 (diff)
downloadkdepimpi-7b3148175ea540f0d7b4bc79e05dd52f2cd47771.zip
kdepimpi-7b3148175ea540f0d7b4bc79e05dd52f2cd47771.tar.gz
kdepimpi-7b3148175ea540f0d7b4bc79e05dd52f2cd47771.tar.bz2
Made addressee select dialog useable
Diffstat (limited to 'kabc/addresseedialog.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseedialog.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/kabc/addresseedialog.h b/kabc/addresseedialog.h
index 74e7871..99c74bd 100644
--- a/kabc/addresseedialog.h
+++ b/kabc/addresseedialog.h
@@ -1,160 +1,161 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#ifndef KABC_ADDRESSEEDIALOG_H 21#ifndef KABC_ADDRESSEEDIALOG_H
22#define KABC_ADDRESSEEDIALOG_H 22#define KABC_ADDRESSEEDIALOG_H
23 23
24#include <qdict.h> 24#include <qdict.h>
25 25
26#include <kdialogbase.h> 26#include <kdialogbase.h>
27#include <klineedit.h> 27#include <klineedit.h>
28#include <klistview.h> 28#include <klistview.h>
29 29
30#include "addressbook.h" 30#include "addressbook.h"
31 31
32namespace KABC { 32namespace KABC {
33 33
34/** 34/**
35 @short Special ListViewItem, that is used by the AddresseeDialog. 35 @short Special ListViewItem, that is used by the AddresseeDialog.
36*/ 36*/
37class AddresseeItem : public QListViewItem 37class AddresseeItem : public QListViewItem
38{ 38{
39 public: 39 public:
40 40
41 /** 41 /**
42 Type of column 42 Type of column
43 @li @p Name - Name in Addressee 43 @li @p Name - Name in Addressee
44 @li @p Email - Email in Addressee 44 @li @p Email - Email in Addressee
45 */ 45 */
46 enum columns { Name = 0, Email = 1 }; 46 enum columns { Name = 0, Email = 1 };
47 47
48 /** 48 /**
49 Constructor. 49 Constructor.
50 50
51 @param parent The parent listview. 51 @param parent The parent listview.
52 @param addressee The associated addressee. 52 @param addressee The associated addressee.
53 */ 53 */
54 AddresseeItem( QListView *parent, const Addressee &addressee ); 54 AddresseeItem( QListView *parent, const Addressee &addressee );
55 55
56 /** 56 /**
57 Returns the addressee. 57 Returns the addressee.
58 */ 58 */
59 Addressee addressee() const { return mAddressee; } 59 Addressee addressee() const { return mAddressee; }
60 60
61 /** 61 /**
62 Method used by QListView to sort the items. 62 Method used by QListView to sort the items.
63 */ 63 */
64 virtual QString key( int column, bool ascending ) const; 64 virtual QString key( int column, bool ascending ) const;
65 65
66 private: 66 private:
67 Addressee mAddressee; 67 Addressee mAddressee;
68}; 68};
69 69
70/** 70/**
71 @short Dialog for selecting address book entries. 71 @short Dialog for selecting address book entries.
72 72
73 This class provides a dialog for selecting entries from the standard KDE 73 This class provides a dialog for selecting entries from the standard KDE
74 address book. Use the getAddressee() function to open a modal dialog, 74 address book. Use the getAddressee() function to open a modal dialog,
75 returning an address book entry. 75 returning an address book entry.
76 76
77 In the dialog you can select an entry from the list with the mouse or type in 77 In the dialog you can select an entry from the list with the mouse or type in
78 the first letters of the name or email address you are searching for. The 78 the first letters of the name or email address you are searching for. The
79 entry matching best is automatically selected. Use double click, pressing 79 entry matching best is automatically selected. Use double click, pressing
80 return or pressing the ok button to return the selected addressee to the 80 return or pressing the ok button to return the selected addressee to the
81 application. 81 application.
82*/ 82*/
83class AddresseeDialog : public KDialogBase 83class AddresseeDialog : public KDialogBase
84{ 84{
85 Q_OBJECT 85 Q_OBJECT
86 86
87 public: 87 public:
88 /** 88 /**
89 Construct addressbook entry select dialog. 89 Construct addressbook entry select dialog.
90 90
91 @param parent parent widget 91 @param parent parent widget
92 */ 92 */
93 AddresseeDialog( QWidget *parent=0, bool multiple=false ); 93 AddresseeDialog( QWidget *parent=0, bool multiple=false );
94 94
95 /** 95 /**
96 Destructor. 96 Destructor.
97 */ 97 */
98 virtual ~AddresseeDialog(); 98 virtual ~AddresseeDialog();
99 99
100 /** 100 /**
101 Return the address chosen. 101 Return the address chosen.
102 102
103 If it is a multiple select, this will return only the first address chosen 103 If it is a multiple select, this will return only the first address chosen
104 */ 104 */
105 Addressee addressee(); 105 Addressee addressee();
106 106
107 /** 107 /**
108 Return the list of addresses chosen 108 Return the list of addresses chosen
109 */ 109 */
110 Addressee::List addressees(); 110 Addressee::List addressees();
111 111
112 /** 112 /**
113 Select a single address book entry. 113 Select a single address book entry.
114 114
115 Open addressee select dialog and return the entry selected by the user. 115 Open addressee select dialog and return the entry selected by the user.
116 If the user doesn't select an entry or presses cancel, the returned 116 If the user doesn't select an entry or presses cancel, the returned
117 addressee is empty. 117 addressee is empty.
118 */ 118 */
119 static Addressee getAddressee( QWidget *parent ); 119 static Addressee getAddressee( QWidget *parent );
120 120
121 /** 121 /**
122 Select multiple address book entries. 122 Select multiple address book entries.
123 123
124 Open addressee select dialog and return the entries selected by the user. 124 Open addressee select dialog and return the entries selected by the user.
125 If the user doesn't select an entry or presses cancel, the returned 125 If the user doesn't select an entry or presses cancel, the returned
126 addressee list is empty. 126 addressee list is empty.
127 */ 127 */
128 static Addressee::List getAddressees( QWidget *parent ); 128 static Addressee::List getAddressees( QWidget *parent );
129 129
130 private slots: 130 private slots:
131 void selectItem( const QString & ); 131 void selectItem( const QString & );
132 void selectNextItem( QListViewItem *item );
132 void updateEdit( QListViewItem *item ); 133 void updateEdit( QListViewItem *item );
133 void addSelected( QListViewItem *item ); 134 void addSelected( QListViewItem *item );
134 void removeSelected(); 135 void removeSelected();
136 void loadAddressBook();
135 137
136 protected slots: 138 protected slots:
137 void addressBookChanged(); 139 void addressBookChanged();
138 140
139 private: 141 private:
140 void loadAddressBook();
141 void addCompletionItem( const QString &str, QListViewItem *item ); 142 void addCompletionItem( const QString &str, QListViewItem *item );
142 143
143 bool mMultiple; 144 bool mMultiple;
144 145
145 KListView *mAddresseeList; 146 KListView *mAddresseeList;
146 KLineEdit *mAddresseeEdit; 147 QLineEdit *mAddresseeEdit;
147 148
148 KListView *mSelectedList; 149 KListView *mSelectedList;
149 150
150 AddressBook *mAddressBook; 151 AddressBook *mAddressBook;
151 152
152 QDict<QListViewItem> mItemDict; 153 QDict<QListViewItem> mItemDict;
153 QDict<QListViewItem> mSelectedDict; 154 QDict<QListViewItem> mSelectedDict;
154 155
155 class AddresseeDialogPrivate; 156 class AddresseeDialogPrivate;
156 AddresseeDialogPrivate *d; 157 AddresseeDialogPrivate *d;
157}; 158};
158 159
159} 160}
160#endif 161#endif