kde-improvements/servicemenus: attachToEmail.desktop rotatejpg.desktop scripts/attach-to-email scrip...

glen cvs at pld-linux.org
Fri Jun 9 10:09:35 CEST 2006


Author: glen
Date: Fri Jun  9 10:09:32 2006
New Revision: 7470

Added:
   kde-improvements/servicemenus/rotatejpg.desktop
   kde-improvements/servicemenus/scripts/attach-to-email   (contents, props changed)
   kde-improvements/servicemenus/scripts/jpegtran-rotate   (contents, props changed)
Modified:
   kde-improvements/servicemenus/attachToEmail.desktop
Log:
- update from current kdebase-servicemenus.tar.bz2 (b8ce7213a7f54c97874f1ea9cb7973b3)


Modified: kde-improvements/servicemenus/attachToEmail.desktop
==============================================================================
--- kde-improvements/servicemenus/attachToEmail.desktop	(original)
+++ kde-improvements/servicemenus/attachToEmail.desktop	Fri Jun  9 10:09:32 2006
@@ -10,5 +10,11 @@
 Name[sk]=PridaĹĽ do e-mailu ako prĂ­lohu
 Name[de]=An E-Mail anh�gen
 Name[pt_BR]=Enviar por e-mail como anexo
+Name[nl]=Verzend als bijlage per e-mail
+Name[pl]=WyĹ›lij e-mailem jako zaĹ‚Ä
cznik
+Name[es]=Enviar por correo
+Name[da]=VedhĂŚft til email
+Name[nb]=Vedlegg til e-post
+Name[nn]=Vedlegg til e-post
 Icon=attach
-Exec=/usr/local/bin/multiple-attachments-servicemenu %U
\ No newline at end of file
+Exec=/usr/bin/attach-to-email %U

Added: kde-improvements/servicemenus/rotatejpg.desktop
==============================================================================
--- (empty file)
+++ kde-improvements/servicemenus/rotatejpg.desktop	Fri Jun  9 10:09:32 2006
@@ -0,0 +1,33 @@
+[Desktop Entry]
+ServiceTypes=image/jpg,image/jpeg
+Actions=rotatejpgCCW;rotatejpgCW;rotatejpg180;fliphor;flipver
+
+[Desktop Action rotatejpgCCW]
+Name=Rotate Selected Images AntiClockwise
+Name[pl]=Obróć zaznaczone obrazy przeciwnie ze wskazówkami zegara
+Icon=rotate_ccw
+Exec=jpegtran-rotate 270 %U
+
+[Desktop Action rotatejpgCW]
+Name=Rotate Selected Images Clockwise
+Name[pl]=Obróć zaznaczone obrazy zgodnie ze wskazówkami zegara
+Icon=rotate_cw
+Exec=jpegtran-rotate 90 %U
+
+[Desktop Action rotatejpg180]
+Name=Rotate Selected Images 180 Degrees
+Name[pl]=Obróć zaznaczone obrazy o 180 stopni
+Icon=rotate_cw
+Exec=jpegtran-rotate 180 %U
+
+[Desktop Action fliphor]
+Name=Flip Selected Images Horizontal
+Name[pl]=Zamień zaznaczone obrazy horyzontalnie
+Icon=fliph
+Exec=jpegtran-rotate fliphor %U
+
+[Desktop Action flipver]
+Name=Flip Selected Images Vertical 
+Name[pl]=Zamień zaznaczone obrazy wertykalnie
+Icon=flipv
+Exec=jpegtran-rotate flipver %U

