Commit b9fe0d8e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent df8b01a0
Pipeline #39613 passed with stage
in 16 minutes and 48 seconds
......@@ -57,7 +57,7 @@ private Q_SLOTS:
FakeNetworkAccessManagerFactory::get()->setScenarios(scenarios);
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
Drive::DrivesCreateJob *job = new Drive::DrivesCreateJob(requestId, sourceDrives, account);
auto *job = new Drive::DrivesCreateJob(requestId, sourceDrives, account);
QVERIFY(execJob(job));
const auto items = job->items();
......
......@@ -50,7 +50,7 @@ private Q_SLOTS:
FakeNetworkAccessManagerFactory::get()->setScenarios(scenarios);
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
Drive::DrivesDeleteJob *job = new Drive::DrivesDeleteJob(drivesId, account);
auto *job = new Drive::DrivesDeleteJob(drivesId, account);
QVERIFY(execJob(job));
}
......
......@@ -54,7 +54,7 @@ private Q_SLOTS:
FakeNetworkAccessManagerFactory::get()->setScenarios(scenarios);
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
Drive::DrivesHideJob *job = new Drive::DrivesHideJob(sourceDrive, true, account);
auto *job = new Drive::DrivesHideJob(sourceDrive, true, account);
QVERIFY(execJob(job));
const auto items = job->items();
......
......@@ -56,7 +56,7 @@ private Q_SLOTS:
sourceDrives->setName(QStringLiteral("Renamed Drive"));
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
Drive::DrivesModifyJob *job = new Drive::DrivesModifyJob(sourceDrives, account);
auto *job = new Drive::DrivesModifyJob(sourceDrives, account);
QVERIFY(execJob(job));
......
......@@ -57,7 +57,7 @@ private Q_SLOTS:
FakeNetworkAccessManagerFactory::get()->setScenarios(scenarios);
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
Drive::TeamdriveCreateJob *job = new Drive::TeamdriveCreateJob(requestId, sourceTeamdrive, account);
auto *job = new Drive::TeamdriveCreateJob(requestId, sourceTeamdrive, account);
QVERIFY(execJob(job));
const auto items = job->items();
......
......@@ -50,7 +50,7 @@ private Q_SLOTS:
FakeNetworkAccessManagerFactory::get()->setScenarios(scenarios);
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
Drive::TeamdriveDeleteJob *job = new Drive::TeamdriveDeleteJob(teamdriveId, account);
auto *job = new Drive::TeamdriveDeleteJob(teamdriveId, account);
QVERIFY(execJob(job));
}
......
......@@ -56,7 +56,7 @@ private Q_SLOTS:
sourceTeamdrive->setName(QStringLiteral("Renamed Team Drive"));
auto account = AccountPtr::create(QStringLiteral("MockAccount"), QStringLiteral("MockToken"));
Drive::TeamdriveModifyJob *job = new Drive::TeamdriveModifyJob(sourceTeamdrive, account);
auto *job = new Drive::TeamdriveModifyJob(sourceTeamdrive, account);
QVERIFY(execJob(job));
......
......@@ -34,7 +34,7 @@ public:
QDateTime busyStart;
QDateTime busyEnd;
};
typedef QVector<BusyRange> BusyRangeList;
using BusyRangeList = QVector<BusyRange>;
explicit FreeBusyQueryJob(const QString &id,
const QDateTime &timeMin,
......
......@@ -663,14 +663,14 @@ QByteArray contactToXML(const ContactPtr& contact)
/* Anniversary */
const QString anniversary = contact->anniversary().toString(Qt::ISODate);
if (!anniversary.isEmpty()) {
output.append("<gContact:event rel=\"anniversary\"><gd:when startTime=\"").append(anniversary.toHtmlEscaped().toUtf8()).append("\" /></gContact:event>");
output.append(R"(<gContact:event rel="anniversary"><gd:when startTime=")").append(anniversary.toHtmlEscaped().toUtf8()).append("\" /></gContact:event>");
parsedCustoms << QStringLiteral("KADDRESSBOOK-X-Anniversary");
}
/* Blog */
const QString blog = contact->blogFeed().url();
if (!blog.isEmpty()) {
output.append("<gContact:website rel=\"blog\" href=\"").append(blog.toHtmlEscaped().toUtf8()).append("\" />");
output.append(R"(<gContact:website rel="blog" href=")").append(blog.toHtmlEscaped().toUtf8()).append("\" />");
parsedCustoms << QStringLiteral("KADDRESSBOOK-BlogFeed");
}
......
......@@ -83,7 +83,7 @@ public:
}
account->setScopes(currentScopes);
}
AuthJob *job = new AuthJob(account, apiKey, apiSecret);
auto *job = new AuthJob(account, apiKey, apiSecret);
job->setUsername(account->accountName());
connect(job, &AuthJob::finished,
[=]() {
......
......@@ -14,12 +14,13 @@
#include "../../debug.h"
#include <QAbstractSocket>
#include <QDateTime>
#include <QDesktopServices>
#include <QTcpServer>
#include <QTcpSocket>
#include <QDesktopServices>
#include <QUrlQuery>
#include <QUrl>
#include <QDateTime>
#include <QUrlQuery>
#include <memory>
using namespace KGAPI2;
......@@ -190,7 +191,7 @@ void FullAuthenticationJob::start()
scopes << scope.toString();
}
d->mServer = std::unique_ptr<QTcpServer>(new QTcpServer(this));
d->mServer = std::make_unique<QTcpServer>(this);
if (!d->mServer->listen(QHostAddress::LocalHost, d->mServerPort)) {
d->emitError(InvalidAccount, tr("Could not start OAuth HTTP server"));
return;
......
......@@ -45,115 +45,115 @@ class KGAPICORE_EXPORT FeedData {
class Object;
typedef QSharedPointer<Object> ObjectPtr;
typedef QList<ObjectPtr> ObjectsList;
using ObjectPtr = QSharedPointer<Object>;
using ObjectsList = QList<ObjectPtr>;
class Account;
typedef QSharedPointer<Account> AccountPtr;
typedef QList<AccountPtr> AccountsList;
using AccountPtr = QSharedPointer<Account>;
using AccountsList = QList<AccountPtr>;
class AccountInfo;
typedef QSharedPointer<AccountInfo> AccountInfoPtr;
typedef QList<AccountInfoPtr> AccountInfosList;
using AccountInfoPtr = QSharedPointer<AccountInfo>;
using AccountInfosList = QList<AccountInfoPtr>;
class Contact;
typedef QSharedPointer<Contact> ContactPtr;
typedef QList<ContactPtr> ContactsList;
using ContactPtr = QSharedPointer<Contact>;
using ContactsList = QList<ContactPtr>;
class ContactsGroup;
typedef QSharedPointer<ContactsGroup> ContactsGroupPtr;
typedef QList<ContactsGroupPtr> ContactsGroupsList;
using ContactsGroupPtr = QSharedPointer<ContactsGroup>;
using ContactsGroupsList = QList<ContactsGroupPtr>;
class Calendar;
typedef QSharedPointer<Calendar> CalendarPtr;
typedef QList<CalendarPtr> CalendarsList;
using CalendarPtr = QSharedPointer<Calendar>;
using CalendarsList = QList<CalendarPtr>;
namespace Drive
{
class About;
typedef QSharedPointer<About> AboutPtr;
typedef QList<AboutPtr> AboutsList;
using AboutPtr = QSharedPointer<About>;
using AboutsList = QList<AboutPtr>;
class App;
typedef QSharedPointer<App> AppPtr;
typedef QList<AppPtr> AppsList;
using AppPtr = QSharedPointer<App>;
using AppsList = QList<AppPtr>;
class Change;
typedef QSharedPointer<Change> ChangePtr;
typedef QList<ChangePtr> ChangesList;
using ChangePtr = QSharedPointer<Change>;
using ChangesList = QList<ChangePtr>;
class ChildReference;
typedef QSharedPointer<ChildReference> ChildReferencePtr;
typedef QList<ChildReferencePtr> ChildReferencesList;
using ChildReferencePtr = QSharedPointer<ChildReference>;
using ChildReferencesList = QList<ChildReferencePtr>;
class File;
typedef QSharedPointer<File> FilePtr;
typedef QList<FilePtr> FilesList;
using FilePtr = QSharedPointer<File>;
using FilesList = QList<FilePtr>;
class ParentReference;
typedef QSharedPointer<ParentReference> ParentReferencePtr;
typedef QList<ParentReferencePtr> ParentReferencesList;
using ParentReferencePtr = QSharedPointer<ParentReference>;
using ParentReferencesList = QList<ParentReferencePtr>;
class Permission;
typedef QSharedPointer<Permission> PermissionPtr;
typedef QList<PermissionPtr> PermissionsList;
using PermissionPtr = QSharedPointer<Permission>;
using PermissionsList = QList<PermissionPtr>;
class Revision;
typedef QSharedPointer<Revision> RevisionPtr;
typedef QList<RevisionPtr> RevisionsList;
using RevisionPtr = QSharedPointer<Revision>;
using RevisionsList = QList<RevisionPtr>;
class Drives;
typedef QSharedPointer<Drives> DrivesPtr;
typedef QList<DrivesPtr> DrivesList;
using DrivesPtr = QSharedPointer<Drives>;
using DrivesList = QList<DrivesPtr>;
class Teamdrive;
typedef QSharedPointer<Teamdrive> TeamdrivePtr;
typedef QList<TeamdrivePtr> TeamdrivesList;
using TeamdrivePtr = QSharedPointer<Teamdrive>;
using TeamdrivesList = QList<TeamdrivePtr>;
class User;
typedef QSharedPointer<User> UserPtr;
typedef QList<UserPtr> UsersList;
using UserPtr = QSharedPointer<User>;
using UsersList = QList<UserPtr>;
}
class Event;
typedef QSharedPointer<Event> EventPtr;
typedef QList<EventPtr> EventsList;
using EventPtr = QSharedPointer<Event>;
using EventsList = QList<EventPtr>;
class Location;
typedef QSharedPointer<Location> LocationPtr;
typedef QList<LocationPtr> LocationsList;
using LocationPtr = QSharedPointer<Location>;
using LocationsList = QList<LocationPtr>;
class Reminder;
typedef QSharedPointer<Reminder> ReminderPtr;
typedef QList<ReminderPtr> RemindersList;
using ReminderPtr = QSharedPointer<Reminder>;
using RemindersList = QList<ReminderPtr>;
class Task;
typedef QSharedPointer<Task> TaskPtr;
typedef QList<TaskPtr> TasksList;
using TaskPtr = QSharedPointer<Task>;
using TasksList = QList<TaskPtr>;
class TaskList;
typedef QSharedPointer<TaskList> TaskListPtr;
typedef QList<TaskListPtr> TaskListsList;
using TaskListPtr = QSharedPointer<TaskList>;
using TaskListsList = QList<TaskListPtr>;
namespace Blogger
{
class Blog;
typedef QSharedPointer<Blog> BlogPtr;
typedef QList<BlogPtr> BlogsList;
using BlogPtr = QSharedPointer<Blog>;
using BlogsList = QList<BlogPtr>;
class Comment;
typedef QSharedPointer<Comment> CommentPtr;
typedef QList<CommentPtr> CommentsList;
using CommentPtr = QSharedPointer<Comment>;
using CommentsList = QList<CommentPtr>;
class Page;
typedef QSharedPointer<Page> PagePtr;
typedef QList<PagePtr> PagesList;
using PagePtr = QSharedPointer<Page>;
using PagesList = QList<PagePtr>;
class Post;
typedef QSharedPointer<Post> PostPtr;
typedef QList<PostPtr> PostsList;
using PostPtr = QSharedPointer<Post>;
using PostsList = QList<PostPtr>;
}
......
......@@ -68,8 +68,8 @@ public:
friend class About;
};
typedef QSharedPointer<Format> FormatPtr;
typedef QList<FormatPtr> FormatsList;
using FormatPtr = QSharedPointer<Format>;
using FormatsList = QList<FormatPtr>;
/**
* @brief DriveAbout::AdditionalRoleInfo holds the structure used for
......@@ -110,8 +110,8 @@ public:
friend class About;
};
typedef QSharedPointer<RoleSet> RoleSetPtr;
typedef QList<RoleSetPtr> RoleSetsList;
using RoleSetPtr = QSharedPointer<RoleSet>;
using RoleSetsList = QList<RoleSetPtr>;
explicit AdditionalRoleInfo(const AdditionalRoleInfo &other);
virtual ~AdditionalRoleInfo();
......@@ -137,8 +137,8 @@ public:
friend class About;
};
typedef QSharedPointer<AdditionalRoleInfo> AdditionalRoleInfoPtr;
typedef QList<AdditionalRoleInfoPtr> AdditionalRoleInfosList;
using AdditionalRoleInfoPtr = QSharedPointer<AdditionalRoleInfo>;
using AdditionalRoleInfosList = QList<AdditionalRoleInfoPtr>;
/**
* @brief DriveAbout::Feature holds the structure used for features[] property.
......@@ -170,8 +170,8 @@ public:
friend class About;
};
typedef QSharedPointer<Feature> FeaturePtr;
typedef QList<FeaturePtr> FeaturesList;
using FeaturePtr = QSharedPointer<Feature>;
using FeaturesList = QList<FeaturePtr>;
/**
* @brief DriveAbout::MaxUploadSize holds the structure used for maxUploadSizes[] property.
......@@ -204,8 +204,8 @@ public:
friend class About;
};
typedef QSharedPointer<MaxUploadSize> MaxUploadSizePtr;
typedef QList<MaxUploadSizePtr> MaxUploadSizesList;
using MaxUploadSizePtr = QSharedPointer<MaxUploadSize>;
using MaxUploadSizesList = QList<MaxUploadSizePtr>;
struct KGAPIDRIVE_EXPORT Fields {
static const QString AdditionalRoleInfo;
......
......@@ -55,8 +55,8 @@ class KGAPIDRIVE_EXPORT App: public KGAPI2::Object
friend class App::Private;
};
typedef QSharedPointer<Icon> IconPtr;
typedef QList<IconPtr> IconsList;
using IconPtr = QSharedPointer<Icon>;
using IconsList = QList<IconPtr>;
explicit App();
explicit App(const App &other);
......
......@@ -128,7 +128,7 @@ class KGAPIDRIVE_EXPORT Drives: public KGAPI2::Object
friend class Drives;
};
typedef QSharedPointer<Restrictions> RestrictionsPtr;
using RestrictionsPtr = QSharedPointer<Restrictions>;
/**
* @brief Drives::Capabilities holds the structure used for
......@@ -280,7 +280,7 @@ class KGAPIDRIVE_EXPORT Drives: public KGAPI2::Object
friend class Drives;
};
typedef QSharedPointer<Capabilities> CapabilitiesPtr;
using CapabilitiesPtr = QSharedPointer<Capabilities>;
/**
* @brief Drives::BackgroundImageFile holds the structure used
......@@ -388,7 +388,7 @@ class KGAPIDRIVE_EXPORT Drives: public KGAPI2::Object
friend class Drives;
};
typedef QSharedPointer<BackgroundImageFile> BackgroundImageFilePtr;
using BackgroundImageFilePtr = QSharedPointer<BackgroundImageFile>;
struct Fields {
static const QString Kind;
......
......@@ -124,8 +124,8 @@ class KGAPIDRIVE_EXPORT File: public KGAPI2::Object
friend class File::Private;
};
typedef QSharedPointer<Labels> LabelsPtr;
typedef QList<LabelsPtr> LabelsList;
using LabelsPtr = QSharedPointer<Labels>;
using LabelsList = QList<LabelsPtr>;
/**
* @brief DriveFile::IndexableText holds the structure used for indexableText property.
......@@ -159,7 +159,7 @@ class KGAPIDRIVE_EXPORT File: public KGAPI2::Object
friend class File::Private;
};
typedef QSharedPointer<IndexableText> IndexableTextPtr;
using IndexableTextPtr = QSharedPointer<IndexableText>;
/**
* @brief DriveFile::ImageMediaMetadata holds the structure used for
......@@ -204,7 +204,7 @@ class KGAPIDRIVE_EXPORT File: public KGAPI2::Object
friend class ImageMediaMetadata;
};
typedef QSharedPointer<Location> LocationPtr;
using LocationPtr = QSharedPointer<Location>;
explicit ImageMediaMetadata(const ImageMediaMetadata &other);
virtual ~ImageMediaMetadata();
......@@ -274,7 +274,7 @@ class KGAPIDRIVE_EXPORT File: public KGAPI2::Object
friend class File::Private;
};
typedef QSharedPointer<ImageMediaMetadata> ImageMediaMetadataPtr;
using ImageMediaMetadataPtr = QSharedPointer<ImageMediaMetadata>;
class Thumbnail
{
......@@ -297,7 +297,7 @@ class KGAPIDRIVE_EXPORT File: public KGAPI2::Object
friend class File::Private;
};
typedef QSharedPointer<Thumbnail> ThumbnailPtr;
using ThumbnailPtr = QSharedPointer<Thumbnail>;
/**
* @brief JSON serialization options.
......
......@@ -110,8 +110,8 @@ class KGAPIDRIVE_EXPORT Permission: public KGAPI2::Object
friend class Permission;
};
typedef QSharedPointer<PermissionDetails> PermissionDetailsPtr;
typedef QList<PermissionDetailsPtr> PermissionDetailsList;
using PermissionDetailsPtr = QSharedPointer<PermissionDetails>;
using PermissionDetailsList = QList<PermissionDetailsPtr>;
explicit Permission();
explicit Permission(const Permission &other);
......
......@@ -127,7 +127,7 @@ class KGAPIDRIVE_EXPORT Teamdrive: public KGAPI2::Object
friend class Teamdrive;
};
typedef QSharedPointer<Restrictions> RestrictionsPtr;
using RestrictionsPtr = QSharedPointer<Restrictions>;
/**
* @brief DriveTeamdrive::Capabilities holds the structure used for capabilities property.
......@@ -278,7 +278,7 @@ class KGAPIDRIVE_EXPORT Teamdrive: public KGAPI2::Object
friend class Teamdrive;
};
typedef QSharedPointer<Capabilities> CapabilitiesPtr;
using CapabilitiesPtr = QSharedPointer<Capabilities>;
/**
* @brief DriveTeamdrive::BackgroundImageFile holds the structure used
......@@ -356,7 +356,7 @@ class KGAPIDRIVE_EXPORT Teamdrive: public KGAPI2::Object
friend class Teamdrive;
};
typedef QSharedPointer<BackgroundImageFile> BackgroundImageFilePtr;
using BackgroundImageFilePtr = QSharedPointer<BackgroundImageFile>;
struct Fields {
static const QString Kind;
......
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