mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-11 23:39:50 -05:00
FdoSecrets: fix prompt completed signal argument type
This commit is contained in:
parent
44779bc862
commit
463bb0b03f
@ -600,11 +600,11 @@ namespace FdoSecrets
|
||||
return qobject_cast<Service*>(parent());
|
||||
}
|
||||
|
||||
void Collection::doLock()
|
||||
bool Collection::doLock()
|
||||
{
|
||||
Q_ASSERT(m_backend);
|
||||
|
||||
m_backend->lock();
|
||||
return m_backend->lock();
|
||||
}
|
||||
|
||||
void Collection::doUnlock()
|
||||
|
@ -102,7 +102,7 @@ namespace FdoSecrets
|
||||
|
||||
public slots:
|
||||
// expose some methods for Prmopt to use
|
||||
void doLock();
|
||||
bool doLock();
|
||||
void doUnlock();
|
||||
// will remove self
|
||||
void doDelete();
|
||||
|
@ -65,7 +65,7 @@ namespace FdoSecrets
|
||||
|
||||
DBusReturn<void> PromptBase::dismiss()
|
||||
{
|
||||
emit completed(true, {});
|
||||
emit completed(true, "");
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ namespace FdoSecrets
|
||||
// only need to delete in backend, collection will react itself.
|
||||
auto accepted = service()->doCloseDatabase(m_collection->backend());
|
||||
|
||||
emit completed(!accepted, {});
|
||||
emit completed(!accepted, "");
|
||||
|
||||
return {};
|
||||
}
|
||||
@ -125,11 +125,17 @@ namespace FdoSecrets
|
||||
}
|
||||
|
||||
emit collectionCreated(coll);
|
||||
emit completed(false, coll->objectPath().path());
|
||||
emit completed(false, QVariant::fromValue(coll->objectPath()));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
DBusReturn<void> CreateCollectionPrompt::dismiss()
|
||||
{
|
||||
emit completed(true, QVariant::fromValue(QDBusObjectPath{"/"}));
|
||||
return {};
|
||||
}
|
||||
|
||||
LockCollectionsPrompt::LockCollectionsPrompt(Service* parent, const QList<Collection*>& colls)
|
||||
: PromptBase(parent)
|
||||
{
|
||||
@ -153,19 +159,26 @@ namespace FdoSecrets
|
||||
|
||||
MessageBox::OverrideParent override(findWindow(windowId));
|
||||
|
||||
QList<QDBusObjectPath> locked;
|
||||
for (const auto& c : asConst(m_collections)) {
|
||||
if (c) {
|
||||
c->doLock();
|
||||
locked << c->objectPath();
|
||||
if (!c->doLock()) {
|
||||
return dismiss();
|
||||
}
|
||||
m_locked << c->objectPath();
|
||||
}
|
||||
}
|
||||
|
||||
emit completed(false, QVariant::fromValue(locked));
|
||||
emit completed(false, QVariant::fromValue(m_locked));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
DBusReturn<void> LockCollectionsPrompt::dismiss()
|
||||
{
|
||||
emit completed(true, QVariant::fromValue(m_locked));
|
||||
return {};
|
||||
}
|
||||
|
||||
UnlockCollectionsPrompt::UnlockCollectionsPrompt(Service* parent, const QList<Collection*>& colls)
|
||||
: PromptBase(parent)
|
||||
{
|
||||
@ -191,6 +204,7 @@ namespace FdoSecrets
|
||||
|
||||
for (const auto& c : asConst(m_collections)) {
|
||||
if (c) {
|
||||
// doUnlock is nonblocking
|
||||
connect(c, &Collection::doneUnlockCollection, this, &UnlockCollectionsPrompt::collectionUnlockFinished);
|
||||
c->doUnlock();
|
||||
}
|
||||
@ -226,6 +240,11 @@ namespace FdoSecrets
|
||||
emit completed(m_unlocked.isEmpty(), QVariant::fromValue(m_unlocked));
|
||||
}
|
||||
}
|
||||
DBusReturn<void> UnlockCollectionsPrompt::dismiss()
|
||||
{
|
||||
emit completed(true, QVariant::fromValue(m_unlocked));
|
||||
return {};
|
||||
}
|
||||
|
||||
DeleteItemPrompt::DeleteItemPrompt(Service* parent, Item* item)
|
||||
: PromptBase(parent)
|
||||
@ -250,14 +269,18 @@ namespace FdoSecrets
|
||||
// delete item's backend. Item will be notified after the backend is deleted.
|
||||
if (m_item) {
|
||||
if (FdoSecrets::settings()->noConfirmDeleteItem()) {
|
||||
MessageBox::setNextAnswer(MessageBox::Move);
|
||||
// based on permanent or not, different button is used
|
||||
if (m_item->isDeletePermanent()) {
|
||||
MessageBox::setNextAnswer(MessageBox::Delete);
|
||||
} else {
|
||||
MessageBox::setNextAnswer(MessageBox::Move);
|
||||
}
|
||||
}
|
||||
m_item->collection()->doDeleteEntries({m_item->backend()});
|
||||
}
|
||||
|
||||
emit completed(false, {});
|
||||
emit completed(false, "");
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace FdoSecrets
|
||||
|
@ -73,6 +73,7 @@ namespace FdoSecrets
|
||||
explicit CreateCollectionPrompt(Service* parent);
|
||||
|
||||
DBusReturn<void> prompt(const QString& windowId) override;
|
||||
DBusReturn<void> dismiss() override;
|
||||
|
||||
signals:
|
||||
void collectionCreated(Collection* coll);
|
||||
@ -85,9 +86,11 @@ namespace FdoSecrets
|
||||
explicit LockCollectionsPrompt(Service* parent, const QList<Collection*>& colls);
|
||||
|
||||
DBusReturn<void> prompt(const QString& windowId) override;
|
||||
DBusReturn<void> dismiss() override;
|
||||
|
||||
private:
|
||||
QList<QPointer<Collection>> m_collections;
|
||||
QList<QDBusObjectPath> m_locked;
|
||||
};
|
||||
|
||||
class UnlockCollectionsPrompt : public PromptBase
|
||||
@ -97,6 +100,7 @@ namespace FdoSecrets
|
||||
explicit UnlockCollectionsPrompt(Service* parent, const QList<Collection*>& coll);
|
||||
|
||||
DBusReturn<void> prompt(const QString& windowId) override;
|
||||
DBusReturn<void> dismiss() override;
|
||||
|
||||
private slots:
|
||||
void collectionUnlockFinished(bool accepted);
|
||||
|
Loading…
Reference in New Issue
Block a user