author | zautrix <zautrix> | 2004-08-09 12:44:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-09 12:44:25 (UTC) |
commit | 48f53b2d2e7ed189e88f924259693ab66ff44b7f (patch) (side-by-side diff) | |
tree | 19bcb263aef667ee236b4d49cea89985331805bd | |
parent | e0ba2d4770094974ec4a2a48af436a7df9a055bc (diff) | |
download | kdepimpi-48f53b2d2e7ed189e88f924259693ab66ff44b7f.zip kdepimpi-48f53b2d2e7ed189e88f924259693ab66ff44b7f.tar.gz kdepimpi-48f53b2d2e7ed189e88f924259693ab66ff44b7f.tar.bz2 |
recurrence fixes
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 32 |
2 files changed, 25 insertions, 9 deletions
@@ -1,159 +1,159 @@ ############################################################################# # Makefile for building: kopi-desktop -# Generated by qmake (1.07a) (Qt 3.3.3) on: Mon Aug 9 12:10:32 2004 +# Generated by qmake (1.07a) (Qt 3.3.3) on: Mon Aug 9 13:18:13 2004 # Project: kopi-desktop.pro # Template: subdirs # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro ############################################################################# MAKEFILE = Makefile QMAKE = qmake DEL_FILE = rm -f CHK_DIR_EXISTS= test -d MKDIR = mkdir -p INSTALL_FILE= INSTALL_DIR = SUBTARGETS = \ sub-gammu-emb-common \ sub-libical \ sub-libkcal \ sub-microkde \ sub-libkdepim \ sub-kabc \ sub-korganizer \ sub-kaddressbook \ sub-kabc-plugins-file \ sub-kabc-plugins-dir first: all all: Makefile $(SUBTARGETS) gammu/emb/common/$(MAKEFILE): @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) libical/$(MAKEFILE): @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-libical: libical/$(MAKEFILE) FORCE cd libical && $(MAKE) -f $(MAKEFILE) libkcal/$(MAKEFILE): @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-libkcal: libkcal/$(MAKEFILE) FORCE cd libkcal && $(MAKE) -f $(MAKEFILE) microkde/$(MAKEFILE): @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-microkde: microkde/$(MAKEFILE) FORCE cd microkde && $(MAKE) -f $(MAKEFILE) libkdepim/$(MAKEFILE): @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim" cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-libkdepim: libkdepim/$(MAKEFILE) FORCE cd libkdepim && $(MAKE) -f $(MAKEFILE) kabc/$(MAKEFILE): @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc" cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-kabc: kabc/$(MAKEFILE) FORCE cd kabc && $(MAKE) -f $(MAKEFILE) korganizer/$(MAKEFILE): @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer" cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-korganizer: korganizer/$(MAKEFILE) FORCE cd korganizer && $(MAKE) -f $(MAKEFILE) kaddressbook/$(MAKEFILE): @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook" cd kaddressbook && $(QMAKE) kaddressbook.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE cd kaddressbook && $(MAKE) -f $(MAKEFILE) kabc/plugins/file/$(MAKEFILE): @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" cd kabc/plugins/file && $(QMAKE) file.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) kabc/plugins/dir/$(MAKEFILE): @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir" cd kabc/plugins/dir && $(QMAKE) dir.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE) Makefile: kopi-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro qmake: qmake_all @$(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro all: $(SUBTARGETS) qmake_all: gammu/emb/common/$(MAKEFILE) libical/$(MAKEFILE) libkcal/$(MAKEFILE) microkde/$(MAKEFILE) libkdepim/$(MAKEFILE) kabc/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE) ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true uninstall_subdirs: qmake_all FORCE ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true install_subdirs: qmake_all FORCE ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true distclean: qmake_all FORCE ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true install: install_subdirs uninstall: uninstall_subdirs FORCE: diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index bc1b863..596148e 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp @@ -154,447 +154,463 @@ public: #if 0 // not supported printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); #endif break; } } QString alarmString = "na"; if ( alarm ) { Alarm *alarm; if ( todo->alarms().count() > 0 ) alarm = todo->alarms().first(); else { alarm = new Alarm( todo ); todo->addAlarm( alarm ); } alarm->setType( Alarm::Audio ); alarm->setEnabled( true ); int alarmOffset = alarmDt.secsTo( todo->dtStart() ); alarm->setStartOffset( -alarmOffset ); alarmString = QString::number( alarmOffset ); } else { Alarm *alarm; if ( todo->alarms().count() > 0 ) { alarm = todo->alarms().first(); alarm->setType( Alarm::Audio ); alarm->setStartOffset( -60*15 ); alarm->setEnabled( false ); } } // csum ***************************************** QStringList attList; uint cSum; if ( todo->hasDueDate() ) attList << dtToString ( todo->dtDue() ); attList << QString::number( id ); attList << todo->summary(); attList << completedString; attList << QString::number( todo->priority() ); attList << alarmString; attList << todo->categoriesStr(); attList << todo->secrecyStr(); cSum = PhoneFormat::getCsum(attList ); todo->setCsum( mProfileName, QString::number( cSum )); mCalendar->addTodo( todo); return true; } bool readEvent( Calendar *existingCalendar, GSM_CalendarEntry* Note) { int id = Note->Location; Event *event; event = existingCalendar->event( mProfileName ,QString::number( id ) ); if ( event ) event = (Event*)event->clone(); else event = new Event; event->setID( mProfileName,QString::number( id ) ); event->setTempSyncStat(SYNC_TEMPSTATE_NEW_EXTERNAL ); int i = 0; bool repeating = false; int repeat_dayofweek = -1; int repeat_day = -1; int repeat_weekofmonth = -1; int repeat_month = -1; int repeat_frequency = -1; int rec_type = -1; GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; GSM_DateTime* dtp; bool alarm = false; QDateTime alarmDt; repeat_startdate.Day = 0; repeat_stopdate.Day = 0; for (i=0;i<Note->EntriesNum;i++) { //qDebug(" for ev"); switch (Note->Entries[i].EntryType) { case CAL_START_DATETIME: dtp = &Note->Entries[i].Date ; if ( dtp->Hour > 24 ) { event->setFloats( true ); event->setDtStart( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); } else { event->setDtStart (fromGSM ( dtp )); } break; case CAL_END_DATETIME: dtp = &Note->Entries[i].Date ; if ( dtp->Hour > 24 ) { event->setFloats( true ); event->setDtEnd( QDateTime (datefromGSM ( dtp ), QTime(0,0,0 ))); } else { event->setDtEnd (fromGSM ( dtp )); } break; case CAL_ALARM_DATETIME: dtp = &Note->Entries[i].Date ; alarm = true; alarmDt = fromGSM ( dtp ); break; case CAL_SILENT_ALARM_DATETIME: dtp = &Note->Entries[i].Date ; alarm = true; alarmDt = fromGSM ( dtp ); break; case CAL_RECURRANCE: rec_type = Note->Entries[i].Number; //printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24,((Note->Entries[i].Number/24)>1) ? "s":"" ); break; case CAL_TEXT: //qDebug(" ev text %s", DecodeUnicodeConsole(Note->Entries[i].Text) ); event->setSummary( QString::fromUtf8 ( (const char*)DecodeUnicodeConsole( Note->Entries[i].Text ))); break; case CAL_LOCATION: event->setLocation(QString::fromUtf8 ((const char*) DecodeUnicodeConsole(Note->Entries[i].Text) )); break; case CAL_PHONE: //printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); break; case CAL_PRIVATE: if ( Note->Entries[i].Number == 1 ) event->setSecrecy( Incidence::SecrecyPrivate ); else event->setSecrecy( Incidence::SecrecyPublic ); break; case CAL_CONTACTID: #if 0 entry.Location = Note->Entries[i].Number; entry.MemoryType = MEM_ME; error=Phone->GetMemory(&s, &entry); if (error == ERR_NONE) { name = GSM_PhonebookGetEntryName(&entry); if (name != NULL) { //printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); } else { //printmsg("Contact ID : %d\n",Note->Entries[i].Number); } } else { //printmsg("Contact ID : %d\n",Note->Entries[i].Number); } #endif break; case CAL_REPEAT_DAYOFWEEK: repeat_dayofweek = Note->Entries[i].Number; repeating = true; break; case CAL_REPEAT_DAY: repeat_day = Note->Entries[i].Number; repeating = true; break; case CAL_REPEAT_WEEKOFMONTH: repeat_weekofmonth = Note->Entries[i].Number; repeating = true; break; case CAL_REPEAT_MONTH: repeat_month = Note->Entries[i].Number; repeating = true; break; case CAL_REPEAT_FREQUENCY: repeat_frequency = Note->Entries[i].Number; repeating = true; break; case CAL_REPEAT_STARTDATE: repeat_startdate = Note->Entries[i].Date; repeating = true; break; case CAL_REPEAT_STOPDATE: repeat_stopdate = Note->Entries[i].Date; repeating = true; break; } } #if 0 event->setDescription( attList[4] ); bool repeating = false; int repeat_dayofweek = -1; int repeat_day = -1; int repeat_weekofmonth = -1; int repeat_month = -1; int repeat_frequency = -1; GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; #endif QString recurString = "no"; - if ( repeating ) { + if ( repeating && repeat_frequency != -1) { recurString = "y"; if ( repeat_dayofweek >= 0 ) recurString += "dow" + QString::number (repeat_dayofweek); if ( repeat_day >= 0 ) recurString += "d" + QString::number (repeat_day); if ( repeat_weekofmonth >= 0 ) recurString += "w" + QString::number (repeat_weekofmonth); if ( repeat_month >= 0 ) recurString += "m" + QString::number ( repeat_month ); if ( repeat_frequency >= 0 ) recurString += "f" + QString::number (repeat_frequency ); int rtype = 0; // qDebug("recurs "); QDate startDate, endDate; - if ( repeat_startdate.Day > 0 ) + if ( repeat_startdate.Day > 0 ) { startDate = datefromGSM ( &repeat_startdate ); - else + event->setDtStart(QDateTime ( startDate, event->dtStart().time())); + } else { startDate = event->dtStart().date(); + } int freq = repeat_frequency; bool hasEndDate = false; if ( repeat_stopdate.Day > 0 ) { endDate = datefromGSM ( &repeat_stopdate ); hasEndDate = true; } uint weekDaysNum = repeat_dayofweek ; - + // 1 == monday, 7 == sunday QBitArray weekDays( 7 ); int i; int bb = 1; for( i = 1; i <= 7; ++i ) { weekDays.setBit( i - 1, ( bb & weekDaysNum )); bb = 2 << (i-1); //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); } // qDebug("next "); int pos = 0; Recurrence *r = event->recurrence(); /* 0 daily; 1 weekly;x 2 monthpos;x 3 monthlyday; 4 rYearlyMont bool repeating = false; int repeat_dayofweek = -1; int repeat_day = -1; int repeat_weekofmonth = -1; int repeat_month = -1; int repeat_frequency = -1; */ int dayOfWeek = startDate.dayOfWeek(); if ( repeat_weekofmonth >= 0 ) { - rtype = 2; + rtype = 2; // ************************ 2 MonthlyPos pos = repeat_weekofmonth; if ( repeat_dayofweek >= 0 ) dayOfWeek = repeat_dayofweek; + if (repeat_month > 0) { + if ( repeat_month != event->dtStart().date().month() ) { + QDate date (event->dtStart().date().year(),repeat_month,event->dtStart().date().day() ); + event->setDtStart(QDateTime ( date , event->dtStart().time()) ); + } + if ( freq == 1 ) + freq = 12; + } } else if ( repeat_dayofweek >= 0 ) { - rtype = 1; - } if ( repeat_dayofweek >= 0 ) { - rtype = 1; + rtype = 1;// ************************ 1 Weekly + } else if ( repeat_day >= 0 ) { + if ( repeat_month > 0) { + rtype = 4; + } else { + rtype = 3; + } + } else { + rtype = 0 ; } if ( rtype == 0 ) { if ( hasEndDate ) r->setDaily( freq, endDate ); else r->setDaily( freq, -1 ); } else if ( rtype == 1 ) { if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); else r->setWeekly( freq, weekDays, -1 ); } else if ( rtype == 3 ) { if ( hasEndDate ) r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); else r->setMonthly( Recurrence::rMonthlyDay, freq, -1 ); r->addMonthlyDay( startDate.day() ); } else if ( rtype == 2 ) { if ( hasEndDate ) r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); else r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); QBitArray days( 7 ); days.fill( false ); days.setBit( dayOfWeek - 1 ); r->addMonthlyPos( pos, days ); } else if ( rtype == 4 ) { if ( hasEndDate ) r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); else r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); r->addYearlyNum( startDate.month() ); } } else { event->recurrence()->unsetRecurs(); } QStringList categoryList; categoryList << getCategory( Note ); event->setCategories( categoryList ); QString alarmString = "na"; // strange 0 semms to mean: alarm enabled if ( alarm ) { Alarm *alarm; if ( event->alarms().count() > 0 ) alarm = event->alarms().first(); else { alarm = new Alarm( event ); event->addAlarm( alarm ); } alarm->setType( Alarm::Audio ); alarm->setEnabled( true ); int alarmOffset = alarmDt.secsTo( event->dtStart() ); alarm->setStartOffset( -alarmOffset ); alarmString = QString::number( alarmOffset ); } else { Alarm *alarm; if ( event->alarms().count() > 0 ) { alarm = event->alarms().first(); alarm->setType( Alarm::Audio ); alarm->setStartOffset( -60*15 ); alarm->setEnabled( false ); } } // csum ***************************************** QStringList attList; uint cSum; attList << dtToString ( event->dtStart() ); attList << dtToString ( event->dtEnd() ); attList << QString::number( id ); attList << event->summary(); attList << event->location(); attList << alarmString; attList << recurString; attList << event->categoriesStr(); attList << event->secrecyStr(); cSum = PhoneFormat::getCsum(attList ); event->setCsum( mProfileName, QString::number( cSum )); mCalendar->addEvent( event); return true; } QDateTime fromGSM ( GSM_DateTime* dtp, bool useTz = true ) { QDateTime dt; int y,m,t,h,min,sec; y = dtp->Year; m = dtp->Month; t = dtp->Day; h = dtp->Hour; min = dtp->Minute; sec = dtp->Second; dt = QDateTime(QDate(y,m,t), QTime(h,min,sec)); // dtp->Timezone: offset in hours int offset = KGlobal::locale()->localTimeOffset( dt ); if ( useTz ) dt = dt.addSecs ( offset*60); return dt; } QString dtToString( const QDateTime& dti, bool useTZ = false ) { QString datestr; QString timestr; int offset = KGlobal::locale()->localTimeOffset( dti ); QDateTime dt; if (useTZ) dt = dti.addSecs ( -(offset*60)); else dt = dti; if(dt.date().isValid()){ const QDate& date = dt.date(); datestr.sprintf("%04d%02d%02d", date.year(), date.month(), date.day()); } if(dt.time().isValid()){ const QTime& time = dt.time(); timestr.sprintf("T%02d%02d%02d", time.hour(), time.minute(), time.second()); } return datestr + timestr; } QDate datefromGSM ( GSM_DateTime* dtp ) { return QDate ( dtp->Year, dtp->Month, dtp->Day ); } QString getCategory( GSM_CalendarEntry* Note) { QString CATEGORY; switch (Note->Type) { case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; case GSM_CAL_CALL : CATEGORY = QString("Call"); break; case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; case GSM_CAL_T_HOCK : CATEGORY = QString("Training/Hockey"); break; case GSM_CAL_T_RACE : CATEGORY = QString("Training/Races"); break; case GSM_CAL_T_RUGB : CATEGORY = QString("Training/Rugby"); break; case GSM_CAL_T_SAIL : CATEGORY = QString("Training/Sailing"); break; case GSM_CAL_T_STRE : CATEGORY = QString("Training/Street Games"); break; case GSM_CAL_T_SWIM : CATEGORY = QString("Training/Swimming"); break; case GSM_CAL_T_TENN : CATEGORY = QString("Training/Tennis"); break; case GSM_CAL_T_TRAV : CATEGORY = QString("Training/Travels"); break; case GSM_CAL_T_WINT : CATEGORY = QString("Training/Winter Games"); break; default : CATEGORY = QString(""); } return CATEGORY; } protected: private: Calendar *mCalendar; QString mProfileName ; }; PhoneFormat::PhoneFormat() { ; } PhoneFormat::~PhoneFormat() { } ulong PhoneFormat::getCsum( const QStringList & attList) { int max = attList.count() -1; ulong cSum = 0; int j,k,i; int add; for ( i = 1; i < max ; ++i ) { QString s = attList[i]; if ( ! s.isEmpty() ){ j = s.length(); for ( k = 0; k < j; ++k ) { int mul = k +1; add = s[k].unicode (); if ( k < 16 ) mul = mul * mul; |