|
|
|
@ -191,7 +191,7 @@ bool ResourceXMLRPC::doOpen()
|
|
|
|
|
mServer->setUrl( KURL( mPrefs->url() ) );
|
|
|
|
|
mServer->setUserAgent( "KDE-Calendar" );
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQVariant> args;
|
|
|
|
|
TQStringVariantMap args;
|
|
|
|
|
args.insert( "domain", mPrefs->domain() );
|
|
|
|
|
args.insert( "username", mPrefs->user() );
|
|
|
|
|
args.insert( "password", mPrefs->password() );
|
|
|
|
@ -209,7 +209,7 @@ void ResourceXMLRPC::doClose()
|
|
|
|
|
{
|
|
|
|
|
kdDebug(5800) << "ResourceXMLRPC::doClose()" << endl;
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQVariant> args;
|
|
|
|
|
TQStringVariantMap args;
|
|
|
|
|
args.insert( "sessionid", mSessionID );
|
|
|
|
|
args.insert( "kp3", mKp3 );
|
|
|
|
|
|
|
|
|
@ -238,7 +238,7 @@ bool ResourceXMLRPC::doLoad()
|
|
|
|
|
mTodoStateMapper.setIdentifier( type() + "_" + identifier() );
|
|
|
|
|
mTodoStateMapper.load();
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQVariant> args, columns;
|
|
|
|
|
TQStringVariantMap args, columns;
|
|
|
|
|
args.insert( "start", TQDateTime( TQDate::currentDate().addDays( -12 ) ) );
|
|
|
|
|
args.insert( "end", TQDateTime( TQDate::currentDate().addDays( 2000 ) ) );
|
|
|
|
|
|
|
|
|
@ -256,7 +256,7 @@ bool ResourceXMLRPC::doLoad()
|
|
|
|
|
this, TQT_SLOT( listTodosFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
|
|
|
|
|
this, TQT_SLOT( fault( int, const TQString&, const TQVariant& ) ) );
|
|
|
|
|
|
|
|
|
|
mServer->call( LoadEventCategoriesCommand, TQVariant( TQMap<TQString, TQVariant>() ),
|
|
|
|
|
mServer->call( LoadEventCategoriesCommand, TQVariant( TQStringVariantMap() ),
|
|
|
|
|
this, TQT_SLOT( loadEventCategoriesFinished( const TQValueList<TQVariant>&, const TQVariant& ) ),
|
|
|
|
|
this, TQT_SLOT( fault( int, const TQString&, const TQVariant& ) ) );
|
|
|
|
|
|
|
|
|
@ -281,7 +281,7 @@ bool ResourceXMLRPC::doSave()
|
|
|
|
|
uint counter = 0;
|
|
|
|
|
for ( evIt = events.begin(); evIt != events.end(); ++evIt ) {
|
|
|
|
|
if ( !(*evIt)->isReadOnly() ) {
|
|
|
|
|
TQMap<TQString, TQVariant> args;
|
|
|
|
|
TQStringVariantMap args;
|
|
|
|
|
writeEvent( (*evIt), args );
|
|
|
|
|
|
|
|
|
|
args.insert( "id", idMapper().remoteId( (*evIt)->uid() ).toInt() );
|
|
|
|
@ -297,7 +297,7 @@ bool ResourceXMLRPC::doSave()
|
|
|
|
|
|
|
|
|
|
for ( todoIt = todos.begin(); todoIt != todos.end(); ++todoIt ) {
|
|
|
|
|
if ( !(*todoIt)->isReadOnly() ) {
|
|
|
|
|
TQMap<TQString, TQVariant> args;
|
|
|
|
|
TQStringVariantMap args;
|
|
|
|
|
writeTodo( (*todoIt), args );
|
|
|
|
|
|
|
|
|
|
args.insert( "id", idMapper().remoteId( (*todoIt)->uid() ).toInt() );
|
|
|
|
@ -329,7 +329,7 @@ TDEABC::Lock *ResourceXMLRPC::lock()
|
|
|
|
|
|
|
|
|
|
bool ResourceXMLRPC::addEvent( Event* ev )
|
|
|
|
|
{
|
|
|
|
|
TQMap<TQString, TQVariant> args;
|
|
|
|
|
TQStringVariantMap args;
|
|
|
|
|
|
|
|
|
|
disableChangeNotification();
|
|
|
|
|
|
|
|
|
@ -409,7 +409,7 @@ Event::List ResourceXMLRPC::rawEvents()
|
|
|
|
|
|
|
|
|
|
bool ResourceXMLRPC::addTodo( Todo *todo )
|
|
|
|
|
{
|
|
|
|
|
TQMap<TQString, TQVariant> args;
|
|
|
|
|
TQStringVariantMap args;
|
|
|
|
|
|
|
|
|
|
disableChangeNotification();
|
|
|
|
|
|
|
|
|
@ -516,7 +516,7 @@ void ResourceXMLRPC::reload()
|
|
|
|
|
void ResourceXMLRPC::loginFinished( const TQValueList<TQVariant>& variant,
|
|
|
|
|
const TQVariant& )
|
|
|
|
|
{
|
|
|
|
|
TQMap<TQString, TQVariant> map = variant[ 0 ].toMap();
|
|
|
|
|
TQStringVariantMap map = variant[ 0 ].toMap();
|
|
|
|
|
|
|
|
|
|
KURL url = KURL( mPrefs->url() );
|
|
|
|
|
if ( map[ "GOAWAY" ].toString() == "XOXO" ) { // failed
|
|
|
|
@ -536,7 +536,7 @@ void ResourceXMLRPC::loginFinished( const TQValueList<TQVariant>& variant,
|
|
|
|
|
void ResourceXMLRPC::logoutFinished( const TQValueList<TQVariant>& variant,
|
|
|
|
|
const TQVariant& )
|
|
|
|
|
{
|
|
|
|
|
TQMap<TQString, TQVariant> map = variant[ 0 ].toMap();
|
|
|
|
|
TQStringVariantMap map = variant[ 0 ].toMap();
|
|
|
|
|
|
|
|
|
|
if ( map[ "GOODBYE" ].toString() != "XOXO" )
|
|
|
|
|
kdError() << "logout failed" << endl;
|
|
|
|
@ -562,7 +562,7 @@ void ResourceXMLRPC::listEventsFinished( const TQValueList<TQVariant>& list,
|
|
|
|
|
|
|
|
|
|
bool changed = false;
|
|
|
|
|
for ( eventIt = eventList.begin(); eventIt != eventList.end(); ++eventIt ) {
|
|
|
|
|
TQMap<TQString, TQVariant> map = (*eventIt).toMap();
|
|
|
|
|
TQStringVariantMap map = (*eventIt).toMap();
|
|
|
|
|
|
|
|
|
|
Event *event = new Event;
|
|
|
|
|
event->setFloats( false );
|
|
|
|
@ -644,8 +644,8 @@ void ResourceXMLRPC::loadEventCategoriesFinished( const TQValueList<TQVariant> &
|
|
|
|
|
{
|
|
|
|
|
mEventCategoryMap.clear();
|
|
|
|
|
|
|
|
|
|
const TQMap<TQString, TQVariant> map = mapList[ 0 ].toMap();
|
|
|
|
|
TQMap<TQString, TQVariant>::ConstIterator it;
|
|
|
|
|
const TQStringVariantMap map = mapList[ 0 ].toMap();
|
|
|
|
|
TQStringVariantMap::ConstIterator it;
|
|
|
|
|
|
|
|
|
|
KPimPrefs prefs( "korganizerrc" );
|
|
|
|
|
for ( it = map.begin(); it != map.end(); ++it ) {
|
|
|
|
@ -673,7 +673,7 @@ void ResourceXMLRPC::listTodosFinished( const TQValueList<TQVariant>& list,
|
|
|
|
|
|
|
|
|
|
bool changed = false;
|
|
|
|
|
for ( todoIt = todoList.begin(); todoIt != todoList.end(); ++todoIt ) {
|
|
|
|
|
TQMap<TQString, TQVariant> map = (*todoIt).toMap();
|
|
|
|
|
TQStringVariantMap map = (*todoIt).toMap();
|
|
|
|
|
|
|
|
|
|
Todo *todo = new Todo;
|
|
|
|
|
|
|
|
|
@ -749,8 +749,8 @@ void ResourceXMLRPC::loadTodoCategoriesFinished( const TQValueList<TQVariant> &m
|
|
|
|
|
{
|
|
|
|
|
mTodoCategoryMap.clear();
|
|
|
|
|
|
|
|
|
|
const TQMap<TQString, TQVariant> map = mapList[ 0 ].toMap();
|
|
|
|
|
TQMap<TQString, TQVariant>::ConstIterator it;
|
|
|
|
|
const TQStringVariantMap map = mapList[ 0 ].toMap();
|
|
|
|
|
TQStringVariantMap::ConstIterator it;
|
|
|
|
|
|
|
|
|
|
KPimPrefs prefs( "korganizerrc" );
|
|
|
|
|
for ( it = map.begin(); it != map.end(); ++it ) {
|
|
|
|
@ -773,7 +773,7 @@ void ResourceXMLRPC::fault( int error, const TQString& errorMsg,
|
|
|
|
|
mSynchronizer->stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ResourceXMLRPC::readEvent( const TQMap<TQString, TQVariant> &args, Event *event,
|
|
|
|
|
void ResourceXMLRPC::readEvent( const TQStringVariantMap &args, Event *event,
|
|
|
|
|
TQString &uid )
|
|
|
|
|
{
|
|
|
|
|
// for recurrence
|
|
|
|
@ -784,7 +784,7 @@ void ResourceXMLRPC::readEvent( const TQMap<TQString, TQVariant> &args, Event *e
|
|
|
|
|
TQDateTime rEndDate;
|
|
|
|
|
TQValueList<TQDateTime> rExceptions;
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQVariant>::ConstIterator it;
|
|
|
|
|
TQStringVariantMap::ConstIterator it;
|
|
|
|
|
for ( it = args.begin(); it != args.end(); ++it ) {
|
|
|
|
|
if ( it.key() == "id" ) {
|
|
|
|
|
uid = it.data().toString();
|
|
|
|
@ -816,8 +816,8 @@ void ResourceXMLRPC::readEvent( const TQMap<TQString, TQVariant> &args, Event *e
|
|
|
|
|
event->setSecrecy( (it.data().toString() == "public" ?
|
|
|
|
|
Incidence::SecrecyPublic : Incidence::SecrecyPrivate) );
|
|
|
|
|
} else if ( it.key() == "category" ) {
|
|
|
|
|
const TQMap<TQString, TQVariant> categories = it.data().toMap();
|
|
|
|
|
TQMap<TQString, TQVariant>::ConstIterator catIt;
|
|
|
|
|
const TQStringVariantMap categories = it.data().toMap();
|
|
|
|
|
TQStringVariantMap::ConstIterator catIt;
|
|
|
|
|
|
|
|
|
|
TQStringList eventCategories;
|
|
|
|
|
for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
|
|
|
|
@ -850,17 +850,17 @@ void ResourceXMLRPC::readEvent( const TQMap<TQString, TQVariant> &args, Event *e
|
|
|
|
|
} else if ( it.key() == "recur_data" ) {
|
|
|
|
|
rData = it.data().toInt();
|
|
|
|
|
} else if ( it.key() == "recur_exception" ) {
|
|
|
|
|
const TQMap<TQString, TQVariant> dateList = it.data().toMap();
|
|
|
|
|
TQMap<TQString, TQVariant>::ConstIterator dateIt;
|
|
|
|
|
const TQStringVariantMap dateList = it.data().toMap();
|
|
|
|
|
TQStringVariantMap::ConstIterator dateIt;
|
|
|
|
|
|
|
|
|
|
for ( dateIt = dateList.begin(); dateIt != dateList.end(); ++dateIt )
|
|
|
|
|
rExceptions.append( (*dateIt).toDateTime() );
|
|
|
|
|
} else if ( it.key() == "participants" ) {
|
|
|
|
|
const TQMap<TQString, TQVariant> persons = it.data().toMap();
|
|
|
|
|
TQMap<TQString, TQVariant>::ConstIterator personsIt;
|
|
|
|
|
const TQStringVariantMap persons = it.data().toMap();
|
|
|
|
|
TQStringVariantMap::ConstIterator personsIt;
|
|
|
|
|
|
|
|
|
|
for ( personsIt = persons.begin(); personsIt != persons.end(); ++personsIt ) {
|
|
|
|
|
TQMap<TQString, TQVariant> person = (*personsIt).toMap();
|
|
|
|
|
TQStringVariantMap person = (*personsIt).toMap();
|
|
|
|
|
Attendee::PartStat status = Attendee::InProcess;
|
|
|
|
|
if ( person[ "status" ] == "A" )
|
|
|
|
|
status = Attendee::Accepted;
|
|
|
|
@ -878,11 +878,11 @@ void ResourceXMLRPC::readEvent( const TQMap<TQString, TQVariant> &args, Event *e
|
|
|
|
|
event->addAttendee( attendee );
|
|
|
|
|
}
|
|
|
|
|
} else if ( it.key() == "alarm" ) {
|
|
|
|
|
const TQMap<TQString, TQVariant> alarmList = it.data().toMap();
|
|
|
|
|
TQMap<TQString, TQVariant>::ConstIterator alarmIt;
|
|
|
|
|
const TQStringVariantMap alarmList = it.data().toMap();
|
|
|
|
|
TQStringVariantMap::ConstIterator alarmIt;
|
|
|
|
|
|
|
|
|
|
for ( alarmIt = alarmList.begin(); alarmIt != alarmList.end(); ++alarmIt ) {
|
|
|
|
|
TQMap<TQString, TQVariant> alarm = (*alarmIt).toMap();
|
|
|
|
|
TQStringVariantMap alarm = (*alarmIt).toMap();
|
|
|
|
|
|
|
|
|
|
Alarm *vAlarm = event->newAlarm();
|
|
|
|
|
vAlarm->setText( event->summary() );
|
|
|
|
@ -940,7 +940,7 @@ void ResourceXMLRPC::readEvent( const TQMap<TQString, TQVariant> &args, Event *e
|
|
|
|
|
setRights( event, rights );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ResourceXMLRPC::writeEvent( Event *event, TQMap<TQString, TQVariant> &args )
|
|
|
|
|
void ResourceXMLRPC::writeEvent( Event *event, TQStringVariantMap &args )
|
|
|
|
|
{
|
|
|
|
|
args.insert( "start", event->dtStart() );
|
|
|
|
|
|
|
|
|
@ -961,7 +961,7 @@ void ResourceXMLRPC::writeEvent( Event *event, TQMap<TQString, TQVariant> &args
|
|
|
|
|
// CATEGORY
|
|
|
|
|
const TQStringList categories = event->categories();
|
|
|
|
|
TQStringList::ConstIterator catIt;
|
|
|
|
|
TQMap<TQString, TQVariant> catMap;
|
|
|
|
|
TQStringVariantMap catMap;
|
|
|
|
|
int counter = 0;
|
|
|
|
|
for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
|
|
|
|
|
TQMap<TQString, int>::Iterator it = mEventCategoryMap.find( *catIt );
|
|
|
|
@ -990,7 +990,7 @@ void ResourceXMLRPC::writeEvent( Event *event, TQMap<TQString, TQVariant> &args
|
|
|
|
|
args.insert( "recur_interval", int( 0 ) );
|
|
|
|
|
args.insert( "recur_enddate", TQDateTime() );
|
|
|
|
|
args.insert( "recur_data", int( 0 ) );
|
|
|
|
|
args.insert( "recur_exception", TQMap<TQString, TQVariant>() );
|
|
|
|
|
args.insert( "recur_exception", TQStringVariantMap() );
|
|
|
|
|
} else {
|
|
|
|
|
switch ( rec->recurrenceType() ) {
|
|
|
|
|
case Recurrence::rDaily:
|
|
|
|
@ -1036,7 +1036,7 @@ void ResourceXMLRPC::writeEvent( Event *event, TQMap<TQString, TQVariant> &args
|
|
|
|
|
// TODO: Also use exception dates!
|
|
|
|
|
const TQValueList<TQDateTime> dates = event->recurrence()->exDateTimes();
|
|
|
|
|
TQValueList<TQDateTime>::ConstIterator dateIt;
|
|
|
|
|
TQMap<TQString, TQVariant> exMap;
|
|
|
|
|
TQStringVariantMap exMap;
|
|
|
|
|
int counter = 0;
|
|
|
|
|
for ( dateIt = dates.begin(); dateIt != dates.end(); ++dateIt, ++counter )
|
|
|
|
|
exMap.insert( TQString::number( counter ), *dateIt );
|
|
|
|
@ -1047,9 +1047,9 @@ void ResourceXMLRPC::writeEvent( Event *event, TQMap<TQString, TQVariant> &args
|
|
|
|
|
// PARTICIPANTS
|
|
|
|
|
const Attendee::List attendees = event->attendees();
|
|
|
|
|
Attendee::List::ConstIterator attIt;
|
|
|
|
|
TQMap<TQString, TQVariant> persons;
|
|
|
|
|
TQStringVariantMap persons;
|
|
|
|
|
for ( attIt = attendees.begin(); attIt != attendees.end(); ++attIt ) {
|
|
|
|
|
TQMap<TQString, TQVariant> person;
|
|
|
|
|
TQStringVariantMap person;
|
|
|
|
|
TQString status;
|
|
|
|
|
|
|
|
|
|
if ( (*attIt)->status() == Attendee::Accepted )
|
|
|
|
@ -1072,9 +1072,9 @@ void ResourceXMLRPC::writeEvent( Event *event, TQMap<TQString, TQVariant> &args
|
|
|
|
|
// ALARMS
|
|
|
|
|
const Alarm::List alarms = event->alarms();
|
|
|
|
|
Alarm::List::ConstIterator alarmIt;
|
|
|
|
|
TQMap<TQString, TQVariant> alarmMap;
|
|
|
|
|
TQStringVariantMap alarmMap;
|
|
|
|
|
for ( alarmIt = alarms.begin(); alarmIt != alarms.end(); ++alarmIt ) {
|
|
|
|
|
TQMap<TQString, TQVariant> alarm;
|
|
|
|
|
TQStringVariantMap alarm;
|
|
|
|
|
alarm.insert( "time", (*alarmIt)->time() );
|
|
|
|
|
alarm.insert( "offset", (*alarmIt)->startOffset().asSeconds() );
|
|
|
|
|
alarm.insert( "enabled", ( (*alarmIt)->enabled() ? int( 1 ) : int( 0 ) ) );
|
|
|
|
@ -1085,7 +1085,7 @@ void ResourceXMLRPC::writeEvent( Event *event, TQMap<TQString, TQVariant> &args
|
|
|
|
|
args.insert( "alarm", alarmMap );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ResourceXMLRPC::writeTodo( Todo* todo, TQMap<TQString, TQVariant>& args )
|
|
|
|
|
void ResourceXMLRPC::writeTodo( Todo* todo, TQStringVariantMap& args )
|
|
|
|
|
{
|
|
|
|
|
args.insert( "subject", todo->summary() );
|
|
|
|
|
args.insert( "des", todo->description() );
|
|
|
|
@ -1093,7 +1093,7 @@ void ResourceXMLRPC::writeTodo( Todo* todo, TQMap<TQString, TQVariant>& args )
|
|
|
|
|
(todo->secrecy() == Todo::SecrecyPublic ? "public" : "private" ) );
|
|
|
|
|
|
|
|
|
|
// CATEGORIES
|
|
|
|
|
TQMap<TQString, TQVariant> catMap;
|
|
|
|
|
TQStringVariantMap catMap;
|
|
|
|
|
|
|
|
|
|
const TQStringList categories = todo->categories();
|
|
|
|
|
TQStringList::ConstIterator catIt;
|
|
|
|
@ -1124,7 +1124,7 @@ void ResourceXMLRPC::writeTodo( Todo* todo, TQMap<TQString, TQVariant>& args )
|
|
|
|
|
args.insert( "status", status );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ResourceXMLRPC::readTodo( const TQMap<TQString, TQVariant>& args, Todo *todo, TQString &uid )
|
|
|
|
|
void ResourceXMLRPC::readTodo( const TQStringVariantMap& args, Todo *todo, TQString &uid )
|
|
|
|
|
{
|
|
|
|
|
uid = args[ "id" ].toString();
|
|
|
|
|
|
|
|
|
@ -1141,8 +1141,8 @@ void ResourceXMLRPC::readTodo( const TQMap<TQString, TQVariant>& args, Todo *tod
|
|
|
|
|
todo->setSecrecy( args[ "access" ].toString() == "public" ? Todo::SecrecyPublic : Todo::SecrecyPrivate );
|
|
|
|
|
|
|
|
|
|
// CATEGORIES
|
|
|
|
|
const TQMap<TQString, TQVariant> categories = args[ "category" ].toMap();
|
|
|
|
|
TQMap<TQString, TQVariant>::ConstIterator it;
|
|
|
|
|
const TQStringVariantMap categories = args[ "category" ].toMap();
|
|
|
|
|
TQStringVariantMap::ConstIterator it;
|
|
|
|
|
|
|
|
|
|
TQStringList todoCategories;
|
|
|
|
|
for ( it = categories.begin(); it != categories.end(); ++it ) {
|
|
|
|
|