MessageComposer::AttachmentModel Class

The AttachmentModel class. More...

Header: #include <MessageComposer/AttachmentModel>
CMake: find_package(KPim6MessageComposer REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::MessageComposer)
Inherits: QAbstractItemModel

Public Functions

AttachmentModel(QObject *parent)
virtual ~AttachmentModel() override
void addAttachment(const MessageCore::AttachmentPart::Ptr &part)
MessageCore::AttachmentPart::List attachments() const
bool isAutoDisplayEnabled() const
bool isEncryptEnabled() const
bool isEncryptSelected() const
bool isSignEnabled() const
bool isSignSelected() const
bool removeAttachment(const MessageCore::AttachmentPart::Ptr &part)
bool replaceAttachment(const MessageCore::AttachmentPart::Ptr &oldPart, const MessageCore::AttachmentPart::Ptr &newPart)
void setAutoDisplayEnabled(bool enabled)
void setEncryptEnabled(bool enabled)
void setEncryptSelected(bool selected)
void setModified(bool modified)
void setSignEnabled(bool enabled)
void setSignSelected(bool selected)
bool updateAttachment(const MessageCore::AttachmentPart::Ptr &part)

Reimplemented Public Functions

virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override
virtual QMimeData *mimeData(const QModelIndexList &indexes) const override
virtual QStringList mimeTypes() const override
virtual QModelIndex parent(const QModelIndex &index) const override
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override
virtual Qt::DropActions supportedDropActions() const override

Signals

void attachItemsRequester(const Akonadi::Item::List &)
void attachUrlsRequested(const QList<QUrl> &urls)
void attachmentCompressRequested(MessageCore::AttachmentPart::Ptr part, bool compress)
void attachmentRemoved(MessageCore::AttachmentPart::Ptr part)
void autoDisplayEnabled(bool enabled)
void encryptEnabled(bool enabled)
void signEnabled(bool enabled)

Detailed Description

Member Function Documentation

[explicit] AttachmentModel::AttachmentModel(QObject *parent)

Constructs an AttachmentModel. parent The parent object.

[override virtual noexcept] AttachmentModel::~AttachmentModel()

Destroys the AttachmentModel.

void AttachmentModel::addAttachment(const MessageCore::AttachmentPart::Ptr &part)

Adds an attachment to the model. part The attachment part to add.

[signal] void AttachmentModel::attachItemsRequester(const Akonadi::Item::List &)

Emitted when items from Akonadi should be attached. items The list of Akonadi items to attach.

[signal] void AttachmentModel::attachUrlsRequested(const QList<QUrl> &urls)

Emitted when URLs should be attached to the message. urls The list of URLs to attach.

[signal] void AttachmentModel::attachmentCompressRequested(MessageCore::AttachmentPart::Ptr part, bool compress)

Emitted when an attachment compression state should change. part The attachment part to compress or decompress. compress True to compress, false to decompress.

[signal] void AttachmentModel::attachmentRemoved(MessageCore::AttachmentPart::Ptr part)

Emitted when an attachment is removed. part The attachment part that was removed.

MessageCore::AttachmentPart::List AttachmentModel::attachments() const

Returns the list of all attachments in the model.

[signal] void AttachmentModel::autoDisplayEnabled(bool enabled)

Emitted when automatic display is enabled or disabled. enabled True if auto-display is now enabled.

See also setAutoDisplayEnabled().

[override virtual] int AttachmentModel::columnCount(const QModelIndex &parent = QModelIndex()) const

Reimplements: QAbstractItemModel::columnCount(const QModelIndex &parent) const.

Returns the number of columns in the model. parent The parent model index. Returns The number of columns.

[override virtual] QVariant AttachmentModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const

Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.

Returns data for the given model index and role. index The model index. role The data role to retrieve. Returns The data at the specified index for the given role.

See also setData().

[override virtual] bool AttachmentModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)

Reimplements: QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent).

Handles dropping of MIME data onto the attachment model. data The MIME data being dropped. action The drop action. row The row index where the drop occurred. column The column index where the drop occurred. parent The parent model index. Returns True if the data was successfully handled.

[signal] void AttachmentModel::encryptEnabled(bool enabled)

Emitted when encryption is enabled or disabled. enabled True if encryption is now enabled.

See also setEncryptEnabled().

