Changeset 218:a3ba967e8dc4 in SMSSender


Ignore:
Timestamp:
May 10, 2012 3:27:24 PM (8 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
default
Message:
  • Added some forgotten IMPL macros.
  • Fixed some crashes because of not initialized variables.
  • Switched datatypes library into a shared one. Seems like this fixes #59.
Files:
1 added
1 deleted
60 edited
5 moved

Legend:

Unmodified
Added
Removed
  • gateways/Schoolnet/src/business/bcaccount.cpp

    r217 r218  
    5252BCAccount::BCAccount(QObject* parent, IStorage* storage)
    5353    : AbstractAccount(parent)
     54    , httpHelper_(new BCHttpHelper(this))
    5455    , sendAs_(saNumber)
    5556    , useDeepThought_(true)
  • gateways/Schoolnet/src/business/bchttphelper.cpp

    r217 r218  
    2525
    2626namespace Schoolnet {
     27
     28BCHttpHelper::BCHttpHelper(QObject *parent)
     29    : SNetworkHelper(parent)
     30{
     31}
    2732
    2833QByteArray BCHttpHelper::postback(QString eventTarget, const QString& eventArgument, QList<IParam*>& postValues) {
  • gateways/Schoolnet/src/business/bchttphelper.h

    r217 r218  
    3030
    3131public:
     32    BCHttpHelper(QObject *parent);
     33
     34public:
    3235    QByteArray syncPostByTarget(const QString& eventTarget, const QString& eventArgument, QList<IParam*>& postValues);
    3336
  • gateways/Schoolnet/src/business/deepthought/datatypes.h

    r217 r218  
    4545public:
    4646    QuestionData()
    47         : status(0)
     47        : id(-1)
     48        , status(0)
    4849    {}
    4950    QuestionData(const QuestionData& other)
  • gateways/Schoolnet/src/library.cpp

    r217 r218  
    2929namespace Schoolnet {
    3030
    31 //S_SINGLETON_IMPL(Library)
    32 Library* Library::instance_ = NULL;
    33 Library* Library::instance() {
    34     static CGuard guard; /* To delete the instance at the end */
    35     if (!instance_) {
    36         instance_ = new Library;
    37     }
    38     return instance_;
    39 }
     31S_SINGLETON_IMPL(Library)
    4032
    4133Library::Library()
  • gateways/Schoolnet/src/persistence/deepthought/dadeepthoughtstorage.cpp

    r217 r218  
    2727
    2828namespace Schoolnet {
     29
     30S_SINGLETON_IMPL(DADeepThoughtStorage)
    2931
    3032const uint DADeepThoughtStorage::ACTUAL_DB_VERSION = 2;
  • gateways/Sunrise/src/business/bcaccount.cpp

    r217 r218  
    5050    : AbstractAccount(parent)
    5151    , MAX_ANTICAPTCHA_TRY_COUNT(2)
     52    , networkHelper_(new BCNetworkHelper(this))
    5253{
    5354    init(new DAAccountStorageOfficer(this, this, storage), new SStdAccountValidator(this, this));
  • gateways/Sunrise/src/business/bcnetworkhelper.cpp

    r217 r218  
    2626namespace Sunrise {
    2727
    28 BCNetworkHelper::BCNetworkHelper(QObject* parent)
     28BCNetworkHelper::BCNetworkHelper(QObject *parent)
    2929    : SNetworkHelper(parent)
    3030{
  • gateways/Sunrise/src/business/bcnetworkhelper.h

    r217 r218  
    2828
    2929public:
    30     BCNetworkHelper(QObject* parent);
     30    BCNetworkHelper(QObject *parent);
    3131
    3232    SNetworkReply sendForm(const QString& lastHtml, const QString& formIdOrName, QList<IParam*>& posts, SNetworkHelper::PostType postType = SNetworkHelper::ptUrlEncoded);
  • lib/datatypes/datatypes.pro

    r217 r218  
    88DEFINES += LIBDATATYPES_COMPATIBILITY_VERSION=\\\"3.0.0.alpha$$VERSION_REVISION\\\"
    99VERSION = 3.0.0.$$VERSION_REVISION
    10 CONFIG += staticlib \
    11     thread \
     10CONFIG += thread \
    1211    exceptions \
    1312    rtti
     
    2120include(datatypes.inc)
    2221
     22DEFINES += DATATYPES_LIBRARY
     23
    2324# Input
    2425HEADERS += src/scontact.h \
     
    3031    src/smacros.h \
    3132    src/snetworkhelper.h \ # src/snotifyparam.h \
    32     src/snetworkhelper_p.h \
    3333    src/snetworkreply.h \
    3434    src/snetworkreply_p.h \
     
    7676    src/interfaces/persistence/istorage.h \
    7777    src/interfaces/persistence/istorageofficer.h \
     78    src/interfaces/ui/iaccountsettingswidget.h \
     79    src/interfaces/ui/iclosepreventabledialog.h \
     80    src/interfaces/ui/isendingdialog.h \
    7881    src/managers/staskmanager.h \
    79     src/ui/iaccountsettingswidget.h \
    80     src/ui/iclosepreventabledialog.h \
    81     src/ui/isendingdialog.h \
    8282    src/validation/sstdaccountvalidator.h \
    83     src/validation/svalidationresult.h
     83    src/validation/svalidationresult.h \
     84    src/datatypes_global.h
    8485SOURCES += src/scontact.cpp \
    8586    src/sdummyaccount.cpp \
     
    113114    src/interfaces/persistence/iaccountlistmanager.cpp \
    114115    src/interfaces/persistence/istorage.cpp \
     116    src/interfaces/ui/iclosepreventabledialog.cpp \
     117    src/interfaces/ui/isendingdialog.cpp \
    115118    src/managers/staskmanager.cpp \
    116     src/ui/iclosepreventabledialog.cpp \
    117     src/ui/isendingdialog.cpp \
    118119    src/validation/sstdaccountvalidator.cpp \
    119120    src/validation/svalidationresult.cpp \
  • lib/datatypes/src/abstract/abstractaccount.h

    r217 r218  
    2626#include "persistence/istorageofficer.h"
    2727
    28 class AbstractAccount: public IAccount {
     28class DATATYPES_SHARED_EXPORT AbstractAccount: public IAccount {
    2929    Q_OBJECT
    3030    Q_INTERFACES(IAccount)
  • lib/datatypes/src/abstract/abstractaccount_tasks.h

    r217 r218  
    2828class AbstractAccount;
    2929
    30 class AbstractAccountInitTask : public IAccountInitTask {
     30class DATATYPES_SHARED_EXPORT AbstractAccountInitTask : public IAccountInitTask {
    3131    Q_OBJECT
    3232
     
    4646
    4747
    48 class AbstractAccountLoginTask : public IAccountLoginTask {
     48class DATATYPES_SHARED_EXPORT AbstractAccountLoginTask : public IAccountLoginTask {
    4949    Q_OBJECT
    5050
     
    6767
    6868
    69 class AbstractSMSSendTask : public ISMSSendTask {
     69class DATATYPES_SHARED_EXPORT AbstractSMSSendTask : public ISMSSendTask {
    7070    Q_OBJECT
    7171
  • lib/datatypes/src/abstract/abstractgateway.h

    r217 r218  
    2222#include "istorage.h"
    2323
    24 class AbstractGateway: public IGateway {
     24class DATATYPES_SHARED_EXPORT AbstractGateway: public IGateway {
    2525    Q_OBJECT
    2626    Q_INTERFACES(IGateway)
  • lib/datatypes/src/abstract/persistence/abstractaccountstorageofficer.h

    r217 r218  
    2424#include "abstract/abstractaccount.h"
    2525
    26 class AbstractAccountStorageOfficer : public AbstractStorageOfficer {
     26class DATATYPES_SHARED_EXPORT AbstractAccountStorageOfficer : public AbstractStorageOfficer {
    2727    Q_OBJECT
    2828
  • lib/datatypes/src/abstract/persistence/abstractstorageofficer.h

    r217 r218  
    2222#include "persistence/istorageofficer.h"
    2323
    24 class AbstractStorageOfficer: public IStorageOfficer {
     24class DATATYPES_SHARED_EXPORT AbstractStorageOfficer: public IStorageOfficer {
    2525    Q_OBJECT
    2626    Q_INTERFACES(IStorageOfficer)
  • lib/datatypes/src/abstract/persistence/versionedstorage.h

    r217 r218  
    2222#include <QSqlDatabase>
    2323
    24 class VersionedStorage {
     24#include "datatypes_global.h"
     25
     26class DATATYPES_SHARED_EXPORT VersionedStorage {
    2527protected:
    2628    void init(const QSqlDatabase& db, uint newestVersion);
  • lib/datatypes/src/exceptions/eabortloadingexception.h

    r194 r218  
    2222#include "eexception.h"
    2323
    24 class SMAKE_VISIBLE EAbortException: public EException {
     24class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE EAbortException: public EException {
    2525public:
    2626    EAbortException();
  • lib/datatypes/src/exceptions/eexception.h

    r217 r218  
    2828#include <stdexcept>
    2929
     30#include "datatypes_global.h"
     31
    3032#ifndef Q_WS_WIN
    3133    #define SMAKE_VISIBLE __attribute__ ((visibility("default")))
     
    3537
    3638class EException;
    37 class SMAKE_VISIBLE EException : public std::runtime_error {
     39class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE EException : public std::runtime_error {
    3840public:
    3941    EException();
  • lib/datatypes/src/exceptions/elibraryloadexception.h

    r194 r218  
    2525namespace Library {
    2626
    27 class SMAKE_VISIBLE ELoadException: public EException {
     27class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE ELoadException: public EException {
    2828public:
    2929    enum Purpose {
  • lib/datatypes/src/exceptions/eloginaccountloginexception.h

    r194 r218  
    2525namespace LoginAccount {
    2626
    27 class SMAKE_VISIBLE ELoginException: public EException {
     27class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE ELoginException: public EException {
    2828public:
    2929    enum Purpose {
  • lib/datatypes/src/exceptions/enetworkexception.h

    r194 r218  
    2525#include <QNetworkReply>
    2626
    27 class SMAKE_VISIBLE ENetworkException : public EException {
     27class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE ENetworkException : public EException {
    2828public:
    2929    ENetworkException(QNetworkReply::NetworkError networkError, const QString& message);
  • lib/datatypes/src/exceptions/eparseexception.h

    r194 r218  
    2323#include <QMetaType>
    2424
    25 class SMAKE_VISIBLE EParseException: public EException {
     25class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE EParseException: public EException {
    2626public:
    2727    explicit EParseException(const QString& msg);
  • lib/datatypes/src/exceptions/httpexceptions.h

    r194 r218  
    2525
    2626namespace Http {
    27     class SMAKE_VISIBLE EReadException: public EException {
     27    class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE EReadException: public EException {
    2828    public:
    2929        explicit EReadException(const QString& msg);
     
    3636    };
    3737
    38     class SMAKE_VISIBLE ESSLException: public EException {
     38    class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE ESSLException: public EException {
    3939    public:
    4040        explicit ESSLException(const QList<QSslError>& errors);
  • lib/datatypes/src/exceptions/persistence/estoragereadexception.h

    r194 r218  
    2424
    2525namespace Storage {
    26     class SMAKE_VISIBLE EReadException: public EException {
     26    class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE EReadException: public EException {
    2727    public:
    2828        explicit EReadException(const QString& msg);
  • lib/datatypes/src/exceptions/persistence/estoragewriteexception.h

    r194 r218  
    2424
    2525namespace Storage {
    26     class SMAKE_VISIBLE EWriteException: public EException {
     26    class DATATYPES_SHARED_EXPORT SMAKE_VISIBLE EWriteException: public EException {
    2727    public:
    2828        explicit EWriteException(const QString& msg);
  • lib/datatypes/src/interfaces/iaccount.h

    r217 r218  
    3333#include "stask.h"
    3434
     35#include "datatypes_global.h"
     36
    3537class IAccount;
    3638class IGateway;
     
    4042class ISMSSendTask;
    4143
    42 class IAccount: public QObject, public IStorable, public IValidatable {
     44class DATATYPES_SHARED_EXPORT IAccount: public QObject, public IStorable, public IValidatable {
    4345    Q_OBJECT
    4446    Q_INTERFACES(IStorable IValidatable)
  • lib/datatypes/src/interfaces/iaccount_tasks.h

    r217 r218  
    2222#include <QString>
    2323
     24#include "datatypes_global.h"
     25
    2426#include "scontact.h"
    2527#include "stask.h"
     
    3335const uint UID_SEND_SMS      = 300;
    3436
    35 class IAccountTask : public SThreadedTask {
     37class DATATYPES_SHARED_EXPORT IAccountTask : public SThreadedTask {
    3638    Q_OBJECT
    3739
     
    4951
    5052
    51 class IAccountInitTask : public IAccountTask {
     53class DATATYPES_SHARED_EXPORT IAccountInitTask : public IAccountTask {
    5254    Q_OBJECT
    5355
     
    5961
    6062
    61 class IAccountLoginTask : public IAccountTask {
     63class DATATYPES_SHARED_EXPORT IAccountLoginTask : public IAccountTask {
    6264    Q_OBJECT
    6365
     
    6971
    7072
    71 class ISMSSendTask : public IAccountTask {
     73class DATATYPES_SHARED_EXPORT ISMSSendTask : public IAccountTask {
    7274    Q_OBJECT
    7375
  • lib/datatypes/src/interfaces/icontactimporter.h

    r217 r218  
    2525#include <QWizardPage>
    2626
     27#include "datatypes_global.h"
     28
    2729class SContact;
    2830
    29 class IContactImporter : public QObject {
     31class DATATYPES_SHARED_EXPORT IContactImporter : public QObject {
    3032    Q_OBJECT
    3133
  • lib/datatypes/src/interfaces/igateway.h

    r217 r218  
    2626#include <QWidget>
    2727
     28#include "datatypes_global.h"
     29
    2830#include "sdatatypes.h"
    2931
     
    3436class IStorage;
    3537
    36 class IGateway : public QObject {
     38class DATATYPES_SHARED_EXPORT IGateway : public QObject {
    3739    Q_OBJECT
    3840
  • lib/datatypes/src/interfaces/ilibrary.h

    r217 r218  
    2727#include <QTranslator>
    2828
     29#include "datatypes_global.h"
     30
    2931#include "smacros.h"
    3032#include "sshared.h"
     
    3739class SVersion;
    3840
    39 class ILibrary : public QObject {
     41class DATATYPES_SHARED_EXPORT ILibrary : public QObject {
    4042    Q_OBJECT
    4143
  • lib/datatypes/src/interfaces/ilibraryloader.h

    r217 r218  
    2323#include <QString>
    2424
     25#include "datatypes_global.h"
     26
    2527class IGateway;
    2628class ILibrary;
    2729
    28 class ILibraryLoader {
     30class DATATYPES_SHARED_EXPORT ILibraryLoader {
    2931public:
    3032    virtual bool      isLibrary(const QString& filename) =0;
  • lib/datatypes/src/interfaces/imanagers.h

    r217 r218  
    2828#include <QSet>
    2929#include <QString>
     30
     31#include "datatypes_global.h"
    3032
    3133#include "sdatatypes.h"
     
    5254class SNumber;
    5355
    54 class IManagerFactory {
     56class DATATYPES_SHARED_EXPORT IManagerFactory {
    5557public:
    5658    virtual IAccountManager*     accountManager() const =0;
  • lib/datatypes/src/interfaces/istorable.h

    r217 r218  
    1919#define ISTORABLE_H_
    2020
    21 #include <QObject>
     21#include "datatypes_global.h"
    2222
    2323class IStorageOfficer;
    24 class IStorable {
     24
     25class DATATYPES_SHARED_EXPORT IStorable {
    2526public:
    2627    virtual IStorageOfficer* getStorageOfficer() const =0;
  • lib/datatypes/src/interfaces/ivalidatable.h

    r217 r218  
    1919#define IVALIDATABLE_H_
    2020
    21 #include <QObject>
     21#include "datatypes_global.h"
    2222
    2323class IValidator;
    24 class IValidatable {
     24
     25class DATATYPES_SHARED_EXPORT IValidatable {
    2526public:
    2627    virtual IValidator* getValidator() const =0;
  • lib/datatypes/src/interfaces/ivalidator.h

    r217 r218  
    2121#include <QObject>
    2222
     23#include "datatypes_global.h"
     24
    2325class SValidationResult;
    2426
    25 class IValidator : public QObject {
     27class DATATYPES_SHARED_EXPORT IValidator : public QObject {
    2628    Q_OBJECT
    2729
  • lib/datatypes/src/interfaces/persistence/iaccountlistmanager.h

    r217 r218  
    2424#include <QString>
    2525
     26#include "datatypes_global.h"
     27
    2628class IAccount;
    2729class AbstractAccount;
     
    2931class EException;
    3032
    31 class IAccountListManager {
     33class DATATYPES_SHARED_EXPORT IAccountListManager {
    3234public:
    3335    virtual IAccount*       getAccount(const QString& name, bool skeletonOnly, SDummyAccount* dummy) =0;
  • lib/datatypes/src/interfaces/persistence/iaccountstoragemanager.h

    r217 r218  
    2424#include <QString>
    2525
     26#include "datatypes_global.h"
     27
    2628class IAccount;
    2729class SDummyAccount;
    2830class EException;
    2931
    30 class IAccountStorageManager {
     32class DATATYPES_SHARED_EXPORT IAccountStorageManager {
    3133public:
    3234    virtual IAccount*       getAccount(const QString& name) =0;
  • lib/datatypes/src/interfaces/persistence/icontactstoragemanager.h

    r217 r218  
    2121#include <QSet>
    2222
     23#include "datatypes_global.h"
     24
    2325class SContact;
    2426
    25 class IContactStorageManager {
     27class DATATYPES_SHARED_EXPORT IContactStorageManager {
    2628public:
    2729    virtual SContact       getContact(int contactId) =0;
  • lib/datatypes/src/interfaces/persistence/igroupstoragemanager.h

    r217 r218  
    2121#include <QSet>
    2222
     23#include "datatypes_global.h"
     24
    2325class SGroup;
    2426
    25 class IGroupStorageManager {
     27class DATATYPES_SHARED_EXPORT IGroupStorageManager {
    2628public:
    2729    virtual SGroup       getGroup(int groupId) =0;
  • lib/datatypes/src/interfaces/persistence/isettings.h

    r217 r218  
    2525#include <QString>
    2626
    27 class ISettings {
     27#include "datatypes_global.h"
     28
     29class DATATYPES_SHARED_EXPORT ISettings {
    2830public:
    2931    virtual QLocale getLocale() =0;
  • lib/datatypes/src/interfaces/persistence/istorage.h

    r217 r218  
    2828#include <QVariant>
    2929
     30#include "datatypes_global.h"
     31
    3032class SContact;
    3133class SGroup;
    3234
    33 class IStorage : public QObject {
     35class DATATYPES_SHARED_EXPORT IStorage : public QObject {
    3436    Q_OBJECT
    3537
  • lib/datatypes/src/interfaces/persistence/istorageofficer.h

    r217 r218  
    2222#include <QString>
    2323
     24#include "datatypes_global.h"
     25
    2426class IStorage;
    2527
    26 class IStorageOfficer : public QObject {
     28class DATATYPES_SHARED_EXPORT IStorageOfficer : public QObject {
    2729    Q_OBJECT
    2830
  • lib/datatypes/src/interfaces/ui/iaccountsettingswidget.h

    r217 r218  
    2121#include <QWidget>
    2222
     23#include "datatypes_global.h"
     24
    2325class IAccount;
    2426
    25 class IAccountSettingsWidget: public QWidget {
     27class DATATYPES_SHARED_EXPORT IAccountSettingsWidget: public QWidget {
    2628    Q_OBJECT
    2729
  • lib/datatypes/src/interfaces/ui/iclosepreventabledialog.h

    r217 r218  
    2222#include <QDialog>
    2323
    24 class IClosePreventableDialog : public QDialog {
     24#include "datatypes_global.h"
     25
     26class DATATYPES_SHARED_EXPORT IClosePreventableDialog : public QDialog {
    2527    Q_OBJECT
    2628
  • lib/datatypes/src/interfaces/ui/isendingdialog.h

    r217 r218  
    2424class ISMSSendTask;
    2525
    26 class ISendingDialog: public IClosePreventableDialog {
     26class DATATYPES_SHARED_EXPORT ISendingDialog: public IClosePreventableDialog {
    2727    Q_OBJECT
    2828    Q_INTERFACES(IClosePreventableDialog)
  • lib/datatypes/src/managers/staskmanager.cpp

    r217 r218  
    1616 along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717 */
    18 
    1918#include "staskmanager.h"
    2019
     
    3231    //connect(this, SIGNAL(taskEnqueued(STask*)), this, SLOT(startTasks()), Qt::DirectConnection); // We want to run the task in the same context as the callers
    3332}
     33STaskManager::~STaskManager() {
     34    QMutexLocker locker(&tasksMutex_);
     35
     36    foreach (STask* task, taskQueue_) {
     37        task->deleteLater();
     38    }
     39    taskQueue_.clear();
     40
     41    foreach (STask* task, runningTasks_) {
     42        disconnect(task, 0, this, 0);
     43        connect(task, SIGNAL(finished(STask*)), task, SLOT(deleteLater()));
     44    }
     45    runningTasks_.clear();
     46}
    3447
    3548/**
     
    4457
    4558    if (!taskQueue_.contains(task) && !runningTasks_.contains(task)) {
    46         task->setParent(this);
    4759        taskQueue_.append(task);
    4860
  • lib/datatypes/src/managers/staskmanager.h

    r217 r218  
    2727#include "stask.h"
    2828
    29 class STaskManager : public QObject {
     29class DATATYPES_SHARED_EXPORT STaskManager : public QObject {
    3030    Q_OBJECT
    3131    S_SINGLETON(STaskManager)
     32
     33public:
     34    ~STaskManager();
    3235
    3336public:
     
    5659private:
    5760    mutable QMutex tasksMutex_;
    58     QList<STask*>   taskQueue_;
    59     QList<STask*>   runningTasks_;
     61    QList<STask*>  taskQueue_;
     62    QList<STask*>  runningTasks_;
    6063};
    6164
  • lib/datatypes/src/scontact.h

    r217 r218  
    2323#include <QStringList>
    2424
     25#include "datatypes_global.h"
     26
    2527#include "smacros.h"
    2628#include "sshared.h"
     
    2931class SNumber;
    3032
    31 class SContact {
     33class DATATYPES_SHARED_EXPORT SContact {
    3234    S_SHARED(SContact, public)
    3335    S_QHASH_FRIEND(SContact)
  • lib/datatypes/src/sdatatypes.h

    r217 r218  
    2121#include <QObject>
    2222
     23#include "datatypes_global.h"
     24
    2325namespace Account {
    24     class Action {
     26    class DATATYPES_SHARED_EXPORT Action {
    2527    public:
    2628        static const QString Sleeping;
     
    7981
    8082
    81 class IDialogWrapper : public QObject {
     83class DATATYPES_SHARED_EXPORT IDialogWrapper : public QObject {
    8284    Q_OBJECT
    8385
  • lib/datatypes/src/sdummyaccount.h

    r217 r218  
    2222#include "abstract/abstractgateway.h"
    2323
    24 class SDummyGateway : public AbstractGateway {
     24class DATATYPES_SHARED_EXPORT SDummyGateway : public AbstractGateway {
    2525public:
    2626    explicit SDummyGateway(QObject* parent, const QString& name);
     
    4949};
    5050
    51 class SErrorGateway: public SDummyGateway {
     51class DATATYPES_SHARED_EXPORT SErrorGateway: public SDummyGateway {
    5252public:
    5353    explicit SErrorGateway(QObject* parent, const QString& error);
     
    5858
    5959
    60 class SDummyAccount: public AbstractAccount {
     60class DATATYPES_SHARED_EXPORT SDummyAccount: public AbstractAccount {
    6161    Q_OBJECT
    6262
     
    9191#include "abstract/persistence/abstractaccountstorageofficer.h"
    9292
    93 class SDummyStorageOfficer: public AbstractAccountStorageOfficer {
     93class DATATYPES_SHARED_EXPORT SDummyStorageOfficer: public AbstractAccountStorageOfficer {
    9494    Q_OBJECT
    9595
     
    106106#include "ui/iaccountsettingswidget.h"
    107107
    108 class SDummyAccountSettingsWidget: public IAccountSettingsWidget {
     108class DATATYPES_SHARED_EXPORT SDummyAccountSettingsWidget: public IAccountSettingsWidget {
    109109    Q_OBJECT
    110110    Q_INTERFACES(IAccountSettingsWidget)
  • lib/datatypes/src/sgroup.h

    r217 r218  
    2424#include <QString>
    2525
     26#include "datatypes_global.h"
     27
    2628#include "smacros.h"
    2729#include "sshared.h"
     
    3032class SGroupData;
    3133
    32 class SGroup {
     34class DATATYPES_SHARED_EXPORT SGroup {
    3335    S_SHARED(SGroup, public)
    3436    S_QHASH_FRIEND(SGroup)
  • lib/datatypes/src/snetworkhelper.cpp

    r217 r218  
    1616 along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1717 */
    18 
    1918#include "snetworkhelper.h"
    2019
     
    3029const uint SNetworkHelper::MAX_REDIRECT_COUNT = 10;
    3130
    32 QNetworkAccessManager *SNetworkHelper::networkAccessManager() const {
    33     return networkAccessManager_;
    34 }
    35 
    36 SNetworkHelper::SNetworkHelper(QObject* parent, QNetworkAccessManager* forcedNetworkAccessManager)
     31SNetworkHelper::SNetworkHelper(QObject *parent)
    3732    : QObject(parent)
    3833    , MULTIPART_BOUNDARY("---------------------------11677076429873974811095575830")
     34    , sharedCookieJar_(new QNetworkCookieJar(this))
    3935{
    40     if (forcedNetworkAccessManager) {
    41         networkAccessManager_ = forcedNetworkAccessManager;
    42     } else {
    43         networkAccessManager_ = new QNetworkAccessManager(this);
    44 
    45         qRegisterMetaType<QList<QSslError> >("QList<QSslError>");
    46     }
    47     connect(networkAccessManager_, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
    48             this, SLOT(onSslErrors(QNetworkReply*, const QList<QSslError>&)));
    49 
     36    qRegisterMetaType<QList<QSslError> >("QList<QSslError>");
    5037
    5138    initDefaultSSLConfiguration();
     39}
     40
     41
     42QMap<QThread *, QNetworkAccessManager *> SNetworkHelper::networkAccessManager_ = QMap<QThread *, QNetworkAccessManager *>();
     43/**
     44 * QNetworkAccessManager can not be accessed from different threads simultaneous. Therefore we create an own instance
     45 * for each thread and share the cookie jar.
     46 */
     47QNetworkAccessManager &SNetworkHelper::networkAccessManager() {
     48    if (!networkAccessManager_.contains(QThread::currentThread())) {
     49        QNetworkAccessManager* nam = new QNetworkAccessManager(this);
     50        nam->setCookieJar(sharedCookieJar_);
     51        sharedCookieJar_->setParent(this); // setCookieJar takes ownership
     52
     53        connect(QThread::currentThread(), SIGNAL(terminated()), this, SLOT(onThreadTerminated()), Qt::DirectConnection);
     54        networkAccessManager_.insert(QThread::currentThread(), nam);
     55
     56        connect(nam, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
     57                this, SLOT(onSslErrors(QNetworkReply*, const QList<QSslError>&)));
     58    }
     59    return *networkAccessManager_.value(QThread::currentThread());
     60}
     61void SNetworkHelper::onThreadTerminated() {
     62    networkAccessManager_.take(QThread::currentThread())->deleteLater();
    5263}
    5364
     
    116127 */
    117128SNetworkReply SNetworkHelper::asyncGet(QNetworkRequest& request) {
    118     lastUrl_.insert(QThread::currentThread(), request.url());
    119 
    120     SNetworkReply reply(networkAccessManager()->get(request));
     129    lastUrl_.insert(&networkAccessManager(), request.url());
     130
     131    SNetworkReply reply(networkAccessManager().get(request));
    121132    return reply;
    122133}
     
    176187 */
    177188SNetworkReply SNetworkHelper::asyncPost(QNetworkRequest& request, QList<IParam*>& posts, SNetworkHelper::PostType postType) {
    178     lastUrl_.insert(QThread::currentThread(), request.url());
     189    lastUrl_.insert(&networkAccessManager(), request.url());
    179190
    180191    // Set the content type header
     
    206217
    207218    // Post the request
    208     SNetworkReply reply(networkAccessManager()->post(request, postData));
     219    SNetworkReply reply(networkAccessManager().post(request, postData));
    209220    return reply;
    210221}
     
    272283}
    273284QUrl SNetworkHelper::lastUrl() {
    274     return lastUrl_.value(QThread::currentThread());
     285    return lastUrl_.value(&networkAccessManager());
    275286}
    276287
     
    349360
    350361void SNetworkHelper::clearCookies() {
    351     networkAccessManager()->setCookieJar(new QNetworkCookieJar(networkAccessManager()));
     362    networkAccessManager().setCookieJar(new QNetworkCookieJar);
    352363}
    353364
  • lib/datatypes/src/snetworkhelper.h

    r217 r218  
    3131#include <QUrl>
    3232
     33#include "datatypes_global.h"
     34
    3335#include "sshared.h"
    3436
     
    3840class SNetworkReply;
    3941
    40 class SNetworkHelper : public QObject {
     42class DATATYPES_SHARED_EXPORT SNetworkHelper : public QObject {
    4143    Q_OBJECT
    4244
     
    5557
    5658public:
    57     explicit SNetworkHelper(QObject* parent, QNetworkAccessManager* forcedNetworkAccessManager = NULL);
     59    SNetworkHelper(QObject *parent);
    5860
    59     QNetworkAccessManager *networkAccessManager() const;
     61    QNetworkAccessManager &networkAccessManager();
    6062
    6163    SNetworkReply          syncGet(const QUrl& destination, SNetworkHelper::RedirectHandling redirectHandling = SNetworkHelper::rhHandleRedirects);
     
    103105
    104106private slots:
     107    void onThreadTerminated();
    105108    void onSslErrors(QNetworkReply* reply, const QList<QSslError>& errors);
    106109
     
    108111    const QString MULTIPART_BOUNDARY;
    109112
    110     QNetworkAccessManager* networkAccessManager_;
    111     QMap<QThread*, QUrl>   lastUrl_;
     113    QNetworkCookieJar *                             sharedCookieJar_;
     114    static QMap<QThread *, QNetworkAccessManager *> networkAccessManager_;
     115    QMap<QNetworkAccessManager *, QUrl>             lastUrl_;
    112116
    113117    HeadersMap        defaultHeaders_;
     
    118122
    119123
    120 class IParam {
     124class DATATYPES_SHARED_EXPORT IParam {
    121125public:
    122126    virtual QByteArray encode(SNetworkHelper::PostType postType) const =0;
     
    128132
    129133
    130 class SKeyValueParam : public IParam {
     134class DATATYPES_SHARED_EXPORT SKeyValueParam : public IParam {
    131135    Q_INTERFACES(IParam)
    132136
     
    147151
    148152
    149 class SFileParam : public SKeyValueParam {
     153class DATATYPES_SHARED_EXPORT SFileParam : public SKeyValueParam {
    150154public:
    151155    SFileParam(const QByteArray& key, const QByteArray& fileName, const QByteArray& fileType, const QByteArray& value);
  • lib/datatypes/src/snetworkreply.h

    r217 r218  
    2323#include <QSharedData>
    2424
     25#include "datatypes_global.h"
     26
    2527#include "smacros.h"
    2628#include "sshared.h"
     
    3032class SNetworkReplyData;
    3133
    32 class SNetworkReply {
     34class DATATYPES_SHARED_EXPORT SNetworkReply {
    3335    S_SHARED(SNetworkReply, public)
    3436    S_QHASH_FRIEND(SNetworkReply)
  • lib/datatypes/src/snumber.h

    r217 r218  
    2222#include <QString>
    2323
     24#include "datatypes_global.h"
     25
    2426#include "sdatatypes.h"
    2527#include "smacros.h"
     
    2830class SNumberData;
    2931
    30 class SNumber {
     32class DATATYPES_SHARED_EXPORT SNumber {
    3133    S_SHARED(SNumber, public)
    3234    S_QHASH_FRIEND(SNumber)
  • lib/datatypes/src/sshared.h

    r217 r218  
    2525#include <QtGlobal>
    2626
    27 class SShareable : public QObject, public QSharedData {
     27#include "datatypes_global.h"
     28
     29class DATATYPES_SHARED_EXPORT SShareable : public QObject, public QSharedData {
    2830protected:
    2931    SShareable() {}
  • lib/datatypes/src/stask.cpp

    r217 r218  
    9797void STask::startSubTask(STask* subTask, bool waitFor) {
    9898    subTasks_.append(subTask);
    99     connect(subTask, SIGNAL(finished(STask::Result, uint)), this, SLOT(onSubTaskFinished(STask::Result, uint)), Qt::QueuedConnection);
    100     connect(subTask, SIGNAL(exceptionOccured(const EException&)), this, SLOT(onSubTaskExceptionOccured(const EException&)), Qt::DirectConnection);
     99    connect(subTask, SIGNAL(finished(STask*)), this, SLOT(onSubTaskFinished(STask*)), Qt::QueuedConnection);
     100    connect(subTask, SIGNAL(exceptionOccured(STask*)), this, SLOT(onSubTaskExceptionOccured(STask*)), Qt::DirectConnection);
    101101
    102102    subTask->setParentTask(this);
     
    580580
    581581void SThreadedTask::doStart() {
    582     QObject *parentBak = parent();
    583     setParent(NULL);
    584582    moveToThread(thread_);
    585     setParent(parentBak);
    586583    Q_ASSERT(thread() == thread_);
    587584
  • lib/datatypes/src/stask.h

    r217 r218  
    2525#include <QThread>
    2626#include <QWaitCondition>
     27
     28#include "datatypes_global.h"
    2729
    2830#include "exceptions/eexception.h"
     
    3537inline bool operator<(const SUIdNamespaceIdent& a, const SUIdNamespaceIdent& b) { return (a.nmespace + QString::number(a.uid)) < (b.nmespace + QString::number(b.uid)); }
    3638
    37 class STask : public QObject {
     39class DATATYPES_SHARED_EXPORT STask : public QObject {
    3840    Q_OBJECT
    3941
     
    197199
    198200
    199 class SThreadedTask : public STask {
     201class DATATYPES_SHARED_EXPORT SThreadedTask : public STask {
    200202    Q_OBJECT
    201203
     
    215217
    216218
    217 class SAsynchroneousTask : public STask {
     219class DATATYPES_SHARED_EXPORT SAsynchroneousTask : public STask {
    218220    Q_OBJECT
    219221
  • lib/datatypes/src/stask_predefined.h

    r217 r218  
    2222#include "abstract/abstractaccount_tasks.h"
    2323
    24 class SDefaultLoginInitTask : public AbstractAccountInitTask {
     24class DATATYPES_SHARED_EXPORT SDefaultLoginInitTask : public AbstractAccountInitTask {
    2525    Q_OBJECT
    2626
  • lib/datatypes/src/sversion.h

    r217 r218  
    2121#include <QString>
    2222
    23 class SVersion {
     23#include "datatypes_global.h"
     24
     25class DATATYPES_SHARED_EXPORT SVersion {
    2426public:
    2527    SVersion(short major, short minor, short release, short build)
  • lib/datatypes/src/validation/sstdaccountvalidator.h

    r217 r218  
    2222#include "ivalidator.h"
    2323
    24 class SStdAccountValidator : public IValidator {
     24class DATATYPES_SHARED_EXPORT SStdAccountValidator : public IValidator {
    2525    Q_OBJECT
    2626    Q_INTERFACES(IValidator)
  • lib/datatypes/src/validation/svalidationresult.h

    r194 r218  
    2222#include <QStringList>
    2323
    24 class SValidationResult {
     24#include "datatypes_global.h"
     25
     26class DATATYPES_SHARED_EXPORT SValidationResult {
    2527public:
    2628    enum ValidationType {
  • src/business/bclibraryloader.cpp

    r217 r218  
    6666
    6767        QLibrary library;
    68         //DEBUG ONLY!library.setLoadHints(QLibrary::ResolveAllSymbolsHint);
     68        //library.setLoadHints(QLibrary::ResolveAllSymbolsHint);
    6969        library.setFileName(filename);
    7070
Note: See TracChangeset for help on using the changeset viewer.