summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/distributionlisteditor.cpp34
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
@@ -32,15 +32,13 @@
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
42using namespace KABC; 40using namespace KABC;
43 41
44EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString &current, 42EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString &current,
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,
@@ -182,17 +180,14 @@ DistributionListEditor::~DistributionListEditor()
182 mManager->save(); 180 mManager->save();
183 delete mManager; 181 delete mManager;
184} 182}
185 183
186void DistributionListEditor::slotSelectionEntryViewChanged() 184void 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
@@ -220,19 +215,18 @@ void DistributionListEditor::removeList()
220 addEntryButton->setEnabled( !mNameCombo->currentText().isEmpty()); 215 addEntryButton->setEnabled( !mNameCombo->currentText().isEmpty());
221 updateEntryView(); 216 updateEntryView();
222} 217}
223 218
224void DistributionListEditor::addEntry() 219void 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 }
@@ -250,33 +244,27 @@ void DistributionListEditor::addEntry()
250 244
251void DistributionListEditor::removeEntry() 245void 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
267void DistributionListEditor::changeEmail() 258void 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 );
@@ -292,17 +280,14 @@ void DistributionListEditor::updateEntryView()
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
@@ -322,14 +307,11 @@ void DistributionListEditor::updateNameCombo()
322 307
323 updateEntryView(); 308 updateEntryView();
324} 309}
325 310
326void DistributionListEditor::slotSelectionAddresseeViewChanged() 311void 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}