Changeset View
Changeset View
Standalone View
Standalone View
src/aboutdialog/libattica-ocsclient/postjob.cpp
Show All 15 Lines | 1 | /* | |||
---|---|---|---|---|---|
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
19 | USA. | 19 | USA. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #include "postjob.h" | 22 | #include "postjob.h" | ||
23 | 23 | | |||
24 | #include <kio/job.h> | 24 | #include <KIO/Job> | ||
25 | #include <klocale.h> | | |||
26 | 25 | | |||
27 | #include <QXmlStreamReader> | 26 | #include <QXmlStreamReader> | ||
28 | #include <QDebug> | 27 | #include <QDebug> | ||
29 | #include <QTimer> | 28 | #include <QTimer> | ||
29 | #include <QUrlQuery> | ||||
30 | | ||||
30 | using namespace AmarokAttica; | 31 | using namespace AmarokAttica; | ||
31 | 32 | | |||
32 | PostJob::PostJob() | 33 | PostJob::PostJob() | ||
33 | : m_job( ) | 34 | : m_job( ) | ||
34 | { | 35 | { | ||
35 | } | 36 | } | ||
36 | 37 | | |||
37 | void PostJob::setUrl( const QUrl &url ) | 38 | void PostJob::setUrl( const QUrl &url ) | ||
Show All 21 Lines | 59 | { | |||
59 | return m_statusMessage; | 60 | return m_statusMessage; | ||
60 | } | 61 | } | ||
61 | 62 | | |||
62 | void PostJob::doWork() | 63 | void PostJob::doWork() | ||
63 | { | 64 | { | ||
64 | QString postData; | 65 | QString postData; | ||
65 | 66 | | |||
66 | const QStringList dataKeys = m_data.keys(); | 67 | const QStringList dataKeys = m_data.keys(); | ||
68 | QUrlQuery query; | ||||
67 | foreach( const QString &name, dataKeys ) { | 69 | foreach( const QString &name, dataKeys ) { | ||
68 | m_url.addQueryItem( name, m_data.value( name ) ); | 70 | query.addQueryItem( name, m_data.value( name ) ); | ||
69 | } | 71 | } | ||
72 | m_url.setQuery( query ); | ||||
70 | 73 | | |||
71 | qDebug() << m_url; | 74 | qDebug() << m_url; | ||
72 | 75 | | |||
73 | auto job = KIO::http_post( m_url, postData.toUtf8(), KIO::HideProgressInfo ); | 76 | auto job = KIO::http_post( m_url, postData.toUtf8(), KIO::HideProgressInfo ); | ||
74 | connect( job, &KIO::TransferJob::result, | 77 | connect( job, &KIO::TransferJob::result, | ||
75 | this, &PostJob::slotJobResult ); | 78 | this, &PostJob::slotJobResult ); | ||
76 | connect( job, &KIO::TransferJob::data, | 79 | connect( job, &KIO::TransferJob::data, | ||
77 | this, &PostJob::slotJobData ); | 80 | this, &PostJob::slotJobData ); | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |