2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 #include <Commons/Exception.h>
20 #include "Attachment.h"
25 #include <EventGetNodeData.h>
34 using namespace WrtDeviceApis::Commons;
37 //--------------------------------------------------------------------------
41 Attachment::Attachment()
46 Attachment::Attachment(const string& fullPath,
50 init(fullPath, isVirtualPath);
54 Attachment::Attachment(email_attachment_info_t* att)
58 m_attachShortName = std::string(att->name); //set shot Name
59 m_isDownloaded = att->downloaded;
60 m_attachmentID = att->attachment_id;
62 LoggerD(" showname = " << m_attachShortName << " isDownloaded = " << m_isDownloaded << " attachmentID = " << m_attachmentID);
63 LoggerD("save name is = " << att->savename);
66 init( att->savename, false);
70 Attachment::Attachment(email_attachment_data_t* att)
74 m_attachShortName = std::string(att->attachment_name);
75 m_isDownloaded = att->save_status;
76 m_attachmentID = att->attachment_id;
77 m_isInlineAttachment = att->inline_content_status;
78 //m_mimeType = std::string(att->attachment_mime_type);
79 LoggerD(" showname = " << m_attachShortName << " isDownloaded = " << m_isDownloaded << " attachmentID = " << m_attachmentID << "Mime= " << m_mimeType);
80 LoggerD("save name is = " << att->attachment_path << "isInlineAttachment = " << m_isInlineAttachment);
82 if ( att->attachment_path)
84 init( att->attachment_path, false);
89 Attachment::Attachment(const std::string& fullPath, bool isVirtualPath,
90 const DeviceAPI::Filesystem::INode& inode):
91 DeviceAPI::Filesystem::INode(inode)
93 LoggerD("entered , inode");
94 init(fullPath, isVirtualPath);
99 Attachment::Attachment(const std::string& fullPath, bool isVirtualPath, const DeviceAPI::Filesystem::INode& inode):
102 LoggerD("entered , inode");
103 init(fullPath, isVirtualPath);
107 std::string Attachment::getRealPath(const std::string &path) const
110 #if 0 // MESSAGING ATTACHMENT IS BLOCKED
113 DeviceAPI::Filesystem::IPathPtr currentPath = DeviceAPI::Filesystem::IPath::create(
115 return currentPath->getFullPath();
118 Catch(WrtDeviceApis::Commons::Exception) {
119 LoggerE("invalid path");
120 ReThrow(WrtDeviceApis::Commons::InvalidArgumentException);
124 LoggerD(" path = " << path);