2004-10-27 [paul]
authorPaul Mangan <paul@claws-mail.org>
Wed, 27 Oct 2004 10:24:57 +0000 (10:24 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 27 Oct 2004 10:24:57 +0000 (10:24 +0000)
* tools/kdeservicemenu/README
* tools/kdeservicemenu/install.sh
* tools/kdeservicemenu/sylpheed-kdeservicemenu.pl
* tools/kdeservicemenu/template_sylpheed-attach-files.desktop
* tools/kdeservicemenu/template_sylpheed-compress-attach.desktop
add uninstall function
refactor

ChangeLog.claws
tools/kdeservicemenu/README
tools/kdeservicemenu/install.sh
tools/kdeservicemenu/sylpheed-kdeservicemenu.pl
tools/kdeservicemenu/template_sylpheed-attach-files.desktop
tools/kdeservicemenu/template_sylpheed-compress-attach.desktop

index 83af6ec..1a85b24 100644 (file)
@@ -1,8 +1,13 @@
 2004-10-27 [paul]
 
+       * tools/kdeservicemenu/README
+       * tools/kdeservicemenu/install.sh
        * tools/kdeservicemenu/sylpheed-kdeservicemenu.pl
+       * tools/kdeservicemenu/template_sylpheed-attach-files.desktop
+       * tools/kdeservicemenu/template_sylpheed-compress-attach.desktop
                output files to /tmp instead of littering the
                current dir
+               add uninstall function
                refactor
 
 2004-10-26 [christoph] 0.9.12cvs134
index a463054..2a83cdb 100644 (file)
@@ -1,5 +1,5 @@
 sylpheed-kdeservicemenu.pl 
-Version: 1.0
+Version: 1.1
 Sylpheed servicemenu for Konqueror
 
 FILES
@@ -24,17 +24,39 @@ Adds the following menu items to Konqueror's 'Actions' menu:
 /Actions/Sylpheed/Attach as Gzipped Tar Archive
 /Actions/Sylpheed/Attach as Zip Archive
 
+All outputted files are created in /tmp
+Original files are preserved when creating [FILE].gz and [FILE].bz2
+
+REQUIREMENTS
+Perl 5.x.x
+
 INSTALL
 o cd sylpheed-claws/tools/kdeservicemenu
 o ./install.sh --global
   ./install.sh --local
        (systemwide or home directory installation)
+               
+UNINSTALL
+o cd sylpheed-claws/tools/kdeservicemenu
+o ./install.sh --uninstall-global
+  ./install.sh --uninstall-local
+       (systemwide or home directory uninstallation)
+
 
 LICENSE
-GPL
+GNU GENERAL PUBLIC LICENSE
                
 THANKS
-install.sh was written by Dylan Schrader (dschrader@conception.edu) 
+install.sh was written by Dylan Schrader <dschrader@conception.edu> 
 and is released under the GPL. It was originally part of his
 'Attach to email' service Menu for Konqueror, version 0.6.13 
-<http://themes.kde.org/content/show.php?content=11234>
+<http://themes.kde.org/content/show.php?content=11234> and has been
+adapted for Sylpheed servicemenu for Konqueror
+
+LINKS
+Sylpheed-Claws <http://sylpheed-claws.sourceforge.net/>
+Perl <http://www.perl.org>
+KDE <http://www.kde.org>
+
+CONTACT
+Paul Mangan <claws@thewildbeast.co.uk>
index c334d80..ecbadd7 100644 (file)
@@ -5,6 +5,7 @@ DESKTOP_TEMPLATE_ONE="template_sylpheed-attach-files.desktop"
 DESKTOP_ONE="sylpheed-attach-files.desktop"
 DESKTOP_TEMPLATE_TWO="template_sylpheed-compress-attach.desktop"
 DESKTOP_TWO="sylpheed-compress-attach.desktop"
+SERVICEMENU_DIR="share/apps/konqueror/servicemenus"
 
 function check_environ {
 #Check to see if we can coax kde-config into the PATH
@@ -33,19 +34,32 @@ function install_all {
 #Go ahead and install
 echo "Generating $DESKTOP_ONE ..."
 SED_PREFIX=${PREFIX//\//\\\/} #Replace forward slashes in $PREFIX with \/ so that sed doesn't freak out
-sed "s/SCRIPT_PATH/$SED_PREFIX\\/bin\\/sylpheed-kdeservicemenu.pl/" $DESKTOP_TEMPLATE_ONE > $DESKTOP_ONE
-cp -f $DESKTOP_ONE $PREFIX/share/apps/konqueror/servicemenus/sylpheed-attach-files.desktop
+sed "s/SCRIPT_PATH/$SED_PREFIX\\/bin\\/$PERL_SCRIPT/" $DESKTOP_TEMPLATE_ONE > $DESKTOP_ONE
+echo "Installing $PREFIX/$SERVICEMENU_DIR/$DESKTOP_ONE"
+mv -f $DESKTOP_ONE $PREFIX/$SERVICEMENU_DIR/$DESKTOP_ONE
 echo "Generating $DESKTOP_TWO ..."
 SED_PREFIX=${PREFIX//\//\\\/} #Replace forward slashes in $PREFIX with \/ so that sed doesn't freak out
-sed "s/SCRIPT_PATH/$SED_PREFIX\\/bin\\/sylpheed-kdeservicemenu.pl/" $DESKTOP_TEMPLATE_TWO > $DESKTOP_TWO
-cp -f $DESKTOP_TWO $PREFIX/share/apps/konqueror/servicemenus/sylpheed-compress-attach.desktop
+sed "s/SCRIPT_PATH/$SED_PREFIX\\/bin\\/$PERL_SCRIPT/" $DESKTOP_TEMPLATE_TWO > $DESKTOP_TWO
+echo "Installing $PREFIX/$SERVICEMENU_DIR/$DESKTOP_TWO"
+mv -f $DESKTOP_TWO $PREFIX/$SERVICEMENU_DIR/$DESKTOP_TWO
+echo "Installing $PREFIX/bin/$PERL_SCRIPT"
 cp -f $PERL_SCRIPT $PREFIX/bin/
 echo "Setting permissions ..."
-chmod 0644 $PREFIX/share/apps/konqueror/servicemenus/sylpheed-attach-files.desktop
-chmod 0644 $PREFIX/share/apps/konqueror/servicemenus/sylpheed-compress-attach.desktop
+chmod 0644 $PREFIX/$SERVICEMENU_DIR/$DESKTOP_ONE
+chmod 0644 $PREFIX/$SERVICEMENU_DIR/$DESKTOP_TWO
 chmod 0755 $PREFIX/bin/$PERL_SCRIPT
 }
 
+function uninstall_all {
+echo "Removing $PREFIX/$SERVICEMENU_DIR/$DESKTOP_ONE"
+rm $PREFIX/$SERVICEMENU_DIR/$DESKTOP_ONE
+echo "Removing $PREFIX/$SERVICEMENU_DIR/$DESKTOP_TWO"
+rm $PREFIX/$SERVICEMENU_DIR/$DESKTOP_TWO
+echo "Removing $PREFIX/bin/$PERL_SCRIPT"
+rm $PREFIX/bin/$PERL_SCRIPT
+echo "Finished uninstall."
+}
+
 case $1 in
   "--global" )
     check_environ
@@ -65,16 +79,33 @@ case $1 in
     if [ ! -d $PREFIX/bin ]; then
       mkdir $PREFIX/bin
     fi
-    if [ ! -d $PREFIX/share/apps/konqueror/servicemenus ]; then
-      mkdir $PREFIX/share/apps/konqueror/servicemenus
+    if [ ! -d $PREFIX/$SERVICEMENU_DIR ]; then
+      mkdir $PREFIX/$SERVICEMENU_DIR
     fi
     install_all
     ;;
+  "--uninstall-global" )
+    check_environ
+    PREFIX=$(kde-config --prefix)
+    echo "Uninstalling in $PREFIX ..."
+    if [ "$(id -u)" != "0" ]; then
+      echo "You are not root, if you have any global installs, you will probably not have permission to remove them."
+    fi
+    uninstall_all
+    ;;
+  "--uninstall-local" )
+    check_environ
+    PREFIX=$(kde-config --localprefix)
+    echo "Uninstalling in $PREFIX ..."
+    uninstall_all
+    ;;
   * )
