2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file Attachment.cpp
20 * @author Pawel Misiak (p.misiak@samsung.com)
25 #include <dpl/log/log.h>
26 #include <Commons/Exception.h>
27 #include <Filesystem/Manager.h>
28 #include "Attachment.h"
30 #include <API/Filesystem/INode.h>
31 #include <Tizen/Filesystem/EventGetNodeData.h>
32 #include <API/Filesystem/IManager.h>
39 using namespace WrtDeviceApis::Commons;
42 //--------------------------------------------------------------------------
47 Attachment::Attachment()
52 Attachment::Attachment(const string& fullPath,
56 init(fullPath, isVirtualPath);
59 Attachment::Attachment(emf_attachment_info_t* att)
63 m_attachShortName = std::string(att->name); //set shot Name
64 m_isDownloaded = att->downloaded;
65 m_attachmentID = att->attachment_id;
67 LogDebug(" showname = " << m_attachShortName << " isDownloaded = " << m_isDownloaded << " attachmentID = " << m_attachmentID);
68 LogDebug("save name is = " << att->savename);
71 init( att->savename, false);
75 Attachment::Attachment(emf_attachment_data_t* att)
79 m_attachShortName = std::string(att->attachment_name);
80 m_isDownloaded = att->save_status;
81 m_attachmentID = att->attachment_id;
82 //m_mimeType = std::string(att->attachment_mime_type);
83 LogDebug(" showname = " << m_attachShortName << " isDownloaded = " << m_isDownloaded << " attachmentID = " << m_attachmentID << "Mime= " << m_mimeType);
84 LogDebug("save name is = " << att->attachment_path);
86 if ( att->attachment_path)
88 init( att->attachment_path, false);
93 Attachment::Attachment(const std::string& fullPath, bool isVirtualPath,
94 const Api::Filesystem::INode& inode):
95 Api::Filesystem::INode(inode)
97 LogDebug("entered , inode");
98 init(fullPath, isVirtualPath);
103 Attachment::Attachment(const std::string& fullPath, bool isVirtualPath, const Api::Filesystem::INode& inode):
106 LogDebug("entered , inode");
107 init(fullPath, isVirtualPath);
111 std::string Attachment::getRealPath(const std::string &path) const
114 #if 0 // MESSAGING ATTACHMENT IS BLOCKED
117 Api::Filesystem::IPathPtr currentPath = Api::Filesystem::IPath::create(
119 return currentPath->getFullPath();
122 Catch(WrtDeviceApis::Commons::Exception) {
123 LogError("invalid path");
124 ReThrow(WrtDeviceApis::Commons::InvalidArgumentException);
128 LogDebug(" path = " << path);