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
|
/*
* Copyright (C) Kurt Granroth
* Copyright (C) 2004, Mart Kelder ([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.
*
* 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
*/
/*
* tdeio.h -- Declaration of class KKIODrop.
*/
#ifndef KEG_TDEIODROP_H
#define KEG_TDEIODROP_H
#include "polldrop.h"
class TQWidget;
class KDropDialog;
class KornMailSubject;
class TDEProcess;
class TDEIO_Count;
class TDEIO_Protocol;
class TDEIO_Subjects;
class TDEIO_Read;
class TDEIO_Delete;
class TDEConfigGroup;
class KURL;
template<class> class TQPtrList;
template<class> class TQValueList;
namespace TDEIO { class Job; class MetaData; class Slave; class TransferJob; }
/**
* Polling monitor for IMAP4 maildrops.
* @author Kurt Granroth ([email protected])
* Changes to poll with TDEIO
* @author Mart Kelder ([email protected])
* $version $Id$
*/
class KKioDrop : public KPollableDrop
{
Q_OBJECT
private:
KURL *_kurl;
TDEIO::MetaData *_metadata;
TQString _password;
bool _valid;
const TDEIO_Protocol * _protocol;
bool _ssl;
TDEIO_Count *_count;
TDEIO_Subjects *_subjects;
TDEIO_Read *_read;
TDEIO_Delete *_delete;
int _readSubjectsTotalSteps;
int _deleteMailsTotalSteps;
//For process
TDEProcess *_process;
//List of mailurls fetched by the last time emails were counted
struct FileInfo {
TQString name;
long size;
};
TQValueList<FileInfo> *_mailurls;
/*
* The help-classes of this functions are friend functions, because this way, they can
* access the _kurl and _metadata-values without a function; and this way, no signal or
* public functions are neccesairy to emit a signal from KKioDrop.
*/
friend class TDEIO_Count;
friend class TDEIO_Subjects;
friend class TDEIO_Read;
friend class TDEIO_Delete;
friend class TDEIO_Single_Subjects;
public:
static const char *ProtoConfigKey;
static const char *HostConfigKey;
static const char *PortConfigKey;
static const char *UserConfigKey;
static const char *MailboxConfigKey;
static const char *PassConfigKey;
static const char *SavePassConfigKey;
static const char *MetadataConfigKey;
public:
/**
* KKioDrop Constructor
*/
KKioDrop();
KKioDrop( TDEConfigGroup* );
/**
* Set the server that will be checked for new mail.
*/
void setKioServer( const TQString & proto, const TQString & server, int port = -1 );
void setKioServer( const TQString & proto, const TQString & server, int port,
const TDEIO::MetaData metadata, bool ssl, bool setProtocol = true ); //Last argument inits _protocol
/** Set the account information for the PROTO server. */
void setUser( const TQString & user, const TQString & password, const TQString & mailbox, const TQString & auth );
// The next functions return settings
TQString protocol() const;
TQString server() const;
int port() const;
TQString user() const;
TQString password() const;
TQString mailbox() const;
TQString auth() const;
virtual void recheck();
virtual void forceRecheck();
virtual bool valid();
/**
* KKioDrop Destructor
*/
virtual ~KKioDrop();
virtual bool canReadSubjects(void);
virtual TQValueVector<KornMailSubject> * doReadSubjects(bool * stop);
virtual bool canDeleteMails();
virtual bool deleteMails(TQPtrList<const KornMailId> * ids, bool * stop);
virtual bool canReadMail ();
virtual TQString readMail(const KornMailId * id, bool * stop);
virtual KMailDrop* clone () const ;
virtual bool readConfigGroup ( const TQMap< TQString, TQString >& map, const Protocol * protocol );
virtual bool writeConfigGroup ( TDEConfigBase& cfg ) const;
virtual TQString type() const { return TQString::fromUtf8("tdeio"); }
virtual bool synchrone() const { return false; } //class is not synchrone
//virtual void addConfigPage( KDropCfgDialog * );
virtual bool asynchrone() const { return true; }
private:
KKioDrop& operator = ( const KKioDrop& );
//static void encrypt( TQString& str );
//static void decrypt( TQString& str );
/*
* The next functions are called from the help-classes (which are friend of the class).
* The only thing this functions do is emitting signals.
*/
void emitRechecked() { emit rechecked(); }
void emitChanged( int value ) { emit changed( value, this ); }
void emitReadSubjectsReady( bool success ) { emit readSubjectsReady( success ); }
void emitReadSubjectsRead( KornMailSubject * subject ) { emit readSubject( subject ); }
void emitReadSubjectsTotalSteps( int value ) { _readSubjectsTotalSteps = value; emit readSubjectsTotalSteps( value ); }
void emitReadSubjectsProgress( int value ) { emit readSubjectsProgress( _readSubjectsTotalSteps - value ); }
void emitReadMailReady( TQString* msg ) { emit readMailReady( msg ); }
void emitDeleteMailsReady( bool value ) { emit deleteMailsReady( value ); }
void emitDeleteMailsTotalSteps( int value ) { _deleteMailsTotalSteps = value; emit deleteMailsTotalSteps( value ); }
void emitDeleteMailsProgress( int value ) { emit deleteMailsProgress( _deleteMailsTotalSteps - value ); }
void emitShowPassivePopup( TQPtrList< KornMailSubject > *subject, int total )
{ emit showPassivePopup( subject, total, passiveDate(), this->realName() ); }
void emitShowPassivePopup( const TQString& error )
{ if( passivePopup() ) { emit showPassivePopup( error, this->realName() ); } }
void emitValidChanged() { emit validChanged( valid() ); }
private slots:
void slotConnectionError( int, const TQString& );
void slotConnectionWarning( const TQString& );
void slotConnectionInfoMessage( const TQString& );
protected:
//The next functions are needed for Process;
virtual bool startProcess();
virtual bool stopProcess();
public slots:
virtual void readSubjectsCanceled();
virtual void readMailCanceled();
virtual void deleteMailsCanceled();
private slots:
//For Process too
void processExit(TDEProcess*);
void receivedStdout( TDEProcess *, char *, int);
};
#endif // KEG_TDEIODROP_H
|