Added: kde-improvements/servicemenus/scripts/attach-to-email
==============================================================================
--- (empty file)
+++ kde-improvements/servicemenus/scripts/attach-to-email	Fri Jun  9 10:09:32 2006
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#Purpose:
+#Used in conjunction with a Konqueror service menu to allow multiple url selection
+#when attaching to email.
+#
+#Author:
+#Dylan Schrader <dschrader at conception.edu>
+import sys
+import os
+import dircache
+import commands
+from string import *
+
+#Default values
+emailclient="$(kde-config --prefix)/bin/kmail -s %s --body %B --attach %A"
+language="en"
+kdeprefix=commands.getoutput("kde-config --prefix")
+kdelocalprefix=commands.getoutput("kde-config --localprefix")
+#Path to kde email configs.
+emailconfigfile="%s/share/config/emaildefaults" % kdelocalprefix
+#Path to kde language configs.
+langconfigfile="%s/share/config/kdeglobals" % kdelocalprefix
+#Various language options.
+languages={
+"en":{"subject":"Attached files","body":"Attached should be:"},
+"cs":{"subject":u"PřiloŞenÊ soubory","body":u"V příloze je/jsou:"},
+"sk":{"subject":u"PriloĹženĂŠ sĂşbory","body":u"V prĂ­lohe je/sĂş:"},
+"la":{"subject":"Scapis iniunctis","body":"Quae erant iniungenda:"},
+"de":{"subject":"Angeh\344ngte Dateien","body":"Angeh\344ngt werden:"},
+"pt_BR":{"subject":"Arquivos anexos","body":u"Os anexos sĂŁo:"},
+"nl":{"subject":"Bijgesloten bestanden","body":"De volgende bestanden zijn bijgesloten:"},
+"pl":{"subject":u"Pliki w zaĹ‚Ä
czniku","body":u"ZaĹ‚Ä
czone pliki:"},
+"es":{"subject":"Incluye archivos","body":"Este correo debe incluir los archivos:"},
+"da":{"subject":u"VedhĂŚftede filer","body":u"VedhĂŚftede filer er:"},
+"nb":{"subject":" Vedlagde filer","body":" Vedlagde filer er:"},
+"nn":{"subject":" Vedlagde filer","body":" Vedlagde filer er:"}
+}
+#Attachments.
+attachments=""
+#The arguments.
+attachmentlist=sys.argv[1:]
+
+def urlsafe(x):
+	"""Make string x safe for urls."""
+	y=""
+	for char in x:
+		if not char in ascii_letters+digits+os.sep:
+			char="%"+str(hex(ord(char)))[2:]
+		y+=char
+	return y
+
+def parseconfig(option,configs):
+	"""Parse configs(list of lines) for option."""
+	value=""
+	for line in configs:
+		line=line.strip()
+		if find(line,option)==-1:
+			continue
+		value=line[len(option):].lstrip().lstrip("=").lstrip()
+	return value
+
+def openconfig(file):
+	"""Open a config file and return a list of lines in it."""
+	try:
+		o=open(file,"r")
+		configlines=o.readlines()
+		o.close()
+		print "Config file found in %s" % (file)
+	except:
+		configlines=[]
+		print "No config file found in %s" % (file)
+	return configlines
+
+configlines=openconfig(emailconfigfile)
+value=parseconfig("EmailClient",configlines)
+if value!="" and os.path.basename(value)!="kmail":
+	emailclient=value
+
+configlines=openconfig(langconfigfile)
+value=parseconfig("Language",configlines)
+if languages.has_key(value):
+	language=value
+elif languages.has_key(value[:2]):
+	#Suppose that you use en_US, but languages only has_key("en").
+	language=value[:2]
+
+subject=languages[language]["subject"]
+body=languages[language]["body"]
+
+for path in attachmentlist:
+	if os.path.isdir(path):
+		#If it's a directory, we want to include all subpaths recursively.
+		#Change this if you want it to do something else (e.g. tar the directory, then attach it.)
+		files=dircache.listdir(path)
+		for file in files:
+			attachmentlist.append(os.path.join(path,file))
+	else:
+		body+="\n\t%s" % (path)
+		if os.path.isabs(path):
+			#if it's a local file (and not http,ftp,etc)
+			if os.path.split(split(emailclient)[0])[1]=="kmail":
+				#kmail will interpret http char codes even for local files;
+				#this compensates for that.
+				path=urlsafe(path)
+		attachments+=" \'%s\'" % (path)
+
+executable=emailclient
+executable=replace(executable,"%s","\'"+subject+"\'")
+executable=replace(executable,"%B","\'"+body+"\'")
+executable=replace(executable,"%A",attachments)
+executable=replace(executable,"%t","")
+executable=replace(executable,"%c","")
+executable=replace(executable,"%b","")
+
+try:
+	print "Executing: %s" % (executable)
+	os.system(executable)
+except UnicodeEncodeError:
+	executable=executable.encode("ascii","replace")
+	print "Environment does not support utf-8 encoding."
+	print "Converted to ASCII encoding."
+	print "Executing: %s" % (executable)
+	os.system(executable)
\ No newline at end of file

Added: kde-improvements/servicemenus/scripts/jpegtran-rotate
==============================================================================
--- (empty file)
+++ kde-improvements/servicemenus/scripts/jpegtran-rotate	Fri Jun  9 10:09:32 2006
@@ -0,0 +1,24 @@
+#!/bin/sh
+ROT=$1
+shift
+while test -f "$1"
+do
+		if [ "$ROT" = "fliphor" ]
+		then
+			echo flipping hor
+ 			`jpegtran -copy all -flip horizontal -outfile rotate "$1"`
+			`mv rotate "$1"`
+		else	
+			if [ "$ROT" = "flipver" ]
+			then
+				echo flipping ver
+				`jpegtran -copy all -flip vertical -outfile rotate "$1"`
+	                        `mv rotate "$1"`
+	               	else
+				echo "rotating2 $ROT"
+			        `jpegtran -copy all -rotate $ROT -outfile rotate "$1"`
+	        		`mv rotate "$1"`
+			fi
+		fi
+	shift
+done


More information about the pld-cvs-commit mailing list