summaryrefslogtreecommitdiffstats
path: root/src/app/mount.js
blob: 3aadcc8b31cd65cdf7058c9e41c87432f2541d56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
   This is an extension for the Krusader filemanager
   http://krusader.sf.net/
   
   Author: Jonas Bähr, http://www.jonas-baehr.de/
   
   This script shows a dialog for mounting a device. The commandline which is
   returned by this is executed by Krusader's UserAction-system
   Krusader looks for the variable 'cmd'.

   scriptDir is a string-variable set by Krusader with the directory of the currently
   executed script. This is usefull for relative path's inside scripts.
*/

var ui = Factory.loadui( scriptDir + 'mount.ui' );

ui.child('device').setFocus();

var m = ui.exec();

var cmd = "@CANCEL@"; //FIXME: replace this with UserAction.cancel

if (m) {
   var cmd = "mount";
   var device = ui.child('device').url;
   var mountpoint = ui.child('mountpoint').url;
   var filesystem = ui.child('filesystem').currentText;
   var options = ui.child('options').text;

   if ( filesystem != '<auto>' && filesystem != '' )
      cmd += " -t " + filesystem;
   if ( options != '' )
      cmd += " " + options;

   cmd +=  " " + device + " " + mountpoint;
}