[override virtual] Qt::ItemFlags AttachmentModel::flags(const QModelIndex &index) const

Reimplements: QAbstractItemModel::flags(const QModelIndex &index) const.

Returns the flags for the given model index. index The model index. Returns The item flags.

[override virtual] QVariant AttachmentModel::headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const

Reimplements: QAbstractItemModel::headerData(int section, Qt::Orientation orientation, int role) const.

Returns the header data for the given section. section The section index. orientation The header orientation. role The data role. Returns The header data.

[override virtual] QModelIndex AttachmentModel::index(int row, int column, const QModelIndex &parent = QModelIndex()) const

Reimplements: QAbstractItemModel::index(int row, int column, const QModelIndex &parent) const.

Returns the model index at the given row and column. row The row index. column The column index. parent The parent model index. Returns The model index.

bool AttachmentModel::isAutoDisplayEnabled() const

Returns whether automatic display is enabled for attachments.

bool AttachmentModel::isEncryptEnabled() const

Returns whether encryption is enabled for attachments.

bool AttachmentModel::isEncryptSelected() const

Returns whether encryption is selected for all attachments.

bool AttachmentModel::isSignEnabled() const

Returns whether signing is enabled for attachments.

bool AttachmentModel::isSignSelected() const

Returns whether signing is selected for all attachments.

[override virtual] QMimeData *AttachmentModel::mimeData(const QModelIndexList &indexes) const

Reimplements: QAbstractItemModel::mimeData(const QModelIndexList &indexes) const.

Returns MIME data for the selected attachments. indexes The list of selected model indexes. Returns The MIME data containing the selected attachments.

[override virtual] QStringList AttachmentModel::mimeTypes() const

Reimplements: QAbstractItemModel::mimeTypes() const.

Returns the list of supported MIME types for drag and drop.

[override virtual] QModelIndex AttachmentModel::parent(const QModelIndex &index) const

Reimplements: QAbstractItemModel::parent(const QModelIndex &index) const.

Returns the parent model index for the given index. index The child model index. Returns The parent model index.

bool AttachmentModel::removeAttachment(const MessageCore::AttachmentPart::Ptr &part)

Removes an attachment from the model. part The attachment part to remove. Returns True if the removal was successful.

bool AttachmentModel::replaceAttachment(const MessageCore::AttachmentPart::Ptr &oldPart, const MessageCore::AttachmentPart::Ptr &newPart)

Replaces an old attachment with a new one. oldPart The old attachment part to replace. newPart The new attachment part. Returns True if the replacement was successful.

[override virtual] int AttachmentModel::rowCount(const QModelIndex &parent = QModelIndex()) const

Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

Returns the number of rows in the model. parent The parent model index. Returns The number of rows.

void AttachmentModel::setAutoDisplayEnabled(bool enabled)

Sets whether automatic display is enabled for attachments. enabled True to enable automatic display.

See also autoDisplayEnabled().

[override virtual] bool AttachmentModel::setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole)

Reimplements: QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role).

Sets data for the given model index and role. index The model index. value The value to set. role The data role to set. Returns True if the data was successfully set.

See also data().

void AttachmentModel::setEncryptEnabled(bool enabled)

Sets whether encryption is enabled for attachments. enabled True to enable encryption.

See also encryptEnabled().

void AttachmentModel::setEncryptSelected(bool selected)

Sets encryption for all attachments. selected True to encrypt all attachments.

See also isEncryptSelected().

void AttachmentModel::setModified(bool modified)

Sets whether the model has been modified and needs saving. modified True if modified, false otherwise.

void AttachmentModel::setSignEnabled(bool enabled)

Sets whether signing is enabled for attachments. enabled True to enable signing.

See also signEnabled().

void AttachmentModel::setSignSelected(bool selected)

Sets signing for all attachments. selected True to sign all attachments.

See also isSignSelected().

[signal] void AttachmentModel::signEnabled(bool enabled)

Emitted when signing is enabled or disabled. enabled True if signing is now enabled.

See also setSignEnabled().

[override virtual] Qt::DropActions AttachmentModel::supportedDropActions() const

Reimplements: QAbstractItemModel::supportedDropActions() const.

Returns the supported drop actions for the model.

bool AttachmentModel::updateAttachment(const MessageCore::AttachmentPart::Ptr &part)

Updates an existing attachment in the model. part The attachment part to update. Returns True if the update was successful.