agendainterface/agendautil/src/agendautil.cpp
changeset 55 2c54b51f39c4
parent 45 b6db4fd4947b
child 64 1881ad52dc45
equal deleted inserted replaced
51:0b38fc5b94c6 55:2c54b51f39c4
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: 
    14 * Description: 
    15 *
    15 *
    16 */
    16 */
    17 #include "agendautil.h"
    17 #include <agendautil.h>
    18 #include "agendautil_p.h"
    18 #include "agendautil_p.h"
    19 
    19 
    20 #include <QList>
    20 #include <QList>
    21 #include <QDateTime>
    21 #include <QDateTime>
    22 
    22 
    92 /*! \var AgendaUtil::FilterFlags AgendaUtil::IncludeAll
    92 /*! \var AgendaUtil::FilterFlags AgendaUtil::IncludeAll
    93     Include all entries (appointments, day events, anniversaries and todos).
    93     Include all entries (appointments, day events, anniversaries and todos).
    94 */
    94 */
    95 
    95 
    96 /*!
    96 /*!
    97 	Adds new enty.
    97 	To store the new entry or update the entry in the Calendar db.
    98 
    98 
    99 	\param entry The entry to be added
    99 	\param entry The entry to be added/updated
   100 	\return id of the added entry on success; otherwise returns 0.
   100 	\param range The recurrence range of entry
   101 	\sa deleteEntry(), updateEntry()
   101 	\return ulong The local uid of the entry added/updated in the db.
   102 */
   102 */
   103 ulong AgendaUtil::addEntry(const AgendaEntry& entry)
   103 ulong AgendaUtil::store(AgendaEntry &entry, AgendaUtil::RecurrenceRange range)
   104 {
   104 {
   105 	return d->addEntry(entry);
   105 	return d->store(entry, range);
   106 }
   106 }
       
   107 
   107 /*!
   108 /*!
   108 	Clones the `entry' passed in the argument and saves it as type `type'.
   109 	Clones the `entry' passed in the argument and saves it as type `type'.
   109 
   110 
   110 	This API clones the entry, by retaining the GUID of the entry and all the
   111 	This API clones the entry, by retaining the GUID of the entry and all the
   111 	other data from the entry provided and saves it as the given type. Note that
   112 	other data from the entry provided and saves it as the given type. Note that
   131     Deletes the entry
   132     Deletes the entry
   132 
   133 
   133     \param id The id of the entry to be deleted
   134     \param id The id of the entry to be deleted
   134     \return If false is returned, an error has occurred. Call error() to get a value of
   135     \return If false is returned, an error has occurred. Call error() to get a value of
   135     AgendaUtil::Error that indicates which error occurred
   136     AgendaUtil::Error that indicates which error occurred
   136     \sa addEntry(), updateEntry()
   137     \sa store()
   137 */
   138 */
   138 bool AgendaUtil::deleteEntry(ulong id)
   139 bool AgendaUtil::deleteEntry(ulong id)
   139 {
   140 {
   140     return d->deleteEntry(id);
   141     return d->deleteEntry(id);
   141 }
   142 }
   146 	\param id The id of the entry to be deleted
   147 	\param id The id of the entry to be deleted
   147 	\param range Specifies if all the instances of the repeating entry has to be deleted or
   148 	\param range Specifies if all the instances of the repeating entry has to be deleted or
   148 				only specific instances
   149 				only specific instances
   149 	\return If false is returned, an error has occurred. Call error() to get a value of
   150 	\return If false is returned, an error has occurred. Call error() to get a value of
   150 	AgendaUtil::Error that indicates which error occurred
   151 	AgendaUtil::Error that indicates which error occurred
   151 	\sa addEntry(), updateEntry()
   152 	\sa store()
   152  */
   153  */
   153 void AgendaUtil::deleteRepeatedEntry(
   154 void AgendaUtil::deleteRepeatedEntry(
   154 		AgendaEntry& entry,
   155 		AgendaEntry& entry,
   155 		AgendaUtil::RecurrenceRange range)
   156 		AgendaUtil::RecurrenceRange range)
   156 {
   157 {
   157 	d->deleteRepeatedEntry(entry, range);
   158 	d->deleteRepeatedEntry(entry, range);
   158 }
   159 }
   159 
   160 
   160 /*!
       
   161 	Updates the entry
       
   162 
       
   163 	\param entry The entry to be updated
       
   164 	\return If false is returned, an error has occurred. Call error() to get a value of
       
   165 	AgendaUtil::Error that indicates which error occurred
       
   166 	\sa addEntry(), deleteEntry()
       
   167  */
       
   168 bool AgendaUtil::updateEntry(const AgendaEntry& entry, bool isChild)
       
   169 {
       
   170 	return d->updateEntry(entry, isChild);
       
   171 }
       
   172 
       
   173 /*!
       
   174 	Store the repeating entry. This needs to be called only when alreay existing
       
   175 	repeating entry is getting modified and saved. This function takes care of
       
   176 	copying the relevant fields to its child also
       
   177 
       
   178 	\param entry The entry to be stored
       
   179 	\return If false is returned, an error has occurred. Call error() to get a value of
       
   180 	AgendaUtil::Error that indicates which error occurred
       
   181 	\sa addEntry(), deleteEntry()
       
   182  */
       
   183 bool AgendaUtil::storeRepeatingEntry(const AgendaEntry& entry,
       
   184                                      bool copyToChildren)
       
   185 {
       
   186 	return d->storeRepeatingEntry(entry, copyToChildren);
       
   187 }
       
   188 
       
   189 /*!
       
   190 	Creates an exceptional entry
       
   191 
       
   192 	\param entry The entry to be stored
       
   193 	\return If false is returned, an error has occurred. Call error() to get a value of
       
   194 	AgendaUtil::Error that indicates which error occurred
       
   195 	\sa addEntry(), deleteEntry()
       
   196  */
       
   197 bool AgendaUtil::createException(const AgendaEntry& entry,QDateTime instanceOriginalDateTime)
       
   198 {
       
   199 	return d->createException(entry, instanceOriginalDateTime);
       
   200 }
       
   201 /*!
   161 /*!
   202 	Fetches the entry which of id is equal to given \a id.
   162 	Fetches the entry which of id is equal to given \a id.
   203 
   163 
   204 	\param id id of the entry to be returned
   164 	\param id id of the entry to be returned
   205 	\return the entry on success; null entry on failure
   165 	\return the entry on success; null entry on failure
   342     }
   302     }
   343     return AgendaEntry();
   303     return AgendaEntry();
   344 }
   304 }
   345 
   305 
   346 /*!
   306 /*!
   347 	Clears the repeating properties of the entry. This means
       
   348 	It will delete all the instances and stores a single entry
       
   349 	which is non repeating
       
   350 
       
   351 	\param entry The entry for which repeating properties to be cleared
       
   352 	\return None
       
   353  */
       
   354 void AgendaUtil::clearRepeatingProperties(AgendaEntry& entry)
       
   355 {
       
   356 	 if(d) {
       
   357 		return d->clearRepeatingProperties(entry);
       
   358 	 }
       
   359 }
       
   360 
       
   361 /*!
       
   362 	Returns the start and end times of previous occurence of a particular
   307 	Returns the start and end times of previous occurence of a particular
   363 	instance
   308 	instance
   364 
   309 
   365 	\param entry The instance with which previous instance details are obtained
   310 	\param entry The instance with which previous instance details are obtained
   366 	\return None
   311 	\return None