configelem.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           configelem.h  -  description
00003                              -------------------
00004     begin                : Tue May 9 2000
00005     copyright            : (C) 2000-2001 by Eggert Ehmke
00006     email                : eggert.ehmke@berlin.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef CONFIGELEM_H
00019 #define CONFIGELEM_H
00020 
00021 //C headers
00022 #include <time.h>
00023 #include <unistd.h>
00024 #include <stdlib.h>
00025 #include <stdio.h>
00026 
00027 //TQt headers
00028 #include <ntqstring.h>
00029 #include <ntqlistview.h>
00030 #include <ntqdom.h>
00031 #include <ntqobject.h>
00032 #include <ntqtimer.h>
00033 #include <ntqregexp.h>
00034 #include <ntqdir.h>
00035 #include <ntqfile.h>
00036 #include <ntqtextstream.h>
00037 
00038 //KDE headers
00039 #include <kurl.h>
00040 #include <tdeconfig.h>
00041 #include <kdebug.h>
00042 #include <kpassdlg.h>
00043 #include <tdeio/job.h>
00044 #include <tdeio/global.h>
00045 #include <tdemessagebox.h>
00046 #include <tdeapplication.h>
00047 
00048 //KShowmail headers
00049 #include "showrecord.h"
00050 #include "constants.h"
00051 #include "types.h"
00052 #include "configlist.h"
00053 #include "showmaildialog.h"
00054 #include "decodeRFC2047.h"
00055 #include "kshowmailview.h"
00056 #include "encryption.h"
00057 #include "tdewalletaccess.h"
00058 #include "headerfilter.h"
00059 #include "filterlog.h"
00060 
00061 
00062 
00063 using namespace Constants;
00064 using namespace Types;
00065 using namespace Encryption;
00066 
00067 //forward class declarations
00068 class KshowmailView;
00069 class ConfigList;
00070 class ShowRecordElem;
00071 class ShowRecord;
00072 
00086 class ConfigElem : public TQObject {
00087 
00088   TQ_OBJECT
00089 
00090   public:
00091 
00096     static const int continueShowHeaders;
00097 
00102     static const int cancelShowHeaders;
00103 
00109     ConfigElem();
00110 
00115     ConfigElem ( ConfigList* config );
00116 
00124     ConfigElem( ConfigElem* pElem );
00125 
00134     ConfigElem( ConfigList* config, const TQString& account );
00135 
00140     ~ConfigElem();
00141 
00146     bool isActive() const;
00147 
00152     void setActive( bool active );
00153 
00158    TQString getAccountName() const;
00159 
00164    void setAccountName( TQString name );
00165 
00170    TQString getPassword() const;
00171 
00177    void setPassword( const TQString& password );
00178 
00183    bool hasPassword() const;
00184 
00189    KURL getURL() const;
00190 
00196    void setListViewItem( TQListViewItem* item );
00197 
00203    TQListViewItem* getListViewItem();
00204 
00210    bool isSelected() const;
00211 
00215    void clearMailList();
00216 
00221    void setHost( const TQString& host );
00222 
00227    TQString getHost() const;
00228 
00233    void setProtocol( const TQString& protocol );
00234 
00240    TQString getProtocol( bool upperCase = false ) const;
00241 
00246    void setTLS( bool tls );
00247 
00253    bool getTLS() const;
00254 
00259    void setPort( unsigned short int port );
00260 
00265    unsigned short int getPort() const;
00266 
00271    void setUser( const TQString& user );
00272 
00277    TQString getUser() const;
00278 
00284    void setPasswordStorage( int storage );
00285 
00291    int getPasswordStorage() const;
00292 
00293 
00301   void saveOptions( TQDomDocument& doc, TQDomElement& parent );
00302 
00307   void readStoredMails( TQDomElement& parent );
00308 
00313   int count();
00314 
00320   void deleteSelectedMails();
00321 
00328   void showSelectedMails();
00329 
00338   bool assertPassword( bool force = false );
00339 
00344   Types::AccountState_Type getState();
00345 
00350   TQStringList getSelectedSubjects() const;
00351 
00358   bool hasSelectedMails();
00359 
00368   void refreshMailList( FilterLog* log = NULL );
00369 
00374   int getNumberNewMails();
00375 
00380   int getNumberMails();
00381 
00386   long getTotalSize();
00387 
00393   void fillMailListView( KshowmailView* view );
00394 
00400   void refreshAccountListItem();
00401 
00405   void killPOP3Job();
00406 
00413   int showSelectedHeaders();
00414 
00418   void printSetup() const;
00419 
00424   void reloadFilterSettings();
00425 
00426 
00427   private:
00428 
00433     ConfigList* appConfig;
00434 
00439     FilterLog* FLog;
00440 
00444     Types::AccountState_Type state;
00445 
00453     int PasswordStorage;
00454 
00458     bool m_bActive;
00459 
00463     TQString m_strAccount;
00464 
00468     TQListViewItem* m_pViewItem;
00469 
00473     ShowRecord* m_pshowrecord;
00474 
00478     KURL m_url;
00479 
00484     int secureLoginType;
00485 
00489     bool useTLS;
00490 
00495     TQByteArray mailbody;
00496 
00505     MailNumberList_Type MailsToDelete;
00506 
00513     MailToDownloadMap_Type MailsToDownload;
00514 
00522     MailNumberList_Type MailsToShow;
00523 
00531     MailNumberList_Type newMails;
00532 
00536     TDEIO::TransferJob* pop3Job;
00537 
00542     TQTimer* pop3Timer;
00543 
00549     ShowRecord* tempMailList;
00550 
00555     TQStringList receivedUIDs;
00556 
00561     TQStringList receivedSizes;
00562 
00567     TQByteArray receivedHeader;
00568 
00572     HeaderFilter headerFilter;
00573 
00581     bool filterApplied;
00582 
00587     bool deletionPerformedByFilters;
00588 
00593     bool refreshPerformedByFilters;
00594 
00599     bool downloadActionsInvoked;
00600 
00604     int moveCounter;
00605 
00609     void init();
00610 
00619     void deleteNextMail();
00620 
00627     void commitDeletion();
00628 
00638     void showNextMail();
00639 
00646     void commitDownloading();
00647 
00652     void startKIOJob( const TQString& path );
00653 
00663     unsigned int getTimeoutTime();
00664 
00672     void getUIDs();
00673 
00681     void getSizes();
00682 
00687     void getHeaders();
00688 
00699     void getNextHeader();
00700 
00707     void copyHeaders();
00708 
00720     void applyFilters();
00721 
00730     void applyFiltersDeleted();
00731 
00736     void cancelRefresh();
00737 
00747     void commitRefresh();
00748 
00764     void swapMailLists();
00765 
00772     void doDownloadActions();
00773 
00783     void getNextMailForDownloadActions();
00784 
00790     bool isMailDir( const TQDir& path );
00791 
00798     bool writeToMailBox( const TQString& mail, const TQString& box );
00799 
00800   private slots:
00801 
00816     void slotMailDeleted( TDEIO::Job* job );
00817 
00826     void slotFinalizeDeletion( TDEIO::Job* );
00827 
00845     void slotBodyDownloaded( TDEIO::Job* job );
00846 
00862     void slotMailDownloadedForAction( TDEIO::Job* job );
00863 
00872     void slotDataMailBody( TDEIO::Job*, const TQByteArray & datas );
00873 
00883     void slotFinalizeShowMail( TDEIO::Job* );
00884 
00892     void slotTimeout();
00893 
00902     void slotReceiveUID( TDEIO::Job*, const TQByteArray& data );
00903 
00911     void slotUIDsReceived( TDEIO::Job* job );
00912 
00921     void slotReceiveSize( TDEIO::Job*, const TQByteArray& data );
00922 
00929     void slotSizesReceived( TDEIO::Job* job );
00930 
00931 
00937     void slotFinalizeRefresh( TDEIO::Job* );
00938 
00954     void slotHeaderDownloaded( TDEIO::Job* job );
00955 
00964     void slotReceiveHeader( TDEIO::Job*, const TQByteArray& data );
00965 
00966 
00967   signals:
00968 
00973     void sigDeleteReady( TQString account );
00974 
00980     void sigShowBodiesReady( TQString account );
00981 
00985     void sigConfigChanged();
00986 
00990     void sigMessageWindowOpened();
00991 
00995     void sigMessageWindowClosed();
00996 
01001     void sigRefreshReady( TQString account );
01002 
01003   protected:
01004 
01010     bool isSpam( TQByteArray mail ) const;
01011 
01016     bool isSpamAssassinRunning() const;
01017 
01018 
01019 
01020 };
01021 #endif

Generated on Tue Apr 1 21:59:49 2008 for kshowmail.tdevelop by  doxygen 1.5.0