|
|
@@ -132,7 +132,7 @@ void Account::setCredentials(AbstractCredentials *cred)
|
|
|
|
|
|
QUrl Account::davUrl() const
|
|
|
{
|
|
|
- return concatUrlPath(url(), davPath());
|
|
|
+ return Utility::concatUrlPath(url(), davPath());
|
|
|
}
|
|
|
|
|
|
QList<QNetworkCookie> Account::lastAuthCookies() const
|
|
|
@@ -184,7 +184,7 @@ QNetworkAccessManager *Account::networkAccessManager()
|
|
|
|
|
|
QNetworkReply *Account::headRequest(const QString &relPath)
|
|
|
{
|
|
|
- return headRequest(concatUrlPath(url(), relPath));
|
|
|
+ return headRequest(Utility::concatUrlPath(url(), relPath));
|
|
|
}
|
|
|
|
|
|
QNetworkReply *Account::headRequest(const QUrl &url)
|
|
|
@@ -198,7 +198,7 @@ QNetworkReply *Account::headRequest(const QUrl &url)
|
|
|
|
|
|
QNetworkReply *Account::getRequest(const QString &relPath)
|
|
|
{
|
|
|
- return getRequest(concatUrlPath(url(), relPath));
|
|
|
+ return getRequest(Utility::concatUrlPath(url(), relPath));
|
|
|
}
|
|
|
|
|
|
QNetworkReply *Account::getRequest(const QUrl &url)
|
|
|
@@ -221,7 +221,7 @@ QNetworkReply *Account::deleteRequest( const QUrl &url)
|
|
|
|
|
|
QNetworkReply *Account::davRequest(const QByteArray &verb, const QString &relPath, QNetworkRequest req, QIODevice *data)
|
|
|
{
|
|
|
- return davRequest(verb, concatUrlPath(davUrl(), relPath), req, data);
|
|
|
+ return davRequest(verb, Utility::concatUrlPath(davUrl(), relPath), req, data);
|
|
|
}
|
|
|
|
|
|
QNetworkReply *Account::davRequest(const QByteArray &verb, const QUrl &url, QNetworkRequest req, QIODevice *data)
|
|
|
@@ -315,43 +315,6 @@ void Account::setUrl(const QUrl &url)
|
|
|
_url = url;
|
|
|
}
|
|
|
|
|
|
-QUrl Account::concatUrlPath(const QUrl &url, const QString &concatPath,
|
|
|
- const QList< QPair<QString, QString> > &queryItems)
|
|
|
-{
|
|
|
- QString path = url.path();
|
|
|
- if (! concatPath.isEmpty()) {
|
|
|
- // avoid '//'
|
|
|
- if (path.endsWith('/') && concatPath.startsWith('/')) {
|
|
|
- path.chop(1);
|
|
|
- } // avoid missing '/'
|
|
|
- else if (!path.endsWith('/') && !concatPath.startsWith('/')) {
|
|
|
- path += QLatin1Char('/');
|
|
|
- }
|
|
|
- path += concatPath; // put the complete path together
|
|
|
- }
|
|
|
-
|
|
|
- QUrl tmpUrl = url;
|
|
|
- tmpUrl.setPath(path);
|
|
|
- if( queryItems.size() > 0 ) {
|
|
|
- tmpUrl.setQueryItems(queryItems);
|
|
|
- }
|
|
|
- return tmpUrl;
|
|
|
-}
|
|
|
-
|
|
|
-QString Account::_configFileName;
|
|
|
-
|
|
|
-std::unique_ptr<QSettings> Account::settingsWithGroup(const QString& group, QObject *parent)
|
|
|
-{
|
|
|
- if (_configFileName.isEmpty()) {
|
|
|
- // cache file name
|
|
|
- ConfigFile cfg;
|
|
|
- _configFileName = cfg.configFile();
|
|
|
- }
|
|
|
- std::unique_ptr<QSettings> settings(new QSettings(_configFileName, QSettings::IniFormat, parent));
|
|
|
- settings->beginGroup(group);
|
|
|
- return settings;
|
|
|
-}
|
|
|
-
|
|
|
QVariant Account::credentialSetting(const QString &key) const
|
|
|
{
|
|
|
if (_credentials) {
|