setupserver.h 3.24 KB
Newer Older
1
/* This file is part of the KDE project
2
   Copyright (C) 2010 Casey Link <unnamedrambler@gmail.com>
Laurent Montel's avatar
Laurent Montel committed
3
   Copyright (c) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
4
   Copyright (C) 2009 Kevin Ottens <ervin@kde.org>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
   Copyright (C) 2006-2008 Omat Holding B.V. <info@omat.nl>
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program 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
   General Public License for more details.

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

#ifndef SETUPSERVER_H
#define SETUPSERVER_H

#include <klineedit.h>
Laurent Montel's avatar
Laurent Montel committed
25
#include <QDialog>
26
#include <collection.h>
27
#include <KJob>
28

29
#include <QRegExpValidator>
Laurent Montel's avatar
Laurent Montel committed
30
class QPushButton;
31
class QComboBox;
32
33
34
35
36
37
38
39
40
namespace Ui
{
class SetupServerView;
}

namespace MailTransport
{
class ServerTest;
}
Laurent Montel's avatar
Laurent Montel committed
41
namespace KIdentityManagement
42
43
44
45
{
class IdentityCombo;
class IdentityManager;
}
Laurent Montel's avatar
Laurent Montel committed
46
class FolderArchiveSettingPage;
47
class ImapResourceBase;
48

49
50
51
52
53
/**
 * @class SetupServer
 * These contain the account settings
 * @author Tom Albers <tomalbers@kde.nl>
 */
Laurent Montel's avatar
Laurent Montel committed
54
class SetupServer : public QDialog
55
{
Laurent Montel's avatar
Laurent Montel committed
56
    Q_OBJECT
57
58

public:
Laurent Montel's avatar
Laurent Montel committed
59
60
61
62
63
64
    /**
     * Constructor
     * @param parentResource The resource this dialog belongs to
     * @param parent Parent WId
     */
    SetupServer(ImapResourceBase *parentResource, WId parent);
65

Laurent Montel's avatar
Laurent Montel committed
66
67
68
69
    /**
     * Destructor
     */
    ~SetupServer();
70

Laurent Montel's avatar
Laurent Montel committed
71
    bool shouldClearCache() const;
72

Laurent Montel's avatar
Laurent Montel committed
73
private Q_SLOTS:
Laurent Montel's avatar
Laurent Montel committed
74
75
76
77
78
79
80
81
82
    /**
     * Call this if you want the settings saved from this page.
     */
    void applySettings();
    void slotIdentityCheckboxChanged();
    void slotMailCheckboxChanged();
    void slotEncryptionRadioChanged();
    void slotSubcriptionCheckboxChanged();
    void slotShowServerInfo();
83
private:
Laurent Montel's avatar
Laurent Montel committed
84
85
    void readSettings();
    void populateDefaultAuthenticationOptions();
86

Laurent Montel's avatar
Laurent Montel committed
87
88
89
90
91
92
93
94
95
96
97
98
99
    ImapResourceBase *m_parentResource;
    Ui::SetupServerView *m_ui;
    MailTransport::ServerTest *m_serverTest;
    bool m_subscriptionsChanged;
    bool m_shouldClearCache;
    QString m_vacationFileName;
    KIdentityManagement::IdentityManager *m_identityManager;
    KIdentityManagement::IdentityCombo *m_identityCombobox;
    QString m_oldResourceName;
    QRegExpValidator mValidator;
    Akonadi::Collection mOldTrash;
    FolderArchiveSettingPage *m_folderArchiveSettingPage;
    QPushButton *mOkButton;
100

Laurent Montel's avatar
Laurent Montel committed
101
private Q_SLOTS:
Laurent Montel's avatar
Laurent Montel committed
102
    void slotTest();
103
    void slotFinished(const QVector<int> &testResult);
Laurent Montel's avatar
Laurent Montel committed
104
    void slotCustomSieveChanged();
Laurent Montel's avatar
Laurent Montel committed
105

106
    void slotServerChanged();
Laurent Montel's avatar
Laurent Montel committed
107
108
109
110
111
112
113
    void slotTestChanged();
    void slotComplete();
    void slotSafetyChanged();
    void slotManageSubscriptions();
    void slotEnableWidgets();
    void targetCollectionReceived(const Akonadi::Collection::List &collections);
    void localFolderRequestJobFinished(KJob *job);
114
    void populateDefaultAuthenticationOptions(QComboBox *combo);
115
116
117
};

#endif