You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
955 B
39 lines
955 B
6 years ago
|
#ifndef ADDRESSBOOK_H
|
||
|
#define ADDRESSBOOK_H
|
||
|
|
||
|
#include "precompiled.h"
|
||
|
|
||
|
class MainWindow;
|
||
|
|
||
|
class AddressBookModel : public QAbstractTableModel {
|
||
|
|
||
|
public:
|
||
|
AddressBookModel(QTableView* parent);
|
||
|
~AddressBookModel();
|
||
|
|
||
|
void addNewLabel(QString label, QString addr);
|
||
|
void removeItemAt(int row);
|
||
|
QPair<QString, QString> itemAt(int row);
|
||
|
|
||
|
int rowCount(const QModelIndex &parent) const;
|
||
|
int columnCount(const QModelIndex &parent) const;
|
||
|
QVariant data(const QModelIndex &index, int role) const;
|
||
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||
|
|
||
|
private:
|
||
|
void loadDataFromStorage();
|
||
|
void saveDataToStorage();
|
||
|
|
||
|
QString writeableFile();
|
||
|
|
||
|
QTableView* parent;
|
||
|
QList<QPair<QString, QString>>* labels = nullptr;
|
||
|
QStringList headers;
|
||
|
};
|
||
|
|
||
|
class AddressBook {
|
||
|
public:
|
||
|
static void open(MainWindow* parent, QLineEdit* target = nullptr);
|
||
|
};
|
||
|
|
||
|
#endif // ADDRESSBOOK_H
|