~cszikszoy/do-plugins/fix-confluence

« back to all changes in this revision

Viewing changes to ClawsMail/src/ClawsContactDetailItem.cs

  • Committer: David Siegel
  • Date: 2009-01-07 19:40:53 UTC
  • mfrom: (407.1.4 trunk)
  • Revision ID: david@x-20090107194053-wseaq4rkw4y12bka
Merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ClawsContactDetailItem.cs 
 
2
 *
 
3
 * GNOME Do is the legal property of its developers. Please refer to the
 
4
 * COPYRIGHT file distributed with this
 
5
 * source distribution.
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation, either version 3 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 */
 
20
 
 
21
using System;
 
22
using Mono.Unix;
 
23
using Do.Universe;
 
24
 
 
25
namespace Claws {
 
26
        
 
27
        /// <summary>
 
28
        /// Claws contact.
 
29
        /// </summary>
 
30
        public class ClawsContactDetailItem: Item, IContactDetailItem {
 
31
 
 
32
                const string IconForOthers = "stock_person";
 
33
                const string IconForMail = "stock_mail-compose";
 
34
                
 
35
                string type, detail, name, icon;
 
36
 
 
37
                #region std properties
 
38
                
 
39
                public override string Name {
 
40
                        get { return name; }
 
41
                }
 
42
 
 
43
                public override string Description {
 
44
                        get { return detail; } 
 
45
                }
 
46
 
 
47
                public string Key {
 
48
                        get { return type; } 
 
49
                }
 
50
                
 
51
                public string Value {
 
52
                        get { return detail; } 
 
53
                }
 
54
 
 
55
                public override string Icon {
 
56
                        get { return icon; }
 
57
                }
 
58
 
 
59
                #endregion
 
60
                
 
61
                public ClawsContactDetailItem (string type, string detail) 
 
62
                {
 
63
                        this.type = type.ToLower ();
 
64
                        this.detail = detail;
 
65
 
 
66
                        if (type.StartsWith ("email.")) {
 
67
                                icon = IconForMail;
 
68
                                
 
69
                                string remark = type.Substring (type.LastIndexOf (".") + 1);
 
70
                                if (type.StartsWith (ClawsContactsItemSource.ClawsPrimaryEmailPrefix)) {
 
71
                                        name = Catalog.GetString ("Primary Email") + " " + remark;
 
72
                                } else {
 
73
                                        if (remark.Length > 0) {
 
74
                                                name = Catalog.GetString ("Email") + " " + remark;
 
75
                                        } else {
 
76
                                                name = Catalog.GetString ("Other email");
 
77
                                        }
 
78
                                }
 
79
                                
 
80
                        } else {                                
 
81
                                icon = IconForOthers;
 
82
                                name = Catalog.GetString ("Other");
 
83
                        }
 
84
                }
 
85
 
 
86
 
 
87
        }
 
88
}