summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-11-25 15:49:13 (UTC)
committer zautrix <zautrix>2005-11-25 15:49:13 (UTC)
commit794a5204686ad9bfc16172b01db35f1f3b7683e5 (patch) (unidiff)
tree29da2cb35a4d6a0cd6885436087fe0659b58a9f4 /korganizer
parent90b62d1158d00f162a258541e24aaed4c967480b (diff)
downloadkdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.zip
kdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.tar.gz
kdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.tar.bz2
sync
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp19
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/koprefs.cpp10
-rw-r--r--korganizer/koprefs.h1
4 files changed, 28 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 31e103d..8965d3b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1917,129 +1917,128 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1917 delete eventRSync; 1917 delete eventRSync;
1918 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); 1918 qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() );
1919 QString mes; 1919 QString mes;
1920 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); 1920 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT );
1921 QString delmess; 1921 QString delmess;
1922 if ( delFut ) { 1922 if ( delFut ) {
1923 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); 1923 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1924 mes += delmess; 1924 mes += delmess;
1925 } 1925 }
1926 mes = i18n("Local calendar changed!\n") +mes; 1926 mes = i18n("Local calendar changed!\n") +mes;
1927 mCalendar->checkAlarmForIncidence( 0, true ); 1927 mCalendar->checkAlarmForIncidence( 0, true );
1928 qDebug( mes ); 1928 qDebug( mes );
1929 if ( mSyncManager->mShowSyncSummary ) { 1929 if ( mSyncManager->mShowSyncSummary ) {
1930 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1930 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1931 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1931 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1932 qDebug("KO: WB cancelled "); 1932 qDebug("KO: WB cancelled ");
1933 mSyncManager->mWriteBackFile = false; 1933 mSyncManager->mWriteBackFile = false;
1934 return syncOK; 1934 return syncOK;
1935 } 1935 }
1936 } 1936 }
1937 return syncOK; 1937 return syncOK;
1938} 1938}
1939 1939
1940void CalendarView::setSyncDevice( QString s ) 1940void CalendarView::setSyncDevice( QString s )
1941{ 1941{
1942 mCurrentSyncDevice= s; 1942 mCurrentSyncDevice= s;
1943} 1943}
1944void CalendarView::setSyncName( QString s ) 1944void CalendarView::setSyncName( QString s )
1945{ 1945{
1946 mCurrentSyncName= s; 1946 mCurrentSyncName= s;
1947} 1947}
1948bool CalendarView::syncCalendar(QString filename, int mode) 1948bool CalendarView::syncCalendar(QString filename, int mode)
1949{ 1949{
1950 //qDebug("syncCalendar %s ", filename.latin1()); 1950 //qDebug("syncCalendar %s ", filename.latin1());
1951 mGlobalSyncMode = SYNC_MODE_NORMAL; 1951 mGlobalSyncMode = SYNC_MODE_NORMAL;
1952 CalendarLocal* calendar = new CalendarLocal(); 1952 CalendarLocal* calendar = new CalendarLocal();
1953 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1953 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1954 FileStorage* storage = new FileStorage( calendar ); 1954 FileStorage* storage = new FileStorage( calendar );
1955 bool syncOK = false; 1955 bool syncOK = false;
1956 storage->setFileName( filename ); 1956 storage->setFileName( filename );
1957 // qDebug("loading ... "); 1957 // qDebug("loading ... ");
1958 if ( storage->load() ) { 1958 if ( storage->load() ) {
1959 getEventViewerDialog()->setSyncMode( true ); 1959 getEventViewerDialog()->setSyncMode( true );
1960 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1960 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1961 getEventViewerDialog()->setSyncMode( false ); 1961 getEventViewerDialog()->setSyncMode( false );
1962 if ( syncOK ) { 1962 if ( syncOK ) {
1963 if ( mSyncManager->mWriteBackFile ) 1963 if ( mSyncManager->mWriteBackFile )
1964 { 1964 {
1965 storage->setSaveFormat( new ICalFormat() ); 1965 storage->setSaveFormat( new ICalFormat() );
1966 storage->save(); 1966 storage->save();
1967 } 1967 }
1968 } 1968 }
1969 setModified( true ); 1969 setModified( true );
1970 } 1970 }
1971 delete storage; 1971 delete storage;
1972 delete calendar; 1972 delete calendar;
1973 if ( syncOK ) 1973 if ( syncOK )
1974 updateView(); 1974 updateView();
1975 return syncOK; 1975 return syncOK;
1976} 1976}
1977 1977
1978void CalendarView::syncExternal( int mode ) 1978void CalendarView::syncExternal( int mode )
1979{ 1979{
1980 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1980 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1981
1982 qApp->processEvents(); 1981 qApp->processEvents();
1983 CalendarLocal* calendar = new CalendarLocal(); 1982 CalendarLocal* calendar = new CalendarLocal();
1984 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1983 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1985 bool syncOK = false; 1984 bool syncOK = false;
1986 bool loadSuccess = false; 1985 bool loadSuccess = false;
1987 PhoneFormat* phoneFormat = 0; 1986 PhoneFormat* phoneFormat = 0;
1988 emit tempDisableBR(true); 1987 emit tempDisableBR(true);
1989#ifndef DESKTOP_VERSION 1988#ifndef DESKTOP_VERSION
1990 SharpFormat* sharpFormat = 0; 1989 SharpFormat* sharpFormat = 0;
1991 if ( mode == 0 ) { // sharp 1990 if ( mode == 0 ) { // sharp
1992 sharpFormat = new SharpFormat () ; 1991 sharpFormat = new SharpFormat () ;
1993 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1992 loadSuccess = sharpFormat->load( calendar, mCalendar );
1994 1993
1995 } else 1994 } else
1996#endif 1995#endif
1997 if ( mode == 1 ) { // phone 1996 if ( mode == 1 ) { // phone
1998 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1997 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1999 mSyncManager->mPhoneDevice, 1998 mSyncManager->mPhoneDevice,
2000 mSyncManager->mPhoneConnection, 1999 mSyncManager->mPhoneConnection,
2001 mSyncManager->mPhoneModel); 2000 mSyncManager->mPhoneModel);
2002 loadSuccess = phoneFormat->load( calendar,mCalendar); 2001 loadSuccess = phoneFormat->load( calendar,mCalendar);
2003 2002
2004 } else { 2003 } else {
2005 emit tempDisableBR(false); 2004 emit tempDisableBR(false);
2006 return; 2005 return;
2007 } 2006 }
2008 if ( loadSuccess ) { 2007 if ( loadSuccess ) {
2009 getEventViewerDialog()->setSyncMode( true ); 2008 getEventViewerDialog()->setSyncMode( true );
2010 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 2009 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
2011 getEventViewerDialog()->setSyncMode( false ); 2010 getEventViewerDialog()->setSyncMode( false );
2012 qApp->processEvents(); 2011 qApp->processEvents();
2013 if ( syncOK ) { 2012 if ( syncOK ) {
2014 if ( mSyncManager->mWriteBackFile ) 2013 if ( mSyncManager->mWriteBackFile )
2015 { 2014 {
2016 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 2015 QPtrList<Incidence> iL = mCalendar->rawIncidences();
2017 Incidence* inc = iL.first(); 2016 Incidence* inc = iL.first();
2018 if ( phoneFormat ) { 2017 if ( phoneFormat ) {
2019 while ( inc ) { 2018 while ( inc ) {
2020 inc->removeID(mCurrentSyncDevice); 2019 inc->removeID(mCurrentSyncDevice);
2021 inc = iL.next(); 2020 inc = iL.next();
2022 } 2021 }
2023 } 2022 }
2024#ifndef DESKTOP_VERSION 2023#ifndef DESKTOP_VERSION
2025 if ( sharpFormat ) 2024 if ( sharpFormat )
2026 sharpFormat->save(calendar); 2025 sharpFormat->save(calendar);
2027#endif 2026#endif
2028 if ( phoneFormat ) 2027 if ( phoneFormat )
2029 phoneFormat->save(calendar); 2028 phoneFormat->save(calendar);
2030 iL = calendar->rawIncidences(); 2029 iL = calendar->rawIncidences();
2031 inc = iL.first(); 2030 inc = iL.first();
2032 Incidence* loc; 2031 Incidence* loc;
2033 while ( inc ) { 2032 while ( inc ) {
2034 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 2033 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
2035 loc = mCalendar->incidence(inc->uid() ); 2034 loc = mCalendar->incidence(inc->uid() );
2036 if ( loc ) { 2035 if ( loc ) {
2037 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 2036 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
2038 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 2037 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
2039 } 2038 }
2040 } 2039 }
2041 inc = iL.next(); 2040 inc = iL.next();
2042 } 2041 }
2043 Incidence* lse = getLastSyncEvent(); 2042 Incidence* lse = getLastSyncEvent();
2044 if ( lse ) { 2043 if ( lse ) {
2045 lse->setReadOnly( false ); 2044 lse->setReadOnly( false );
@@ -4973,139 +4972,153 @@ void CalendarView::lookForOutgoingMessages()
4973void CalendarView::lookForIncomingMessages() 4972void CalendarView::lookForIncomingMessages()
4974{ 4973{
4975 IncomingDialog *icd = mDialogManager->incomingDialog(); 4974 IncomingDialog *icd = mDialogManager->incomingDialog();
4976 icd->retrieve(); 4975 icd->retrieve();
4977} 4976}
4978 4977
4979bool CalendarView::removeCompletedSubTodos( Todo* t ) 4978bool CalendarView::removeCompletedSubTodos( Todo* t )
4980{ 4979{
4981 bool deleteTodo = true; 4980 bool deleteTodo = true;
4982 QPtrList<Incidence> subTodos; 4981 QPtrList<Incidence> subTodos;
4983 Incidence *aTodo; 4982 Incidence *aTodo;
4984 subTodos = t->relations(); 4983 subTodos = t->relations();
4985 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4984 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4986 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4985 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4987 deleteTodo = false; 4986 deleteTodo = false;
4988 } 4987 }
4989 if ( deleteTodo ) { 4988 if ( deleteTodo ) {
4990 if ( t->isCompleted() && !t->doesRecur()) { 4989 if ( t->isCompleted() && !t->doesRecur()) {
4991 checkExternalId( t ); 4990 checkExternalId( t );
4992 mCalendar->deleteTodo( t ); 4991 mCalendar->deleteTodo( t );
4993 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4992 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4994 } 4993 }
4995 else 4994 else
4996 deleteTodo = false; 4995 deleteTodo = false;
4997 } 4996 }
4998 return deleteTodo; 4997 return deleteTodo;
4999 4998
5000} 4999}
5001void CalendarView::purgeCompleted() 5000void CalendarView::purgeCompleted()
5002{ 5001{
5003 int result = KMessageBox::warningContinueCancel(this, 5002 int result = KMessageBox::warningContinueCancel(this,
5004 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 5003 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
5005 5004
5006 if (result == KMessageBox::Continue) { 5005 if (result == KMessageBox::Continue) {
5007 5006
5008 QPtrList<Todo> todoCal; 5007 QPtrList<Todo> todoCal;
5009 QPtrList<Todo> rootTodos; 5008 QPtrList<Todo> rootTodos;
5010 //QPtrList<Incidence> rel; 5009 //QPtrList<Incidence> rel;
5011 Todo *aTodo; 5010 Todo *aTodo;
5012 todoCal = calendar()->todos(); 5011 todoCal = calendar()->todos();
5013 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 5012 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
5014 if ( !aTodo->relatedTo() ) 5013 if ( !aTodo->relatedTo() )
5015 rootTodos.append( aTodo ); 5014 rootTodos.append( aTodo );
5016 } 5015 }
5017 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 5016 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
5018 removeCompletedSubTodos( aTodo ); 5017 removeCompletedSubTodos( aTodo );
5019 } 5018 }
5020 5019
5021 updateView(); 5020 updateView();
5022 } 5021 }
5023} 5022}
5024 5023
5025void CalendarView::slotCalendarChanged() 5024void CalendarView::slotCalendarChanged()
5026{ 5025{
5027 ; 5026 ;
5028} 5027}
5029 5028
5030void CalendarView::keyPressEvent ( QKeyEvent *e) 5029void CalendarView::keyPressEvent ( QKeyEvent *e)
5031{ 5030{
5032 //qDebug("CalendarView::keyPressEvent "); 5031 //qDebug("CalendarView::keyPressEvent ");
5033 e->ignore(); 5032 e->ignore();
5034} 5033}
5035 5034
5036 5035
5037bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 5036bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource)
5038{ 5037{
5039 5038
5040 if ( manager != mSyncManager) 5039 if ( manager != mSyncManager)
5041 qDebug("KO: Internal error-1. SyncManager mismatch "); 5040 qDebug("KO: Internal error-1. SyncManager mismatch ");
5042 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 5041 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
5043 qDebug("KO: SyncKDE request detected!"); 5042 qDebug("KO: SyncKDE request detected!");
5044 } 5043 }
5045 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 5044 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
5046 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 5045 mCurrentSyncName = mSyncManager->getCurrentSyncName();
5047 return syncCalendar( filename, mode ); 5046 if ( !resource.isEmpty() ) {
5047 int exclusiveSyncResource = KOPrefs::instance()->getFuzzyCalendarID( resource );
5048 qDebug( "KO: Sync request for resource: %s", resource.latin1() );
5049
5050 if ( !exclusiveSyncResource ) {
5051 qDebug( "KO: Requested sync resource not found: %s", resource.latin1() );
5052 return false;
5053 }
5054 mCalendar->setDefaultCalendar( exclusiveSyncResource );
5055 mCalendar->setDefaultCalendarEnabledOnly();
5056 }
5057 bool result = syncCalendar( filename, mode );
5058 if ( !resource.isEmpty() )
5059 restoreCalendarSettings();
5060 return result;
5048} 5061}
5049bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 5062bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
5050{ 5063{
5051 //mSyncManager = manager; 5064 //mSyncManager = manager;
5052 if ( manager != mSyncManager) 5065 if ( manager != mSyncManager)
5053 qDebug("KO: Internal error-2. SyncManager mismatch "); 5066 qDebug("KO: Internal error-2. SyncManager mismatch ");
5054 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 5067 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
5055 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 5068 mCurrentSyncName = mSyncManager->getCurrentSyncName();
5056 if ( resource == "sharp" ) 5069 if ( resource == "sharp" )
5057 syncExternal( 0 ); 5070 syncExternal( 0 );
5058 if ( resource == "phone" ) 5071 if ( resource == "phone" )
5059 syncExternal( 1 ); 5072 syncExternal( 1 );
5060 // pending setmodified 5073 // pending setmodified
5061 return true; 5074 return true;
5062} 5075}
5063void CalendarView::setSyncManager(KSyncManager* manager) 5076void CalendarView::setSyncManager(KSyncManager* manager)
5064{ 5077{
5065 mSyncManager = manager; 5078 mSyncManager = manager;
5066} 5079}
5067 5080
5068void CalendarView::removeSyncInfo( QString syncProfile) 5081void CalendarView::removeSyncInfo( QString syncProfile)
5069{ 5082{
5070 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 5083 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
5071 mCalendar->removeSyncInfo( syncProfile ); 5084 mCalendar->removeSyncInfo( syncProfile );
5072 5085
5073} 5086}
5074 5087
5075void CalendarView::undo_delete() 5088void CalendarView::undo_delete()
5076{ 5089{
5077 //qDebug("undo_delete() "); 5090 //qDebug("undo_delete() ");
5078 Incidence* undo = mCalendar->undoIncidence(); 5091 Incidence* undo = mCalendar->undoIncidence();
5079 if ( !undo ) { 5092 if ( !undo ) {
5080 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 5093 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
5081 i18n("KO/Pi")); 5094 i18n("KO/Pi"));
5082 return; 5095 return;
5083 } 5096 }
5084 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + 5097 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) +
5085 i18n("\nAre you sure you want\nto restore this?"), 5098 i18n("\nAre you sure you want\nto restore this?"),
5086 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 5099 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
5087 mCalendar->undoDeleteIncidence(); 5100 mCalendar->undoDeleteIncidence();
5088 updateView(); 5101 updateView();
5089 } 5102 }
5090} 5103}
5091 5104
5092void CalendarView::slotViewerClosed() 5105void CalendarView::slotViewerClosed()
5093{ 5106{
5094 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 5107 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
5095} 5108}
5096 5109
5097void CalendarView::resetFocus() 5110void CalendarView::resetFocus()
5098{ 5111{
5099 if ( mViewerCallerIsSearchDialog ) { 5112 if ( mViewerCallerIsSearchDialog ) {
5100 if ( mDialogManager->getSearchDialog()->isVisible() ){ 5113 if ( mDialogManager->getSearchDialog()->isVisible() ){
5101 mDialogManager->getSearchDialog()->raise(); 5114 mDialogManager->getSearchDialog()->raise();
5102 mDialogManager->getSearchDialog()->setActiveWindow(); 5115 mDialogManager->getSearchDialog()->setActiveWindow();
5103 mDialogManager->getSearchDialog()->listview()->resetFocus(); 5116 mDialogManager->getSearchDialog()->listview()->resetFocus();
5104 } else 5117 } else
5105 mViewerCallerIsSearchDialog = false; 5118 mViewerCallerIsSearchDialog = false;
5106 } 5119 }
5107 if ( !mViewerCallerIsSearchDialog ) { 5120 if ( !mViewerCallerIsSearchDialog ) {
5108 //mViewManager->currentView()->setFocus(); 5121 //mViewManager->currentView()->setFocus();
5109 //qDebug("sssssssssssssssset focus "); 5122 //qDebug("sssssssssssssssset focus ");
5110 topLevelWidget()->raise(); 5123 topLevelWidget()->raise();
5111 setActiveWindow(); 5124 setActiveWindow();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 80f7ed4..f85b6a3 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -457,129 +457,129 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
457 /** Move to the previous date(s) in the current view */ 457 /** Move to the previous date(s) in the current view */
458 void goPrevious(); 458 void goPrevious();
459 /** Move to the next date(s) in the current view */ 459 /** Move to the next date(s) in the current view */
460 void goNextMonth(); 460 void goNextMonth();
461 461
462 /** Move to the previous date(s) in the current view */ 462 /** Move to the previous date(s) in the current view */
463 void goPreviousMonth(); 463 void goPreviousMonth();
464 464
465 void toggleExpand(); 465 void toggleExpand();
466 void toggleDateNavigatorWidget(); 466 void toggleDateNavigatorWidget();
467 void toggleAllDaySize(); 467 void toggleAllDaySize();
468 468
469 /** Look for new messages in the inbox */ 469 /** Look for new messages in the inbox */
470 void lookForIncomingMessages(); 470 void lookForIncomingMessages();
471 /** Look for new messages in the outbox */ 471 /** Look for new messages in the outbox */
472 void lookForOutgoingMessages(); 472 void lookForOutgoingMessages();
473 473
474 void processMainViewSelection( Incidence * ); 474 void processMainViewSelection( Incidence * );
475 void processTodoListSelection( Incidence * ); 475 void processTodoListSelection( Incidence * );
476 476
477 void processIncidenceSelection( Incidence * ); 477 void processIncidenceSelection( Incidence * );
478 478
479 void purgeCompleted(); 479 void purgeCompleted();
480 bool removeCompletedSubTodos( Todo* ); 480 bool removeCompletedSubTodos( Todo* );
481 void slotCalendarChanged(); 481 void slotCalendarChanged();
482 bool importBday(); 482 bool importBday();
483 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 483 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
484 bool importQtopia( const QString &categoriesFile, 484 bool importQtopia( const QString &categoriesFile,
485 const QString &datebookFile, 485 const QString &datebookFile,
486 const QString &tasklistFile ); 486 const QString &tasklistFile );
487 void syncExternal( int mode ); 487 void syncExternal( int mode );
488 void slotSelectPickerDate( QDate ) ; 488 void slotSelectPickerDate( QDate ) ;
489 void showDatePicker() ; 489 void showDatePicker() ;
490 void showDatePickerPopup() ; 490 void showDatePickerPopup() ;
491 void moveIncidence(Incidence *) ; 491 void moveIncidence(Incidence *) ;
492 void beamIncidence(Incidence *) ; 492 void beamIncidence(Incidence *) ;
493 void beamCalendar() ; 493 void beamCalendar() ;
494 void beamFilteredCalendar() ; 494 void beamFilteredCalendar() ;
495 void beamIncidenceList(QPtrList<Incidence>) ; 495 void beamIncidenceList(QPtrList<Incidence>) ;
496 void manageCategories(); 496 void manageCategories();
497 void editCategories(); 497 void editCategories();
498 int addCategories(); 498 int addCategories();
499 void removeCategories(); 499 void removeCategories();
500 void setSyncDevice( QString ); 500 void setSyncDevice( QString );
501 void setSyncName( QString ); 501 void setSyncName( QString );
502 void showDay( QDate ); 502 void showDay( QDate );
503 void undo_delete(); 503 void undo_delete();
504 protected slots: 504 protected slots:
505 void resetFocus(); 505 void resetFocus();
506 void scrollBarValue(int); 506 void scrollBarValue(int);
507 void slotViewerClosed(); 507 void slotViewerClosed();
508 void timerAlarm(); 508 void timerAlarm();
509 void suspendAlarm(); 509 void suspendAlarm();
510 void beamDone( Ir *ir ); 510 void beamDone( Ir *ir );
511 /** Select a view or adapt the current view to display the specified dates. */ 511 /** Select a view or adapt the current view to display the specified dates. */
512 void showDates( const KCal::DateList & ); 512 void showDates( const KCal::DateList & );
513 void selectWeekNum ( int ); 513 void selectWeekNum ( int );
514 void checkConflictForEvent(); 514 void checkConflictForEvent();
515 515
516 public: 516 public:
517 void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); 517 void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval );
518 // show a standard warning 518 // show a standard warning
519 // returns KMsgBox::yesNoCancel() 519 // returns KMsgBox::yesNoCancel()
520 int msgCalModified(); 520 int msgCalModified();
521 virtual bool sync(KSyncManager* manager, QString filename, int mode); 521 virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource);
522 522
523 virtual bool syncExternal(KSyncManager* manager, QString resource); 523 virtual bool syncExternal(KSyncManager* manager, QString resource);
524 virtual void removeSyncInfo( QString syncProfile); 524 virtual void removeSyncInfo( QString syncProfile);
525 void setSyncManager(KSyncManager* manager); 525 void setSyncManager(KSyncManager* manager);
526 void setLoadedFileVersion(QDateTime); 526 void setLoadedFileVersion(QDateTime);
527 bool checkFileVersion(QString fn); 527 bool checkFileVersion(QString fn);
528 bool checkAllFileVersions(); 528 bool checkAllFileVersions();
529 bool checkFileChanged(QString fn); 529 bool checkFileChanged(QString fn);
530 Event* getLastSyncEvent(); 530 Event* getLastSyncEvent();
531 /** Adapt navigation units correpsonding to step size of navigation of the 531 /** Adapt navigation units correpsonding to step size of navigation of the
532 * current view. 532 * current view.
533 */ 533 */
534 void adaptNavigationUnits(); 534 void adaptNavigationUnits();
535 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 535 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
536 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 536 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
537 //Attendee* getYourAttendee(Event *event); 537 //Attendee* getYourAttendee(Event *event);
538 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 538 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
539 void setScrollBarStep(int val ); 539 void setScrollBarStep(int val );
540 540
541 protected: 541 protected:
542 Event *mConflictingEvent; 542 Event *mConflictingEvent;
543 void schedule(Scheduler::Method, Incidence *incidence = 0); 543 void schedule(Scheduler::Method, Incidence *incidence = 0);
544 544
545 // returns KMsgBox::OKCandel() 545 // returns KMsgBox::OKCandel()
546 int msgItemDelete(const QString name); 546 int msgItemDelete(const QString name);
547 void showEventEditor(); 547 void showEventEditor();
548 void showTodoEditor(); 548 void showTodoEditor();
549 Todo *selectedTodo(); 549 Todo *selectedTodo();
550 private: 550 private:
551#ifdef DESKTOP_VERSION 551#ifdef DESKTOP_VERSION
552 QScrollBar * mDateScrollBar; 552 QScrollBar * mDateScrollBar;
553#endif 553#endif
554 bool flag_blockConflict; 554 bool flag_blockConflict;
555 bool flag_blockScrollBar; 555 bool flag_blockScrollBar;
556 bool flag_checkFileFirsttime; 556 bool flag_checkFileFirsttime;
557 bool flag_clearallviewsEventDisplay; 557 bool flag_clearallviewsEventDisplay;
558 bool flag_clearallviewsupdateView; 558 bool flag_clearallviewsupdateView;
559 QDateTime mNextAlarmDateTime; 559 QDateTime mNextAlarmDateTime;
560 bool mViewerCallerIsSearchDialog; 560 bool mViewerCallerIsSearchDialog;
561 bool mBlockShowDates; 561 bool mBlockShowDates;
562 KSyncManager* mSyncManager; 562 KSyncManager* mSyncManager;
563 AlarmDialog * mAlarmDialog; 563 AlarmDialog * mAlarmDialog;
564 QString mAlarmNotification; 564 QString mAlarmNotification;
565 QString mSuspendAlarmNotification; 565 QString mSuspendAlarmNotification;
566 QTimer* mSuspendTimer; 566 QTimer* mSuspendTimer;
567 QTimer* mAlarmTimer; 567 QTimer* mAlarmTimer;
568 QTimer* mRecheckAlarmTimer; 568 QTimer* mRecheckAlarmTimer;
569 void computeAlarm( QString ); 569 void computeAlarm( QString );
570 void startAlarm( QString, QString ); 570 void startAlarm( QString, QString );
571 void setSyncEventsReadOnly(); 571 void setSyncEventsReadOnly();
572 572
573 QDateTime loadedFileVersion; 573 QDateTime loadedFileVersion;
574 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 574 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
575 void checkExternalId( Incidence * inc ); 575 void checkExternalId( Incidence * inc );
576 int mGlobalSyncMode; 576 int mGlobalSyncMode;
577 QString mCurrentSyncDevice; 577 QString mCurrentSyncDevice;
578 QString mCurrentSyncName; 578 QString mCurrentSyncName;
579 void init(); 579 void init();
580 int mDatePickerMode; 580 int mDatePickerMode;
581 bool mFlagEditDescription; 581 bool mFlagEditDescription;
582 QDateTime mLastCalendarSync; 582 QDateTime mLastCalendarSync;
583 void createPrinter(); 583 void createPrinter();
584 584
585 void calendarModified( bool, Calendar * ); 585 void calendarModified( bool, Calendar * );
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 1b0e5f4..31ef338 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -467,128 +467,138 @@ void KOPrefs::usrReadConfig()
467 KopiCalendarFile *kkf = getNewCalendar(); 467 KopiCalendarFile *kkf = getNewCalendar();
468 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); 468 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
469 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); 469 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
470 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); 470 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false );
471 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); 471 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
472 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); 472 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
473 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); 473 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
474 kkf->mFileName = QDir::convertSeparators( fc.readEntry( prefix+"_FileName", kkf->mFileName) ); 474 kkf->mFileName = QDir::convertSeparators( fc.readEntry( prefix+"_FileName", kkf->mFileName) );
475 kkf->mSavedFileName = QDir::convertSeparators( fc.readEntry( prefix+"_SavedFileName", kkf->mFileName) ); 475 kkf->mSavedFileName = QDir::convertSeparators( fc.readEntry( prefix+"_SavedFileName", kkf->mFileName) );
476 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); 476 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
477 if ( kkf->mCalNumber == 1 ) { 477 if ( kkf->mCalNumber == 1 ) {
478 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 478 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
479 } 479 }
480 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); 480 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
481 if ( kkf->mName == i18n("Birthdays") ) { 481 if ( kkf->mName == i18n("Birthdays") ) {
482 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); 482 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
483 } 483 }
484 if ( kkf->isRelative ) 484 if ( kkf->isRelative )
485 kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName ); 485 kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName );
486 } 486 }
487 487
488 KPimPrefs::usrReadConfig(); 488 KPimPrefs::usrReadConfig();
489} 489}
490 490
491KopiCalendarFile * KOPrefs::getCalendar( int num ) 491KopiCalendarFile * KOPrefs::getCalendar( int num )
492{ 492{
493 return mDefCalColors[num-1]; 493 return mDefCalColors[num-1];
494} 494}
495 495
496KopiCalendarFile * KOPrefs::getNewCalendar() 496KopiCalendarFile * KOPrefs::getNewCalendar()
497{ 497{
498 KopiCalendarFile * kkf = new KopiCalendarFile(); 498 KopiCalendarFile * kkf = new KopiCalendarFile();
499 kkf->mCalNumber = mNextAvailableCalendar; 499 kkf->mCalNumber = mNextAvailableCalendar;
500 mDefCalColors.resize( mNextAvailableCalendar ); 500 mDefCalColors.resize( mNextAvailableCalendar );
501 mDefCalColors[mNextAvailableCalendar-1] = kkf; 501 mDefCalColors[mNextAvailableCalendar-1] = kkf;
502 ++mNextAvailableCalendar; 502 ++mNextAvailableCalendar;
503 kkf->mDefaultColor = mEventColor; 503 kkf->mDefaultColor = mEventColor;
504 kkf->mName = i18n("New Calendar"); 504 kkf->mName = i18n("New Calendar");
505 mCalendars.append( kkf ); 505 mCalendars.append( kkf );
506 return kkf; 506 return kkf;
507} 507}
508void KOPrefs::deleteCalendar( int num ) 508void KOPrefs::deleteCalendar( int num )
509{ 509{
510 KopiCalendarFile * kkf = mCalendars.first(); 510 KopiCalendarFile * kkf = mCalendars.first();
511 while ( kkf ) { 511 while ( kkf ) {
512 if ( kkf->mCalNumber == num ) { 512 if ( kkf->mCalNumber == num ) {
513 qDebug("KOPrefs::deleteCalendar %d ", num ); 513 qDebug("KOPrefs::deleteCalendar %d ", num );
514 mCalendars.remove( kkf ); 514 mCalendars.remove( kkf );
515 delete kkf; 515 delete kkf;
516 return; 516 return;
517 } 517 }
518 kkf = mCalendars.next(); 518 kkf = mCalendars.next();
519 } 519 }
520} 520}
521int KOPrefs::getCalendarID( const QString & name ) 521int KOPrefs::getCalendarID( const QString & name )
522{ 522{
523 KopiCalendarFile * kkf = mCalendars.first(); 523 KopiCalendarFile * kkf = mCalendars.first();
524 while ( kkf ) { 524 while ( kkf ) {
525 if ( name == kkf->mName) 525 if ( name == kkf->mName)
526 return kkf->mCalNumber; 526 return kkf->mCalNumber;
527 kkf = mCalendars.next(); 527 kkf = mCalendars.next();
528 } 528 }
529 return 1; 529 return 1;
530} 530}
531int KOPrefs::getFuzzyCalendarID( const QString & name )
532{
533 KopiCalendarFile * kkf = mCalendars.first();
534 while ( kkf ) {
535 if ( name.lower() == kkf->mName.lower())
536 return kkf->mCalNumber;
537 kkf = mCalendars.next();
538 }
539 return 0;
540}
531QString KOPrefs::calName( int calNum) const 541QString KOPrefs::calName( int calNum) const
532{ 542{
533 return (mDefCalColors[calNum-1])->mName; 543 return (mDefCalColors[calNum-1])->mName;
534} 544}
535QColor KOPrefs::defaultColor( int calNum ) const 545QColor KOPrefs::defaultColor( int calNum ) const
536{ 546{
537 if ( calNum == 1 ) return mEventColor; 547 if ( calNum == 1 ) return mEventColor;
538 return (mDefCalColors[calNum-1])->mDefaultColor; 548 return (mDefCalColors[calNum-1])->mDefaultColor;
539} 549}
540void KOPrefs::usrWriteConfig() 550void KOPrefs::usrWriteConfig()
541{ 551{
542 config()->setGroup("General"); 552 config()->setGroup("General");
543 config()->writeEntry("Custom Categories",mCustomCategories); 553 config()->writeEntry("Custom Categories",mCustomCategories);
544 554
545 config()->setGroup("Personal Settings"); 555 config()->setGroup("Personal Settings");
546 config()->writeEntry("user_name",mName); 556 config()->writeEntry("user_name",mName);
547 config()->writeEntry("user_email",mEmail); 557 config()->writeEntry("user_email",mEmail);
548 558
549 config()->setGroup("Category Colors"); 559 config()->setGroup("Category Colors");
550 QDictIterator<QColor> it(mCategoryColors); 560 QDictIterator<QColor> it(mCategoryColors);
551 while (it.current()) { 561 while (it.current()) {
552 config()->writeEntry(it.currentKey(),*(it.current())); 562 config()->writeEntry(it.currentKey(),*(it.current()));
553 ++it; 563 ++it;
554 } 564 }
555 KConfig fc (locateLocal("config","kopicalendarrc")); 565 KConfig fc (locateLocal("config","kopicalendarrc"));
556 fc.setGroup("CC"); 566 fc.setGroup("CC");
557 fc.deleteGroup( "CC"); 567 fc.deleteGroup( "CC");
558 fc.setGroup("CC"); 568 fc.setGroup("CC");
559 fc.writeEntry("NumberCalendars",mCalendars.count()); 569 fc.writeEntry("NumberCalendars",mCalendars.count());
560 int numCal = 1; 570 int numCal = 1;
561 int writeCal = 0; 571 int writeCal = 0;
562 while ( numCal < mNextAvailableCalendar ) { 572 while ( numCal < mNextAvailableCalendar ) {
563 KopiCalendarFile * kkf = mCalendars.first(); 573 KopiCalendarFile * kkf = mCalendars.first();
564 while ( kkf ) { 574 while ( kkf ) {
565 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 575 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
566 if ( kkf->mCalNumber == numCal ) { 576 if ( kkf->mCalNumber == numCal ) {
567 ++writeCal; 577 ++writeCal;
568 //qDebug("Write calendar %d %d ", numCal , writeCal); 578 //qDebug("Write calendar %d %d ", numCal , writeCal);
569 QString prefix = "Cal_" + QString::number( writeCal ); 579 QString prefix = "Cal_" + QString::number( writeCal );
570 fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); 580 fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
571 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 581 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
572 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 582 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
573 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 583 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
574 fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); 584 fc.writeEntry( prefix+"_isRelative", kkf->isRelative );
575 fc.writeEntry( prefix+"_Name", kkf->mName); 585 fc.writeEntry( prefix+"_Name", kkf->mName);
576 fc.writeEntry( prefix+"_FileName", kkf->mFileName); 586 fc.writeEntry( prefix+"_FileName", kkf->mFileName);
577 fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); 587 fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName);
578 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); 588 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
579 } 589 }
580 kkf = mCalendars.next(); 590 kkf = mCalendars.next();
581 } 591 }
582 ++numCal; 592 ++numCal;
583 } 593 }
584 fc.sync(); 594 fc.sync();
585 KPimPrefs::usrWriteConfig(); 595 KPimPrefs::usrWriteConfig();
586} 596}
587 597
588void KOPrefs::setCategoryColor(QString cat,const QColor & color) 598void KOPrefs::setCategoryColor(QString cat,const QColor & color)
589{ 599{
590 mCategoryColors.replace(cat,new QColor(color)); 600 mCategoryColors.replace(cat,new QColor(color));
591} 601}
592 602
593QColor *KOPrefs::categoryColor(QString cat) 603QColor *KOPrefs::categoryColor(QString cat)
594{ 604{
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index bac8010..70da096 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -44,128 +44,129 @@ class QStringList;
44#define VIEW_T_VIEW 8 44#define VIEW_T_VIEW 8
45 45
46class KopiCalendarFile : public QObject 46class KopiCalendarFile : public QObject
47{ 47{
48 public: 48 public:
49 KopiCalendarFile( ) : QObject( ) 49 KopiCalendarFile( ) : QObject( )
50 { 50 {
51 isStandard = false; 51 isStandard = false;
52 isEnabled = true; 52 isEnabled = true;
53 isAlarmEnabled = true; 53 isAlarmEnabled = true;
54 isReadOnly = false; 54 isReadOnly = false;
55 mName = "Calendar"; 55 mName = "Calendar";
56 mFileName = QDir::homeDirPath() + "/icalfile.ics"; 56 mFileName = QDir::homeDirPath() + "/icalfile.ics";
57 mSavedFileName = "icalfile.ics"; 57 mSavedFileName = "icalfile.ics";
58 mCalNumber = 0; 58 mCalNumber = 0;
59 mDefaultColor = Qt::red; 59 mDefaultColor = Qt::red;
60 mErrorOnLoad = false; 60 mErrorOnLoad = false;
61 isRelative = false; 61 isRelative = false;
62 } 62 }
63 bool isStandard; 63 bool isStandard;
64 bool isEnabled; 64 bool isEnabled;
65 bool isAlarmEnabled; 65 bool isAlarmEnabled;
66 bool isReadOnly; 66 bool isReadOnly;
67 bool mErrorOnLoad; 67 bool mErrorOnLoad;
68 QString mName; 68 QString mName;
69 QString mFileName; 69 QString mFileName;
70 QString mSavedFileName; 70 QString mSavedFileName;
71 bool isRelative; 71 bool isRelative;
72 int mCalNumber; 72 int mCalNumber;
73 QColor mDefaultColor; 73 QColor mDefaultColor;
74 QDateTime mLoadDt; 74 QDateTime mLoadDt;
75}; 75};
76class KOPrefs : public KPimPrefs 76class KOPrefs : public KPimPrefs
77{ 77{
78 public: 78 public:
79 enum { FormatVCalendar, FormatICalendar }; 79 enum { FormatVCalendar, FormatICalendar };
80 enum { MailClientKMail, MailClientSendmail }; 80 enum { MailClientKMail, MailClientSendmail };
81 enum { IMIPDummy, IMIPKMail }; 81 enum { IMIPDummy, IMIPKMail };
82 enum { IMIPOutbox, IMIPdirectsend }; 82 enum { IMIPOutbox, IMIPdirectsend };
83 enum { neverAuto, addressbookAuto, selectedAuto }; 83 enum { neverAuto, addressbookAuto, selectedAuto };
84 enum { standardDestination, askDestination }; 84 enum { standardDestination, askDestination };
85 85
86 virtual ~KOPrefs(); 86 virtual ~KOPrefs();
87 87
88 /** Get instance of KOPrefs. It is made sure that there is only one 88 /** Get instance of KOPrefs. It is made sure that there is only one
89 instance. */ 89 instance. */
90 static KOPrefs *instance(); 90 static KOPrefs *instance();
91 91
92 /** Set preferences to default values */ 92 /** Set preferences to default values */
93 void usrSetDefaults(); 93 void usrSetDefaults();
94 94
95 /** Read preferences from config file */ 95 /** Read preferences from config file */
96 void usrReadConfig(); 96 void usrReadConfig();
97 97
98 /** Write preferences to config file */ 98 /** Write preferences to config file */
99 void usrWriteConfig(); 99 void usrWriteConfig();
100 void setCategoryDefaults(); 100 void setCategoryDefaults();
101 void setAllDefaults(); 101 void setAllDefaults();
102 KopiCalendarFile * getNewCalendar(); 102 KopiCalendarFile * getNewCalendar();
103 KopiCalendarFile * getCalendar( int ); 103 KopiCalendarFile * getCalendar( int );
104 void deleteCalendar( int ); 104 void deleteCalendar( int );
105 QColor defaultColor( int ) const; 105 QColor defaultColor( int ) const;
106 QString calName( int ) const; 106 QString calName( int ) const;
107 int getCalendarID( const QString & name ); 107 int getCalendarID( const QString & name );
108 int getFuzzyCalendarID( const QString & name );
108 protected: 109 protected:
109 void setTimeZoneIdDefault(); 110 void setTimeZoneIdDefault();
110 111
111 /** Fill empty mail fields with default values. */ 112 /** Fill empty mail fields with default values. */
112 void fillMailDefaults(); 113 void fillMailDefaults();
113 114
114 private: 115 private:
115 /** Constructor disabled for public. Use instance() to create a KOPrefs 116 /** Constructor disabled for public. Use instance() to create a KOPrefs
116 object. */ 117 object. */
117 KOPrefs(); 118 KOPrefs();
118 119
119 static KOPrefs *mInstance; 120 static KOPrefs *mInstance;
120 QStringList getDefaultList(); 121 QStringList getDefaultList();
121 QStringList getLocationDefaultList(); 122 QStringList getLocationDefaultList();
122 public: 123 public:
123 // preferences data 124 // preferences data
124 KConfig* getConfig(); 125 KConfig* getConfig();
125 void setFullName(const QString &); 126 void setFullName(const QString &);
126 QString fullName(); 127 QString fullName();
127 void setEmail(const QString &); 128 void setEmail(const QString &);
128 QString email(); 129 QString email();
129 130
130 QString mAdditional; 131 QString mAdditional;
131 132
132 bool mEmailControlCenter; 133 bool mEmailControlCenter;
133 134
134 bool mBcc; 135 bool mBcc;
135 bool mAutoSave; 136 bool mAutoSave;
136 int mAutoSaveInterval; 137 int mAutoSaveInterval;
137 bool mConfirm; 138 bool mConfirm;
138 139
139 bool mEnableGroupScheduling; 140 bool mEnableGroupScheduling;
140 bool mEnableProjectView; 141 bool mEnableProjectView;
141 142
142 int mDefaultFormat; 143 int mDefaultFormat;
143 int mMailClient; 144 int mMailClient;
144 145
145 int mStartTime; 146 int mStartTime;
146 int mDefaultDuration; 147 int mDefaultDuration;
147 int mAlarmTime; 148 int mAlarmTime;
148 149
149 int mWorkingHoursStart; 150 int mWorkingHoursStart;
150 int mWorkingHoursEnd; 151 int mWorkingHoursEnd;
151 bool mExcludeHolidays; 152 bool mExcludeHolidays;
152 bool mExcludeSaturdays; 153 bool mExcludeSaturdays;
153 bool mMarcusBainsShowSeconds; 154 bool mMarcusBainsShowSeconds;
154 155
155 QFont mTimeBarFont; 156 QFont mTimeBarFont;
156 QFont mMonthViewFont; 157 QFont mMonthViewFont;
157 QFont mAgendaViewFont; 158 QFont mAgendaViewFont;
158 QFont mMarcusBainsFont; 159 QFont mMarcusBainsFont;
159 QFont mTimeLabelsFont; 160 QFont mTimeLabelsFont;
160 QFont mTodoViewFont; 161 QFont mTodoViewFont;
161 QFont mListViewFont; 162 QFont mListViewFont;
162 QFont mDateNavigatorFont; 163 QFont mDateNavigatorFont;
163 QFont mEditBoxFont; 164 QFont mEditBoxFont;
164 QFont mJornalViewFont; 165 QFont mJornalViewFont;
165 QFont mWhatsNextFont; 166 QFont mWhatsNextFont;
166 QFont mEventViewFont; 167 QFont mEventViewFont;
167 168
168 169
169 170
170 171
171 QColor mHolidayColor; 172 QColor mHolidayColor;