Forum has been closed due to ongoing spam issues.
It is kept search and read-able as a reference. Registrations and logins are disabled. Please use the mailing lists instead.

   SearchSearch
Mount a Filesystem

 
Krusader Forum Index -> User Action System
View previous topic :: View next topic  
Author Message
shie
Author


Joined: 17 Oct 2001
Posts: 1552

PostPosted: Tue Jan 11, 2005 12:27 pm    Post subject: Mount a Filesystem

jonas, today i discovered the true power of the user action system
here's mine:

Code:

<!DOCTYPE KrusaderUserActions>
<KrusaderUserActions>
 <action name="newmount" >
  <title>Mount</title>
  <tooltip>Mount a new filesystem</tooltip>
  <icon>hdd_mount</icon>
  <command run_as="root" executionmode="collect_output" >mount -t %_Ask(&quot;Filesystem Type?&quot;)% %_Ask(&quot;Device ?&quot;)% %_Ask(&quot;Mount Point ?&quot;)%</command>
  <defaultshortcut>Alt+Ctrl+M</defaultshortcut>
 </action>
</KrusaderUserActions>


however, with it, i post a small bug report (or a feature request?):
run this action, and it asks your "what filesystem type?". at this point, there's no way to cancel the action. whenever you click cancel, it just continues to the next phase.
_________________
Shie Erlich
Krusader Krew
Back to top
View user's profile Send private message Visit poster's website
jbaehr
Developer


Joined: 04 Dec 2003
Posts: 604
Location: germany

PostPosted: Tue Jan 11, 2005 1:43 pm    Post subject:

The problem is that the useraction-system is based on chunk-replacement, not a scripting-language. So the token %_ask()% will be replaced by the value you enter, nothing more. I'll have a look if it's possible to disable the cancel-button.
If you want ot cancel an action before the comandline is executed you have to use the checkbox on the advance-page. Then you will get a line-edit where the whole command (with substituted placeholders) is displayed. Here you can edit it again an also cancel the execution.

However I could add the ability to cancel at %_ask()%. Therefore I could replace the token with, lets say KRUSADER_UA_ASK_CANCEL and don't execute the commandline if this string is found in the command. But this wouldn't solve your problem because if you cancel the first %_ask% the others will be displayed anyway....

I want to add real scripting using KJSEmbeded (I heard also of KScript which should make it more easy to add JS-scriptinng to a programm but this is not done yet) in the far, far future. Then some more complicated actions will be possible.
Back to top
View user's profile Send private message Visit poster's website
jbaehr
Developer


Joined: 04 Dec 2003
Posts: 604
Location: germany

PostPosted: Wed Jan 12, 2005 10:39 pm    Post subject:

OK, I played a bit and now it's possible for every placeholder to cancel an execution.
Please check out the latest CVS and let me know if that solves your little problem
Back to top
View user's profile Send private message Visit poster's website
shie
Author


Joined: 17 Oct 2001
Posts: 1552

PostPosted: Wed Jan 12, 2005 10:49 pm    Post subject:

thanks, i will
_________________
Shie Erlich
Krusader Krew
Back to top
View user's profile Send private message Visit poster's website
jbaehr
Developer


Joined: 04 Dec 2003
Posts: 604
Location: germany

PostPosted: Sun Jan 23, 2005 11:01 pm    Post subject:

Since I'm working on JavaScript-support for Krusader, I created a sample extension which does the same then your Useraction but with a real GUI
check out the newest CVS and try this:
http://www.jonas-baehr.de/forum/root-mount-extension.tar.bz2
(You need KJSEmbed installed. Gentoo-users can emerge it directly while others have to install the package KDEbindings)

Something else: If a programm called by an useraction does not exits like exepted, Krusader will crash (in this case if mount can't find the mountpoint or so).
I know that this is a very heavy bug, but I haven't any idea how to fix this :/
Back to top
View user's profile Send private message Visit poster's website
shie
Author


Joined: 17 Oct 2001
Posts: 1552

PostPosted: Sun Jan 23, 2005 11:18 pm    Post subject:

why should it crash?
what am i missing?
_________________
Shie Erlich
Krusader Krew
Back to top
View user's profile Send private message Visit poster's website
jbaehr
Developer


Joined: 04 Dec 2003
Posts: 604
Location: germany

PostPosted: Sun Jan 23, 2005 11:56 pm    Post subject:

Try to mount (via useraction, meaning KrActionProc) /dev/lalala, assuming that you don't have a device named lalalala. Then mount doesn't exist normaly but with an error. On my machine this causes krusader to crash. It's the same with every app which don't terminate normaly.[/u]
Back to top
View user's profile Send private message Visit poster's website
shie
Author


Joined: 17 Oct 2001
Posts: 1552

PostPosted: Mon Jan 24, 2005 12:01 am    Post subject:

here's what i did:
1) create the mount user-action
2) ask it to run in terminal - or collect output - don't remember
3) run mount
4) got error: only root can do that (not normal exit)

krusader didn't crash

is that what u mean?
_________________
Shie Erlich
Krusader Krew
Back to top
View user's profile Send private message Visit poster's website
jbaehr
Developer


Joined: 04 Dec 2003
Posts: 604
Location: germany

PostPosted: Mon Jan 24, 2005 12:08 am    Post subject:

hmm.. you're right, this time I did't get a crash... strange. It has to be something else...
Back to top
View user's profile Send private message Visit poster's website
shie
Author


Joined: 17 Oct 2001
Posts: 1552

PostPosted: Mon Jan 24, 2005 12:19 am    Post subject:

you didn't send again the TC color scheme, right?
can u plz?
_________________
Shie Erlich
Krusader Krew
Back to top
View user's profile Send private message Visit poster's website
jbaehr
Developer


Joined: 04 Dec 2003
Posts: 604
Location: germany

PostPosted: Tue May 10, 2005 8:52 pm    Post subject:

I've fixed a nasty usability-issue for the JavaScript-extensions. With a newly introduced variable scriptDir the extensions should always find thier .ui-files.
Check out the latest CVS (make sure you have libKJSEmbed installed), grap http://www.jonas-baehr.de/forum/root-mount-extension.tar.bz2 and have fun
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Krusader Forum Index -> User Action System All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group