OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 17 | Rev 73 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
17 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.ui.preferences;
15
 
16
public class EmailProps extends AbstractProps {
17
    public static final int DEFAULT = 0;
18
    public static final int THUNDERBIRD = 1;
19
    public static final int OUTLOOK = 2;
20
    protected static EmailProps instance;
41 ilm 21
    private String propsFileName = null;
17 ilm 22
 
23
    public synchronized static EmailProps getInstance() {
24
        if (instance == null) {
25
            instance = new EmailProps();
26
        }
27
        return instance;
28
    }
29
 
30
    @Override
31
    protected String getPropsFileName() {
41 ilm 32
        if (this.propsFileName == null) {
33
            return "./Configuration/Email.properties";
34
        } else {
35
            return this.propsFileName;
36
        }
17 ilm 37
    }
38
 
41 ilm 39
    public void setPropsFileName(String propsFileName) {
40
        this.propsFileName = propsFileName;
41
    }
42
 
17 ilm 43
    public String getThunderbirdPath() {
44
        final String stringProperty = this.getStringProperty("thunderbird.path");
45
        if (stringProperty.trim().length() == 0) {
46
            return "C:\\Program Files\\Mozilla Thunderbird\\thunderbird.exe";
47
        }
48
        return stringProperty;
49
    }
50
 
51
    public void setThunderbirdPath(String text) {
52
        this.setProperty("thunderbird.path", text);
53
    }
54
 
55
    public int getMode() {
56
        return this.getIntProperty("mode");
57
    }
58
 
59
    public void setMode(int mode) {
60
        this.setProperty("mode", String.valueOf(mode));
61
    }
62
 
63
    public void setTitle(String text) {
64
        this.setProperty("title", String.valueOf(text));
65
    }
66
 
67
    public String getTitle() {
68
        return this.getStringProperty("title");
69
    }
70
 
71
    public void setHeader(String text) {
72
        this.setProperty("header", String.valueOf(text));
73
    }
74
 
75
    public String getHeader() {
76
        return this.getStringProperty("header");
77
    }
78
 
79
    public void setFooter(String text) {
80
        this.setProperty("footer", String.valueOf(text));
81
    }
82
 
83
    public void setEncodingCharsetName(String charset) {
84
        this.setProperty("encoding", charset);
85
    }
86
 
87
    public String getFooter() {
88
        return this.getStringProperty("footer");
89
    }
90
 
91
    public String getEncodingCharsetName() {
92
        String charset = "UTF-8";
93
        String tmp = this.getStringProperty("encoding");
94
        if (tmp.trim().length() > 0) {
95
            charset = tmp;
96
        }
97
        return charset;
98
    }
99
 
100
    @Override
101
    protected int getDefautIntValue() {
102
        return DEFAULT;
103
    }
104
 
105
}