[kupfer: 3/7] plugin.clawsmail: +action SendFileByMail for FileLeaves.



commit 111053f4be50d32083eae215d9b6bbd6f728a5f2
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date:   Thu Dec 10 08:43:53 2009 +0100

    plugin.clawsmail: +action SendFileByMail for FileLeaves.
    
    New action allow to simple send files via ClawsMail.

 kupfer/plugin/clawsmail.py |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/kupfer/plugin/clawsmail.py b/kupfer/plugin/clawsmail.py
index ba5ef08..3d270aa 100644
--- a/kupfer/plugin/clawsmail.py
+++ b/kupfer/plugin/clawsmail.py
@@ -1,16 +1,15 @@
 # -*- coding: UTF-8 -*-
 import os
 import re
-import urllib
 from xml.dom import minidom
 
 from kupfer.objects import (Leaf, Action, Source, TextLeaf, UrlLeaf, RunnableLeaf, 
-		FilesystemWatchMixin, AppLeafContentMixin)
+		FilesystemWatchMixin, AppLeafContentMixin, FileLeaf)
 from kupfer import utils
 
 __kupfer_name__ = _("Claws Mail")
 __kupfer_sources__ = ("ClawsContactsSource", )
-__kupfer_actions__ = ("NewMailAction", )
+__kupfer_actions__ = ("NewMailAction", "SendFileByMail")
 __description__ = _("Claws Mail Contacts and Actions")
 __version__ = "0.2"
 __author__ = "Karol BÄ?dkowski <karol bedkowski gmail com>"
@@ -105,6 +104,25 @@ class NewMailAction(Action):
 		return False
 
 
+class SendFileByMail(Action):
+	''' Createn new mail and attach selected file'''
+	def __init__(self):
+		Action.__init__(self, _('Send File by Mail'))
+
+	def activate(self, leaf):
+		filepath = leaf.object
+		utils.launch_commandline("claws-mail --attach '%s'" % filepath)
+
+	def get_icon_name(self):
+		return "mail-message-new"
+
+	def item_types(self):
+		yield FileLeaf
+
+	def get_description(self):
+		return _("Create new mail in ClawsMail and attach selected file")
+
+
 class ClawsContactsSource(AppLeafContentMixin, Source, FilesystemWatchMixin):
 	appleaf_content_id = 'claws-mail'
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]