Skip to content

Commit

Permalink
FdoSecrets: code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetf committed Nov 12, 2020
1 parent 5574f90 commit d7ac18c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/fdosecrets/objects/Collection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/fdosecrets/objects/Collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace FdoSecrets
Q_OBJECT

explicit Collection(Service* parent, DatabaseWidget* backend);

public:
/**
* @brief Create a new instance of `Collection`
Expand Down
1 change: 1 addition & 0 deletions src/fdosecrets/objects/Item.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace FdoSecrets
Q_OBJECT

explicit Item(Collection* parent, Entry* backend);

public:
/**
* @brief Create a new instance of `Item`.
Expand Down
6 changes: 4 additions & 2 deletions src/fdosecrets/objects/Prompt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -213,7 +214,8 @@ namespace FdoSecrets
return {};
}

DBusReturn<UnlockCollectionsPrompt*> UnlockCollectionsPrompt::Create(Service* parent, const QList<Collection*>& coll)
DBusReturn<UnlockCollectionsPrompt*> UnlockCollectionsPrompt::Create(Service* parent,
const QList<Collection*>& coll)
{
QScopedPointer<UnlockCollectionsPrompt> res{new UnlockCollectionsPrompt(parent, coll)};
if (!res->registerSelf()) {
Expand Down
5 changes: 5 additions & 0 deletions src/fdosecrets/objects/Prompt.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ namespace FdoSecrets
Q_OBJECT

explicit DeleteCollectionPrompt(Service* parent, Collection* coll);

public:
static DBusReturn<DeleteCollectionPrompt*> Create(Service* parent, Collection* coll);

Expand All @@ -72,6 +73,7 @@ namespace FdoSecrets
Q_OBJECT

explicit CreateCollectionPrompt(Service* parent);

public:
static DBusReturn<CreateCollectionPrompt*> Create(Service* parent);

Expand All @@ -87,6 +89,7 @@ namespace FdoSecrets
Q_OBJECT

explicit LockCollectionsPrompt(Service* parent, const QList<Collection*>& colls);

public:
static DBusReturn<LockCollectionsPrompt*> Create(Service* parent, const QList<Collection*>& colls);

Expand All @@ -103,6 +106,7 @@ namespace FdoSecrets
Q_OBJECT

explicit UnlockCollectionsPrompt(Service* parent, const QList<Collection*>& coll);

public:
static DBusReturn<UnlockCollectionsPrompt*> Create(Service* parent, const QList<Collection*>& coll);

Expand All @@ -124,6 +128,7 @@ namespace FdoSecrets
Q_OBJECT

explicit DeleteItemPrompt(Service* parent, Item* item);

public:
static DBusReturn<DeleteItemPrompt*> Create(Service* parent, Item* item);

Expand Down
30 changes: 15 additions & 15 deletions src/fdosecrets/objects/Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/>").arg(QLatin1String(DBUS_SERVICE_SECRET))
+ m_plugin->reportExistingService());
plugin()->emitError(
tr("Failed to register DBus service at %1.<br/>").arg(QLatin1String(DBUS_SERVICE_SECRET))
+ m_plugin->reportExistingService());
return false;
}

Expand All @@ -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());

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/fdosecrets/objects/Service.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace FdoSecrets
Q_OBJECT

explicit Service(FdoSecretsPlugin* plugin, QPointer<DatabaseTabWidget> dbTabs);

public:
/**
* @brief Create a new instance of `Service`. Its parent is set to `null`
Expand Down
1 change: 1 addition & 0 deletions src/fdosecrets/objects/Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace FdoSecrets
Q_OBJECT

explicit Session(std::unique_ptr<CipherPair>&& cipher, const QString& peer, Service* parent);

public:
static std::unique_ptr<CipherPair> CreateCiphers(const QString& peer,
const QString& algorithm,
Expand Down

0 comments on commit d7ac18c

Please sign in to comment.