You are not logged in.

#1 2017-03-22 09:33

michaelk
Member
Registered: 2017-03-16
Posts: 81

servicemenu from KDE4 wanted for q4os

Konqueror can store complete websites using the formate *.war. Quite handy. But it has the restriction that one can make useof it only for oneself. It makes no sense to send such a *.war-file to other people as it might be that they do not use KDE.

So a one-click-servicemenu is nice to decompress it and get a normal directory from this website, with an index.html within this directory. With a konsole command „cp example.war example.tar.gz“ one can do it and then we have a right-click servicemenu already there: „uncompress to example/“

In KDE4-konqueror there is such a servicemenu. The executed commend (if one clicks on such a *.war-file) is:
„Exec=ark --batch --autodestination --autosubfolder %F“

If I do it under KDE-Trinity the options “batch“, „autodestination“ and „autosubfolger“ are not recognized.

My questions to the experienced guys here are:

1. can this problem solved under kde-trinity?
2. how would a servicemnu-file for this purpose would lool like?

[Priority: very nice to have feature; but not life-sustaining...]

Offline

#2 2017-03-22 10:25

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: servicemenu from KDE4 wanted for q4os

As this is a question rather than a "Tip" or "Tutorial" it might be better placed in the Support section of the forum, however, if you can post an example "war" file I will look into how this could be implemented.

At a first glance of the man-page for ark-trinity I would imagine you could use something like

--extract-to
     Extract 'archive' to 'folder'. Quit when finished.  'folder' will be created  if  it  does
     not exist.

together with

--guess-name
     Used with '--extract-to'. When specified, 'archive' will be extracted to  a  subfolder  of
     'folder' whose name will be the name of 'archive' without the filename extension.

And it will use the archive name to create a folder and extract the contents there. I think this is what you are trying to achieve, let me know if I'm wrong. smile

Offline

#3 2017-03-22 10:56

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: servicemenu from KDE4 wanted for q4os

Thanks again for the quick response. You are right: would have been better to place it under Support as it is a kind of proposal.

...if you can post an example "war" file I will look into how this could be implemented.

I do not know how to attach such a file. Too complicated. If you view this site just go to the menu bar and select „archive this page“ (if you have installed konq-plugins). It will archive the whole site as a *.war-file and store it on your computer. And you may rename it to shorten the too long name I had used when trying your proposal:

user@q4os-desktop:~/Schreibtisch/a.q4os.spezifisch$ ark --guess-name Setting_Up_Multiple_Virtual_Desktops_Q4OS_Support_Q4OS_Forum.war
tdeio (KMimeType): WARNING: mimetype not valid '' (missing entry in the file ?).

For me it means that somehow I have to put .war-files into the list of compressed archives. If this is somehow not possible then a wanted servicemenus would have to do do something like „cp *.war *.tar.gz“ and then „ark --guess name *.tar.gz“. Right?

Offline

#4 2017-03-22 12:33

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: servicemenu from KDE4 wanted for q4os

I have done a few quick tests on a war file and although it's not perfect one solution (without renaming files) is to use the command

ark --extract-to "" --guess-name war-file.war

This will pop a box up to ask for the file type, you can select Tar Archive and it will unpack to a directory with the same name as the file. This is not a full solution but a part way there, I have a lot to do today so will not be able to look further into this until tonight but will see if there is a way to tell ark from the cli of the type of file.

I did notice that the mime-type is gzip so I would have thought ark would detect this but maybe it doesn't read the mime-type when processing files.

Obviously you can easily rename the files and then the above command would work without issue.

HTH

Offline

#5 2017-03-22 13:19

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: servicemenu from KDE4 wanted for q4os

Thanks, your proposal works exactly the way you described. For sure this is the right first step. May be it will be possible to develop a suitable servicemenu for it, like it is already done in KDE4.

To rename *.war to *tar using the konsole „cp *.war *.tar“ is sufficient for coming to a status, where one just has to to do a right click on the *.tar-file and get it uncompressed to a folder with the same name.

And, do not forget: if such a thread is organized well enough one can use it as well for showing linux to beginners! ;-)

Offline

#6 2017-03-23 00:04

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: servicemenu from KDE4 wanted for q4os

Ok the solution is in two parts, the first is to create a script to copy the file to the /tmp folder, change the extension, and then unpack the archive. So first you would create a script with the following content...

#!/bin/bash

for filename in "$@"
do
    cp "$filename" /tmp/
    justname=`basename "$filename"`
    justpath=${filename%/*}
    name_without_extension=${justname%.*}
    mv "/tmp/$justname" "/tmp/$name_without_extension.tar.gz"
    ark --extract-to "$justpath/" --guess-name "/tmp/$name_without_extension.tar.gz"
done

Save this file as /opt/trintiy/bin/war_script and make it executable...

sudo chmod +x /opt/trinity/bin/war_script

Next you want to create the servicemenu file with the following contents...

[Desktop Action runScript]
Exec=war_script %u
Icon=
Name=Extract web archive

[Desktop Entry]
Actions=runScript
Encoding=UTF-8
X-TDE-ServiceTypes=application/x-webarchive
Icon=

Save this as /opt/trinity/share/apps/konqueror/servicemenus/war-extract.desktop
Now right click on a web archive file and you should see an entry titled Extract web archive which will extract the archive.

Offline

#7 2017-03-23 07:18

michaelk
Member
Registered: 2017-03-16
Posts: 81

Re: servicemenu from KDE4 wanted for q4os

Thank you again! Works flawless.

Now I have the functionality on this KDE3-Desktop that I needed and, except for the fact that you helped out at a midnight time, a nice example more for how to solve problems under Linux.

Regards,

Michael

Off topic: how can I support your development works? I could not find a hint for that.

Offline

#8 2017-03-23 09:49

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,989

Re: servicemenu from KDE4 wanted for q4os

Thank you michaelk, I am happy to help. smile

Last edited by Dai_trying (2017-03-23 16:30)

Offline

Board footer

Powered by FluxBB