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.
209 lines
6.4 KiB
209 lines
6.4 KiB
15 years ago
|
/*
|
||
|
* Copyright (C) Kurt Granroth
|
||
|
* Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl)
|
||
|
*
|
||
|
* 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.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
*/
|
||
|
|
||
|
/*
|
||
11 years ago
|
* tdeio.h -- Declaration of class KKIODrop.
|
||
15 years ago
|
*/
|
||
11 years ago
|
#ifndef KEG_TDEIODROP_H
|
||
|
#define KEG_TDEIODROP_H
|
||
15 years ago
|
|
||
|
#include "polldrop.h"
|
||
|
|
||
14 years ago
|
class TQWidget;
|
||
15 years ago
|
class KDropDialog;
|
||
|
class KornMailSubject;
|
||
12 years ago
|
class TDEProcess;
|
||
11 years ago
|
class TDEIO_Count;
|
||
|
class TDEIO_Protocol;
|
||
|
class TDEIO_Subjects;
|
||
|
class TDEIO_Read;
|
||
|
class TDEIO_Delete;
|
||
12 years ago
|
class TDEConfigGroup;
|
||
15 years ago
|
class KURL;
|
||
14 years ago
|
template<class> class TQPtrList;
|
||
|
template<class> class TQValueList;
|
||
12 years ago
|
namespace TDEIO { class Job; class MetaData; class Slave; class TransferJob; }
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Polling monitor for IMAP4 maildrops.
|
||
|
* @author Kurt Granroth (granroth@kde.org)
|
||
11 years ago
|
* Changes to poll with TDEIO
|
||
15 years ago
|
* @author Mart Kelder (mart.kde@hccnet.nl)
|
||
|
* $version $Id$
|
||
|
*/
|
||
|
class KKioDrop : public KPollableDrop
|
||
|
{
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
private:
|
||
|
KURL *_kurl;
|
||
12 years ago
|
TDEIO::MetaData *_metadata;
|
||
15 years ago
|
|
||
14 years ago
|
TQString _password;
|
||
15 years ago
|
|
||
|
bool _valid;
|
||
|
|
||
11 years ago
|
const TDEIO_Protocol * _protocol;
|
||
15 years ago
|
bool _ssl;
|
||
|
|
||
11 years ago
|
TDEIO_Count *_count;
|
||
|
TDEIO_Subjects *_subjects;
|
||
|
TDEIO_Read *_read;
|
||
|
TDEIO_Delete *_delete;
|
||
15 years ago
|
|
||
|
int _readSubjectsTotalSteps;
|
||
|
int _deleteMailsTotalSteps;
|
||
|
//For process
|
||
12 years ago
|
TDEProcess *_process;
|
||
15 years ago
|
|
||
|
//List of mailurls fetched by the last time emails were counted
|
||
|
struct FileInfo {
|
||
14 years ago
|
TQString name;
|
||
15 years ago
|
long size;
|
||
|
};
|
||
14 years ago
|
TQValueList<FileInfo> *_mailurls;
|
||
15 years ago
|
|
||
|
/*
|
||
|
* The help-classes of this functions are friend functions, because this way, they can
|
||
|
* access the _kurl and _metadata-values without a function; and this way, no signal or
|
||
|
* public functions are neccesairy to emit a signal from KKioDrop.
|
||
|
*/
|
||
11 years ago
|
friend class TDEIO_Count;
|
||
|
friend class TDEIO_Subjects;
|
||
|
friend class TDEIO_Read;
|
||
|
friend class TDEIO_Delete;
|
||
|
friend class TDEIO_Single_Subjects;
|
||
15 years ago
|
public:
|
||
|
static const char *ProtoConfigKey;
|
||
|
static const char *HostConfigKey;
|
||
|
static const char *PortConfigKey;
|
||
|
static const char *UserConfigKey;
|
||
|
static const char *MailboxConfigKey;
|
||
|
static const char *PassConfigKey;
|
||
|
static const char *SavePassConfigKey;
|
||
|
static const char *MetadataConfigKey;
|
||
|
|
||
|
public:
|
||
|
/**
|
||
|
* KKioDrop Constructor
|
||
|
*/
|
||
|
KKioDrop();
|
||
12 years ago
|
KKioDrop( TDEConfigGroup* );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Set the server that will be checked for new mail.
|
||
|
*/
|
||
14 years ago
|
void setKioServer( const TQString & proto, const TQString & server, int port = -1 );
|
||
|
void setKioServer( const TQString & proto, const TQString & server, int port,
|
||
12 years ago
|
const TDEIO::MetaData metadata, bool ssl, bool setProtocol = true ); //Last argument inits _protocol
|
||
15 years ago
|
|
||
|
/** Set the account information for the PROTO server. */
|
||
14 years ago
|
void setUser( const TQString & user, const TQString & password, const TQString & mailbox, const TQString & auth );
|
||
15 years ago
|
|
||
|
// The next functions return settings
|
||
14 years ago
|
TQString protocol() const;
|
||
|
TQString server() const;
|
||
15 years ago
|
int port() const;
|
||
|
|
||
14 years ago
|
TQString user() const;
|
||
|
TQString password() const;
|
||
|
TQString mailbox() const;
|
||
|
TQString auth() const;
|
||
15 years ago
|
|
||
|
virtual void recheck();
|
||
|
virtual void forceRecheck();
|
||
|
|
||
|
virtual bool valid();
|
||
|
|
||
|
/**
|
||
|
* KKioDrop Destructor
|
||
|
*/
|
||
|
virtual ~KKioDrop();
|
||
|
|
||
|
virtual bool canReadSubjects(void);
|
||
14 years ago
|
virtual TQValueVector<KornMailSubject> * doReadSubjects(bool * stop);
|
||
15 years ago
|
|
||
|
virtual bool canDeleteMails();
|
||
14 years ago
|
virtual bool deleteMails(TQPtrList<const KornMailId> * ids, bool * stop);
|
||
15 years ago
|
|
||
|
virtual bool canReadMail ();
|
||
14 years ago
|
virtual TQString readMail(const KornMailId * id, bool * stop);
|
||
15 years ago
|
|
||
|
virtual KMailDrop* clone () const ;
|
||
14 years ago
|
virtual bool readConfigGroup ( const TQMap< TQString, TQString >& map, const Protocol * protocol );
|
||
12 years ago
|
virtual bool writeConfigGroup ( TDEConfigBase& cfg ) const;
|
||
11 years ago
|
virtual TQString type() const { return TQString::fromUtf8("tdeio"); }
|
||
15 years ago
|
|
||
|
virtual bool synchrone() const { return false; } //class is not synchrone
|
||
|
|
||
|
//virtual void addConfigPage( KDropCfgDialog * );
|
||
|
|
||
|
virtual bool asynchrone() const { return true; }
|
||
|
|
||
|
private:
|
||
|
KKioDrop& operator = ( const KKioDrop& );
|
||
14 years ago
|
//static void encrypt( TQString& str );
|
||
|
//static void decrypt( TQString& str );
|
||
15 years ago
|
|
||
|
/*
|
||
|
* The next functions are called from the help-classes (which are friend of the class).
|
||
|
* The only thing this functions do is emitting signals.
|
||
|
*/
|
||
|
void emitRechecked() { emit rechecked(); }
|
||
|
void emitChanged( int value ) { emit changed( value, this ); }
|
||
|
|
||
|
void emitReadSubjectsReady( bool success ) { emit readSubjectsReady( success ); }
|
||
|
void emitReadSubjectsRead( KornMailSubject * subject ) { emit readSubject( subject ); }
|
||
|
void emitReadSubjectsTotalSteps( int value ) { _readSubjectsTotalSteps = value; emit readSubjectsTotalSteps( value ); }
|
||
|
void emitReadSubjectsProgress( int value ) { emit readSubjectsProgress( _readSubjectsTotalSteps - value ); }
|
||
|
|
||
14 years ago
|
void emitReadMailReady( TQString* msg ) { emit readMailReady( msg ); }
|
||
15 years ago
|
|
||
|
void emitDeleteMailsReady( bool value ) { emit deleteMailsReady( value ); }
|
||
|
void emitDeleteMailsTotalSteps( int value ) { _deleteMailsTotalSteps = value; emit deleteMailsTotalSteps( value ); }
|
||
|
void emitDeleteMailsProgress( int value ) { emit deleteMailsProgress( _deleteMailsTotalSteps - value ); }
|
||
|
|
||
14 years ago
|
void emitShowPassivePopup( TQPtrList< KornMailSubject > *subject, int total )
|
||
15 years ago
|
{ emit showPassivePopup( subject, total, passiveDate(), this->realName() ); }
|
||
14 years ago
|
void emitShowPassivePopup( const TQString& error )
|
||
15 years ago
|
{ if( passivePopup() ) { emit showPassivePopup( error, this->realName() ); } }
|
||
|
void emitValidChanged() { emit validChanged( valid() ); }
|
||
|
|
||
|
private slots:
|
||
14 years ago
|
void slotConnectionError( int, const TQString& );
|
||
|
void slotConnectionWarning( const TQString& );
|
||
|
void slotConnectionInfoMessage( const TQString& );
|
||
15 years ago
|
|
||
|
protected:
|
||
|
//The next functions are needed for Process;
|
||
|
virtual bool startProcess();
|
||
|
virtual bool stopProcess();
|
||
|
|
||
|
public slots:
|
||
|
virtual void readSubjectsCanceled();
|
||
|
virtual void readMailCanceled();
|
||
|
virtual void deleteMailsCanceled();
|
||
|
|
||
|
private slots:
|
||
|
//For Process too
|
||
12 years ago
|
void processExit(TDEProcess*);
|
||
|
void receivedStdout( TDEProcess *, char *, int);
|
||
15 years ago
|
};
|
||
11 years ago
|
#endif // KEG_TDEIODROP_H
|