MailTransport

transportmodel.h
1/*
2 SPDX-FileCopyrightText: 2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "mailtransport_export.h"
10#include <QAbstractListModel>
11namespace MailTransport
12{
13class TransportManager;
14class Transport;
15class MAILTRANSPORT_EXPORT TransportModel : public QAbstractListModel
16{
17 Q_OBJECT
18public:
19 enum TransportRoles {
20 NameRole,
21 TransportNameRole,
22 TransportIdentifierRole,
23 DefaultRole,
24 ActivitiesRole,
25 EnabledActivitiesRole,
26 LastColumn = EnabledActivitiesRole,
27 };
28
29 explicit TransportModel(QObject *parent = nullptr);
30 ~TransportModel() override;
31
32 [[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
33 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
34 [[nodiscard]] int columnCount(const QModelIndex &parent) const override;
35 [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
36
37 [[nodiscard]] int transportId(int index) const;
38 [[nodiscard]] int indexOf(int transportId) const;
39
40 [[nodiscard]] Qt::ItemFlags flags(const QModelIndex &index) const override;
41
42 [[nodiscard]] bool setData(const QModelIndex &index, const QVariant &value, int role) override;
43
44 void setShowDefault(bool show);
45
46private:
47 MAILTRANSPORT_NO_EXPORT void updateComboboxList();
48 [[nodiscard]] MAILTRANSPORT_NO_EXPORT QString generateTransportName(Transport *t) const;
49 QList<int> mTransportIds;
50 TransportManager *const mTransportManager;
51 bool mShowDefault = false;
52};
53}
DisplayRole
typedef ItemFlags
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:07:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.