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

0001 /*
0002   SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
0003 
0004   SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "globalpart.h"
0008 
0009 using namespace MessageComposer;
0010 
0011 class GlobalPart::GlobalPartPrivate
0012 {
0013 public:
0014     GlobalPartPrivate() = default;
0015 
0016     QList<QByteArray> charsets;
0017     QWidget *parentWidgetForGui = nullptr;
0018     bool guiEnabled = true;
0019     bool fallbackCharsetEnabled = false;
0020     bool allow8Bit = false;
0021     bool MDNRequested = false;
0022     bool requestDeleveryConfirmation = false;
0023 };
0024 
0025 GlobalPart::GlobalPart(QObject *parent)
0026     : MessagePart(parent)
0027     , d(new GlobalPartPrivate)
0028 {
0029 }
0030 
0031 GlobalPart::~GlobalPart() = default;
0032 
0033 bool GlobalPart::isGuiEnabled() const
0034 {
0035     return d->guiEnabled;
0036 }
0037 
0038 void GlobalPart::setGuiEnabled(bool enabled)
0039 {
0040     d->guiEnabled = enabled;
0041 }
0042 
0043 QWidget *GlobalPart::parentWidgetForGui() const
0044 {
0045     return d->parentWidgetForGui;
0046 }
0047 
0048 void GlobalPart::setParentWidgetForGui(QWidget *widget)
0049 {
0050     d->parentWidgetForGui = widget;
0051 }
0052 
0053 bool GlobalPart::isFallbackCharsetEnabled() const
0054 {
0055     return d->fallbackCharsetEnabled;
0056 }
0057 
0058 void GlobalPart::setFallbackCharsetEnabled(bool enabled)
0059 {
0060     d->fallbackCharsetEnabled = enabled;
0061 }
0062 
0063 QList<QByteArray> GlobalPart::charsets(bool forceFallback) const
0064 {
0065     QList<QByteArray> ret = d->charsets;
0066     if (d->fallbackCharsetEnabled || forceFallback) {
0067         ret << "us-ascii";
0068         ret << "utf-8";
0069     }
0070     return ret;
0071 }
0072 
0073 void GlobalPart::setCharsets(const QList<QByteArray> &charsets)
0074 {
0075     d->charsets = charsets;
0076 }
0077 
0078 bool GlobalPart::is8BitAllowed() const
0079 {
0080     return d->allow8Bit;
0081 }
0082 
0083 void GlobalPart::set8BitAllowed(bool allowed)
0084 {
0085     d->allow8Bit = allowed;
0086 }
0087 
0088 bool GlobalPart::MDNRequested() const
0089 {
0090     return d->MDNRequested;
0091 }
0092 
0093 void GlobalPart::setMDNRequested(bool requestMDN)
0094 {
0095     d->MDNRequested = requestMDN;
0096 }
0097 
0098 bool GlobalPart::requestDeleveryConfirmation() const
0099 {
0100     return d->requestDeleveryConfirmation;
0101 }
0102 
0103 void GlobalPart::setRequestDeleveryConfirmation(bool value)
0104 {
0105     d->requestDeleveryConfirmation = value;
0106 }
0107 
0108 #include "moc_globalpart.cpp"