Incidenceeditor

attachmenticonview.h
1/*
2 SPDX-FileCopyrightText: 2003 Cornelius Schumacher <schumacher@kde.org>
3 SPDX-FileCopyrightText: 2005 Reinhold Kainhofer <reinhold@kainhofer.com>
4 SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
5 SPDX-FileCopyrightText: 2010 Bertjan Broeksema <broeksema@kde.org>
6 SPDX-FileCopyrightText: 2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
7
8 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
9
10 NOTE: May, 2010. Extracted this code from
11 kdepim/incidenceeditors/editorattachments.{h,cpp}
12*/
13
14#pragma once
15
16#include <KCalendarCore/Attachment>
17
18#include <QMimeType>
19#include <QUrl>
20
21#include <QListWidget>
22
23namespace IncidenceEditorNG
24{
25class AttachmentIconView : public QListWidget
26{
28 friend class EditorAttachments;
29
30public:
31 explicit AttachmentIconView(QWidget *parent = nullptr);
32
33 [[nodiscard]] QMimeData *mimeData() const;
34
35protected:
36 QMimeData *mimeData(const QList<QListWidgetItem *> &items) const override;
37 void startDrag(Qt::DropActions supportedActions) override;
38 void keyPressEvent(QKeyEvent *event) override;
39};
40
41class AttachmentIconItem : public QListWidgetItem
42{
43public:
44 AttachmentIconItem(const KCalendarCore::Attachment &att, QListWidget *parent);
45 ~AttachmentIconItem() override;
46
47 [[nodiscard]] KCalendarCore::Attachment attachment() const;
48 [[nodiscard]] const QString uri() const;
49 [[nodiscard]] const QString savedUri() const;
50 void setUri(const QString &uri);
51
53
54 void setData(const QByteArray &data);
55
56 [[nodiscard]] const QString mimeType() const;
57 void setMimeType(const QString &mime);
58
59 [[nodiscard]] const QString label() const;
60 void setLabel(const QString &description);
61
62 [[nodiscard]] bool isBinary() const;
63
64 [[nodiscard]] static QIcon icon(const QMimeType &mimeType, const QString &uri, bool binary = false);
65 [[nodiscard]] QIcon icon() const;
66
67 void readAttachment();
68
69 [[nodiscard]] QUrl tempFileForAttachment();
70
71private:
72 KCalendarCore::Attachment mAttachment;
73 QString mSaveUri;
74 QUrl mTempFile;
75};
76}
virtual bool event(QEvent *e) override
QList< QListWidgetItem * > items(const QMimeData *data) const const
virtual QVariant data(int role) const const
virtual void setData(int role, const QVariant &value)
Q_OBJECTQ_OBJECT
QObject * parent() const const
typedef DropActions
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.