TizenRefApp-8147 Implement contact list view item class 35/118435/2
authorOleksander Kostenko <o.kostenko@samsung.com>
Fri, 10 Mar 2017 09:42:11 +0000 (11:42 +0200)
committerOleksandr Kostenko <o.kostenko@samsung.com>
Fri, 10 Mar 2017 12:30:13 +0000 (04:30 -0800)
Change-Id: I1fcac7f0419c3c25e255dc6795a6746d2d680275
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
src/Composer/View/inc/ContactListViewItem.h [new file with mode: 0644]
src/Composer/View/src/ContactListViewItem.cpp [new file with mode: 0644]

diff --git a/src/Composer/View/inc/ContactListViewItem.h b/src/Composer/View/inc/ContactListViewItem.h
new file mode 100644 (file)
index 0000000..d43fbed
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ContactListItemView_h_
+#define ContactListItemView_h_
+
+#include "ListItem.h"
+#include <string>
+
+namespace Msg {
+    class ContactListViewItem
+        : public ListItem {
+        public:
+            ContactListViewItem();
+            virtual ~ContactListViewItem();
+
+        protected:
+            static ListItemStyleRef logStyle;
+            static ListItemStyleRef nameOrEmailStyle;
+
+            virtual std::string getSubText() = 0;
+            virtual std::string getMainText() = 0;
+
+        private:
+            std::string getText(ListItem &item, const char *part) override;
+    };
+}
+
+#endif // ContactListItemView_h_
diff --git a/src/Composer/View/src/ContactListViewItem.cpp b/src/Composer/View/src/ContactListViewItem.cpp
new file mode 100644 (file)
index 0000000..abe14da
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ContactListViewItem.h"
+#include <string.h>
+
+using namespace Msg;
+
+ListItemStyleRef ContactListViewItem::logStyle = ListItemStyle::create("1text");
+ListItemStyleRef ContactListViewItem::nameOrEmailStyle = ListItemStyle::create("2text");
+
+namespace {
+    const char *mainTextPart = "elm.text";
+    const char *subTextPart = "elm.text.1";
+}
+
+ContactListViewItem::ContactListViewItem()
+    : ListItem(ELM_GENLIST_ITEM_NONE)
+{
+}
+
+ContactListViewItem::~ContactListViewItem()
+{
+}
+
+std::string ContactListViewItem::getText(ListItem &item, const char *part)
+{
+    if (strcmp(part, mainTextPart) == 0)
+        return getMainText();
+
+    if (getStyle() == nameOrEmailStyle && strcmp(part, subTextPart) == 0)
+        return getSubText();
+
+    return "";
+}