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
|
/*
* Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.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 MK_KIO_PROTO_H
#define MK_KIO_PROTO_H
/*
* KIO can handle multiple protocols. But some protocols have their own
* manipulations of KURL or MetaData , and some protocols could do more then other
* protocols. So, this class is the generic class of a class specified
* by a protocol.
*/
class QString;
#include <kio/global.h>
#include <klocale.h>
#include <tqstringlist.h>
#include "protocol.h"
#include "kio.h"
class KIO_Protocol : public Protocol
{
public:
/*
* Constuctor; empty
*/
KIO_Protocol() {}
/*
* Destructor; empty too
*/
virtual ~KIO_Protocol() {}
/*
* Public enumeration
*/
enum DeleteTypeEnum { get, del };
/**
* This are the implementation of the Protocol-functions
*/
virtual const Protocol* getProtocol( KConfigGroup* ) const { return this; }
virtual KMailDrop* createMaildrop( KConfigGroup* config ) const { return new KKioDrop( config ); }
virtual TQMap< TQString, TQString >* createConfig( KConfigGroup *group, const TQString& password ) const;
/*
* @return: the name of the kio_slave
*/
virtual TQString protocol( bool ) const { return "file"; }
/*
* @return: the name of the protocol used by the configuration
*/
virtual TQString configName() const { return "not specified"; }
virtual bool connectionBased() const { return false; }
/*
* The next four functions return the [capebilities] of a protocol.
* fullMessage means that by downloaden, the whole message is downloaded.
* if it is false, only the headers should be downloaded.
*/
virtual bool canReadSubjects() const { return false; }
virtual bool canDeleteMail() const { return false; }
virtual bool canReadMail() const { return false; }
virtual bool fullMessage() const { return false; }
/*
* The following lines are the options in the configuration;
* true means that an option is enabled;
* false means that the option is disabled.
*/
//virtual int fields() const { return server | port | username | password | mailbox; }
//virtual int urlFields() const { return no_fields; }
virtual unsigned short defaultPort( bool ) const { return 0; }
/*
* This sets the string of such fields in Configuration
*/
virtual TQString serverName() const { return i18n( "Server:" ); }
virtual TQString portName() const { return i18n( "Port:" ); }
virtual TQString usernameName() const { return i18n( "Username:" ); }
virtual TQString mailboxName() const { return i18n( "Mailbox:" ); }
virtual TQString passwordName() const { return i18n( "Password:" ); }
virtual TQString savePasswordName() const { return i18n( "Save password" ); }
virtual TQString authName() const { return i18n( "Authentication:" ); }
/*
* The next function returns the method of deleting: some protoocols
* like to delete files with KIO::get; other with KIO::del
*/
virtual DeleteTypeEnum deleteFunction() const { return del; }
/*
* The next options are the input for the Authentication Combo, seperated by '|'.
* The name should be the same as the auth-metadata.
*/
virtual TQStringList authList() const { return TQStringList::split( '|', "Plain", false ); }
/*
* The next functions are manipulations of an KURL.
* At some points in the code, a KURL is used. But sometimes,
* these have to had a little retouch. That is possible with these function.
*
* For example, by imap, by default, the whole message is downloaded and marked as reed.
* By changing an option to the KURL path, this can be prevented.
*
* The most functions are recognized by name.
* commitDelete return true if a protocol has to confirm a deletion.
* It will be called after marking the messages for deletion.
* deleteCommitKURL is the KURL manipulator; the KURL is as in the settings.
* That KURL isn't retouch by deleteMailKURL.
*/
virtual void recheckConnectKURL( KURL &, KIO::MetaData & ) const { }
virtual void recheckKURL ( KURL &, KIO::MetaData & ) const { };
virtual void readSubjectConnectKURL ( KURL & kurl, KIO::MetaData & ) const { kurl.setPath( "" ); }
virtual void readSubjectKURL ( KURL &, KIO::MetaData & ) const { } //For editing a kurl (adding extra options)
virtual void deleteMailConnectKURL( KURL & kurl, KIO::MetaData & ) const { kurl.setPath( "" ); }
virtual void deleteMailKURL ( KURL &, KIO::MetaData & ) const { }
virtual bool commitDelete() const { return false; }
virtual void deleteCommitKURL( KURL &, KIO::MetaData & ) const { }
virtual void readMailKURL ( KURL &, KIO::MetaData & ) const { }
virtual const KIO_Protocol* getKIOProtocol() const { return this; }
virtual void readEntries( TQMap< TQString, TQString >* ) const;
virtual void readEntries( TQMap< TQString, TQString >*, TQMap< TQString, TQString >* ) const = 0;
protected:
/*
* This enumeration is used when returning the capebilitys of a protocol
*/
enum Fields { no_fields = 0, server = 1, port = 2, username = 4, password = 8,
mailbox = 16, save_password = 32, metadata = 64 };
void clearFields( TQMap< TQString, TQString > *map, const Fields fields ) const;
};
#endif //MK_KIO_PROTO_H
|