KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > nativ > defaultmailclient > Win32SystemDefaultMailClient


1 /*
2  * Created on 31.10.2004
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Generation - Code and Comments
6  */

7 package org.columba.mail.nativ.defaultmailclient;
8
9 import com.jniwrapper.win32.registry.RegistryKey;
10
11
12 /**
13  * @author Timo
14  *
15  * TODO To change the template for this generated type comment go to
16  * Window - Preferences - Java - Code Generation - Code and Comments
17  */

18 public class Win32SystemDefaultMailClient implements SystemDefaultMailClient {
19
20     
21     /**
22      * @see org.columba.mail.nativ.defaultmailclient.SystemDefaultMailClient#isDefaultMailClient()
23      */

24     public boolean isDefaultMailClient() {
25         RegistryKey mailClients = RegistryKey.LOCAL_MACHINE.openSubKey("Software").openSubKey("Clients").openSubKey("Mail", true);
26         if( mailClients == null ) return true;
27         
28         return mailClients.values().get("").equals("Columba");
29     }
30
31     /**
32      * @see org.columba.mail.nativ.defaultmailclient.SystemDefaultMailClient#setDefaultMailClient()
33      */

34     public void setDefaultMailClient() {
35         RegistryKey mailClients = RegistryKey.LOCAL_MACHINE.openSubKey("Software").openSubKey("Clients").openSubKey("Mail", true);
36         
37         if( mailClients.exists("Columba")) {
38             mailClients.values().put("", "Columba");
39             
40             // Copy the commandline from the client info to the Classes mailto entry
41
RegistryKey classesMailto = RegistryKey.CLASSES_ROOT.openSubKey("mailto").openSubKey("shell").openSubKey("open").openSubKey("command",true);
42             
43             RegistryKey clientMailto = mailClients.openSubKey("Columba").openSubKey("Protocols").openSubKey("mailto").openSubKey("shell").openSubKey("open").openSubKey("command");
44             
45             classesMailto.values().put("",clientMailto.values().get(""));
46         }
47     }
48 }
49
Popular Tags