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.

folderdiaacltab.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // -*- mode: C++; c-file-style: "gnu" -*-
  2. /**
  3. * folderdiaacltab.h
  4. *
  5. * Copyright (c) 2004 David Faure <faure@kde.org>
  6. *
  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. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of this program with any edition of
  23. * the TQt library by Trolltech AS, Norway (or with modified versions
  24. * of TQt that use the same license as TQt), and distribute linked
  25. * combinations including the two. You must obey the GNU General
  26. * Public License in all respects for all of the code used other than
  27. * TQt. If you modify this file, you may extend this exception to
  28. * your version of the file, but you are not obligated to do so. If
  29. * you do not wish to do so, delete this exception statement from
  30. * your version.
  31. */
  32. #ifndef FOLDERDIAACL_H
  33. #define FOLDERDIAACL_H
  34. #include "kmfolderdia.h"
  35. #include "acljobs.h"
  36. #include "kmfoldertype.h"
  37. class KMFolderImap;
  38. class KPushButton;
  39. class TQWidgetStack;
  40. class TQHBox;
  41. class TQVButtonGroup;
  42. class TDEListView;
  43. namespace TDEIO { class Job; }
  44. namespace KMail {
  45. enum IMAPUserIdFormat { FullEmail, UserName };
  46. struct ACLListEntry;
  47. typedef TQValueVector<KMail::ACLListEntry> ACLList;
  48. class ImapAccountBase;
  49. /**
  50. * "New Access Control Entry" dialog.
  51. * Internal class, only used by FolderDiaACLTab
  52. */
  53. class ACLEntryDialog :public KDialogBase {
  54. Q_OBJECT
  55. public:
  56. ACLEntryDialog( IMAPUserIdFormat userIdFormat, const TQString& caption, TQWidget* parent, const char* name = 0 );
  57. void setValues( const TQString& userId, unsigned int permissions );
  58. TQString userId() const;
  59. TQStringList userIds() const;
  60. unsigned int permissions() const;
  61. private slots:
  62. void slotSelectAddresses();
  63. void slotChanged();
  64. private:
  65. TQVButtonGroup* mButtonGroup;
  66. KLineEdit* mUserIdLineEdit;
  67. IMAPUserIdFormat mUserIdFormat;
  68. };
  69. /**
  70. * "Access Control" tab in the folder dialog
  71. * Internal class, only used by KMFolderDialog
  72. */
  73. class FolderDiaACLTab : public FolderDiaTab
  74. {
  75. Q_OBJECT
  76. public:
  77. FolderDiaACLTab( KMFolderDialog* dlg, TQWidget* parent, const char* name = 0 );
  78. virtual void load();
  79. virtual bool save();
  80. virtual AccepStatus accept();
  81. static bool supports( KMFolder* refFolder );
  82. private slots:
  83. // Network (TDEIO) slots
  84. void slotConnectionResult( int, const TQString& );
  85. void slotReceivedACL( KMFolder*, TDEIO::Job*, const KMail::ACLList& );
  86. void slotMultiSetACLResult(TDEIO::Job *);
  87. void slotACLChanged( const TQString&, int );
  88. void slotReceivedUserRights( KMFolder* folder );
  89. void slotDirectoryListingFinished(KMFolderImap*);
  90. // User (TDEListView) slots
  91. void slotEditACL(TQListViewItem*);
  92. void slotSelectionChanged(TQListViewItem*);
  93. // User (pushbuttons) slots
  94. void slotAddACL();
  95. void slotEditACL();
  96. void slotRemoveACL();
  97. void slotChanged( bool b );
  98. private:
  99. KURL imapURL() const;
  100. void initializeWithValuesFromFolder( KMFolder* folder );
  101. void startListing();
  102. void loadListView( const KMail::ACLList& aclList );
  103. void loadFinished( const KMail::ACLList& aclList );
  104. void addACLs( const TQStringList& userIds, unsigned int permissions );
  105. private:
  106. // The widget containing the ACL widgets (listview and buttons)
  107. TQHBox* mACLWidget;
  108. //class ListView;
  109. class ListViewItem;
  110. TDEListView* mListView;
  111. KPushButton* mAddACL;
  112. KPushButton* mEditACL;
  113. KPushButton* mRemoveACL;
  114. TQStringList mRemovedACLs;
  115. TQString mImapPath;
  116. ImapAccountBase* mImapAccount;
  117. int mUserRights;
  118. KMail::ACLJobs::ACLFetchState mUserRightsState;
  119. KMFolderType mFolderType;
  120. ACLList mInitialACLList;
  121. ACLList mACLList; // to be set
  122. IMAPUserIdFormat mUserIdFormat;
  123. TQLabel* mLabel;
  124. TQWidgetStack* mStack;
  125. KMFolderDialog* mDlg;
  126. bool mChanged;
  127. bool mAccepting; // i.e. close when done
  128. bool mSaving;
  129. };
  130. } // end of namespace KMail
  131. #endif /* FOLDERDIAACL_H */