summaryrefslogtreecommitdiffabout
path: root/kmicromail/accountitem.h
blob: 4c92bfc90522e78cce999dad0758e33644106ca6 (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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#ifndef __ACCOUNT_ITEM
#define __ACCOUNT_ITEM


#include <qlistview.h>
#include <qlist.h>
#include <opie2/osmartpointer.h>
#include <libmailwrapper/mailwrapper.h>

class POP3wrapper;
class RecMail;
class RecBody;
class QPopupMenu;
class Selectstore;
class AccountView;
class POP3account;
class NNTPaccount;
class IMAPaccount;
class AbstractMail;
class Folder;

#define RECBODYP Opie::Core::OSmartPointer<RecBody>

class AccountViewItem : public QListViewItem
{

public:
    AccountViewItem( AccountView *parent );
    AccountViewItem( QListViewItem *parent);
    AccountViewItem( QListViewItem *parent , QListViewItem*after  );
    AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after  );

    virtual ~AccountViewItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0;
    virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0;
    virtual QPopupMenu * getContextMenu(){return 0;};
    virtual void contextMenuSelected(int){}
    virtual AccountView*accountView();
    virtual bool matchName(const QString&name)const;
    virtual bool isDraftfolder();
    Opie::Core::OSmartPointer<Folder> getFolder() { return folder; };

protected:
    AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0);
    virtual void init();
    virtual void removeChilds();
    virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f);
    static const QString contextName;
    AccountView*m_Backlink;
    Opie::Core::OSmartPointer<Folder> folder;
};

class POP3viewItem : public AccountViewItem
{

public:
    POP3viewItem( POP3account *a, AccountView *parent );
    virtual ~POP3viewItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
    virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
    AbstractMail *getWrapper();
    virtual QPopupMenu * getContextMenu();
    virtual void contextMenuSelected(int);

protected:
    POP3account *account;
    virtual void refresh();
    AbstractMail *wrapper;
    void disconnect();
    void setOnOffline();
};

class POP3folderItem : public AccountViewItem
{

public:
    POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after  );
    virtual ~POP3folderItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
    virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
    virtual QPopupMenu * getContextMenu();
    virtual void contextMenuSelected(int);

protected:
    void downloadMails();
    POP3viewItem *pop3;
};


class NNTPviewItem : public AccountViewItem
{

public:
    NNTPviewItem( NNTPaccount *a, AccountView *parent );
    virtual ~NNTPviewItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
    virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
    AbstractMail *getWrapper();
    virtual QPopupMenu * getContextMenu();
    virtual void contextMenuSelected(int);

protected:
    NNTPaccount *account;
    virtual void refresh();
    AbstractMail *wrapper;
    void disconnect();
    void setOnOffline();
    void subscribeGroups();
};

class NNTPfolderItem : public AccountViewItem
{

public:
    NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after  );
    virtual ~NNTPfolderItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
    virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
    virtual QPopupMenu * getContextMenu();
    virtual void contextMenuSelected(int);

protected:
    void downloadMails();
    NNTPviewItem *nntp;
};



class IMAPviewItem : public AccountViewItem
{
    friend class IMAPfolderItem;
public:
    IMAPviewItem( IMAPaccount *a, AccountView *parent );
    virtual ~IMAPviewItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
    virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
    AbstractMail *getWrapper();
    virtual QPopupMenu * getContextMenu();
    virtual void contextMenuSelected(int);
    const QStringList&subFolders();
    virtual void refreshFolders(bool force=false);
    bool offline();

protected:
    virtual void createNewFolder();
    IMAPaccount *account;
    AbstractMail *wrapper;
    QStringList currentFolders;
};

class IMAPfolderItem : public AccountViewItem
{

public:
    IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after  );
    IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master  );
    virtual ~IMAPfolderItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
    virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
    virtual QPopupMenu * getContextMenu();
    virtual void contextMenuSelected(int);
    virtual const QString& Delemiter()const;
protected:
    virtual void createNewFolder();
    virtual void deleteFolder();
    virtual void downloadMails();
    IMAPviewItem *imap;
};

class MHviewItem : public AccountViewItem
{
    friend class MHfolderItem;

public:
    MHviewItem( const QString&aMboxPath, AccountView *parent );
    virtual ~MHviewItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
    virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
    AbstractMail *getWrapper();
    virtual QPopupMenu * getContextMenu();
    virtual void contextMenuSelected(int);
    QStringList subFolders();
    virtual void refresh(bool force=false);

protected:
    void downloadMails();
    virtual void createFolder();
    QString m_Path;
    AbstractMail *wrapper;
    QStringList currentFolders;
};

class MHfolderItem : public AccountViewItem
{

public:
    MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after  );
    MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
    virtual ~MHfolderItem();
    virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
    virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
    virtual QPopupMenu * getContextMenu();
    virtual void contextMenuSelected(int);
    virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const;
    virtual bool isDraftfolder();

protected:
    void downloadMails();
    virtual void createFolder();
    virtual void deleteFolder();
    void initName();
    MHviewItem *mbox;
};

#endif