OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 41 | Rev 156 | 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;
73 ilm 41
        load();
41 ilm 42
    }
43
 
17 ilm 44
    public String getThunderbirdPath() {
45
        final String stringProperty = this.getStringProperty("thunderbird.path");
46
        if (stringProperty.trim().length() == 0) {
47
            return "C:\\Program Files\\Mozilla Thunderbird\\thunderbird.exe";
48
        }
49
        return stringProperty;
50
    }
51
 
52
    public void setThunderbirdPath(String text) {
53
        this.setProperty("thunderbird.path", text);
54
    }
55
 
56
    public int getMode() {
57
        return this.getIntProperty("mode");
58
    }
59
 
60
    public void setMode(int mode) {
61
        this.setProperty("mode", String.valueOf(mode));
62
    }
63
 
64
    public void setTitle(String text) {
65
        this.setProperty("title", String.valueOf(text));
66
    }
67
 
68
    public String getTitle() {
69
        return this.getStringProperty("title");
70
    }
71
 
72
    public void setHeader(String text) {
73
        this.setProperty("header", String.valueOf(text));
74
    }
75
 
76
    public String getHeader() {
77
        return this.getStringProperty("header");
78
    }
79
 
80
    public void setFooter(String text) {
81
        this.setProperty("footer", String.valueOf(text));
82
    }
83
 
84
    public void setEncodingCharsetName(String charset) {
85
        this.setProperty("encoding", charset);
86
    }
87
 
88
    public String getFooter() {
89
        return this.getStringProperty("footer");
90
    }
91
 
92
    public String getEncodingCharsetName() {
93
        String charset = "UTF-8";
94
        String tmp = this.getStringProperty("encoding");
95
        if (tmp.trim().length() > 0) {
96
            charset = tmp;
97
        }
98
        return charset;
99
    }
100
 
101
    @Override
102
    protected int getDefautIntValue() {
103
        return DEFAULT;
104
    }
105
 
106
}