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 
00055 namespace KMail {
00056   class FolderRequester; 
00068 class FolderDiaTab : public QWidget
00069 {
00070   Q_OBJECT
00071 public:
00072    FolderDiaTab( QWidget *parent=0, const char* name=0 )
00073      : QWidget( parent, name ) {}
00074 
00075   virtual void load() = 0;
00076 
00081   virtual bool save() = 0;
00082 
00083   enum AcceptStatus { Accepted, Canceled, Delayed };
00088   virtual AcceptStatus accept() {
00089     return save() ? Accepted : Canceled;
00090   }
00091 
00092 signals:
00095   void readyForAccept();
00096 
00099   void cancelAccept();
00100 
00102   void changed(bool);
00103 };
00104 
00109 class FolderDiaGeneralTab : public FolderDiaTab
00110 {
00111   Q_OBJECT
00112 
00113 public:
00114   FolderDiaGeneralTab( KMFolderDialog* dlg,
00115                        const QString& aName,
00116                        QWidget* parent, const char* name = 0 );
00117 
00118   virtual void load();
00119   virtual bool save();
00120 
00121 private slots:
00122   void slotChangeIcon( QString icon );
00123   /*
00124    * is called if the folder dropdown changes
00125    * then we update the other items to reflect the capabilities
00126    */
00127   void slotFolderNameChanged( const QString& );
00128   void slotFolderContentsSelectionChanged( int );
00129 
00130 private:
00131   void initializeWithValuesFromFolder( KMFolder* folder );
00132 
00133 private:
00134   QComboBox *mShowSenderReceiverComboBox;
00135   QComboBox *mContentsComboBox;
00136   QComboBox *mIncidencesForComboBox;
00137   QLabel      *mNormalIconLabel;
00138   KIconButton *mNormalIconButton;
00139   QLabel      *mUnreadIconLabel;
00140   KIconButton *mUnreadIconButton;
00141   QCheckBox   *mIconsCheckBox;
00142   QCheckBox   *mNewMailCheckBox;
00143   QCheckBox   *mNotifyOnNewMailCheckBox;
00144   QCheckBox   *mKeepRepliesInSameFolderCheckBox;
00145   KLineEdit   *mNameEdit;
00146 
00147   KPIM::IdentityCombo *mIdentityComboBox;
00148 
00149   KMFolderDialog* mDlg;
00150   bool mIsLocalSystemFolder;
00151 };
00152 
00153 } // end of namespace KMail
00154 
00158 class KMFolderDialog : public KDialogBase
00159 {
00160   Q_OBJECT
00161 
00162 public:
00163   KMFolderDialog( KMFolder *folder, KMFolderDir *aFolderDir,
00164           KMFolderTree* parent, const QString& caption,
00165                   const QString& name = QString::null );
00166 
00167   KMFolder* folder() const { return mFolder; }
00168   void setFolder( KMFolder* folder );
00169   // Was mFolder just created? (This only makes sense from save())
00170   // If Apply is clicked, or OK proceeeds half-way, then next time "new folder" will be false.
00171   bool isNewFolder() const { return mIsNewFolder; }
00172 
00173   KMFolderDir* folderDir() const { return mFolderDir; }
00174   typedef QValueList<QGuardedPtr<KMFolder> > FolderList;
00175 
00176   KMFolder* parentFolder() const { return mParentFolder; }
00177 
00178   KMFolderTree* folderTree() const { return mFolderTree; }
00179 
00180 protected slots:
00181   void slotChanged( bool );
00182   virtual void slotOk();
00183   virtual void slotApply();
00184 
00185   void slotReadyForAccept();
00186   void slotCancelAccept();
00187 
00188 private:
00189   void addTab( KMail::FolderDiaTab* tab );
00190 
00191 private:
00192   // Can be 0 initially when creating a folder, but will be set by save() in the first tab.
00193   QGuardedPtr<KMFolder> mFolder;
00194   QGuardedPtr<KMFolderDir> mFolderDir;
00195   QGuardedPtr<KMFolder> mParentFolder;
00196 
00197   bool mIsNewFolder; // if true, save() did set mFolder.
00198 
00199   QValueVector<KMail::FolderDiaTab*> mTabs;
00200   int mDelayedSavingTabs; // this should go into a base class one day
00201   KMFolderTree* mFolderTree;
00202 };
00203 
00204 #endif /*__KMFOLDERDIA*/
00205 
KDE Home | KDE Accessibility Home | Description of Access Keys