在qtassistant所在的根目录(bin目录外)建立一个openqch文件
#!/bin/sh
export RM=$(which rm)
export MAKEDIR=$(which mkdir)
export BINHOME="$(dirname $0)"
export BIN="${BINHOME}/bin"
#export BINBASE=$(basename $0)
export QCHFILE="$1"
export LD_LIBRARY_PATH=${BINHOME}/lib:${LD_LIBRARY_PATH}
if [ -z "${QCHFILE}" ]; then
export PATH="${BIN}"
assistant
else
export BASE="$(basename ${QCHFILE})"
export BOOKTEMP="${BINHOME}/temp/bookindex"
export QHCPFILE="${BOOKTEMP}/${BASE}.qhcp"
export QHCFILE="${BOOKTEMP}/${BASE}.qhc"
${MAKEDIR} -p "${BOOKTEMP}"
export PATH="${BIN}"
#export LD_LIBRARY_PATH=${BINHOME}
echo \<?xml version=\"1.0\" encoding=\"utf8\"?\> > "${QHCPFILE}"
echo \ >> "${QHCPFILE}"
echo \ >> "${QHCPFILE}"
echo \ >> "${QHCPFILE}"
echo \${QCHFILE}\ >> "${QHCPFILE}"
echo \ >> "${QHCPFILE}"
echo \ >> "${QHCPFILE}"
echo \ >> "${QHCPFILE}"
qcollectiongenerator "${QHCPFILE}" -o "${QHCFILE}"
${RM} "${QHCPFILE}"
assistant -collectionFile "${QHCFILE}"
${RM} "${QHCFILE}"
fi
使用时在命令行中敲入命令:
openqch xxx.qch
或者将其与qch类型文件绑定,方法如下:
在${HOME}/.local/share/applications 下建立一个QtAssistant.desktop
[Desktop Entry]
Exec=/hd/tools/Reader/QtAssistant/openqch "%f"
Name=QtAssistant
Type=Application
在系统设置中将该文件与qch文件类型绑定