Connect ShareObserver to group signals (#3441)

Connected ShareObserver to allow to import from a share before an export happens.
This commit is contained in:
ckieschnick 2019-09-05 04:57:37 +02:00 committed by Jonathan White
parent 41131ae48d
commit 0a75b47509

View File

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