1 /*
2     SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com>
3     SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #include "appletdata.h"
7 
8 namespace Latte {
9 namespace Data {
10 
Applet()11 Applet::Applet()
12     : Generic()
13 {
14 }
15 
Applet(Applet && o)16 Applet::Applet(Applet &&o)
17     : Generic(o),
18       isSelected(o.isSelected),
19       description(o.description),
20       icon(o.icon),
21       storageId(o.storageId),
22       subcontainmentId(o.subcontainmentId)
23 {
24 }
25 
Applet(const Applet & o)26 Applet::Applet(const Applet &o)
27     : Generic(o),
28       isSelected(o.isSelected),
29       description(o.description),
30       icon(o.icon),
31       storageId(o.storageId),
32       subcontainmentId(o.subcontainmentId)
33 {
34 }
35 
operator =(const Applet & rhs)36 Applet &Applet::operator=(const Applet &rhs)
37 {
38     id = rhs.id;
39     name = rhs.name;
40     description = rhs.description;
41     isSelected = rhs.isSelected;
42     icon = rhs.icon;
43     storageId = rhs.storageId;
44     subcontainmentId = rhs.subcontainmentId;
45 
46     return (*this);
47 }
48 
operator =(Applet && rhs)49 Applet &Applet::operator=(Applet &&rhs)
50 {
51     id = rhs.id;
52     name = rhs.name;
53     description = rhs.description;
54     isSelected = rhs.isSelected;
55     icon = rhs.icon;
56     storageId = rhs.storageId;
57     subcontainmentId = rhs.subcontainmentId;
58 
59     return (*this);
60 }
61 
operator ==(const Applet & rhs) const62 bool Applet::operator==(const Applet &rhs) const
63 {
64     return (id == rhs.id)
65             && (name == rhs.name)
66             && (description == rhs.description)
67             && (icon == rhs.icon)
68             && (isSelected == rhs.isSelected)
69             && (storageId == rhs.storageId)
70             && (subcontainmentId == rhs.subcontainmentId);
71 }
72 
operator !=(const Applet & rhs) const73 bool  Applet::operator!=(const Applet &rhs) const
74 {
75     return !(*this == rhs);
76 }
77 
isInstalled() const78 bool Applet::isInstalled() const
79 {
80     return isValid() && id != name;
81 }
82 
isValid() const83 bool Applet::isValid() const
84 {
85     return !id.isEmpty();
86 }
87 
visibleName() const88 QString Applet::visibleName() const
89 {
90     return name.isEmpty() ? id : name;
91 }
92 
93 }
94 }
95