summaryrefslogtreecommitdiff
path: root/library/backend
Side-by-side diff
Diffstat (limited to 'library/backend') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/event.cpp5
-rw-r--r--library/backend/event.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/library/backend/event.cpp b/library/backend/event.cpp
index 8f3f780..7cac314 100644
--- a/library/backend/event.cpp
+++ b/library/backend/event.cpp
@@ -460,277 +460,280 @@ void Event::setRepeat( const RepeatPattern &p )
}
/*!
Sets the description of the event to \a s.
*/
void Event::setDescription( const QString &s )
{
descript = s;
}
/*!
Sets the location of the event to \a s.
*/
void Event::setLocation( const QString &s )
{
locat = s;
}
// void Event::setCategory( const QString &s )
// {
// categ = s;
// }
/*!
\internal
*/
void Event::setType( Type t )
{
typ = t;
}
/*!
Sets the start date and time of the first or only occurance of this event
to the date and time \a d. \a d should be in local time.
*/
void Event::setStart( const QDateTime &d )
{
startUTC = TimeConversion::toUTC( d );
}
/*!
\internal
*/
void Event::setStart( time_t time )
{
startUTC = time;
}
/*!
Sets the end date and time of the first or only occurance of this event
to the date and time \a d. \a d should be in local time.
*/
void Event::setEnd( const QDateTime &d )
{
endUTC = TimeConversion::toUTC( d );
}
/*!
\internal
*/
void Event::setEnd( time_t time )
{
endUTC = time;
}
/*!
\internal
*/
void Event::setTimeZone( const QString &z )
{
tz = z;
}
/*!
\internal
*/
void Event::setAlarm( bool b, int minutes, SoundTypeChoice s )
{
hAlarm = b;
aMinutes = minutes;
aSound = s;
}
/*!
\internal
*/
void Event::setRepeat( bool b, const RepeatPattern &p )
{
hRepeat = b;
pattern = p;
}
/*!
Sets the notes for the event to \a n.
*/
void Event::setNotes( const QString &n )
{
note = n;
}
/*!
Returns the description of the event.
*/
const QString &Event::description() const
{
return descript;
}
/*!
Returns the location of the event.
*/
const QString &Event::location() const
{
return locat;
}
// QString Event::category() const
// {
// return categ;
// }
/*!
\internal
*/
Event::Type Event::type() const
{
return typ;
}
+/*
QDateTime Event::start() const {
return start( TRUE );
}
+*/
/*!
\internal
*/
QDateTime Event::start( bool actual ) const
{
QDateTime dt = (startUTC > 0) ? TimeConversion::fromUTC( startUTC ) : QDateTime::currentDateTime();
if ( actual && typ == AllDay ) {
QTime t = dt.time();
t.setHMS( 0, 0, 0 );
dt.setTime( t );
}
return dt;
}
-
+/*
QDateTime Event::end() const {
return end( TRUE );
}
+*/
/*!
\internal
*/
QDateTime Event::end( bool actual ) const
{
QDateTime dt = (endUTC > 0) ? TimeConversion::fromUTC( endUTC ) : QDateTime::currentDateTime();
if ( actual && typ == AllDay ) {
QTime t = dt.time();
t.setHMS( 23, 59, 59 );
dt.setTime( t );
}
return dt;
}
/*!
\internal
*/
const QString &Event::timeZone() const
{
return tz;
}
/*!
\internal
*/
bool Event::hasAlarm() const
{
return hAlarm;
}
/*!
\internal
*/
int Event::alarmTime() const
{
return aMinutes;
}
/*!
Returns the sound type for the alarm of this event.
*/
Event::SoundTypeChoice Event::alarmSound() const
{
return aSound;
}
/*!
\internal
*/
bool Event::hasRepeat() const
{
return doRepeat();
}
/*!
\internal
*/
const Event::RepeatPattern &Event::repeatPattern() const
{
return pattern;
}
/*!
\internal
*/
Event::RepeatPattern &Event::repeatPattern()
{
return pattern;
}
/*!
Returns the notes for the event.
*/
const QString &Event::notes() const
{
return note;
}
/*!
\internal
*/
bool Event::operator==( const Event &e ) const
{
if ( uid() && e.uid() == uid() )
return TRUE;
return ( e.descript == descript &&
e.locat == locat &&
e.categ == categ &&
e.typ == typ &&
e.startUTC == startUTC &&
e.endUTC == endUTC &&
e.tz == tz &&
e.hAlarm == hAlarm &&
e.aMinutes == aMinutes &&
e.aSound == aSound &&
e.hRepeat == hRepeat &&
e.pattern == pattern &&
e.note == note );
}
/*!
\internal
Appends the contact information to \a buf.
*/
void Event::save( QString& buf )
{
buf += " description=\"" + Qtopia::escapeString(descript) + "\"";
if ( !locat.isEmpty() )
buf += " location=\"" + Qtopia::escapeString(locat) + "\"";
// save the categoies differently....
QString strCats = idsToString( categories() );
buf += " categories=\"" + Qtopia::escapeString(strCats) + "\"";
buf += " uid=\"" + QString::number( uid() ) + "\"";
if ( (Type)typ != Normal )
buf += " type=\"AllDay\"";
if ( hAlarm ) {
buf += " alarm=\"" + QString::number( aMinutes ) + "\" sound=\"";
if ( aSound == Event::Loud )
buf += "loud";
else
buf += "silent";
buf += "\"";
}
if ( hRepeat )
write( buf, pattern );
buf += " start=\""
diff --git a/library/backend/event.h b/library/backend/event.h
index 2b275a4..4610d85 100644
--- a/library/backend/event.h
+++ b/library/backend/event.h
@@ -216,160 +216,160 @@ public:
bool operator<( const EffectiveEvent &e ) const;
bool operator<=( const EffectiveEvent &e ) const;
bool operator==( const EffectiveEvent &e ) const;
bool operator!=( const EffectiveEvent &e ) const;
bool operator>( const EffectiveEvent &e ) const;
bool operator>= ( const EffectiveEvent &e ) const;
void setStart( const QTime &start );
void setEnd( const QTime &end );
void setEvent( Event e );
void setDate( const QDate &date );
void setEffectiveDates( const QDate &from, const QDate &to );
// QString category() const;
const QString &description() const;
const QString &location() const;
const QString &notes() const;
const Event &event() const;
const QTime &start() const;
const QTime &end() const;
const QDate &date() const;
int length() const;
int size() const;
QDate startDate() const;
QDate endDate() const;
private:
class EffectiveEventPrivate *d;
Event mEvent;
QDate mDate;
QTime mStart,
mEnd;
};
inline void Event::setAlarm( int minutes, SoundTypeChoice s )
{
setAlarm(TRUE, minutes, s);
}
inline void Event::clearAlarm()
{
setAlarm(FALSE, 0, Silent);
}
inline int Event::alarmDelay() const
{
return alarmTime();
}
inline void Event::setAllDay(bool enable)
{
if (enable)
setType(AllDay);
else
setType(Normal);
};
inline bool Event::isAllDay() const
{
return type() == AllDay;
}
inline Event::RepeatType Event::repeatType() const
{
return repeatPattern().type;
}
inline int Event::frequency() const
{
return repeatPattern().frequency;
}
inline int Event::weekOffset() const
{
if (start().date().day() == 1)
return 1;
return (start().date().day() - 1) / 7 + 1;
}
inline QDate Event::repeatTill() const
{
return repeatPattern().endDate();
}
inline bool Event::repeatForever() const
{
return !repeatPattern().hasEndDate;
}
inline void Event::setRepeatType(RepeatType t)
{
pattern.type = t;
}
inline void Event::setFrequency(int f)
{
pattern.frequency = f;
}
inline void Event::setRepeatTill(const QDate &d)
{
pattern.setEndDate(d);
pattern.hasEndDate = TRUE;
}
inline void Event::setRepeatForever(bool b)
{
if (!b == pattern.hasEndDate)
return;
if (!b && !pattern.hasEndDate)
pattern.setEndDate(end().date());
pattern.hasEndDate = !b;
}
inline bool Event::repeatOnWeekDay(int day) const
{
if (pattern.type != Weekly)
return FALSE;
return ( (1 << (day - 1)) & pattern.days ) != 0;
}
inline void Event::setRepeatOnWeekDay(int day, bool enable)
{
if ( repeatOnWeekDay( day ) != enable )
pattern.days ^= 1 << (day - 1);
}
-/*
+
inline QDateTime Event::start( ) const
{
return start(FALSE);
}
inline QDateTime Event::end( ) const
{
return end(FALSE);
}
-*/
+
#ifdef PALMTOPCENTER
class QPC_EXPORT EffectiveEventSizeSorter : public QSorter<EffectiveEvent>
{
public:
int compare( const EffectiveEvent& a, const EffectiveEvent& b ) const
{
return a.size() - b.size();
}
};
class QPC_EXPORT EffectiveEventTimeSorter : public QSorter<EffectiveEvent>
{
public:
int compare( const EffectiveEvent& a, const EffectiveEvent& b ) const
{
return a.start().secsTo( b.start() );
}
};
#endif
#endif