-    echo "Usage: $0 [--global|--local]"
+    echo "Usage: $0 [--global|--local|--uninstall-global|--uninstall-local]"
     echo
-    echo "--global  attempts a system-wide installation."
-    echo "--local   attempts to install in your home directory."
+    echo "    --global            attempts a system-wide installation."
+    echo "    --local             attempts to install in your home directory."
+    echo "    --uninstall-global  attempts a system-wide uninstallation."
+    echo "    --uninstall-local   attempts to uninstall in your home directory."
     echo
     exit 0
     ;;
index 449957f..6bda430 100644 (file)
@@ -20,32 +20,32 @@ unless ($ARGV[0]) { exit; }
 
 my $sylpheed = "sylpheed --compose --attach";
 my $prefix = "/tmp/archive.";
-my ($suffix,$command) = find_sufncom($ARGV[0]);
+my $command = find_command($ARGV[0]);
 my ($sel,$att) = split_parts();
 
-if ($ARGV[0] eq "gzip" || $ARGV[0] eq "bzip2") {
+if ($ARGV[0] eq "gz" || $ARGV[0] eq "bz2") {
        exec "$sel$sylpheed $att";
 } elsif ($ARGV[0] eq "attachfile") {
        exec "$sylpheed $sel";
 } else {
-       exec "$command $prefix$suffix $sel;"
-           ."$sylpheed $prefix$suffix";
+       exec "$command $prefix$ARGV[0] $sel;"
+           ."$sylpheed $prefix$ARGV[0]";
 }
 
 exit;
 
-sub find_sufncom {
+sub find_command {
        local($s) = @_;
-       my ($suf,$com);
+       my $com;
        
-       if ($s eq "gzip") { $suf = "gz"; $com = "$s -c"; }
-       elsif ($s eq "bzip2") { $suf = "bz2"; $com = "$s -c"; }
-       elsif ($s eq "zip") { $suf = "zip"; $com = "$s -r"; }
-       elsif ($s eq "tar") { $suf = "tar"; $com = "$s -c -f"; }
-       elsif ($s eq "tarbzip2") { $suf = "tar.bz2"; $com = "tar -cj -f"; }
-       elsif ($s eq "targz") { $suf = "tar.gz"; $com = "tar -cz -f"; }
+       if ($s eq "gz")         { $com = "gzip -c"; }
+       elsif ($s eq "bz2")     { $com = "bzip2 -c"; }
+       elsif ($s eq "zip")     { $com = "$s -r"; }
+       elsif ($s eq "tar")     { $com = "$s -c -f"; }
+       elsif ($s eq "tar.bz2") { $com = "tar -cj -f"; }
+       elsif ($s eq "tar.gz")  { $com = "tar -cz -f"; }
        
-       return ($suf,$com);
+       return $com;
 }
 
 sub split_parts {
@@ -55,9 +55,10 @@ sub split_parts {
        for (my $count = $#ARGV; $count > 0; $count--) {
                my @s = split("/", $ARGV[$count]);
                my $p = pop(@s);
-               if ($ARGV[0] eq "gzip" || $ARGV[0] eq "bzip2") {
-                       my $psub = substitute($p);
-                       my $output = "/tmp/$psub.$suffix";
+               if ($ARGV[0] eq "gz" || $ARGV[0] eq "bz2") {
+                       my $psub = $p;
+                       $psub =~ s/\s/_/g;
+                       my $output = "/tmp/$psub.$ARGV[0]";
                        $selectedParts .= "$command \"$p\" > $output;";
                        $attachedParts .= "$output ";
                } else {
@@ -66,9 +67,3 @@ sub split_parts {
        }
        return ($selectedParts,$attachedParts);
 }
-
-sub substitute {
-       local($s) = @_;
-       $s =~ s/\s/_/g;
-       return $s;
-}
index 8bc8564..3b0b18f 100644 (file)
@@ -12,9 +12,9 @@ Exec=SCRIPT_PATH attachfile %F
 [Desktop Action GZipAndAttach]
 Name=Attach as GZip File(s)
 Icon=sylpheed
-Exec=SCRIPT_PATH gzip %F
+Exec=SCRIPT_PATH gz %F
 
 [Desktop Action BZipAndAttach]
 Name=Attach as BZip File(s)
 Icon=sylpheed
-Exec=SCRIPT_PATH bzip2 %F
+Exec=SCRIPT_PATH bz2 %F
index 1142308..579358a 100644 (file)
@@ -12,12 +12,12 @@ Exec=SCRIPT_PATH tar %F
 [Desktop Action TarBzipAndAttach]
 Name=Attach as Bzipped Tar Archive
 Icon=sylpheed
-Exec=SCRIPT_PATH tarbzip2 %F
+Exec=SCRIPT_PATH tar.bz2 %F
 
 [Desktop Action TarGzipAndAttach]
 Name=Attach as Gzipped Tar Archive
 Icon=sylpheed
-Exec=SCRIPT_PATH targz %F
+Exec=SCRIPT_PATH tar.gz %F
 
 [Desktop Action ZipAndAttach]
 Name=Attach as Zip Archive