qDebug() << __PRETTY_FUNCTION__;
if (m_facebookAuthenticator->isLoggedIn())
- m_facebookAuthenticator->logOut();
+ m_facebookAuthenticator->logOut(true);
else if (m_networkAccessManager->isConnected())
m_facebookAuthenticator->login();
else
m_browser = 0;
}
-void FacebookAuthentication::clearAccountInformation(bool keepUsername)
+void FacebookAuthentication::clearAccountInformation(bool clearUserInformation)
{
- qDebug() << __PRETTY_FUNCTION__;
+ qWarning() << __PRETTY_FUNCTION__ << "clearUserInformation:" << clearUserInformation;
QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
- if(!keepUsername) {
- settings.remove(SETTINGS_AUTOMATIC_UPDATE_ENABLED);
- settings.remove(SETTINGS_AUTOMATIC_UPDATE_INTERVAL);
- }
-
settings.remove(USER_UNSEND_MESSAGE);
settings.remove(USER_UNSEND_MESSAGE_PUBLISH);
- NetworkCookieJar::clearCookiesSetting();
+ if (clearUserInformation) {
+ NetworkCookieJar::clearCookiesSetting();
+ settings.remove(SETTINGS_AUTOMATIC_UPDATE_ENABLED);
+ settings.remove(SETTINGS_AUTOMATIC_UPDATE_INTERVAL);
+ }
}
void FacebookAuthentication::destroyLogin()
m_browser->deleteLater();
}
-bool FacebookAuthentication::isLoggedIn()
+bool FacebookAuthentication::isLoggedIn() const
{
qWarning() << __PRETTY_FUNCTION__;
}
}
-void FacebookAuthentication::logOut()
+void FacebookAuthentication::logOut(bool clearUserInformation)
{
qWarning() << __PRETTY_FUNCTION__;
- clearAccountInformation();
+ clearAccountInformation(clearUserInformation);
m_loggedIn = false;
emit loggedOut();
}
/**
* @brief Clears account information from settings
*
- * @param keepUsername keep = true, false otherwise
+ * @param clearUserInformation True if user information should be cleared
*/
- void clearAccountInformation(bool keepUsername = false);
+ void clearAccountInformation(bool clearUserInformation = false);
/**
* @brief Is the user currently logged in
*
* @returns True if the user is logged in, otherwise false
*/
- bool isLoggedIn();
+ bool isLoggedIn() const;
/**
* @brief Initiate login process
/**
* @brief Log out
+ *
+ * @param clearUserInformation True if user information should be cleared
*/
- void logOut();
+ void logOut(bool clearUserInformation = false);
private:
/**