TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kmail_proto.h 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright (C) 2005, Mart Kelder (mart.kde@hccnet.nl)
  3. *
  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.
  8. *
  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.
  13. *
  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
  17. */
  18. #ifndef MK_KMAILPROTOCOL
  19. #define MK_KMAILPROTOCOL
  20. #include "protocol.h"
  21. class TDEConfig;
  22. class TDEConfigBase;
  23. /**
  24. * This class is the comminucation between KOrn and KMail.
  25. * If provides an configuration option to fill in the KMail account name,
  26. * and it provides a conversion from the KMail config to a configuration KOrn can read.
  27. * That conversion is done every time, so that changing the settings in KMail also affects
  28. * the settings in KOrn.
  29. */
  30. class KMail_Protocol : public Protocol
  31. {
  32. public:
  33. /**
  34. * Constructor
  35. */
  36. KMail_Protocol();
  37. /**
  38. * Destructor
  39. */
  40. ~KMail_Protocol();
  41. /**
  42. * This function returns the protocol of the resulting configuration.
  43. * This is not itself, because an real Protocol of type KMail doesn't exist.
  44. *
  45. * @param config The configuration group to read the kmailname from.
  46. * @return A pointer to a Protocol (not newly created) or 0 if an error orrured.
  47. */
  48. virtual const Protocol* getProtocol( TDEConfigGroup* config ) const;
  49. /**
  50. * This gives a new Maildrop back. The maildrop is responsible to execute the configuration.
  51. * In most cases, it will return a new instance of the KKioDrop Maildrop.
  52. * @param config The configuration group to read the kmailname from.
  53. * @return A new KMailDrop, or a 0 pointer if an error occured.
  54. */
  55. virtual KMailDrop* createMaildrop( TDEConfigGroup* config ) const;
  56. /**
  57. * This does the real convertion: given a namen of a KMail account (hidden in config),
  58. * it calculates how the configuration whould have looked in KOrn.
  59. *
  60. * @param config The configuration group to read the kmailname from.
  61. * @param password The password fetched out of the configuration or TDEWallet.
  62. * @return A mapping containing the configuration if success, and empty mapping otherwise.
  63. */
  64. virtual TQMap< TQString, TQString > * createConfig( TDEConfigGroup* config, const TQString& password ) const;
  65. /**
  66. * The name of thes protocol
  67. *
  68. * @return "kmail"
  69. */
  70. virtual TQString configName() const { return "kmail"; }
  71. /**
  72. * This adds the names of the groupboxes neccesairy for configuration to list.
  73. *
  74. * @param list A empty list at calling; after this function, "KMail" is added, because KMail is the only group here.
  75. */
  76. virtual void configFillGroupBoxes( TQStringList* list ) const;
  77. /**
  78. * This filles the config fields of the configuration.
  79. * There is only one config field, containing the accounts of KMail.
  80. *
  81. * @param vector A vector containing the groupboxes.
  82. * @param object An object to connect slots to.
  83. * @param result The resulting object.
  84. */
  85. virtual void configFields( TQPtrVector< TQWidget >* vector, const TQObject* object, TQPtrList< AccountInput >* result ) const;
  86. /**
  87. * This can manipulate entries that are readed from the configuartion.
  88. * This function does nothing here.
  89. *
  90. * @param config The configuration mapping as read from the configuration file
  91. */
  92. virtual void readEntries( TQMap< TQString, TQString >* config ) const;
  93. /**
  94. * This can manipulate entries that are writed to the configuartion file.
  95. * This function does nothing here.
  96. *
  97. * @param config The configuration mapping as to be written to the configuration file (can be modified)
  98. */
  99. virtual void writeEntries( TQMap< TQString, TQString >* config ) const;
  100. private:
  101. TQString readPassword( bool store, const TDEConfigBase &config, int id ) const;
  102. TQString getTypeAndConfig( const TQString& kmailname, TDEConfig &config, int &nummer ) const;
  103. static const char* kmailGroupName;
  104. static const char* kmailKeyName;
  105. static const char* kmailKeyType;
  106. static const char* kmailKeyId;
  107. static const char* kmailKeyMBox;
  108. static const char* kmailKeyTQMail;
  109. static const int kmailFirstGroup;
  110. };
  111. #endif //MK_KMAILPROTOCOL