Skip to content

Commit

Permalink
Connect ShareObserver to group signals (keepassxreboot#3441)
Browse files Browse the repository at this point in the history
Connected ShareObserver to allow to import from a share before an export happens.
  • Loading branch information
ckieschnick authored and droidmonkey committed Sep 5, 2019
1 parent 41131ae commit 0a75b47
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/keeshare/ShareObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ ShareObserver::ShareObserver(QSharedPointer<Database> db, QObject* parent)
{
connect(KeeShare::instance(), SIGNAL(activeChanged()), SLOT(handleDatabaseChanged()));

connect(m_db.data(), SIGNAL(groupDataChanged(Group*)), SLOT(handleDatabaseChanged()));
connect(m_db.data(), SIGNAL(groupAdded()), SLOT(handleDatabaseChanged()));
connect(m_db.data(), SIGNAL(groupRemoved()), SLOT(handleDatabaseChanged()));

connect(m_db.data(), SIGNAL(databaseModified()), SLOT(handleDatabaseChanged()));
connect(m_db.data(), SIGNAL(databaseSaved()), SLOT(handleDatabaseSaved()));

Expand Down Expand Up @@ -109,10 +113,12 @@ void ShareObserver::reinitialize()
}
if (update.newReference.isExporting()) {
exported[update.newReference.path] << update.group->name();
// export is only on save
}

if (update.newReference.isImporting()) {
imported[update.newReference.path] << update.group->name();
// import has to occur immediately
const auto result = this->importShare(update.newReference.path);
if (!result.isValid()) {
// tolerable result - blocked import or missing source
Expand Down

0 comments on commit 0a75b47

Please sign in to comment.