source: SMSSender/gateways/Post/business/account.h @ 376:0d8179eea17f

separation-frontend-backend
Last change on this file since 376:0d8179eea17f was 376:0d8179eea17f, checked in by Sämy Zehnder <saemy.zehnder@…>, 5 years ago
  • Separates backend and frontend code in the Post gateway.
File size: 2.3 KB
Line 
1/*
2  Swiss Post gateway plugin - The smssender plugin for the Swiss Post platform.
3  Copyright (C) 2011-2014, gorrión. See http://smssender.gorrion.ch
4
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  GNU General Public License for more details.
14
15  You should have received a copy of the GNU General Public License
16  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef POST_ACCOUNT_H
19#define POST_ACCOUNT_H
20
21#include <QScopedPointer>
22
23#include "common/network/snetworkhelper.h"
24#include "gateways/common/business/baseaccount.h"
25
26namespace Post {
27
28class Account : public BaseAccount {
29    Q_OBJECT
30
31    friend class AccountLoginTask; // reloadOnlineParams
32    friend class SMSSendTask; // reloadOnlineParams
33
34public:
35    explicit Account(IGateway *gateway);
36
37public: /* IAccount */
38    Persistence::IStorageHelper *createStorageHelper(
39            Persistence::IMainStorage *storage);
40    IValidator *createValidator() const;
41
42public: /* IAccount - SMS sending */
43    void cancelSMSSending();
44
45public: /* IAccount - costs */
46    int costsForText(const QString &text) const;
47    int fragmentSize() const;
48
49public:
50    SNetworkHelper *httpHelper() const;
51
52protected: /* AbstractAccount */
53    IAccountInitTask *doCreateInitTask();
54    IAccountLoginTask *doCreateLoginTask();
55    ISMSSendTask *doCreateSMSSendTask(const QString& message,
56                                      const QSet<const SContact *>& recipients);
57
58protected: /* AbstractLoginAccount */
59    bool checkStillLoggedIn();
60
61private:
62    int longSMSLength() const;
63    void setLongSMSLength(int longSMSLength);
64
65private:
66    void reloadOnlineParams();
67    void reloadOnlineParams(QString html);
68
69    void reloadLongSMSLength(QString html);
70    void reloadFreeSMSCount(QString html);
71
72private slots:
73    void onInitStateChanged();
74
75private:
76    QScopedPointer<SNetworkHelper> m_httpHelper;
77    int m_longSMSLength;
78
79    Q_DISABLE_COPY(Account)
80};
81
82}
83
84#endif /* POST_ACCOUNT_H */
Note: See TracBrowser for help on using the repository browser.