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());
|
return qobject_cast<Service*>(parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Collection::doLock()
|
bool Collection::doLock()
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_backend);
|
Q_ASSERT(m_backend);
|
||||||
|
|
||||||
m_backend->lock();
|
return m_backend->lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Collection::doUnlock()
|
void Collection::doUnlock()
|
||||||
|
@ -102,7 +102,7 @@ namespace FdoSecrets
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// expose some methods for Prmopt to use
|
// expose some methods for Prmopt to use
|
||||||
void doLock();
|
bool doLock();
|
||||||
void doUnlock();
|
void doUnlock();
|
||||||
// will remove self
|
// will remove self
|
||||||
void doDelete();
|
void doDelete();
|
||||||
|
@ -65,7 +65,7 @@ namespace FdoSecrets
|
|||||||
|
|
||||||
DBusReturn<void> PromptBase::dismiss()
|
DBusReturn<void> PromptBase::dismiss()
|
||||||
{
|
{
|
||||||
emit completed(true, {});
|
emit completed(true, "");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ namespace FdoSecrets
|
|||||||
// only need to delete in backend, collection will react itself.
|
// only need to delete in backend, collection will react itself.
|
||||||
auto accepted = service()->doCloseDatabase(m_collection->backend());
|
auto accepted = service()->doCloseDatabase(m_collection->backend());
|
||||||
|
|
||||||
emit completed(!accepted, {});
|
emit completed(!accepted, "");
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -125,11 +125,17 @@ namespace FdoSecrets
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit collectionCreated(coll);
|
emit collectionCreated(coll);
|
||||||
emit completed(false, coll->objectPath().path());
|
emit completed(false, QVariant::fromValue(coll->objectPath()));
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBusReturn<void> CreateCollectionPrompt::dismiss()
|
||||||
|
{
|
||||||
|
emit completed(true, QVariant::fromValue(QDBusObjectPath{"/"}));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
LockCollectionsPrompt::LockCollectionsPrompt(Service* parent, const QList<Collection*>& colls)
|
LockCollectionsPrompt::LockCollectionsPrompt(Service* parent, const QList<Collection*>& colls)
|
||||||
: PromptBase(parent)
|
: PromptBase(parent)
|
||||||
{
|
{
|
||||||
@ -153,19 +159,26 @@ namespace FdoSecrets
|
|||||||
|
|
||||||
MessageBox::OverrideParent override(findWindow(windowId));
|
MessageBox::OverrideParent override(findWindow(windowId));
|
||||||
|
|
||||||
QList<QDBusObjectPath> locked;
|
|
||||||
for (const auto& c : asConst(m_collections)) {
|
for (const auto& c : asConst(m_collections)) {
|
||||||
if (c) {
|
if (c) {
|
||||||
c->doLock();
|
if (!c->doLock()) {
|
||||||
locked << c->objectPath();
|
return dismiss();
|
||||||
|
}
|
||||||
|
m_locked << c->objectPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit completed(false, QVariant::fromValue(locked));
|
emit completed(false, QVariant::fromValue(m_locked));
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBusReturn<void> LockCollectionsPrompt::dismiss()
|
||||||
|
{
|
||||||
|
emit completed(true, QVariant::fromValue(m_locked));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
UnlockCollectionsPrompt::UnlockCollectionsPrompt(Service* parent, const QList<Collection*>& colls)
|
UnlockCollectionsPrompt::UnlockCollectionsPrompt(Service* parent, const QList<Collection*>& colls)
|
||||||
: PromptBase(parent)
|
: PromptBase(parent)
|
||||||
{
|
{
|
||||||
@ -191,6 +204,7 @@ namespace FdoSecrets
|
|||||||
|
|
||||||
for (const auto& c : asConst(m_collections)) {
|
for (const auto& c : asConst(m_collections)) {
|
||||||
if (c) {
|
if (c) {
|
||||||
|
// doUnlock is nonblocking
|
||||||
connect(c, &Collection::doneUnlockCollection, this, &UnlockCollectionsPrompt::collectionUnlockFinished);
|
connect(c, &Collection::doneUnlockCollection, this, &UnlockCollectionsPrompt::collectionUnlockFinished);
|
||||||
c->doUnlock();
|
c->doUnlock();
|
||||||
}
|
}
|
||||||
@ -226,6 +240,11 @@ namespace FdoSecrets
|
|||||||
emit completed(m_unlocked.isEmpty(), QVariant::fromValue(m_unlocked));
|
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)
|
DeleteItemPrompt::DeleteItemPrompt(Service* parent, Item* item)
|
||||||
: PromptBase(parent)
|
: PromptBase(parent)
|
||||||
@ -250,14 +269,18 @@ namespace FdoSecrets
|
|||||||
// delete item's backend. Item will be notified after the backend is deleted.
|
// delete item's backend. Item will be notified after the backend is deleted.
|
||||||
if (m_item) {
|
if (m_item) {
|
||||||
if (FdoSecrets::settings()->noConfirmDeleteItem()) {
|
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()});
|
m_item->collection()->doDeleteEntries({m_item->backend()});
|
||||||
}
|
}
|
||||||
|
|
||||||
emit completed(false, {});
|
emit completed(false, "");
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace FdoSecrets
|
} // namespace FdoSecrets
|
||||||
|
@ -73,6 +73,7 @@ namespace FdoSecrets
|
|||||||
explicit CreateCollectionPrompt(Service* parent);
|
explicit CreateCollectionPrompt(Service* parent);
|
||||||
|
|
||||||
DBusReturn<void> prompt(const QString& windowId) override;
|
DBusReturn<void> prompt(const QString& windowId) override;
|
||||||
|
DBusReturn<void> dismiss() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void collectionCreated(Collection* coll);
|
void collectionCreated(Collection* coll);
|
||||||
@ -85,9 +86,11 @@ namespace FdoSecrets
|
|||||||
explicit LockCollectionsPrompt(Service* parent, const QList<Collection*>& colls);
|
explicit LockCollectionsPrompt(Service* parent, const QList<Collection*>& colls);
|
||||||
|
|
||||||
DBusReturn<void> prompt(const QString& windowId) override;
|
DBusReturn<void> prompt(const QString& windowId) override;
|
||||||
|
DBusReturn<void> dismiss() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QPointer<Collection>> m_collections;
|
QList<QPointer<Collection>> m_collections;
|
||||||
|
QList<QDBusObjectPath> m_locked;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UnlockCollectionsPrompt : public PromptBase
|
class UnlockCollectionsPrompt : public PromptBase
|
||||||
@ -97,6 +100,7 @@ namespace FdoSecrets
|
|||||||
explicit UnlockCollectionsPrompt(Service* parent, const QList<Collection*>& coll);
|
explicit UnlockCollectionsPrompt(Service* parent, const QList<Collection*>& coll);
|
||||||
|
|
||||||
DBusReturn<void> prompt(const QString& windowId) override;
|
DBusReturn<void> prompt(const QString& windowId) override;
|
||||||
|
DBusReturn<void> dismiss() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void collectionUnlockFinished(bool accepted);
|
void collectionUnlockFinished(bool accepted);
|
||||||
|
Loading…
Reference in New Issue
Block a user