summaryrefslogtreecommitdiffstats
path: root/kshowmail/filterlogentry.h
blob: 74eb509691fa0473294f1aa77323063cc8b2ca87 (plain)
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
//
// C++ Interface: filterlogentry
//
// Description:
//
//
// Author: Ulrich Weigelt <ulrich.weigelt@gmx.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef FILTERLOGENTRY_H
#define FILTERLOGENTRY_H

//TQt headers
#include <ntqdatetime.h>
#include <ntqstring.h>
#include <ntqdom.h>

//KDE headers
#include <kdebug.h>

//KShowmail headers
#include "types.h"
#include "constants.h"

using namespace Types;

/**
 * @brief An Object of this class contains the datas about a deleted or moved mail.
 * These objects are stored in the lists of the filter log.
 *
 * @author Ulrich Weigelt <ulrich.weigelt@gmx.de>
 */

class FilterLogEntry{

  public:

    /**
     * Default constructor
     */
    FilterLogEntry();

    /**
     * General constructor
     * @param action executed action
     * @param dateTime date and time on which the mail was sent
     * @param sender sender of the mail
     * @param account Account which has received the mail
     * @param subject Subject of the mail
     * @param mailbox mailbox where the mails was moved
     */
    FilterLogEntry( FilterAction_Type action, const TQDateTime& dateTime, const TQString& sender, const TQString& account, const TQString& subject, const TQString& mailbox = TQString::null );

    /**
     * Copy Constructor
     * @param ent source entry
     */
    FilterLogEntry( const FilterLogEntry& ent );

    /**
     * Destructor
     */
    ~FilterLogEntry();

    /**
     * Assignment operator
     * @param ent source entry
     */
    FilterLogEntry& operator=( const FilterLogEntry& ent );

    /**
     * Compares this entry with the given entry
     * @param ent entry to compare
     * @return TRUE - the time of this entry is equal to te time of the given entry.
     */
    bool operator==( const FilterLogEntry& ent ) const;

    /**
     * Compares this entry with the given entry
     * @param ent entry to compare
     * @return TRUE - the time of this entry is not equal to the time of the given entry.
     */
    bool operator!=( const FilterLogEntry& ent ) const;

    /**
     * Compares this entry with the given entry
     * @param ent entry to compare
     * @return TRUE - the time of this entry is later than the time of the given entry.
     */
    bool operator>( const FilterLogEntry& ent ) const;

    /**
     * Compares this entry with the given entry
     * @param ent entry to compare
     * @return TRUE - the time of this entry is later than or equal to the time of the given entry.
     */
    bool operator>=( const FilterLogEntry& ent ) const;

    /**
     * Compares this entry with the given entry
     * @param ent entry to compare
     * @return TRUE - the time of this entry is earlier than the time of the given entry.
     */
    bool operator<( const FilterLogEntry& ent ) const;

    /**
     * Compares this entry with the given entry
     * @param ent entry to compare
     * @return TRUE - the time of this entry is earlier than or equal to the time of the given entry.
     */
    bool operator<=( const FilterLogEntry& ent ) const;

    /**
     * Prints the datas of this entry to Stdout.
     */
    void print();

    /**
     * Returns whether the mail of this entry is older than the given number of days.
     * @param days number of days to compare
     * @return TRUE - the mail is older than the given date
     */
    bool isOlder( uint days );

    /**
     * Stores the entry into the given DOM document as child of the given DOM element.
     */
    void save( TQDomDocument& doc, TQDomElement& parent );

    /**
     * Returns the date and time of send
     * @return send date and time
     */
    TQDateTime getDate();

    /**
     * Returns the sender.
     * @return Sender
     */
    TQString getSender();

    /**
     * Returns the account.
     * @return Account
     */
    TQString getAccount();

    /**
     * Returns the subject
     * @return Subject
     */
    TQString getSubject();

    /**
     * Returns the mailbox
     * @return mailbox
     */
    TQString getMailbox();

  private:

    /**
     * executed action
     */
    FilterAction_Type act;

    /**
     * Delivery date and time
     */
    TQDateTime sentDateTime;

    /**
     * Sender
     */
    TQString sender;

    /**
     * Account
     */
    TQString account;

    /**
     * Subject
     */
    TQString subject;

    /**
     * mailbox if the mails was moved
     */
    TQString mailbox;

};

#endif