~rpadovani/oxide/type-info

« back to all changes in this revision

Viewing changes to qt/core/api/oxideqdownloadrequest.cc

  • Committer: Riccardo Padovani
  • Date: 2015-10-19 07:56:29 UTC
  • mfrom: (1088.1.131 oxide)
  • Revision ID: riccardo@rpadovani.com-20151019075629-z0mlhwlb9xflkovw
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// vim:expandtab:shiftwidth=2:tabstop=2:
2
 
// Copyright (C) 2014 Canonical Ltd.
 
2
// Copyright (C) 2014-2015 Canonical Ltd.
3
3
 
4
4
// This library is free software; you can redistribute it and/or
5
5
// modify it under the terms of the GNU Lesser General Public
16
16
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
18
18
#include "oxideqdownloadrequest.h"
19
 
#include "oxideqdownloadrequest_p.h"
20
19
 
21
20
#include "net/http/http_request_headers.h"
22
21
#include "url/gurl.h"
25
24
const QString kCookieListDelimiter = ";";
26
25
}
27
26
 
28
 
OxideQDownloadRequestPrivate::OxideQDownloadRequestPrivate(
 
27
class OxideQDownloadRequestData : public QSharedData {
 
28
 public:
 
29
  OxideQDownloadRequestData(const QUrl& url,
 
30
                            const QString& mime_type,
 
31
                            bool should_prompt,
 
32
                            const QString& suggested_filename,
 
33
                            const QStringList& cookies,
 
34
                            const QString& referrer,
 
35
                            const QString& user_agent)
 
36
      : url(url),
 
37
        mime_type(mime_type),
 
38
        should_prompt(should_prompt),
 
39
        suggested_filename(suggested_filename),
 
40
        cookies(cookies),
 
41
        referrer(referrer),
 
42
        user_agent(user_agent) {}
 
43
 
 
44
  OxideQDownloadRequestData()
 
45
      : should_prompt(false) {}
 
46
 
 
47
  QUrl url;
 
48
  QString mime_type;
 
49
  bool should_prompt;
 
50
  QString suggested_filename;
 
51
  QStringList cookies;
 
52
  QString referrer;
 
53
  QString user_agent;
 
54
};
 
55
 
 
56
OxideQDownloadRequest::OxideQDownloadRequest(
29
57
    const QUrl& url,
30
58
    const QString& mimeType,
31
59
    const bool shouldPrompt,
32
60
    const QString& suggestedFilename,
33
 
    const QStringList& cookies,
 
61
    const QString& cookies,
34
62
    const QString& referrer,
35
63
    const QString& userAgent)
36
 
  : url_(url),
37
 
    mime_type_(mimeType),
38
 
    should_prompt_(shouldPrompt),
39
 
    suggested_filename_(suggestedFilename),
40
 
    cookies_(cookies),
41
 
    referrer_(referrer),
42
 
    user_agent_(userAgent) {}
43
 
 
44
 
OxideQDownloadRequestPrivate::~OxideQDownloadRequestPrivate() {}
45
 
 
46
 
OxideQDownloadRequest::OxideQDownloadRequest(
47
 
    const QUrl& url,
48
 
    const QString& mimeType,
49
 
    const bool shouldPrompt,
50
 
    const QString& suggestedFilename,
51
 
    const QString& cookies,
52
 
    const QString& referrer,
53
 
    const QString& userAgent,
54
 
    QObject* parent) :
55
 
      QObject(parent),
56
 
      d_ptr(new OxideQDownloadRequestPrivate(url,
 
64
    : d(new OxideQDownloadRequestData(
 
65
          url,
57
66
          mimeType,
58
67
          shouldPrompt,
59
68
          suggestedFilename,
60
69
          cookies.split(kCookieListDelimiter, QString::SkipEmptyParts),
61
70
          referrer,
62
 
          userAgent)) {
63
 
}
 
71
          userAgent)) {}
 
72
 
 
73
OxideQDownloadRequest::OxideQDownloadRequest()
 
74
    : d(new OxideQDownloadRequestData()) {}
64
75
 
65
76
OxideQDownloadRequest::~OxideQDownloadRequest() {}
66
77
 
 
78
OxideQDownloadRequest::OxideQDownloadRequest(
 
79
    const OxideQDownloadRequest& other)
 
80
    : d(other.d) {}
 
81
 
 
82
OxideQDownloadRequest OxideQDownloadRequest::operator=(
 
83
    const OxideQDownloadRequest& other) {
 
84
  d = other.d;
 
85
  return *this;
 
86
}
 
87
 
 
88
bool OxideQDownloadRequest::operator==(
 
89
    const OxideQDownloadRequest& other) const {
 
90
  return d == other.d;
 
91
}
 
92
 
 
93
bool OxideQDownloadRequest::operator!=(
 
94
    const OxideQDownloadRequest& other) const {
 
95
  return !(*this == other);
 
96
}
 
97
 
67
98
QUrl OxideQDownloadRequest::url() const {
68
 
  Q_D(const OxideQDownloadRequest);
69
 
 
70
 
  return d->url_;
 
99
  return d->url;
71
100
}
72
101
 
73
102
QString OxideQDownloadRequest::mimeType() const {
74
 
  Q_D(const OxideQDownloadRequest);
75
 
 
76
 
  return d->mime_type_;
 
103
  return d->mime_type;
77
104
}
78
105
 
79
106
bool OxideQDownloadRequest::shouldPrompt() const {
80
 
  Q_D(const OxideQDownloadRequest);
81
 
 
82
 
  return d->should_prompt_;
 
107
  return d->should_prompt;
83
108
}
84
109
 
85
110
QString OxideQDownloadRequest::suggestedFilename() const {
86
 
  Q_D(const OxideQDownloadRequest);
87
 
 
88
 
  return d->suggested_filename_;
 
111
  return d->suggested_filename;
89
112
}
90
113
 
91
114
QStringList OxideQDownloadRequest::cookies() const {
92
 
  Q_D(const OxideQDownloadRequest);
93
 
 
94
 
  return d->cookies_;
 
115
  return d->cookies;
95
116
}
96
117
 
97
118
QString OxideQDownloadRequest::referrer() const {
98
 
  Q_D(const OxideQDownloadRequest);
99
 
 
100
 
  return d->referrer_;
 
119
  return d->referrer;
101
120
}
102
121
 
103
122
QString OxideQDownloadRequest::userAgent() const {
104
 
  Q_D(const OxideQDownloadRequest);
105
 
 
106
 
  return d->user_agent_;
 
123
  return d->user_agent;
107
124
}
108
125