mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
Merge branch '2103_mcext_enhancement'
* 2103_mcext_enhancement: Added support of viewing the compiled Java files (*.class). changed type of checking: used -n operator instead of -z Added support of SQLite database files Ticket #2103: mc.ext enhancement
This commit is contained in:
commit
3bc09cc253
@ -7,6 +7,22 @@ action=$1
|
||||
filetype=$2
|
||||
|
||||
|
||||
STAROFFICE_REGEXP='\.(sxw|sdw|stw|sxc|stc|sxi|sti|sxd|std||sxm||sxg)$'
|
||||
|
||||
staroffice_console() {
|
||||
filename=$1;shift
|
||||
is_view=$1; shift
|
||||
if [ -n "${is_view}" ]; then
|
||||
is_view='-dump'
|
||||
fi
|
||||
|
||||
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
|
||||
cd $tmp
|
||||
soffice2html.pl "${filename}"
|
||||
elinks ${is_view} content.html
|
||||
rm -rf "$tmp"
|
||||
}
|
||||
|
||||
do_view_action() {
|
||||
filetype=$1
|
||||
|
||||
@ -15,19 +31,36 @@ do_view_action() {
|
||||
ps2ascii "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
pdf)
|
||||
pdftotext "${MC_EXT_FILENAME}" -
|
||||
pdftotext -layout -nopgbrk "${MC_EXT_FILENAME}" -
|
||||
;;
|
||||
odt)
|
||||
odt2txt "${MC_EXT_FILENAME}"
|
||||
if [ ` echo "${MC_EXT_FILENAME}" | grep -c "${STAROFFICE_REGEXP}"` -ne 0 ]; then
|
||||
staroffice_console "${MC_EXT_FILENAME}" "view"
|
||||
else
|
||||
odt2txt "${MC_EXT_FILENAME}"
|
||||
fi
|
||||
;;
|
||||
msdoc)
|
||||
antiword -t "${MC_EXT_FILENAME}" || \
|
||||
which wvHtml >/dev/null 2>&1 &&
|
||||
{
|
||||
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
|
||||
wvHtml "${MC_EXT_FILENAME}" --targetdir="$tmp" page.html
|
||||
elinks -dump "$tmp/page.html"
|
||||
rm -rf "$tmp"
|
||||
} || \
|
||||
antiword -t "${MC_EXT_FILENAME}" || \
|
||||
catdoc -w "${MC_EXT_FILENAME}" || \
|
||||
word2x -f text "${MC_EXT_FILENAME}" - || \
|
||||
strings "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
msxls)
|
||||
xls2csv "${MC_EXT_FILENAME}" || \
|
||||
which xlHtml >/dev/null 2>&1 && {
|
||||
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
|
||||
xlhtml -a "${MC_EXT_FILENAME}" > "$tmp/page.html"
|
||||
elinks -dump "$tmp/page.html"
|
||||
rm -rf "$tmp"
|
||||
} || \
|
||||
xls2csv "${MC_EXT_FILENAME}" || \
|
||||
strings "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
dvi)
|
||||
@ -46,33 +79,74 @@ do_open_action() {
|
||||
|
||||
case "${filetype}" in
|
||||
ps)
|
||||
(gv "${MC_EXT_FILENAME}" &)
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(gv "${MC_EXT_FILENAME}" &)
|
||||
else
|
||||
ps2ascii "${MC_EXT_FILENAME}" | ${PAGER:-more}
|
||||
fi
|
||||
;;
|
||||
pdf)
|
||||
(xpdf "${MC_EXT_FILENAME}" &)
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(xpdf "${MC_EXT_FILENAME}" &)
|
||||
else
|
||||
pdftotext -layout -nopgbrk "${MC_EXT_FILENAME}" - | ${PAGER:-more}
|
||||
fi
|
||||
#(acroread "${MC_EXT_FILENAME}" &)
|
||||
#(ghostview "${MC_EXT_FILENAME}" &)
|
||||
;;
|
||||
ooffice)
|
||||
(ooffice "${MC_EXT_FILENAME}" &)
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(ooffice "${MC_EXT_FILENAME}" &)
|
||||
else
|
||||
if [ ` echo "${MC_EXT_FILENAME}" | grep -c "${STAROFFICE_REGEXP}"` -ne 0 ]; then
|
||||
staroffice_console "${MC_EXT_FILENAME}"
|
||||
else
|
||||
odt2txt "${MC_EXT_FILENAME}" | ${PAGER:-more}
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
abw)
|
||||
(abiword "${MC_EXT_FILENAME}" &)
|
||||
;;
|
||||
msdoc)
|
||||
(abiword "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(abiword "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
else
|
||||
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
|
||||
wvHtml "${MC_EXT_FILENAME}" --targetdir="$tmp" page.html -1
|
||||
elinks "$tmp/page.html"
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
;;
|
||||
msxls)
|
||||
(gnumeric "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(gnumeric "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
else
|
||||
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
|
||||
xlhtml -a "${MC_EXT_FILENAME}" > "$tmp/page.html"
|
||||
elinks "$tmp/page.html"
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
;;
|
||||
msppt)
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(ooffice %f >/dev/null 2>&1 &)
|
||||
else
|
||||
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
|
||||
ppthtml %f > "$tmp/page.html"
|
||||
elinks "$tmp/page.html"
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
;;
|
||||
framemaker)
|
||||
fmclient -f "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
dvi)
|
||||
if [ x$DISPLAY = x ]; then
|
||||
dvisvga "${MC_EXT_FILENAME}"
|
||||
else
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(xdvi "${MC_EXT_FILENAME}" &)
|
||||
else
|
||||
dvisvga "${MC_EXT_FILENAME}" || \
|
||||
dvi2tty "${MC_EXT_FILENAME}" | ${PAGER:-more}
|
||||
fi
|
||||
;;
|
||||
djvu)
|
||||
|
@ -33,10 +33,10 @@ do_open_action() {
|
||||
(gimp "${MC_EXT_FILENAME}" &)
|
||||
;;
|
||||
*)
|
||||
if [ "$DISPLAY" = "" ]; then
|
||||
zgv "${MC_EXT_FILENAME}"
|
||||
else
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(gqview "${MC_EXT_FILENAME}" &)
|
||||
else
|
||||
zgv "${MC_EXT_FILENAME}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
@ -32,6 +32,9 @@ do_view_action() {
|
||||
dbf)
|
||||
dbview -b "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
sqlite)
|
||||
sqlite3 "${MC_EXT_FILENAME}" .dump
|
||||
;;
|
||||
mo)
|
||||
msgunfmt "${MC_EXT_FILENAME}" || \
|
||||
cat "${MC_EXT_FILENAME}"
|
||||
@ -42,6 +45,9 @@ do_view_action() {
|
||||
torrent)
|
||||
ctorrent -x "${MC_EXT_FILENAME}" 2>/dev/null
|
||||
;;
|
||||
javaclass)
|
||||
jad -p "${MC_EXT_FILENAME}" 2>/dev/null
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
@ -57,6 +63,9 @@ do_open_action() {
|
||||
dbf)
|
||||
dbview "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
sqlite)
|
||||
sqlite3 "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
glade)
|
||||
if glade-3 --version >/dev/null 2>&1; then
|
||||
(glade-3 "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
|
@ -32,10 +32,10 @@ do_open_action() {
|
||||
|
||||
case "${filetype}" in
|
||||
common)
|
||||
if [ "$DISPLAY" = "" ]; then
|
||||
play "${MC_EXT_FILENAME}"
|
||||
else
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
else
|
||||
play "${MC_EXT_FILENAME}"
|
||||
fi
|
||||
;;
|
||||
mod)
|
||||
@ -46,17 +46,17 @@ do_open_action() {
|
||||
vplay -s 22 "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
mp3)
|
||||
if [ "$DISPLAY" = "" ]; then
|
||||
mpg123 "${MC_EXT_FILENAME}"
|
||||
else
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
else
|
||||
mpg123 "${MC_EXT_FILENAME}"
|
||||
fi
|
||||
;;
|
||||
ogg)
|
||||
if [ "$DISPLAY" = "" ]; then
|
||||
ogg123 "${MC_EXT_FILENAME}"
|
||||
else
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(xmms "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
else
|
||||
ogg123 "${MC_EXT_FILENAME}"
|
||||
fi
|
||||
;;
|
||||
midi)
|
||||
@ -66,10 +66,10 @@ do_open_action() {
|
||||
mplayer -vo null "${MC_EXT_FILENAME}"
|
||||
;;
|
||||
playlist)
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
mplayer -vo null -playlist "${MC_EXT_FILENAME}"
|
||||
else
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(xmms -p "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
else
|
||||
mplayer -vo null -playlist "${MC_EXT_FILENAME}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
|
@ -112,7 +112,14 @@ do_open_action() {
|
||||
esac | ${pager}
|
||||
;;
|
||||
chm)
|
||||
which kchmviewer > /dev/null 2>&1 && (kchmviewer "${MC_EXT_FILENAME}" &) || (xchm "${MC_EXT_FILENAME}" &)
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
which kchmviewer > /dev/null 2>&1 \
|
||||
&& (kchmviewer "${MC_EXT_FILENAME}" &) \
|
||||
|| (xchm "${MC_EXT_FILENAME}" &)
|
||||
else
|
||||
chm_http "${MC_EXT_FILENAME}" & elinks http://localhost:8080/index.html
|
||||
kill -INT %1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
@ -25,7 +25,11 @@ do_open_action() {
|
||||
(realplay "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
;;
|
||||
*)
|
||||
(mplayer "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
if [ -n "$DISPLAY" ]; then
|
||||
(mplayer "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
else
|
||||
mplayer -vo null "${MC_EXT_FILENAME}"
|
||||
fi
|
||||
#(gtv "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
#(xanim "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
|
||||
;;
|
||||
|
@ -6,7 +6,6 @@
|
||||
action=$1
|
||||
filetype=$2
|
||||
|
||||
|
||||
do_view_action() {
|
||||
filetype=$1
|
||||
|
||||
@ -26,10 +25,11 @@ do_open_action() {
|
||||
|
||||
case "${filetype}" in
|
||||
html)
|
||||
(if test -n "@X11_WWW@" && test -n "$DISPLAY"; then
|
||||
(if [ -n "@X11_WWW@" -a -n "$DISPLAY" ]; then
|
||||
(@X11_WWW@ file://"${MC_EXT_CURRENTDIR}"/"${MC_EXT_BASENAME}" &) 1>&2
|
||||
else
|
||||
links "${MC_EXT_FILENAME}" || \
|
||||
elinks "${MC_EXT_FILENAME}" || \
|
||||
links "${MC_EXT_FILENAME}" || \
|
||||
lynx -force_html "${MC_EXT_FILENAME}" || \
|
||||
${PAGER:-more} "${MC_EXT_FILENAME}"
|
||||
fi) 2>/dev/null
|
||||
|
@ -564,6 +564,10 @@ type/^Microsoft\ Excel
|
||||
Open=@EXTHELPERSDIR@/doc.sh open msxls
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view msxls
|
||||
|
||||
regex/i/\.(ppt|pps)$
|
||||
Open=@EXTHELPERSDIR@/doc.sh open msppt
|
||||
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view msppt
|
||||
|
||||
# Use OpenOffice.org to open any MS Office documents
|
||||
type/^Microsoft\ Office\ Document
|
||||
Open=@EXTHELPERSDIR@/doc.sh open ooffice
|
||||
@ -588,6 +592,10 @@ regex/i/\.djvu?$
|
||||
|
||||
### Miscellaneous ###
|
||||
|
||||
# Compiled Java classes
|
||||
shell/.class
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view javaclass
|
||||
|
||||
# Makefile
|
||||
regex/[Mm]akefile$
|
||||
Open=make -f %f %{Enter parameters}
|
||||
@ -600,9 +608,14 @@ shell/Imakefile
|
||||
regex/^Makefile.(PL|pl)$
|
||||
Open=%var{PERL:perl} %f
|
||||
|
||||
# sqlite3.db
|
||||
type/^SQLite 3.x database
|
||||
Open=@EXTHELPERSDIR@/misc.sh open sqlite
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view sqlite
|
||||
|
||||
# dbf
|
||||
shell/i/.dbf
|
||||
Open=%view{ascii} @EXTHELPERSDIR@/misc.sh open dbf
|
||||
Open=@EXTHELPERSDIR@/misc.sh open dbf
|
||||
View=%view{ascii} @EXTHELPERSDIR@/misc.sh view dbf
|
||||
|
||||
# REXX script
|
||||
|
Loading…
Reference in New Issue
Block a user