public slots:
/**
+ * @brief Clears account iformation from settings
+ *
+ * @param keepUsername keep = true, false otherwise
+ */
+ void clearAccountInformation(bool keepUsername = false);
+
+ /**
* @brief Loads username from settings
*
* @return QString Loaded username
*/
void start();
- /**
- * @brief Clears account iformation from settings
- *
- */
- void clearAccountInformation();
-
-private:
-
- /**
- * @brief Creates login url with given parameters
- *
- * @param urlParts Url parts
- * @return QUrl Login page url
- */
- QUrl formLoginPageUrl(const QStringList & urlParts) const;
-
- /**
- * @brief Reads previous stored credentials from file.
- *
- * @param credentialsFromFile This dataclass is the place where method stores credentials.
- * Corrent parameter here is m_loginCredentials
- */
- void readCredentials(FacebookCredentials &credentialsFromFile);
-
- /**
- * @brief Checks expiration time of credentials and compares it to current time.
- *
- * @param credentials this parameter represents credentials that will be verified.
- * @return bool returns true if expiration time is after current time. in other cases returns
- * false.
- */
- bool verifyCredentials(const FacebookCredentials &credentials) const;
-
- /**
- * @brief Writes credentials to File
- *
- * @param credentials Contents of this dataclass is stored to file
- */
- void writeCredentials(const FacebookCredentials &credentials);
-
private slots:
/**
signals:
/**
+ * @brief Signals error
+ *
+ * @param error error code
+ */
+ void error(const int error);
+
+ /**
* @brief This signal is emitted if updateCredentials method finds credentials from URL.
* Signal is also emitted at the beginning of the program if there is valid credentials
* in the file.
*
- * @param freshLogin Was login done via login dialog
* @param credentials New credentials
*/
- void credentialsReady(bool freshLogin, const FacebookCredentials &credentials);
+ void credentialsReady(const FacebookCredentials &credentials);
/**
- * @brief Signals changed credentials
+ * @brief This signal is emitted if updateCredentials method can't find credentials from URL
*
- * @param credentials New credentials
*/
- void credentialsChanged(const FacebookCredentials &credentials);
+ void loginFailure();
/**
- * @brief This signal is emitted if updateCredentials method can't find credentials from URL
+ * @brief This signal is emitted always when login is called. At first the application tries
+ * to login using saved cookies
*
*/
- void loginFailure();
+ void loginUsingCookies();
/**
* @brief Signals when credentials are invalid new login is needed
*
- * @param url Login page url
*/
- void newLoginRequest(const QUrl &url);
+ void newLoginRequest();
+
+ /**
+ * @brief This signal is emitted when new cookies need to be saved.
+ *
+ */
+ void saveCookiesRequest();
/*******************************************************************************
* DATA MEMBERS
private:
- int m_loginAttempts; ///< Indicates login attempts
+ bool m_freshLogin; ///< Flag for fresh login
/**
* @brief Dataclass that contains authorization to use facebook. Dataclass is composed of five