File indexing completed on 2024-06-23 05:18:34

0001 /*
0002    SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "plugincomposerinterface.h"
0008 #include "composer/composerattachmentinterface.h"
0009 #include "composer/composerviewbase.h"
0010 #include "composer/composerviewinterface.h"
0011 #include <MessageComposer/AttachmentModel>
0012 #include <MessageComposer/ConvertSnippetVariablesJob>
0013 using namespace MessageComposer;
0014 
0015 PluginComposerInterface::PluginComposerInterface() = default;
0016 
0017 PluginComposerInterface::~PluginComposerInterface()
0018 {
0019     delete mComposerViewInterface;
0020 }
0021 
0022 void PluginComposerInterface::setComposerViewBase(ComposerViewBase *composerViewBase)
0023 {
0024     delete mComposerViewInterface;
0025     mComposerViewInterface = new MessageComposer::ComposerViewInterface(composerViewBase);
0026 }
0027 
0028 QString PluginComposerInterface::subject() const
0029 {
0030     return mComposerViewInterface->subject();
0031 }
0032 
0033 QString PluginComposerInterface::replyTo() const
0034 {
0035     return mComposerViewInterface->replyTo();
0036 }
0037 
0038 QString PluginComposerInterface::to() const
0039 {
0040     return mComposerViewInterface->to();
0041 }
0042 
0043 QString PluginComposerInterface::cc() const
0044 {
0045     return mComposerViewInterface->cc();
0046 }
0047 
0048 QString PluginComposerInterface::from() const
0049 {
0050     return mComposerViewInterface->from();
0051 }
0052 
0053 MessageComposer::ComposerAttachmentInterface PluginComposerInterface::attachments()
0054 {
0055     return mComposerViewInterface->attachments();
0056 }
0057 
0058 QString PluginComposerInterface::shortDate() const
0059 {
0060     return mComposerViewInterface->shortDate();
0061 }
0062 
0063 QString PluginComposerInterface::longDate() const
0064 {
0065     return mComposerViewInterface->longDate();
0066 }
0067 
0068 QString PluginComposerInterface::shortTime() const
0069 {
0070     return mComposerViewInterface->shortTime();
0071 }
0072 
0073 QString PluginComposerInterface::longTime() const
0074 {
0075     return mComposerViewInterface->longTime();
0076 }
0077 
0078 QString PluginComposerInterface::insertDayOfWeek() const
0079 {
0080     return mComposerViewInterface->insertDayOfWeek();
0081 }
0082 
0083 QString PluginComposerInterface::variableFromEnum(MessageComposer::ConvertSnippetVariablesUtil::VariableType type) const
0084 {
0085     return MessageComposer::ConvertSnippetVariablesUtil::snippetVariableFromEnum(type);
0086 }
0087 
0088 QString PluginComposerInterface::convertVariable(MessageComposer::ConvertSnippetVariablesUtil::VariableType type) const
0089 {
0090     return MessageComposer::ConvertSnippetVariablesJob::convertVariables(mComposerViewInterface,
0091                                                                          MessageComposer::ConvertSnippetVariablesUtil::snippetVariableFromEnum(type));
0092 }
0093 
0094 QString PluginComposerInterface::convertText(const QString &str) const
0095 {
0096     return MessageComposer::ConvertSnippetVariablesJob::convertVariables(mComposerViewInterface, str);
0097 }