removed the content from template.docbook, which is completly unrelated to kmobiletools
[kdepim.git] / korn / kmail_proto.h
blob876d823c850ee4723f41deb53f4b017b55ca910e
1 /*
2 * Copyright (C) 2005, Mart Kelder (mart.kde@hccnet.nl)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef MK_KMAILPROTOCOL
21 #define MK_KMAILPROTOCOL
23 #include "protocol.h"
25 #include <QString>
27 class AccountSettings;
28 class KConfig;
29 class KConfigBase;
31 template< class T > class QList;
33 /**
34 * This class is the comminucation between KOrn and KMail.
35 * If provides an configuration option to fill in the KMail account name,
36 * and it provides a conversion from the KMail config to a configuration KOrn can read.
37 * That conversion is done every time, so that changing the settings in KMail also affects
38 * the settings in KOrn.
40 class KMail_Protocol : public Protocol
42 public:
43 /**
44 * Constructor
46 KMail_Protocol();
47 /**
48 * Destructor
50 ~KMail_Protocol();
52 /**
53 * This function returns the protocol of the resulting configuration.
54 * This is not itself, because an real Protocol of type KMail doesn't exist.
56 * @param config The configuration group to read the kmailname from.
57 * @return A pointer to a Protocol (not newly created) or 0 if an error orrured.
59 virtual const Protocol* getProtocol( AccountSettings* config ) const;
60 /**
61 * This gives a new Maildrop back. The maildrop is responsible to execute the configuration.
62 * In most cases, it will return a new instance of the KKioDrop Maildrop.
63 * @param config The configuration group to read the kmailname from.
64 * @return A new KMailDrop, or a 0 pointer if an error occurred.
66 virtual KMailDrop* createMaildrop( AccountSettings* config ) const;
67 /**
68 * This does the real convertion: given a namen of a KMail account (hidden in config),
69 * it calculates how the configuration whould have looked in KOrn.
71 * @param config The configuration group to read the kmailname from.
72 * @param password The password fetched out of the configuration or KWallet.
73 * @return A mapping containing the configuration if success, and empty mapping otherwise.
75 virtual QMap< QString, QString > * createConfig( AccountSettings* config ) const;
76 /**
77 * The name of thes protocol
79 * @return "kmail"
81 virtual QString configName() const { return "kmail"; }
83 /**
84 * This adds the names of the groupboxes neccesairy for configuration to list.
86 * @param list A empty list at calling; after this function, "KMail" is added, because KMail is the only group here.
88 virtual void configFillGroupBoxes( QStringList* list ) const;
89 /**
90 * This filles the config fields of the configuration.
91 * There is only one config field, containing the accounts of KMail.
93 * @param vector A vector containing the groupboxes.
94 * @param object An object to connect slots to.
95 * @param result The resulting object.
97 virtual void configFields( QVector< QWidget* >* vector, const QObject* object, QList< AccountInput* >* result ) const;
98 /**
99 * This can manipulate entries that are readed from the configuartion.
100 * This function does nothing here.
102 * @param config The configuration mapping as read from the configuration file
104 virtual void readEntries( QMap< QString, QString >* config ) const;
107 * This can manipulate entries that are writed to the configuartion file.
108 * This function does nothing here.
110 * @param config The configuration mapping as to be written to the configuration file (can be modified)
112 virtual void writeEntries( QMap< QString, QString >* config ) const;
114 private:
115 QString readPassword( bool store, const KConfigBase &config, int id ) const;
116 QString getTypeAndConfig( const QString& kmailname, KConfig &config, int &nummer, QString& groupname ) const;
118 static const char* kmailGroupName;
119 static const char* kmailKeyName;
120 static const char* kmailKeyType;
121 static const char* kmailKeyId;
122 static const char* kmailKeyMBox;
123 static const char* kmailKeyQMail;
124 static const int kmailFirstGroup;
127 #endif //MK_KMAILPROTOCOL