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.

dcopdrop.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * Copyright (C) 2004, 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 DCOPDROP_H
  19. #define DCOPDROP_H
  20. #include "maildrop.h"
  21. #include <dcopobject.h>
  22. class DCOPDropInterface;
  23. //class KDropCfgDialog;
  24. class KornMailId;
  25. class KornMailSubject;
  26. class TDEConfigBase;
  27. template<class A, class B> class TQMap;
  28. class TQString;
  29. /**
  30. * This class implements a KMailDrop for DCOP-objects.
  31. * This class handles all new messages which are comming in through DCOP.
  32. */
  33. class DCOPDrop : public KMailDrop
  34. { Q_OBJECT
  35. public:
  36. /**
  37. * Constructor: no parameters
  38. */
  39. DCOPDrop();
  40. /**
  41. * Destructor
  42. */
  43. virtual ~DCOPDrop();
  44. /**
  45. * A DCOPDrop cannot produce error messages, so it always returns true.
  46. *
  47. * @return true is the box is valid
  48. */
  49. virtual bool valid() { return true; }
  50. /**
  51. * This forces the drop to recheck. It is inpossible to recheck dcop,
  52. * so this function does nothing.
  53. */
  54. virtual void recheck();
  55. /**
  56. * This function starts the monitor, however, this drop is always running,
  57. * and doesn't need to be started.
  58. * The return value is always true.
  59. *
  60. * @return true
  61. */
  62. virtual bool startMonitor();
  63. /**
  64. * This function starts the monitor, however, this drop is always running,
  65. * and doesn't need to be started.
  66. * The return value is always true.
  67. *
  68. * @return true
  69. */
  70. virtual bool stopMonitor();
  71. /**
  72. * Return true is the monitor has been started before.
  73. * @return true is it is 'running'.
  74. */
  75. virtual bool running() { return _isRunning; }
  76. //virtual void addConfigPage( KDropCfgDialog* ) ;
  77. /**
  78. * This function gives a new instance of a DCOPDrop.
  79. *
  80. * @return A new instance of a DCOPDrop.
  81. */
  82. virtual KMailDrop* clone() const { return new DCOPDrop; }
  83. /**
  84. * This function reeds the config which are shipped which the group.
  85. *
  86. * @param config The configuration group which contains the info for this account.
  87. * @return The same value as KMailDrop::readConfigGroup( config ) returns.
  88. */
  89. virtual bool readConfigGroup( const TDEConfigGroup& config );
  90. /**
  91. * This function also reeds the configurion, but from a mapping.
  92. *
  93. * @param map The mapping containing the configuration.
  94. * @param protocol The protocol which comes with the mapping.
  95. *
  96. * @return true is all information is retrieved succesfully.
  97. */
  98. virtual bool readConfigGroup( const TQMap< TQString, TQString > & map, const Protocol * protocol );
  99. /**
  100. * This function writes the information to a config group.
  101. *
  102. * @param config The configuration to write true
  103. * @return true if no error occured.
  104. */
  105. virtual bool writeConfigGroup( TDEConfigBase& config ) const;
  106. /**
  107. * This returns the type of the box, in this case allways "dcop".
  108. *
  109. * @return "dcop"
  110. */
  111. virtual TQString type() const;
  112. /**
  113. * This function should return true if it uses a synchrone comminucation.
  114. * It doens't, so it returns false.
  115. *
  116. * @return false
  117. */
  118. virtual bool synchrone() const { return false; }
  119. /**
  120. * Return true if it is possible to read the subjects of new email.
  121. *
  122. * @return true
  123. */
  124. virtual bool canReadSubjects() { return true; }
  125. /**
  126. * This function does reads the subjects.
  127. * @param stop A variable which isn't used: only used for synchrone actions
  128. * @return A TQValueVector which KornMailSubject* instance for every new mail.
  129. */
  130. virtual TQValueVector< KornMailSubject >* doReadSubjects( bool *stop );
  131. /**
  132. * This function should return true if it is possible to delete emails.
  133. * This is possible, so it always return true.
  134. *
  135. * @return true
  136. */
  137. virtual bool canDeleteMails() { return true; }
  138. /**
  139. * This function deletes the email.
  140. *
  141. * @param ids The id's of the email which must be deleted.
  142. * @param stop Not used: only for synchrone opererations.
  143. * @return true if deleting was succesfull
  144. */
  145. virtual bool deleteMails( TQPtrList<const KornMailId> * ids, bool * stop );
  146. /**
  147. * This function returns true if it is possible to read emails.
  148. * The emails are only given at once as a whole, so reading is impossible.
  149. *
  150. * @return false
  151. */
  152. virtual bool canReadMail() { return false; }
  153. private:
  154. bool _isRunning;
  155. TQMap< int, KornMailSubject* > *_msgList;
  156. TQString *_name;
  157. int _counter;
  158. DCOPDropInterface *_interface;
  159. void eraseList( void );
  160. private slots:
  161. void doReadSubjectsASync( void );
  162. public: //accessed by DCOPDropInterface
  163. int addMessage( const TQString& subject, const TQString& message );
  164. bool removeMessage( int id );
  165. //accessed by DCOPDropCfg
  166. TQString DCOPName() const;
  167. void setDCOPName( const TQString& );
  168. };
  169. #endif