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.

accountmanager.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef MK_ACCOUNTMANAGER_H
  19. #define MK_ACCOUNTMANAGER_H
  20. #include <tqobject.h>
  21. class DCOPDrop;
  22. class KornSubjectsDlg;
  23. class KKioDrop;
  24. class KMailDrop;
  25. class TDEConfig;
  26. template< class T > class TQPtrList;
  27. template< class T, class W > class TQMap;
  28. /**
  29. * This class manage the different accounts.
  30. *
  31. * This class reads the config and makes the accounts,
  32. * and it communicate with the boxes.
  33. */
  34. class AccountManager : public TQObject
  35. { Q_OBJECT
  36. public:
  37. /**
  38. * Constructor, parameters are directed to TQObject.
  39. */
  40. AccountManager( TQObject * parent = 0, const char * name = 0 );
  41. /**
  42. * Destructor
  43. */
  44. ~AccountManager();
  45. /**
  46. * This function is used to read the config.
  47. *
  48. * @param config The TDEConfig instance to the configuration
  49. * @param index The index of the box. As there are different boxes,
  50. * every box have it's own index. This number is used to get the
  51. * right config-information out of the config parameter.
  52. */
  53. virtual void readConfig( TDEConfig* config, const int index );
  54. /**
  55. * This write the configuration into a file. Things that must be right is
  56. * for example the reset number. The configuration isn't saved through this
  57. * method; configurations are saved in the configurations classes.
  58. *
  59. * @param config The TDEConfig instance to which the configuration is written.
  60. * @param index The index of the box.
  61. */
  62. virtual void writeConfig( TDEConfig* config, const int index );
  63. /**
  64. * This method makes a TQString which can be used for a tooltip.
  65. * In it, all accounts are summed and the number of new messages of
  66. * every account is added.
  67. *
  68. * @return A string that can be used for the Tooltip of the box.
  69. */
  70. TQString getTooltip() const;
  71. protected:
  72. /**
  73. * This function is called when the number of emails has changed.
  74. * Boxes must override this method and update the information.
  75. *
  76. * @param numberOfNewMessages The number of unread messages.
  77. * @param newMessages Are there any new messages (important for displaying it)?
  78. */
  79. virtual void setCount( int numberOfNewMessages, bool newMessages ) = 0;
  80. /**
  81. * This functions sets a new Tooltip. Boxes must override this method
  82. * @param tooltip The tooltip to be set.
  83. */
  84. virtual void setTooltip( const TQString& tooltip ) = 0;
  85. /**
  86. * This funtion is called if @p command have to be executed.
  87. * For example, if new email has arrived, and the user setuped KOrn
  88. * to execute a command. Boxes must override this function.
  89. */
  90. virtual void runCommand( const TQString& command ) = 0;
  91. /**
  92. * This function can be called by classes that inherit this class.
  93. * If this function is called, all account which are part of this
  94. * box are rechecked.
  95. */
  96. void doRecheck();
  97. /**
  98. * If this method is called, the number of new messages of all of its account
  99. * is resetted.
  100. */
  101. void doReset();
  102. /**
  103. * If this function is called, a windows with shows the message headers will popup.
  104. */
  105. void doView();
  106. /**
  107. * These functions are called if the user wants to start or stop the account being triggered.
  108. */
  109. void doStartTimer();
  110. void doStopTimer();
  111. private:
  112. struct Dropinfo
  113. {
  114. int index;
  115. int msgnr;
  116. bool newMessages;
  117. int reset;
  118. };
  119. TQPtrList< KMailDrop > *_kioList;
  120. TQPtrList< DCOPDrop > *_dcopList;
  121. TQMap< KMailDrop*, Dropinfo* > *_dropInfo;
  122. static KornSubjectsDlg *_subjectsDlg;
  123. private:
  124. int totalMessages();
  125. bool hasNewMessages();
  126. void playSound( const TQString& );
  127. private slots:
  128. void slotChanged( int, KMailDrop* );
  129. void slotValidChanged( bool );
  130. };
  131. #endif //MK_ACCOUNTMANAGER_H