kmail Library API Documentation

kmfolderdia.h

00001 // -*- mode: C++; c-file-style: "gnu" -*-
00032 #ifndef __KMFOLDERDIA
00033 #define __KMFOLDERDIA
00034 
00035 #include "mailinglist-magic.h"
00036 using KMail::MailingList;
00037 
00038 #include <kdialogbase.h>
00039 #include "configuredialog_p.h"
00040 #include <qvaluevector.h>
00041 
00042 class QCheckBox;
00043 class QPushButton;
00044 class QLineEdit;
00045 class QListBox;
00046 class QComboBox;
00047 class QGroupBox;
00048 class KMFolder;
00049 class KMFolderTreeItem;
00050 class KMFolderDir;
00051 class KIntNumInput;
00052 class KIconButton;
00053 class KEditListBox;
00054 namespace KPIM { class IdentityCombo; }
00055 class KMFolderDialog;
00056 class KMFolderTree;
00057 template <typename T> class QGuardedPtr;
00058 
00059 namespace KMail {
00060 
00072 class FolderDiaTab : public QWidget
00073 {
00074   Q_OBJECT
00075 public:
00076    FolderDiaTab( QWidget *parent=0, const char* name=0 )
00077      : QWidget( parent, name ) {}
00078 
00079   virtual void load() = 0;
00080 
00085   virtual bool save() = 0;
00086 
00087   enum AcceptStatus { Accepted, Canceled, Delayed };
00092   virtual AcceptStatus accept() {
00093     return save() ? Accepted : Canceled;
00094   }
00095 
00096 signals:
00099   void readyForAccept();
00100 
00103   void cancelAccept();
00104 
00106   void changed(bool);
00107 };
00108 
00113 class FolderDiaGeneralTab : public FolderDiaTab
00114 {
00115   Q_OBJECT
00116 
00117 public:
00118   FolderDiaGeneralTab( KMFolderDialog* dlg,
00119                        const QString& aName,
00120                        QWidget* parent, const char* name = 0 );
00121 
00122   virtual void load();
00123   virtual bool save();
00124 
00125 private slots:
00126   void slotChangeIcon( QString icon );
00127   /*
00128    * is called if the folder dropdown changes
00129    * then we update the other items to reflect the capabilities
00130    */
00131   void slotUpdateItems( int );
00132   void slotFolderNameChanged( const QString& );
00133   void slotFolderContentsSelectionChanged( int );
00134 
00135 private:
00136   void initializeWithValuesFromFolder( KMFolder* folder );
00137 
00138 private:
00139   QComboBox *mBelongsToComboBox;
00140   QComboBox *mMailboxTypeComboBox;
00141   QComboBox *mShowSenderReceiverComboBox;
00142   QComboBox *mContentsComboBox;
00143   QLineEdit *mNameEdit;
00144   QLabel      *mNormalIconLabel;
00145   KIconButton *mNormalIconButton;
00146   QLabel      *mUnreadIconLabel;
00147   KIconButton *mUnreadIconButton;
00148   QCheckBox   *mIconsCheckBox;
00149   QCheckBox   *mNewMailCheckBox;
00150   QCheckBox   *mIgnoreNewMailCheckBox;
00151   QCheckBox   *mKeepRepliesInSameFolderCheckBox;
00152 
00153   KPIM::IdentityCombo *mIdentityComboBox;
00154   QGroupBox *mMailboxTypeGroupBox;
00155 
00156   KMFolderDialog* mDlg;
00157 };
00158 
00163 class FolderDiaExpiryTab : public FolderDiaTab
00164 {
00165   Q_OBJECT
00166 
00167 public:
00168   FolderDiaExpiryTab( KMFolderDialog* dlg,
00169                       QWidget* parent, const char* name = 0 );
00170 
00171   virtual void load();
00172   virtual bool save();
00173 
00174 private slots:
00175   void slotExpireFolder( bool );
00176   void slotReadExpiryUnitChanged( int );
00177   void slotUnreadExpiryUnitChanged( int );
00178 
00179 private:
00180 
00181 private:
00182   QCheckBox    *mExpireFolderCheckBox;
00183   KIntNumInput *mReadExpiryTimeNumInput, *mUnreadExpiryTimeNumInput;
00184   QComboBox    *mReadExpiryUnitsComboBox, *mUnreadExpiryUnitsComboBox;
00185   QRadioButton *mExpireActionDelete, *mExpireActionMove;
00186   QComboBox    *mExpireToFolderComboBox;
00187 
00188   KMFolderDialog* mDlg;
00189 };
00190 
00195 class FolderDiaMailingListTab : public FolderDiaTab
00196 {
00197   Q_OBJECT
00198 
00199 public:
00200   FolderDiaMailingListTab( KMFolderDialog* dlg, QWidget* parent, const char* name = 0 );
00201 
00202   virtual void load();
00203   virtual bool save();
00204 
00205 private slots:
00206   /*
00207    * Detects mailing-list related stuff
00208    */
00209   void slotDetectMailingList();
00210   void slotInvokeHandler();
00211   void slotMLHandling( int element );
00212   void slotHoldsML( bool holdsML );
00213   void slotAddressChanged( int addr );
00214 
00215 private:
00216   void fillMLFromWidgets();
00217   void fillEditBox();
00218 
00219   bool          mMLInfoChanged;
00220   QCheckBox    *mHoldsMailingList;
00221   QComboBox    *mMLHandlerCombo;
00222   QPushButton  *mDetectButton;
00223   QComboBox    *mAddressCombo;
00224   int           mLastItem;
00225   KEditListBox *mEditList;
00226   QLabel       *mMLId;
00227   MailingList   mMailingList;
00228 
00229   KMFolderDialog* mDlg;
00230 };
00231 
00232 } // end of namespace KMail
00233 
00237 class KMFolderDialog : public KDialogBase
00238 {
00239   Q_OBJECT
00240 
00241 public:
00242   KMFolderDialog( KMFolder *folder, KMFolderDir *aFolderDir,
00243           KMFolderTree* parent, const QString& caption,
00244                   const QString& name = QString::null );
00245 
00246   KMFolder* folder() const { return mFolder; }
00247   void setFolder( KMFolder* folder );
00248   // Was mFolder just created? (This only makes sense from save())
00249   // If Apply is clicked, or OK proceeeds half-way, then next time "new folder" will be false.
00250   bool isNewFolder() const { return mIsNewFolder; }
00251 
00252   KMFolderDir* folderDir() const { return mFolderDir; }
00253   typedef QValueList<QGuardedPtr<KMFolder> > FolderList;
00254 
00255   const FolderList& folders() const { return mFolders; }
00256   QStringList folderNameList() const { return mFolderNameList; }
00257 
00258   const FolderList& moveToFolderList() const { return mMoveToFolderList; }
00259   QStringList moveToFolderNameList() const { return mMoveToFolderNameList; }
00260 
00261   KMFolder* parentFolder() const { return mParentFolder; }
00262   int positionInFolderList() const { return mPositionInFolderList; }
00263 
00264 protected slots:
00265   void slotChanged( bool );
00266   virtual void slotOk();
00267   virtual void slotApply();
00268 
00269   void slotReadyForAccept();
00270   void slotCancelAccept();
00271 
00272 private:
00273   void addTab( KMail::FolderDiaTab* tab );
00274 
00275 private:
00276   // Can be 0 initially when creating a folder, but will be set by save() in the first tab.
00277   QGuardedPtr<KMFolder> mFolder;
00278   QGuardedPtr<KMFolderDir> mFolderDir;
00279   QGuardedPtr<KMFolder> mParentFolder;
00280 
00281   int mPositionInFolderList;
00282   FolderList mFolders; // list of possible "parent folders" for this folder
00283   QStringList mFolderNameList; // names of possible "parent folders" for this folder
00284 
00285   FolderList mMoveToFolderList; // list of all folders suitable for moving messages to them
00286   QStringList mMoveToFolderNameList; // names of all folders suitable for moving messages to them
00287 
00288   bool mIsNewFolder; // if true, save() did set mFolder.
00289 
00290   QValueVector<KMail::FolderDiaTab*> mTabs;
00291   int mDelayedSavingTabs; // this should go into a base class one day
00292 };
00293 
00294 #endif /*__KMFOLDERDIA*/
00295 
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Apr 4 04:48:26 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003