2020-10-07 10:36:04 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2022-02-10 10:26:41 +00:00
|
|
|
// SPDX-FileCopyrightText: 2014-2022 The Monero Project
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
#ifndef ADDRESSBOOKMODEL_H
|
|
|
|
#define ADDRESSBOOKMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QIcon>
|
|
|
|
|
|
|
|
class AddressBook;
|
|
|
|
|
|
|
|
class AddressBookModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum ModelColumn
|
|
|
|
{
|
2021-06-04 17:48:55 +00:00
|
|
|
Description = 0,
|
|
|
|
Address,
|
2020-10-07 10:36:04 +00:00
|
|
|
COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
AddressBookModel(QObject *parent, AddressBook * addressBook);
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
|
|
|
|
|
|
|
Q_INVOKABLE bool deleteRow(int row);
|
|
|
|
|
|
|
|
bool isShowFullAddresses() const;
|
|
|
|
void setShowFullAddresses(bool show);
|
|
|
|
bool writeCSV(const QString &path);
|
2020-10-21 06:25:02 +00:00
|
|
|
QMap<QString, QString> readCSV(const QString &path);
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void startReset();
|
|
|
|
void endReset();
|
|
|
|
|
|
|
|
private:
|
|
|
|
AddressBook * m_addressBook;
|
|
|
|
QIcon m_contactIcon;
|
|
|
|
bool m_showFullAddresses;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ADDRESSBOOKMODEL_H
|