french -> French
[kdepim.git] / pimcommon / shorturl / abstractshorturl.cpp
blob2570746fc08f5e6cdcf35e77cfe4f82b2db96af1
1 /*
2 Copyright (c) 2013 Montel Laurent <montel@kde.org>
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License, version 2, as
6 published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #include "abstractshorturl.h"
20 #include <KLocale>
22 using namespace PimCommon;
23 AbstractShortUrl::AbstractShortUrl(QObject *parent)
24 : QObject(parent),
25 mErrorFound(false),
26 mNetworkAccessManager(new QNetworkAccessManager(this))
28 connect(mNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotShortUrlFinished(QNetworkReply*)));
31 AbstractShortUrl::~AbstractShortUrl()
36 void AbstractShortUrl::shortUrl(const QString &url)
38 mErrorFound = false;
39 mOriginalUrl = url;
42 void AbstractShortUrl::slotErrorFound(QNetworkReply::NetworkError error)
44 mErrorFound = true;
45 QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
46 Q_EMIT shortUrlFailed(i18n("Error reported by server:\n\'%1\'", (reply ? reply->errorString() : QString::number(error)) ));
49 void AbstractShortUrl::slotShortUrlFinished(QNetworkReply */*reply*/)