Git commit 6cfeca8e34d172f7f83b51703820b681622b60a9 by Nicolas Fella. Committed on 07/05/2023 at 14:37. Pushed by alex into branch 'master'.
Drop submission via SMTP This uses the SMTP KIO worker, which was dropped several years ago, so this is completely non-functional M +0 -8 kcmcddb/cddbconfigwidget.cpp M +0 -2 kcmcddb/cddbconfigwidget.h M +6 -110 kcmcddb/cddbconfigwidget.ui M +1 -26 kcmcddb/doc/index.docbook M +0 -27 kcmcddb/kcmcddb.cpp M +1 -3 kcmcddb/kcmcddb.h M +0 -3 libkcddb/CMakeLists.txt D +0 -45 libkcddb/asyncsmtpsubmit.cpp D +0 -39 libkcddb/asyncsmtpsubmit.h M +14 -46 libkcddb/client.cpp M +0 -4 libkcddb/config.cpp M +0 -22 libkcddb/libkcddb5.kcfg D +0 -48 libkcddb/smtpsubmit.cpp D +0 -31 libkcddb/smtpsubmit.h M +0 -6 libkcddb/submit.h D +0 -34 libkcddb/syncsmtpsubmit.cpp D +0 -26 libkcddb/syncsmtpsubmit.h M +0 -2 tests/CMakeLists.txt M +0 -1 tests/asynchttpsubmittest.cpp D +0 -71 tests/asyncsmtpsubmittest.cpp D +0 -34 tests/asyncsmtpsubmittest.h M +0 -1 tests/synchttpsubmittest.cpp D +0 -59 tests/syncsmtpsubmittest.cpp https://invent.kde.org/multimedia/libkcddb/commit/6cfeca8e34d172f7f83b51703820b681622b60a9 diff --git a/kcmcddb/cddbconfigwidget.cpp b/kcmcddb/cddbconfigwidget.cpp index e941684..f71290a 100644 --- a/kcmcddb/cddbconfigwidget.cpp +++ b/kcmcddb/cddbconfigwidget.cpp @@ -50,7 +50,6 @@ CDDBConfigWidget::CDDBConfigWidget(QWidget * parent) layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(groupBox); - connect(needsAuthenticationBox,&QAbstractButton::toggled,this, &CDDBConfigWidget::needAuthenticationChanged); connect(kcfg_FreedbLookupTransport,QOverload<int>::of(&QComboBox::activated),this, &CDDBConfigWidget::protocolChanged); connect(kcfg_FreedbLookupEnabled,&QAbstractButton::toggled,freedbServerBox,&QWidget::setEnabled); connect(mirrorListButton,&QAbstractButton::clicked,this, &CDDBConfigWidget::showMirrorList); @@ -100,11 +99,4 @@ void CDDBConfigWidget::protocolChanged() kcfg_port->setValue(8880); } -void CDDBConfigWidget::needAuthenticationChanged(bool needsAuth) -{ - kcfg_smtpUsername->setEnabled(needsAuth); - if (!needsAuth) - kcfg_smtpUsername->clear(); -} - // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff --git a/kcmcddb/cddbconfigwidget.h b/kcmcddb/cddbconfigwidget.h index bf8d5e4..e340050 100644 --- a/kcmcddb/cddbconfigwidget.h +++ b/kcmcddb/cddbconfigwidget.h @@ -23,8 +23,6 @@ class CDDBConfigWidget : public QWidget, public Ui::CDDBConfigWidgetBase virtual void showMirrorList(); virtual void protocolChanged(); - - virtual void needAuthenticationChanged(bool); }; #endif // CDDB_CONFIG_WIDGET_H diff --git a/kcmcddb/cddbconfigwidget.ui b/kcmcddb/cddbconfigwidget.ui index 617225a..f89432e 100644 --- a/kcmcddb/cddbconfigwidget.ui +++ b/kcmcddb/cddbconfigwidget.ui @@ -7,13 +7,13 @@ <string>CDDB Settings</string> </property> <layout class="QVBoxLayout"> - <property name="margin"> + <property name="margin" stdset="0"> <number>0</number> </property> <item> <widget class="QTabWidget" name="tabWidget2"> <property name="currentIndex"> - <number>0</number> + <number>1</number> </property> <widget class="QWidget" name="tabLookup"> <attribute name="title"> @@ -168,33 +168,22 @@ </layout> </item> <item> - <widget class="QGroupBox" name="kcfg_FreedbSubmitTransport"> + <widget class="QGroupBox"> <property name="title"> <string>Submit Method</string> </property> <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0" colspan="2"> - <widget class="QRadioButton" name="httpButton"> - <property name="text"> - <string>HTTP</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0"> + <item row="0" column="0"> <widget class="QLabel" name="textLabel2"> <property name="text"> <string>Server:</string> </property> </widget> </item> - <item row="1" column="1"> + <item row="0" column="1"> <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QLineEdit" name="kcfg_httpSubmitServer"> - </widget> + <widget class="QLineEdit" name="kcfg_httpSubmitServer"/> </item> <item> <widget class="QLabel" name="textLabel3_2"> @@ -214,99 +203,6 @@ </item> </layout> </item> - <item row="2" column="0" colspan="2"> - <widget class="QRadioButton" name="smtpButton"> - <property name="text"> - <string>SMTP (Email)</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLineEdit" name="kcfg_replyTo"/> - </item> - <item row="6" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLineEdit" name="kcfg_smtpHostname"/> - </item> - <item> - <widget class="QLabel" name="textLabel3"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Port:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="kcfg_smtpPort"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximum"> - <number>65535</number> - </property> - <property name="value"> - <number>25</number> - </property> - </widget> - </item> - </layout> - </item> - <item row="7" column="0" colspan="2"> - <widget class="QCheckBox" name="needsAuthenticationBox"> - <property name="text"> - <string>Server needs authentication</string> - </property> - </widget> - </item> - <item row="9" column="1"> - <widget class="QLineEdit" name="kcfg_smtpUsername"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="textLabel9_2"> - <property name="text"> - <string>Reply-To:</string> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="textLabel2_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>SMTP server:</string> - </property> - </widget> - </item> - <item row="9" column="0"> - <widget class="QLabel" name="textLabel4"> - <property name="text"> - <string>Username:</string> - </property> - </widget> - </item> </layout> </widget> </item> diff --git a/kcmcddb/doc/index.docbook b/kcmcddb/doc/index.docbook index 5774c2f..dfee7fa 100644 --- a/kcmcddb/doc/index.docbook +++ b/kcmcddb/doc/index.docbook @@ -132,35 +132,10 @@ page. The <guibutton>Defaults</guibutton> button restores the default values of server or a web server to submit new <acronym>CDDB</acronym> entries. This is useful if you do not have your own system configured as a server. </para> -<para>If you plan to submit a CDDB entry, enter your email address into the first textbox, -then you must decide between submitting between &HTTP; -and submitting the entry as an email (via &SMTP;). </para> - -<tip><para>It is simpler to submit new entries using &HTTP;. Some firewalls block this traffic. If your -firewall prevents you from sending new entries using &HTTP;, you can use &SMTP;.</para></tip> - -<para>First select either <guilabel>&HTTP;</guilabel> or <guilabel>SMTP (Email)</guilabel> to determine which -protocol to use.</para> - -<sect3 id="http-options"> -<title>Using &HTTP; to send CDDB information</title> +<para>If you plan to submit a CDDB entry, enter your email address into the first textbox. </para> <para>You can enter a server name or port number in the text boxes provided. If you want to send this information to the international servers, you do not need to change anything.</para> -</sect3> - -<sect3 id="smtp-options"> -<title>Using &SMTP; (Email) to send CDDB information</title> - -<para>To prepare to submit information using email, enter your email address in the -text box labeled <guilabel>Reply-To:</guilabel>, your email server in the text box -labeled <guilabel>SMTP server:</guilabel> and select the port number in the spinbox -labeled <guilabel>Port:</guilabel>.</para> -<para>If you need to use a password to send email using the email server, place a mark in the -check box labeled <guilabel>Server needs authentication</guilabel> and enter your -username in the text box labeled <guilabel>Username</guilabel>.</para> - -</sect3> </sect2> </sect1> diff --git a/kcmcddb/kcmcddb.cpp b/kcmcddb/kcmcddb.cpp index a8ece51..8030e20 100644 --- a/kcmcddb/kcmcddb.cpp +++ b/kcmcddb/kcmcddb.cpp @@ -64,7 +64,6 @@ CDDBModule::defaults() KCModule::defaults(); KCDDB::Config config; - updateWidgetsFromConfig( config ); } void @@ -73,31 +72,6 @@ CDDBModule::checkSettings() const KCDDB::Config config; config.load(); - - if (config.smtpHostname().isEmpty() || config.emailAddress().isEmpty() - || !config.emailAddress().contains(QLatin1String( "@" )) || - (!config.replyTo().isEmpty() && !config.replyTo().contains(QLatin1String( "@" )))) - - { - if (config.freedbSubmitTransport() == KCDDB::Submit::SMTP) - { - KMessageBox::error(widget_, i18n("freedb has been set to use HTTP for submissions " - "because the email details you have entered are " - "incomplete. Please review your email settings " - "and try again."), i18n("Incorrect Email Settings")); - config.setFreedbSubmitTransport(KCDDB::Submit::HTTP); - - config.save(); - } - } -} - - void -CDDBModule::updateWidgetsFromConfig(const KCDDB::Config & config) -{ - bool smtpUserIsEmpty = config.smtpUsername().isEmpty(); - widget_->needsAuthenticationBox->setChecked(!smtpUserIsEmpty); - widget_->kcfg_smtpUsername->setEnabled(!smtpUserIsEmpty); } void @@ -115,7 +89,6 @@ CDDBModule::load() KCDDB::Config config; config.load(); - updateWidgetsFromConfig(config); } // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff --git a/kcmcddb/kcmcddb.h b/kcmcddb/kcmcddb.h index 7dc689a..17847be 100644 --- a/kcmcddb/kcmcddb.h +++ b/kcmcddb/kcmcddb.h @@ -34,9 +34,7 @@ class CDDBModule : public KCModule void load() override; protected: - - void checkSettings() const; - void updateWidgetsFromConfig(const KCDDB::Config &); + void checkSettings() const; private: diff --git a/libkcddb/CMakeLists.txt b/libkcddb/CMakeLists.txt index 93c53a6..1c2dceb 100644 --- a/libkcddb/CMakeLists.txt +++ b/libkcddb/CMakeLists.txt @@ -78,9 +78,6 @@ target_sources(KCddb PRIVATE httplookup.cpp httplookup.h synchttplookup.cpp asynchttplookup.cpp asynchttplookup.h - smtpsubmit.cpp smtpsubmit.h - asyncsmtpsubmit.cpp asyncsmtpsubmit.h - syncsmtpsubmit.cpp syncsmtpsubmit.h submit.cpp sites.cpp sites.h httpsubmit.cpp diff --git a/libkcddb/asyncsmtpsubmit.cpp b/libkcddb/asyncsmtpsubmit.cpp deleted file mode 100644 index 5501468..0000000 --- a/libkcddb/asyncsmtpsubmit.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - SPDX-FileCopyrightText: 2003 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#include "asyncsmtpsubmit.h" -#include "logging.h" - -#include "cdinfo.h" - -#include <KIO/Job> - -namespace KCDDB -{ - AsyncSMTPSubmit::AsyncSMTPSubmit(const QString& hostname, uint port, - const QString& username, const QString& from, const QString& to ) - : SMTPSubmit( hostname, port, username, from, to ) - { - - } - - AsyncSMTPSubmit::~AsyncSMTPSubmit() - { - - } - - Result AsyncSMTPSubmit::runJob(KIO::Job* job) - { - connect( job, &KJob::result, - this, &AsyncSMTPSubmit::slotDone ); - - return Success; - } - - void AsyncSMTPSubmit::slotDone( KJob* job ) - { - qCDebug(LIBKCDDB) ; - if ( job->error()==0 ) - Q_EMIT finished( Success ); - else - Q_EMIT finished( UnknownError ); - } -} - diff --git a/libkcddb/asyncsmtpsubmit.h b/libkcddb/asyncsmtpsubmit.h deleted file mode 100644 index b0ae5b5..0000000 --- a/libkcddb/asyncsmtpsubmit.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - SPDX-FileCopyrightText: 2003-2004 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#ifndef ASYNCSMTPSUBMIT_H -#define ASYNCSMTPSUBMIT_H - -#include "smtpsubmit.h" - -class KJob; -namespace KIO -{ - class Job; -} - -namespace KCDDB -{ - class AsyncSMTPSubmit : public SMTPSubmit - { - Q_OBJECT - - public: - AsyncSMTPSubmit(const QString& hostname, uint port, const QString& username, - const QString& from, const QString& to); - virtual ~AsyncSMTPSubmit(); - - Q_SIGNALS: - void finished( KCDDB::Result ); - protected Q_SLOTS: - void slotDone( KJob * ); - protected: - Result runJob(KIO::Job* job) override; - } ; -} - -#endif // ASYNCSMTPSUBMIT_H -// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff --git a/libkcddb/client.cpp b/libkcddb/client.cpp index 416d8e9..c355966 100644 --- a/libkcddb/client.cpp +++ b/libkcddb/client.cpp @@ -8,17 +8,15 @@ #include "client.h" -#include "synccddbplookup.h" #include "asynccddbplookup.h" -#include "synchttplookup.h" #include "asynchttplookup.h" -#include "syncsmtpsubmit.h" -#include "asyncsmtpsubmit.h" -#include "synchttpsubmit.h" #include "asynchttpsubmit.h" #include "cache.h" -#include "lookup.h" #include "logging.h" +#include "lookup.h" +#include "synccddbplookup.h" +#include "synchttplookup.h" +#include "synchttpsubmit.h" #include "config-musicbrainz.h" #ifdef HAVE_MUSICBRAINZ5 @@ -273,47 +271,17 @@ namespace KCDDB QString from = d->config.emailAddress(); - switch (d->config.freedbSubmitTransport()) - { - case Submit::HTTP: - { - QString hostname = d->config.httpSubmitServer(); - uint port = d->config.httpSubmitPort(); - - if ( blockingMode() ) - d->cdInfoSubmit = new SyncHTTPSubmit(from, hostname, port); - else - { - d->cdInfoSubmit = new AsyncHTTPSubmit(from, hostname, port); - connect( static_cast<AsyncHTTPSubmit *>( d->cdInfoSubmit ), - &AsyncHTTPSubmit::finished, - this, &Client::slotSubmitFinished ); - } - - break; - } - case Submit::SMTP: - { - QString hostname = d->config.smtpHostname(); - uint port = d->config.smtpPort(); - QString username = d->config.smtpUsername(); + QString hostname = d->config.httpSubmitServer(); + uint port = d->config.httpSubmitPort(); - if ( blockingMode() ) - d->cdInfoSubmit = new SyncSMTPSubmit( hostname, port, username, from, d->config.submitAddress() ); - else - { - d->cdInfoSubmit = new AsyncSMTPSubmit( hostname, port, username, from, d->config.submitAddress() ); - connect( static_cast<AsyncSMTPSubmit *>( d->cdInfoSubmit ), - &AsyncSMTPSubmit::finished, - this, &Client::slotSubmitFinished ); - } - break; - } - default: - qCDebug(LIBKCDDB) << "Unsupported transport: "; -// << CDDB::transportToString(d->config.submitTransport()) << endl; - return UnknownError; - break; + if ( blockingMode() ) + d->cdInfoSubmit = new SyncHTTPSubmit(from, hostname, port); + else + { + d->cdInfoSubmit = new AsyncHTTPSubmit(from, hostname, port); + connect( static_cast<AsyncHTTPSubmit *>( d->cdInfoSubmit ), + &AsyncHTTPSubmit::finished, + this, &Client::slotSubmitFinished ); } Result r = d->cdInfoSubmit->submit( cdInfo, offsetList ); diff --git a/libkcddb/config.cpp b/libkcddb/config.cpp index 6aeb3c8..eae884a 100644 --- a/libkcddb/config.cpp +++ b/libkcddb/config.cpp @@ -26,10 +26,6 @@ namespace KCDDB static_cast<KConfigSkeleton::ItemString *>(findItem(QLatin1String( "emailAddress" ))) ->setDefaultValue(kes.getSetting( KEMailSettings::EmailAddress )); - static_cast<KConfigSkeleton::ItemString *>(findItem(QLatin1String( "replyTo" ))) - ->setDefaultValue(kes.getSetting( KEMailSettings::ReplyToAddress )); - static_cast<KConfigSkeleton::ItemString *>(findItem(QLatin1String( "smtpHostname" ))) - ->setDefaultValue(kes.getSetting( KEMailSettings::OutServer )); } void Config::reparse() diff --git a/libkcddb/libkcddb5.kcfg b/libkcddb/libkcddb5.kcfg index 03faa8b..f5bbf55 100644 --- a/libkcddb/libkcddb5.kcfg +++ b/libkcddb/libkcddb5.kcfg @@ -33,13 +33,6 @@ </entry> </group> <group name="Submit"> - <entry name="FreedbSubmitTransport" type="Enum"> - <choices> - <choice name="HTTP"></choice> - <choice name="SMTP"></choice> - </choices> - <default>HTTP</default> - </entry> <entry name="emailAddress" type="String"> </entry> <entry name="httpSubmitServer" type="String"> @@ -48,20 +41,5 @@ <entry name="httpSubmitPort" type="Int"> <default>80</default> </entry> - <entry name="smtpPort" type="Int"> - <default>25</default> - </entry> - <entry name="smtpUsername" type="String"> - </entry> - <entry name="useGlobalEmail" type="Bool"> - <default>true</default> - </entry> - <entry name="replyTo" type="String"> - </entry> - <entry name="smtpHostname" type="String"> - </entry> - <entry name="submitAddress" type="String"> - <default>[email protected]</default> - </entry> </group> </kcfg> diff --git a/libkcddb/smtpsubmit.cpp b/libkcddb/smtpsubmit.cpp deleted file mode 100644 index 93d85b2..0000000 --- a/libkcddb/smtpsubmit.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - SPDX-FileCopyrightText: 2003 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#include "smtpsubmit.h" -#include "logging.h" - -#include <KIO/Job> - -namespace KCDDB -{ - SMTPSubmit::SMTPSubmit(const QString& hostname, uint port, const QString& username, - const QString& from, const QString& to) - : Submit(), from_(from), to_(to) - { - url_.setScheme(QLatin1String( "smtp" )); - url_.setHost(hostname); - url_.setPort(port); - if (!username.isEmpty()) - url_.setUserName(username); - url_.setPath(QLatin1String( "/send" )); - } - - SMTPSubmit::~SMTPSubmit() - { - - } - - KIO::Job* SMTPSubmit::createJob(const CDInfo& cdInfo) - { - url_.setQuery(QString::fromLatin1("to=%1&subject=cddb %2 %3&from=%4") - .arg(to_, cdInfo.get(Category).toString(), - cdInfo.get(QLatin1String( "discid" )).toString(), from_)); - qCDebug(LIBKCDDB) << "Url is: " << url_.toDisplayString(); - - return KIO::storedPut(diskData_.toUtf8().data(), url_, -1, KIO::HideProgressInfo); - } - - void SMTPSubmit::makeDiskData( const CDInfo& cdInfo, const TrackOffsetList& offsetList ) - { - diskData_ = QLatin1String( "Content-Type: text/plain; charset=\"utf-8\";\n" ); - - Submit::makeDiskData(cdInfo, offsetList); - } -} - diff --git a/libkcddb/smtpsubmit.h b/libkcddb/smtpsubmit.h deleted file mode 100644 index 882e712..0000000 --- a/libkcddb/smtpsubmit.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - SPDX-FileCopyrightText: 2003 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#ifndef SMTPSUBMIT_H -#define SMTPSUBMIT_H - -#include "submit.h" -#include <QUrl> - -namespace KCDDB -{ - class SMTPSubmit : public Submit - { - public: - SMTPSubmit(const QString& hostname, uint port, const QString& username, const QString& from, const QString& to); - virtual ~SMTPSubmit(); - - protected: - void makeDiskData( const CDInfo&, const TrackOffsetList& ) override; - - KIO::Job* createJob(const CDInfo& cdInfo) override; - - QUrl url_; - QString from_, to_; - } ; -} - -#endif // SMTPSUBMIT_H diff --git a/libkcddb/submit.h b/libkcddb/submit.h index 34c5a34..d72d7f0 100644 --- a/libkcddb/submit.h +++ b/libkcddb/submit.h @@ -25,12 +25,6 @@ namespace KCDDB { public: - enum Transport - { - HTTP, - SMTP - }; - Submit(); virtual ~Submit(); diff --git a/libkcddb/syncsmtpsubmit.cpp b/libkcddb/syncsmtpsubmit.cpp deleted file mode 100644 index 682ab82..0000000 --- a/libkcddb/syncsmtpsubmit.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - SPDX-FileCopyrightText: 2003-2004 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#include "syncsmtpsubmit.h" - -#include "cdinfo.h" - -#include <KIO/Job> - -namespace KCDDB -{ - SyncSMTPSubmit::SyncSMTPSubmit(const QString& hostname, uint port, - const QString& username, const QString& from, const QString& to) - : SMTPSubmit( hostname, port, username, from, to ) - { - - } - - SyncSMTPSubmit::~SyncSMTPSubmit() - { - - } - - Result SyncSMTPSubmit::runJob(KIO::Job* job) - { - if ( job->exec() ) - return Success; - - return UnknownError; - } -} diff --git a/libkcddb/syncsmtpsubmit.h b/libkcddb/syncsmtpsubmit.h deleted file mode 100644 index 1558b89..0000000 --- a/libkcddb/syncsmtpsubmit.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - SPDX-FileCopyrightText: 2003 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#ifndef SYNCSMTPSUBMIT_H -#define SYNCSMTPSUBMIT_H - -#include "smtpsubmit.h" - -namespace KCDDB -{ - class SyncSMTPSubmit : public SMTPSubmit - { - public: - SyncSMTPSubmit(const QString& hostname, uint port, const QString& username, - const QString& from, const QString& to); - virtual ~SyncSMTPSubmit(); - protected: - Result runJob(KIO::Job* job) override; - } ; -} - -#endif // SYNCSMTPSUBMIT_H -// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c37b7f9..2d2a027 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,8 +21,6 @@ add_unit_tests( cachetest musicbrainztest-severaldiscs musicbrainztest-fulldate - syncsmtpsubmittest - asyncsmtpsubmittest asynchttpsubmittest synchttpsubmittest sitestest) diff --git a/tests/asynchttpsubmittest.cpp b/tests/asynchttpsubmittest.cpp index 61195aa..0a91751 100644 --- a/tests/asynchttpsubmittest.cpp +++ b/tests/asynchttpsubmittest.cpp @@ -16,7 +16,6 @@ AsyncHTTPSubmitTest::AsyncHTTPSubmitTest(QCoreApplication& app) using namespace KCDDB; client_ = new Client; - client_->config().setFreedbSubmitTransport(Submit::HTTP); client_->setBlockingMode( false ); TrackOffsetList list; diff --git a/tests/asyncsmtpsubmittest.cpp b/tests/asyncsmtpsubmittest.cpp deleted file mode 100644 index 198a909..0000000 --- a/tests/asyncsmtpsubmittest.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - SPDX-FileCopyrightText: 2006 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#include "asyncsmtpsubmittest.h" -#include <QDebug> -#include <QCoreApplication> - -#include "libkcddb/submit.h" - -AsyncSMTPSubmitTest::AsyncSMTPSubmitTest(QCoreApplication& app) - : app_(app) -{ - using namespace KCDDB; - - client_ = new Client; - client_->config().setFreedbSubmitTransport(Submit::SMTP); - client_->config().setSubmitAddress(QString::fromUtf8("[email protected]")); - client_->setBlockingMode( false ); - - TrackOffsetList list; - - list - << 150 // First track start. - << 2592 - << 35472 - << 47891 - << 123310 - << 133125; // Disc end. - - CDInfo cdInfo; - - cdInfo.set(QString::fromUtf8("discid"), QString::fromUtf8("3606ed05")); - cdInfo.set(QString::fromUtf8("revision"), 4); - cdInfo.set(QString::fromUtf8("title"), QString::fromUtf8("Bamse och Bronto")); - cdInfo.set(QString::fromUtf8("artist"), QString::fromUtf8("Musiksage")); - cdInfo.set(QString::fromUtf8("year"), 2001); - cdInfo.set(QString::fromUtf8("category"), QString::fromUtf8("misc")); - cdInfo.set(QString::fromUtf8("genre"), QString::fromUtf8("Barnsaga")); - cdInfo.set(QString::fromUtf8("extd"), QString::fromUtf8("Berättare: Olof Thunberg")); - - cdInfo.track(0).set(QString::fromUtf8("title"), QString::fromUtf8("Bamses signaturmelodi")); - cdInfo.track(1).set(QString::fromUtf8("title"),QString::fromUtf8("*")); - cdInfo.track(2).set(QString::fromUtf8("title"), QString::fromUtf8("Brummavisan")); - cdInfo.track(3).set(QString::fromUtf8("title"), QString::fromUtf8("*")); - cdInfo.track(4).set(QString::fromUtf8("title"), QString::fromUtf8("Jätteödlan Bronto")); - - connect(client_,&KCDDB::Client::finished,this, &AsyncSMTPSubmitTest::slotFinished); - - client_->submit(cdInfo, list); -} - - void -AsyncSMTPSubmitTest::slotFinished(Result r) -{ - qDebug() << "AsyncSMTPSubmitTest::slotFinished: Got " << KCDDB::resultToString(r); - - app_.quit(); -} - -int main(int argc, char ** argv) -{ - QCoreApplication app(argc, argv); - app.setApplicationName(QString::fromUtf8("libkcddb_test")); - - new AsyncSMTPSubmitTest(app); - - return app.exec(); -} diff --git a/tests/asyncsmtpsubmittest.h b/tests/asyncsmtpsubmittest.h deleted file mode 100644 index 387d8ab..0000000 --- a/tests/asyncsmtpsubmittest.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - SPDX-FileCopyrightText: 2003 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#ifndef TEST_H -#define TEST_H - -#include <QObject> -#include "libkcddb/client.h" - -using namespace KCDDB; - -class QCoreApplication; - -class AsyncSMTPSubmitTest : public QObject -{ - Q_OBJECT - - public: - AsyncSMTPSubmitTest(QCoreApplication& app); - - public Q_SLOTS: - - void slotFinished(KCDDB::Result); - - private: - - QCoreApplication& app_; - KCDDB::Client * client_; -}; - -#endif diff --git a/tests/synchttpsubmittest.cpp b/tests/synchttpsubmittest.cpp index 2f1d529..d2e2755 100644 --- a/tests/synchttpsubmittest.cpp +++ b/tests/synchttpsubmittest.cpp @@ -47,7 +47,6 @@ main(int argc, char ** argv) cdInfo.track(4).set(QString::fromUtf8("title"), QString::fromUtf8("Jätteödlan Bronto")); Client c; - c.config().setFreedbSubmitTransport(Submit::HTTP); c.setBlockingMode( true ); Result r = c.submit(cdInfo, list); diff --git a/tests/syncsmtpsubmittest.cpp b/tests/syncsmtpsubmittest.cpp deleted file mode 100644 index 7bfbb83..0000000 --- a/tests/syncsmtpsubmittest.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - SPDX-FileCopyrightText: 2003 Richard Lärkäng <[email protected]> - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#include <QDebug> -#include <QCoreApplication> - -#include "libkcddb/client.h" -#include "libkcddb/config.h" -#include "libkcddb/submit.h" - - int -main(int argc, char ** argv) -{ - QCoreApplication app(argc, argv); - app.setApplicationName(QString::fromUtf8("libkcddb_test")); - - using namespace KCDDB; - - TrackOffsetList list; - - list - << 150 // First track start. - << 2592 - << 35472 - << 47891 - << 123310 - << 133125; // Disc end. - - CDInfo cdInfo; - - cdInfo.set(QString::fromUtf8("discid"), QString::fromUtf8("3606ed05")); - cdInfo.set(QString::fromUtf8("revision"), 4); - cdInfo.set(QString::fromUtf8("title"), QString::fromUtf8("Bamse och Bronto")); - cdInfo.set(QString::fromUtf8("artist"), QString::fromUtf8("Musiksage")); - cdInfo.set(QString::fromUtf8("year"), 2001); - cdInfo.set(QString::fromUtf8("category"), QString::fromUtf8("misc")); - cdInfo.set(QString::fromUtf8("genre"), QString::fromUtf8("Barnsaga")); - cdInfo.set(QString::fromUtf8("extd"), QString::fromUtf8("Berättare: Olof Thunberg")); - - cdInfo.track(0).set(QString::fromUtf8("title"), QString::fromUtf8("Bamses signaturmelodi")); - cdInfo.track(1).set(QString::fromUtf8("title"),QString::fromUtf8("*")); - cdInfo.track(2).set(QString::fromUtf8("title"), QString::fromUtf8("Brummavisan")); - cdInfo.track(3).set(QString::fromUtf8("title"), QString::fromUtf8("*")); - cdInfo.track(4).set(QString::fromUtf8("title"), QString::fromUtf8("Jätteödlan Bronto")); - - Client c; - c.config().setFreedbSubmitTransport(Submit::SMTP); - c.config().setSubmitAddress(QString::fromUtf8("[email protected]")); - - c.setBlockingMode( true ); - - Result r = c.submit(cdInfo, list); - - qDebug() << "Result: " << resultToString(r); -} -
