summaryrefslogtreecommitdiffstats
path: root/kshowmail/kcmconfigs/mailboxwizard.h
blob: a75d8be86a7435d1a93b1b2f1be2d9f0d03b3d84 (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
//
// C++ Interface: mailboxwizard
//
// Description:
//
//
// Author: Ulrich Weigelt <ulrich.weigelt@gmx.de>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MAILBOXWIZARD_H
#define MAILBOXWIZARD_H

//C-headers
#include <stdlib.h>

//TQt headers
#include <tqwizard.h>
#include <tqwidget.h>
#include <tqlayout.h>
#include <tqdir.h>
#include <tqregexp.h>
#include <tqfileinfo.h>
#include <tqmap.h>

//KDE headers
#include <tdelocale.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <tdefiledialog.h>
#include <tdelistview.h>
#include <kstandarddirs.h>
#include <tdeconfig.h>
#include <kdebug.h>

//Kshowmail headers
#include "../constants.h"
#include "mailboxwizardlistitem.h"

/**
 * Wizard to configure the mailbox to which a filteres mail shall be moved.
 * @author Ulrich Weigelt <ulrich.weigelt@gmx.de>
 */
class MailBoxWizard : public TQWizard
{

  Q_OBJECT

  public:

    /**
     * Constructor
     */
    MailBoxWizard( TQWidget* parent = 0, const char* name = 0 );

    /**
     * Destructor
     */
    ~MailBoxWizard();

    /**
     * Returns the absolute path of the selected mailbox.
     * @return the path
     */
    TQString getPath();

  private:

    /**
     * This contains the path to the mail directory
     */
    KLineEdit* txtMailDir;

    /**
     * This button opens a file dialog to slecht the mail directory
     */
    KPushButton* btnMailDir;

    /**
     * This view shows the available mailboxes in the selected directory
     */
    TDEListView* lstMailboxes;

    /**
     * Title of page 1.
     * Set by constructor
     */
    TQString title1;

    /**
     * Title of page 2.
     * Set by Constructor.
     */
    TQString title2;

    /**
     * Returns whether the given directory is a maildir directory
     * @param path the directory for test
     * @return TRUE - directory is a maildir directory
     */
    bool isMailDir( const TQDir& path );

    /**
     * Adds a new mailbox list view item to the mailbox list or to a given parent item.
     * @param boxname name of the mailbox
     * @param path path to the directory of this mailbox
     */
    void addMailBoxListItem( TQString boxname, TQDir path );



  private slots:

    /**
     * Connected with btnMailDir.
     * Opens a file dialog to choose the mail directory.
     */
    void slotOpenDirDialog();

    /**
     * Connected with the signal selected of this wizard.
     * Searchs for mailboxes inside the path typed in page1.
     * @param pageTitle title of the selected page
     */
    void slotPageChanged( const TQString& pageTitle );


};

#endif