// // Tizen Web Device API // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // 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 IATTACHMENT_H #define IATTACHMENT_H #include #include #include "IMessage.h" namespace DeviceAPI { namespace Messaging { class IAttachment; typedef DPL::SharedPtr IAttachmentPtr; //-------------------------------------------------------------------------- class IAttachment { protected: // fields /** * value of attachment full path name */ std::string m_attachFullPath; /** * value of attachment short name used to display in message */ std::string m_attachShortName; /** * value of attachment file size */ unsigned int m_fileSize; /** * value of attachment mime type */ std::string m_mimeType; /** * The downloaded email file copy to a temporary folder (for security), the file in the temp Folder is dummy File. */ std::string m_dummyFilePath; //std::string m_virtualPath; /** * information if abstract message attachment has been changed and need * update in low level * only name may be changed, not path */ bool m_validAttachment; bool m_isCreatedProperly; bool m_isDownloaded; bool m_hasDummyFile; // If object have a dummy file, is deleted when it destroy; int m_attachmentID; // attachment ID from email service. bool m_isInlineAttachment; // is inline attachment from email service. int m_nth; // attachment order index, 1 base. IMessagePtr m_message; //message ptr public: // methods explicit IAttachment(); void init(const std::string& fullPath, bool isVirtualPath); virtual ~IAttachment(); /** * getter of attachment name (only name without path) value */ std::string getShortName() const; /** * getter of attachment name (full path) value */ std::string getFullPath() const; /** * getter of attachment size */ unsigned int getFileSize() const; /** * getter of attachment mime type */ std::string getMimeType() const; /** * setter of attachment mime type */ void setMimeType(const std::string &mimeType); IMessagePtr getMessage() const; void setMessage(const IMessagePtr& message); /** * getter of attachment valid */ bool getIsCreatedProperly() const; bool getIsValidAttachment() const; /** * rename short name value of attachment */ void rename(const std::string& newName); //void setVirtualPath(const std::string& virtualPath); // std::string getVirtualPath(); void setAttachmentID(int id); int getAttachmentID() const; void setDownloaded(bool downloaded); bool getDownloaded() const; void setIsInlineAttachment(bool isInlineAttachment); bool getIsInlineAttachment() const; void setDummyFilePath(const std::string& dummyFilePath); std::string getDummyFilePath() const; bool hasDummyFile() const; int getNth() { return m_nth; } void setNth(int nth) { m_nth = nth; } private: void makeShortName(); virtual std::string getRealPath(const std::string &path) const = 0; }; } } #endif