summaryrefslogtreecommitdiffstats
path: root/korganizer
diff options
context:
space:
mode:
Diffstat (limited to 'korganizer')
-rw-r--r--korganizer/aboutdata.cpp4
-rw-r--r--korganizer/actionmanager.cpp2
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/freebusymanager.cpp99
-rw-r--r--korganizer/koagenda.cpp7
-rw-r--r--korganizer/koagendaview.cpp7
-rw-r--r--korganizer/koeditorgeneral.cpp7
-rw-r--r--korganizer/kogroupwareprefspage.ui8
-rw-r--r--korganizer/koprefs.cpp8
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp13
-rw-r--r--korganizer/resourceview.cpp4
-rw-r--r--korganizer/timelabels.cpp5
13 files changed, 119 insertions, 48 deletions
diff --git a/korganizer/aboutdata.cpp b/korganizer/aboutdata.cpp
index d2a5de359..f372d11fc 100644
--- a/korganizer/aboutdata.cpp
+++ b/korganizer/aboutdata.cpp
@@ -37,7 +37,9 @@ AboutData::AboutData()
"(c) 2004-2005 Reinhold Kainhofer", 0,
"http://korganizer.kde.org" )
{
- addAuthor("Reinhold Kainhofer",I18N_NOOP("Current Maintainer"),
+ addAuthor("Timothy Pearson",I18N_NOOP("Current Maintainer"),
+ addAuthor("Reinhold Kainhofer",I18N_NOOP("Previous maintainer"),
addAuthor("Cornelius Schumacher",I18N_NOOP("Co-Maintainer"),
diff --git a/korganizer/actionmanager.cpp b/korganizer/actionmanager.cpp
index 4a900abd3..ce608165e 100644
--- a/korganizer/actionmanager.cpp
+++ b/korganizer/actionmanager.cpp
@@ -197,7 +197,7 @@ void ActionManager::createCalendarResources()
mResourceView = factory.resourceView();
connect( mCalendarResources, SIGNAL( calendarChanged() ),
- mCalendarView, SLOT( slotCalendarChanged() ) );
+ mCalendarView, SLOT(resourcesChanged() ) );
connect( mCalendarResources, SIGNAL( signalErrorMessage( const QString & ) ),
mCalendarView, SLOT( showErrorMessage( const QString & ) ) );
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 75e7ee434..6a91254e5 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2159,8 +2159,6 @@ void CalendarView::purgeCompleted()
void CalendarView::slotCalendarChanged()
{
kdDebug(5850) << "CalendarView::slotCalendarChanged()" << endl;
-
- updateView();
}
void CalendarView::warningChangeFailed( Incidence * )
diff --git a/korganizer/freebusymanager.cpp b/korganizer/freebusymanager.cpp
index 94fe320cf..fdb4f531b 100644
--- a/korganizer/freebusymanager.cpp
+++ b/korganizer/freebusymanager.cpp
@@ -66,6 +66,8 @@
#include <qregexp.h>
#include <qdir.h>
+#define DEBUG_5850 kdDebug(5850)
+
using namespace KCal;
FreeBusyDownloadJob::FreeBusyDownloadJob( const QString &email, const KURL &url,
@@ -96,10 +98,10 @@ void FreeBusyDownloadJob::slotData( KIO::Job *, const QByteArray &data )
void FreeBusyDownloadJob::slotResult( KIO::Job *job )
{
- kdDebug(5850) << "FreeBusyDownloadJob::slotResult() " << mEmail << endl;
+ DEBUG_5850 << "FreeBusyDownloadJob::slotResult() " << mEmail << endl;
if( job->error() ) {
- kdDebug(5850) << "FreeBusyDownloadJob::slotResult() job error for " << mEmail << endl;
+ DEBUG_5850 << "FreeBusyDownloadJob::slotResult() job error for " << mEmail << endl;
emit freeBusyDownloadError( mEmail );
} else {
FreeBusy *fb = mManager->iCalToFreeBusy( mFreeBusyData );
@@ -189,7 +191,7 @@ void FreeBusyManager::slotPerhapsUploadFB()
} else {
// We are currently uploading the FB list. Start the timer
if( eta <= 0 ) {
- kdDebug(5850) << "This shouldn't happen! eta <= 0\n";
+ DEBUG_5850 << "This shouldn't happen! eta <= 0\n";
eta = 10; // whatever
}
}
@@ -241,6 +243,16 @@ void FreeBusyManager::publishFreeBusy()
mBrokenUrl = true;
return;
}
+
+// // Substitute %u and %d [FIXME]
+// QString defaultEmail = KOCore()::self()->email();
+// int emailpos = defaultEmail.find( '@' );
+// if (emailpos != -1) {
+// const QString emailName = defaultEmail.left( emailpos );
+// const QString emailHost = defaultEmail.mid( emailpos + 1 );
+// targetURL = targetURL.url().replace("%25u", emailName, true);
+// targetURL = targetURL.url().replace("%25d", emailHost, true);
+// }
targetURL.setUser( KOPrefs::instance()->mFreeBusyPublishUser );
targetURL.setPass( KOPrefs::instance()->mFreeBusyPublishPassword );
@@ -311,7 +323,7 @@ void FreeBusyManager::publishFreeBusy()
KURL src;
src.setPath( tempFile.name() );
- kdDebug(5850) << "FreeBusyManager::publishFreeBusy(): " << targetURL << endl;
+ DEBUG_5850 << "FreeBusyManager::publishFreeBusy(): " << targetURL << endl;
KIO::Job * job = KIO::file_copy( src, targetURL, -1,
true /*overwrite*/,
@@ -343,7 +355,7 @@ void FreeBusyManager::slotUploadFreeBusyResult(KIO::Job *_job)
bool FreeBusyManager::retrieveFreeBusy( const QString &email, bool forceDownload )
{
- kdDebug(5850) << "FreeBusyManager::retrieveFreeBusy(): " << email << endl;
+ DEBUG_5850 << "FreeBusyManager::retrieveFreeBusy(): " << email << endl;
if ( email.isEmpty() ) return false;
// Check for cached copy of free/busy list
@@ -374,11 +386,11 @@ bool FreeBusyManager::processRetrieveQueue()
KURL sourceURL = freeBusyUrl( email );
- kdDebug(5850) << "FreeBusyManager::processRetrieveQueue(): url: " << sourceURL
+ DEBUG_5850 << "FreeBusyManager::processRetrieveQueue(): url: " << sourceURL
<< endl;
if ( !sourceURL.isValid() ) {
- kdDebug(5850) << "Invalid FB URL\n";
+ DEBUG_5850 << "Invalid FB URL\n";
slotFreeBusyDownloadError( email );
return false;
}
@@ -406,7 +418,7 @@ void FreeBusyManager::slotFreeBusyDownloadError( const QString& email )
// The reason we try to download even our own free-busy list is that
// this allows to avoid showing as busy the folders that are "fb relevant for nobody"
// like shared resources (meeting rooms etc.)
- kdDebug(5850) << "freebusy of owner, falling back to local list" << endl;
+ DEBUG_5850 << "freebusy of owner, falling back to local list" << endl;
emit freeBusyRetrieved( ownerFreeBusy(), email );
}
@@ -419,7 +431,7 @@ void FreeBusyManager::cancelRetrieval()
KURL FreeBusyManager::freeBusyUrl( const QString &email )
{
- kdDebug(5850) << "FreeBusyManager::freeBusyUrl(): " << email << endl;
+ DEBUG_5850 << "FreeBusyManager::freeBusyUrl(): " << email << endl;
// First check if there is a specific FB url for this email
QString configFile = locateLocal( "data", "korganizer/freebusyurls" );
@@ -428,7 +440,7 @@ KURL FreeBusyManager::freeBusyUrl( const QString &email )
cfg.setGroup( email );
QString url = cfg.readEntry( "url" );
if ( !url.isEmpty() ) {
- kdDebug(5850) << "found cached url: " << url << endl;
+ DEBUG_5850 << "found cached url: " << url << endl;
return KURL( url );
}
// Try with the url configurated by preferred email in kaddressbook
@@ -459,8 +471,9 @@ KURL FreeBusyManager::freeBusyUrl( const QString &email )
// Sanity check: Don't download if it's not a correct email
// address (this also avoids downloading for "(empty email)").
int emailpos = email.find( '@' );
- if( emailpos == -1 )
+ if( emailpos == -1 ) {
return KURL();
+ }
// Cut off everything left of the @ sign to get the user name.
const QString emailName = email.left( emailpos );
@@ -477,35 +490,51 @@ KURL FreeBusyManager::freeBusyUrl( const QString &email )
if ( hostDomain != emailHost && !hostDomain.endsWith( '.' + emailHost )
&& !emailHost.endsWith( '.' + hostDomain ) ) {
// Host names do not match
- kdDebug(5850) << "Host '" << sourceURL.host() << "' doesn't match email '"
+ DEBUG_5850 << "Host '" << sourceURL.host() << "' doesn't match email '"
<< email << '\'' << endl;
return KURL();
}
}
- kdDebug(5850) << "Server FreeBusy url: " << sourceURL << endl;
- if ( KOPrefs::instance()->mFreeBusyFullDomainRetrieval )
- sourceURL.setFileName( email + ".ifb" );
- else
- sourceURL.setFileName( emailName + ".ifb" );
- sourceURL.setUser( KOPrefs::instance()->mFreeBusyRetrieveUser );
- sourceURL.setPass( KOPrefs::instance()->mFreeBusyRetrievePassword );
-
- kdDebug(5850) << "Results in generated: " << sourceURL << endl;
- return sourceURL;
+ // This should work with anything thrown at it, not just Kolab
+ // Notice that Kolab URLs are just entered as the base address, e.g. http://server.com/mykolab/
+ // This means that if the trailing slash is not entered, we can treat this as a custom, non-Kolab URL!
+ // In that case, just pass it on through with substitution for %u and %d
+ // TODO: May want an explicit configuration option in kogroupwareprefspage.ui for this
+ if ((sourceURL.url().endsWith("/", true) == false) || (sourceURL.url().contains("%25u", true)) || (sourceURL.url().contains("%25d", true))) {
+ // A generic URL, substitute %u and %d
+ sourceURL = sourceURL.url().replace("%25u", emailName, true);
+ sourceURL = sourceURL.url().replace("%25d", emailHost, true);
+ sourceURL.setUser( KOPrefs::instance()->mFreeBusyRetrieveUser );
+ sourceURL.setPass( KOPrefs::instance()->mFreeBusyRetrievePassword );
+ return sourceURL;
+ }
+ else {
+ // This is (probably) a Kolab URL!
+ DEBUG_5850 << "Server FreeBusy url: " << sourceURL << endl;
+ if ( KOPrefs::instance()->mFreeBusyFullDomainRetrieval )
+ sourceURL.setFileName( email + ".ifb" );
+ else
+ sourceURL.setFileName( emailName + ".ifb" );
+ sourceURL.setUser( KOPrefs::instance()->mFreeBusyRetrieveUser );
+ sourceURL.setPass( KOPrefs::instance()->mFreeBusyRetrievePassword );
+
+ DEBUG_5850 << "Results in generated: " << sourceURL << endl;
+ return sourceURL;
+ }
}
KCal::FreeBusy *FreeBusyManager::iCalToFreeBusy( const QCString &data )
{
- kdDebug(5850) << "FreeBusyManager::iCalToFreeBusy()" << endl;
- kdDebug(5850) << data << endl;
+ DEBUG_5850 << "FreeBusyManager::iCalToFreeBusy()" << endl;
+ DEBUG_5850 << data << endl;
QString freeBusyVCal = QString::fromUtf8( data );
KCal::FreeBusy *fb = mFormat.parseFreeBusy( freeBusyVCal );
if ( !fb ) {
- kdDebug(5850) << "FreeBusyManager::iCalToFreeBusy(): Error parsing free/busy"
+ DEBUG_5850 << "FreeBusyManager::iCalToFreeBusy(): Error parsing free/busy"
<< endl;
- kdDebug(5850) << freeBusyVCal << endl;
+ DEBUG_5850 << freeBusyVCal << endl;
}
return fb;
}
@@ -517,19 +546,19 @@ QString FreeBusyManager::freeBusyDir()
FreeBusy *FreeBusyManager::loadFreeBusy( const QString &email )
{
- kdDebug(5850) << "FreeBusyManager::loadFreeBusy(): " << email << endl;
+ DEBUG_5850 << "FreeBusyManager::loadFreeBusy(): " << email << endl;
QString fbd = freeBusyDir();
QFile f( fbd + "/" + email + ".ifb" );
if ( !f.exists() ) {
- kdDebug(5850) << "FreeBusyManager::loadFreeBusy() " << f.name()
+ DEBUG_5850 << "FreeBusyManager::loadFreeBusy() " << f.name()
<< " doesn't exist." << endl;
return 0;
}
if ( !f.open( IO_ReadOnly ) ) {
- kdDebug(5850) << "FreeBusyManager::loadFreeBusy() Unable to open file "
+ DEBUG_5850 << "FreeBusyManager::loadFreeBusy() Unable to open file "
<< f.name() << endl;
return 0;
}
@@ -542,17 +571,17 @@ FreeBusy *FreeBusyManager::loadFreeBusy( const QString &email )
bool FreeBusyManager::saveFreeBusy( FreeBusy *freebusy, const Person &person )
{
- kdDebug(5850) << "FreeBusyManager::saveFreeBusy(): " << person.fullName() << endl;
+ DEBUG_5850 << "FreeBusyManager::saveFreeBusy(): " << person.fullName() << endl;
QString fbd = freeBusyDir();
QDir freeBusyDirectory( fbd );
if ( !freeBusyDirectory.exists() ) {
- kdDebug(5850) << "Directory " << fbd << " does not exist!" << endl;
- kdDebug(5850) << "Creating directory: " << fbd << endl;
+ DEBUG_5850 << "Directory " << fbd << " does not exist!" << endl;
+ DEBUG_5850 << "Creating directory: " << fbd << endl;
if( !freeBusyDirectory.mkdir( fbd, true ) ) {
- kdDebug(5850) << "Could not create directory: " << fbd << endl;
+ DEBUG_5850 << "Could not create directory: " << fbd << endl;
return false;
}
}
@@ -563,7 +592,7 @@ bool FreeBusyManager::saveFreeBusy( FreeBusy *freebusy, const Person &person )
filename += ".ifb";
QFile f( filename );
- kdDebug(5850) << "FreeBusyManager::saveFreeBusy(): filename: " << filename
+ DEBUG_5850 << "FreeBusyManager::saveFreeBusy(): filename: " << filename
<< endl;
freebusy->clearAttendees();
@@ -573,7 +602,7 @@ bool FreeBusyManager::saveFreeBusy( FreeBusy *freebusy, const Person &person )
Scheduler::Publish );
if ( !f.open( IO_ReadWrite ) ) {
- kdDebug(5850) << "acceptFreeBusy: Can't open:" << filename << " for writing"
+ DEBUG_5850 << "acceptFreeBusy: Can't open:" << filename << " for writing"
<< endl;
return false;
}
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index b63f13030..953bb606a 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1913,9 +1913,10 @@ void KOAgenda::selectItem(KOAgendaItem *item)
}
mSelectedItem = item;
mSelectedItem->select();
- assert( mSelectedItem->incidence() );
- mSelectedUid = mSelectedItem->incidence()->uid();
- emit incidenceSelected( mSelectedItem->incidence() );
+ Incidence *incidence = mSelectedItem->incidence();
+ assert( incidence );
+ mSelectedUid = incidence->uid();
+ emit incidenceSelected( incidence );
}
void KOAgenda::selectItemByUID( const QString& uid )
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index a526760e5..e81e04850 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -368,6 +368,13 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name, bool
if ( cal )
cal->registerObserver( this );
+
+ CalendarResources *calres = dynamic_cast<CalendarResources*>( cal );
+ if ( calres ) {
+ connect( calres, SIGNAL(signalResourceAdded(ResourceCalendar *)), SLOT(resourcesChanged()) );
+ connect( calres, SIGNAL(signalResourceModified( ResourceCalendar *)), SLOT(resourcesChanged()) );
+ connect( calres, SIGNAL(signalResourceDeleted(ResourceCalendar *)), SLOT(resourcesChanged()) );
+ }
}
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 8b93c2ef0..3a9c20071 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -349,7 +349,12 @@ void KOEditorGeneral::updateAlarmWidgets()
{
if ( mAlarmList.isEmpty() ) {
mAlarmStack->raiseWidget( SimpleAlarmPage );
- mAlarmButton->setChecked( false );
+ if (KOPrefs::instance()->mAlarmsEnabledByDefault == true) {
+ mAlarmButton->setChecked( true );
+ }
+ else {
+ mAlarmButton->setChecked( false );
+ }
mAlarmEditButton->setEnabled( false );
} else if ( mAlarmList.count() > 1 ) {
mAlarmStack->raiseWidget( AdvancedAlarmLabel );
diff --git a/korganizer/kogroupwareprefspage.ui b/korganizer/kogroupwareprefspage.ui
index 2efe88af6..d6f14f9ad 100644
--- a/korganizer/kogroupwareprefspage.ui
+++ b/korganizer/kogroupwareprefspage.ui
@@ -385,7 +385,9 @@ Here is a Kolab2 server URL example: "webdavs://kolab2.com/freebusy/[email protected]
<property name="whatsThis" stdset="0">
<string>Enter the URL for the server on which the Free/Busy information is published here.
Ask the server administrator for this information.
-Here is a Kolab2 server URL example: "webdavs://kolab2.com/freebusy/"</string>
+Here is a Kolab2 server URL example: "webdavs://kolab2.com/freebusy/"
+Here is a generic server example: "http://myserver.net/%u@%d/?internal.ics"
+%u expands to the username, and %d expands to the domain name.</string>
</property>
</widget>
<widget class="QLineEdit">
@@ -398,7 +400,9 @@ Here is a Kolab2 server URL example: "webdavs://kolab2.com/freebusy/"</string>
<property name="whatsThis" stdset="0">
<string>Enter the URL for the server on which the Free/Busy information is published here.
Ask the server administrator for this information.
-Here is a Kolab2 server URL example: "webdavs://kolab2.com/freebusy/"</string>
+Here is a Kolab2 server URL example: "webdavs://kolab2.com/freebusy/"
+Here is a generic server example: "http://myserver.net/%u@%d/?internal.ics"
+%u expands to the username, and %d expands to the domain name.</string>
</property>
</widget>
</hbox>
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index a44aaf6e8..3e4d78dda 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -92,6 +92,8 @@ KOPrefs::KOPrefs() :
// Load it now, not deep within some painting code
mMyAddrBookMails = KABC::StdAddressBook::self()->whoAmI().emails();
+
+ mAlarmsEnabledByDefault = false;
}
@@ -211,6 +213,9 @@ void KOPrefs::usrReadConfig()
setTimeZoneIdDefault();
}
+ config()->setGroup("Event Dialogs");
+ mAlarmsEnabledByDefault = config()->readBoolEntry( "Alarm Enabled By Default" );
+
#if 0
config()->setGroup("FreeBusy");
if( mRememberRetrievePw )
@@ -251,6 +256,9 @@ void KOPrefs::usrWriteConfig()
i->writeConfig( config() );
}
+ config()->setGroup("Event Dialogs");
+ config()->writeEntry( "Alarm Enabled By Default", mAlarmsEnabledByDefault );
+
#if 0
if( mRememberRetrievePw )
config()->writeEntry( "Retrieve Server Password", KStringHandler::obscure( mRetrievePassword ) );
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index d341183ed..dc7a62d18 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -91,6 +91,7 @@ class KDE_EXPORT KOPrefs : public KOPrefsBase
QColor* resourceColor( const QString & );
QString mHtmlExportFile;
+ bool mAlarmsEnabledByDefault;
// Groupware passwords
QString mPublishPassword;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 99045c309..fd9fd8246 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -331,11 +331,17 @@ class KOPrefsDialogTime : public KPrefsModule
mAlarmTimeCombo->insertStringList( alarmList );
topLayout->addWidget( mAlarmTimeCombo, 5, 1 );
+ QLabel *alarmDefaultLabel = new QLabel( i18n( "Enable reminders by default:" ), topFrame);
+ topLayout->addWidget( alarmDefaultLabel, 6, 0 );
+ mAlarmTimeDefaultCheckBox = new QCheckBox( topFrame );
+ topLayout->addWidget( mAlarmTimeDefaultCheckBox, 6, 1 );
+ connect( mAlarmTimeDefaultCheckBox, SIGNAL( toggled( bool ) ),
+ SLOT( slotWidChanged() ) );
QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
i18n("Working Hours"),
topFrame);
- topLayout->addMultiCellWidget( workingHoursGroup, 6, 6, 0, 1 );
+ topLayout->addMultiCellWidget( workingHoursGroup, 7, 7, 0, 1 );
QHBox *workDaysBox = new QHBox( workingHoursGroup );
// Respect start of week setting
@@ -369,7 +375,7 @@ class KOPrefsDialogTime : public KPrefsModule
addWidBool( KOPrefs::instance()->excludeHolidaysItem(),
workingHoursGroup );
- topLayout->setRowStretch(7,1);
+ topLayout->setRowStretch(8,1);
load();
}
@@ -381,6 +387,7 @@ class KOPrefsDialogTime : public KPrefsModule
i18n( KOPrefs::instance()->mTimeZoneId.utf8() ) );
mAlarmTimeCombo->setCurrentItem( KOPrefs::instance()->mAlarmTime );
+ mAlarmTimeDefaultCheckBox->setChecked ( KOPrefs::instance()->mAlarmsEnabledByDefault );
for ( int i = 0; i < 7; ++i ) {
mWorkDays[i]->setChecked( (1<<i) & (KOPrefs::instance()->mWorkWeekMask) );
}
@@ -403,6 +410,7 @@ class KOPrefsDialogTime : public KPrefsModule
mRegionMap[mHolidayCombo->currentText()];
KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
+ KOPrefs::instance()->mAlarmsEnabledByDefault = mAlarmTimeDefaultCheckBox->isChecked();
int mask = 0;
for ( int i = 0; i < 7; ++i ) {
if (mWorkDays[i]->isChecked()) mask = mask | (1<<i);
@@ -433,6 +441,7 @@ class KOPrefsDialogTime : public KPrefsModule
QComboBox *mHolidayCombo;
QMap<QString,QString> mRegionMap;
QComboBox *mAlarmTimeCombo;
+ QCheckBox *mAlarmTimeDefaultCheckBox;
QCheckBox *mWorkDays[7];
};
diff --git a/korganizer/resourceview.cpp b/korganizer/resourceview.cpp
index 53b8e6495..112a2801b 100644
--- a/korganizer/resourceview.cpp
+++ b/korganizer/resourceview.cpp
@@ -159,8 +159,10 @@ void ResourceItem::stateChange( bool active )
createSubresourceItems();
}
} else {
- if ( mResource->save() ) mResource->setActive( false );
+ // mView->requestClose must be called before mResource->save() because
+ // save causes closeResource do be called.
mView->requestClose( mResource );
+ if ( mResource->save() ) mResource->setActive( false );
}
setOpen( mResource->isActive() && childCount() > 0 );
diff --git a/korganizer/timelabels.cpp b/korganizer/timelabels.cpp
index 792c270da..ab5967055 100644
--- a/korganizer/timelabels.cpp
+++ b/korganizer/timelabels.cpp
@@ -176,6 +176,11 @@ int TimeLabels::minimumWidth() const
/** updates widget's internal state */
void TimeLabels::updateConfig()
{
+ // Avoid crash on exit
+ if ( !mAgenda ) {
+ return;
+ }
+
setFont(KOPrefs::instance()->mTimeBarFont);
QString test = "20";