diff options
Diffstat (limited to 'kresources/kolab/kcal/incidence.cpp')
-rw-r--r-- | kresources/kolab/kcal/incidence.cpp | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/kresources/kolab/kcal/incidence.cpp b/kresources/kolab/kcal/incidence.cpp index 8c74e3bdf..74f41fd8d 100644 --- a/kresources/kolab/kcal/incidence.cpp +++ b/kresources/kolab/kcal/incidence.cpp @@ -34,8 +34,8 @@ #include "incidence.h" #include "resourcekolab.h" -#include <qfile.h> -#include <qvaluelist.h> +#include <tqfile.h> +#include <tqvaluelist.h> #include <libkcal/journal.h> #include <korganizer/version.h> @@ -47,8 +47,8 @@ using namespace Kolab; -Incidence::Incidence( KCal::ResourceKolab *res, const QString &subResource, Q_UINT32 sernum, - const QString& tz ) +Incidence::Incidence( KCal::ResourceKolab *res, const TQString &subResource, Q_UINT32 sernum, + const TQString& tz ) : KolabBase( tz ), mFloatingStatus( Unset ), mHasAlarm( false ), mRevision( 0 ), mResource( res ), @@ -61,22 +61,22 @@ Incidence::~Incidence() { } -void Incidence::setSummary( const QString& summary ) +void Incidence::setSummary( const TQString& summary ) { mSummary = summary; } -QString Incidence::summary() const +TQString Incidence::summary() const { return mSummary; } -void Incidence::setLocation( const QString& location ) +void Incidence::setLocation( const TQString& location ) { mLocation = location; } -QString Incidence::location() const +TQString Incidence::location() const { return mLocation; } @@ -91,7 +91,7 @@ KolabBase::Email Incidence::organizer() const return mOrganizer; } -void Incidence::setStartDate( const QDateTime& startDate ) +void Incidence::setStartDate( const TQDateTime& startDate ) { mStartDate = startDate; if ( mFloatingStatus == AllDay ) @@ -99,7 +99,7 @@ void Incidence::setStartDate( const QDateTime& startDate ) mFloatingStatus = HasTime; } -void Incidence::setStartDate( const QDate& startDate ) +void Incidence::setStartDate( const TQDate& startDate ) { mStartDate = startDate; if ( mFloatingStatus == HasTime ) @@ -107,7 +107,7 @@ void Incidence::setStartDate( const QDate& startDate ) mFloatingStatus = AllDay; } -void Incidence::setStartDate( const QString& startDate ) +void Incidence::setStartDate( const TQString& startDate ) { if ( startDate.length() > 10 ) // This is a date + time @@ -117,7 +117,7 @@ void Incidence::setStartDate( const QString& startDate ) setStartDate( stringToDate( startDate ) ); } -QDateTime Incidence::startDate() const +TQDateTime Incidence::startDate() const { return mStartDate; } @@ -143,22 +143,22 @@ void Incidence::addAttendee( const Attendee& attendee ) mAttendees.append( attendee ); } -QValueList<Incidence::Attendee>& Incidence::attendees() +TQValueList<Incidence::Attendee>& Incidence::attendees() { return mAttendees; } -const QValueList<Incidence::Attendee>& Incidence::attendees() const +const TQValueList<Incidence::Attendee>& Incidence::attendees() const { return mAttendees; } -void Incidence::setInternalUID( const QString& iuid ) +void Incidence::setInternalUID( const TQString& iuid ) { mInternalUID = iuid; } -QString Incidence::internalUID() const +TQString Incidence::internalUID() const { return mInternalUID; } @@ -173,15 +173,15 @@ int Incidence::revision() const return mRevision; } -bool Incidence::loadAttendeeAttribute( QDomElement& element, +bool Incidence::loadAttendeeAttribute( TQDomElement& element, Attendee& attendee ) { - for ( QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { + for ( TQDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { if ( n.isComment() ) continue; if ( n.isElement() ) { - QDomElement e = n.toElement(); - QString tagName = e.tagName(); + TQDomElement e = n.toElement(); + TQString tagName = e.tagName(); if ( tagName == "display-name" ) attendee.displayName = e.text(); @@ -212,10 +212,10 @@ bool Incidence::loadAttendeeAttribute( QDomElement& element, return true; } -void Incidence::saveAttendeeAttribute( QDomElement& element, +void Incidence::saveAttendeeAttribute( TQDomElement& element, const Attendee& attendee ) const { - QDomElement e = element.ownerDocument().createElement( "attendee" ); + TQDomElement e = element.ownerDocument().createElement( "attendee" ); element.appendChild( e ); writeString( e, "display-name", attendee.displayName ); writeString( e, "smtp-address", attendee.smtpAddress ); @@ -229,14 +229,14 @@ void Incidence::saveAttendeeAttribute( QDomElement& element, writeString( e, "delegated-from", attendee.delegator ); } -void Incidence::saveAttendees( QDomElement& element ) const +void Incidence::saveAttendees( TQDomElement& element ) const { - QValueList<Attendee>::ConstIterator it = mAttendees.begin(); + TQValueList<Attendee>::ConstIterator it = mAttendees.begin(); for ( ; it != mAttendees.end(); ++it ) saveAttendeeAttribute( element, *it ); } -void Incidence::saveAttachments( QDomElement& element ) const +void Incidence::saveAttachments( TQDomElement& element ) const { KCal::Attachment::List::ConstIterator it = mAttachments.begin(); for ( ; it != mAttachments.end(); ++it ) { @@ -249,15 +249,15 @@ void Incidence::saveAttachments( QDomElement& element ) const } } -void Incidence::saveRecurrence( QDomElement& element ) const +void Incidence::saveRecurrence( TQDomElement& element ) const { - QDomElement e = element.ownerDocument().createElement( "recurrence" ); + TQDomElement e = element.ownerDocument().createElement( "recurrence" ); element.appendChild( e ); e.setAttribute( "cycle", mRecurrence.cycle ); if ( !mRecurrence.type.isEmpty() ) e.setAttribute( "type", mRecurrence.type ); - writeString( e, "interval", QString::number( mRecurrence.interval ) ); - for( QStringList::ConstIterator it = mRecurrence.days.begin(); it != mRecurrence.days.end(); ++it ) { + writeString( e, "interval", TQString::number( mRecurrence.interval ) ); + for( TQStringList::ConstIterator it = mRecurrence.days.begin(); it != mRecurrence.days.end(); ++it ) { writeString( e, "day", *it ); } if ( !mRecurrence.dayNumber.isEmpty() ) @@ -265,29 +265,29 @@ void Incidence::saveRecurrence( QDomElement& element ) const if ( !mRecurrence.month.isEmpty() ) writeString( e, "month", mRecurrence.month ); if ( !mRecurrence.rangeType.isEmpty() ) { - QDomElement range = element.ownerDocument().createElement( "range" ); + TQDomElement range = element.ownerDocument().createElement( "range" ); e.appendChild( range ); range.setAttribute( "type", mRecurrence.rangeType ); - QDomText t = element.ownerDocument().createTextNode( mRecurrence.range ); + TQDomText t = element.ownerDocument().createTextNode( mRecurrence.range ); range.appendChild( t ); } - for( QValueList<QDate>::ConstIterator it = mRecurrence.exclusions.begin(); + for( TQValueList<TQDate>::ConstIterator it = mRecurrence.exclusions.begin(); it != mRecurrence.exclusions.end(); ++it ) { writeString( e, "exclusion", dateToString( *it ) ); } } -void Incidence::loadRecurrence( const QDomElement& element ) +void Incidence::loadRecurrence( const TQDomElement& element ) { mRecurrence.interval = 0; mRecurrence.cycle = element.attribute( "cycle" ); mRecurrence.type = element.attribute( "type" ); - for ( QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { + for ( TQDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { if ( n.isComment() ) continue; if ( n.isElement() ) { - QDomElement e = n.toElement(); - QString tagName = e.tagName(); + TQDomElement e = n.toElement(); + TQString tagName = e.tagName(); if ( tagName == "interval" ) mRecurrence.interval = e.text().toInt(); @@ -309,9 +309,9 @@ void Incidence::loadRecurrence( const QDomElement& element ) } } -bool Incidence::loadAttribute( QDomElement& element ) +bool Incidence::loadAttribute( TQDomElement& element ) { - QString tagName = element.tagName(); + TQString tagName = element.tagName(); if ( tagName == "summary" ) setSummary( element.text() ); @@ -355,7 +355,7 @@ bool Incidence::loadAttribute( QDomElement& element ) // Unhandled tag - save for later storage kdDebug() << "Saving unhandled tag " << element.tagName() << endl; Custom c; - c.key = QCString( "X-KDE-KolabUnhandled-" ) + element.tagName().latin1(); + c.key = TQCString( "X-KDE-KolabUnhandled-" ) + element.tagName().latin1(); c.value = element.text(); mCustomList.append( c ); } @@ -364,7 +364,7 @@ bool Incidence::loadAttribute( QDomElement& element ) return true; } -bool Incidence::saveAttributes( QDomElement& element ) const +bool Incidence::saveAttributes( TQDomElement& element ) const { // Save the base class elements KolabBase::saveAttributes( element ); @@ -383,26 +383,26 @@ bool Incidence::saveAttributes( QDomElement& element ) const if ( mHasAlarm ) { // Alarms should be minutes before. Libkcal uses event time + alarm time int alarmTime = qRound( -alarm() ); - writeString( element, "alarm", QString::number( alarmTime ) ); + writeString( element, "alarm", TQString::number( alarmTime ) ); } writeString( element, "x-kde-internaluid", internalUID() ); - writeString( element, "revision", QString::number( revision() ) ); + writeString( element, "revision", TQString::number( revision() ) ); saveCustomAttributes( element ); return true; } -void Incidence::saveCustomAttributes( QDomElement& element ) const +void Incidence::saveCustomAttributes( TQDomElement& element ) const { - QValueList<Custom>::ConstIterator it = mCustomList.begin(); + TQValueList<Custom>::ConstIterator it = mCustomList.begin(); for ( ; it != mCustomList.end(); ++it ) { - QString key = (*it).key; + TQString key = (*it).key; Q_ASSERT( !key.isEmpty() ); if ( key.startsWith( "X-KDE-KolabUnhandled-" ) ) { key = key.mid( strlen( "X-KDE-KolabUnhandled-" ) ); writeString( element, key, (*it).value ); } else { // Let's use attributes so that other tag-preserving-code doesn't need sub-elements - QDomElement e = element.ownerDocument().createElement( "x-custom" ); + TQDomElement e = element.ownerDocument().createElement( "x-custom" ); element.appendChild( e ); e.setAttribute( "key", key ); e.setAttribute( "value", (*it).value ); @@ -410,7 +410,7 @@ void Incidence::saveCustomAttributes( QDomElement& element ) const } } -void Incidence::loadCustomAttributes( QDomElement& element ) +void Incidence::loadCustomAttributes( TQDomElement& element ) { Custom custom; custom.key = element.attribute( "key" ).latin1(); @@ -418,7 +418,7 @@ void Incidence::loadCustomAttributes( QDomElement& element ) mCustomList.append( custom ); } -static KCal::Attendee::PartStat attendeeStringToStatus( const QString& s ) +static KCal::Attendee::PartStat attendeeStringToStatus( const TQString& s ) { if ( s == "none" ) return KCal::Attendee::NeedsAction; @@ -433,7 +433,7 @@ static KCal::Attendee::PartStat attendeeStringToStatus( const QString& s ) return KCal::Attendee::Accepted; } -static QString attendeeStatusToString( KCal::Attendee::PartStat status ) +static TQString attendeeStatusToString( KCal::Attendee::PartStat status ) { switch( status ) { case KCal::Attendee::NeedsAction: @@ -456,7 +456,7 @@ static QString attendeeStatusToString( KCal::Attendee::PartStat status ) return "accepted"; } -static KCal::Attendee::Role attendeeStringToRole( const QString& s ) +static KCal::Attendee::Role attendeeStringToRole( const TQString& s ) { if ( s == "optional" ) return KCal::Attendee::OptParticipant; @@ -465,7 +465,7 @@ static KCal::Attendee::Role attendeeStringToRole( const QString& s ) return KCal::Attendee::ReqParticipant; } -static QString attendeeRoleToString( KCal::Attendee::Role role ) +static TQString attendeeRoleToString( KCal::Attendee::Role role ) { switch( role ) { case KCal::Attendee::ReqParticipant: @@ -511,7 +511,7 @@ void Incidence::setRecurrence( KCal::Recurrence* recur ) case KCal::Recurrence::rWeekly: // every X weeks mRecurrence.cycle = "weekly"; { - QBitArray arr = recur->days(); + TQBitArray arr = recur->days(); for ( uint idx = 0 ; idx < 7 ; ++idx ) if ( arr.testBit( idx ) ) mRecurrence.days.append( s_weekDayName[idx] ); @@ -520,11 +520,11 @@ void Incidence::setRecurrence( KCal::Recurrence* recur ) case KCal::Recurrence::rMonthlyPos: { mRecurrence.cycle = "monthly"; mRecurrence.type = "weekday"; - QValueList<KCal::RecurrenceRule::WDayPos> monthPositions = recur->monthPositions(); + TQValueList<KCal::RecurrenceRule::WDayPos> monthPositions = recur->monthPositions(); if ( !monthPositions.isEmpty() ) { KCal::RecurrenceRule::WDayPos monthPos = monthPositions.first(); // TODO: Handle multiple days in the same week - mRecurrence.dayNumber = QString::number( monthPos.pos() ); + mRecurrence.dayNumber = TQString::number( monthPos.pos() ); mRecurrence.days.append( s_weekDayName[ monthPos.day()-1 ] ); // Not (properly) handled(?): monthPos.negative (nth days before end of month) } @@ -533,20 +533,20 @@ void Incidence::setRecurrence( KCal::Recurrence* recur ) case KCal::Recurrence::rMonthlyDay: { mRecurrence.cycle = "monthly"; mRecurrence.type = "daynumber"; - QValueList<int> monthDays = recur->monthDays(); + TQValueList<int> monthDays = recur->monthDays(); // ####### Kolab XML limitation: only the first month day is used if ( !monthDays.isEmpty() ) - mRecurrence.dayNumber = QString::number( monthDays.first() ); + mRecurrence.dayNumber = TQString::number( monthDays.first() ); break; } case KCal::Recurrence::rYearlyMonth: // (day n of Month Y) { mRecurrence.cycle = "yearly"; mRecurrence.type = "monthday"; - QValueList<int> rmd = recur->yearDates(); + TQValueList<int> rmd = recur->yearDates(); int day = !rmd.isEmpty() ? rmd.first() : recur->startDate().day(); - mRecurrence.dayNumber = QString::number( day ); - QValueList<int> months = recur->yearMonths(); + mRecurrence.dayNumber = TQString::number( day ); + TQValueList<int> months = recur->yearMonths(); if ( !months.isEmpty() ) mRecurrence.month = s_monthName[ months.first() - 1 ]; // #### Kolab XML limitation: only one month specified break; @@ -554,22 +554,22 @@ void Incidence::setRecurrence( KCal::Recurrence* recur ) case KCal::Recurrence::rYearlyDay: // YearlyDay (day N of the year). Not supported by Outlook mRecurrence.cycle = "yearly"; mRecurrence.type = "yearday"; - mRecurrence.dayNumber = QString::number( recur->yearDays().first() ); + mRecurrence.dayNumber = TQString::number( recur->yearDays().first() ); break; case KCal::Recurrence::rYearlyPos: // (weekday X of week N of month Y) mRecurrence.cycle = "yearly"; mRecurrence.type = "weekday"; - QValueList<int> months = recur->yearMonths(); + TQValueList<int> months = recur->yearMonths(); if ( !months.isEmpty() ) mRecurrence.month = s_monthName[ months.first() - 1 ]; // #### Kolab XML limitation: only one month specified - QValueList<KCal::RecurrenceRule::WDayPos> monthPositions = recur->yearPositions(); + TQValueList<KCal::RecurrenceRule::WDayPos> monthPositions = recur->yearPositions(); if ( !monthPositions.isEmpty() ) { KCal::RecurrenceRule::WDayPos monthPos = monthPositions.first(); // TODO: Handle multiple days in the same week - mRecurrence.dayNumber = QString::number( monthPos.pos() ); + mRecurrence.dayNumber = TQString::number( monthPos.pos() ); mRecurrence.days.append( s_weekDayName[ monthPos.day()-1 ] ); - //mRecurrence.dayNumber = QString::number( *recur->yearNums().getFirst() ); + //mRecurrence.dayNumber = TQString::number( *recur->yearNums().getFirst() ); // Not handled: monthPos.negative (nth days before end of month) } break; @@ -577,7 +577,7 @@ void Incidence::setRecurrence( KCal::Recurrence* recur ) int howMany = recur->duration(); if ( howMany > 0 ) { mRecurrence.rangeType = "number"; - mRecurrence.range = QString::number( howMany ); + mRecurrence.range = TQString::number( howMany ); } else if ( howMany == 0 ) { mRecurrence.rangeType = "date"; mRecurrence.range = dateToString( recur->endDate() ); @@ -657,7 +657,7 @@ void Incidence::setFields( const KCal::Incidence* incidence ) // Handle the scheduling ID if ( incidence->schedulingID() == incidence->uid() ) { // There is no scheduling ID - setInternalUID( QString::null ); + setInternalUID( TQString::null ); } else { // We've internally been using a different uid, so save that as the // temporary (internal) uid and restore the original uid, the one that @@ -672,8 +672,8 @@ void Incidence::setFields( const KCal::Incidence* incidence ) setPilotSyncStatus( incidence->syncStatus() ); // Unhandled tags and other custom properties (see libkcal/customproperties.h) - const QMap<QCString, QString> map = incidence->customProperties(); - QMap<QCString, QString>::ConstIterator cit = map.begin(); + const TQMap<TQCString, TQString> map = incidence->customProperties(); + TQMap<TQCString, TQString>::ConstIterator cit = map.begin(); for ( ; cit != map.end() ; ++cit ) { Custom c; c.key = cit.key(); @@ -682,11 +682,11 @@ void Incidence::setFields( const KCal::Incidence* incidence ) } } -static QBitArray daysListToBitArray( const QStringList& days ) +static TQBitArray daysListToBitArray( const TQStringList& days ) { - QBitArray arr( 7 ); + TQBitArray arr( 7 ); arr.fill( false ); - for( QStringList::ConstIterator it = days.begin(); it != days.end(); ++it ) { + for( TQStringList::ConstIterator it = days.begin(); it != days.end(); ++it ) { for ( uint i = 0; i < 7 ; ++i ) if ( *it == s_weekDayName[i] ) arr.setBit( i, true ); @@ -724,7 +724,7 @@ void Incidence::saveTo( KCal::Incidence* incidence ) + organizer().smtpAddress + ">" ); incidence->clearAttendees(); - QValueList<Attendee>::ConstIterator it; + TQValueList<Attendee>::ConstIterator it; for ( it = mAttendees.begin(); it != mAttendees.end(); ++it ) { KCal::Attendee::PartStat status = attendeeStringToStatus( (*it).status ); KCal::Attendee::Role role = attendeeStringToRole( (*it).role ); @@ -755,7 +755,7 @@ void Incidence::saveTo( KCal::Incidence* incidence ) } else if ( mRecurrence.cycle == "daily" ) { recur->setDaily( mRecurrence.interval ); } else if ( mRecurrence.cycle == "weekly" ) { - QBitArray rDays = daysListToBitArray( mRecurrence.days ); + TQBitArray rDays = daysListToBitArray( mRecurrence.days ); recur->setWeekly( mRecurrence.interval, rDays ); } else if ( mRecurrence.cycle == "monthly" ) { recur->setMonthly( mRecurrence.interval ); @@ -803,7 +803,7 @@ void Incidence::saveTo( KCal::Incidence* incidence ) if ( hasPilotSyncStatus() ) incidence->setSyncStatus( pilotSyncStatus() ); - for( QValueList<Custom>::ConstIterator it = mCustomList.begin(); it != mCustomList.end(); ++it ) { + for( TQValueList<Custom>::ConstIterator it = mCustomList.begin(); it != mCustomList.end(); ++it ) { incidence->setNonKDECustomProperty( (*it).key, (*it).value ); } @@ -811,16 +811,16 @@ void Incidence::saveTo( KCal::Incidence* incidence ) void Incidence::loadAttachments() { - QStringList attachments; + TQStringList attachments; if ( mResource->kmailListAttachments( attachments, mSubResource, mSernum ) ) { - for ( QStringList::ConstIterator it = attachments.constBegin(); it != attachments.constEnd(); ++it ) { - QByteArray data; + for ( TQStringList::ConstIterator it = attachments.constBegin(); it != attachments.constEnd(); ++it ) { + TQByteArray data; KURL url; if ( mResource->kmailGetAttachment( url, mSubResource, mSernum, *it ) && !url.isEmpty() ) { - QFile f( url.path() ); + TQFile f( url.path() ); if ( f.open( IO_ReadOnly ) ) { data = f.readAll(); - QString mimeType; + TQString mimeType; if ( !mResource->kmailAttachmentMimetype( mimeType, mSubResource, mSernum, *it ) ) mimeType = "application/octet-stream"; KCal::Attachment *a = new KCal::Attachment( KCodecs::base64Encode( data ).data(), mimeType ); @@ -834,9 +834,9 @@ void Incidence::loadAttachments() } } -QString Incidence::productID() const +TQString Incidence::productID() const { - return QString( "KOrganizer " ) + korgVersion + ", Kolab resource"; + return TQString( "KOrganizer " ) + korgVersion + ", Kolab resource"; } // Unhandled KCal::Incidence fields: |