summaryrefslogtreecommitdiffstats
path: root/examples/declarative/support/contactmodel.h
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
commit2366667fc97eb6a56203b2dd7dac776ff4164abd (patch)
treeb2acb6cc6bfe475d7e619e4788973b61fff775e0 /examples/declarative/support/contactmodel.h
parent2c762f3b8b284a7c6dc0c499b7052013bad5b707 (diff)
downloadQt-2366667fc97eb6a56203b2dd7dac776ff4164abd.zip
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.gz
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.bz2
Initial import of kinetic-dui branch from the old kinetic
Diffstat (limited to 'examples/declarative/support/contactmodel.h')
-rw-r--r--examples/declarative/support/contactmodel.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/examples/declarative/support/contactmodel.h b/examples/declarative/support/contactmodel.h
new file mode 100644
index 0000000..e262358
--- /dev/null
+++ b/examples/declarative/support/contactmodel.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-$THISYEAR$ $TROLLTECH$. All rights reserved.
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+#ifndef _CONTACTMODEL_H_
+#define _CONTACTMODEL_H_
+
+#include <qlistmodelinterface.h>
+#include "contact.h"
+
+class ContactModel : public QListModelInterface
+{
+ Q_OBJECT
+public:
+ ContactModel(QObject *parent = 0);
+ ~ContactModel();
+
+ enum Roles {
+ PortraitRole,
+ FirstNameRole,
+ LastNameRole,
+ CompanyRole,
+ EmailsRole,
+ AddressesRole,
+ NumbersRole
+ };
+
+ int count() const;
+
+ QHash<int,QVariant> data(int index, const QList<int> &roles) const;
+ QList<int> roles() const;
+
+
+ QString toString(int role) const;
+
+ void deleteContact(int index);
+ int insertContact(Contact *contact);
+
+ int isAfter(QString &name1, QString &name2) const;
+ int findIndex(QString &searchName) const;
+
+private:
+ QList<Contact*> contactList;
+};
+
+#endif