Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cd2c0797 authored by Laurent Montel's avatar Laurent Montel 😁

Use QVector

parent dc314b5e
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.7.40")
set(PIM_VERSION "5.7.41")
project(libkdav VERSION ${PIM_VERSION})
......@@ -30,7 +30,7 @@ set(QT_REQUIRED_VERSION "5.8.0")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core Gui XmlPatterns Test)
find_package(KF5 ${KF5_VERSION} REQUIRED CoreAddons KIO)
find_package(KF5 ${KF5_VERSION} REQUIRED CoreAddons KIO I18n)
# setup lib
......
add_definitions(-DTRANSLATION_DOMAIN=\"libkdav\")
include_directories(
common/
protocols/
......@@ -111,6 +112,7 @@ PRIVATE
Qt5::Gui
Qt5::XmlPatterns
KF5::KIOCore
KF5::I18n
)
set_target_properties(KPimKDAV PROPERTIES
......
#! /bin/sh
$XGETTEXT `find . -name "*.cpp" -o -name "*.h" | grep -v '/tests/'` -o $podir/libkdav.pot
......@@ -125,7 +125,6 @@ void DavCollectionModifyJob::davJobFinished(KJob *job)
QDomElement responseElement = Utils::firstChildElementNS(response.documentElement(), QStringLiteral("DAV:"), QStringLiteral("response"));
bool hasError = false;
QString errorText;
// parse all propstats answers to get the eventual errors
const QDomNodeList propstats = responseElement.elementsByTagNameNS(QStringLiteral("DAV:"), QStringLiteral("propstat"));
......
......@@ -101,7 +101,7 @@ void DavCollectionsFetchJob::principalFetchFinished(KJob *job)
return;
}
foreach (const QString &homeSet, homeSets) {
for (const QString &homeSet : homeSets) {
QUrl url = mUrl.url();
if (homeSet.startsWith(QLatin1Char('/'))) {
......
......@@ -17,6 +17,7 @@
*/
#include "daverror.h"
#include <KLocalizedString>
#include <KIO/Global>
#include <KIO/Job>
......@@ -49,13 +50,11 @@ QString Error::internalErrorText() const
return mErrorText;
}
int Error::jobErrorCode() const
{
return mJobErrorCode;
}
int Error::responseCode() const
{
return mResponseCode;
......@@ -82,80 +81,80 @@ QString Error::errorText() const
case ERR_PROBLEM_WITH_REQUEST: {
// User-side error
if (mResponseCode == 401) {
err = QStringLiteral("Invalid username/password");
err = i18n("Invalid username/password");
} else if (mResponseCode == 403) {
err = QStringLiteral("Access forbidden");
err = i18n("Access forbidden");
} else if (mResponseCode == 404) {
err = QStringLiteral("Resource not found");
err = i18n("Resource not found");
} else {
err = QStringLiteral("HTTP error");
err = i18n("HTTP error");
}
result = QStringLiteral("There was a problem with the request.\n"
"%1 (%2).").arg(err).arg(mResponseCode);
result = i18n("There was a problem with the request.\n"
"%1 (%2).", err, mResponseCode);
break;
}
case ERR_NO_MULTIGET: {
result = QStringLiteral("Protocol for the collection does not support MULTIGET");
result = i18n("Protocol for the collection does not support MULTIGET");
break;
}
case ERR_SERVER_UNRECOVERABLE: {
result = QStringLiteral("The server encountered an error that prevented it from completing your request: %1 (%2)").arg(err).arg(mResponseCode);
result = i18n("The server encountered an error that prevented it from completing your request: %1 (%2)", err, mResponseCode);
break;
}
case ERR_COLLECTIONDELETE: {
result = QStringLiteral("There was a problem with the request. The collection has not been deleted from the server.\n"
"%1 (%2).").arg(err).arg(mResponseCode);
result = i18n("There was a problem with the request. The collection has not been deleted from the server.\n"
"%1 (%2).", err, mResponseCode);
break;
}
case ERR_COLLECTIONFETCH: {
result = QStringLiteral("Invalid responses from backend");
result = i18n("Invalid responses from backend");
break;
}
case ERR_COLLECTIONFETCH_XQUERY_SETFOCUS: {
result = QStringLiteral("Error setting focus for XQuery");
result = i18n("Error setting focus for XQuery");
break;
}
case ERR_COLLECTIONFETCH_XQUERY_INVALID: {
result = QStringLiteral("Invalid XQuery submitted by DAV implementation");
result = i18n("Invalid XQuery submitted by DAV implementation");
break;
}
case ERR_COLLECTIONMODIFY: {
result = QStringLiteral("There was a problem with the request. The collection has not been modified on the server.\n"
"%1 (%2).").arg(err).arg(mResponseCode);
result = i18n("There was a problem with the request. The collection has not been modified on the server.\n"
"%1 (%2).", err, mResponseCode);
break;
}
case ERR_COLLECTIONMODIFY_NO_PROPERITES: {
result = QStringLiteral("No properties to change or remove");
result = i18n("No properties to change or remove");
break;
}
case ERR_COLLECTIONMODIFY_RESPONSE: {
result = QStringLiteral("There was an error when modifying the properties");
result = i18n("There was an error when modifying the properties");
if (!mErrorText.isEmpty()) {
result.append(QStringLiteral("\nThe server returned more information:\n%1").arg(mErrorText));
result.append(i18n("\nThe server returned more information:\n%1", mErrorText));
}
break;
}
case ERR_ITEMCREATE: {
result = QStringLiteral("There was a problem with the request. The item has not been created on the server.\n"
"%1 (%2).").arg(err).arg(mResponseCode);
result = i18n("There was a problem with the request. The item has not been created on the server.\n"
"%1 (%2).", err, mResponseCode);
break;
}
case ERR_ITEMDELETE: {
result = QStringLiteral("There was a problem with the request. The item has not been deleted from the server.\n"
"%1 (%2).").arg(err).arg(mResponseCode);
result = i18n("There was a problem with the request. The item has not been deleted from the server.\n"
"%1 (%2).", err, mResponseCode);
break;
}
case ERR_ITEMMODIFY: {
result = QStringLiteral("There was a problem with the request. The item was not modified on the server.\n"
"%1 (%2).").arg(err).arg(mResponseCode);
result = i18n("There was a problem with the request. The item was not modified on the server.\n"
"%1 (%2).", err, mResponseCode);
break;
}
case ERR_ITEMLIST: {
result = QStringLiteral("There was a problem with the request.");
result = i18n("There was a problem with the request.");
break;
};
case ERR_ITEMLIST_NOMIMETYPE: {
result = QStringLiteral("There was a problem with the request. The requested mimetypes are not supported.");
result = i18n("There was a problem with the request. The requested mimetypes are not supported.");
break;
}
case NO_ERR:
......
......@@ -26,14 +26,12 @@ class DavJobBasePrivate {
public:
DavJobBasePrivate();
int mLatestResponseCode;
int mJobErrorCode;
int mLatestResponseCode = 0;
int mJobErrorCode = 0;
QString mInternalErrorText;
};
DavJobBasePrivate::DavJobBasePrivate()
: mLatestResponseCode(0)
, mJobErrorCode(0)
{
}
......@@ -68,7 +66,7 @@ bool DavJobBase::canRetryLater() const
// Payment required
ret = true;
} else if (latestResponseCode() == 407) {
// Proxy authentication required
// Proxy authentication required
ret = true;
} else if (latestResponseCode() == 408) {
// Request timeout
......
......@@ -312,7 +312,7 @@ void DavPrincipalSearchJob::principalPropertySearchFinished(KJob *job)
}
}
QList< DavPrincipalSearchJob::Result > DavPrincipalSearchJob::results() const
QVector< DavPrincipalSearchJob::Result > DavPrincipalSearchJob::results() const
{
return mResults;
}
......
......@@ -98,7 +98,7 @@ public:
/**
* Get the job results.
*/
QList<Result> results() const;
QVector<Result> results() const;
private:
void principalCollectionSetSearchFinished(KJob *job);
......@@ -112,9 +112,10 @@ private:
int mPrincipalPropertySearchSubJobCount;
bool mPrincipalPropertySearchSubJobSuccessful;
QList< QPair<QString, QString> > mFetchProperties;
QList<Result> mResults;
QVector<Result> mResults;
};
}
Q_DECLARE_TYPEINFO(KDAV::DavPrincipalSearchJob::Result, Q_MOVABLE_TYPE);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment