25 #ifndef KOEDITORATTACHMENTS_H
26 #define KOEDITORATTACHMENTS_H
30 #include <kdialogbase.h>
31 #include <kmimetype.h>
33 #include <kiconview.h>
37 class AttachmentListItem;
38 class AttachmentIconView;
57 class AttachmentEditDialog :
public KDialogBase
62 AttachmentEditDialog( AttachmentListItem *item, TQWidget *parent=0 );
67 void urlSelected(
const TQString &url );
68 void urlChanged(
const TQString & url );
69 virtual void slotApply();
72 friend class KOEditorAttachments;
73 KMimeType::Ptr mMimeType;
74 AttachmentListItem *mItem;
75 TQLabel *mTypeLabel, *mIcon;
77 KLineEdit *mLabelEdit;
78 KURLRequester *mURLRequester;
81 class KOEditorAttachments :
public TQWidget
86 KOEditorAttachments(
int spacing = 8, TQWidget *parent = 0,
87 const char *name = 0 );
88 ~KOEditorAttachments();
90 void addUriAttachment(
const TQString &uri,
91 const TQString &mimeType = TQString(),
92 const TQString &label = TQString(),
93 bool inLine =
false );
95 void addDataAttachment(
const TQByteArray &data,
96 const TQString &mimeType = TQString(),
97 const TQString &label = TQString() );
106 bool hasAttachments();
109 void showAttachment( TQIconViewItem *item );
110 void saveAttachment( TQIconViewItem *item );
117 void dragEnterEvent( TQDragEnterEvent *event );
118 void dragMoveEvent( TQDragMoveEvent *event );
119 void dropEvent( TQDropEvent *event );
123 void selectionChanged();
124 void contextMenu( TQIconViewItem* item,
const TQPoint &pos );
127 void openURL(
const KURL &url );
137 friend class AttachmentIconView;
138 void handlePasteOrDrop( TQMimeSource* source );
139 TQString randomString(
int length )
const;
140 AttachmentIconView *mAttachments;
141 TQPushButton *mRemoveBtn;
142 TQPopupMenu *mContextMenu, *mAddMenu;
143 TDEAction *mOpenAction;
144 TDEAction *mSaveAsAction;
145 TDEAction *mCopyAction;
146 TDEAction *mCutAction;
147 TDEAction *mDeleteAction;
148 TDEAction *mEditAction;
152 class AttachmentIconView :
public TDEIconView
157 friend class KOEditorAttachments;
159 AttachmentIconView( KOEditorAttachments* parent=0 );
161 TQDragObject *mimeData();
162 ~AttachmentIconView();
165 TQDragObject * dragObject();
167 void dragMoveEvent( TQDragMoveEvent *event );
168 void contentsDragMoveEvent( TQDragMoveEvent *event );
169 void contentsDragEnterEvent( TQDragEnterEvent *event );
170 void dragEnterEvent( TQDragEnterEvent *event );
174 void handleDrop( TQDropEvent *event,
const TQValueList<TQIconDragItem> & list );
177 std::set<KTempDir*> mTempDirs;
178 TQMap<KCal::Attachment *, KURL> mTempFiles;
179 KOEditorAttachments* mParent;