From a5b034d4a9c44f9bc1e83b01de82530f8fc63013 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 4 Apr 2015 14:41:04 -0400 Subject: Imported Upstream version 3.0.4 --- .../coreSQLiteStudio/services/impl/dbmanagerimpl.cpp | 17 ++++++++++++++--- .../coreSQLiteStudio/services/impl/dbmanagerimpl.h | 2 +- SQLiteStudio3/coreSQLiteStudio/services/importmanager.h | 2 ++ .../coreSQLiteStudio/services/notifymanager.cpp | 3 +++ 4 files changed, 20 insertions(+), 4 deletions(-) (limited to 'SQLiteStudio3/coreSQLiteStudio/services') diff --git a/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp b/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp index 70aa568..e96e181 100644 --- a/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp @@ -107,9 +107,14 @@ bool DbManagerImpl::updateDb(Db* db, const QString &name, const QString &path, c result = CFG->removeDb(name); InvalidDb* invalidDb = dynamic_cast(db); + bool wasReloaded = false; Db* reloadedDb = db; if (pathDifferent && invalidDb) - reloadedDb = tryToLoadDb(invalidDb); + { + reloadedDb = tryToLoadDb(invalidDb, false); + if (reloadedDb) // we need to know that, so we can emit dbLoaded() signal later, out of the listLock + wasReloaded = true; + } if (reloadedDb) // reloading was not necessary (was not invalid) or it was successful db = reloadedDb; @@ -119,6 +124,10 @@ bool DbManagerImpl::updateDb(Db* db, const QString &name, const QString &path, c listLock.unlock(); + // If we did reload the db, we need to emit proper signal, because it was suppressed in tryToLoadDb(), because of the listLock + if (wasReloaded) + emit dbLoaded(db); + if (result && reloadedDb) emit dbUpdated(oldName, db); else if (reloadedDb) // database reloaded correctly, but update failed @@ -355,7 +364,7 @@ QList DbManagerImpl::getInvalidDatabases() const }); } -Db* DbManagerImpl::tryToLoadDb(InvalidDb* invalidDb) +Db* DbManagerImpl::tryToLoadDb(InvalidDb* invalidDb, bool emitNotifySignal) { QUrl url = QUrl::fromUserInput(invalidDb->getPath()); if (url.isLocalFile() && !QFile::exists(invalidDb->getPath())) @@ -373,7 +382,9 @@ Db* DbManagerImpl::tryToLoadDb(InvalidDb* invalidDb) if (CFG->getDbGroup(db->getName())->open) db->open(); - emit dbLoaded(db); + if (emitNotifySignal) + emit dbLoaded(db); + return db; } diff --git a/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.h b/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.h index 8e28080..5797ac6 100644 --- a/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.h +++ b/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.h @@ -94,7 +94,7 @@ class API_EXPORT DbManagerImpl : public DbManager */ QList getInvalidDatabases() const; - Db* tryToLoadDb(InvalidDb* invalidDb); + Db* tryToLoadDb(InvalidDb* invalidDb, bool emitNotifySignal = true); /** * @brief Creates database object. diff --git a/SQLiteStudio3/coreSQLiteStudio/services/importmanager.h b/SQLiteStudio3/coreSQLiteStudio/services/importmanager.h index 6f13826..2401e78 100644 --- a/SQLiteStudio3/coreSQLiteStudio/services/importmanager.h +++ b/SQLiteStudio3/coreSQLiteStudio/services/importmanager.h @@ -36,6 +36,8 @@ class API_EXPORT ImportManager : public PluginServiceBase * (for example from a clipboard). */ QString inputFileName; + + bool ignoreErrors = false; }; enum StandardConfigFlag diff --git a/SQLiteStudio3/coreSQLiteStudio/services/notifymanager.cpp b/SQLiteStudio3/coreSQLiteStudio/services/notifymanager.cpp index 0980399..f8b7f25 100644 --- a/SQLiteStudio3/coreSQLiteStudio/services/notifymanager.cpp +++ b/SQLiteStudio3/coreSQLiteStudio/services/notifymanager.cpp @@ -1,4 +1,5 @@ #include "services/notifymanager.h" +#include DEFINE_SINGLETON(NotifyManager) @@ -71,11 +72,13 @@ QList NotifyManager::getRecentErrors() const void notifyError(const QString &msg) { + qDebug() << "Error from notify manager:" << msg; NotifyManager::getInstance()->error(msg); } void notifyWarn(const QString &msg) { + qDebug() << "Warning from notify manager:" << msg; NotifyManager::getInstance()->warn(msg); } -- cgit v1.2.3