• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdemultimedia API Reference
  • KDE Home
  • Contact Us
 

libkcddb

  • sources
  • kde-4.14
  • kdemultimedia
  • libkcddb
  • libkcddb
httpsubmit.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002 Benjamin Meyer <ben-devel@meyerhome.net>
3  Copyright (C) 2003 Richard Lärkäng <nouseforaname@home.se>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "httpsubmit.h"
22 
23 #include <kdebug.h>
24 #include <kio/job.h>
25 
26 namespace KCDDB
27 {
28  HTTPSubmit::HTTPSubmit(const QString& from, const QString& hostname, uint port)
29  : Submit(), from_(from)
30  {
31  url_.setProtocol( QLatin1String( "http" ));
32  url_.setHost(hostname);
33  url_.setPort(port);
34  url_.setPath(QLatin1String( "/~cddb/submit.cgi" ));
35  }
36 
37  HTTPSubmit::~HTTPSubmit()
38  {
39 
40  }
41 
42  KIO::Job* HTTPSubmit::createJob(const CDInfo& cdInfo)
43  {
44  KIO::TransferJob* job = KIO::http_post(url_, diskData_.toUtf8().data(), KIO::HideProgressInfo);
45 
46  job->addMetaData(QLatin1String( "content-type" ), QLatin1String( "Content-Type: text/plain" ));
47  QString header;
48 
49  header += QLatin1String( "Content-Type: text/plain\n" );
50 
51  header += QLatin1String( "Category: " ) + cdInfo.get(Category).toString() + QLatin1Char( '\n' );
52  header += QLatin1String( "Discid: " ) + cdInfo.get(QLatin1String( "discid" )).toString() + QLatin1Char( '\n' );
53  header += QLatin1String( "User-Email: " ) + from_ + QLatin1Char( '\n' );
54  //header += QLatin1String( "Submit-Mode: test\n" );
55  header += QLatin1String( "Submit-Mode: submit\n" );
56  header += QLatin1String( "Charset: UTF-8" );
57 
58  job->addMetaData(QLatin1String( "customHTTPHeader" ), header);
59 
60  return job;
61  }
62 }
KCDDB::HTTPSubmit::createJob
virtual KIO::Job * createJob(const CDInfo &cdInfo)
Definition: httpsubmit.cpp:42
KCDDB::Category
The freedb category of the entry.
Definition: cdinfo.h:46
KCDDB::CDInfo::get
QVariant get(const QString &type) const
Get data for type that has been assigned to this disc.
Definition: cdinfo.cpp:518
KCDDB::Submit
Definition: submit.h:37
KCDDB::CDInfo
Information about a CD.
Definition: cdinfo.h:117
QString
QLatin1Char
KCDDB::HTTPSubmit::~HTTPSubmit
virtual ~HTTPSubmit()
Definition: httpsubmit.cpp:37
KCDDB::Submit::diskData_
QString diskData_
Definition: submit.h:60
KCDDB::HTTPSubmit::HTTPSubmit
HTTPSubmit(const QString &from, const QString &hostname, uint port)
Definition: httpsubmit.cpp:28
QLatin1String
httpsubmit.h
KCDDB::HTTPSubmit::url_
KUrl url_
Definition: httpsubmit.h:36
QByteArray::data
char * data()
KCDDB::HTTPSubmit::from_
QString from_
Definition: httpsubmit.h:37
QVariant::toString
QString toString() const
QString::toUtf8
QByteArray toUtf8() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:28:13 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkcddb

Skip menu "libkcddb"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdemultimedia API Reference

Skip menu "kdemultimedia API Reference"
  • libkcddb
  • libkcompactdisc

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal