From 7f85eb77aa3a4aa41dd0985485471135164950e3 Mon Sep 17 00:00:00 2001 From: Aetf Date: Tue, 3 Nov 2020 19:11:37 -0500 Subject: [PATCH] FdoSecrets: code formatting --- src/fdosecrets/objects/Collection.cpp | 3 ++- src/fdosecrets/objects/Collection.h | 1 + src/fdosecrets/objects/Item.h | 1 + src/fdosecrets/objects/Prompt.cpp | 6 ++++-- src/fdosecrets/objects/Prompt.h | 5 +++++ src/fdosecrets/objects/Service.cpp | 30 +++++++++++++-------------- src/fdosecrets/objects/Service.h | 1 + src/fdosecrets/objects/Session.h | 1 + 8 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/fdosecrets/objects/Collection.cpp b/src/fdosecrets/objects/Collection.cpp index 448080cbcb..0f856d87f8 100644 --- a/src/fdosecrets/objects/Collection.cpp +++ b/src/fdosecrets/objects/Collection.cpp @@ -415,7 +415,8 @@ namespace FdoSecrets emit aliasAboutToAdd(alias); - bool ok = registerWithPath(QStringLiteral(DBUS_PATH_TEMPLATE_ALIAS).arg(p()->objectPath().path(), alias), false); + bool ok = + registerWithPath(QStringLiteral(DBUS_PATH_TEMPLATE_ALIAS).arg(p()->objectPath().path(), alias), false); if (ok) { m_aliases.insert(alias); emit aliasAdded(alias); diff --git a/src/fdosecrets/objects/Collection.h b/src/fdosecrets/objects/Collection.h index 1018078736..80940d5a73 100644 --- a/src/fdosecrets/objects/Collection.h +++ b/src/fdosecrets/objects/Collection.h @@ -41,6 +41,7 @@ namespace FdoSecrets Q_OBJECT explicit Collection(Service* parent, DatabaseWidget* backend); + public: /** * @brief Create a new instance of `Collection` diff --git a/src/fdosecrets/objects/Item.h b/src/fdosecrets/objects/Item.h index 9707797068..8c753a3d52 100644 --- a/src/fdosecrets/objects/Item.h +++ b/src/fdosecrets/objects/Item.h @@ -43,6 +43,7 @@ namespace FdoSecrets Q_OBJECT explicit Item(Collection* parent, Entry* backend); + public: /** * @brief Create a new instance of `Item`. diff --git a/src/fdosecrets/objects/Prompt.cpp b/src/fdosecrets/objects/Prompt.cpp index cde09715f5..efed631795 100644 --- a/src/fdosecrets/objects/Prompt.cpp +++ b/src/fdosecrets/objects/Prompt.cpp @@ -41,7 +41,8 @@ namespace FdoSecrets bool PromptBase::registerSelf() { - auto path = QStringLiteral(DBUS_PATH_TEMPLATE_PROMPT).arg(p()->objectPath().path(), Tools::uuidToHex(QUuid::createUuid())); + auto path = QStringLiteral(DBUS_PATH_TEMPLATE_PROMPT) + .arg(p()->objectPath().path(), Tools::uuidToHex(QUuid::createUuid())); bool ok = registerWithPath(path); if (!ok) { service()->plugin()->emitError(tr("Failed to register item on DBus at path '%1'").arg(path)); @@ -213,7 +214,8 @@ namespace FdoSecrets return {}; } - DBusReturn UnlockCollectionsPrompt::Create(Service* parent, const QList& coll) + DBusReturn UnlockCollectionsPrompt::Create(Service* parent, + const QList& coll) { QScopedPointer res{new UnlockCollectionsPrompt(parent, coll)}; if (!res->registerSelf()) { diff --git a/src/fdosecrets/objects/Prompt.h b/src/fdosecrets/objects/Prompt.h index e72f0512c3..9a97256754 100644 --- a/src/fdosecrets/objects/Prompt.h +++ b/src/fdosecrets/objects/Prompt.h @@ -58,6 +58,7 @@ namespace FdoSecrets Q_OBJECT explicit DeleteCollectionPrompt(Service* parent, Collection* coll); + public: static DBusReturn Create(Service* parent, Collection* coll); @@ -72,6 +73,7 @@ namespace FdoSecrets Q_OBJECT explicit CreateCollectionPrompt(Service* parent); + public: static DBusReturn Create(Service* parent); @@ -87,6 +89,7 @@ namespace FdoSecrets Q_OBJECT explicit LockCollectionsPrompt(Service* parent, const QList& colls); + public: static DBusReturn Create(Service* parent, const QList& colls); @@ -103,6 +106,7 @@ namespace FdoSecrets Q_OBJECT explicit UnlockCollectionsPrompt(Service* parent, const QList& coll); + public: static DBusReturn Create(Service* parent, const QList& coll); @@ -124,6 +128,7 @@ namespace FdoSecrets Q_OBJECT explicit DeleteItemPrompt(Service* parent, Item* item); + public: static DBusReturn Create(Service* parent, Item* item); diff --git a/src/fdosecrets/objects/Service.cpp b/src/fdosecrets/objects/Service.cpp index 591da1737f..957203d8b8 100644 --- a/src/fdosecrets/objects/Service.cpp +++ b/src/fdosecrets/objects/Service.cpp @@ -68,8 +68,9 @@ namespace FdoSecrets bool Service::initialize() { if (!QDBusConnection::sessionBus().registerService(QStringLiteral(DBUS_SERVICE_SECRET))) { - plugin()->emitError(tr("Failed to register DBus service at %1.
").arg(QLatin1String(DBUS_SERVICE_SECRET)) - + m_plugin->reportExistingService()); + plugin()->emitError( + tr("Failed to register DBus service at %1.
").arg(QLatin1String(DBUS_SERVICE_SECRET)) + + m_plugin->reportExistingService()); return false; } @@ -80,10 +81,8 @@ namespace FdoSecrets // Connect to service unregistered signal m_serviceWatcher.reset(new QDBusServiceWatcher()); - connect(m_serviceWatcher.get(), - &QDBusServiceWatcher::serviceUnregistered, - this, - &Service::dbusServiceUnregistered); + connect( + m_serviceWatcher.get(), &QDBusServiceWatcher::serviceUnregistered, this, &Service::dbusServiceUnregistered); m_serviceWatcher->setConnection(QDBusConnection::sessionBus()); @@ -166,9 +165,7 @@ namespace FdoSecrets // only start relay signals when the collection is fully setup connect(coll, &Collection::collectionChanged, this, [this, coll]() { emit collectionChanged(coll); }); - connect(coll, &Collection::collectionAboutToDelete, this, [this, coll]() { - emit collectionDeleted(coll); - }); + connect(coll, &Collection::collectionAboutToDelete, this, [this, coll]() { emit collectionDeleted(coll); }); if (emitSignal) { emit collectionCreated(coll); } @@ -275,12 +272,15 @@ namespace FdoSecrets // collection will be created when the prompt completes. // once it's done, we set additional properties on the collection - connect(cp.value(), &CreateCollectionPrompt::collectionCreated, cp.value(), [alias, properties](Collection* coll) { - coll->setProperties(properties).okOrDie(); - if (!alias.isEmpty()) { - coll->addAlias(alias).okOrDie(); - } - }); + connect(cp.value(), + &CreateCollectionPrompt::collectionCreated, + cp.value(), + [alias, properties](Collection* coll) { + coll->setProperties(properties).okOrDie(); + if (!alias.isEmpty()) { + coll->addAlias(alias).okOrDie(); + } + }); } return collection; } diff --git a/src/fdosecrets/objects/Service.h b/src/fdosecrets/objects/Service.h index c0d39191aa..5b1ff5acdb 100644 --- a/src/fdosecrets/objects/Service.h +++ b/src/fdosecrets/objects/Service.h @@ -50,6 +50,7 @@ namespace FdoSecrets Q_OBJECT explicit Service(FdoSecretsPlugin* plugin, QPointer dbTabs); + public: /** * @brief Create a new instance of `Service`. Its parent is set to `null` diff --git a/src/fdosecrets/objects/Session.h b/src/fdosecrets/objects/Session.h index 5722895adc..3bb6ea2575 100644 --- a/src/fdosecrets/objects/Session.h +++ b/src/fdosecrets/objects/Session.h @@ -39,6 +39,7 @@ namespace FdoSecrets Q_OBJECT explicit Session(std::unique_ptr&& cipher, const QString& peer, Service* parent); + public: static std::unique_ptr CreateCiphers(const QString& peer, const QString& algorithm,