/usr/include/kcal/todo.h is in kdepimlibs5-dev 4:4.14.10-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | /*
This file is part of the kcal library.
Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2009 Allen Winter <winter@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
@file
This file is part of the API for handling calendar data and
defines the Todo class.
@author Cornelius Schumacher \<schumacher@kde.org\>
@author Allen Winter \<winter@kde.org\>
*/
#ifndef KCAL_TODO_H
#define KCAL_TODO_H
#include "incidence.h"
#include <kpimutils/supertrait.h>
#include <QtCore/QByteArray>
namespace KCal {
/**
@brief
Provides a To-do in the sense of RFC2445.
*/
class KCAL_DEPRECATED_EXPORT Todo : public Incidence
{
public:
/**
List of to-dos.
*/
typedef ListBase<Todo> List;
/**
A shared pointer to a Todo object.
*/
typedef boost::shared_ptr<Todo> Ptr;
/**
A shared pointer to a non-mutable Todo object.
*/
typedef boost::shared_ptr<const Todo> ConstPtr;
/**
Constructs an empty to-do.
*/
Todo();
/**
Copy constructor.
@param other is the to-do to copy.
*/
Todo( const Todo &other );
/**
Destroys a to-do.
*/
~Todo();
/**
@copydoc
IncidenceBase::type()
*/
QByteArray type() const;
/**
@copydoc
IncidenceBase::typeStr()
*/
//KDE5: QString typeStr() const;
/**
Returns an exact copy of this todo. The returned object is owned by the
caller.
*/
Todo *clone();
/**
Sets due date and time.
@param dtDue The due date/time.
@param first If true and the todo recurs, the due date of the first
occurrence will be returned. If false and recurrent, the date of the
current occurrence will be returned. If non-recurrent, the normal due
date will be returned.
*/
void setDtDue( const KDateTime &dtDue, bool first = false );
/**
Returns due date and time.
@param first If true and the todo recurs, the due date of the first
occurrence will be returned. If false and recurrent, the date of the
current occurrence will be returned. If non-recurrent, the normal due
date will be returned.
*/
KDateTime dtDue( bool first = false ) const;
/**
Returns due time as string formatted according to the user's locale
settings.
@param shortfmt If set, use short date format; else use long format.
@param spec If set, return the time in the given spec, else use the
todo's current spec.
@deprecated use IncidenceFormatter::timeToString()
*/
KCAL_DEPRECATED QString dtDueTimeStr(
bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns due date as string formatted according to the user's locale
settings.
@param shortfmt If set, use short date format; else use long format.
@param spec If set, return the date in the given spec, else use the
todo's current spec.
@deprecated use IncidenceFormatter::dateToString()
*/
KCAL_DEPRECATED QString dtDueDateStr(
bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns due date and time as string formatted according to the user's
locale settings.
@param shortfmt If set, use short date format; else use long format.
@param spec If set, return the date/time in the given spec, else use
the todo's current spec.
@deprecated use IncidenceFormatter::dateTimeToString()
*/
KCAL_DEPRECATED QString dtDueStr(
bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns true if the todo has a due date, otherwise return false.
*/
bool hasDueDate() const;
/**
Sets if the todo has a due date.
@param hasDueDate true if todo has a due date, otherwise false
*/
void setHasDueDate( bool hasDueDate );
/**
Returns true if the todo has a start date, otherwise return false.
*/
bool hasStartDate() const;
/**
Sets if the todo has a start date.
@param hasStartDate true if todo has a start date, otherwise false
*/
void setHasStartDate( bool hasStartDate );
/**
@copydoc
IncidenceBase::dtStart()
*/
virtual KDateTime dtStart() const;
/**
Returns the start date of the todo.
@param first If true, the start date of the todo will be returned;
also, if the todo recurs, the start date of the first occurrence
will be returned.
If false and the todo recurs, the relative start date will be returned,
based on the date returned by dtRecurrence().
*/
KDateTime dtStart( bool first ) const;
/**
Sets the start date of the todo.
@param dtStart is the to-do start date.
*/
void setDtStart( const KDateTime &dtStart );
/**
Returns a todo's starting time as a string formatted according to the
user's locale settings.
@param shortfmt If set, use short date format; else use long format.
@param first If true, the start date of the todo will be returned;
also, if the todo recurs, the start date of the first occurrence
will be returned.
If false and the todo recurs, the relative start date will be returned,
based on the date returned by dtRecurrence().
@param spec If set, returns the time in the given spec, else use the
todo's current spec.
@deprecated use IncidenceFormatter::timeToString()
*/
KCAL_DEPRECATED QString dtStartTimeStr(
bool shortfmt, bool first, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
@copydoc
IncidenceBase::dtStartTimeStr()
*/
virtual KCAL_DEPRECATED QString dtStartTimeStr(
bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns a todo's starting date as a string formatted according to the
user's locale settings.
@param shortfmt If set, use short date format; else use long format.
@param first If true, the start date of the todo will be returned;
also, if the todo recurs, the start date of the first occurrence
will be returned.
If false and the todo recurs, the relative start date will be returned,
based on the date returned by dtRecurrence().
@param spec If set, returns the date in the given spec, else use the
todo's current spec.
@deprecated use IncidenceFormatter::dateToString()
*/
KCAL_DEPRECATED QString dtStartDateStr(
bool shortfmt, bool first, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
@copydoc
IncidenceBase::dtStartDateStr()
*/
virtual KCAL_DEPRECATED QString dtStartDateStr(
bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns a todo's starting date and time as a string formatted according
to the user's locale settings.
@param shortfmt If set, use short date format; else use long format.
@param first If true, the start date of the todo will be returned;
also, if the todo recurs, the start date of the first occurrence
will be returned.
If false and the todo recurs, the relative start date will be returned,
based on the date returned by dtRecurrence().
@param spec If set, returns the date and time in the given spec, else
use the todo's current spec.
@deprecated use IncidenceFormatter::dateTimeToString()
*/
KCAL_DEPRECATED QString dtStartStr(
bool shortfmt, bool first, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
@copydoc
IncidenceBase::dtStartStr()
*/
virtual KCAL_DEPRECATED QString dtStartStr(
bool shortfmt = true, const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns true if the todo is 100% completed, otherwise return false.
@see isOverdue, isInProgress(), isOpenEnded(), isNotStarted(bool),
setCompleted(), percentComplete()
*/
bool isCompleted() const;
/**
Sets completed state.
@param completed If true set completed state to 100%, if false set
completed state to 0%.
@see isCompleted(), percentComplete()
*/
void setCompleted( bool completed );
/**
Returns what percentage of the to-do is completed. Returns a value
between 0 and 100.
*/
int percentComplete() const;
/**
Sets what percentage of the to-do is completed. Valid values are in the
range from 0 to 100.
@param percent is the completion percentage, which as integer value
between 0 and 100, inclusive.
@see isCompleted(), setCompleted()
*/
void setPercentComplete( int percent );
/**
Returns date and time when todo was completed.
*/
KDateTime completed() const;
/**
Returns string contaiting date and time when the todo was completed
formatted according to the user's locale settings.
@param shortfmt If set, use short date format; else use long format.
*/
QString completedStr( bool shortfmt = false ) const;
/**
Sets date and time of completion.
@param completeDate is the to-do completion date.
*/
void setCompleted( const KDateTime &completeDate );
/**
Returns true, if the to-do has a date associated with completion,
otherwise return false.
*/
bool hasCompletedDate() const;
/**
Returns true, if the to-do is in-progress (started, or >0% completed);
otherwise return false. If the to-do is overdue, then it is not
considered to be in-progress.
@param first If true, the start and due dates of the todo will be used;
also, if the todo recurs, the start date and due date of the first
occurrence will be used.
If false and the todo recurs, the relative start and due dates will be
used, based on the date returned by dtRecurrence().
@see isOverdue(), isCompleted(), isOpenEnded(), isNotStarted(bool)
@since 4.4
*/
bool isInProgress( bool first ) const;
/**
Returns true, if the to-do is open-ended (no due date); false otherwise.
@see isOverdue(), isCompleted(), isInProgress(), isNotStarted(bool)
@since 4.4
*/
bool isOpenEnded() const;
/**
Returns true, if the to-do has yet to be started (no start date and 0%
completed); otherwise return false.
@param first If true, the start date of the todo will be used;
also, if the todo recurs, the start date of the first occurrence
will be used.
If false and the todo recurs, the relative start date will be used,
based on the date returned by dtRecurrence().
@see isOverdue(), isCompleted(), isInProgress(), isOpenEnded()
@since 4.4
*/
bool isNotStarted( bool first ) const;
/**
@copydoc
IncidenceBase::shiftTimes()
*/
virtual void shiftTimes( const KDateTime::Spec &oldSpec,
const KDateTime::Spec &newSpec );
/**
Sets the due date/time of the current occurrence if recurrent.
@param dt is the
*/
void setDtRecurrence( const KDateTime &dt );
/**
Returns the due date/time of the current occurrence if recurrent.
*/
KDateTime dtRecurrence() const;
/**
Returns true if the @p date specified is one on which the to-do will
recur. Todos are a special case, hence the overload. It adds an extra
check, which make it return false if there's an occurrence between
the recur start and today.
@param date is the date to check.
@param timeSpec is the
*/
virtual bool recursOn( const QDate &date,
const KDateTime::Spec &timeSpec ) const;
/**
Returns true if this todo is overdue (e.g. due date is lower than today
and not completed), else false.
@see isCompleted(), isInProgress(), isOpenEnded(), isNotStarted(bool)
*/
bool isOverdue() const;
/**
Assignment operator.
@param other is the to-do to assign.
*/
Todo &operator=( const Todo &other );
/**
Compare this with @p todo for equality.
@param todo is the to-do to compare.
*/
bool operator==( const Todo &todo ) const;
protected:
/**
Returns the end date/time of the base incidence.
*/
virtual KDateTime endDateRecurrenceBase() const;
private:
/**
@copydoc
IncidenceBase::accept()
*/
bool accept( Visitor &v ) { return v.visit( this ); }
//@cond PRIVATE
class Private;
Private *const d;
//@endcond
};
}
//@cond PRIVATE
// super class trait specialization
namespace KPIMUtils {
template <> struct SuperClass<KCal::Todo> : public SuperClassTrait<KCal::Incidence>{};
}
//@endcond
#endif
|