|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "emailtrace.h" |
|
19 |
|
20 #include <QString> |
|
21 |
|
22 #include "nmmailbox.h" |
|
23 |
|
24 NmMailboxPrivate::NmMailboxPrivate() |
|
25 { |
|
26 NM_FUNCTION; |
|
27 } |
|
28 |
|
29 NmMailboxPrivate::~NmMailboxPrivate() |
|
30 { |
|
31 NM_FUNCTION; |
|
32 } |
|
33 |
|
34 /*! |
|
35 \class NmMailbox |
|
36 \brief Data model for mailbox spesific data |
|
37 */ |
|
38 |
|
39 /*! |
|
40 Constructs NmMailbox object with empty data |
|
41 */ |
|
42 NmMailbox::NmMailbox() |
|
43 { |
|
44 NM_FUNCTION; |
|
45 |
|
46 d = new NmMailboxPrivate(); |
|
47 } |
|
48 |
|
49 /*! |
|
50 Copy constructor |
|
51 */ |
|
52 NmMailbox::NmMailbox(const NmMailbox &mailbox) |
|
53 { |
|
54 NM_FUNCTION; |
|
55 |
|
56 d = mailbox.d; |
|
57 } |
|
58 |
|
59 /*! |
|
60 Constructs NmMailbox object from \a mailbox data |
|
61 */ |
|
62 NmMailbox::NmMailbox(QExplicitlySharedDataPointer<NmMailboxPrivate> mailboxprivate) |
|
63 { |
|
64 NM_FUNCTION; |
|
65 |
|
66 d = mailboxprivate; |
|
67 } |
|
68 |
|
69 /*! |
|
70 Assign data from \a mailbox |
|
71 */ |
|
72 NmMailbox &NmMailbox::operator=(const NmMailbox &mailbox) |
|
73 { |
|
74 NM_FUNCTION; |
|
75 |
|
76 if (this != &mailbox) { |
|
77 d = mailbox.d; |
|
78 } |
|
79 return *this; |
|
80 } |
|
81 |
|
82 /*! |
|
83 Destructor |
|
84 */ |
|
85 NmMailbox::~NmMailbox() |
|
86 { |
|
87 NM_FUNCTION; |
|
88 } |
|
89 |
|
90 /*! |
|
91 Returns mailbox id |
|
92 */ |
|
93 NmId NmMailbox::id() const |
|
94 { |
|
95 NM_FUNCTION; |
|
96 |
|
97 return d->mId; |
|
98 } |
|
99 |
|
100 /*! |
|
101 Sets mailbox id from \a id |
|
102 */ |
|
103 void NmMailbox::setId(const NmId& id) |
|
104 { |
|
105 NM_FUNCTION; |
|
106 |
|
107 d->mId = id; |
|
108 } |
|
109 |
|
110 /*! |
|
111 Returns mailbox name string |
|
112 */ |
|
113 QString NmMailbox::name() const |
|
114 { |
|
115 NM_FUNCTION; |
|
116 |
|
117 return d->mName; |
|
118 } |
|
119 |
|
120 /*! |
|
121 Sets mailbox name from \a name |
|
122 */ |
|
123 void NmMailbox::setName(const QString &name) |
|
124 { |
|
125 NM_FUNCTION; |
|
126 |
|
127 d->mName = name; |
|
128 } |
|
129 |
|
130 /*! |
|
131 Equal operator returns true if both NmMailbox objects have same name and id |
|
132 */ |
|
133 bool NmMailbox::operator==(const NmMailbox &mailbox) const |
|
134 { |
|
135 NM_FUNCTION; |
|
136 |
|
137 bool ret = true; |
|
138 |
|
139 if (this->name().compare(mailbox.name()) != 0) { |
|
140 ret = false; |
|
141 } |
|
142 if (this->id() != mailbox.id()) { |
|
143 ret = false; |
|
144 } |
|
145 return ret; |
|
146 } |
|
147 |
|
148 |
|
149 NmAddress NmMailbox::address() const |
|
150 { |
|
151 NM_FUNCTION; |
|
152 |
|
153 return d->mAddress; |
|
154 } |
|
155 |
|
156 |
|
157 void NmMailbox::setAddress(const NmAddress& address) |
|
158 { |
|
159 NM_FUNCTION; |
|
160 |
|
161 d->mAddress = address; |
|
162 } |
|
163 |