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          alarm->hasEndOffset() && alarm->endOffset().asSeconds() <= 0 ) {
00387       simple = true;
00388     }
00389   }
00390   return simple;
00391 }
00392 
00393 static QString etc = i18n( "elipsis", "..." );
00394 void KOEditorGeneral::updateAlarmWidgets( Incidence *incidence )
00395 {
00396   uint maxLen = 75; //TODO: compute from the font and dialog width
00397 
00398   if ( incidence ) {
00399     mAlarmButton->setChecked( incidence->isAlarmEnabled() );
00400   }
00401 
00402   if ( mAlarmList.isEmpty() ) {
00403     mAlarmIsSimple = true;
00404     mSimpleAlarmBox->show();
00405     bool on;
00406     const bool creatingNewIncidence = ( incidence == 0 );
00407     if ( mType == "Event" && creatingNewIncidence ) {
00408       on = KOPrefs::instance()->defaultEventReminders();
00409     } else if ( mType == "Todo" && creatingNewIncidence ) {
00410       on = KOPrefs::instance()->defaultTodoReminders();
00411     } else {
00412       on = false;
00413     }
00414     mAlarmButton->setChecked( on );
00415     mAlarmAdvancedButton->setEnabled( on );
00416   } else if ( mAlarmList.count() > 1 ) {
00417     mAlarmIsSimple = false;
00418     mAlarmAdvancedButton->setEnabled( true );
00419     mSimpleAlarmBox->hide();
00420     if ( incidence ) {
00421       QString remStr = IncidenceFormatter::reminderStringList( incidence ).join( ", " );
00422       if ( remStr.length() > maxLen ) {
00423         maxLen -= etc.length();
00424         remStr = remStr.left( maxLen );
00425         remStr += etc;
00426       }
00427       mAlarmInfoLabel->setText( i18n( "Triggers %1" ).arg( remStr ) );
00428     }
00429   } else {  // alarm count is 1
00430     Alarm *alarm = mAlarmList.first();
00431     if ( isSimpleAlarm( alarm ) ) {
00432       mAlarmIsSimple = true;
00433       mSimpleAlarmBox->show();
00434       int offset;
00435       if ( mType == "Event" ) {
00436         offset = alarm->startOffset().asSeconds();
00437         mAlarmInfoLabel->setText( i18n( "before the start" ) );
00438       }
00439       if ( mType == "Todo" ) {
00440         if ( alarm->hasStartOffset() ) {
00441           offset = alarm->startOffset().asSeconds();
00442           mAlarmInfoLabel->setText( i18n( "before the start" ) );
00443         } else {
00444           offset = alarm->endOffset().asSeconds();
00445           mAlarmInfoLabel->setText( i18n( "before the due time" ) );
00446         }
00447       }
00448       offset = offset / -60; // make minutes
00449       int useoffset = offset;
00450       if ( offset == 0 ) {
00451         mAlarmIncrCombo->setCurrentItem( 0 ); // use minute units for 0 offset
00452       } else if (offset % (24*60) == 0) { // divides evenly into days?
00453         useoffset = offset / (24*60);
00454         mAlarmIncrCombo->setCurrentItem(2);
00455       } else if (offset % 60 == 0) { // divides evenly into hours?
00456         useoffset = offset / 60;
00457         mAlarmIncrCombo->setCurrentItem(1);
00458       }
00459       mAlarmTimeEdit->setValue( useoffset );
00460     } else {
00461       mAlarmIsSimple = false;
00462       mAlarmAdvancedButton->setEnabled( true );
00463       mSimpleAlarmBox->hide();
00464       if ( incidence ) {
00465         QString remStr = IncidenceFormatter::reminderStringList( incidence ).first();
00466         mAlarmInfoLabel->setText( i18n( "Triggers %1" ).arg( remStr ) );
00467       }
00468     }
00469   }
00470 }
00471 
00472 void KOEditorGeneral::readIncidence( Incidence *incidence, Calendar *calendar )
00473 {
00474   mSummaryEdit->setText( incidence->summary() );
00475   mLocationEdit->setText( incidence->location() );
00476   mDescriptionEdit->setText( incidence->description() );
00477 
00478   mSecrecyCombo->setCurrentItem( incidence->secrecy() );
00479 
00480   // set up alarm stuff
00481   mAlarmList.clear();
00482   Alarm::List::ConstIterator it;
00483   Alarm::List alarms = incidence->alarms();
00484   for( it = alarms.begin(); it != alarms.end(); ++it ) {
00485     Alarm *al = new Alarm( *(*it) );
00486     al->setParent( 0 );
00487     mAlarmList.append( al );
00488   }
00489   updateDefaultAlarmTime();
00490   updateAlarmWidgets( incidence );
00491 
00492   setCategories( incidence->categories() );
00493 
00494   mAttachments->readIncidence( incidence );
00495 
00496   QString resLabel = IncidenceFormatter::resourceString( calendar, incidence );
00497   if ( !resLabel.isEmpty() ) {
00498     mResourceLabel->setText( i18n( "Calendar: %1" ).arg( resLabel ) );
00499     mResourceLabel->show();
00500   }
00501 }
00502 
00503 Alarm *KOEditorGeneral::alarmFromSimplePage( Incidence *incidence ) const
00504 {
00505   if ( mAlarmButton->isChecked() ) {
00506     Alarm *alarm = new Alarm( 0 );
00507     alarm->setDisplayAlarm( "" );
00508     alarm->setEnabled(true);
00509     QString tmpStr = mAlarmTimeEdit->text();
00510     int j = mAlarmTimeEdit->value() * -60;
00511     if ( mAlarmIncrCombo->currentItem() == 1 ) {
00512       j = j * 60;
00513     } else if ( mAlarmIncrCombo->currentItem() == 2 ) {
00514       j = j * (60 * 24);
00515     }
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() && !todo->hasDueDate() ) {
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   incidence->setSummary(mSummaryEdit->text());
00535   incidence->setLocation(mLocationEdit->text());
00536   incidence->setDescription(mDescriptionEdit->text());
00537   incidence->setCategories(mCategories);
00538   incidence->setSecrecy(mSecrecyCombo->currentItem());
00539 
00540   // alarm stuff
00541   incidence->clearAlarms();
00542   if ( mAlarmIsSimple ) {
00543     Alarm *al = alarmFromSimplePage( incidence );
00544     if ( al ) {
00545       al->setParent( incidence );
00546       al->setEnabled( mAlarmButton->isChecked() );
00547       incidence->addAlarm( al );
00548     }
00549   } else {
00550     // simply assign the list of alarms
00551     Alarm::List::ConstIterator it;
00552     for( it = mAlarmList.begin(); it != mAlarmList.end(); ++it ) {
00553       Alarm *al = new Alarm( *(*it) );
00554       al->setParent( incidence );
00555       al->setEnabled( mAlarmButton->isChecked() );
00556       incidence->addAlarm( al );
00557     }
00558   }
00559   mAttachments->writeIncidence( incidence );
00560 }
00561 
00562 void KOEditorGeneral::setSummary( const QString &text )
00563 {
00564   mSummaryEdit->setText( text );
00565 }
00566 
00567 void KOEditorGeneral::setDescription( const QString &text )
00568 {
00569   mDescriptionEdit->setText( text );
00570 }
00571 
00572 QObject *KOEditorGeneral::typeAheadReceiver() const
00573 {
00574   return mSummaryEdit;
00575 }
00576 
00577 void KOEditorGeneral::updateAttendeeSummary(int count)
00578 {
00579   if ( count <= 0 )
00580     mAttendeeSummaryLabel->setText( i18n("No attendees") );
00581   else
00582     mAttendeeSummaryLabel->setText( i18n( "One attendee", "%n attendees", count ) );
00583 }
KDE Home | KDE Accessibility Home | Description of Access Keys