kmail

kmfolderdia.h
1 // -*- mode: C++; c-file-style: "gnu" -*-
32 #ifndef __KMFOLDERDIA
33 #define __KMFOLDERDIA
34 
35 #include <kdialogbase.h>
36 #include "configuredialog_p.h"
37 #include <tqvaluevector.h>
38 
39 class TQCheckBox;
40 class TQPushButton;
41 class TQLineEdit;
42 class TQListBox;
43 class TQComboBox;
44 class KMFolder;
45 class KMFolderTreeItem;
46 class KMFolderDir;
47 class KIntNumInput;
48 class KIconButton;
49 class KEditListBox;
50 namespace KPIM { class IdentityCombo; }
51 class KMFolderDialog;
52 class KMFolderTree;
53 template <typename T> class TQGuardedPtr;
54 class TemplatesConfiguration;
55 class KPushButton;
56 
57 namespace KMail {
58  class FolderRequester;
70 class FolderDiaTab : public TQWidget
71 {
72  Q_OBJECT
73  TQ_OBJECT
74 public:
75  FolderDiaTab( TQWidget *parent=0, const char* name=0 )
76  : TQWidget( parent, name ) {}
77 
78  virtual void load() = 0;
79 
84  virtual bool save() = 0;
85 
86  enum AccepStatus { Accepted, Canceled, Delayed };
91  virtual AccepStatus accept() {
92  return save() ? Accepted : Canceled;
93  }
94 
95 signals:
98  void readyForAccept();
99 
102  void cancelAccept();
103 
105  void changed(bool);
106 };
107 
113 {
114  Q_OBJECT
115  TQ_OBJECT
116 
117 public:
119  const TQString& aName,
120  TQWidget* parent, const char* name = 0 );
121 
122  virtual void load();
123  virtual bool save();
124 
125 private slots:
126  void slotChangeIcon( TQString icon );
127  /*
128  * is called if the folder dropdown changes
129  * then we update the other items to reflect the capabilities
130  */
131  void slotFolderNameChanged( const TQString& );
132  void slotFolderContentsSelectionChanged( int );
133 
134 private:
135  void initializeWithValuesFromFolder( KMFolder* folder );
136 
137 private:
138  TQComboBox *mShowSenderReceiverComboBox;
139  TQComboBox *mContentsComboBox;
140  TQComboBox *mIncidencesForComboBox;
141  TQCheckBox *mAlarmsBlockedCheckBox;
142  TQCheckBox *mSharedSeenFlagsCheckBox;
143  TQLabel *mNormalIconLabel;
144  KIconButton *mNormalIconButton;
145  TQLabel *mUnreadIconLabel;
146  KIconButton *mUnreadIconButton;
147  TQCheckBox *mIconsCheckBox;
148  TQCheckBox *mNewMailCheckBox;
149  TQCheckBox *mNotifyOnNewMailCheckBox;
150  TQCheckBox *mKeepRepliesInSameFolderCheckBox;
151  KLineEdit *mNameEdit;
152 
153  KPIM::IdentityCombo *mIdentityComboBox;
154 
155  KMFolderDialog* mDlg;
156  bool mIsLocalSystemFolder;
157  bool mIsResourceFolder;
158 };
159 
165 {
166  Q_OBJECT
167  TQ_OBJECT
168 
169 public:
170  FolderDiaTemplatesTab( KMFolderDialog *dlg, TQWidget *parent );
171 
172  virtual void load();
173  virtual bool save();
174 
175 public slots:
176  void slotEmitChanged(); // do nothing for now
177 
178  void slotCopyGlobal();
179 
180 private:
181  void initializeWithValuesFromFolder( KMFolder* folder );
182 
183 private:
184  TQCheckBox* mCustom;
185  TemplatesConfiguration* mWidget;
186  KPushButton* mCopyGlobal;
187  KMFolder* mFolder;
188  uint mIdentity;
189 
190  KMFolderDialog* mDlg;
191  bool mIsLocalSystemFolder;
192 };
193 
194 } // end of namespace KMail
195 
199 class KMFolderDialog : public KDialogBase
200 {
201  Q_OBJECT
202  TQ_OBJECT
203 
204 public:
205  KMFolderDialog( KMFolder *folder, KMFolderDir *aFolderDir,
206  KMFolderTree* parent, const TQString& caption,
207  const TQString& name = TQString() );
208 
209  KMFolder* folder() const { return mFolder; }
210  void setFolder( KMFolder* folder );
211  // Was mFolder just created? (This only makes sense from save())
212  // If Apply is clicked, or OK proceeeds half-way, then next time "new folder" will be false.
213  bool isNewFolder() const { return mIsNewFolder; }
214 
215  KMFolderDir* folderDir() const { return mFolderDir; }
216  typedef TQValueList<TQGuardedPtr<KMFolder> > FolderList;
217 
218  KMFolder* parentFolder() const { return mParentFolder; }
219 
220  KMFolderTree* folderTree() const { return mFolderTree; }
221 
222 protected slots:
223  void slotChanged( bool );
224  virtual void slotOk();
225  virtual void slotApply();
226 
227  void slotReadyForAccept();
228  void slotCancelAccept();
229 
230 private:
231  void addTab( KMail::FolderDiaTab* tab );
232 
233 private:
234  // Can be 0 initially when creating a folder, but will be set by save() in the first tab.
235  TQGuardedPtr<KMFolder> mFolder;
236  TQGuardedPtr<KMFolderDir> mFolderDir;
237  TQGuardedPtr<KMFolder> mParentFolder;
238 
239  bool mIsNewFolder; // if true, save() did set mFolder.
240 
241  TQValueVector<KMail::FolderDiaTab*> mTabs;
242  int mDelayedSavingTabs; // this should go into a base class one day
243  KMFolderTree* mFolderTree;
244 };
245 
246 #endif /*__KMFOLDERDIA*/
247