kmail

kmfolderdia.h

00001 // -*- mode: C++; c-file-style: "gnu" -*-
00032 #ifndef __KMFOLDERDIA
00033 #define __KMFOLDERDIA
00034 
00035 #include <kdialogbase.h>
00036 #include "configuredialog_p.h"
00037 #include <qvaluevector.h>
00038 
00039 class QCheckBox;
00040 class QPushButton;
00041 class QLineEdit;
00042 class QListBox;
00043 class QComboBox;
00044 class KMFolder;
00045 class KMFolderTreeItem;
00046 class KMFolderDir;
00047 class KIntNumInput;
00048 class KIconButton;
00049 class KEditListBox;
00050 namespace KPIM { class IdentityCombo; }
00051 class KMFolderDialog;
00052 class KMFolderTree;
00053 template <typename T> class QGuardedPtr;
00054 class TemplatesConfiguration;
00055 class KPushButton;
00056 
00057 namespace KMail {
00058   class FolderRequester; 
00070 class FolderDiaTab : public QWidget
00071 {
00072   Q_OBJECT
00073 public:
00074    FolderDiaTab( QWidget *parent=0, const char* name=0 )
00075      : QWidget( parent, name ) {}
00076 
00077   virtual void load() = 0;
00078 
00083   virtual bool save() = 0;
00084 
00085   enum AcceptStatus { Accepted, Canceled, Delayed };
00090   virtual AcceptStatus accept() {
00091     return save() ? Accepted : Canceled;
00092   }
00093 
00094 signals:
00097   void readyForAccept();
00098 
00101   void cancelAccept();
00102 
00104   void changed(bool);
00105 };
00106 
00111 class FolderDiaGeneralTab : public FolderDiaTab
00112 {
00113   Q_OBJECT
00114 
00115 public:
00116   FolderDiaGeneralTab( KMFolderDialog* dlg,
00117                        const QString& aName,
00118                        QWidget* parent, const char* name = 0 );
00119 
00120   virtual void load();
00121   virtual bool save();
00122 
00123 private slots:
00124   void slotChangeIcon( QString icon );
00125   /*
00126    * is called if the folder dropdown changes
00127    * then we update the other items to reflect the capabilities
00128    */
00129   void slotFolderNameChanged( const QString& );
00130   void slotFolderContentsSelectionChanged( int );
00131 
00132 private:
00133   void initializeWithValuesFromFolder( KMFolder* folder );
00134 
00135 private:
00136   QComboBox *mShowSenderReceiverComboBox;
00137   QComboBox *mContentsComboBox;
00138   QComboBox *mIncidencesForComboBox;
00139   QLabel      *mNormalIconLabel;
00140   KIconButton *mNormalIconButton;
00141   QLabel      *mUnreadIconLabel;
00142   KIconButton *mUnreadIconButton;
00143   QCheckBox   *mIconsCheckBox;
00144   QCheckBox   *mNewMailCheckBox;
00145   QCheckBox   *mNotifyOnNewMailCheckBox;
00146   QCheckBox   *mKeepRepliesInSameFolderCheckBox;
00147   KLineEdit   *mNameEdit;
00148 
00149   KPIM::IdentityCombo *mIdentityComboBox;
00150 
00151   KMFolderDialog* mDlg;
00152   bool mIsLocalSystemFolder;
00153 };
00154 
00159 class FolderDiaTemplatesTab : public FolderDiaTab
00160 {
00161   Q_OBJECT
00162 
00163 public:
00164   FolderDiaTemplatesTab( KMFolderDialog* dlg,
00165                        const QString& aName,
00166                        QWidget* parent, const char* name = 0 );
00167 
00168   virtual void load();
00169   virtual bool save();
00170 
00171 public slots:
00172   void slotEmitChanged(); // do nothing for now
00173   
00174   void slotCopyGlobal();
00175 
00176 private:
00177   void initializeWithValuesFromFolder( KMFolder* folder );
00178 
00179 private:
00180   QCheckBox* mCustom;
00181   TemplatesConfiguration* mWidget;
00182   KPushButton* mCopyGlobal;
00183   KMFolder* mFolder;
00184   uint mIdentity;
00185 
00186   KMFolderDialog* mDlg;
00187   bool mIsLocalSystemFolder;
00188 };
00189 
00190 } // end of namespace KMail
00191 
00195 class KMFolderDialog : public KDialogBase
00196 {
00197   Q_OBJECT
00198 
00199 public:
00200   KMFolderDialog( KMFolder *folder, KMFolderDir *aFolderDir,
00201           KMFolderTree* parent, const QString& caption,
00202                   const QString& name = QString::null );
00203 
00204   KMFolder* folder() const { return mFolder; }
00205   void setFolder( KMFolder* folder );
00206   // Was mFolder just created? (This only makes sense from save())
00207   // If Apply is clicked, or OK proceeeds half-way, then next time "new folder" will be false.
00208   bool isNewFolder() const { return mIsNewFolder; }
00209 
00210   KMFolderDir* folderDir() const { return mFolderDir; }
00211   typedef QValueList<QGuardedPtr<KMFolder> > FolderList;
00212 
00213   KMFolder* parentFolder() const { return mParentFolder; }
00214 
00215   KMFolderTree* folderTree() const { return mFolderTree; }
00216 
00217 protected slots:
00218   void slotChanged( bool );
00219   virtual void slotOk();
00220   virtual void slotApply();
00221 
00222   void slotReadyForAccept();
00223   void slotCancelAccept();
00224 
00225 private:
00226   void addTab( KMail::FolderDiaTab* tab );
00227 
00228 private:
00229   // Can be 0 initially when creating a folder, but will be set by save() in the first tab.
00230   QGuardedPtr<KMFolder> mFolder;
00231   QGuardedPtr<KMFolderDir> mFolderDir;
00232   QGuardedPtr<KMFolder> mParentFolder;
00233 
00234   bool mIsNewFolder; // if true, save() did set mFolder.
00235 
00236   QValueVector<KMail::FolderDiaTab*> mTabs;
00237   int mDelayedSavingTabs; // this should go into a base class one day
00238   KMFolderTree* mFolderTree;
00239 };
00240 
00241 #endif /*__KMFOLDERDIA*/
00242 
KDE Home | KDE Accessibility Home | Description of Access Keys