1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2007-11-07
7  * Description : mail settings container.
8  *
9  * Copyright (C) 2007-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2010      by Andi Clemens <andi dot clemens at googlemail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_MAIL_SETTINGS_H
25 #define DIGIKAM_MAIL_SETTINGS_H
26 
27 // Qt includes
28 
29 #include <QtGlobal>
30 #include <QList>
31 #include <QString>
32 #include <QStringList>
33 #include <QUrl>
34 #include <QMap>
35 
36 class KConfigGroup;
37 
38 namespace DigikamGenericSendByMailPlugin
39 {
40 
41 class MailSettings
42 {
43 
44 public:
45 
46     /**
47      * Images selection mode
48      */
49     enum Selection
50     {
51         IMAGES = 0,
52         ALBUMS
53     };
54 
55     enum MailClient
56     {
57         BALSA = 0,
58         CLAWSMAIL,
59         EVOLUTION,
60         KMAIL,
61         NETSCAPE,       ///< Messenger (https://en.wikipedia.org/wiki/Netscape_Messenger_9)
62         OUTLOOK,
63         SYLPHEED,
64         THUNDERBIRD
65     };
66 
67     enum ImageFormat
68     {
69         JPEG = 0,
70         PNG
71     };
72 
73 public:
74 
75     explicit MailSettings();
76     ~MailSettings();
77 
78     /**
79      * Read and write settings in config file between sessions.
80      */
81     void  readSettings(KConfigGroup& group);
82     void  writeSettings(KConfigGroup& group);
83 
84     QString format()           const;
85 
86     /**
87      * Return the attachment limit in bytes
88      */
89     qint64  attachementLimit() const;
90 
91     void setMailUrl(const QUrl& orgUrl, const QUrl& emailUrl);
92     QUrl mailUrl(const QUrl& orgUrl) const;
93 
94     /**
95      * Helper methods to fill combobox from GUI.
96      */
97     static QMap<MailClient,  QString> mailClientNames();
98     static QMap<ImageFormat, QString> imageFormatNames();
99 
100 public:
101 
102     Selection                 selMode;              ///< Items selection mode
103 
104     QList<QUrl>               inputImages;          ///< Selected items to send.
105 
106     bool                      addFileProperties;
107     bool                      imagesChangeProp;
108 
109     bool                      removeMetadata;
110 
111     int                       imageCompression;
112 
113     qint64                    attLimitInMbytes;
114 
115     QString                   tempPath;
116 
117     MailClient                mailProgram;
118 
119     int                       imageSize;
120 
121     ImageFormat               imageFormat;
122 
123     QMap<QUrl, QUrl>          itemsList;            ///< Map of original item and attached item (can be resized).
124 
125     QMap<MailClient, QString> binPaths;             ///< Map of paths for all mail clients.
126 };
127 
128 } // namespace DigikamGenericSendByMailPlugin
129 
130 #endif // DIGIKAM_MAIL_SETTINGS_H
131