korganizer

koeditorgeneral.cpp

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 
00025 
00026 #include <qwidget.h>
00027 #include <qtooltip.h>
00028 #include <qlayout.h>
00029 #include <qvbox.h>
00030 #include <qhbox.h>
00031 #include <qbuttongroup.h>
00032 #include <qvgroupbox.h>
00033 #include <qdatetime.h>
00034 #include <qlineedit.h>
00035 #include <qlabel.h>
00036 #include <qcheckbox.h>
00037 #include <qpushbutton.h>
00038 #include <qcombobox.h>
00039 #include <qspinbox.h>
00040 #include <qwhatsthis.h>
00041 
00042 #include <kglobal.h>
00043 #include <kdialog.h>
00044 #include <kdebug.h>
00045 #include <klocale.h>
00046 #include <kiconloader.h>
00047 #include <kmessagebox.h>
00048 #include <kfiledialog.h>
00049 #include <ksqueezedtextlabel.h>
00050 #include <kstandarddirs.h>
00051 #include <ktextedit.h>
00052 #include <krestrictedline.h>
00053 
00054 #include <libkcal/todo.h>
00055 #include <libkcal/event.h>
00056 #include <libkcal/incidenceformatter.h>
00057 
00058 #include <libkdepim/kdateedit.h>
00059 #include <libkdepim/categoryselectdialog.h>
00060 
00061 #include "koprefs.h"
00062 #include "koglobals.h"
00063 
00064 #include "koeditorgeneral.h"
00065 #include "koeditoralarms.h"
00066 #include "koeditorattachments.h"
00067 #include "koeditorgeneral.moc"
00068 #include "kohelper.h"
00069 
00070 KOEditorGeneral::KOEditorGeneral( QObject *parent, const char* name) :
00071   QObject( parent, name ), mAttachments(0)
00072 {
00073   mType = "Event";
00074   mAlarmList.setAutoDelete( true );
00075 }
00076 
00077 KOEditorGeneral::~KOEditorGeneral()
00078 {
00079 }
00080 
00081 
00082 FocusLineEdit::FocusLineEdit( QWidget *parent )
00083   : QLineEdit( parent ), mSkipFirst( true )
00084 {
00085 }
00086 
00087 void FocusLineEdit::focusInEvent ( QFocusEvent *e )
00088 {
00089   if ( !mSkipFirst ) {
00090     emit focusReceivedSignal();
00091   } else {
00092     mSkipFirst = false;
00093   }
00094   QLineEdit::focusInEvent( e );
00095 }
00096 
00097 
00098 void KOEditorGeneral::initHeader( QWidget *parent,QBoxLayout *topLayout)
00099 {
00100   QGridLayout *headerLayout = new QGridLayout();
00101   headerLayout->setSpacing( topLayout->spacing() );
00102   topLayout->addLayout( headerLayout );
00103 
00104   QString whatsThis = i18n("Sets the Title of this event or to-do.");
00105   QLabel *summaryLabel = new QLabel( i18n("T&itle:"), parent );
00106   QWhatsThis::add( summaryLabel, whatsThis );
00107   QFont f = summaryLabel->font();
00108   f.setBold( true );
00109   summaryLabel->setFont(f);
00110   headerLayout->addWidget(summaryLabel,1,0);
00111 
00112   mSummaryEdit = new FocusLineEdit( parent );
00113   QWhatsThis::add( mSummaryEdit, whatsThis );
00114   connect( mSummaryEdit, SIGNAL( focusReceivedSignal() ),
00115            SIGNAL( focusReceivedSignal() ) );
00116   headerLayout->addWidget(mSummaryEdit,1,1);
00117   summaryLabel->setBuddy( mSummaryEdit );
00118 
00119   mAttendeeSummaryLabel = new QLabel( parent );
00120   updateAttendeeSummary( 0 );
00121   headerLayout->addWidget( mAttendeeSummaryLabel, 1, 2 );
00122 
00123   whatsThis = i18n("Sets where the event or to-do will take place.");
00124   QLabel *locationLabel = new QLabel( i18n("&Location:"), parent );
00125   QWhatsThis::add( locationLabel, whatsThis );
00126   headerLayout->addWidget(locationLabel,2,0);
00127 
00128   mLocationEdit = new QLineEdit( parent );
00129   QWhatsThis::add( mLocationEdit, whatsThis );
00130   headerLayout->addMultiCellWidget( mLocationEdit, 2, 2, 1, 2 );
00131   locationLabel->setBuddy( mLocationEdit );
00132 
00133   QBoxLayout *thirdLineLayout = new QHBoxLayout();
00134   headerLayout->addMultiCellLayout( thirdLineLayout, 3, 3, 0, 2 );
00135 
00136   mResourceLabel = new QLabel( parent );
00137   mResourceLabel->hide();
00138   thirdLineLayout->addWidget( mResourceLabel );
00139 
00140   whatsThis = i18n("Allows you to select the categories that this event or to-do belongs to.");
00141   QLabel *categoriesLabel = new QLabel( i18n("Categories:"), parent );
00142   QWhatsThis::add( categoriesLabel, whatsThis );
00143   thirdLineLayout->addWidget( categoriesLabel );
00144   mCategoriesLabel = new KSqueezedTextLabel( parent );
00145   QWhatsThis::add( mCategoriesLabel, whatsThis );
00146   mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
00147   thirdLineLayout->addWidget( mCategoriesLabel );
00148 
00149   mCategoriesButton = new QPushButton( parent );
00150   mCategoriesButton->setText(i18n("&Select..."));
00151   QWhatsThis::add( mCategoriesButton, whatsThis );
00152   connect(mCategoriesButton,SIGNAL(clicked()),SLOT(selectCategories()));
00153   thirdLineLayout->addWidget( mCategoriesButton );
00154 }
00155 
00156 void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
00157 {
00158   QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
00159 
00160   QLabel *secrecyLabel = new QLabel(i18n("Acc&ess:"),parent);
00161   QString whatsThis = i18n("Sets whether the access to this event or to-do "
00162                "is restricted. Please note that KOrganizer "
00163                "currently does not use this setting, so the "
00164                "implementation of the restrictions will depend "
00165                "on the groupware server. This means that events "
00166                "or to-dos marked as private or confidential may "
00167                "be visible to others.");
00168   QWhatsThis::add( secrecyLabel, whatsThis );
00169   secrecyLayout->addWidget(secrecyLabel);
00170 
00171   mSecrecyCombo = new QComboBox(parent);
00172   QWhatsThis::add( mSecrecyCombo, whatsThis );
00173   mSecrecyCombo->insertStringList(Incidence::secrecyList());
00174   secrecyLayout->addWidget(mSecrecyCombo);
00175   secrecyLabel->setBuddy( mSecrecyCombo );
00176 }
00177 
00178 void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
00179 {
00180   mDescriptionEdit = new KTextEdit(parent);
00181   QWhatsThis::add( mDescriptionEdit,
00182            i18n("Sets the description for this event or to-do. This "
00183             "will be displayed in a reminder if one is set, "
00184             "as well as in a tooltip when you hover over the "
00185             "event.") );
00186   mDescriptionEdit->append("");
00187   mDescriptionEdit->setReadOnly(false);
00188   mDescriptionEdit->setOverwriteMode(false);
00189   mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
00190   mDescriptionEdit->setTabChangesFocus( true );;
00191   topLayout->addWidget(mDescriptionEdit, 4);
00192 }
00193 
00194 void KOEditorGeneral::initAlarm( QWidget *parent, QBoxLayout *topLayout )
00195 {
00196   QBoxLayout *alarmLayout = new QHBoxLayout( topLayout );
00197 
00198   mAlarmButton = new QCheckBox( parent );
00199   QWhatsThis::add( mAlarmButton, i18n( "Enable reminders for this event or to-do." ) );
00200   QToolTip::add( mAlarmButton, i18n( "Enable reminders" ) );
00201   alarmLayout->addWidget( mAlarmButton );
00202 
00203   mAlarmAdvancedButton = new QPushButton( parent );
00204   mAlarmAdvancedButton->setIconSet( KOGlobals::self()->smallIconSet( "bell", 16 ) );
00205   QWhatsThis::add( mAlarmAdvancedButton,
00206                    i18n( "Push this button to create an advanced set of reminders "
00207                          "for this event or to-do." ) );
00208   QToolTip::add( mAlarmAdvancedButton, i18n( "Set an advanced reminder" ) );
00209   connect( mAlarmAdvancedButton, SIGNAL(clicked()), SLOT(editAlarms()) );
00210   alarmLayout->addWidget( mAlarmAdvancedButton );
00211 
00212   mSimpleAlarmBox = new QHBox( parent );
00213   alarmLayout->addWidget( mSimpleAlarmBox );
00214 
00215   QString whatsThis, toolTip;
00216   if ( mType == "Event" ) {
00217     whatsThis = i18n( "Set the time before the event starts when the reminder will be triggered." );
00218     toolTip = i18n( "Set the start time trigger offset" );
00219   } else {
00220     whatsThis = i18n( "Set the time before the to-do is due when the reminder will be triggered." );
00221     toolTip = i18n( "Set the due time trigger offset" );
00222   }
00223   mAlarmTimeEdit = new QSpinBox( 0, 99999, 1, mSimpleAlarmBox, "alarmTimeEdit" );
00224   mAlarmTimeEdit->setValue( 0 );
00225   QWhatsThis::add( mAlarmTimeEdit, whatsThis );
00226   QToolTip::add( mAlarmTimeEdit, toolTip );
00227 
00228   mAlarmIncrCombo = new QComboBox( false, mSimpleAlarmBox );
00229   mAlarmIncrCombo->insertItem( i18n("minute(s)") );
00230   mAlarmIncrCombo->insertItem( i18n("hour(s)") );
00231   mAlarmIncrCombo->insertItem( i18n("day(s)") );
00232   QWhatsThis::add( mAlarmIncrCombo, whatsThis );
00233   QToolTip::add( mAlarmIncrCombo, toolTip );
00234 
00235   mAlarmInfoLabel = new QLabel( parent );
00236   if ( mType == "Event" ) {
00237     mAlarmInfoLabel->setText( i18n( "before the start" ) );
00238   } else {
00239     mAlarmInfoLabel->setText( i18n( "before the due time" ) );
00240   }
00241   alarmLayout->addWidget( mAlarmInfoLabel );
00242 
00243   mAlarmAdvancedButton->setEnabled( false );
00244   mAlarmTimeEdit->setEnabled( false );
00245   mAlarmIncrCombo->setEnabled( false );
00246   mAlarmInfoLabel->setEnabled( false );
00247   connect( mAlarmButton, SIGNAL(toggled(bool)), mAlarmAdvancedButton, SLOT(setEnabled(bool)) );
00248   connect( mAlarmButton, SIGNAL(toggled(bool)), mAlarmTimeEdit, SLOT(setEnabled(bool)) );
00249   connect( mAlarmButton, SIGNAL(toggled(bool)), mAlarmIncrCombo, SLOT(setEnabled(bool)) );
00250   connect( mAlarmButton, SIGNAL(toggled(bool)), mAlarmInfoLabel, SLOT(setEnabled(bool)) );
00251 }
00252 
00253 void KOEditorGeneral::initAttachments(QWidget *parent,QBoxLayout *topLayout)
00254 {
00255   mAttachments = new KOEditorAttachments( KDialog::spacingHint(), parent );
00256   connect( mAttachments, SIGNAL( openURL( const KURL & ) ) ,
00257            this, SIGNAL( openURL( const KURL & ) ) );
00258   topLayout->addWidget( mAttachments, 1 );
00259 }
00260 
00261 void KOEditorGeneral::setType( const QCString &type )
00262 {
00263   // must be "Event", "Todo", "Journal", etc.
00264   mType = type;
00265 }
00266 
00267 void KOEditorGeneral::addAttachments( const QStringList &attachments,
00268                                       const QStringList &mimeTypes,
00269                                       bool inlineAttachments )
00270 {
00271   QStringList::ConstIterator it;
00272   uint i = 0;
00273   for ( it = attachments.begin(); it != attachments.end(); ++it, ++i ) {
00274     if ( !(*it).isEmpty() ) {
00275       QString mimeType;
00276       if ( mimeTypes.count() > i ) {
00277         mimeType = mimeTypes[ i ];
00278       }
00279       mAttachments->addUriAttachment( *it, mimeType, QString(), inlineAttachments );
00280     }
00281   }
00282 }
00283 
00284 void KOEditorGeneral::selectCategories()
00285 {
00286   KPIM::CategorySelectDialog *categoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), mCategoriesButton    );
00287   KOGlobals::fitDialogToScreen( categoryDialog );
00288   categoryDialog->setSelected( mCategories );
00289 
00290   connect(categoryDialog, SIGNAL(editCategories()), this, SIGNAL(openCategoryDialog()));
00291   connect(this, SIGNAL(updateCategoryConfig()), categoryDialog, SLOT(updateCategoryConfig()));
00292 
00293   if ( categoryDialog->exec() ) {
00294     setCategories( categoryDialog->selectedCategories() );
00295   }
00296   delete categoryDialog;
00297 }
00298 
00299 
00300 void KOEditorGeneral::editAlarms()
00301 {
00302   if ( mAlarmIsSimple ) {
00303     mAlarmList.clear();
00304     Alarm *al = alarmFromSimplePage( 0 );
00305     if ( al ) {
00306       mAlarmList.append( al );
00307     }
00308   }
00309 
00310   KOEditorAlarms *dlg = new KOEditorAlarms( mType, &mAlarmList, mAlarmAdvancedButton );
00311   if ( dlg->exec() != KDialogBase::Cancel ) {
00312     if ( mType == "Event" ) {
00313       Event *e = new Event;
00314       Alarm::List::ConstIterator it;
00315       for( it = mAlarmList.begin(); it != mAlarmList.end(); ++it ) {
00316         Alarm *a = (*it)->clone();
00317         a->setParent( e );
00318         e->addAlarm( a );
00319       }
00320       updateAlarmWidgets( e );
00321       delete e;
00322     } else {
00323       Todo *t = new Todo;
00324       Alarm::List::ConstIterator it;
00325       for( it = mAlarmList.begin(); it != mAlarmList.end(); ++it ) {
00326         Alarm *a = (*it)->clone();
00327         a->setParent( t );
00328         t->addAlarm( a );
00329       }
00330       updateAlarmWidgets( t );
00331       delete t;
00332     }
00333   }
00334 }
00335 
00336 void KOEditorGeneral::enableAlarm( bool enable )
00337 {
00338   mAlarmAdvancedButton->setEnabled( enable );
00339 }
00340 
00341 void KOEditorGeneral::toggleAlarm( bool on )
00342 {
00343   mAlarmButton->setChecked( on );
00344 }
00345 
00346 void KOEditorGeneral::setCategories( const QStringList &categories )
00347 {
00348   mCategoriesLabel->setText( categories.join(",") );
00349   mCategories = categories;
00350 }
00351 
00352 void KOEditorGeneral::setDefaults(bool /*allDay*/)
00353 {
00354   mAlarmList.clear();
00355   updateDefaultAlarmTime();
00356   updateAlarmWidgets( 0 );
00357 
00358   mSecrecyCombo->setCurrentItem( Incidence::SecrecyPublic );
00359   mAttachments->setDefaults();
00360 }
00361 
00362 void KOEditorGeneral::updateDefaultAlarmTime()
00363 {
00364   int reminderTime = KOPrefs::instance()->mReminderTime;
00365   int index = KOPrefs::instance()->mReminderTimeUnits;
00366   if ( index < 0 || index > 2 ) {
00367     index = 0;
00368   }
00369   mAlarmTimeEdit->setValue( reminderTime );
00370   mAlarmIncrCombo->setCurrentItem( index );
00371 }
00372 
00373 bool KOEditorGeneral::isSimpleAlarm( Alarm *alarm ) const
00374 {
00375   // Check if its the trivial type of alarm, which can be
00376   // configured with a simply spin box...
00377 
00378   bool simple = false;
00379   if ( alarm->type() == Alarm::Display && alarm->text().isEmpty() &&
00380        alarm->repeatCount() == 0 && !alarm->hasTime() ) {
00381     if ( mType == "Event" &&
00382          alarm->hasStartOffset() && alarm->startOffset().asSeconds() <= 0 ) {
00383       simple = true;
00384     }
00385     if ( mType == "Todo" ) {
00386       if ( ( alarm->hasStartOffset() && alarm->startOffset().asSeconds() <= 0 ) ||
00387            ( alarm->hasEndOffset() && alarm->endOffset().asSeconds() <= 0 ) ) {
00388         simple = true;
00389       }
00390     }
00391   }
00392   return simple;
00393 }
00394 
00395 static QString etc = i18n( "elipsis", "..." );
00396 void KOEditorGeneral::updateAlarmWidgets( Incidence *incidence )
00397 {
00398   int maxLen = 75; //TODO: compute from the font and dialog width
00399 
00400   if ( incidence ) {
00401     mAlarmButton->setChecked( incidence->isAlarmEnabled() );
00402   }
00403 
00404   if ( mAlarmList.isEmpty() ) {
00405     mAlarmIsSimple = true;
00406     mSimpleAlarmBox->show();
00407     bool on;
00408     if ( mType == "Event" ) {
00409       on = KOPrefs::instance()->defaultEventReminders();
00410     } else if ( mType == "Todo" ) {
00411       on = KOPrefs::instance()->defaultTodoReminders();
00412     } else {
00413       on = false;
00414     }
00415     mAlarmButton->setChecked( on );
00416     mAlarmAdvancedButton->setEnabled( on );
00417   } else if ( mAlarmList.count() > 1 ) {
00418     mAlarmIsSimple = false;
00419     mAlarmAdvancedButton->setEnabled( true );
00420     mSimpleAlarmBox->hide();
00421     if ( incidence ) {
00422       QString remStr = IncidenceFormatter::reminderStringList( incidence ).join( ", " );
00423       if ( remStr.length() > maxLen ) {
00424         maxLen -= etc.length();
00425         remStr = remStr.left( maxLen );
00426         remStr += etc;
00427       }
00428       mAlarmInfoLabel->setText( i18n( "Triggers %1" ).arg( remStr ) );
00429     }
00430   } else {  // alarm count is 1
00431     Alarm *alarm = mAlarmList.first();
00432     if ( isSimpleAlarm( alarm ) ) {
00433       mAlarmIsSimple = true;
00434       mSimpleAlarmBox->show();
00435       int offset;
00436       if ( mType == "Event" ) {
00437         offset = alarm->startOffset().asSeconds();
00438         mAlarmInfoLabel->setText( i18n( "before the start" ) );
00439       }
00440       if ( mType == "Todo" ) {
00441         if ( alarm->hasStartOffset() ) {
00442           offset = alarm->startOffset().asSeconds();
00443           mAlarmInfoLabel->setText( i18n( "before the start" ) );
00444         } else {
00445           offset = alarm->endOffset().asSeconds();
00446           mAlarmInfoLabel->setText( i18n( "before the due time" ) );
00447         }
00448       }
00449       offset = offset / -60; // make minutes
00450       int useoffset = offset;
00451       if ( offset == 0 ) {
00452         mAlarmIncrCombo->setCurrentItem( 0 ); // use minute units for 0 offset
00453       } else if (offset % (24*60) == 0) { // divides evenly into days?
00454         useoffset = offset / (24*60);
00455         mAlarmIncrCombo->setCurrentItem(2);
00456       } else if (offset % 60 == 0) { // divides evenly into hours?
00457         useoffset = offset / 60;
00458         mAlarmIncrCombo->setCurrentItem(1);
00459       }
00460       mAlarmTimeEdit->setValue( useoffset );
00461     } else {
00462       mAlarmIsSimple = false;
00463       mAlarmAdvancedButton->setEnabled( true );
00464       mSimpleAlarmBox->hide();
00465       if ( incidence ) {
00466         QString remStr = IncidenceFormatter::reminderStringList( incidence ).first();
00467         mAlarmInfoLabel->setText( i18n( "Triggers %1" ).arg( remStr ) );
00468       }
00469     }
00470   }
00471 }
00472 
00473 void KOEditorGeneral::readIncidence( Incidence *incidence, Calendar *calendar )
00474 {
00475   mSummaryEdit->setText( incidence->summary() );
00476   mLocationEdit->setText( incidence->location() );
00477   mDescriptionEdit->setText( incidence->description() );
00478 
00479   mSecrecyCombo->setCurrentItem( incidence->secrecy() );
00480 
00481   // set up alarm stuff
00482   mAlarmList.clear();
00483   Alarm::List::ConstIterator it;
00484   Alarm::List alarms = incidence->alarms();
00485   for( it = alarms.begin(); it != alarms.end(); ++it ) {
00486     Alarm *al = new Alarm( *(*it) );
00487     al->setParent( 0 );
00488     mAlarmList.append( al );
00489   }
00490   updateDefaultAlarmTime();
00491   updateAlarmWidgets( incidence );
00492 
00493   setCategories( incidence->categories() );
00494 
00495   mAttachments->readIncidence( incidence );
00496 
00497   QString resLabel = IncidenceFormatter::resourceString( calendar, incidence );
00498   if ( !resLabel.isEmpty() ) {
00499     mResourceLabel->setText( i18n( "Calendar: %1" ).arg( resLabel ) );
00500     mResourceLabel->show();
00501   }
00502 }
00503 
00504 Alarm *KOEditorGeneral::alarmFromSimplePage( Incidence *incidence ) const
00505 {
00506   if ( mAlarmButton->isChecked() ) {
00507     Alarm *alarm = new Alarm( 0 );
00508     alarm->setDisplayAlarm("");
00509     alarm->setEnabled(true);
00510     QString tmpStr = mAlarmTimeEdit->text();
00511     int j = mAlarmTimeEdit->value() * -60;
00512     if (mAlarmIncrCombo->currentItem() == 1)
00513       j = j * 60;
00514     else if (mAlarmIncrCombo->currentItem() == 2)
00515       j = j * (60 * 24);
00516     if ( mType == "Event" ) {
00517       alarm->setStartOffset( j );
00518     }
00519     if ( mType == "Todo" ) {
00520       Todo *todo = static_cast<Todo *>( incidence );
00521       if ( todo && todo->hasStartDate() ) {
00522         alarm->setStartOffset( j );
00523       } else {
00524         alarm->setEndOffset( j );
00525       }
00526     }
00527     return alarm;
00528   } else {
00529     return 0;
00530   }
00531 }
00532 void KOEditorGeneral::writeIncidence( Incidence *incidence )
00533 {
00534 //  kdDebug(5850) << "KOEditorGeneral::writeIncidence()" << endl;
00535 
00536   incidence->setSummary(mSummaryEdit->text());
00537   incidence->setLocation(mLocationEdit->text());
00538   incidence->setDescription(mDescriptionEdit->text());
00539   incidence->setCategories(mCategories);
00540   incidence->setSecrecy(mSecrecyCombo->currentItem());
00541 
00542   // alarm stuff
00543   incidence->clearAlarms();
00544   if ( mAlarmIsSimple ) {
00545     Alarm *al = alarmFromSimplePage( incidence );
00546     if ( al ) {
00547       al->setParent( incidence );
00548       al->setEnabled( mAlarmButton->isChecked() );
00549       incidence->addAlarm( al );
00550     }
00551   } else {
00552     // simply assign the list of alarms
00553     Alarm::List::ConstIterator it;
00554     for( it = mAlarmList.begin(); it != mAlarmList.end(); ++it ) {
00555       Alarm *al = new Alarm( *(*it) );
00556       al->setParent( incidence );
00557       al->setEnabled( mAlarmButton->isChecked() );
00558       incidence->addAlarm( al );
00559     }
00560   }
00561   mAttachments->writeIncidence( incidence );
00562 }
00563 
00564 void KOEditorGeneral::setSummary( const QString &text )
00565 {
00566   mSummaryEdit->setText( text );
00567 }
00568 
00569 void KOEditorGeneral::setDescription( const QString &text )
00570 {
00571   mDescriptionEdit->setText( text );
00572 }
00573 
00574 QObject *KOEditorGeneral::typeAheadReceiver() const
00575 {
00576   return mSummaryEdit;
00577 }
00578 
00579 void KOEditorGeneral::updateAttendeeSummary(int count)
00580 {
00581   if ( count <= 0 )
00582     mAttendeeSummaryLabel->setText( i18n("No attendees") );
00583   else
00584     mAttendeeSummaryLabel->setText( i18n( "One attendee", "%n attendees", count ) );
00585 }
KDE Home | KDE Accessibility Home | Description of Access Keys