[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepimlibs/kxmlrpcclient
From: Antonio Aloisio <antonio.aloisio () gmail ! com>
Date: 2007-07-20 14:23:00
Message-ID: 1184941380.741119.8077.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 690256 by aloisio:
Other ISO8601 format added for QTimeDate, TimeZone support required
M +26 -3 client.cpp
M +34 -0 client.h
M +26 -4 query.cpp
M +5 -1 query.h
--- trunk/KDE/kdepimlibs/kxmlrpcclient/client.cpp #690255:690256
@@ -36,14 +36,17 @@
class Client::Private
{
public:
- Private() : mUserAgent( "KDE XMLRPC resources" ), mDigestAuth( false ) {}
+ Private() : mUserAgent( "KDE XMLRPC resources" ), mDigestAuth( false )
+ , mDateFormatExtended(true)
+ , mTimeFormatExtended(true){}
void queryFinished( Query * );
KUrl mUrl;
QString mUserAgent;
bool mDigestAuth;
-
+ bool mDateFormatExtended;
+ bool mTimeFormatExtended;
QList<Query*> mPendingQueries;
};
@@ -96,6 +99,26 @@
d->mUserAgent = userAgent;
}
+void Client::setDateFormat( bool extended )
+{
+ d->mDateFormatExtended=extended;
+}
+
+void Client::setTimeFormat( bool extended )
+{
+ d->mDateFormatExtended=extended;
+}
+
+bool Client::dateFormat() const
+{
+ return d->mDateFormatExtended;
+}
+
+bool Client::timeFormat() const
+{
+ return d->mTimeFormatExtended;
+}
+
bool Client::isDigestAuthEnabled() const
{
return d->mDigestAuth;
@@ -134,7 +157,7 @@
connect( query, SIGNAL( finished( Query * ) ), this, SLOT( queryFinished( Query * ) ) );
d->mPendingQueries.append( query );
- query->call( d->mUrl.url(), method, args, metaData );
+ query->call( d->mUrl.url(), method, args, metaData, d->mDateFormatExtended, d->mTimeFormatExtended );
}
void Client::call( const QString &method, const QVariant &arg,
--- trunk/KDE/kdepimlibs/kxmlrpcclient/client.h #690255:690256
@@ -108,6 +108,40 @@
void setUserAgent( const QString &userAgent );
/**
+ Sets the Date Format the Client will use.
+ extended format: YYYY-MM-DD
+ basic format: YYYYMMDD
+ @param extended true extended format will be used.
+
+ @see dateFormat()
+ */
+ void setDateFormat( bool extended );
+
+ /**
+ Sets the Time Format the Client will use.
+ extended format: HH:MM:SS
+ basic format: HHMMSS
+ @param extended true extended format will be used.
+
+ @see timeFormat()
+ */
+ void setTimeFormat( bool extended );
+
+ /**
+ Returns true if the date format is extended
+
+ @see setDateFormat()
+ */
+ bool dateFormat() const;
+
+ /**
+ Returns true if the time format is extended
+
+ @see setTimeFormat()
+ */
+ bool timeFormat() const;
+
+ /**
Returns true if HTTP-Digest authentication is enabled, false
if not.
--- trunk/KDE/kdepimlibs/kxmlrpcclient/query.cpp #690255:690256
@@ -152,6 +152,8 @@
QByteArray mBuffer;
QVariant mId;
QList<KJob*> mPendingJobs;
+ bool mDateFormatExtended;
+ bool mTimeFormatExtended;
};
bool Query::Private::isMessageResponse( const QDomDocument &doc ) const
@@ -253,9 +255,22 @@
return "<value><base64>" + arg.toByteArray().toBase64()
+ "</base64></value>\r\n";
case QVariant::DateTime:
- return "<value><dateTime.iso8601>"
- + arg.toDateTime().toString( Qt::ISODate )
- + "</dateTime.iso8601></value>\r\n";
+ {
+ QString date;
+ QString time;
+
+ if ( mTimeFormatExtended )
+ time= arg.toDateTime().time().toString( Qt::ISODate );
+ else
+ time= arg.toDateTime().time().toString( "hhmmss");
+
+ if ( mDateFormatExtended )
+ date= arg.toDateTime().date().toString( Qt::ISODate );
+ else
+ date= arg.toDateTime().date().toString( "yyyyMMdd");
+
+ return "<value><dateTime.iso8601>" + date + "T" + time + "</dateTime.iso8601></value>\r\n";
+ }
case QVariant::List:
{
QString markup = "<value><array><data>\r\n";
@@ -407,14 +422,21 @@
void Query::call( const QString &server,
const QString &method,
const QList<QVariant> &args,
- const QMap<QString, QString> &jobMetaData )
+ const QMap<QString, QString> &jobMetaData,
+ const bool dateFormatExtended,
+ const bool timeFormatExtended)
{
+ d->mDateFormatExtended=dateFormatExtended;
+ d->mTimeFormatExtended=timeFormatExtended;
const QString xmlMarkup = d->markupCall( method, args );
+
QMap<QString, QString>::const_iterator mapIter;
QByteArray postData;
QDataStream stream( &postData, QIODevice::WriteOnly );
stream.writeRawData( xmlMarkup.toUtf8(), xmlMarkup.toUtf8().length() );
+
+
KIO::TransferJob *job = KIO::http_post( KUrl( server ), postData, false);
if ( !job ) {
--- trunk/KDE/kdepimlibs/kxmlrpcclient/query.h #690255:690256
@@ -64,10 +64,14 @@
@param method the method to call.
@param args an argument list to pass to said method.
@param jobMetaData additional arguments to pass to the KIO::Job.
+ @param dateFormatExtended an optional parameter
+ @param timeFormatExtended an optional parameter
*/
void call( const QString &server, const QString &method,
const QList<QVariant> &args,
- const QMap<QString, QString> &jobMetaData );
+ const QMap<QString, QString> &jobMetaData,
+ const bool dateFormatExtended,
+ const bool timeFormatExtended);
Q_SIGNALS:
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic