korganizer
koeditorattachments.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef KOEDITORATTACHMENTS_H
00027 #define KOEDITORATTACHMENTS_H
00028
00029 #include <kdialog.h>
00030 #include <kmimetype.h>
00031 #include <kurl.h>
00032
00033 #include <QWidget>
00034 #include <QDragEnterEvent>
00035 #include <Q3ValueList>
00036 #include <QLabel>
00037 #include <QDropEvent>
00038
00039 namespace KCal {
00040 class Incidence;
00041 class Attachment;
00042 }
00043
00044 class KJob;
00045 class AttachmentIconItem;
00046 class Q3IconDragItem;
00047 class Q3IconViewItem;
00048 class QLabel;
00049 class KLineEdit;
00050 class K3IconView;
00051 class KMenu;
00052 class KUrlRequester;
00053 class QCheckBox;
00054 class AttachmentIconView;
00055 class QMimeSource;
00056 class QPushButton;
00057 class KAction;
00058
00059 namespace KIO {
00060 class Job;
00061 }
00062
00063 class AttachmentEditDialog : public KDialog
00064 {
00065 Q_OBJECT
00066 public:
00067 AttachmentEditDialog( AttachmentIconItem *item,
00068 QWidget *parent, bool modal=true );
00069
00070 void accept();
00071
00072 protected slots:
00073 void urlChanged( const KUrl &url );
00074 virtual void slotApply();
00075
00076 private:
00077 KMimeType::Ptr mMimeType;
00078 AttachmentIconItem *mItem;
00079 QLabel *mTypeLabel, *mIcon;
00080 KLineEdit *mLabelEdit;
00081 KUrlRequester *mURLRequester;
00082 QCheckBox *mInline;
00083 };
00084
00085 class KOEditorAttachments : public QWidget
00086 {
00087 Q_OBJECT
00088 public:
00089 explicit KOEditorAttachments( int spacing = 8, QWidget *parent = 0 );
00090 ~KOEditorAttachments();
00091
00092 void addAttachment( const QString &uri,
00093 const QString &mimeType = QString(),
00094 const QString &label = QString(),
00095 bool binary = false );
00096 void addAttachment( KCal::Attachment *attachment );
00097 void addAttachment( const QByteArray &data,
00098 const QString &mimeType = QString(),
00099 const QString &label = QString() );
00100
00102 void setDefaults();
00104 void readIncidence( KCal::Incidence * );
00106 void writeIncidence( KCal::Incidence * );
00107
00108 bool hasAttachments();
00109
00110 public slots:
00112 void applyChanges();
00113
00114 protected slots:
00115 void showAttachment( Q3IconViewItem *item );
00116 void slotAdd();
00117 void slotEdit();
00118 void slotRemove();
00119 void slotShow();
00120 void dragEnterEvent( QDragEnterEvent *event );
00121 void dropEvent( QDropEvent *event );
00122 void slotItemRenamed ( Q3IconViewItem * item, const QString & text );
00123 void dropped ( QDropEvent * e, const Q3ValueList<Q3IconDragItem> & lst );
00124 void downloadComplete( KJob *job );
00125 void slotCopy();
00126 void slotCut();
00127 void slotPaste();
00128 void selectionChanged();
00129 void contextMenu( Q3IconViewItem *item, const QPoint &pos );
00130
00131 signals:
00132 void openURL( const KUrl &url );
00133
00134 private:
00135 void handlePasteOrDrop( const QMimeData *mimeData );
00136
00137 AttachmentIconView *mAttachments;
00138 KMenu *mPopupMenu;
00139 QString mUid;
00140 QPushButton *mRemoveBtn;
00141 KAction *mOpenAction, *mCopyAction, *mCutAction,
00142 *mDeleteAction, *mEditAction;
00143 };
00144
00145 #endif