File indexing completed on 2025-01-19 03:52:45

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-11-07
0007  * Description : mail settings container.
0008  *
0009  * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2010      by Andi Clemens <andi dot clemens at googlemail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_MAIL_SETTINGS_H
0017 #define DIGIKAM_MAIL_SETTINGS_H
0018 
0019 // Qt includes
0020 
0021 #include <QtGlobal>
0022 #include <QList>
0023 #include <QString>
0024 #include <QStringList>
0025 #include <QUrl>
0026 #include <QMap>
0027 
0028 class KConfigGroup;
0029 
0030 namespace DigikamGenericSendByMailPlugin
0031 {
0032 
0033 class MailSettings
0034 {
0035 
0036 public:
0037 
0038     /**
0039      * Images selection mode
0040      */
0041     enum Selection
0042     {
0043         IMAGES = 0,
0044         ALBUMS
0045     };
0046 
0047     enum MailClient
0048     {
0049         BALSA = 0,
0050         CLAWSMAIL,
0051         EVOLUTION,
0052         KMAIL,
0053         NETSCAPE,       ///< Messenger (https://en.wikipedia.org/wiki/Netscape_Messenger_9)
0054         OUTLOOK,
0055         SYLPHEED,
0056         THUNDERBIRD
0057     };
0058 
0059     enum ImageFormat
0060     {
0061         JPEG = 0,
0062         PNG
0063     };
0064 
0065 public:
0066 
0067     explicit MailSettings();
0068     ~MailSettings();
0069 
0070     /**
0071      * Read and write settings in config file between sessions.
0072      */
0073     void  readSettings(KConfigGroup& group);
0074     void  writeSettings(KConfigGroup& group);
0075 
0076     QString format()           const;
0077 
0078     /**
0079      * Return the attachment limit in bytes
0080      */
0081     qint64  attachementLimit() const;
0082 
0083     void setMailUrl(const QUrl& orgUrl, const QUrl& emailUrl);
0084     QUrl mailUrl(const QUrl& orgUrl) const;
0085 
0086     /**
0087      * Helper methods to fill combobox from GUI.
0088      */
0089     static QMap<MailClient,  QString> mailClientNames();
0090     static QMap<ImageFormat, QString> imageFormatNames();
0091 
0092 public:
0093 
0094     Selection                 selMode;              ///< Items selection mode
0095 
0096     QList<QUrl>               inputImages;          ///< Selected items to send.
0097 
0098     bool                      addFileProperties;
0099     bool                      imagesChangeProp;
0100 
0101     bool                      removeMetadata;
0102 
0103     int                       imageCompression;
0104 
0105     qint64                    attLimitInMbytes;
0106 
0107     QString                   tempPath;
0108 
0109     MailClient                mailProgram;
0110 
0111     int                       imageSize;
0112 
0113     ImageFormat               imageFormat;
0114 
0115     QMap<QUrl, QUrl>          itemsList;            ///< Map of original item and attached item (can be resized).
0116 
0117     QMap<MailClient, QString> binPaths;             ///< Map of paths for all mail clients.
0118 };
0119 
0120 } // namespace DigikamGenericSendByMailPlugin
0121 
0122 #endif // DIGIKAM_MAIL_SETTINGS_H