source: SMSSender/gateways/Post/src/business/account.h @ 315:e6c8bb244ecd

separation-frontend-backend
Last change on this file since 315:e6c8bb244ecd was 315:e6c8bb244ecd, checked in by Sämy Zehnder <saemy.zehnder@…>, 5 years ago
  • Separates the frontend from the backend code.
  • At this point the schoolnet gateway is converted only.
  • Removes bc & da prefixes from the filenames.
File size: 2.6 KB
Line 
1/*
2  Swiss Post gateway plugin - The smssender plugin for the Swiss Post platform.
3  Copyright (C) 2011-2012, 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_BCACCOUNT_H_
19#define POST_BCACCOUNT_H_
20
21#include <QScopedPointer>
22
23#include <business/impl/abstractaccount.h>
24#include <network/snetworkhelper.h>
25#include <persistence/imainstorage.h>
26
27namespace Post {
28
29class Account : public AbstractAccount {
30    Q_OBJECT
31
32    friend class ContactImporter; // networkHelper()
33    friend class AccountLoginTask; // reloadOnlineParams(), httpHelper()
34    friend class SMSSendTask; // reloadOnlineParams(), httpHelper()
35
36public:
37    explicit Account(IGateway *gateway);
38
39public: /* IAccount */
40    Persistence::IStorageHelper* createStorageHelper(Persistence::IMainStorage *storage);
41    IValidator* createValidator() const;
42
43public: /* IAccount - SMS sending */
44    void               cancelSMSSending();
45
46public: /* IAccount - costs */
47    int                costsForText(const QString &text) const;
48    int                fragmentSize() const;
49
50public: /* Properties */
51
52protected: /* AbstractAccount */
53    IAccountInitTask*  doCreateInitTask();
54    IAccountLoginTask* doCreateLoginTask();
55    ISMSSendTask*      doCreateSMSSendTask(const QString& message, const QSet<SContact>& recipients);
56
57protected: /* AbstractLoginAccount */
58    bool               checkStillLoggedIn();
59
60private:
61    int                longSMSLength() const;
62    void               setLongSMSLength(int longSMSLength);
63
64private:
65    void               reloadOnlineParams();
66    void               reloadOnlineParams(QString html);
67
68    void               reloadLongSMSLength(QString html);
69    void               reloadFreeSMSCount(QString html);
70
71private:
72    SNetworkHelper *httpHelper() const; // TODO: dependency injection -> remove friends
73
74private slots:
75    void               onInitStateChanged();
76
77private:
78    QScopedPointer<SNetworkHelper> m_httpHelper;
79    int m_longSMSLength;
80
81    Q_DISABLE_COPY(Account)
82};
83
84}
85
86#endif /* POST_BCACCOUNT_H_ */
Note: See TracBrowser for help on using the repository browser.