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.
kshowmail/kshowmail/filterlog.h

184 lines
3.9 KiB

//
// C++ Interface: filterlog
//
// Description:
//
//
// Author: Ulrich Weigelt <ulrich.weigelt@gmx.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef FILTERLOG_H
#define FILTERLOG_H
//TQt headers
#include <tqvaluelist.h>
#include <tqdatetime.h>
#include <tqdom.h>
#include <tqfile.h>
#include <tqtextstream.h>
//KDE headers
#include <kdebug.h>
#include <tdemessagebox.h>
#include <tdelocale.h>
#include <kstandarddirs.h>
#include <tdeapplication.h>
#include <tdeconfig.h>
//KShowmail headers
#include "filterlogentry.h"
#include "constants.h"
/**
* @brief This is the log of the filters.
* It holds two lists of entry objects (class FilterLogEntry). One for the deleted mails and the other one for
* the moved mails.
*
* @author Ulrich Weigelt <ulrich.weigelt@gmx.de>
*/
typedef TQValueList<FilterLogEntry> LogEntryList;
class FilterLog{
public:
/**
* Default constructor
*/
FilterLog();
/**
* Destructor
*/
~FilterLog();
/**
* Adds an entry about a deleted mail.
* @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
*/
void addDeletedMail( const TQDateTime& dateTime, const TQString& sender, const TQString& account, const TQString& subject );
/**
* Adds an entry about a moved mail.
* @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
*/
void addMovedMail( const TQDateTime& dateTime, const TQString& sender, const TQString& account, const TQString& subject, const TQString& mailbox );
/**
* Prints the log state.
*/
void print();
/**
* Clears the log of deleted mails.
*/
void clearDeletedMailsLog();
/**
* Clears the log of moved mails.
*/
void clearMovedMailsLog();
/**
* Saved the log of deleted mails as XML document.
*/
void save();
/**
* Loads the log of deleted mails from the XML document and get settings.
*/
void load();
/**
* Returns a copy of the list of deleted mails.
* @return copy of the deleted mails list
*/
LogEntryList getDeletedMails();
/**
* Retruns a copy of the list of moved mails.
* @return copy of the moved mails list
*/
LogEntryList getMovedMails();
/**
* Loads the settings
*/
void loadSetup();
/**
* Returns the number of logged deleted mails.
* @return number of logged deleted mails
*/
int numberDeletedMails();
/**
* Returns the number of logged moved mails.
* @return number of logged moved mails
*/
int numberMovedMails();
private:
/**
* Connector to the configuration file
*/
TDEConfig* config;
/**
* List of entries about deleted mails.
*/
LogEntryList listDeletedMails;
/**
* List of entries about moved mails.
*/
LogEntryList listMovedMails;
/**
* TRUE - the log accepts orders to log deleted mails
*/
bool logDeletedMails;
/**
* TRUE - the log accepts orders to log moved mails
*/
bool logMovedMails;
/**
* exit - hold log of deleted mails until application exit
* days - hold log some days
*/
enum{ exit, days } deletedMailsStorageMode;
/**
* Time (days) a entry of a deleted mail will be stored.
*/
unsigned int daysStoreDeletedMails;
protected:
/**
* adds an entry.
* The target list will be coose on the basis of the given filter action.
*/
void addEntry( FilterAction_Type action, const TQDateTime& dateTime, const TQString& sender, const TQString& account, const TQString& subject, const TQString& mailbox = TQString::null );
};
#endif