update// refactored addressbook with new storage format
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define ADDRESSBOOK_H
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "contactmodel.h"
|
||||
|
||||
class MainWindow;
|
||||
|
||||
@@ -10,10 +11,11 @@ class AddressBookModel : public QAbstractTableModel {
|
||||
public:
|
||||
AddressBookModel(QTableView* parent);
|
||||
~AddressBookModel();
|
||||
|
||||
void addNewLabel(QString label, QString addr);
|
||||
|
||||
void addNewLabel(QString label, QString address, QString myAddr);
|
||||
void removeItemAt(int row);
|
||||
QPair<QString, QString> itemAt(int row);
|
||||
//QPair<QString, QString> itemAt(int row);
|
||||
ContactItem itemAt(int row);
|
||||
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
@@ -25,7 +27,8 @@ private:
|
||||
void saveData();
|
||||
|
||||
QTableView* parent;
|
||||
QList<QPair<QString, QString>> labels;
|
||||
//QList<QPair<QString, QString>> labels;
|
||||
QList<ContactItem> labels;
|
||||
QStringList headers;
|
||||
};
|
||||
|
||||
@@ -39,7 +42,7 @@ public:
|
||||
static QString addressFromAddressLabel(const QString& lblAddr);
|
||||
|
||||
// Add a new address/label to the database
|
||||
void addAddressLabel(QString label, QString address);
|
||||
void addAddressLabel(QString label, QString address, QString myAddr);
|
||||
|
||||
// Remove a new address/label from the database
|
||||
void removeAddressLabel(QString label, QString address);
|
||||
@@ -48,7 +51,7 @@ public:
|
||||
void updateLabel(QString oldlabel, QString address, QString newlabel);
|
||||
|
||||
// Read all addresses
|
||||
const QList<QPair<QString, QString>>& getAllAddressLabels();
|
||||
const QList<ContactItem>& getAllAddressLabels();
|
||||
|
||||
// Get an address's first label
|
||||
QString getLabelForAddress(QString address);
|
||||
@@ -61,7 +64,7 @@ private:
|
||||
void writeToStorage();
|
||||
|
||||
QString writeableFile();
|
||||
QList<QPair<QString, QString>> allLabels;
|
||||
QList<ContactItem> allLabels;
|
||||
|
||||
static AddressBook* instance;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user