author | ulf69 <ulf69> | 2004-06-29 05:22:55 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-06-29 05:22:55 (UTC) |
commit | 822dcc26ab3b70952679a1e12a010549659b6351 (patch) (unidiff) | |
tree | 334efa1aa742545c0ad0afdad681e8fe0cb29eb0 | |
parent | 6cbf4bfe5ee3b706d7b50324b5300db76eef89d6 (diff) | |
download | kdepimpi-822dcc26ab3b70952679a1e12a010549659b6351.zip kdepimpi-822dcc26ab3b70952679a1e12a010549659b6351.tar.gz kdepimpi-822dcc26ab3b70952679a1e12a010549659b6351.tar.bz2 |
removed KAB_EMBEDDED references
-rw-r--r-- | kabc/distributionlisteditor.cpp | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/kabc/distributionlisteditor.cpp b/kabc/distributionlisteditor.cpp index 569dc96..8b485d8 100644 --- a/kabc/distributionlisteditor.cpp +++ b/kabc/distributionlisteditor.cpp | |||
@@ -1,335 +1,317 @@ | |||
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 | #include <qlistview.h> | 21 | #include <qlistview.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qinputdialog.h> | 25 | #include <qinputdialog.h> |
26 | #include <qbuttongroup.h> | 26 | #include <qbuttongroup.h> |
27 | #include <qradiobutton.h> | 27 | #include <qradiobutton.h> |
28 | 28 | ||
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | 31 | ||
32 | #include "addressbook.h" | 32 | #include "addressbook.h" |
33 | #include "addresseedialog.h" | 33 | #include "addresseedialog.h" |
34 | #include "distributionlist.h" | 34 | #include "distributionlist.h" |
35 | 35 | ||
36 | #include "distributionlisteditor.h" | 36 | #include "distributionlisteditor.h" |
37 | 37 | ||
38 | #ifndef KAB_EMBEDDED | 38 | //US #include "distributionlisteditor.moc" |
39 | #include "distributionlisteditor.moc" | ||
40 | #endif //KAB_EMBEDDED | ||
41 | 39 | ||
42 | using namespace KABC; | 40 | using namespace KABC; |
43 | 41 | ||
44 | EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString ¤t, | 42 | EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString ¤t, |
45 | QWidget *parent ) : | 43 | QWidget *parent ) : |
46 | KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, | 44 | KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, |
47 | parent ) | 45 | parent ) |
48 | { | 46 | { |
49 | QFrame *topFrame = plainPage(); | 47 | QFrame *topFrame = plainPage(); |
50 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 48 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); |
51 | 49 | ||
52 | mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), | 50 | mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), |
53 | topFrame ); | 51 | topFrame ); |
54 | topLayout->addWidget( mButtonGroup ); | 52 | topLayout->addWidget( mButtonGroup ); |
55 | 53 | ||
56 | QStringList::ConstIterator it; | 54 | QStringList::ConstIterator it; |
57 | for( it = emails.begin(); it != emails.end(); ++it ) { | 55 | for( it = emails.begin(); it != emails.end(); ++it ) { |
58 | QRadioButton *button = new QRadioButton( *it, mButtonGroup ); | 56 | QRadioButton *button = new QRadioButton( *it, mButtonGroup ); |
59 | if ( (*it) == current ) { | 57 | if ( (*it) == current ) { |
60 | button->setDown( true ); | 58 | button->setDown( true ); |
61 | } | 59 | } |
62 | } | 60 | } |
63 | } | 61 | } |
64 | 62 | ||
65 | QString EmailSelectDialog::selected() | 63 | QString EmailSelectDialog::selected() |
66 | { | 64 | { |
67 | QButton *button = mButtonGroup->selected(); | 65 | QButton *button = mButtonGroup->selected(); |
68 | if ( button ) return button->text(); | 66 | if ( button ) return button->text(); |
69 | return QString::null; | 67 | return QString::null; |
70 | } | 68 | } |
71 | 69 | ||
72 | QString EmailSelectDialog::getEmail( const QStringList &emails, const QString ¤t, | 70 | QString EmailSelectDialog::getEmail( const QStringList &emails, const QString ¤t, |
73 | QWidget *parent ) | 71 | QWidget *parent ) |
74 | { | 72 | { |
75 | EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); | 73 | EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); |
76 | dlg->exec(); | 74 | dlg->exec(); |
77 | 75 | ||
78 | QString result = dlg->selected(); | 76 | QString result = dlg->selected(); |
79 | 77 | ||
80 | delete dlg; | 78 | delete dlg; |
81 | 79 | ||
82 | return result; | 80 | return result; |
83 | } | 81 | } |
84 | 82 | ||
85 | class EditEntryItem : public QListViewItem | 83 | class EditEntryItem : public QListViewItem |
86 | { | 84 | { |
87 | public: | 85 | public: |
88 | EditEntryItem( QListView *parent, const Addressee &addressee, | 86 | EditEntryItem( QListView *parent, const Addressee &addressee, |
89 | const QString &email=QString::null ) : | 87 | const QString &email=QString::null ) : |
90 | QListViewItem( parent ), | 88 | QListViewItem( parent ), |
91 | mAddressee( addressee ), | 89 | mAddressee( addressee ), |
92 | mEmail( email ) | 90 | mEmail( email ) |
93 | { | 91 | { |
94 | setText( 0, addressee.realName() ); | 92 | setText( 0, addressee.realName() ); |
95 | if( email.isEmpty() ) { | 93 | if( email.isEmpty() ) { |
96 | setText( 1, addressee.preferredEmail() ); | 94 | setText( 1, addressee.preferredEmail() ); |
97 | setText( 2, i18n("Yes") ); | 95 | setText( 2, i18n("Yes") ); |
98 | } else { | 96 | } else { |
99 | setText( 1, email ); | 97 | setText( 1, email ); |
100 | setText( 2, i18n("No") ); | 98 | setText( 2, i18n("No") ); |
101 | } | 99 | } |
102 | } | 100 | } |
103 | 101 | ||
104 | Addressee addressee() const | 102 | Addressee addressee() const |
105 | { | 103 | { |
106 | return mAddressee; | 104 | return mAddressee; |
107 | } | 105 | } |
108 | 106 | ||
109 | QString email() const | 107 | QString email() const |
110 | { | 108 | { |
111 | return mEmail; | 109 | return mEmail; |
112 | } | 110 | } |
113 | 111 | ||
114 | private: | 112 | private: |
115 | Addressee mAddressee; | 113 | Addressee mAddressee; |
116 | QString mEmail; | 114 | QString mEmail; |
117 | }; | 115 | }; |
118 | 116 | ||
119 | DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) : | 117 | DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) : |
120 | QWidget( parent ), | 118 | QWidget( parent ), |
121 | mAddressBook( addressBook ) | 119 | mAddressBook( addressBook ) |
122 | { | 120 | { |
123 | kdDebug(5700) << "DistributionListEditor()" << endl; | 121 | kdDebug(5700) << "DistributionListEditor()" << endl; |
124 | 122 | ||
125 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 123 | QBoxLayout *topLayout = new QVBoxLayout( this ); |
126 | topLayout->setMargin( KDialog::marginHint() ); | 124 | topLayout->setMargin( KDialog::marginHint() ); |
127 | topLayout->setSpacing( KDialog::spacingHint() ); | 125 | topLayout->setSpacing( KDialog::spacingHint() ); |
128 | 126 | ||
129 | QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ; | 127 | QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ; |
130 | 128 | ||
131 | mNameCombo = new QComboBox( this ); | 129 | mNameCombo = new QComboBox( this ); |
132 | nameLayout->addWidget( mNameCombo ); | 130 | nameLayout->addWidget( mNameCombo ); |
133 | connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) ); | 131 | connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) ); |
134 | 132 | ||
135 | newButton = new QPushButton( i18n("New List"), this ); | 133 | newButton = new QPushButton( i18n("New List"), this ); |
136 | nameLayout->addWidget( newButton ); | 134 | nameLayout->addWidget( newButton ); |
137 | connect( newButton, SIGNAL( clicked() ), SLOT( newList() ) ); | 135 | connect( newButton, SIGNAL( clicked() ), SLOT( newList() ) ); |
138 | 136 | ||
139 | removeButton = new QPushButton( i18n("Remove List"), this ); | 137 | removeButton = new QPushButton( i18n("Remove List"), this ); |
140 | nameLayout->addWidget( removeButton ); | 138 | nameLayout->addWidget( removeButton ); |
141 | connect( removeButton, SIGNAL( clicked() ), SLOT( removeList() ) ); | 139 | connect( removeButton, SIGNAL( clicked() ), SLOT( removeList() ) ); |
142 | 140 | ||
143 | mEntryView = new QListView( this ); | 141 | mEntryView = new QListView( this ); |
144 | mEntryView->addColumn( i18n("Name") ); | 142 | mEntryView->addColumn( i18n("Name") ); |
145 | mEntryView->addColumn( i18n("Email") ); | 143 | mEntryView->addColumn( i18n("Email") ); |
146 | mEntryView->addColumn( i18n("Use Preferred") ); | 144 | mEntryView->addColumn( i18n("Use Preferred") ); |
147 | topLayout->addWidget( mEntryView ); | 145 | topLayout->addWidget( mEntryView ); |
148 | connect(mEntryView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionEntryViewChanged())); | 146 | connect(mEntryView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionEntryViewChanged())); |
149 | 147 | ||
150 | changeEmailButton = new QPushButton( i18n("Change Email"), this ); | 148 | changeEmailButton = new QPushButton( i18n("Change Email"), this ); |
151 | topLayout->addWidget( changeEmailButton ); | 149 | topLayout->addWidget( changeEmailButton ); |
152 | connect( changeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); | 150 | connect( changeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); |
153 | 151 | ||
154 | removeEntryButton = new QPushButton( i18n("Remove Entry"), this ); | 152 | removeEntryButton = new QPushButton( i18n("Remove Entry"), this ); |
155 | topLayout->addWidget( removeEntryButton ); | 153 | topLayout->addWidget( removeEntryButton ); |
156 | connect( removeEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) ); | 154 | connect( removeEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) ); |
157 | 155 | ||
158 | addEntryButton = new QPushButton( i18n("Add Entry"), this ); | 156 | addEntryButton = new QPushButton( i18n("Add Entry"), this ); |
159 | topLayout->addWidget( addEntryButton ); | 157 | topLayout->addWidget( addEntryButton ); |
160 | connect( addEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) ); | 158 | connect( addEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) ); |
161 | 159 | ||
162 | mAddresseeView = new QListView( this ); | 160 | mAddresseeView = new QListView( this ); |
163 | mAddresseeView->addColumn( i18n("Name") ); | 161 | mAddresseeView->addColumn( i18n("Name") ); |
164 | mAddresseeView->addColumn( i18n("Preferred Email") ); | 162 | mAddresseeView->addColumn( i18n("Preferred Email") ); |
165 | topLayout->addWidget( mAddresseeView ); | 163 | topLayout->addWidget( mAddresseeView ); |
166 | 164 | ||
167 | 165 | ||
168 | connect(mAddresseeView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionAddresseeViewChanged())); | 166 | connect(mAddresseeView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionAddresseeViewChanged())); |
169 | 167 | ||
170 | mManager = new DistributionListManager( mAddressBook ); | 168 | mManager = new DistributionListManager( mAddressBook ); |
171 | mManager->load(); | 169 | mManager->load(); |
172 | 170 | ||
173 | updateAddresseeView(); | 171 | updateAddresseeView(); |
174 | updateNameCombo(); | 172 | updateNameCombo(); |
175 | removeButton->setEnabled(!mManager->listNames().isEmpty()); | 173 | removeButton->setEnabled(!mManager->listNames().isEmpty()); |
176 | } | 174 | } |
177 | 175 | ||
178 | DistributionListEditor::~DistributionListEditor() | 176 | DistributionListEditor::~DistributionListEditor() |
179 | { | 177 | { |
180 | kdDebug(5700) << "~DistributionListEditor()" << endl; | 178 | kdDebug(5700) << "~DistributionListEditor()" << endl; |
181 | 179 | ||
182 | mManager->save(); | 180 | mManager->save(); |
183 | delete mManager; | 181 | delete mManager; |
184 | } | 182 | } |
185 | 183 | ||
186 | void DistributionListEditor::slotSelectionEntryViewChanged() | 184 | void DistributionListEditor::slotSelectionEntryViewChanged() |
187 | { | 185 | { |
188 | #ifndef KAB_EMBEDDED | 186 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); |
189 | EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); | ||
190 | #else //KAB_EMBEDDED | ||
191 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); | 187 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); |
192 | #endif //KAB_EMBEDDED | ||
193 | bool state = (entryItem != 0L); | 188 | bool state = (entryItem != 0L); |
194 | 189 | ||
195 | changeEmailButton->setEnabled(state); | 190 | changeEmailButton->setEnabled(state); |
196 | removeEntryButton->setEnabled(state); | 191 | removeEntryButton->setEnabled(state); |
197 | } | 192 | } |
198 | 193 | ||
199 | void DistributionListEditor::newList() | 194 | void DistributionListEditor::newList() |
200 | { | 195 | { |
201 | bool ok = false; | 196 | bool ok = false; |
202 | QString name = QInputDialog::getText( i18n("New Distribution List"), | 197 | QString name = QInputDialog::getText( i18n("New Distribution List"), |
203 | i18n("Please enter name:"), | 198 | i18n("Please enter name:"), |
204 | QLineEdit::Normal, QString::null, &ok, | 199 | QLineEdit::Normal, QString::null, &ok, |
205 | this ); | 200 | this ); |
206 | if ( !ok || name.isEmpty() ) return; | 201 | if ( !ok || name.isEmpty() ) return; |
207 | 202 | ||
208 | new DistributionList( mManager, name ); | 203 | new DistributionList( mManager, name ); |
209 | 204 | ||
210 | mNameCombo->insertItem( name ); | 205 | mNameCombo->insertItem( name ); |
211 | removeButton->setEnabled(true); | 206 | removeButton->setEnabled(true); |
212 | updateEntryView(); | 207 | updateEntryView(); |
213 | } | 208 | } |
214 | 209 | ||
215 | void DistributionListEditor::removeList() | 210 | void DistributionListEditor::removeList() |
216 | { | 211 | { |
217 | delete mManager->list( mNameCombo->currentText() ); | 212 | delete mManager->list( mNameCombo->currentText() ); |
218 | mNameCombo->removeItem( mNameCombo->currentItem() ); | 213 | mNameCombo->removeItem( mNameCombo->currentItem() ); |
219 | removeButton->setEnabled(!mManager->listNames().isEmpty()); | 214 | removeButton->setEnabled(!mManager->listNames().isEmpty()); |
220 | addEntryButton->setEnabled( !mNameCombo->currentText().isEmpty()); | 215 | addEntryButton->setEnabled( !mNameCombo->currentText().isEmpty()); |
221 | updateEntryView(); | 216 | updateEntryView(); |
222 | } | 217 | } |
223 | 218 | ||
224 | void DistributionListEditor::addEntry() | 219 | void DistributionListEditor::addEntry() |
225 | { | 220 | { |
226 | #ifndef KAB_EMBEDDED | 221 | /*US |
227 | AddresseeItem *addresseeItem = | 222 | AddresseeItem *addresseeItem = |
228 | dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); | 223 | dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); |
229 | #else //KAB_EMBEDDED | 224 | */ |
230 | AddresseeItem *addresseeItem = | 225 | AddresseeItem *addresseeItem = |
231 | (AddresseeItem *)( mAddresseeView->selectedItem() ); | 226 | (AddresseeItem *)( mAddresseeView->selectedItem() ); |
232 | #endif //KAB_EMBEDDED | ||
233 | 227 | ||
234 | 228 | ||
235 | if( !addresseeItem ) { | 229 | if( !addresseeItem ) { |
236 | kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl; | 230 | kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl; |
237 | return; | 231 | return; |
238 | } | 232 | } |
239 | 233 | ||
240 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 234 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
241 | if ( !list ) { | 235 | if ( !list ) { |
242 | kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl; | 236 | kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl; |
243 | return; | 237 | return; |
244 | } | 238 | } |
245 | 239 | ||
246 | list->insertEntry( addresseeItem->addressee() ); | 240 | list->insertEntry( addresseeItem->addressee() ); |
247 | updateEntryView(); | 241 | updateEntryView(); |
248 | slotSelectionAddresseeViewChanged(); | 242 | slotSelectionAddresseeViewChanged(); |
249 | } | 243 | } |
250 | 244 | ||
251 | void DistributionListEditor::removeEntry() | 245 | void DistributionListEditor::removeEntry() |
252 | { | 246 | { |
253 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 247 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
254 | if ( !list ) return; | 248 | if ( !list ) return; |
255 | 249 | ||
256 | #ifndef KAB_EMBEDDED | 250 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); |
257 | EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); | ||
258 | #else //KAB_EMBEDDED | ||
259 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); | 251 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); |
260 | #endif //KAB_EMBEDDED | ||
261 | if ( !entryItem ) return; | 252 | if ( !entryItem ) return; |
262 | 253 | ||
263 | list->removeEntry( entryItem->addressee(), entryItem->email() ); | 254 | list->removeEntry( entryItem->addressee(), entryItem->email() ); |
264 | delete entryItem; | 255 | delete entryItem; |
265 | } | 256 | } |
266 | 257 | ||
267 | void DistributionListEditor::changeEmail() | 258 | void DistributionListEditor::changeEmail() |
268 | { | 259 | { |
269 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 260 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
270 | if ( !list ) return; | 261 | if ( !list ) return; |
271 | 262 | ||
272 | #ifndef KAB_EMBEDDED | 263 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); |
273 | EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); | ||
274 | #else //KAB_EMBEDDED | ||
275 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); | 264 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); |
276 | #endif //KAB_EMBEDDED | ||
277 | if ( !entryItem ) return; | 265 | if ( !entryItem ) return; |
278 | 266 | ||
279 | QString email = EmailSelectDialog::getEmail( entryItem->addressee().emails(), | 267 | QString email = EmailSelectDialog::getEmail( entryItem->addressee().emails(), |
280 | entryItem->email(), this ); | 268 | entryItem->email(), this ); |
281 | list->removeEntry( entryItem->addressee(), entryItem->email() ); | 269 | list->removeEntry( entryItem->addressee(), entryItem->email() ); |
282 | list->insertEntry( entryItem->addressee(), email ); | 270 | list->insertEntry( entryItem->addressee(), email ); |
283 | 271 | ||
284 | updateEntryView(); | 272 | updateEntryView(); |
285 | } | 273 | } |
286 | 274 | ||
287 | void DistributionListEditor::updateEntryView() | 275 | void DistributionListEditor::updateEntryView() |
288 | { | 276 | { |
289 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 277 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
290 | if ( !list ) return; | 278 | if ( !list ) return; |
291 | 279 | ||
292 | mEntryView->clear(); | 280 | mEntryView->clear(); |
293 | DistributionList::Entry::List entries = list->entries(); | 281 | DistributionList::Entry::List entries = list->entries(); |
294 | DistributionList::Entry::List::ConstIterator it; | 282 | DistributionList::Entry::List::ConstIterator it; |
295 | for( it = entries.begin(); it != entries.end(); ++it ) { | 283 | for( it = entries.begin(); it != entries.end(); ++it ) { |
296 | new EditEntryItem( mEntryView, (*it).addressee, (*it).email ); | 284 | new EditEntryItem( mEntryView, (*it).addressee, (*it).email ); |
297 | } | 285 | } |
298 | #ifndef KAB_EMBEDDED | 286 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); |
299 | EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); | ||
300 | #else //KAB_EMBEDDED | ||
301 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); | 287 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); |
302 | #endif //KAB_EMBEDDED | ||
303 | bool state = (entryItem != 0L); | 288 | bool state = (entryItem != 0L); |
304 | 289 | ||
305 | changeEmailButton->setEnabled(state); | 290 | changeEmailButton->setEnabled(state); |
306 | removeEntryButton->setEnabled(state); | 291 | removeEntryButton->setEnabled(state); |
307 | } | 292 | } |
308 | 293 | ||
309 | void DistributionListEditor::updateAddresseeView() | 294 | void DistributionListEditor::updateAddresseeView() |
310 | { | 295 | { |
311 | mAddresseeView->clear(); | 296 | mAddresseeView->clear(); |
312 | 297 | ||
313 | AddressBook::Iterator it; | 298 | AddressBook::Iterator it; |
314 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 299 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
315 | new AddresseeItem( mAddresseeView, *it ); | 300 | new AddresseeItem( mAddresseeView, *it ); |
316 | } | 301 | } |
317 | } | 302 | } |
318 | 303 | ||
319 | void DistributionListEditor::updateNameCombo() | 304 | void DistributionListEditor::updateNameCombo() |
320 | { | 305 | { |
321 | mNameCombo->insertStringList( mManager->listNames() ); | 306 | mNameCombo->insertStringList( mManager->listNames() ); |
322 | 307 | ||
323 | updateEntryView(); | 308 | updateEntryView(); |
324 | } | 309 | } |
325 | 310 | ||
326 | void DistributionListEditor::slotSelectionAddresseeViewChanged() | 311 | void DistributionListEditor::slotSelectionAddresseeViewChanged() |
327 | { | 312 | { |
328 | #ifndef KAB_EMBEDDED | 313 | //US AddresseeItem *addresseeItem = dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); |
329 | AddresseeItem *addresseeItem = dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); | ||
330 | #else //KAB_EMBEDDED | ||
331 | AddresseeItem *addresseeItem = (AddresseeItem *)( mAddresseeView->selectedItem() ); | 314 | AddresseeItem *addresseeItem = (AddresseeItem *)( mAddresseeView->selectedItem() ); |
332 | #endif //KAB_EMBEDDED | ||
333 | bool state = (addresseeItem != 0L); | 315 | bool state = (addresseeItem != 0L); |
334 | addEntryButton->setEnabled( state && !mNameCombo->currentText().isEmpty()); | 316 | addEntryButton->setEnabled( state && !mNameCombo->currentText().isEmpty()); |
335 | } | 317 | } |