01: /*
02: * Created on 31.10.2004
03: *
04: * TODO To change the template for this generated file go to
05: * Window - Preferences - Java - Code Generation - Code and Comments
06: */
07: package org.columba.mail.nativ.defaultmailclient;
08:
09: import com.jniwrapper.win32.registry.RegistryKey;
10:
11: /**
12: * @author Timo
13: *
14: * TODO To change the template for this generated type comment go to
15: * Window - Preferences - Java - Code Generation - Code and Comments
16: */
17: public class Win32SystemDefaultMailClient implements
18: SystemDefaultMailClient {
19:
20: /**
21: * @see org.columba.mail.nativ.defaultmailclient.SystemDefaultMailClient#isDefaultMailClient()
22: */
23: public boolean isDefaultMailClient() {
24: RegistryKey mailClients = RegistryKey.LOCAL_MACHINE.openSubKey(
25: "Software").openSubKey("Clients").openSubKey("Mail",
26: true);
27: if (mailClients == null)
28: return true;
29:
30: return mailClients.values().get("").equals("Columba");
31: }
32:
33: /**
34: * @see org.columba.mail.nativ.defaultmailclient.SystemDefaultMailClient#setDefaultMailClient()
35: */
36: public void setDefaultMailClient() {
37: RegistryKey mailClients = RegistryKey.LOCAL_MACHINE.openSubKey(
38: "Software").openSubKey("Clients").openSubKey("Mail",
39: true);
40:
41: if (mailClients.exists("Columba")) {
42: mailClients.values().put("", "Columba");
43:
44: // Copy the commandline from the client info to the Classes mailto entry
45: RegistryKey classesMailto = RegistryKey.CLASSES_ROOT
46: .openSubKey("mailto").openSubKey("shell")
47: .openSubKey("open").openSubKey("command", true);
48:
49: RegistryKey clientMailto = mailClients
50: .openSubKey("Columba").openSubKey("Protocols")
51: .openSubKey("mailto").openSubKey("shell")
52: .openSubKey("open").openSubKey("command");
53:
54: classesMailto.values().put("",
55: clientMailto.values().get(""));
56: }
57: }
58: }
|