1 /*
2  * %kadu copyright begin%
3  * Copyright 2010, 2011 Piotr Galiszewski (piotr.galiszewski@kadu.im)
4  * Copyright 2010 Piotr Dąbrowski (ultr@ultr.pl)
5  * Copyright 2011 Bartosz Brachaczek (b.brachaczek@gmail.com)
6  * Copyright 2009, 2010, 2011 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
7  * %kadu copyright end%
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #include "status/status-type-data.h"
24 #include "status/status-type-group.h"
25 #include "status/status-type-manager.h"
26 #include "status/status-type.h"
27 
28 #include "status.h"
29 
30 #include <stdio.h>
31 
Status(StatusType statusType,const QString & description)32 Status::Status(StatusType statusType, const QString &description) :
33 		Description(description)
34 {
35 	setType(statusType);
36 }
37 
Status(const Status & copyme)38 Status::Status(const Status& copyme) :
39 		Type(copyme.Type), Description(copyme.Description)
40 {
41 }
42 
~Status()43 Status::~Status()
44 {
45 }
46 
setType(StatusType type)47 void Status::setType(StatusType type)
48 {
49 	Type = type;
50 }
51 
isDisconnected() const52 bool Status::isDisconnected() const
53 {
54 	return StatusType::Offline == Type;
55 }
56 
operator <(const Status & compare) const57 bool Status::operator < (const Status &compare) const
58 {
59 	return Type < compare.Type;
60 }
61 
operator ==(const Status & compare) const62 bool Status::operator == (const Status &compare) const
63 {
64 	return Type == compare.Type
65 	       && Description == compare.Description;
66 }
67 
operator !=(const Status & compare) const68 bool Status::operator != (const Status& compare) const
69 {
70 	return !(*this == compare);
71 }
72 
hasDescription() const73 bool Status::hasDescription() const
74 {
75 	return !Description.isEmpty();
76 }
77