00001
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
00129
00130
00131
void slotUpdateItems(
int );
00132
void slotFolderNameChanged(
const QString& );
00133
00134
private:
00135
void initializeWithValuesFromFolder(
KMFolder* folder );
00136
00137
private:
00138
QComboBox *mBelongsToComboBox;
00139
QComboBox *mMailboxTypeComboBox;
00140
QComboBox *mShowSenderReceiverComboBox;
00141
QComboBox *mContentsComboBox;
00142
QLineEdit *mNameEdit;
00143
QLabel *mNormalIconLabel;
00144 KIconButton *mNormalIconButton;
00145
QLabel *mUnreadIconLabel;
00146 KIconButton *mUnreadIconButton;
00147
QCheckBox *mIconsCheckBox;
00148
QCheckBox *mNewMailCheckBox;
00149
QCheckBox *mIgnoreNewMailCheckBox;
00150
QCheckBox *mKeepRepliesInSameFolderCheckBox;
00151
00152 KPIM::IdentityCombo *mIdentityComboBox;
00153
QGroupBox *mMailboxTypeGroupBox;
00154
00155
KMFolderDialog* mDlg;
00156 };
00157
00162 class FolderDiaExpiryTab :
public FolderDiaTab
00163 {
00164 Q_OBJECT
00165
00166
public:
00167
FolderDiaExpiryTab(
KMFolderDialog* dlg,
00168
QWidget* parent,
const char* name = 0 );
00169
00170
virtual void load();
00171
virtual bool save();
00172
00173
private slots:
00174
void slotExpireFolder(
bool );
00175
void slotReadExpiryUnitChanged(
int );
00176
void slotUnreadExpiryUnitChanged(
int );
00177
00178
private:
00179
00180
private:
00181
QCheckBox *mExpireFolderCheckBox;
00182 KIntNumInput *mReadExpiryTimeNumInput, *mUnreadExpiryTimeNumInput;
00183
QComboBox *mReadExpiryUnitsComboBox, *mUnreadExpiryUnitsComboBox;
00184
QRadioButton *mExpireActionDelete, *mExpireActionMove;
00185
QComboBox *mExpireToFolderComboBox;
00186
00187
KMFolderDialog* mDlg;
00188 };
00189
00194 class FolderDiaMailingListTab :
public FolderDiaTab
00195 {
00196 Q_OBJECT
00197
00198
public:
00199
FolderDiaMailingListTab(
KMFolderDialog* dlg,
QWidget* parent,
const char* name = 0 );
00200
00201
virtual void load();
00202
virtual bool save();
00203
00204
private slots:
00205
00206
00207
00208
void slotDetectMailingList();
00209
void slotInvokeHandler();
00210
void slotMLHandling(
int element );
00211
void slotHoldsML(
bool holdsML );
00212
void slotAddressChanged(
int addr );
00213
00214
private:
00215
void fillMLFromWidgets();
00216
void fillEditBox();
00217
00218
bool mMLInfoChanged;
00219
QCheckBox *mHoldsMailingList;
00220
QComboBox *mMLHandlerCombo;
00221
QPushButton *mDetectButton;
00222
QComboBox *mAddressCombo;
00223
int mLastItem;
00224 KEditListBox *mEditList;
00225
QLabel *mMLId;
00226
MailingList mMailingList;
00227
00228
KMFolderDialog* mDlg;
00229 };
00230
00231 }
00232
00236 class KMFolderDialog :
public KDialogBase
00237 {
00238 Q_OBJECT
00239
00240
public:
00241
KMFolderDialog(
KMFolder *folder,
KMFolderDir *aFolderDir,
00242 KMFolderTree* parent,
const QString& caption,
00243
const QString& name = QString::null );
00244
00245
KMFolder* folder()
const {
return mFolder; }
00246
void setFolder(
KMFolder* folder );
00247
00248
00249
bool isNewFolder()
const {
return mIsNewFolder; }
00250
00251
KMFolderDir* folderDir()
const {
return mFolderDir; }
00252
typedef QValueList<QGuardedPtr<KMFolder> >
FolderList;
00253
00254
const FolderList& folders()
const {
return mFolders; }
00255
QStringList folderNameList()
const {
return mFolderNameList; }
00256
00257
const FolderList& moveToFolderList()
const {
return mMoveToFolderList; }
00258
QStringList moveToFolderNameList()
const {
return mMoveToFolderNameList; }
00259
00260
KMFolder* parentFolder()
const {
return mParentFolder; }
00261
int positionInFolderList()
const {
return mPositionInFolderList; }
00262
00263
protected slots:
00264
void slotChanged(
bool );
00265
virtual void slotOk();
00266
virtual void slotApply();
00267
00268
void slotReadyForAccept();
00269
void slotCancelAccept();
00270
00271
private:
00272
void addTab(
KMail::FolderDiaTab* tab );
00273
00274
private:
00275
00276
QGuardedPtr<KMFolder> mFolder;
00277
QGuardedPtr<KMFolderDir> mFolderDir;
00278
QGuardedPtr<KMFolder> mParentFolder;
00279
00280
int mPositionInFolderList;
00281
FolderList mFolders;
00282
QStringList mFolderNameList;
00283
00284
FolderList mMoveToFolderList;
00285
QStringList mMoveToFolderNameList;
00286
00287
bool mIsNewFolder;
00288
00289
QValueVector<KMail::FolderDiaTab*> mTabs;
00290
int mDelayedSavingTabs;
00291 };
00292
00293
#endif
00294