summaryrefslogtreecommitdiffstats
path: root/kioslave
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-05-09 09:50:34 -0500
committerSlávek Banko <slavek.banko@axis.cz>2013-05-09 19:56:13 +0200
commit9dd9493f97af0370b583f3c6fa5b1bc23d655757 (patch)
treee01aa32a30544e4688e413ce0404d5c4620338cc /kioslave
parentfd31f20cfb50e5b2039fa30eb72302070de44498 (diff)
downloadtdebase-9dd9493f97af0370b583f3c6fa5b1bc23d655757.tar.gz
tdebase-9dd9493f97af0370b583f3c6fa5b1bc23d655757.zip
Add lz/lzma compression support to tdeio_man tdeioslave
This resolves Bug 1493 (cherry picked from commit f08ddb4652c6658ce3ad294509e101da468c1af6)
Diffstat (limited to 'kioslave')
-rw-r--r--kioslave/filter/CMakeLists.txt2
-rw-r--r--kioslave/filter/Makefile.am8
-rw-r--r--kioslave/man/kio_man.cpp28
3 files changed, 30 insertions, 8 deletions
diff --git a/kioslave/filter/CMakeLists.txt b/kioslave/filter/CMakeLists.txt
index 11694d2dd..db98dc37c 100644
--- a/kioslave/filter/CMakeLists.txt
+++ b/kioslave/filter/CMakeLists.txt
@@ -22,7 +22,7 @@ link_directories(
##### other data ################################
-install( FILES gzip.protocol bzip.protocol bzip2.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
+install( FILES gzip.protocol bzip.protocol bzip2.protocol xz.protocol lzma.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
##### kio_filter (module) #######################
diff --git a/kioslave/filter/Makefile.am b/kioslave/filter/Makefile.am
index f315064c8..d95d763dc 100644
--- a/kioslave/filter/Makefile.am
+++ b/kioslave/filter/Makefile.am
@@ -16,6 +16,12 @@ protocoldir = $(kde_servicesdir)
if include_BZIP2
BZIP2FILES=bzip.protocol bzip2.protocol
endif
+if include_XZ
+XZPROTOCOL=xz.protocol
+endif
+if include_LZMA
+LZMAPROTOCOL=lzma.protocol
+endif
-protocol_DATA = gzip.protocol $(BZIP2FILES)
+protocol_DATA = gzip.protocol $(BZIP2FILES) $(XZPROTOCOL) $(LZMAPROTOCOL)
diff --git a/kioslave/man/kio_man.cpp b/kioslave/man/kio_man.cpp
index 30d8dc551..63fed2e5f 100644
--- a/kioslave/man/kio_man.cpp
+++ b/kioslave/man/kio_man.cpp
@@ -70,6 +70,10 @@ void stripExtension( TQString *name )
pos -= 4;
else if ( name->find(".bz", -3) != -1 )
pos -= 3;
+ else if ( name->find(".xz", -3) != -1 )
+ pos -= 3;
+ else if ( name->find(".lzma", -5) != -1 )
+ pos -= 5;
if ( pos > 0 )
pos = name->findRev('.', pos-1);
@@ -476,13 +480,19 @@ void MANProtocol::get(const KURL& url )
{
pageFound=false;
//check for the case that there is foo.1 and foo.1.gz found:
- // ### TODO make it more generic (other extensions)
- if ((foundPages.count()==2) &&
- (((foundPages[0]+".gz") == foundPages[1]) ||
- (foundPages[0] == (foundPages[1]+".gz"))))
- pageFound=true;
- else
+ if (foundPages.count()==2) {
+ TQString foundPage0 = foundPages[0];
+ TQString foundPage1 = foundPages[1];
+
+ stripExtension(&foundPage0);
+ stripExtension(&foundPage1);
+ if(foundPage0 == foundPage1) {
+ pageFound=true;
+ }
+ }
+ if (!pageFound) {
outputMatchingPages(foundPages);
+ }
}
//yes, we found exactly one man page
@@ -1335,6 +1345,12 @@ void MANProtocol::showIndex(const TQString& section)
end -= 2;
else if ( len >= 4 && strcmp( end-3, ".bz2" ) == 0 )
end -= 4;
+ else if ( len >= 3 && strcmp( end-2, ".bz" ) == 0 )
+ end -= 3;
+ else if ( len >= 3 && strcmp( end-2, ".xz" ) == 0 )
+ end -= 3;
+ else if ( len >= 5 && strcmp( end-4, ".lzma" ) == 0 )
+ end -= 5;
while ( end >= begin && *end != '.' )
end--;