-rw-r--r-- | korganizer/calendarview.cpp | 12 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 15 | ||||
-rw-r--r-- | korganizer/koprefs.h | 9 |
4 files changed, 11 insertions, 30 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 0306e07..e64d83a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1154,128 +1154,128 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int remote->deleteIncidence( inR ); ++delFut; } inR = er.next(); } } bar.hide(); mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); eventLSync->setReadOnly( false ); eventLSync->setDtStart( mLastCalendarSync ); eventRSync->setDtStart( mLastCalendarSync ); eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); eventLSync->setReadOnly( true ); if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal... remote->addEvent( eventRSync ); else delete eventRSync; QString mes; 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); QString delmess; if ( delFut ) { delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); mes += delmess; } if ( mSyncManager->mShowSyncSummary ) { KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); } qDebug( mes ); mCalendar->checkAlarmForIncidence( 0, true ); return syncOK; } void CalendarView::setSyncDevice( QString s ) { mCurrentSyncDevice= s; } void CalendarView::setSyncName( QString s ) { mCurrentSyncName= s; } bool CalendarView::syncCalendar(QString filename, int mode) { //qDebug("syncCalendar %s ", filename.latin1()); mGlobalSyncMode = SYNC_MODE_NORMAL; CalendarLocal* calendar = new CalendarLocal(); - calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); + calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); FileStorage* storage = new FileStorage( calendar ); bool syncOK = false; storage->setFileName( filename ); // qDebug("loading ... "); if ( storage->load() ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, mode ); getEventViewerDialog()->setSyncMode( false ); if ( syncOK ) { if ( mSyncManager->mWriteBackFile ) { storage->setSaveFormat( new ICalFormat() ); storage->save(); } } setModified( true ); } delete storage; delete calendar; if ( syncOK ) updateView(); return syncOK; } void CalendarView::syncExternal( int mode ) { mGlobalSyncMode = SYNC_MODE_EXTERNAL; qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); - calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); + calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); bool syncOK = false; bool loadSuccess = false; PhoneFormat* phoneFormat = 0; emit tempDisableBR(true); #ifndef DESKTOP_VERSION SharpFormat* sharpFormat = 0; if ( mode == 0 ) { // sharp sharpFormat = new SharpFormat () ; loadSuccess = sharpFormat->load( calendar, mCalendar ); } else #endif if ( mode == 1 ) { // phone phoneFormat = new PhoneFormat (mCurrentSyncDevice, mSyncManager->mPhoneDevice, mSyncManager->mPhoneConnection, mSyncManager->mPhoneModel); loadSuccess = phoneFormat->load( calendar,mCalendar); } else { emit tempDisableBR(false); return; } if ( loadSuccess ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); getEventViewerDialog()->setSyncMode( false ); qApp->processEvents(); if ( syncOK ) { if ( mSyncManager->mWriteBackFile ) { QPtrList<Incidence> iL = mCalendar->rawIncidences(); Incidence* inc = iL.first(); if ( phoneFormat ) { while ( inc ) { inc->removeID(mCurrentSyncDevice); inc = iL.next(); } } #ifndef DESKTOP_VERSION if ( sharpFormat ) sharpFormat->save(calendar); #endif if ( phoneFormat ) phoneFormat->save(calendar); iL = calendar->rawIncidences(); inc = iL.first(); Incidence* loc; @@ -1453,97 +1453,97 @@ bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a { //qDebug("addAnni "); Event * ev = new Event(); if ( a ) { ev->addAttendee( a ); } QString kind; if ( birthday ) kind = i18n( "Birthday" ); else kind = i18n( "Anniversary" ); ev->setSummary( name + " - " + kind ); ev->setOrganizer( "nobody@nowhere" ); ev->setCategories( kind ); ev->setDtStart( QDateTime(date) ); ev->setDtEnd( QDateTime(date) ); ev->setFloats( true ); Recurrence * rec = ev->recurrence(); rec->setYearly(Recurrence::rYearlyMonth,1,-1); rec->addYearlyNum( date.month() ); if ( !mCalendar->addAnniversaryNoDup( ev ) ) { delete ev; return false; } return true; } bool CalendarView::importQtopia( const QString &categories, const QString &datebook, const QString &todolist ) { QtopiaFormat qtopiaFormat; qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); updateView(); return true; #if 0 mGlobalSyncMode = SYNC_MODE_QTOPIA; mCurrentSyncDevice = "qtopia-XML"; if ( mSyncManager->mAskForPreferences ) edit_sync_options(); qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); - calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); + calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); bool syncOK = false; QtopiaFormat qtopiaFormat; qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); bool loadOk = true; if ( !categories.isEmpty() ) loadOk = qtopiaFormat.load( calendar, categories ); if ( loadOk && !datebook.isEmpty() ) loadOk = qtopiaFormat.load( calendar, datebook ); if ( loadOk && !todolist.isEmpty() ) loadOk = qtopiaFormat.load( calendar, todolist ); if ( loadOk ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); getEventViewerDialog()->setSyncMode( false ); qApp->processEvents(); if ( syncOK ) { if ( mSyncManager->mWriteBackFile ) { // write back XML file } setModified( true ); } } else { QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), question, i18n("Ok")) ; } delete calendar; updateView(); return syncOK; #endif } void CalendarView::setSyncEventsReadOnly() { Event * ev; QPtrList<Event> eL = mCalendar->rawEvents(); ev = eL.first(); while ( ev ) { if ( ev->uid().left(15) == QString("last-syncEvent-") ) ev->setReadOnly( true ); ev = eL.next(); } @@ -1956,108 +1956,108 @@ void CalendarView::writeFilterSettings(KConfig *config) } config->setGroup("General"); config->writeEntry("CalendarFilters",filterList); config->setGroup("FilterView"); config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); } void CalendarView::goToday() { mNavigator->selectToday(); } void CalendarView::goNext() { mNavigator->selectNext(); } void CalendarView::goPrevious() { mNavigator->selectPrevious(); } void CalendarView::goNextMonth() { mNavigator->selectNextMonth(); } void CalendarView::goPreviousMonth() { mNavigator->selectPreviousMonth(); } void CalendarView::writeLocale() { //KPimGlobalPrefs::instance()->setGlobalConfig(); #if 0 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); QString dummy = KOPrefs::instance()->mUserDateFormatLong; KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); dummy = KOPrefs::instance()->mUserDateFormatShort; KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, KOPrefs::instance()->mDaylightsavingStart, KOPrefs::instance()->mDaylightsavingEnd ); - KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); + KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); #endif } void CalendarView::updateConfig() { writeLocale(); if ( KOPrefs::instance()->mUseAppColors ) QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); emit configChanged(); mTodoList->updateConfig(); // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); - mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); + mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); // To make the "fill window" configurations work //mViewManager->raiseCurrentView(); } void CalendarView::eventChanged(Event *event) { changeEventDisplay(event,KOGlobals::EVENTEDITED); //updateUnmanagedViews(); } void CalendarView::eventAdded(Event *event) { changeEventDisplay(event,KOGlobals::EVENTADDED); } void CalendarView::eventToBeDeleted(Event *) { kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; } void CalendarView::eventDeleted() { changeEventDisplay(0,KOGlobals::EVENTDELETED); } void CalendarView::changeTodoDisplay(Todo *which, int action) { changeIncidenceDisplay((Incidence *)which, action); mDateNavigator->updateView(); //LR //mDialogManager->updateSearchDialog(); if (which) { mViewManager->updateWNview(); //mTodoList->updateView(); } } void CalendarView::changeIncidenceDisplay(Incidence *which, int action) { updateUnmanagedViews(); //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); if ( action == KOGlobals::EVENTDELETED ) { //delete mCalendar->checkAlarmForIncidence( 0, true ); if ( mEventViewerDialog ) mEventViewerDialog->hide(); } else @@ -2275,97 +2275,97 @@ void CalendarView::manageCategories() if ( cp->addCat() ) { count = addCategories(); if ( count ) { topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); writeSettings(); } } else { removeCategories(); updateView(); } delete cp; } void CalendarView::beamIncidence(Incidence * Inc) { QPtrList<Incidence> delSel ; delSel.append(Inc); beamIncidenceList( delSel ); } void CalendarView::beamCalendar() { QPtrList<Incidence> delSel = mCalendar->rawIncidences(); //qDebug("beamCalendar() "); beamIncidenceList( delSel ); } void CalendarView::beamFilteredCalendar() { QPtrList<Incidence> delSel = mCalendar->incidences(); //qDebug("beamFilteredCalendar() "); beamIncidenceList( delSel ); } void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) { if ( beamDialog->exec () == QDialog::Rejected ) return; #ifdef DESKTOP_VERSION QString fn = locateLocal( "tmp", "kopibeamfile" ); #else QString fn = "/tmp/kopibeamfile"; #endif QString mes; bool createbup = true; if ( createbup ) { QString description = "\n"; CalendarLocal* cal = new CalendarLocal(); if ( beamDialog->beamLocal() ) cal->setLocalTime(); else - cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); + cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); bool addText = false; if ( delSel.count() < 10 ) addText = true; else { description.sprintf(i18n(" %d items?"),delSel.count() ); } while ( incidence ) { Incidence *in = incidence->clone(); if ( ! in->summary().isEmpty() ) { in->setDescription(""); } else { in->setSummary( in->description().left(20)); in->setDescription(""); } if ( addText ) description += in->summary() + "\n"; cal->addIncidence( in ); incidence = delSel.next(); } if ( beamDialog->beamVcal() ) { fn += ".vcs"; FileStorage storage( cal, fn, new VCalFormat ); storage.save(); } else { fn += ".ics"; FileStorage storage( cal, fn, new ICalFormat( ) ); storage.save(); } delete cal; mes = i18n("KO/Pi: Ready for beaming"); topLevelWidget()->setCaption(mes); KApplication::convert2latin1( fn ); #ifndef DESKTOP_VERSION Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); ir->send( fn, description, "text/x-vCalendar" ); #endif } } void CalendarView::beamDone( Ir *ir ) { #ifndef DESKTOP_VERSION delete ir; #endif topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); topLevelWidget()->raise(); } diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index bafd349..d3aa650 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -1,89 +1,90 @@ /* This file is part of KOrganizer. Copyright (c) 1999 Preston Brown Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlistview.h> #include <qlayout.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qprogressbar.h> #include <qfileinfo.h> #include <qmessagebox.h> #include <qdialog.h> #include <qtextstream.h> #include <qdir.h> #include <qregexp.h> #include <klocale.h> #include <kdebug.h> #include <kiconloader.h> #include <kglobal.h> +#include <libkdepim/kpimglobalprefs.h> #include <libkcal/calendar.h> #include <libkcal/calendarlocal.h> #include <libkcal/icalformat.h> #include <libkcal/vcalformat.h> #include <libkcal/recurrence.h> #include <libkcal/filestorage.h> #include <libkdepim/categoryselectdialog.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif #ifndef KORG_NOPRINTER #include "calprinter.h" #endif #include "koglobals.h" #include "koprefs.h" #include "kfiledialog.h" #include "kolistview.h" ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) { mItem = item; mDate = date; } ListItemVisitor::~ListItemVisitor() { } bool ListItemVisitor::visit(Event *e) { bool ok = false; QString start, end; if ( e->doesRecur() ) { QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); if ( ok ) { int days = e->dtStart().date().daysTo(e->dtEnd().date() ); start = KGlobal::locale()->formatDate(d,true); end = KGlobal::locale()->formatDate(d.addDays( days),true); } } if ( ! ok ) { start =e->dtStartDateStr(); @@ -332,97 +333,97 @@ void KOListView::setCategories( bool removeOld ) } KOListViewItem * item, *temp; item = sel.first(); Incidence* inc; while ( item ) { inc = item->data(); if ( removeOld ) { inc->setCategories( categoriesStr ); } else { itemList = QStringList::split (",", inc->categoriesStr() ); for( i = 0; i< catList.count(); ++i ) { if ( !itemList.contains (catList[i])) itemList.append( catList[i] ); } itemList.sort(); inc->setCategories( itemList.join(",") ); } temp = item; item = sel.next(); mUidDict.remove( inc->uid() ); delete temp;; addIncidence( inc ); } } void KOListView::beamSelected() { int icount = 0; QPtrList<Incidence> delSel ; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { delSel.append(((KOListViewItem *)item)->data()); ++icount; } item = item->nextSibling(); } if ( icount ) { emit beamIncidenceList( delSel ); return; QString fn ; fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; QString mes; bool createbup = true; if ( createbup ) { QString description = "\n"; CalendarLocal* cal = new CalendarLocal(); - cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); + cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); while ( incidence ) { Incidence *in = incidence->clone(); description += in->summary() + "\n"; cal->addIncidence( in ); incidence = delSel.next(); } FileStorage storage( cal, fn, new VCalFormat ); storage.save(); delete cal; mes = i18n("KO/Pi: Ready for beaming"); topLevelWidget()->setCaption(mes); #ifndef DESKTOP_VERSION Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); ir->send( fn, description, "text/x-vCalendar" ); #endif } } } void KOListView::beamDone( Ir *ir ) { #ifndef DESKTOP_VERSION delete ir; #endif topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); } void KOListView::saveDescriptionToFile() { int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), i18n("Continue"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { return; } int icount = 0; QPtrList<Incidence> delSel ; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { delSel.append(((KOListViewItem *)item)->data()); ++icount; } @@ -483,97 +484,97 @@ void KOListView::saveDescriptionToFile() topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); return; } QTextStream ts( &file ); ts << text; file.close(); //qDebug("%s ", text.latin1()); mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); KOPrefs::instance()->mLastSaveFile = fn; topLevelWidget()->setCaption(mes); } } } void KOListView::saveToFile() { int icount = 0; QPtrList<Incidence> delSel ; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { delSel.append(((KOListViewItem *)item)->data()); ++icount; } item = item->nextSibling(); } if ( icount ) { QString fn = KOPrefs::instance()->mLastSaveFile; fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); if ( fn == "" ) return; QFileInfo info; info.setFile( fn ); QString mes; bool createbup = true; if ( info. exists() ) { mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, i18n("Overwrite!"), i18n("Cancel"), 0, 0, 1 ); if ( result != 0 ) { createbup = false; } } if ( createbup ) { CalendarLocal cal; - cal.setTimeZoneId(KOPrefs::instance()->mTimeZoneId); + cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); while ( incidence ) { cal.addIncidence( incidence->clone() ); incidence = delSel.next(); } ICalFormat format; format.save( &cal, fn ); mes = i18n("KO/Pi:Saved %1").arg(fn ); KOPrefs::instance()->mLastSaveFile = fn; topLevelWidget()->setCaption(mes); } } } void KOListView::deleteAll() { int icount = 0; QPtrList<Incidence> delSel ; QListViewItem *item = mListView->firstChild (); while ( item ) { if ( item->isSelected() ) { delSel.append(((KOListViewItem *)item)->data()); ++icount; } item = item->nextSibling(); } if ( icount ) { Incidence *incidence = delSel.first(); Incidence *toDelete; KOPrefs *p = KOPrefs::instance(); bool confirm = p->mConfirm; QString mess; mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { p->mConfirm = false; int delCounter = 0; QDialog dia ( this, "p-dialog", true ); QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); QVBoxLayout lay( &dia ); lay.setMargin(7); lay.setSpacing(7); lay.addWidget( &lab); QProgressBar bar( icount, &dia ); lay.addWidget( &bar); int w = 220; int h = 50; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 258f738..ba1c6d1 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -98,108 +98,100 @@ KOPrefs::KOPrefs() : addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); addItemBool("ShowIconNextDays",&mShowIconNextDays,true); addItemBool("ShowIconNext",&mShowIconNext,true); addItemBool("ShowIconJournal",&mShowIconJournal,true); addItemBool("ShowIconStretch",&mShowIconStretch,true); addItemBool("LanguageChanged",&mLanguageChanged,false); addItemBool("AskForQuit",&mAskForQuit,false); #ifndef DESKTOP_VERSION addItemBool("ShowFullMenu",&mShowFullMenu,false); #else addItemBool("ShowFullMenu",&mShowFullMenu,true); #endif addItemBool("ToolBarHor",&mToolBarHor, true ); addItemBool("ToolBarUp",&mToolBarUp, false ); addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); addItemInt("Whats Next Days",&mWhatsNextDays,3); addItemInt("Whats Next Prios",&mWhatsNextPrios,1); addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); addItemInt("AllDay Size",&mAllDaySize,28); QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); addItemStringList("LocationDefaults",&mLocationDefaults ); addItemStringList("EventSummary User",&mEventSummaryUser); addItemStringList("TodoSummary User",&mTodoSummaryUser); addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); addItemBool("Enable Project View",&mEnableProjectView,false); addItemBool("Auto Save",&mAutoSave,false); addItemInt("Auto Save Interval",&mAutoSaveInterval,3); addItemBool("Confirm Deletes",&mConfirm,true); addItemString("Archive File",&mArchiveFile); addItemString("Html Export File",&mHtmlExportFile, QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); addItemBool("Html With Save",&mHtmlWithSave,false); KPrefs::setCurrentGroup("Personal Settings"); addItemInt("Mail Client",&mMailClient,MailClientKMail); addItemBool("Use Control Center Email",&mEmailControlCenter,false); addItemBool("Bcc",&mBcc,false); KPrefs::setCurrentGroup("Time & Date"); - // addItemString("Time Zone",&mTimeZone,"+0100"); - addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); - // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); - addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); - addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); - addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); - addItemInt("Default Start Time",&mStartTime,10); addItemInt("Default Duration",&mDefaultDuration,2); addItemInt("Default Alarm Time",&mAlarmTime,3); - addItemInt("Daylight Savings",&mDaylightSavings,0); KPrefs::setCurrentGroup("AlarmSettings"); addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); KPrefs::setCurrentGroup("Calendar"); addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); KPrefs::setCurrentGroup("Fonts"); // qDebug(" KPrefs::setCurrentGroup(Fonts); "); addItemFont("TimeBar Font",&mTimeBarFont); addItemFont("MonthView Font",&mMonthViewFont); addItemFont("AgendaView Font",&mAgendaViewFont); addItemFont("MarcusBains Font",&mMarcusBainsFont); addItemFont("TimeLabels Font",&mTimeLabelsFont); addItemFont("TodoView Font",&mTodoViewFont); addItemFont("ListView Font",&mListViewFont); addItemFont("DateNavigator Font",&mDateNavigatorFont); addItemFont("EditBox Font",&mEditBoxFont); addItemFont("JournalView Font",&mJornalViewFont); addItemFont("WhatsNextView Font",&mWhatsNextFont); addItemFont("EventView Font",&mEventViewFont); // KPrefs::setCurrentGroup("SyncProfiles"); // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); // addItemStringList("SyncProfileNames",&mSyncProfileNames); // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); KPrefs::setCurrentGroup("RemoteSyncing"); // addItemBool("UsePasswd",&mUsePassWd,false); // addItemBool("WriteBackFile",&mWriteBackFile,true); // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); // addItemBool("AskForPreferences",&mAskForPreferences,true); // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); addItemBool("ShowSyncEvents",&mShowSyncEvents,false); addItemInt("LastSyncTime",&mLastSyncTime,0); #ifdef _WIN32_ QString hdp= locateLocal("data","korganizer")+"\\\\"; #else QString hdp= locateLocal("data","korganizer")+"/"; #endif @@ -309,97 +301,97 @@ KOPrefs::KOPrefs() : addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); KPrefs::setCurrentGroup( "Editors" ); addItemStringList( "EventTemplates", &mEventTemplates ); addItemStringList( "TodoTemplates", &mTodoTemplates ); addItemInt("DestinationPolicy",&mDestination,standardDestination); } KOPrefs::~KOPrefs() { if (mInstance == this) mInstance = insd.setObject(0); setLocaleDict( 0 ); if ( mLocaleDict ) delete mLocaleDict; //qDebug("KOPrefs::~KOPrefs() "); } KOPrefs *KOPrefs::instance() { if (!mInstance) { mInstance = insd.setObject(new KOPrefs()); mInstance->readConfig(); } return mInstance; } void KOPrefs::usrSetDefaults() { } void KOPrefs::fillMailDefaults() { if (mName.isEmpty()) mName = i18n("Anonymous"); if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); } void KOPrefs::setTimeZoneIdDefault() { - mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); + ; } void KOPrefs::setCategoryDefaults() { mCustomCategories.clear(); mCustomCategories = getDefaultList(); QStringList::Iterator it; for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { setCategoryColor(*it,mDefaultCategoryColor); } } QStringList KOPrefs::getDefaultList() { QStringList retval ; retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; retval.sort(); return retval; } void KOPrefs::usrReadConfig() { mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; mLocaleDict = 0; // pending LR fix translation // qDebug("KOPrefs::usrReadConfig() fix translation "); if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { if ( mPreferredLanguage == 1 ) { mLocaleDict = new QDict<QString>; int i = 0; QString fw ( germanwords[i] [0]); while ( !fw.isEmpty() ) { mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); ++i; fw = germanwords[i] [0]; } setLocaleDict( mLocaleDict ); } else { QString fileName ; @@ -442,100 +434,97 @@ void KOPrefs::usrReadConfig() line = text.mid( br, nbr - br ); br = nbr+1; } //qDebug("end *%s* ", end.latin1()); setLocaleDict( mLocaleDict ); } else { qDebug("KO: Cannot find translation file %s",fileName.latin1() ); } } } config()->setGroup("General"); mCustomCategories = config()->readListEntry("Custom Categories"); if ( KOPrefs::instance()->mLanguageChanged ) { mLocationDefaults.clear(); mEventSummaryUser.clear(); mTodoSummaryUser.clear(); } if (mLocationDefaults.isEmpty()) { mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") mLocationDefaults.sort(); } if (mEventSummaryUser.isEmpty()) { mEventSummaryUser = getDefaultList() ; } if (mTodoSummaryUser.isEmpty()) { mTodoSummaryUser = getDefaultList() ; } if (mCustomCategories.isEmpty()) setCategoryDefaults(); config()->setGroup("Personal Settings"); mName = config()->readEntry("user_name",""); mEmail = config()->readEntry("user_email",""); fillMailDefaults(); config()->setGroup("Category Colors"); QStringList::Iterator it; for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); } - - if (mTimeZoneId.isEmpty()) { - setTimeZoneIdDefault(); - } + KPimPrefs::usrReadConfig(); } void KOPrefs::usrWriteConfig() { config()->setGroup("General"); config()->writeEntry("Custom Categories",mCustomCategories); config()->setGroup("Personal Settings"); config()->writeEntry("user_name",mName); config()->writeEntry("user_email",mEmail); config()->setGroup("Category Colors"); QDictIterator<QColor> it(mCategoryColors); while (it.current()) { config()->writeEntry(it.currentKey(),*(it.current())); ++it; } KPimPrefs::usrWriteConfig(); } void KOPrefs::setCategoryColor(QString cat,const QColor & color) { mCategoryColors.replace(cat,new QColor(color)); } QColor *KOPrefs::categoryColor(QString cat) { QColor *color = 0; if (!cat.isEmpty()) color = mCategoryColors[cat]; if (color) return color; else return &mDefaultCategoryColor; } void KOPrefs::setFullName(const QString &name) { mName = name; } void KOPrefs::setEmail(const QString &email) { //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); mEmail = email; diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 03df59b..c74b0ef 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -50,103 +50,99 @@ class KOPrefs : public KPimPrefs /** Set preferences to default values */ void usrSetDefaults(); /** Read preferences from config file */ void usrReadConfig(); /** Write preferences to config file */ void usrWriteConfig(); void setCategoryDefaults(); protected: void setTimeZoneIdDefault(); /** Fill empty mail fields with default values. */ void fillMailDefaults(); private: /** Constructor disabled for public. Use instance() to create a KOPrefs object. */ KOPrefs(); static KOPrefs *mInstance; QDict<QString> *mLocaleDict; QStringList getDefaultList(); public: // preferences data KConfig* getConfig(); void setFullName(const QString &); QString fullName(); void setEmail(const QString &); QString email(); QString mAdditional; bool mEmailControlCenter; bool mBcc; bool mAutoSave; int mAutoSaveInterval; bool mConfirm; bool mEnableGroupScheduling; bool mEnableProjectView; int mDefaultFormat; int mMailClient; - QString mTimeZone; - //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius - //int mTimeZoneOffset; // e.g. -240 min int mStartTime; int mDefaultDuration; int mAlarmTime; - int mDaylightSavings; int mWorkingHoursStart; int mWorkingHoursEnd; bool mExcludeHolidays; bool mExcludeSaturdays; bool mMarcusBainsShowSeconds; QFont mTimeBarFont; QFont mMonthViewFont; QFont mAgendaViewFont; QFont mMarcusBainsFont; QFont mTimeLabelsFont; QFont mTodoViewFont; QFont mListViewFont; QFont mDateNavigatorFont; QFont mEditBoxFont; QFont mJornalViewFont; QFont mWhatsNextFont; QFont mEventViewFont; QColor mHolidayColor; QColor mHighlightColor; QColor mEventColor; QColor mAgendaBgColor; QColor mWorkingHoursColor; QColor mTodoDueTodayColor; QColor mTodoOverdueColor; QColor mMonthViewEvenColor; QColor mMonthViewOddColor; QColor mMonthViewHolidayColor; bool mMonthViewUsesDayColors; bool mMonthViewSatSunTog; QColor mAppColor1; QColor mAppColor2; bool mUseAppColors; int mDayBegins; int mHourSize; int mAllDaySize; bool mShowFullMenu; bool mDailyRecur; bool mWeeklyRecur; bool mMonthDailyRecur; bool mMonthWeeklyRecur; bool mMonthShowIcons; @@ -226,67 +222,62 @@ class KOPrefs : public KPimPrefs QStringList mTodoTemplates; QStringList mEventTemplates; int mDestination; bool mEditOnDoubleClick; bool mViewChangeHoldFullscreen; bool mViewChangeHoldNonFullscreen; bool mCenterOnCurrentTime; bool mSetTimeToDayStartAt; bool mHighlightCurrentDay; bool mUseHighlightLightColor; bool mListViewMonthTimespan; bool mWNViewShowsParents; bool mWNViewShowLocation; bool mTodoViewShowsPercentage; bool mTodoViewUsesCatColors; bool mTodoViewUsesSmallFont; bool mTodoViewUsesForegroundColor; bool mMonthViewUsesForegroundColor; bool mHightlightDateTimeEdit; bool mShortDateInViewer; QStringList mLocationDefaults; QStringList mEventSummaryUser; QStringList mTodoSummaryUser; bool mUseInternalAlarmNotification; int mAlarmPlayBeeps; int mAlarmSuspendTime; int mAlarmSuspendCount; int mAlarmBeepInterval; QString mActiveSyncPort; QString mActiveSyncIP; //US I copied the following settings into KPimGlobalPrefs // that allows us later to easily remove the settings from here. int mPreferredDate; QString mUserDateFormatLong; QString mUserDateFormatShort; int mPreferredLanguage; int mPreferredTime; bool mWeekStartsOnSunday; - QString mTimeZoneId; - bool mUseDaylightsaving; - int mDaylightsavingStart; - int mDaylightsavingEnd; - private: QDict<QColor> mCategoryColors; QColor mDefaultCategoryColor; QFont mDefaultTimeBarFont; QFont mDefaultViewFont; QFont mDefaultMonthViewFont; QString mName; QString mEmail; }; #endif |