From kde-commits Sun Apr 05 22:46:17 2009 From: George Goldberg Date: Sun, 05 Apr 2009 22:46:17 +0000 To: kde-commits Subject: playground/base/plasma/dataengines/presence Message-Id: <1238971577.442001.1480.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123897158410376 SVN commit 949799 by gberg: Misc tidyup, error checking and consistency improvements. M +3 -3 plasma-dataengine-presence.desktop M +2 -2 presence.operations M +7 -3 presenceservice.cpp M +4 -4 presencesource.cpp M +1 -1 presencesource.h M +2 -4 setrequestedpresencejob.cpp --- trunk/playground/base/plasma/dataengines/presence/plasma-dataengine-presence.desktop #949798:949799 @@ -2,11 +2,11 @@ Encoding=UTF-8 Name=Presence Name[cs]=Přítomnost -Name[el]=Παρουσία +Name[el]= αρουσία Name[et]=Kohalolek Name[fr]=Présence Name[gl]=Presenza -Name[km]=បង្ហាញ +Name[km]=បង្ ាញ Name[nds]=Anwesigkeit Name[pa]=ਮੌਜੂਦਗੀ Name[pt]=Presença @@ -28,7 +28,7 @@ Comment[pt]=Motor de Dados de Presença do Telepathy Comment[pt_BR]=Motor de Dados de Presença do Telepathy Comment[sv]=Telepathy datagränssnitt för närvaro -Comment[uk]=Рушій даних присутності для Telepathy +Comment[uk]= ушій даних присутності для Telepathy Comment[x-test]=xxTelepathy Presence Data Enginexx ServiceTypes=Plasma/DataEngine Type=Service --- trunk/playground/base/plasma/dataengines/presence/presence.operations #949798:949799 @@ -1,11 +1,11 @@ - + - + --- trunk/playground/base/plasma/dataengines/presence/presenceservice.cpp #949798:949799 @@ -38,11 +38,15 @@ Plasma::ServiceJob * PresenceService::createJob(const QString& operation, QMap& parameters) { - if (operation == "setRequestedPresence") { - return new SetRequestedPresenceJob(m_source, parameters); + if(operation == "setPresence") + { + if(parameters.contains("status") && parameters.contains("status_message")) + { + return new SetRequestedPresenceJob(m_source, parameters); + } } - // default case is to fail: + // If we don't know what to do for this operation, default to failing. return new Plasma::ServiceJob(m_source->objectName(), operation, parameters, this); } --- trunk/playground/base/plasma/dataengines/presence/presencesource.cpp #949798:949799 @@ -20,7 +20,7 @@ #include "presenceservice.h" -#include +#include #include #include @@ -101,9 +101,9 @@ kDebug(); // Output the method we are in. // Update the data of this source - setData("current_presence_type", presenceTypeToString(presence.type)); - setData("current_presence_status", presence.status); - setData("current_presence_status_message", presence.statusMessage); + setData("presence_type", presenceTypeToString(presence.type)); + setData("presence_status", presence.status); + setData("presence_status_message", presence.statusMessage); // FIXME: Make things other than just current presence available for the source. // Required to trigger emission of update signal after changing data --- trunk/playground/base/plasma/dataengines/presence/presencesource.h #949798:949799 @@ -19,7 +19,7 @@ #ifndef PLASMA_DATAENGINE_PRESENCE_PRESENCESOURCE_H #define PLASMA_DATAENGINE_PRESENCE_PRESENCESOURCE_H -#include +#include #include --- trunk/playground/base/plasma/dataengines/presence/setrequestedpresencejob.cpp #949798:949799 @@ -28,12 +28,10 @@ SetRequestedPresenceJob::SetRequestedPresenceJob(PresenceSource *source, const QMap ¶meters, QObject *parent) - : Plasma::ServiceJob(source->objectName(), "setRequestedPresence", parameters, parent), + : Plasma::ServiceJob(source->objectName(), "setPresence", parameters, parent), m_account(source->account()) { kDebug(); // Output the method we are in. - - // FIXME: Check the parameters passed are valid here. } void SetRequestedPresenceJob::start() @@ -43,7 +41,7 @@ // Call the appropriate method on the Account object Telepathy::SimplePresence rp; rp.status = parameters().value("status").toString(); - rp.statusMessage = parameters().value("statusMessage").toString(); + rp.statusMessage = parameters().value("status_message").toString(); // FIXME: Will all hell break lose here if we don't set the presence type? // FIXME: What happens if there was a status message before, but we set without one this time. Does it stay the same?