settings.h 2.22 KB
Newer Older
1 2
/*
    Copyright (c) 2008 Volker Krause <vkrause@kde.org>
3
    Copyright (c) 2008 Omat Holding B.V. <info@omat.nl>
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

    This library is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published by
    the Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    This library is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
    License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to the
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
*/

#ifndef SETTINGS_H
#define SETTINGS_H

#include "settingsbase.h"

Kevin Ottens's avatar
Kevin Ottens committed
26 27 28 29
#include <kimap/loginjob.h>

#include <mailtransport/transport.h>

30
class ImapAccount;
31
class KJob;
32

33 34
class Settings : public SettingsBase
{
Laurent Montel's avatar
Laurent Montel committed
35 36
    Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", "org.kde.Akonadi.Imap.Wallet")
37
public:
Laurent Montel's avatar
Laurent Montel committed
38
    static KIMAP::LoginJob::AuthenticationMode mapTransportAuthToKimap(MailTransport::Transport::EnumAuthenticationType::type authType);
Kevin Ottens's avatar
Kevin Ottens committed
39

Laurent Montel's avatar
Laurent Montel committed
40 41
    explicit Settings(WId = 0);
    void setWinId(WId);
42

43
    virtual void requestPassword();
44

Laurent Montel's avatar
Laurent Montel committed
45
    virtual void loadAccount(ImapAccount *account) const;
46

Kevin Ottens's avatar
Kevin Ottens committed
47
    QString rootRemoteId() const;
Laurent Montel's avatar
Laurent Montel committed
48
    virtual void renameRootCollection(const QString &newName);
Kevin Ottens's avatar
Kevin Ottens committed
49

50 51
    virtual void clearCachedPassword();
    virtual void cleanup();
52

53 54 55
    virtual QString password(bool *userRejected = nullptr) const;
    virtual QString sieveCustomPassword(bool *userRejected = nullptr) const;

Laurent Montel's avatar
Laurent Montel committed
56
Q_SIGNALS:
Laurent Montel's avatar
Laurent Montel committed
57
    void passwordRequestCompleted(const QString &password, bool userRejected);
58

Laurent Montel's avatar
Laurent Montel committed
59
public Q_SLOTS:
Laurent Montel's avatar
Laurent Montel committed
60 61
    Q_SCRIPTABLE virtual void setPassword(const QString &password);
    Q_SCRIPTABLE virtual void setSieveCustomPassword(const QString &password);
62

Laurent Montel's avatar
Laurent Montel committed
63
protected Q_SLOTS:
Laurent Montel's avatar
Laurent Montel committed
64
    virtual void onWalletOpened(bool success);
65

Laurent Montel's avatar
Laurent Montel committed
66
    void onRootCollectionFetched(KJob *job);
Kevin Ottens's avatar
Kevin Ottens committed
67

68
protected:
69
    WId m_winId;
70
    mutable QString m_password;
71
    mutable QString m_customSievePassword;
72 73 74
};

#endif