Changed implementation
[situare] / src / facebookservice / facebookauthentication.h
index e4c5883..6f37c71 100644 (file)
@@ -62,6 +62,13 @@ public:
 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
@@ -82,40 +89,6 @@ public slots:
     */
     void start();
 
-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:
 
     /**
@@ -135,14 +108,20 @@ private slots:
 signals:
 
     /**
+    * @brief Signals error
+    *
+    * @param error error message
+    */
+    void error(const QString &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 This signal is emitted if updateCredentials method can't find credentials from URL
@@ -151,11 +130,23 @@ signals:
     void loginFailure();
 
     /**
+    * @brief This signal is emitted always when login is called. At first  the application tries
+    *        to login using saved cookies
+    *
+    */
+    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
@@ -163,6 +154,8 @@ signals:
 
 private:
 
+    bool m_freshLogin;
+
     int m_loginAttempts; ///< Indicates login attempts
 
     /**