kmail
customtemplates.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #ifndef CUSTOMTEMPLATES_H
00024 #define CUSTOMTEMPLATES_H
00025
00026 #include "customtemplates_base.h"
00027 #include "templatesinsertcommand.h"
00028
00029 #include <kshortcut.h>
00030
00031 struct CustomTemplateItem;
00032 typedef QDict<CustomTemplateItem> CustomTemplateItemList;
00033 class KShortcut;
00034
00035 class CustomTemplates : public CustomTemplatesBase
00036 {
00037 Q_OBJECT
00038
00039 public:
00040
00041 enum Type { TUniversal, TReply, TReplyAll, TForward };
00042
00043 public:
00044
00045 CustomTemplates( QWidget *parent = 0, const char *name = 0 );
00046 ~CustomTemplates();
00047
00048 void load();
00049 void save();
00050
00051 QString indexToType( int index );
00052
00053 public slots:
00054
00055 void slotInsertCommand( QString cmd, int adjustCursor = 0 );
00056
00057 void slotTextChanged();
00058
00059 void slotAddClicked();
00060 void slotRemoveClicked();
00061 void slotListSelectionChanged();
00062 void slotTypeActivated( int index );
00063 void slotShortcutCaptured( const KShortcut &shortcut );
00064 void slotNameChanged( const QString& );
00065 signals:
00066
00067 void changed();
00068
00069 protected:
00070
00071 void setRecipientsEditsEnabled( bool enabled );
00072
00073 QListViewItem *mCurrentItem;
00074 CustomTemplateItemList mItemList;
00075
00077 QStringList mItemsToDelete;
00078
00079 QPixmap mReplyPix;
00080 QPixmap mReplyAllPix;
00081 QPixmap mForwardPix;
00082
00085 bool mBlockChangeSignal;
00086
00087 };
00088
00089 struct CustomTemplateItem
00090 {
00091 CustomTemplateItem() {}
00092 CustomTemplateItem( const QString &name,
00093 const QString &content,
00094 KShortcut &shortcut,
00095 CustomTemplates::Type type,
00096 QString to, QString cc ) :
00097 mName( name ), mContent( content ), mShortcut(shortcut), mType( type ),
00098 mTo( to ), mCC( cc ) {}
00099
00100 QString mName, mContent;
00101 KShortcut mShortcut;
00102 CustomTemplates::Type mType;
00103 QString mTo, mCC;
00104 };
00105
00106 #endif // CUSTOMTEMPLATES_H
|