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   QGroupBox *mIncidencesForGroup;
00144   QComboBox *mIncidencesForComboBox;
00145   QLineEdit *mNameEdit;
00146   QLabel      *mNormalIconLabel;
00147   KIconButton *mNormalIconButton;
00148   QLabel      *mUnreadIconLabel;
00149   KIconButton *mUnreadIconButton;
00150   QCheckBox   *mIconsCheckBox;
00151   QCheckBox   *mNewMailCheckBox;
00152   QCheckBox   *mIgnoreNewMailCheckBox;
00153   QCheckBox   *mKeepRepliesInSameFolderCheckBox;
00154 
00155   KPIM::IdentityCombo *mIdentityComboBox;
00156   QGroupBox *mMailboxTypeGroupBox;
00157 
00158   KMFolderDialog* mDlg;
00159 };
00160 
00165 class FolderDiaExpiryTab : public FolderDiaTab
00166 {
00167   Q_OBJECT
00168 
00169 public:
00170   FolderDiaExpiryTab( KMFolderDialog* dlg,
00171                       QWidget* parent, const char* name = 0 );
00172 
00173   virtual void load();
00174   virtual bool save();
00175 
00176 private slots:
00177   void slotExpireFolder( bool );
00178   void slotReadExpiryUnitChanged( int );
00179   void slotUnreadExpiryUnitChanged( int );
00180 
00181 private:
00182 
00183 private:
00184   QCheckBox    *mExpireFolderCheckBox;
00185   KIntNumInput *mReadExpiryTimeNumInput, *mUnreadExpiryTimeNumInput;
00186   QComboBox    *mReadExpiryUnitsComboBox, *mUnreadExpiryUnitsComboBox;
00187   QRadioButton *mExpireActionDelete, *mExpireActionMove;
00188   QComboBox    *mExpireToFolderComboBox;
00189 
00190   KMFolderDialog* mDlg;
00191 };
00192 
00197 class FolderDiaMailingListTab : public FolderDiaTab
00198 {
00199   Q_OBJECT
00200 
00201 public:
00202   FolderDiaMailingListTab( KMFolderDialog* dlg, QWidget* parent, const char* name = 0 );
00203 
00204   virtual void load();
00205   virtual bool save();
00206 
00207 private slots:
00208   /*
00209    * Detects mailing-list related stuff
00210    */
00211   void slotDetectMailingList();
00212   void slotInvokeHandler();
00213   void slotMLHandling( int element );
00214   void slotHoldsML( bool holdsML );
00215   void slotAddressChanged( int addr );
00216 
00217 private:
00218   void fillMLFromWidgets();
00219   void fillEditBox();
00220 
00221   bool          mMLInfoChanged;
00222   QCheckBox    *mHoldsMailingList;
00223   QComboBox    *mMLHandlerCombo;
00224   QPushButton  *mDetectButton;
00225   QComboBox    *mAddressCombo;
00226   int           mLastItem;
00227   KEditListBox *mEditList;
00228   QLabel       *mMLId;
00229   MailingList   mMailingList;
00230 
00231   KMFolderDialog* mDlg;
00232 };
00233 
00234 } // end of namespace KMail
00235 
00239 class KMFolderDialog : public KDialogBase
00240 {
00241   Q_OBJECT
00242 
00243 public:
00244   KMFolderDialog( KMFolder *folder, KMFolderDir *aFolderDir,
00245           KMFolderTree* parent, const QString& caption,
00246                   const QString& name = QString::null );
00247 
00248   KMFolder* folder() const { return mFolder; }
00249   void setFolder( KMFolder* folder );
00250   // Was mFolder just created? (This only makes sense from save())
00251   // If Apply is clicked, or OK proceeeds half-way, then next time "new folder" will be false.
00252   bool isNewFolder() const { return mIsNewFolder; }
00253 
00254   KMFolderDir* folderDir() const { return mFolderDir; }
00255   typedef QValueList<QGuardedPtr<KMFolder> > FolderList;
00256 
00257   const FolderList& folders() const { return mFolders; }
00258   QStringList folderNameList() const { return mFolderNameList; }
00259 
00260   const FolderList& moveToFolderList() const { return mMoveToFolderList; }
00261   QStringList moveToFolderNameList() const { return mMoveToFolderNameList; }
00262 
00263   KMFolder* parentFolder() const { return mParentFolder; }
00264   int positionInFolderList() const { return mPositionInFolderList; }
00265 
00266 protected slots:
00267   void slotChanged( bool );
00268   virtual void slotOk();
00269   virtual void slotApply();
00270 
00271   void slotReadyForAccept();
00272   void slotCancelAccept();
00273 
00274 private:
00275   void addTab( KMail::FolderDiaTab* tab );
00276 
00277 private:
00278   // Can be 0 initially when creating a folder, but will be set by save() in the first tab.
00279   QGuardedPtr<KMFolder> mFolder;
00280   QGuardedPtr<KMFolderDir> mFolderDir;
00281   QGuardedPtr<KMFolder> mParentFolder;
00282 
00283   int mPositionInFolderList;
00284   FolderList mFolders; // list of possible "parent folders" for this folder
00285   QStringList mFolderNameList; // names of possible "parent folders" for this folder
00286 
00287   FolderList mMoveToFolderList; // list of all folders suitable for moving messages to them
00288   QStringList mMoveToFolderNameList; // names of all folders suitable for moving messages to them
00289 
00290   bool mIsNewFolder; // if true, save() did set mFolder.
00291 
00292   QValueVector<KMail::FolderDiaTab*> mTabs;
00293   int mDelayedSavingTabs; // this should go into a base class one day
00294 };
00295 
00296 #endif /*__KMFOLDERDIA*/
00297 
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 Fri Dec 21 14:24:52 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003