Fixup PR13870: Make the feature work in Master

This commit is contained in:
Zach Fox 2018-08-29 16:58:19 -07:00
parent 67e57a9487
commit b8cd5dd8b9
3 changed files with 11 additions and 8 deletions

View file

@ -1735,11 +1735,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
QTimer* settingsTimer = new QTimer();
moveToNewNamedThread(settingsTimer, "Settings Thread", [this, settingsTimer]{
connect(qApp, &Application::beforeAboutToQuit, [this, settingsTimer]{
bool autoLogout = Setting::Handle<bool>(AUTO_LOGOUT_SETTING_NAME, false).get();
if (autoLogout) {
auto accountManager = DependencyManager::get<AccountManager>();
accountManager->logout();
}
// Disconnect the signal from the save settings
QObject::disconnect(settingsTimer, &QTimer::timeout, this, &Application::saveSettings);
// Stop the settings timer
@ -2491,6 +2486,11 @@ void Application::cleanupBeforeQuit() {
}
DependencyManager::destroy<ScriptEngines>();
bool autoLogout = Setting::Handle<bool>(AUTO_LOGOUT_SETTING_NAME, false).get();
if (autoLogout) {
DependencyManager::get<AccountManager>()->removeAccountFromFile();
}
_displayPlugin.reset();
PluginManager::getInstance()->shutdown();

View file

@ -96,6 +96,8 @@ public:
QUrl getMetaverseServerURL() { return NetworkingConstants::METAVERSE_SERVER_URL(); }
void removeAccountFromFile();
public slots:
void requestAccessToken(const QString& login, const QString& password);
void requestAccessTokenWithSteam(QByteArray authSessionTicket);
@ -133,7 +135,6 @@ private:
void operator=(AccountManager const& other) = delete;
void persistAccountToFile();
void removeAccountFromFile();
void passSuccessToCallback(QNetworkReply* reply);
void passErrorToCallback(QNetworkReply* reply);

View file

@ -407,8 +407,10 @@
}
function onUsernameChanged() {
Settings.setValue("wallet/autoLogout", false);
Settings.setValue("wallet/savedUsername", "");
if (Account.username !== Settings.getValue("wallet/savedUsername")) {
Settings.setValue("wallet/autoLogout", false);
Settings.setValue("wallet/savedUsername", "");
}
}
// Function Name: fromQml()