korganizer

koattendeeeditor.cpp

00001 /*
00002     Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
00003     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00004     Copyright (c) 2007 Volker Krause <vkrause@kde.org>
00005 
00006         This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include <config.h> // for KDEPIM_NEW_DISTRLISTS
00022 
00023 #include "koattendeeeditor.h"
00024 #include "koprefs.h"
00025 #include "koglobals.h"
00026 
00027 #ifndef KORG_NOKABC
00028 #include <kabc/addresseedialog.h>
00029 #include <libkdepim/addressesdialog.h>
00030 #include <libkdepim/addresseelineedit.h>
00031 #endif
00032 
00033 #include <libkcal/incidence.h>
00034 
00035 #include <libemailfunctions/email.h>
00036 
00037 #ifdef KDEPIM_NEW_DISTRLISTS
00038 #include "distributionlist.h"
00039 #else
00040 #include <kabc/distributionlist.h>
00041 #endif
00042 #include <kabc/stdaddressbook.h>
00043 
00044 #include <kiconloader.h>
00045 #include <klocale.h>
00046 #include <kmessagebox.h>
00047 
00048 #include <qcheckbox.h>
00049 #include <qcombobox.h>
00050 #include <qhbox.h>
00051 #include <qlabel.h>
00052 #include <qlayout.h>
00053 #include <qpushbutton.h>
00054 #include <qwhatsthis.h>
00055 
00056 using namespace KCal;
00057 
00058 KOAttendeeEditor::KOAttendeeEditor( QWidget * parent, const char *name ) :
00059     QWidget( parent, name ),
00060     mDisableItemUpdate( true )
00061 {
00062 }
00063 
00064 void KOAttendeeEditor::initOrganizerWidgets(QWidget * parent, QBoxLayout * layout)
00065 {
00066   mOrganizerHBox = new QHBox( parent );
00067   layout->addWidget( mOrganizerHBox );
00068   // If creating a new event, then the user is the organizer -> show the
00069   // identity combo
00070   // readEvent will delete it and set another label text instead, if the user
00071   // isn't the organizer.
00072   // Note that the i18n text below is duplicated in readEvent
00073   QString whatsThis = i18n("Sets the identity corresponding to "
00074                            "the organizer of this to-do or event. "
00075                            "Identities can be set in the 'Personal' "
00076                            "section of the KOrganizer configuration, or in the "
00077                            "'Security & Privacy'->'Password & User Account' "
00078                            "section of the KDE Control Center. In addition, "
00079                            "identities are gathered from your KMail settings "
00080                            "and from your address book. If you choose "
00081                            "to set it globally for KDE in the Control Center, "
00082                            "be sure to check 'Use email settings from "
00083                            "Control Center' in the 'Personal' section of the "
00084                            "KOrganizer configuration.");
00085   mOrganizerLabel = new QLabel( i18n( "Identity as organizer:" ),
00086                                 mOrganizerHBox );
00087   mOrganizerCombo = new QComboBox( mOrganizerHBox );
00088   QWhatsThis::add( mOrganizerLabel, whatsThis );
00089   QWhatsThis::add( mOrganizerCombo, whatsThis );
00090   fillOrganizerCombo();
00091   mOrganizerHBox->setStretchFactor( mOrganizerCombo, 100 );
00092 }
00093 
00094 void KOAttendeeEditor::initEditWidgets(QWidget * parent, QBoxLayout * layout)
00095 {
00096   QGridLayout *topLayout = new QGridLayout();
00097   layout->addLayout( topLayout );
00098 
00099   QString whatsThis = i18n("Edits the name of the attendee selected in the list "
00100                            "above, or adds a new attendee if there are no attendees"
00101                            "in the list.");
00102   QLabel *attendeeLabel = new QLabel( parent );
00103   QWhatsThis::add( attendeeLabel, whatsThis );
00104   attendeeLabel->setText( i18n("Na&me:") );
00105   topLayout->addWidget( attendeeLabel, 0, 0 );
00106 
00107   mNameEdit = new KPIM::AddresseeLineEdit( parent );
00108   QWhatsThis::add( mNameEdit, whatsThis );
00109   mNameEdit->setClickMessage( i18n("Click to add a new attendee") );
00110   attendeeLabel->setBuddy( mNameEdit );
00111   mNameEdit->installEventFilter( this );
00112   connect( mNameEdit, SIGNAL( textChanged( const QString & ) ),
00113            SLOT( updateAttendee() ) );
00114   connect( mNameEdit, SIGNAL(returnPressed()), SLOT(expandAttendee()) );
00115   topLayout->addMultiCellWidget( mNameEdit, 0, 0, 1, 2 );
00116 
00117   whatsThis = i18n("Edits the role of the attendee selected "
00118                    "in the list above.");
00119   QLabel *attendeeRoleLabel = new QLabel( parent );
00120   QWhatsThis::add( attendeeRoleLabel, whatsThis );
00121   attendeeRoleLabel->setText( i18n("Ro&le:") );
00122   topLayout->addWidget( attendeeRoleLabel, 1, 0 );
00123 
00124   mRoleCombo = new QComboBox( false, parent );
00125   QWhatsThis::add( mRoleCombo, whatsThis );
00126   mRoleCombo->insertStringList( Attendee::roleList() );
00127   attendeeRoleLabel->setBuddy( mRoleCombo );
00128   connect( mRoleCombo, SIGNAL( activated( int ) ),
00129            SLOT( updateAttendee() ) );
00130   topLayout->addWidget( mRoleCombo, 1, 1 );
00131 
00132   mDelegateLabel = new QLabel( parent );
00133   topLayout->addWidget( mDelegateLabel, 1, 2 );
00134 
00135   whatsThis = i18n("Edits the current attendance status of the attendee "
00136                    "selected in the list above.");
00137   QLabel *statusLabel = new QLabel( parent );
00138   QWhatsThis::add( statusLabel, whatsThis );
00139   statusLabel->setText( i18n("Stat&us:") );
00140   topLayout->addWidget( statusLabel, 2, 0 );
00141 
00142   mStatusCombo = new QComboBox( false, parent );
00143   QWhatsThis::add( mStatusCombo, whatsThis );
00144 //   mStatusCombo->insertStringList( Attendee::statusList() );
00145   mStatusCombo->insertItem( SmallIcon( "help" ), Attendee::statusName( Attendee::NeedsAction ) );
00146   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "ok" ), Attendee::statusName( Attendee::Accepted ) );
00147   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "no" ), Attendee::statusName( Attendee::Declined ) );
00148   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "apply" ), Attendee::statusName( Attendee::Tentative ) );
00149   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "mail_forward" ), Attendee::statusName( Attendee::Delegated ) );
00150   mStatusCombo->insertItem( Attendee::statusName( Attendee::Completed ) );
00151   mStatusCombo->insertItem( KOGlobals::self()->smallIcon( "help" ), Attendee::statusName( Attendee::InProcess ) );
00152 
00153   statusLabel->setBuddy( mStatusCombo );
00154   connect( mStatusCombo, SIGNAL( activated( int ) ),
00155            SLOT( updateAttendee() ) );
00156   topLayout->addWidget( mStatusCombo, 2, 1 );
00157 
00158   topLayout->setColStretch( 2, 1 );
00159 
00160   mRsvpButton = new QCheckBox( parent );
00161   QWhatsThis::add( mRsvpButton,
00162            i18n("Edits whether to send an email to the attendee "
00163             "selected in the list above to request "
00164             "a response concerning attendance.") );
00165   mRsvpButton->setText( i18n("Re&quest response") );
00166   connect( mRsvpButton, SIGNAL( clicked() ), SLOT( updateAttendee() ) );
00167   topLayout->addWidget( mRsvpButton, 2, 2 );
00168 
00169   QWidget *buttonBox = new QWidget( parent );
00170   QVBoxLayout *buttonLayout = new QVBoxLayout( buttonBox );
00171 
00172   mAddButton = new QPushButton( i18n("&New"), buttonBox );
00173   QWhatsThis::add( mAddButton,
00174            i18n("Adds a new attendee to the list. Once the "
00175             "attendee is added, you will be able to "
00176             "edit the attendee's name, role, attendance "
00177             "status, and whether or not the attendee is required "
00178             "to respond to the invitation. To select an attendee "
00179             "from your addressbook, click the 'Select Addressee' "
00180             "button instead.") );
00181   buttonLayout->addWidget( mAddButton );
00182   connect( mAddButton, SIGNAL( clicked() ), SLOT( addNewAttendee() ) );
00183 
00184   mRemoveButton = new QPushButton( i18n("&Remove"), buttonBox );
00185   QWhatsThis::add( mRemoveButton,
00186            i18n("Removes the attendee selected in "
00187             "the list above.") );
00188   buttonLayout->addWidget( mRemoveButton );
00189 
00190   mAddressBookButton = new QPushButton( i18n("Select Addressee..."),
00191                                         buttonBox );
00192   QWhatsThis::add( mAddressBookButton,
00193            i18n("Opens your address book, allowing you to select "
00194             "new attendees from it.") );
00195   buttonLayout->addWidget( mAddressBookButton );
00196   connect( mAddressBookButton, SIGNAL( clicked() ), SLOT( openAddressBook() ) );
00197 
00198   topLayout->addMultiCellWidget( buttonBox, 0, 3, 3, 3 );
00199 
00200 #ifdef KORG_NOKABC
00201   mAddressBookButton->hide();
00202 #endif
00203 }
00204 
00205 void KOAttendeeEditor::openAddressBook()
00206 {
00207 #ifndef KORG_NOKABC
00208   KPIM::AddressesDialog *dia = new KPIM::AddressesDialog( this, "adddialog" );
00209   dia->setShowCC( false );
00210   dia->setShowBCC( false );
00211   if ( dia->exec() ) {
00212     KABC::Addressee::List aList = dia->allToAddressesNoDuplicates();
00213     for ( KABC::Addressee::List::iterator itr = aList.begin();
00214           itr != aList.end(); ++itr ) {
00215       insertAttendeeFromAddressee( (*itr) );
00216     }
00217   }
00218   delete dia;
00219   return;
00220 #endif
00221 }
00222 
00223 void KOAttendeeEditor::insertAttendeeFromAddressee(const KABC::Addressee &a, const Attendee * at)
00224 {
00225   bool myself = KOPrefs::instance()->thatIsMe( a.preferredEmail() );
00226   bool sameAsOrganizer = mOrganizerCombo &&
00227   KPIM::compareEmail( a.preferredEmail(), mOrganizerCombo->currentText(), false );
00228   KCal::Attendee::PartStat partStat = at? at->status() : KCal::Attendee::NeedsAction;
00229   bool rsvp = at? at->RSVP() : true;
00230 
00231   if ( myself && sameAsOrganizer ) {
00232     partStat = KCal::Attendee::Accepted;
00233     rsvp = false;
00234   }
00235   Attendee *newAt = new Attendee( a.realName(),
00236                                   a.preferredEmail(),
00237                                   !myself, partStat,
00238                                   at ? at->role() : Attendee::ReqParticipant,
00239                                   a.uid() );
00240   newAt->setRSVP( rsvp );
00241   insertAttendee( newAt, true );
00242   mnewAttendees.append( newAt );
00243 }
00244 
00245 void KOAttendeeEditor::fillOrganizerCombo()
00246 {
00247   Q_ASSERT( mOrganizerCombo );
00248   // Get all emails from KOPrefs (coming from various places),
00249   // and insert them - removing duplicates
00250   const QStringList lst = KOPrefs::instance()->fullEmails();
00251   QStringList uniqueList;
00252   for( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
00253     if ( uniqueList.find( *it ) == uniqueList.end() )
00254       uniqueList << *it;
00255   }
00256   mOrganizerCombo->insertStringList( uniqueList );
00257 }
00258 
00259 void KOAttendeeEditor::addNewAttendee()
00260 {
00261   // check if there's still an unchanged example entry, and if so
00262   // suggest to edit that first
00263   if ( QListViewItem* item = hasExampleAttendee() ) {
00264       KMessageBox::information( this,
00265           i18n( "Please edit the example attendee, before adding more." ), QString::null,
00266           "EditExistingExampleAttendeeFirst" );
00267       // make sure the example attendee is selected
00268       item->setSelected( true );
00269       item->listView()->setCurrentItem( item );
00270       return;
00271   }
00272   Attendee *a = new Attendee( i18n("Firstname Lastname"),
00273                               i18n("name") + "@example.net", true );
00274   insertAttendee( a, false );
00275   mnewAttendees.append( a );
00276   updateAttendeeInput();
00277   // We don't want the hint again
00278   mNameEdit->setClickMessage( "" );
00279   mNameEdit->setFocus();
00280   QTimer::singleShot( 0, mNameEdit, SLOT( selectAll() ) );
00281 }
00282 
00283 void KOAttendeeEditor::readEvent(KCal::Incidence * incidence)
00284 {
00285   mdelAttendees.clear();
00286   mnewAttendees.clear();
00287   if ( KOPrefs::instance()->thatIsMe( incidence->organizer().email() ) || incidence->organizer().isEmpty() ) {
00288     if ( !mOrganizerCombo ) {
00289       mOrganizerCombo = new QComboBox( mOrganizerHBox );
00290       fillOrganizerCombo();
00291     }
00292     mOrganizerLabel->setText( i18n( "Identity as organizer:" ) );
00293 
00294     int found = -1;
00295     QString fullOrganizer = incidence->organizer().fullName();
00296     for ( int i = 0 ; i < mOrganizerCombo->count(); ++i ) {
00297       if ( mOrganizerCombo->text( i ) == fullOrganizer ) {
00298         found = i;
00299         mOrganizerCombo->setCurrentItem( i );
00300         break;
00301       }
00302     }
00303     if ( found < 0 ) {
00304       mOrganizerCombo->insertItem( fullOrganizer, 0 );
00305       mOrganizerCombo->setCurrentItem( 0 );
00306     }
00307   } else { // someone else is the organizer
00308     if ( mOrganizerCombo ) {
00309       delete mOrganizerCombo;
00310       mOrganizerCombo = 0;
00311     }
00312     mOrganizerLabel->setText( i18n( "Organizer: %1" ).arg( incidence->organizer().fullName() ) );
00313   }
00314 
00315   Attendee::List al = incidence->attendees();
00316   Attendee::List::ConstIterator it;
00317   Attendee *first = 0;
00318   for( it = al.begin(); it != al.end(); ++it ) {
00319     Attendee *a = new Attendee( **it );
00320     if ( !first ) {
00321       first = a;
00322     }
00323     insertAttendee( a, true );
00324   }
00325 
00326   // Set the initial editing values to the first attendee in the list.
00327   if ( first ) {
00328     setSelected( 0 );
00329     mNameEdit->setText( first->fullName() );
00330     mUid = first->uid();
00331     mRoleCombo->setCurrentItem( first->role() );
00332     if ( first->status() != KCal::Attendee::None ) {
00333       mStatusCombo->setCurrentItem( first->status() );
00334     } else {
00335       mStatusCombo->setCurrentItem( KCal::Attendee::NeedsAction );
00336     }
00337     mRsvpButton->setChecked( first->RSVP() );
00338     mRsvpButton->setEnabled( true );
00339   }
00340 }
00341 
00342 void KOAttendeeEditor::writeEvent(KCal::Incidence * incidence)
00343 {
00344   if ( mOrganizerCombo ) {
00345     // TODO: Don't take a string and split it up... Is there a better way?
00346     incidence->setOrganizer( mOrganizerCombo->currentText() );
00347   }
00348 }
00349 
00350 void KOAttendeeEditor::setEnableAttendeeInput(bool enabled)
00351 {
00352   //mNameEdit->setEnabled( enabled );
00353   mRoleCombo->setEnabled( enabled );
00354   mStatusCombo->setEnabled( enabled );
00355   mRsvpButton->setEnabled( enabled );
00356 
00357   mRemoveButton->setEnabled( enabled );
00358 }
00359 
00360 void KOAttendeeEditor::clearAttendeeInput()
00361 {
00362   mNameEdit->setText("");
00363   mUid = QString::null;
00364   mRoleCombo->setCurrentItem(0);
00365   mStatusCombo->setCurrentItem(0);
00366   mRsvpButton->setChecked(true);
00367   setEnableAttendeeInput( false );
00368   mDelegateLabel->setText( QString() );
00369 }
00370 
00371 void KOAttendeeEditor::expandAttendee()
00372 {
00373   KABC::Addressee::List aList = expandDistList( mNameEdit->text() );
00374   if ( !aList.isEmpty() ) {
00375     int index = selectedIndex();
00376     for ( KABC::Addressee::List::iterator itr = aList.begin(); itr != aList.end(); ++itr ) {
00377       insertAttendeeFromAddressee( (*itr) );
00378     }
00379     setSelected( index );
00380     removeAttendee( currentAttendee() );
00381   }
00382 }
00383 
00384 void KOAttendeeEditor::updateAttendee()
00385 {
00386   Attendee *a = currentAttendee();
00387   if ( !a || mDisableItemUpdate )
00388     return;
00389 
00390   QString text = mNameEdit->text();
00391   if ( !mNameEdit->text().startsWith( "\"" ) ) {
00392     // Quote the text as it might contain commas and other quotable chars.
00393     text = KPIM::quoteNameIfNecessary( text );
00394   }
00395 
00396   QString name, email;
00397   if ( KPIM::getNameAndMail( text, name, email ) ) {
00398     name.remove( '"' );
00399     email.remove( '"' ).remove( '>' );
00400   } else {
00401     name = QString();
00402     email = mNameEdit->text();
00403   }
00404 
00405   bool iAmTheOrganizer = mOrganizerCombo &&
00406     KOPrefs::instance()->thatIsMe( mOrganizerCombo->currentText() );
00407   if ( iAmTheOrganizer ) {
00408     bool myself =
00409       KPIM::compareEmail( email, mOrganizerCombo->currentText(), false );
00410     bool wasMyself =
00411       KPIM::compareEmail( a->email(), mOrganizerCombo->currentText(), false );
00412     if ( myself ) {
00413       mRsvpButton->setChecked( false );
00414       mRsvpButton->setEnabled( false );
00415     } else if ( wasMyself ) {
00416       // this was me, but is no longer, reset
00417       mStatusCombo->setCurrentItem( KCal::Attendee::NeedsAction );
00418       mRsvpButton->setChecked( true );
00419       mRsvpButton->setEnabled( true );
00420     }
00421   }
00422   a->setName( name );
00423   a->setUid( mUid );
00424   a->setEmail( email );
00425   a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
00426   a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
00427   a->setRSVP( mRsvpButton->isChecked() );
00428 
00429   updateCurrentItem();
00430 }
00431 
00432 void KOAttendeeEditor::fillAttendeeInput( KCal::Attendee *a )
00433 {
00434   mDisableItemUpdate = true;
00435 
00436   QString tname, temail;
00437   QString username = a->name();
00438   if ( !a->email().isEmpty() ) {
00439     username = KPIM::quoteNameIfNecessary( username );
00440 
00441     KPIM::getNameAndMail( username, tname, temail ); // ignore return value
00442                                                      // which is always false
00443     tname += " <" + a->email() + '>';
00444   }
00445 
00446   bool myself = KOPrefs::instance()->thatIsMe( a->email() );
00447   bool sameAsOrganizer = mOrganizerCombo &&
00448           KPIM::compareEmail( a->email(),
00449                                    mOrganizerCombo->currentText(), false );
00450   KCal::Attendee::PartStat partStat = a->status();
00451   bool rsvp = a->RSVP();
00452 
00453   if ( myself && sameAsOrganizer && a->status() == KCal::Attendee::None ) {
00454       partStat = KCal::Attendee::Accepted;
00455       rsvp = false;
00456   }
00457 
00458   mNameEdit->setText(tname);
00459   mUid = a->uid();
00460   mRoleCombo->setCurrentItem(a->role());
00461   if ( partStat != KCal::Attendee::None ) {
00462     mStatusCombo->setCurrentItem( partStat );
00463   } else {
00464     mStatusCombo->setCurrentItem( KCal::Attendee::NeedsAction );
00465   }
00466   mRsvpButton->setChecked( rsvp );
00467 
00468   mDisableItemUpdate = false;
00469   setEnableAttendeeInput( true );
00470 
00471   if ( a->status() == Attendee::Delegated ) {
00472     if ( !a->delegate().isEmpty() )
00473       mDelegateLabel->setText( i18n( "Delegated to %1" ).arg( a->delegate() ) );
00474     else if ( !a->delegator().isEmpty() )
00475       mDelegateLabel->setText( i18n( "Delegated from %1" ).arg( a->delegator() ) );
00476     else
00477       mDelegateLabel->setText( i18n( "Not delegated" ) );
00478   }
00479   if( myself )
00480     mRsvpButton->setEnabled( false );
00481 
00482 }
00483 
00484 void KOAttendeeEditor::updateAttendeeInput()
00485 {
00486   setEnableAttendeeInput(!mNameEdit->text().isEmpty());
00487   Attendee* a = currentAttendee();
00488   if ( a ) {
00489     fillAttendeeInput( a );
00490   } else {
00491     clearAttendeeInput();
00492   }
00493 }
00494 
00495 void KOAttendeeEditor::cancelAttendeeEvent( KCal::Incidence *incidence )
00496 {
00497   incidence->clearAttendees();
00498 
00499   if ( mdelAttendees.isEmpty() ) {
00500     return;
00501   }
00502 
00503   Attendee *att;
00504   for ( att = mdelAttendees.first(); att; att = mdelAttendees.next() ) {
00505     bool isNewAttendee = false;
00506     if ( !mnewAttendees.isEmpty() ) {
00507       for ( Attendee *newAtt = mnewAttendees.first(); newAtt; newAtt = mnewAttendees.next() ) {
00508         if ( *att == *newAtt ) {
00509           isNewAttendee = true;
00510           break;
00511         }
00512       }
00513     }
00514     if ( !isNewAttendee ) {
00515       incidence->addAttendee( new Attendee( *att ) );
00516     }
00517   }
00518   mdelAttendees.clear();
00519 }
00520 
00521 void KOAttendeeEditor::acceptForMe()
00522 {
00523   changeStatusForMe( Attendee::Accepted );
00524 }
00525 
00526 void KOAttendeeEditor::declineForMe()
00527 {
00528   changeStatusForMe( Attendee::Declined );
00529 }
00530 
00531 bool KOAttendeeEditor::eventFilter(QObject *watched, QEvent *ev)
00532 {
00533   if ( watched && watched == mNameEdit && ev->type() == QEvent::FocusIn &&
00534        currentAttendee() == 0 ) {
00535     addNewAttendee();
00536   }
00537 
00538   return QWidget::eventFilter( watched, ev );
00539 }
00540 
00541 bool KOAttendeeEditor::isExampleAttendee( const KCal::Attendee* attendee ) const
00542 {
00543     if ( !attendee ) return false;
00544     if ( attendee->name() == i18n( "Firstname Lastname" )
00545         && attendee->email().endsWith( "example.net" ) ) {
00546         return true;
00547     }
00548     return false;
00549 }
00550 
00551 KABC::Addressee::List KOAttendeeEditor::expandDistList( const QString &text )  const
00552 {
00553   KABC::Addressee::List aList;
00554   KABC::AddressBook *abook = KABC::StdAddressBook::self( true );
00555 
00556 #ifdef KDEPIM_NEW_DISTRLISTS
00557   const QValueList<KPIM::DistributionList::Entry> eList =
00558     KPIM::DistributionList::findByName( abook, text ).entries( abook );
00559   QValueList<KPIM::DistributionList::Entry>::ConstIterator eit;
00560   for ( eit = eList.begin(); eit != eList.end(); ++eit ) {
00561     KABC::Addressee a = (*eit).addressee;
00562     if ( !a.preferredEmail().isEmpty() && aList.find( a ) == aList.end() ) {
00563       aList.append( a ) ;
00564     }
00565   }
00566 
00567 #else
00568   KABC::DistributionListManager manager( abook );
00569   manager.load();
00570   const QStringList dList = manager.listNames();
00571   for ( QStringList::ConstIterator it = dList.begin(); it != dList.end(); ++it ) {
00572     if ( (*it) == text ) {
00573       const QValueList<KABC::DistributionList::Entry> eList = manager.list( *it )->entries();
00574       QValueList<KABC::DistributionList::Entry>::ConstIterator eit;
00575       for ( eit = eList.begin(); eit != eList.end(); ++eit ) {
00576         KABC::Addressee a = (*eit).addressee;
00577         if ( !a.preferredEmail().isEmpty() && aList.find( a ) == aList.end() ) {
00578           aList.append( a ) ;
00579         }
00580       }
00581     }
00582   }
00583 #endif
00584   return aList;
00585 }
00586 
00587 
00588 #include "koattendeeeditor.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys