korganizer

koeditorattachments.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 #ifndef KOEDITORATTACHMENTS_H
00026 #define KOEDITORATTACHMENTS_H
00027 
00028 #include <qwidget.h>
00029 #include <kurl.h>
00030 
00031 namespace KCal {
00032 class Incidence;
00033 class Attachment;
00034 }
00035 
00036 class QIconViewItem;
00037 class AttachmentIconView;
00038 class QMimeSource;
00039 class QPushButton;
00040 class QPopupMenu;
00041 class KAction;
00042 
00043 class KOEditorAttachments : public QWidget
00044 {
00045     Q_OBJECT
00046   public:
00047     KOEditorAttachments( int spacing = 8, QWidget *parent = 0,
00048                          const char *name = 0 );
00049     ~KOEditorAttachments();
00050 
00051     void addAttachment( const KURL &uri,
00052                         const QString &mimeType = QString::null, bool asUri = true );
00053     void addAttachment( KCal::Attachment *attachment );
00054 
00056     void setDefaults();
00058     void readIncidence( KCal::Incidence * );
00060     void writeIncidence( KCal::Incidence * );
00061 
00062     bool hasAttachments();
00063 
00064   protected slots:
00065     void showAttachment( QIconViewItem *item );
00066     void slotAdd();
00067     void slotAddData();
00068     void slotEdit();
00069     void slotRemove();
00070     void slotShow();
00071     void dragEnterEvent( QDragEnterEvent *event );
00072     void dropEvent( QDropEvent *event );
00073     void slotCopy();
00074     void slotCut();
00075     void slotPaste();
00076     void selectionChanged();
00077     void contextMenu( QIconViewItem* item, const QPoint &pos );
00078   signals:
00079     void openURL( const KURL &url );
00080 
00081   private:
00082     friend class AttachmentIconView;
00083     void handlePasteOrDrop( QMimeSource* source );
00084 
00085     AttachmentIconView *mAttachments;
00086     QPushButton *mRemoveBtn;
00087     QPopupMenu *mContextMenu, *mAddMenu;
00088     KAction *mOpenAction, *mCopyAction, *mCutAction;
00089 };
00090 
00091 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys