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.
146 lines
4.1 KiB
146 lines
4.1 KiB
15 years ago
|
/***************************************************************************
|
||
4 years ago
|
filters.h - description
|
||
15 years ago
|
-------------------
|
||
|
begin : Fri Jun 30 2000
|
||
|
copyright : (C) 2000 by Hans Dijkema
|
||
|
email : kmailcvt@hum.org
|
||
|
***************************************************************************/
|
||
|
|
||
|
/***************************************************************************
|
||
|
* *
|
||
|
* This program is free software; you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU General Public License as published by *
|
||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||
|
* (at your option) any later version. *
|
||
|
* *
|
||
|
***************************************************************************/
|
||
|
|
||
4 years ago
|
#ifndef FILTERS_H
|
||
|
#define FILTERS_H
|
||
15 years ago
|
|
||
|
#ifndef MAX_LINE
|
||
|
#define MAX_LINE 4096
|
||
|
#endif
|
||
|
|
||
14 years ago
|
#include <tqcombobox.h>
|
||
|
#include <tqprogressbar.h>
|
||
|
#include <tqptrlist.h>
|
||
|
#include <tqlistbox.h>
|
||
|
#include <tqlabel.h>
|
||
15 years ago
|
|
||
|
#include "kimportpagedlg.h"
|
||
|
|
||
|
class FilterInfo
|
||
|
{
|
||
|
public:
|
||
13 years ago
|
FilterInfo(KImportPageDlg *dlg, TQWidget *parent, bool _removeDupMsg);
|
||
15 years ago
|
~FilterInfo();
|
||
|
|
||
13 years ago
|
void setStatusMsg( const TQString& status );
|
||
14 years ago
|
void setFrom( const TQString& from );
|
||
|
void setTo( const TQString& to );
|
||
|
void setCurrent( const TQString& current );
|
||
15 years ago
|
void setCurrent( int percent = 0 );
|
||
|
void setOverall( int percent = 0 );
|
||
14 years ago
|
void addLog( const TQString& log );
|
||
15 years ago
|
void clear();
|
||
14 years ago
|
void alert( const TQString& message );
|
||
15 years ago
|
static void terminateASAP();
|
||
|
bool shouldTerminate();
|
||
|
|
||
13 years ago
|
TQWidget *parent() { return m_parent; }
|
||
15 years ago
|
bool removeDupMsg;
|
||
|
|
||
|
private:
|
||
|
KImportPageDlg *m_dlg;
|
||
13 years ago
|
TQWidget *m_parent;
|
||
15 years ago
|
static bool s_terminateASAP;
|
||
|
};
|
||
|
|
||
|
class Filter
|
||
|
{
|
||
|
public:
|
||
14 years ago
|
Filter( const TQString& name, const TQString& author,
|
||
14 years ago
|
const TQString& info = TQString() );
|
||
15 years ago
|
virtual ~Filter() {}
|
||
|
virtual void import( FilterInfo* ) = 0;
|
||
14 years ago
|
TQString author() const { return m_author; }
|
||
|
TQString name() const { return m_name; }
|
||
|
TQString info() const { return m_info; }
|
||
14 years ago
|
|
||
|
virtual bool needsSecondPage();
|
||
|
|
||
15 years ago
|
int count_duplicates; //to count all duplicate messages
|
||
14 years ago
|
|
||
15 years ago
|
protected:
|
||
14 years ago
|
void showKMailImportArchiveDialog( FilterInfo* info );
|
||
15 years ago
|
bool addMessage( FilterInfo* info,
|
||
14 years ago
|
const TQString& folder,
|
||
|
const TQString& msgFile,
|
||
|
const TQString& msgStatusFlags = TQString());
|
||
15 years ago
|
bool addMessage_fastImport( FilterInfo* info,
|
||
14 years ago
|
const TQString& folder,
|
||
|
const TQString& msgFile,
|
||
|
const TQString& msgStatusFlags = TQString());
|
||
15 years ago
|
private:
|
||
14 years ago
|
TQString m_name;
|
||
|
TQString m_author;
|
||
|
TQString m_info;
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
14 years ago
|
* Glorified TQString[N] for (a) understandability (b) older gcc compatibility.
|
||
15 years ago
|
*/
|
||
|
template <unsigned int size> class FolderStructureBase
|
||
|
{
|
||
|
public:
|
||
14 years ago
|
typedef TQString NString[size];
|
||
|
/** Constructor. Need a default constructor for TQValueList. */
|
||
15 years ago
|
FolderStructureBase() {} ;
|
||
|
|
||
14 years ago
|
/** Constructor. Turn N TQStrings into a folder structure
|
||
15 years ago
|
* description.
|
||
|
*/
|
||
|
FolderStructureBase(const NString &s)
|
||
|
{
|
||
|
for(unsigned int i=0; i<size; i++) d[i]=s[i];
|
||
|
} ;
|
||
|
|
||
|
/** Copy Constructor. */
|
||
|
FolderStructureBase(const FolderStructureBase &s)
|
||
|
{
|
||
|
for(unsigned int i=0; i<size; i++) d[i]=s[i];
|
||
|
} ;
|
||
|
|
||
14 years ago
|
/** Assignment operator. Does the same thing as
|
||
15 years ago
|
* the copy constructor.
|
||
|
*/
|
||
|
FolderStructureBase &operator =(const FolderStructureBase &s)
|
||
|
{
|
||
|
for(unsigned int i=0; i<size; i++) d[i]=s[i];
|
||
|
return *this;
|
||
|
} ;
|
||
|
|
||
|
/** Access the different fields. There doesn't seem to
|
||
|
* be a real semantics for the fields.
|
||
|
*/
|
||
14 years ago
|
const TQString operator [](unsigned int i) const
|
||
15 years ago
|
{
|
||
14 years ago
|
if (i<size) return d[i]; else return TQString();
|
||
15 years ago
|
} ;
|
||
|
|
||
|
/** Access the different fields, for writing. */
|
||
14 years ago
|
TQString &operator [](unsigned int i)
|
||
15 years ago
|
{
|
||
|
Q_ASSERT(i<size);
|
||
|
if (i<size) return d[i]; else return d[0];
|
||
|
} ;
|
||
|
private:
|
||
14 years ago
|
TQString d[size];
|
||
15 years ago
|
} ;
|
||
|
|
||
|
#endif
|
||
|
|