source: SMSSender/lib/libdatatypes/src/business/BCContact.cpp @ 56:e63ceb8090cd

3.0
Last change on this file since 56:e63ceb8090cd was 56:e63ceb8090cd, checked in by Sämy Zehnder <saemy.zehnder@…>, 12 years ago
  • Renamed accountmodel to accounttreemodel
  • Implemented creation of new contact if number is unknown in vcmain
  • Areacode is now in its own field in vceditcontact
  • Accountlist in vcmain is now controlled by a model (Needs filtering of only active ones)
  • Settingspath is dynamic and user-based now
File size: 1.5 KB
Line 
1/*
2 * BCContact.cpp
3 *
4 *  Created on: May 17, 2009
5 *      Author: saemy
6 */
7
8#include "BCContact.h"
9
10BCContact::BCContact()
11  : id_(-1)
12  , name_("")
13  , number_(SNumber())
14  , image_(QImage())
15{
16    eventMapper_ = new ContactEventMapper(this);
17}
18
19ContactEventMapper* BCContact::eventMapper() const {
20    return eventMapper_;
21}
22IContactEvents* BCContact::contactEvents() const {
23    return static_cast<IContactEvents*>(eventMapper());
24}
25
26
27int BCContact::id() const{
28    return id_;
29}
30QString BCContact::name() const{
31    return name_;
32}
33SNumber BCContact::number() const{
34    return number_;
35}
36QStringList BCContact::aliases() const{
37    return aliases_;
38}
39QImage BCContact::image() const{
40    return image_;
41}
42
43
44void BCContact::setId(int id){
45    if (id_ == id) return;
46
47    int oldId = id_;
48    id_ = id;
49
50    emit contactEvents()->idChanged(oldId, id);
51    emit contactEvents()->dataChanged();
52}
53void BCContact::setName(const QString& name){
54    SET_IF_DIFFERENT(name_, name.trimmed());
55    emit contactEvents()->dataChanged();
56}
57void BCContact::setNumber(const SNumber& number){
58    SET_IF_DIFFERENT(number_, number);
59    emit contactEvents()->dataChanged();
60}
61void BCContact::setAliases(const QStringList& aliases){
62    SET_IF_DIFFERENT(aliases_, aliases);
63    aliases_.sort();
64    emit contactEvents()->dataChanged();
65}
66void BCContact::setImage(const QImage& image){
67    SET_IF_DIFFERENT(image_, image);
68    image_ = image_.scaledToWidth(50, Qt::SmoothTransformation);
69    emit contactEvents()->dataChanged();
70}
Note: See TracBrowser for help on using the repository browser.