home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / komunikace / kmeleon / K-Meleon1.1.3en-US.exe / macros / mail.kmm < prev    next >
Text File  |  2007-05-04  |  4KB  |  97 lines

  1. # K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
  2.  
  3. # ---------- Mail And News Functionality ---------------------------------------------------------------------------
  4. #
  5. # Dependencies    : main.kmm ($macroPrefBranch, JS)
  6. # Resources    : -
  7. # Preferences    : kmeleon.plugins.macros.mailClient
  8. #          kmeleon.plugins.macros.newsClient
  9. #
  10. # ------------------------------------------------------------------------------------------------------------------
  11.  
  12. Mail_ConfigureMail{
  13. $_pref=$_Mail_pref_mailClient; $_macro="_Mail_DefaultMail"; $_tit=_("Mail Configuration"); $_txt=_("Enter your mail client's path or your web mailer's URL:"); &_Mail_Configure;
  14. }
  15. Mail_ConfigureNews{
  16. $_pref=$_Mail_pref_newsClient; $_macro="_Mail_DefaultNews"; $_tit=_("News Configuration"); $_txt=_("Enter your news client's path or your news provider's URL:"); &_Mail_Configure;
  17. }
  18.  
  19. Mail_ReadMail{
  20. $_pref=$_Mail_pref_mailClient; $_macro="Mail_ConfigureMail"; &_Mail_Open;
  21. }
  22. Mail_ReadNews{
  23. $_pref=$_Mail_pref_newsClient; $_macro="Mail_ConfigureNews"; &_Mail_Open;
  24. }
  25.  
  26. Mail_ComposeMessage{
  27. open("mailto:");
  28. }
  29.  
  30. Mail_SendPageURL{
  31. $JS_doit="with(top.document)location='mailto:?subject='+encodeURIComponent(title)+'&body='+encodeURIComponent(URL)"; &JS_hndlDoc;
  32. }
  33. Mail_SendLinkURL{
  34. $JS_doitLink="j=a.length;location='mailto:?body='+encodeURIComponent(href)"; &JS_hndlLink;
  35. }
  36. Mail_SendImageURL{
  37. $JS_doitImage="a=false;location='mailto:?subject='+encodeURIComponent((title)?title:((alt)?alt:document.title))+'&body='+encodeURIComponent(src)"; $JS_doitInput=$JS_doitImage; &JS_hndlImage;
  38. }
  39. Mail_SendFrameURL{
  40. $JS_doit="location='mailto:?subject='+encodeURIComponent(title)+'&body='+encodeURIComponent(URL)"; &JS_hndlDoc;
  41. }
  42. Mail_SendSelection{
  43. $JS_doit="if(getSelection())location='mailto:?subject='+encodeURIComponent(title)+'&body='+encodeURIComponent(getSelection())"; $SelectedText==""?0:&JS_hndlDoc;
  44. }
  45.  
  46. # ----- PRIVATE
  47.  
  48. $_Mail_pref_mailClient=$macroPrefBranch."mail.mailClient";
  49. $_Mail_pref_newsClient=$macroPrefBranch."mail.newsClient";
  50.  
  51. _Mail_DefaultMail{
  52. $__key="Software\\Clients\\Mail\\";
  53. $__key=$__key.readreg("HKLM",$__key);
  54. $__def=readreg("HKLM",$__key."\\shell\\open\\command\\");
  55. $__sys=readreg("HKLM",$__key."\\protocols\\mailto\\shell\\open\\command\\");
  56. $__usr=readreg("HKCR","mailto\\shell\\open\\command\\");
  57. $__usr==$__sys?$_client=$__def:$_client=$__usr;
  58. }
  59. _Mail_DefaultNews{
  60. $__key="Software\\Clients\\News\\";
  61. $__key=$__key.readreg("HKLM",$__key);
  62. $__def=readreg("HKLM",$__key."\\shell\\open\\command\\");
  63. $__sys=readreg("HKLM",$__key."\\protocols\\news\\shell\\open\\command\\");
  64. $__usr=readreg("HKCR","news\\shell\\open\\command\\");
  65. $__usr==$__sys?$_client=$__def:$_client=$__usr;
  66. }
  67.  
  68. _Mail_Open{
  69. $_client=getpref(STRING,$_pref); $_client==""?macros($_macro):0; $_client==""?0:(index($_client,"://")==-1?exec($_client):opennew($_client));
  70. }
  71. _Mail_Configure{
  72. $_client=getpref(STRING,$_pref); $_client==""?macros($_macro):0; $_client=prompt($_txt,$_tit,$_client); $_client==""?0:setpref(STRING,$_pref,$_client);
  73. }
  74.  
  75. _Mail_BuildMenu{
  76. # tools menu
  77. setmenu(MailNews,popup,"&Mail And News");
  78. setmenu("&Mail And News",inline,_Mail_Mail);
  79. setmenu("&Mail And News",inline,_Mail_News);
  80. setmenu("&Mail And News",inline,_Mail_Cnfg);
  81. setmenu(_Mail_Mail,macro,"Read &Mail",Mail_ReadMail);
  82. setmenu(_Mail_Mail,macro,"New Me&ssage...",Mail_ComposeMessage);
  83. setmenu(_Mail_Mail,macro,"Sen&d Page As Link...",Mail_SendPageURL);
  84. setmenu(_Mail_News,macro,"Read &News",Mail_ReadNews,0);
  85. setmenu(_Mail_Cnfg,macro,"Configure M&ail...",Mail_ConfigureMail);
  86. setmenu(_Mail_Cnfg,macro,"Configure N&ews...",Mail_ConfigureNews);
  87. # context menus
  88. setmenu(DocumentSave,macro,"Sen&d Page As Link...",Mail_SendPageURL);
  89. setmenu(FrameSave,macro,"Sen&d Frame As Link...",Mail_SendFrameURL);
  90. setmenu(ImageSave,macro,"Sen&d Image As Link...",Mail_SendImageURL);
  91. setmenu(LinkSave,macro,"Sen&d Link URL...",Mail_SendLinkURL);
  92. setmenu(Selection,macro,"Sen&d By Mail...",Mail_SendSelection);
  93. }
  94. $OnInit=$OnInit."_Mail_BuildMenu;";
  95.  
  96. # ------------------------------------------------------------------------------------------------------------------
  97. $macroModules=$macroModules."Mail;";