~ubuntu-branches/ubuntu/quantal/kipi-plugins/quantal

« back to all changes in this revision

Viewing changes to .pc/sendimages-icedove.diff/sendimages/emailsettingscontainer.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer, Alessandro Ghersi, Felix Geyer
  • Date: 2010-08-26 19:33:41 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20100826193341-oyh7rh1eamgk521i
Tags: 1.4.0-0ubuntu1
[ Alessandro Ghersi ]
* kipi-plugins-common replaces/conflicts kipi-plugins << 1.3.0

[ Felix Geyer ]
* New upstream bugfix release.
* Drop fix-ftbfs-glib-2.25.diff, applied upstream.
* Refresh sendimages-icedove.diff.
* Switch to source format 3.0 (quilt) so we can use bz2 upstream tarballs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of kipi-plugins project
 
4
 * http://www.kipi-plugins.org
 
5
 *
 
6
 * Date        : 2007-11-07
 
7
 * Description : e-mail settings container.
 
8
 *
 
9
 * Copyright (C) 2007-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 * Copyright (C) 2010 by Andi Clemens <andi dot clemens at gmx dot net>
 
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 EMAILSETTINGSCONTAINER_H
 
25
#define EMAILSETTINGSCONTAINER_H
 
26
 
 
27
// Qt includes
 
28
 
 
29
#include <QList>
 
30
#include <QString>
 
31
#include <QStringList>
 
32
 
 
33
// KDE includes
 
34
 
 
35
#include <kurl.h>
 
36
 
 
37
namespace KIPISendimagesPlugin
 
38
{
 
39
 
 
40
class EmailItem
 
41
{
 
42
 
 
43
public:
 
44
 
 
45
    int         rating;         // Image Rating from Kipi host.
 
46
 
 
47
    QString     comments;       // Image comments from Kipi host.
 
48
 
 
49
    QStringList tags;           // List of keywords from Kipi host.
 
50
 
 
51
    KUrl        orgUrl;         // Url of original image.
 
52
    KUrl        emailUrl;       // Url of attached image in e-mail (can be resized).
 
53
};
 
54
 
 
55
class EmailSettingsContainer
 
56
{
 
57
 
 
58
public:
 
59
 
 
60
    enum EmailClient
 
61
    {
 
62
        DEFAULT = 0,        // Default e-mail settings from KDE control panel.
 
63
        BALSA,
 
64
        CLAWSMAIL,
 
65
        EVOLUTION,
 
66
        GMAILAGENT,
 
67
        KMAIL,
 
68
        NETSCAPE,
 
69
        SYLPHEED,
 
70
        SYLPHEEDCLAWS,
 
71
        THUNDERBIRD
 
72
    };
 
73
 
 
74
    enum ImageSize
 
75
    {
 
76
        VERYSMALL = 0,
 
77
        SMALL,
 
78
        MEDIUM,
 
79
        BIG,
 
80
        VERYBIG,
 
81
        HUGE
 
82
    };
 
83
 
 
84
    enum ImageFormat
 
85
    {
 
86
        JPEG = 0,
 
87
        PNG
 
88
    };
 
89
 
 
90
public:
 
91
 
 
92
    EmailSettingsContainer()
 
93
    {
 
94
        addCommentsAndTags      = false;
 
95
        imagesChangeProp        = false;
 
96
        attachmentLimitInMbytes = 17;
 
97
        imageCompression        = 75;
 
98
        emailProgram            = KMAIL;
 
99
        imageSize               = MEDIUM;
 
100
        imageFormat             = JPEG;
 
101
    };
 
102
 
 
103
    ~EmailSettingsContainer(){};
 
104
 
 
105
    int size()
 
106
    {
 
107
        if(imageSize == SMALL)
 
108
            return 640;
 
109
        else if(imageSize == MEDIUM)
 
110
            return 800;
 
111
        else if(imageSize == BIG)
 
112
            return 1024;
 
113
        else if(imageSize == VERYBIG)
 
114
            return 1280;
 
115
        else if(imageSize == HUGE)
 
116
            return 1600;
 
117
        else
 
118
            return 320; // VERYSMALL
 
119
    };
 
120
 
 
121
    QString format()
 
122
    {
 
123
        if (imageFormat == JPEG)
 
124
            return QString("JPEG");
 
125
 
 
126
        return QString("PNG");
 
127
    };
 
128
 
 
129
    void setEmailUrl(const KUrl& orgUrl, const KUrl& emailUrl)
 
130
    {
 
131
        for (QList<EmailItem>::iterator it = itemsList.begin();
 
132
            it != itemsList.end(); ++it)
 
133
        {
 
134
            if ((*it).orgUrl == orgUrl)
 
135
            {
 
136
                (*it).emailUrl = emailUrl;
 
137
                return;
 
138
            }
 
139
        }
 
140
    };
 
141
 
 
142
    KUrl emailUrl(const KUrl& orgUrl)
 
143
    {
 
144
        for (QList<EmailItem>::iterator it = itemsList.begin();
 
145
            it != itemsList.end(); ++it)
 
146
        {
 
147
            if ((*it).orgUrl == orgUrl)
 
148
            {
 
149
                return (*it).emailUrl;
 
150
            }
 
151
        }
 
152
    };
 
153
 
 
154
    qint64 attachementLimitInBytes()
 
155
    {
 
156
        qint64 val = attachmentLimitInMbytes * 1024 * 1024;
 
157
        return val;
 
158
    }
 
159
 
 
160
public:
 
161
 
 
162
    bool             addCommentsAndTags;
 
163
    bool             imagesChangeProp;
 
164
 
 
165
    int              imageCompression;
 
166
 
 
167
    int              attachmentLimitInMbytes;
 
168
 
 
169
    QString          tempPath;
 
170
    QString          tempFolderName;
 
171
 
 
172
    EmailClient      emailProgram;
 
173
 
 
174
    ImageSize        imageSize;
 
175
 
 
176
    ImageFormat      imageFormat;
 
177
 
 
178
    QList<EmailItem> itemsList;
 
179
};
 
180
 
 
181
}  // namespace KIPISendimagesPlugin
 
182
 
 
183
#endif  // EMAILSETTINGSCONTAINER_H