To not to GetSharedPath if there is no image item in chat-message item
[platform/core/api/notification.git] / notification-ex / group_item.h
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef NOTIFICATION_EX_GROUP_ITEM_H_
18 #define NOTIFICATION_EX_GROUP_ITEM_H_
19
20 #include <string>
21 #include <memory>
22 #include <list>
23 #include <map>
24
25 #include "notification-ex/abstract_item.h"
26
27 namespace notification {
28 namespace item {
29
30 /**
31  * @brief The class for GroupItem type notification.
32  * @details The class to make the group of notifications.
33  * @since_tizen 5.5
34  */
35 class EXPORT_API GroupItem : public AbstractItem {
36  public:
37   /**
38    * @brief Constructor
39    * @since_tizen 5.5
40    * @param[in] action The action for GroupItem
41    */
42   GroupItem(std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
43
44   /**
45    * @brief Constructor
46    * @since_tizen 5.5
47    * @param[in] id The GroupItem id
48    * @param[in] action The action for GroupItem
49    */
50   GroupItem(std::string id,
51       std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
52
53   /**
54    * @brief Deserialize
55    * @since_tizen 5.5
56    */
57   virtual ~GroupItem();
58
59  public:
60   /**
61    * @brief Serialize the data of GroupItem.
62    * @since_tizen 5.5
63    * @return Bundle type data
64    */
65   tizen_base::Bundle Serialize() const override;
66
67   /**
68    * @brief Deserialize the serialized data.
69    * @since_tizen 5.5
70    * @param[in] b The serialized Bundle data
71    */
72   void Deserialize(tizen_base::Bundle b) override;
73
74   /**
75    * @brief Finds the AbstractItem using by notification item id.
76    * @since_tizen 5.5
77    * @param[in] id notification item id
78    * @return AbstractItem object
79    */
80   AbstractItem& FindByID(std::string id) override;
81
82   /**
83    * @brief Finds the AbstractItem using by main type.
84    * @since_tizen 5.5
85    * @param[in] type The main type
86    * @return AbstractItem object
87    */
88   AbstractItem& FindByMainType(MainType type) override;
89
90   /**
91    * @brief Checks the item type exist in this notification.
92    * @since_tizen 5.5
93    * @param[in] type notification item type
94    * @return true if the item type exists
95    */
96   bool IsItemTypeExist(int type) override;
97
98   /**
99    * @brief Gets the type of GroupItem.
100    * @since_tizen 5.5
101    * @return AbstractItem::Type::Group
102    */
103   int GetType() const override;
104
105   /**
106    * @brief Gets the path of shared file location.
107    * @since_tizen 5.5
108    * @return The list of shared path.
109    */
110   std::list<std::string> GetSharedPath() const override;
111
112   /**
113    * @brief Sets the shared file path to original file path.
114    * @since_tizen 5.5
115    */
116   void SetSharedPath() override;
117
118   /**
119    * @brief Gets the paths of shared file location.
120    * @since_tizen 5.5
121    * @return The list of private path and original path.
122    */
123   std::list<std::map<std::string, std::string>> GetPathMapList() const override;
124
125   /**
126    * @brief Sets the vertical state.
127    * @details The vertical state is true, the children of GroupItem are associated vertically.
128    *          And if it is false, the children are associated horizontally.
129    * @since_tizen 5.5
130    * @param[in] The vertical state
131    */
132   void SetDirection(bool vertical);
133
134   /**
135    * @brief Gets whether the vertical state is true or not.
136    * @since_tizen 5.5
137    * @return true if vertical is true, or false
138    */
139   bool IsVertical();
140
141   /**
142    * @brief Gets app label data of GroupItem.
143    * @since_tizen 5.5
144    * @return The app label data
145    */
146   std::string GetAppLabel();
147
148   /**
149    * @brief Sets app label data of GroupItem.
150    * @since_tizen 5.5
151    * @return The app label data
152    */
153   void SetAppLabel(std::string label);
154
155   /**
156    * @brief Adds child notification item.
157    * @since_tizen 5.5
158    * @param[in] AbstractItem object
159    */
160   void AddChild(std::shared_ptr<AbstractItem> child);
161
162   /**
163    * @brief Removes child notification item.
164    * @since_tizen 5.5
165    * @param[in] The notification id
166    */
167   void RemoveChild(std::string itemId);
168
169   /**
170    * @brief Removes children.
171    * @since_tizen 5.5
172    */
173   void RemoveChildren();
174
175   /**
176    * @brief Gets the list of children item of GroupItem.
177    * @since_tizen 5.5
178    * @return The list of AbstractItem
179    */
180   std::list<std::shared_ptr<AbstractItem>> GetChildren();
181
182  private:
183   class Impl;
184   std::unique_ptr<Impl> impl_;
185 };
186
187 }  // namespace item
188 }  // namespace notification
189
190 #endif  // NOTIFICATION_EX_GROUP_ITEM_H_