TDE personal information management applications
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.

networkaccount.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* -*- c++ -*-
  2. * networkaccount.h
  3. *
  4. * Copyright (c) 2000-2002 Michael Haeckel <haeckel@kde.org>
  5. * Copyright (c) 2002 Marc Mutz <mutz@kde.org>
  6. *
  7. * This file is based on work on pop3 and imap account implementations
  8. * by Don Sanders <sanders@kde.org> and Michael Haeckel <haeckel@kde.org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; version 2 of the License
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  22. */
  23. #ifndef __KMAIL_NETWORKACCOUNT_H__
  24. #define __KMAIL_NETWORKACCOUNT_H__
  25. #include <tqguardedptr.h>
  26. #include "kmaccount.h"
  27. #include "sieveconfig.h"
  28. #include <tqstring.h>
  29. class AccountManager;
  30. class TDEConfig/*Base*/;
  31. class KURL;
  32. namespace TDEIO {
  33. class Slave;
  34. class MetaData;
  35. }
  36. namespace KMail {
  37. class NetworkAccount : public KMAccount {
  38. Q_OBJECT
  39. protected:
  40. NetworkAccount( AccountManager * parent, const TQString & name, uint id );
  41. public:
  42. virtual ~NetworkAccount();
  43. /** Set the config options to a decent state */
  44. virtual void init();
  45. /** A weak assignment operator */
  46. virtual void pseudoAssign( const KMAccount * a );
  47. /** User login name */
  48. TQString login() const { return mLogin; }
  49. virtual void setLogin( const TQString & login );
  50. /** User password */
  51. TQString passwd() const;
  52. virtual void setPasswd( const TQString & passwd, bool storeInConfig=false );
  53. /**
  54. * Set the password to "" (empty string)
  55. */
  56. virtual void clearPasswd();
  57. /** authentication method */
  58. TQString auth() const { return mAuth; }
  59. virtual void setAuth( const TQString & auth );
  60. /** @return whether to store the password in the config file */
  61. bool storePasswd() const { return mStorePasswd; }
  62. virtual void setStorePasswd( bool store );
  63. /** Server hostname */
  64. TQString host() const { return mHost; }
  65. virtual void setHost( const TQString & host );
  66. /** Server port number */
  67. unsigned short int port() const { return mPort; }
  68. virtual void setPort( unsigned short int port );
  69. /** @return whether to use SSL */
  70. bool useSSL() const { return mUseSSL; }
  71. virtual void setUseSSL( bool use );
  72. /** @return whether to use TLS */
  73. bool useTLS() const { return mUseTLS; }
  74. virtual void setUseTLS( bool use );
  75. /** @return the SieveConfig for this account */
  76. KMail::SieveConfig sieveConfig() const { return mSieveConfig; }
  77. virtual void setSieveConfig( const KMail::SieveConfig & config );
  78. /** Configure the slave by adding to the meta data map */
  79. virtual TDEIO::MetaData slaveConfig() const;
  80. virtual void readConfig( /*const*/ TDEConfig/*Base*/ & config );
  81. virtual void writeConfig( TDEConfig/*Base*/ & config ) /*const*/;
  82. /** @return an URL for this account */
  83. virtual KURL getUrl() const;
  84. /** @return the TDEIO slave for this account */
  85. TDEIO::Slave * slave() const { return mSlave; }
  86. /** Kill all jobs that are currently in progress */
  87. virtual void killAllJobs( bool disconnectSlave = false ) = 0;
  88. /** Read password from wallet, used for on-demand wallet opening */
  89. void readPassword();
  90. virtual bool mailCheckCanProceed() const;
  91. virtual void setCheckingMail( bool checking );
  92. /** Reset connection list for the account */
  93. static void resetConnectionList( NetworkAccount* acct );
  94. protected:
  95. virtual TQString protocol() const = 0;
  96. virtual unsigned short int defaultPort() const = 0;
  97. protected:
  98. KMail::SieveConfig mSieveConfig;
  99. TQGuardedPtr<TDEIO::Slave> mSlave;
  100. TQString mLogin, mPasswd, mAuth, mHost;
  101. unsigned short int mPort;
  102. bool mStorePasswd : 1;
  103. bool mUseSSL : 1;
  104. bool mUseTLS : 1;
  105. bool mAskAgain : 1;
  106. bool mPasswdDirty, mStorePasswdInConfig;
  107. };
  108. } // namespace KMail
  109. #endif // __KMAIL_NETWORKACCOUNT_H__