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   QCheckBox *mAlarmsBlockedCheckBox;
00140   QCheckBox *mSharedSeenFlagsCheckBox;
00141   QLabel      *mNormalIconLabel;
00142   KIconButton *mNormalIconButton;
00143   QLabel      *mUnreadIconLabel;
00144   KIconButton *mUnreadIconButton;
00145   QCheckBox   *mIconsCheckBox;
00146   QCheckBox   *mNewMailCheckBox;
00147   QCheckBox   *mNotifyOnNewMailCheckBox;
00148   QCheckBox   *mKeepRepliesInSameFolderCheckBox;
00149   KLineEdit   *mNameEdit;
00150 
00151   KPIM::IdentityCombo *mIdentityComboBox;
00152 
00153   KMFolderDialog* mDlg;
00154   bool mIsLocalSystemFolder;
00155   bool mIsResourceFolder;
00156 };
00157 
00162 class FolderDiaTemplatesTab : public FolderDiaTab
00163 {
00164   Q_OBJECT
00165 
00166 public:
00167   FolderDiaTemplatesTab( KMFolderDialog *dlg, QWidget *parent );
00168 
00169   virtual void load();
00170   virtual bool save();
00171 
00172 public slots:
00173   void slotEmitChanged(); // do nothing for now
00174 
00175   void slotCopyGlobal();
00176 
00177 private:
00178   void initializeWithValuesFromFolder( KMFolder* folder );
00179 
00180 private:
00181   QCheckBox* mCustom;
00182   TemplatesConfiguration* mWidget;
00183   KPushButton* mCopyGlobal;
00184   KMFolder* mFolder;
00185   uint mIdentity;
00186 
00187   KMFolderDialog* mDlg;
00188   bool mIsLocalSystemFolder;
00189 };
00190 
00191 } // end of namespace KMail
00192 
00196 class KMFolderDialog : public KDialogBase
00197 {
00198   Q_OBJECT
00199 
00200 public:
00201   KMFolderDialog( KMFolder *folder, KMFolderDir *aFolderDir,
00202           KMFolderTree* parent, const QString& caption,
00203                   const QString& name = QString::null );
00204 
00205   KMFolder* folder() const { return mFolder; }
00206   void setFolder( KMFolder* folder );
00207   // Was mFolder just created? (This only makes sense from save())
00208   // If Apply is clicked, or OK proceeeds half-way, then next time "new folder" will be false.
00209   bool isNewFolder() const { return mIsNewFolder; }
00210 
00211   KMFolderDir* folderDir() const { return mFolderDir; }
00212   typedef QValueList<QGuardedPtr<KMFolder> > FolderList;
00213 
00214   KMFolder* parentFolder() const { return mParentFolder; }
00215 
00216   KMFolderTree* folderTree() const { return mFolderTree; }
00217 
00218 protected slots:
00219   void slotChanged( bool );
00220   virtual void slotOk();
00221   virtual void slotApply();
00222 
00223   void slotReadyForAccept();
00224   void slotCancelAccept();
00225 
00226 private:
00227   void addTab( KMail::FolderDiaTab* tab );
00228 
00229 private:
00230   // Can be 0 initially when creating a folder, but will be set by save() in the first tab.
00231   QGuardedPtr<KMFolder> mFolder;
00232   QGuardedPtr<KMFolderDir> mFolderDir;
00233   QGuardedPtr<KMFolder> mParentFolder;
00234 
00235   bool mIsNewFolder; // if true, save() did set mFolder.
00236 
00237   QValueVector<KMail::FolderDiaTab*> mTabs;
00238   int mDelayedSavingTabs; // this should go into a base class one day
00239   KMFolderTree* mFolderTree;
00240 };
00241 
00242 #endif /*__KMFOLDERDIA*/
00243 
KDE Home | KDE Accessibility Home | Description of Access Keys