--- /dev/null
+/*
+ * Copyright (c) 2009-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 FileShare_h_
+#define FileShare_h_
+
+#include <list>
+#include <string>
+
+
+namespace Msg
+{
+ class FileShare
+ {
+ public:
+ static bool launch(const std::list<std::string> &files);
+
+ FileShare(const FileShare&) = delete;
+ FileShare& operator=(const FileShare&) = delete;
+ };
+}
+
+#endif /* FileShare_h_ */
--- /dev/null
+/*
+ * Copyright (c) 2009-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 "FileShare.h"
+#include "AppControlUtils.h"
+#include "Logger.h"
+
+#include <app_control.h>
+#include <vector>
+
+using namespace Msg;
+
+
+bool FileShare::launch(const std::list<std::string> &files)
+{
+ if(files.empty())
+ return false;
+
+ bool res = false;
+ app_control_h svc_handle = nullptr;
+
+ if(APP_CONTROL_ERROR_NONE == app_control_create(&svc_handle))
+ {
+ app_control_set_operation(svc_handle, APP_CONTROL_OPERATION_MULTI_SHARE);
+ app_control_set_mime(svc_handle, "*/*");
+
+ app_control_set_launch_mode(svc_handle, APP_CONTROL_LAUNCH_MODE_GROUP);
+
+ std::vector<const char*> paths;
+ for(const std::string &file : files)
+ {
+ if(!file.empty())
+ paths.push_back(file.c_str());
+ }
+
+ app_control_add_extra_data_array(svc_handle, APP_CONTROL_DATA_PATH, paths.data(), paths.size());
+
+ int ret = app_control_send_launch_request(svc_handle, nullptr, nullptr);
+ MSG_LOG("Result code: ", ret);
+ res = ret == APP_CONTROL_ERROR_NONE;
+ app_control_destroy(svc_handle);
+ }
+
+ return res;
+}
+
#include "MsgPage.h"
#include "MsgAttachment.h"
+#include <list>
+
namespace Msg
{
class SmilImageItemView;
void playAnimation(bool play);
Evas_Object *getVideoSink() const;
std::string getMediaPath() const;
+ const std::list<std::string> &getAttachments() const;
private:
const MsgMedia *getMedia(const MsgPage &page, MsgMedia::Type type) const;
Evas_Object *m_pVideoSink;
bool m_HasAudio;
SmilImageItemView *m_pImageItem;
+ std::list<std::string> m_Attachments;
};
}
void onDeleteButtonClicked(Popup &popup, int buttonId);
void onCopyTextItemPressed(PopupListItem &item);
void onForwardItemPressed(PopupListItem &item);
+ void onShareItemPressed(PopupListItem &item);
void onSaveAttachmentsItemPressed(PopupListItem &item);
// MbeRecipients:
return m_MediaPath;
}
+const std::list<std::string> &SmilPage::getAttachments() const
+{
+ return m_Attachments;
+}
+
bool SmilPage::hasAnimation() const
{
return m_pImageItem && m_pImageItem->hasAnimation();
{
m_Duration = page.getPageDuration();
+ const MsgMediaList &list = page.getMediaList();
+ for(int i = 0; i < list.getLength(); ++i)
+ {
+ m_Attachments.push_back(list[i].getFilePath());
+ }
+
// TODO: image/video, text order
bool hasVideo = getMedia(page, MsgMedia::VideoType) != nullptr;
{
m_Duration = defaultPageDuration;
+ for(int i = 0; i < list.getLength(); ++i)
+ {
+ m_Attachments.push_back(list[i].getFilePath());
+ }
+
if(list.isEmpty())
return;
#include "ContactViewer.h"
#include "FileUtils.h"
#include "SaveAttachmentsPopup.h"
+#include "FileShare.h"
#include <sstream>
#include <iomanip>
void Viewer::onHwMoreButtonClicked()
{
+ m_pSmilPlayer->stop();
+
PopupList &popup = getApp().getPopupManager().getPopupList();
popup.setAutoDismissBlockClickedFlag(true);
popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onDeleteItemPressed), this);
popup.appendItem(msg("IDS_MSGF_OPT_FORWARD"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onForwardItemPressed), this);
- if(!m_Msg->getAttachmentList().isEmpty() || m_Msg->getMediaCount() > 0)
+ bool hasAttachment = !m_Msg->getAttachmentList().isEmpty() || m_Msg->getMediaCount() > 0;
+ if(hasAttachment)
+ {
popup.appendItem(msg("IDS_MSG_OPT_SAVE_ATTACHMENTS_ABB"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onSaveAttachmentsItemPressed), this);
+ popup.appendItem(msg("IDS_COM_BUTTON_SHARE"), POPUPLIST_ITEM_PRESSED_CB(Viewer, onShareItemPressed), this);
+ }
+
popup.show();
}
popup->show();
}
+void Viewer::onShareItemPressed(PopupListItem &item)
+{
+ MSG_LOG("");
+ item.getParent().destroy();
+
+ SmilPage *page = m_pSmilPlayer->getCurrentPage();
+ if(page)
+ FileShare::launch(page->getAttachments());
+}
+
void Viewer::onRecipItemClicked(Evas_Object *obj, void *eventInfo)
{
MSG_LOG("");