Advertisement
Guest User

Untitled

a guest
Mar 26th, 2010
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.75 KB | None | 0 0
  1. Index: attica/lib/atticabasejob.h
  2. ===================================================================
  3. --- attica/lib/atticabasejob.h (revision 1107607)
  4. +++ attica/lib/atticabasejob.h (working copy)
  5. @@ -72,7 +72,7 @@
  6. BaseJob& operator=(const BaseJob& other);
  7.  
  8. class Private;
  9. - Private* d;
  10. + Private * const d;
  11. };
  12.  
  13. }
  14. Index: attica/lib/knowledgebaseentry.h
  15. ===================================================================
  16. --- attica/lib/knowledgebaseentry.h (revision 1107607)
  17. +++ attica/lib/knowledgebaseentry.h (working copy)
  18. @@ -28,7 +28,7 @@
  19. #include <QtCore/QDateTime>
  20. #include <QtCore/QSharedDataPointer>
  21.  
  22. -#include <QUrl>
  23. +#include <QtCore/QUrl>
  24.  
  25.  
  26. namespace Attica
  27. Index: attica/lib/content.cpp
  28. ===================================================================
  29. --- attica/lib/content.cpp (revision 1107607)
  30. +++ attica/lib/content.cpp (working copy)
  31. @@ -174,7 +174,7 @@
  32. QMap<QString,QString>::const_iterator iter = d->m_extendedAttributes.constBegin();
  33. while (iter != d->m_extendedAttributes.constEnd()) {
  34. QString key = iter.key();
  35. - if (key.startsWith("downloadname")) {
  36. + if (key.startsWith(QLatin1String("downloadname"))) {
  37. bool ok;
  38. // remove "downloadlink", get the rest as number
  39. int num = key.right(key.size() - 12).toInt(&ok);
  40. Index: attica/lib/getjob.cpp
  41. ===================================================================
  42. --- attica/lib/getjob.cpp (revision 1107607)
  43. +++ attica/lib/getjob.cpp (working copy)
  44. @@ -31,15 +31,28 @@
  45. using namespace Attica;
  46.  
  47.  
  48. +class Attica::GetJobPrivate
  49. +{
  50. +public:
  51. + GetJobPrivate(const QNetworkRequest& request)
  52. + : m_request(request) {}
  53. +
  54. + const QNetworkRequest m_request;
  55. +};
  56. +
  57. GetJob::GetJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request)
  58. - : BaseJob(internals), m_request(request)
  59. + : BaseJob(internals), d(new GetJobPrivate(request))
  60. {
  61. }
  62.  
  63. +GetJob::~GetJob()
  64. +{
  65. + delete d;
  66. +}
  67.  
  68. QNetworkReply* GetJob::executeRequest()
  69. {
  70. - return internals()->get(m_request);
  71. + return internals()->get(d->m_request);
  72. }
  73.  
  74.  
  75. Index: attica/lib/content.h
  76. ===================================================================
  77. --- attica/lib/content.h (revision 1107607)
  78. +++ attica/lib/content.h (working copy)
  79. @@ -27,10 +27,10 @@
  80. #include <QtCore/QString>
  81. #include <QtCore/QMap>
  82. #include <QtCore/QSharedDataPointer>
  83. +#include <QtCore/QUrl>
  84.  
  85. #include "atticaclient_export.h"
  86. #include "downloaddescription.h"
  87. -#include <qurl.h>
  88.  
  89. class QDateTime;
  90.  
  91. Index: attica/lib/postjob.cpp
  92. ===================================================================
  93. --- attica/lib/postjob.cpp (revision 1107607)
  94. +++ attica/lib/postjob.cpp (working copy)
  95. @@ -33,38 +33,64 @@
  96.  
  97. using namespace Attica;
  98.  
  99. +class Attica::PostJobPrivate
  100. +{
  101. +public:
  102. + PostJobPrivate(const QNetworkRequest& request, QIODevice* iodevice)
  103. + : m_request(request), m_ioDevice(iodevice)
  104. + {
  105. + }
  106. + PostJobPrivate(const QNetworkRequest& request, QIODevice* iodevice, const QByteArray& byteArray)
  107. + : m_request(request), m_ioDevice(iodevice), m_byteArray(byteArray)
  108. + {
  109. + }
  110.  
  111. + QIODevice* m_ioDevice;
  112. + QByteArray m_byteArray;
  113. +
  114. + QString m_responseData;
  115. + const QNetworkRequest m_request;
  116. +
  117. + QString m_status;
  118. + QString m_statusMessage;
  119. +};
  120. +
  121. PostJob::PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, QIODevice* iodevice)
  122. - : BaseJob(internals), m_ioDevice(iodevice), m_request(request)
  123. + : BaseJob(internals), d(new PostJobPrivate(request, iodevice))
  124. {
  125. }
  126.  
  127. Attica::PostJob::PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const QByteArray& byteArray)
  128. - : BaseJob(internals), m_ioDevice(0) , m_byteArray(byteArray), m_request(request)
  129. + : BaseJob(internals), d(new PostJobPrivate(request, 0, byteArray))
  130. {
  131. }
  132.  
  133. PostJob::PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const StringMap& parameters)
  134. - : BaseJob(internals), m_ioDevice(0), m_request(request)
  135. + : BaseJob(internals), d(new PostJobPrivate(request, 0))
  136. {
  137. // Create post data
  138. int j = 0;
  139. for(StringMap::const_iterator i = parameters.begin(); i != parameters.end(); ++i) {
  140. if (j++ > 0) {
  141. - m_byteArray.append('&');
  142. + d->m_byteArray.append('&');
  143. }
  144. - m_byteArray.append(QUrl::toPercentEncoding(i.key()));
  145. - m_byteArray.append('=');
  146. - m_byteArray.append(QUrl::toPercentEncoding(i.value()));
  147. + d->m_byteArray.append(QUrl::toPercentEncoding(i.key()));
  148. + d->m_byteArray.append('=');
  149. + d->m_byteArray.append(QUrl::toPercentEncoding(i.value()));
  150. }
  151. }
  152.  
  153. +PostJob::~PostJob()
  154. +{
  155. + delete d;
  156. +}
  157. +
  158. QNetworkReply* PostJob::executeRequest()
  159. {
  160. - if (m_ioDevice) {
  161. - return internals()->post(m_request, m_ioDevice);
  162. + if (d->m_ioDevice) {
  163. + return internals()->post(d->m_request, d->m_ioDevice);
  164. } else {
  165. - return internals()->post(m_request, m_byteArray);
  166. + return internals()->post(d->m_request, d->m_byteArray);
  167. }
  168. }
  169.  
  170. Index: attica/lib/metadata.h
  171. ===================================================================
  172. --- attica/lib/metadata.h (revision 1107607)
  173. +++ attica/lib/metadata.h (working copy)
  174. @@ -25,7 +25,7 @@
  175.  
  176. #include <QtCore/QString>
  177.  
  178. -#include <QSharedDataPointer>
  179. +#include <QtCore/QSharedDataPointer>
  180.  
  181. #include "atticaclient_export.h"
  182.  
  183. Index: attica/lib/provider.cpp
  184. ===================================================================
  185. --- attica/lib/provider.cpp (revision 1107607)
  186. +++ attica/lib/provider.cpp (working copy)
  187. @@ -616,7 +616,7 @@
  188. QNetworkRequest request(url);
  189.  
  190. if (!d->m_credentialsUserName.isEmpty()) {
  191. - QString concatenated = d->m_credentialsUserName + ":" + d->m_credentialsPassword;
  192. + QString concatenated = d->m_credentialsUserName + ':' + d->m_credentialsPassword;
  193. QByteArray data = concatenated.toLocal8Bit().toBase64();
  194. QString headerData = "Basic " + data;
  195. request.setRawHeader("Authorization", headerData.toLocal8Bit());
  196. Index: attica/lib/getjob.h
  197. ===================================================================
  198. --- attica/lib/getjob.h (revision 1107607)
  199. +++ attica/lib/getjob.h (working copy)
  200. @@ -32,16 +32,19 @@
  201.  
  202. namespace Attica {
  203.  
  204. +class GetJobPrivate;
  205. +
  206. class ATTICA_EXPORT GetJob : public Attica::BaseJob
  207. {
  208. Q_OBJECT
  209.  
  210. protected:
  211. GetJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request);
  212. + ~GetJob();
  213.  
  214. private:
  215. virtual QNetworkReply* executeRequest();
  216. - const QNetworkRequest m_request;
  217. + GetJobPrivate * const d;
  218. };
  219.  
  220. }
  221. Index: attica/lib/postjob.h
  222. ===================================================================
  223. --- attica/lib/postjob.h (revision 1107607)
  224. +++ attica/lib/postjob.h (working copy)
  225. @@ -33,8 +33,11 @@
  226. typedef QMap<QString, QString> StringMap;
  227.  
  228. namespace Attica {
  229. - class Provider;
  230.  
  231. +class Provider;
  232. +
  233. +class PostJobPrivate;
  234. +
  235. class ATTICA_EXPORT PostJob : public BaseJob
  236. {
  237. Q_OBJECT
  238. @@ -43,19 +46,13 @@
  239. PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, QIODevice* data);
  240. PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const StringMap& parameters = StringMap());
  241. PostJob(const QSharedPointer<PlatformDependent>& internals, const QNetworkRequest& request, const QByteArray& byteArray);
  242. + ~PostJob();
  243.  
  244. private:
  245. virtual QNetworkReply* executeRequest();
  246. virtual void parse(const QString&);
  247.  
  248. - QIODevice* m_ioDevice;
  249. - QByteArray m_byteArray;
  250. -
  251. - QString m_responseData;
  252. - const QNetworkRequest m_request;
  253. -
  254. - QString m_status;
  255. - QString m_statusMessage;
  256. + PostJobPrivate * const d;
  257.  
  258. friend class Attica::Provider;
  259. };
  260. Index: attica/lib/provider.h
  261. ===================================================================
  262. --- attica/lib/provider.h (revision 1107607)
  263. +++ attica/lib/provider.h (working copy)
  264. @@ -28,7 +28,7 @@
  265. #include <QtCore/QSharedPointer>
  266. #include <QtCore/QString>
  267.  
  268. -#include <QUrl>
  269. +#include <QtCore/QUrl>
  270.  
  271. #include "atticaclient_export.h"
  272. #include "category.h"
  273. @@ -62,7 +62,7 @@
  274. * The Provider class represents one Open Collaboration Service provider.
  275. * Use the ProviderManager to instanciate a Provider.
  276. *
  277. - * Accessing funtions of the Provider returns a Job class that
  278. + * Accessing functions of the Provider returns a Job class that
  279. * takes care of accessing the server and parsing the result.
  280. */
  281. class ATTICA_EXPORT Provider
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement