TDE personal information management applications
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

154 Zeilen
4.0KB

  1. /* -*- mode: C++ -*-
  2. * kmacctimap.h
  3. *
  4. * Copyright (c) 2000-2002 Michael Haeckel <haeckel@kde.org>
  5. *
  6. * This file is based on popaccount.h by Don Sanders
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; version 2 of the License
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef KMAcctImap_h
  22. #define KMAcctImap_h
  23. #include "imapaccountbase.h"
  24. #include <tqdict.h>
  25. class KMFolderImap;
  26. class KMFolderTreeItem;
  27. namespace KMail {
  28. class ImapJob;
  29. class ActionScheduler;
  30. }
  31. namespace TDEIO {
  32. class Job;
  33. }
  34. class FolderStorage;
  35. //-----------------------------------------------------------------------------
  36. class KMAcctImap: public KMail::ImapAccountBase
  37. {
  38. Q_OBJECT
  39. friend class KMail::ImapJob;
  40. public:
  41. virtual ~KMAcctImap();
  42. /** A weak assignment operator */
  43. virtual void pseudoAssign( const KMAccount * a );
  44. /**
  45. * Inherited methods.
  46. */
  47. virtual TQString type(void) const;
  48. virtual void processNewMail(bool);
  49. ConnectionState makeConnection();
  50. /**
  51. * Kill all jobs related the the specified folder/msg
  52. */
  53. virtual void ignoreJobsForMessage( KMMessage * msg );
  54. virtual void ignoreJobsForFolder( KMFolder * folder );
  55. virtual void removeSlaveJobsForFolder( KMFolder * folder );
  56. /**
  57. * Kill the slave if any jobs are active
  58. */
  59. virtual void killAllJobs( bool disconnectSlave=false );
  60. /**
  61. * Set the top level pseudo folder
  62. */
  63. virtual void setImapFolder(KMFolderImap *);
  64. /**
  65. * Starts the folderlisting for the root folder
  66. */
  67. virtual void listDirectory();
  68. /**
  69. * Read config file entries. This method is called by the account
  70. * manager when a new account is created. The config group is
  71. * already properly set by the caller.
  72. */
  73. virtual void readConfig(TDEConfig& config);
  74. /**
  75. * Returns the root folder of this account
  76. */
  77. virtual FolderStorage* rootFolder() const;
  78. /**
  79. * Queues a message for automatic filtering
  80. */
  81. void execFilters(TQ_UINT32 serNum);
  82. public slots:
  83. /**
  84. * updates the new-mail-check folderlist
  85. */
  86. void slotFiltered(TQ_UINT32 serNum);
  87. void slotUpdateFolderList();
  88. protected:
  89. friend class ::AccountManager;
  90. KMAcctImap(AccountManager* owner, const TQString& accountName, uint id);
  91. /**
  92. * Handle an error coming from a TDEIO job
  93. * See ImapAccountBase::handleJobError for details.
  94. */
  95. virtual bool handleError( int error, const TQString &errorMsg, TDEIO::Job* job, const TQString& context, bool abortSync = false );
  96. virtual void cancelMailCheck();
  97. TQPtrList<KMail::ImapJob> mJobList;
  98. TQGuardedPtr<KMFolderImap> mFolder;
  99. protected slots:
  100. /** new-mail-notification for the current folder (is called via folderComplete) */
  101. void postProcessNewMail(KMFolderImap*, bool);
  102. /**
  103. * new-mail-notification for not-selected folders (is called via
  104. * numUnreadMsgsChanged)
  105. */
  106. void postProcessNewMail( KMFolder * f );
  107. /**
  108. * hooked up to the progress item signaling cancellation.
  109. * Cleanup and reset state.
  110. */
  111. void slotMailCheckCanceled();
  112. /**
  113. * called to reset the connection error status
  114. */
  115. void slotResetConnectionError();
  116. /**
  117. * Slots for automatic filtering
  118. */
  119. void slotFolderSelected( KMFolderImap*, bool );
  120. int slotFilterMsg( KMMessage* );
  121. private:
  122. int mCountRemainChecks;
  123. /** used to reset connection errors */
  124. TQTimer mErrorTimer;
  125. TQValueList<TQ_UINT32> mFilterSerNums;
  126. TQDict<int> mFilterSerNumsToSave;
  127. KMail::ActionScheduler *mScheduler;
  128. };
  129. #endif /*KMAcctImap_h*/