Better wording
[kdepim.git] / incidenceeditor-ng / attachmenticonview.h
blobc20b4a10472909aaa273fdcf34bc3cb729a4f4f1
1 /*
2 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
3 Copyright (C) 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
4 Copyright (c) 2005 Rafal Rzepecki <divide@users.sourceforge.net>
5 Copyright (c) 2010 Bertjan Broeksema <broeksema@kde.org>
6 Copyright (C) 2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 As a special exception, permission is given to link this program
23 with any edition of Qt, and distribute the resulting executable,
24 without including the source code for Qt in the source distribution.
26 NOTE: May, 2010. Extracted this code from
27 kdepim/incidenceeditors/editorattachments.{h,cpp}
30 #ifndef INCIDENCEEDITOR_ATTACHMENTICONVIEW_H
31 #define INCIDENCEEDITOR_ATTACHMENTICONVIEW_H
33 #include "incidenceeditors-ng_export.h"
35 #include <KCalCore/Attachment>
37 #include <KMimeType>
38 #include <KUrl>
40 #include <QListWidget>
42 namespace IncidenceEditorNG {
44 class INCIDENCEEDITORS_NG_EXPORT AttachmentIconView : public QListWidget
46 friend class EditorAttachments;
47 public:
48 AttachmentIconView( QWidget *parent = 0 );
50 QMimeData *mimeData() const;
51 KUrl tempFileForAttachment( const KCalCore::Attachment::Ptr &attachment ) const;
53 protected:
54 QMimeData * mimeData( const QList<QListWidgetItem*> items ) const;
55 void startDrag( Qt::DropActions supportedActions );
56 void keyPressEvent( QKeyEvent *event );
58 private:
59 mutable QHash<KCalCore::Attachment::Ptr, KUrl> mTempFiles;
62 class INCIDENCEEDITORS_NG_EXPORT AttachmentIconItem : public QListWidgetItem
64 public:
65 AttachmentIconItem( const KCalCore::Attachment::Ptr &att, QListWidget *parent );
66 ~AttachmentIconItem();
68 KCalCore::Attachment::Ptr attachment() const;
69 const QString uri() const;
70 void setUri( const QString &uri );
72 using QListWidgetItem::setData;
74 void setData( const QByteArray &data );
76 const QString mimeType() const;
77 void setMimeType( const QString &mime );
79 const QString label() const;
80 void setLabel( const QString &description );
82 bool isBinary() const;
84 static QPixmap icon( KMimeType::Ptr mimeType, const QString &uri, bool binary = false );
85 QPixmap icon() const;
87 void readAttachment();
89 private:
90 KCalCore::Attachment::Ptr mAttachment;
95 #endif // INCIDENCEEDITOR_ATTACHMENTICONVIEW_H