summaryrefslogtreecommitdiffstats
path: root/kmail/accountwizard.h
blob: 0b30ca801557aebee0ff115e07c8da801dbd25cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*******************************************************************************
**
** Filename   : accountwizard.h
** Created on : 07 February, 2005
** Copyright  : (c) 2005 Tobias Koenig
** Email      : [email protected]
**
*******************************************************************************/

/*******************************************************************************
**
**   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.
**
**   In addition, as a special exception, the copyright holders give
**   permission to link the code of this program with any edition of
**   the TQt library by Trolltech AS, Norway (or with modified versions
**   of TQt that use the same license as TQt), and distribute linked
**   combinations including the two.  You must obey the GNU General
**   Public License in all respects for all of the code used other than
**   TQt.  If you modify this file, you may extend this exception to
**   your version of the file, but you are not obligated to do so.  If
**   you do not wish to do so, delete this exception statement from
**   your version.
*******************************************************************************/

#ifndef KMWIZARD_H
#define KMWIZARD_H

#include <kwizard.h>

class KLineEdit;
class TQCheckBox;
class TQLabel;
class TQPushButton;

class KMAccount;
class KMKernel;
class KMServerTest;
class AccountTypeBox;
class KMTransportInfo;

class AccountWizard : public KWizard
{
  TQ_OBJECT
  

  public:
    /**
      Starts the wizard. The wizard is only shown when it has not be
      run successfully before.

      @param kernel The mail kernel the wizard should work on.
      @param parent The parent widget of the dialog.
     */
    static void start( KMKernel *kernel, TQWidget *parent = 0 );

    /**
      Reimplemented
     */
    void showPage( TQWidget *page );

  protected:
    AccountWizard( KMKernel *kernel, TQWidget *parent );
    ~AccountWizard() {};

    void setupWelcomePage();
    void setupAccountTypePage();
    void setupAccountInformationPage();
    void setupLoginInformationPage();
    void setupServerInformationPage();

  protected slots:
    void chooseLocation();
    virtual void accept();
    void createTransport();
    void transportCreated();
    void createAccount();
    void accountCreated();
    void finished();

  private slots:
    void popCapabilities( const TQStringList&, const TQStringList& );
    void imapCapabilities( const TQStringList&, const TQStringList& );
    void smtpCapabilities( const TQStringList&, const TQStringList&,
                           const TQString&, const TQString&, const TQString& );

  private:
    TQString accountName() const;
    TQLabel *createInfoLabel( const TQString &msg );

    void checkPopCapabilities( const TQString&, int );
    void checkImapCapabilities( const TQString&, int );
    void checkSmtpCapabilities( const TQString&, int );
    uint popCapabilitiesFromStringList( const TQStringList& );
    uint imapCapabilitiesFromStringList( const TQStringList& );
    uint authMethodsFromString( const TQString& );
    uint authMethodsFromStringList( const TQStringList& );

    TQWidget *mWelcomePage;

    TQWidget *mAccountTypePage;
    AccountTypeBox *mTypeBox;

    TQWidget *mAccountInformationPage;
    KLineEdit *mRealName;
    KLineEdit *mEMailAddress;
    KLineEdit *mOrganization;

    TQWidget *mLoginInformationPage;
    KLineEdit *mLoginName;
    KLineEdit *mPassword;

    TQWidget *mServerInformationPage;
    TQLabel *mIncomingLabel;
    KLineEdit *mIncomingServer;
    TQCheckBox *mIncomingUseSSL;
    KLineEdit *mIncomingLocation;

    TQPushButton *mChooseLocation;
    KLineEdit *mOutgoingServer;
    TQCheckBox *mOutgoingUseSSL;
    TQCheckBox *mLocalDelivery;

    TQWidget *mIncomingServerWdg;
    TQWidget *mIncomingLocationWdg;

    TQLabel *mAuthInfoLabel;

    KMKernel *mKernel;
    KMAccount *mAccount;
    KMTransportInfo *mTransportInfo;
    TQPtrList<KMTransportInfo> mTransportInfoList;
    KMServerTest *mServerTest;
};

#endif