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.

mailsubject.h 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #ifndef MailSubject_h
  2. #define MailSubject_h
  3. class TQTextCodec;
  4. class KMailDrop;
  5. #include "mailid.h"
  6. /**
  7. * A KornMailSubject instance represents a single mail. It stores
  8. * its id, sender, subject, header, size and date and possibly its
  9. * mail body
  10. */
  11. class KornMailSubject
  12. {
  13. KornMailId * _id;
  14. KMailDrop * _drop;
  15. TQString _subject;
  16. TQString _sender;
  17. TQString _header;
  18. int _size;
  19. int _date;
  20. bool _fullMessage;
  21. public:
  22. /**
  23. * KornMailSubject default constructor
  24. */
  25. KornMailSubject();
  26. /**
  27. * KornMailSubject constructor
  28. * @param id id of the mail. The KornMailId instance should
  29. * not be touched or deleted afterwards. It is destroyed by
  30. * KornMailSubject's destructor.
  31. * @param drop The KMailDrop.
  32. */
  33. KornMailSubject(KornMailId * id, KMailDrop * drop);
  34. /**
  35. * KornMailSubject copy constructor. All data of the source
  36. * KornMailSubject instance are cloned.
  37. * @param src KornMailSubject to copy from
  38. */
  39. KornMailSubject(const KornMailSubject & src);
  40. /**
  41. * replaces the contents of this by the contents of another
  42. * KornMailSubject instance. All data of the source
  43. * KornMailSubject instance are cloned.
  44. * @param src KornMailSubject to copy from
  45. */
  46. KornMailSubject & operator= (const KornMailSubject & src);
  47. /**
  48. * KornMailSubject destructor
  49. */
  50. virtual ~KornMailSubject();
  51. /**
  52. * Return the mail id.
  53. * @return the mail id.
  54. */
  55. const KornMailId * getId() const {return _id;}
  56. /**
  57. * Set the mails subject.
  58. * @param subject the mails subject.
  59. */
  60. void setSubject(const TQString & subject) {_subject = subject;}
  61. /**
  62. * Return the subject.
  63. * @return the subject.
  64. */
  65. const TQString & getSubject() const {return _subject;}
  66. /**
  67. * Set the mails sender.
  68. * @param sender the mails sender.
  69. */
  70. void setSender(const TQString & sender) {_sender = sender;}
  71. /**
  72. * Return the sender.
  73. * @return the sender.
  74. */
  75. const TQString & getSender() const {return _sender;}
  76. /**
  77. * Set the mails header and (if possible) body.
  78. * @param header the mails header with or without body (see fullMessage parameter).
  79. * @param fullMessage true, if header contains the message body as well, false otherwise.
  80. */
  81. void setHeader(const TQString & header, bool fullMessage) {_header = header; _fullMessage = fullMessage;}
  82. /**
  83. * Return the header or the full message (if isHeaderFullMessage() is true).
  84. * @return the header or the full message.
  85. */
  86. const TQString & getHeader() const {return _header;}
  87. /**
  88. * Return true, if the header contains the header and the full message.
  89. * Return false if the header just contains the header.
  90. * @return see above.
  91. */
  92. bool isHeaderFullMessage() const {return _fullMessage;}
  93. /**
  94. * Set the size of the full mail.
  95. * @param the mails full size.
  96. */
  97. void setSize(int size) {_size = size;}
  98. /**
  99. * Return the size of the full mail.
  100. * @return the size of the full mail.
  101. */
  102. int getSize() const {return _size;}
  103. /**
  104. * Set the mails date in seconds since 1970-01-01 00:00:00.
  105. * @param date the mails date.
  106. */
  107. void setDate(int date) {_date = date;}
  108. /**
  109. * Return the mails date in seconds since 1970-01-01 00:00:00.
  110. * @return the mails date.
  111. */
  112. int getDate() const {return _date;}
  113. /**
  114. * Return a string representation of this (for debugging purposes only)
  115. * @return a string representation
  116. */
  117. TQString toString() const;
  118. /**
  119. * Sets the KMailDrop field.
  120. * @param drop The KMailDrop-object
  121. */
  122. void setMailDrop( KMailDrop* drop ) { _drop = drop; }
  123. /**
  124. * Returns the KMailDrop instance of the Maildrop which owns the subject
  125. */
  126. KMailDrop* getMailDrop() const { return _drop; }
  127. /**
  128. * decodes headers using decodeRFC2047String
  129. */
  130. void decodeHeaders();
  131. private:
  132. /**
  133. * Decode a string based on RFC2047
  134. */
  135. TQString decodeRFC2047String(const TQCString& aStr);
  136. /**
  137. * Unfolding a string (basically changing tabs to spaces
  138. */
  139. TQCString unfold( const TQCString & header );
  140. /**
  141. * Returns true if the parameter is a blank (or tab)
  142. *
  143. * Note from KMail's code, where this function is taken from:
  144. * don't rely on isblank(), which is a GNU extension in
  145. * <cctype>. But if someone wants to write a configure test for
  146. * isblank(), we can then rename this function to isblank and #ifdef
  147. * it's definition...
  148. */
  149. inline bool isBlank( char ch ) { return ch == ' ' || ch == '\t' ; }
  150. /**
  151. * ??
  152. */
  153. const TQTextCodec* codecForName(const TQCString& _str);
  154. };
  155. #endif