summaryrefslogtreecommitdiff
path: root/library/backend
authorzecke <zecke>2003-04-16 10:57:59 (UTC)
committer zecke <zecke>2003-04-16 10:57:59 (UTC)
commiteeb29547890a2d162de66d7d5b98d3840a7e2d79 (patch) (side-by-side diff)
tree973c6de7aae2fd5ba368efb87fa24234f0e12aa3 /library/backend
parentdfa2d294b3af09bf3757a3c2294a925093e72fc6 (diff)
downloadopie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.zip
opie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.tar.gz
opie-eeb29547890a2d162de66d7d5b98d3840a7e2d79.tar.bz2
Fix API docu
Diffstat (limited to 'library/backend') (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/categories.cpp9
-rw-r--r--library/backend/categories.h2
-rw-r--r--library/backend/event.cpp4
-rw-r--r--library/backend/palmtoprecord.h12
4 files changed, 17 insertions, 10 deletions
diff --git a/library/backend/categories.cpp b/library/backend/categories.cpp
index 2e84089..cce9f38 100644
--- a/library/backend/categories.cpp
+++ b/library/backend/categories.cpp
@@ -442,97 +442,97 @@ QStringList Categories::labels( const QString &app,
/*!
Returns the label associated with the id
*/
QString Categories::label( const QString &app, int id ) const
{
if ( mGlobalCats.contains( id ) )
return mGlobalCats.label( id );
QMap< QString, CategoryGroup >::ConstIterator
appIt = mAppCats.find( app );
if ( appIt == mAppCats.end() )
return QString::null;
return (*appIt).label( id );
}
/*!
Returns a single string associated with \a catids for display in a
combobox or any area that requires one string. If \a catids are empty
then "Unfiled" will be returned. If multiple categories are
assigned then the behavior depends on the DisplaySingle type.
If \a display is set to ShowMulti then " (multi)" appended to the
first string. If \a display is set to ShowAll, then a space
seperated string is returned with all categories. If ShowFirst is
set, the just the first string is returned.
*/
QString Categories::displaySingle( const QString &app,
const QArray<int> &catids,
DisplaySingle display ) const
{
QStringList strs = labels( app, catids );
if ( !strs.count() )
return tr("Unfiled");
strs.sort();
QString r;
if ( strs.count() > 1 ) {
switch ( display ) {
case ShowFirst:
r = strs.first();
break;
case ShowMulti:
r = strs.first() + tr(" (multi.)");
break;
case ShowAll:
r = strs.join(" ");
break;
}
}
- else r = strs.first();
+ else r = strs.first();
return r;
}
/*!
Returns all ids associated with the application CategoryGroup \a app
and the passed in \a labels in that group.
*/
QArray<int> Categories::ids( const QString &app, const QStringList &labels) const
{
QArray<int> results;
QStringList::ConstIterator it;
int i;
for ( i=0, it=labels.begin(); it!=labels.end(); i++, ++it ) {
int value = id( app, *it );
if ( value != 0 ) {
int tmp = results.size();
results.resize( tmp + 1 );
results[ tmp ] = value;
}
}
return results;
}
/*!
Returns the id associated with the app. If the id is not found in the
application CategoryGroup, then it searches the global CategoryGroup.
If it is not found it either, 0 is returned.
*/
int Categories::id( const QString &app, const QString &cat ) const
{
if ( cat == tr("Unfiled") || cat.contains( tr(" (multi.)") ) )
return 0;
int uid = mGlobalCats.id( cat );
if ( uid != 0 )
return uid;
return mAppCats[app].id( cat );
}
/*!
Return TRUE if renaming succeeded; FALSE if \a appname or \a oldName
is not found, or if \a newName conflicts with an existing category
in the CategoryGroup.
It will first search the CategoryGroup associated with \a appname
and if not found it will try to replace in global CategoryGroup.
@@ -803,126 +803,121 @@ void Categories::dump() const
}
}
QStringList CheckedListView::checked() const
{
QStringList strs;
for ( QCheckListItem *i = (QCheckListItem *) firstChild();
i; i = (QCheckListItem *)i->nextSibling() )
if ( i->isOn() )
strs += i->text( 0 );
return strs;
}
void CheckedListView::addCheckableList( const QStringList &options )
{
for ( QStringList::ConstIterator it = options.begin();
it != options.end(); ++it ) {
(void) new QCheckListItem( this, *it,
QCheckListItem::CheckBox );
}
}
void CheckedListView::setChecked( const QStringList &checked )
{
// iterate over all items
bool showingChecked = FALSE;
for ( QCheckListItem *i = (QCheckListItem *) firstChild();
i; i = (QCheckListItem *)i->nextSibling() )
// see if the item should be checked by searching the
// checked list
if ( checked.find( i->text( 0 ) ) != checked.end() ) {
i->setOn( TRUE );
// make sure it is showing at least one checked item
if ( !showingChecked ) {
ensureItemVisible( i );
showingChecked = TRUE;
}
}
else
i->setOn( FALSE );
}
/*! \fn Categories &Categories::operator= ( const Categories &c )
Performs deep copy.
*/
-/*! \fn QStringList Categories::labels( const QString & app, const QArray<int> &catids ) const
-
- Returns list of labels associated with the application and catids
-*/
-
/*! \fn QStringList Categories::globalCategories() const
Returns list of all global category labels
*/
/*! \fn const QMap<QString, CategoryGroup> &Categories::appGroupMap() const
Returns a map of application names to CategoryGroup. The CategoryGroup
class defines a map of ids to category labels and category labels to ids.
*/
/*! \fn const CategoryGroup &Categories::globalGroup() const
Returns the global CategoryGroup. The CategoryGroup
class defines a map of ids to category labels and category labels to ids.
*/
/*! \fn void Categories::categoryAdded( const Categories &cats, const QString &appname, int uid)
Emitted if a category is added.
\a cats is a const reference to this object
\a appname is the CategoryGroup application name that the category was added to or QString::null if it was global
\a uid is the unique identifier associated with the added category
-*/
+*/
/*! \fn void Categories::categoryRemoved( const Categories &cats, const QString &appname,
int uid)
Emitted if removed category is removed.
\a cats is a const reference to this object
\a appname is the CategoryGroup application name that the category was removed from or QString::null if it was the global CategoryGroup
\a uid is the unique identifier associated with the removed category
*/
/*! \fn void Categories::categoryRenamed( const Categories &cats, const QString &appname,
int uid)
Emitted if \a uid in the \a appname CategoryGroup is renamed in \a cats
object.
\a cats is a const reference to this object
\a appname is the CategoryGroup application name that the category was renamed in or QString::null if it was the global CategoryGroup
\a uid is the unique identifier associated with the renamed category
*/
/*! \fn Categories::Categories( QObject *parent=0, const char *name = 0 )
Constructor for an empty Categories object.
*/
/*! \fn Categories::Categories( const Categories &copyFrom )
Deep copy constructor
*/
/*! \fn Categories::~Categories()
Empty destructor. Call save() before destruction if there are changes
that need to be saved.
*/
/*! \fn CategoryGroup::clear()
\internal
*/
/*! \fn const QMap<int, QString> &CategoryGroup::idMap() const
Returns a const reference to the id to label QMap
*/
diff --git a/library/backend/categories.h b/library/backend/categories.h
index ba65ee3..d5b3669 100644
--- a/library/backend/categories.h
+++ b/library/backend/categories.h
@@ -40,97 +40,97 @@ template class QPC_EXPORT QMap< QString, CategoryGroup >;
// MOC_SKIP_END
#endif
class QPC_EXPORT CategoryGroup
{
friend class Categories;
public:
CategoryGroup(): mIdLabelMap(), mLabelIdMap() { }
CategoryGroup( const CategoryGroup &c ) :
mIdLabelMap( c.mIdLabelMap), mLabelIdMap( c.mLabelIdMap ) { }
void clear() { mIdLabelMap.clear(); mLabelIdMap.clear(); }
int add( const QString &label );
bool add( int uid, const QString &label );
bool remove( const QString &label );
bool remove( int uid );
bool rename( int uid, const QString &newLabel );
bool rename( const QString &oldLabel, const QString &newLabel );
bool contains(int id) const;
bool contains(const QString &label) const;
/** Returns label associated with the uid or QString::null if
* not found
*/
const QString &label(int id) const;
/** Returns the uid associated with label or 0 if not found */
int id(const QString &label) const;
/** Returns a sorted list of labels */
QStringList labels() const;
QStringList labels( const QArray<int> &catids ) const;
const QMap<int, QString> &idMap() const { return mIdLabelMap; }
private:
void insert( int uid, const QString &label );
QMap<int, QString> mIdLabelMap;
QMap<QString, int> mLabelIdMap;
static Qtopia::UidGen &uidGen() { return sUidGen; }
static Qtopia::UidGen sUidGen;
};
-/** Map from application name to categories */
+/* Map from application name to categories */
class QPC_EXPORT Categories : public QObject
{
Q_OBJECT
public:
Categories( QObject *parent=0, const char *name = 0 )
: QObject( parent, name ), mGlobalCats(), mAppCats() { }
Categories( const Categories &copyFrom ) : QObject( copyFrom.parent() ),
mGlobalCats( copyFrom.mGlobalCats ),
mAppCats( copyFrom.mAppCats ) { }
virtual ~Categories() { }
Categories &operator= ( const Categories &c )
{ mAppCats = c.mAppCats; mGlobalCats = c.mGlobalCats; return *this; }
void clear();
/** Add the category name as long as it doesn't already exist
* locally or globally. Return UID if added, 0 if conflicts
* (error).
*/
int addCategory( const QString &appname, const QString &catname);
/** Add the category name as long as it doesn't already exist
* locally or globally. Return UID if added, 0 if conflicts
* (error).
*/
int addCategory( const QString &appname, const QString &catname, int uid);
/** Add the global category just checking that it doesn't
* already exist globally. Return UID if added, 0 if conflicts.
*/
int addGlobalCategory( const QString &catname );
/** Add the global category just checking that it doesn't
* already exist globally. Return UID if added, 0 if conflicts.
*/
int addGlobalCategory( const QString &catname, int uid );
/** Removes the category from the application; if it is not found
* in the application, then it removes it from the global list
*/
bool removeCategory( const QString &appName, const QString &catName,
bool checkGlobal = TRUE);
bool removeCategory( const QString &appName, int uid );
bool removeGlobalCategory( const QString &catName );
bool removeGlobalCategory( int uid );
QArray<int> ids( const QString &app, const QStringList &labels) const;
/** Returns the id associated with the app */
int id( const QString &app, const QString &cat ) const;
/** Returns the label associated with the id */
diff --git a/library/backend/event.cpp b/library/backend/event.cpp
index d906f19..4c24ab3 100644
--- a/library/backend/event.cpp
+++ b/library/backend/event.cpp
@@ -122,103 +122,103 @@ Qtopia::UidGen Event::sUidGen( Qtopia::UidGen::Qtopia );
/*!
\fn bool Event::operator!=( const Event & ) const
\internal
*/
/*!
\fn bool Event::operator>( const Event & ) const
\internal
*/
/*!
\fn bool Event::operator>=( const Event & ) const
\internal
*/
/*!
\enum Event::RepeatType
This enum defines how a event will repeat, if at all.
<ul>
<li>\c NoRepeat - Event does not repeat.
<li>\c Daily - Event occurs every n days.
<li>\c Weekly - Event occurs every n weeks.
<li>\c MonthlyDay - Event occurs every n months. Event will always occur in
the same week and same day of week as the first event.
<li>\c MonthlyDate - Event occurs every n months. Event will always occur
on the same day of the month as the first event.
<li>\c Yearly - Event occurs every n years.
</ul>
*/
/*!
\fn bool Event::isAllDay() const
Returns TRUE if the event is an all day event. Otherwise returns FALSE.
*/
/*!
\fn void Event::setAllDay(bool allday)
If \a allday is TRUE, will set the event to be an all day event.
Otherwise sets the event to not be an all day event.
\warning This function may affect the start and end times of the event.
*/
/*!
- \fn QDateTime Event::start() const
+ \fn QDateTime Event::start(bool) const
Returns the start date and time of the first occurance of the event.
*/
/*!
- \fn QDateTime Event::end() const
+ \fn QDateTime Event::end(bool) const
Returns the end date and time of the first occurance of the event.
*/
/*!
\fn time_t Event::startTime() const
\internal
*/
/*!
\fn time_t Event::endTime() const
\internal
*/
/*!
\fn void Event::setAlarm(int delay, SoundTypeChoice s)
Sets the alarm delay of the event to \a delay and the sound type of the
alarm to \a s.
*/
/*!
\fn void Event::clearAlarm()
Clears the alarm for the event.
*/
/*!
\fn int Event::alarmDelay() const
Returns the delay in minutes between the alarm for an event and the
start of the event.
*/
/*!
\fn Event::RepeatType Event::repeatType() const
Returns the repeat pattern type for the event.
\sa frequency()
*/
/*!
\fn int Event::weekOffset() const
Returns the number of weeks from the start of the month that this event
occurs.
*/
diff --git a/library/backend/palmtoprecord.h b/library/backend/palmtoprecord.h
index 72f7d1c..15cdd6a 100644
--- a/library/backend/palmtoprecord.h
+++ b/library/backend/palmtoprecord.h
@@ -1,85 +1,97 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QTPALMTOP_RECORD_H
#define QTPALMTOP_RECORD_H
#include <qglobal.h>
#include "qpcglobal.h"
#include "palmtopuidgen.h"
#include <qarray.h>
#include <qmap.h>
#if defined(QPC_TEMPLATEDLL)
// MOC_SKIP_BEGIN
QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<QString, QString>;
// MOC_SKIP_END
#endif
class QRegExp;
+/**
+ * @short Qtopia namespace
+ * The namespace of Qtopia
+ */
namespace Qtopia {
class RecordPrivate;
+/**
+ * @short The base class of all Records
+ *
+ * The base class for Records in Qtopia
+ * @see Task
+ * @see Event
+ * @see Contact
+ */
class QPC_EXPORT Record
{
public:
Record() : mUid(0), mCats() { }
Record( const Record &c ) : mUid( c.mUid ), mCats ( c.mCats ), customMap(c.customMap) { }
virtual ~Record() { }
Record &operator=( const Record &c );
virtual bool match( const QRegExp & ) const { return FALSE; }
void setCategories( const QArray<int> &v ) { mCats = v; mCats.sort(); }
void setCategories( int single );
const QArray<int> &categories() const { return mCats; }
void reassignCategoryId( int oldId, int newId )
{
int index = mCats.find( oldId );
if ( index >= 0 )
mCats[index] = newId;
}
int uid() const { return mUid; };
virtual void setUid( int i ) { mUid = i; uidGen().store( mUid ); }
bool isValidUid() const { return mUid != 0; }
void assignUid() { setUid( uidGen().generate() ); }
virtual QString customField(const QString &) const;
virtual void setCustomField(const QString &, const QString &);
virtual void removeCustomField(const QString &);
virtual bool operator == ( const Record &r ) const
{ return mUid == r.mUid; }
virtual bool operator != ( const Record &r ) const
{ return mUid != r.mUid; }
// convenience methods provided for loading and saving to xml
static QString idsToString( const QArray<int> &ids );
// convenience methods provided for loading and saving to xml
static QArray<int> idsFromString( const QString &str );
// for debugging
static void dump( const QMap<int, QString> &map );
protected:
virtual UidGen &uidGen() = 0;
virtual QString customToXml() const;
private: