This file is indexed.

/usr/share/obextool/obextool.tk is in obextool 0.35-0ubuntu2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
#!/bin/sh
# The next line is executed by /bin/sh, but not tcl \
exec wish "$0" ${1+"$@"}
###
### ObexTool 0.35
###   (c) Gerhard Reithofer, Techn EDV Reithofer, 2003-2006
###   ObexTool is licensed using the GNU General Public Licence,
###   see http://www.gnu.org/copyleft/gpl.html

set OBX_Debug 0
###
### The ObexTool default directory - change if necessary
###
set ObexTool_defdir /usr/share/obextool

###
### ObexTool Version (moved here from lib/obextool.ini)
###
set OBEXTOOLVERSION 0.35

###
### Ensure that the warp_lines call in the
### common dialogues (obextool.ini) use the global variable 
### $glb_dlg_width - ger
###
set glb_dlg_width 60
option add *Dialog.msg.font {Helvetica -12 bold} userDefault
option add *Dialog.msg.wrapLength 0 userDefault
option add *Dialog.msg.width $glb_dlg_width userDefault

package require BWidget
package require tablelist

###
### ObexTool header message
###
proc obex_header { msg } {
  global OBEXTOOLVERSION 
  puts "ObexTool $OBEXTOOLVERSION"
  puts "  (c) Gerhard Reithofer, Techn EDV Reithofer, 2003-2008"
  puts "  ObexTool is licensed using the GNU General Public Licence,"
  puts "  see http://www.gnu.org/copyleft/gpl.html"
  puts "$msg"
}

###
### Usage message
###
proc obex_usage { args } {
  global argv0
  set exit_code 0
  set alen [llength $args]
  if {$alen>1} { puts "Error: [lindex $args 0]" }
  if {$alen>2} { set exit_code [lindex $args 1] }
  obex_header "Usage: [file tail $argv0] \[opt arg\]..."
  puts " --help"
  puts " --version"
  puts " --obexcmd obexftp-wrapper-command"
  puts " --obexdir obextool-main-directory"
  puts " --obexcfg obextool-config-directory"
  puts " --setconf key value"
  puts " --memstat 0|1"
  puts " --debug level"
  puts " Use the environment value:"
  puts " OBEXTOOL to define an ObexTool main default directory (--obexdir),"
  puts " OBEXCMD to define an obexftp default command string (--obexcmd) and"
  puts " OBEXTOOL_CFG to define a default config directory (--obexcfg)."
  exit $exit_code
}

###
### Check for $OBEXDIR definition:
###
### The OBEXDIR path is currently determined this way, ordered by priority:
### 1. check if the command line option "--obexdir" is used
### 2. check the environment variable called OBEXTOOL is set
### 3. check the contents of the TCL-variable "ObexTool_defdir" 
### 4. check if in the subdirectory "lib" of the directory where 
###    "obextool.tk" is located, a file exists with the name
###    "obextool.ini" - if yes, this is the OBEXTOOL directory
###

# existing startup directory has lowest priority - default
set OBEXDIR [file normalize [file dirname $argv0]]

# $ObexTool_defdir directory overrides startup directory
if {[file exists $ObexTool_defdir/lib/obextool.ini]} {
  set OBEXDIR $ObexTool_defdir
}

# environment value overrides defaults
if {[info exists env(OBEXTOOL)]} { set OBEXDIR $env(OBEXTOOL) } 

# commad line overrides all - MUST be defined correctly
if {$argc} {
  foreach {opt arg} $argv {
    switch -- $opt { 
      --help    { obex_usage }
      --version { obex_header "Use --help for detailed information."
                  exit 0 }
      --obexdir { set OBEXDIR $arg }
        default { }
    }
  }
}

if {![file exists $OBEXDIR/lib/obextool.ini]} {
  puts "$msg"
  puts "ObexTool startup error: unable to find the ObexTool main directory '$dir'!"
  puts "Ensure to start the main executable directly or set the environment"
  puts "variable OBEXTOOL the ObexTool main directory, e.g."
  puts "     export OBEXTOOL=/usr/local/obext01a"
  puts "or use the command line parameter '--obexdir' to define the ObexTool main"
  puts "directory. If you want to startup the ObexTool from another directory,"
  puts "create a shell program, which points to the full pathname of the"
  puts "main executable obextool.tk, file links will NOT work. E.g.:"
  puts "     $ObexTool_defdir/obextool.tk"
  puts "You may also change the default directory variable 'ObexTool_defdir'"
  puts "in the main executable obextool.tk to fit your suits."
  exit 1
}

###
### Check for $OBEXCFG definition:
### The OBEXCFG path (this is new) - where to find the configuration files:
### 1. check if the command line option "--obexcfg" is used
### 2. check the subdirectory "etc" of the main directory (OBEXDIR/etc)
### 3. check the environment variable called OBEXTOOL_CFG is set,
###    which points to the configuration directory
###
set OBEXCFG $OBEXDIR/etc
if {[info exists env(OBEXTOOL_CFG)]} {
  set OBEXCFG $env(OBEXTOOL_CFG)
}
if {$argc} {
  foreach {opt arg} $argv {
    switch -- $opt {
      --obexcfg { set OBEXCFG $arg }
      default   { }
    }
  }
}

###
### Basic initialization of ObexTool
### The last and only dedicated source statement
###
source $OBEXDIR/lib/obextool.ini

###
### Read the main configuration file first
###
read_obextool_config cfg

###
### Environmet $OBEXCMD as config value override and
### --obexcfg default (idea from Hendrik Sattler)
###
if [info exists env(OBEXCMD)] {
  set ObexConfig(obexftp,command) $env(OBEXCMD)
}
###
### Command line overrides:
### --help, --version, --obexdir and --obexcfg are redundant, 
### as they are managed in an earlier state.
###
if $argc {
# foreach [list opt arg] $argv 
  for {set i 0} {$i<$argc} {incr i} {
    set opt [lindex $argv $i] 
    set arg [lindex $argv [incr i]] 
    debug_out "opt=$opt arg=$arg"
    switch -- $opt {
      --help    { obex_usage }
      --version { 
        obex_header "Use --help for command line information." ; exit 0 }
      --obexcmd { set ObexConfig(obexftp,command) $arg }
      --obexdir { set OBEXDIR $arg }
      --obexcfg { set OBEXCFG $arg }
      --memstat { set ObexConfig(config,memstatus) $arg }
      --setconf { set val [lindex $argv [incr i]]
                  set ObexConfig($arg) $val }
      --debug   { set OBX_Debug $arg }
      default   { obex_usage "Invalid option '$opt'" 1 }
    }
  }
  debug_var OBEXCFG
}

###
### Load language dependent messages
###
load_Messages obextool [getObexCfg config language] $OBEXTOOLVERSION

###
### Read all other configuration files
### ext-config uses function 'get_text'
###
read_obextool_config typ
read_obextool_config ext

###
### Now let's load the obextool packages
###
lappend auto_path $OBEXDIR/lib
package require obexfile
package require obexlist
package require obextree

#####################################################
#                                                   #
#  Begin of ObexTool namespace part                 #
#                                                   #
#####################################################

namespace eval ObexTool {
  variable version $::OBEXTOOLVERSION
  variable mainframe
  variable mem_used 0
  variable dl_last_val 0
  variable dl_active_v 0
  variable array file_types 
  variable obexftp_version "<=0.10.3"
  variable mobile_manufact "*unknown*"
  variable mobile_model "*unknown*"
  variable status_prefix {Got info}
  array set file_types [getObexCfg cfg file_types]

  proc text_view { title txt } {
    variable version 
  debug_out "text_view $title \$txt" 3
    set font   [getObexCfg textwin font]
    set width  [getObexCfg textwin width]
    set height [getObexCfg textwin height]
    set top .txt_view

    set blist [list [get_text "&Close"] \
                    [get_text "Close text window"]\
                      "after idle {destroy $top}"] 
    set wtitle [format [get_text "ObexTool %s - text viewer"] $version]
    set sw [new_swindow $top $wtitle $title $blist 0 .]
    debug_var sw
    set tw [text $sw.txt -width $width -height $height -font $font \
                         -wrap none -bg white]
    pack $tw
    $sw setwidget $tw

    $tw insert end $txt
    BWidget::place $top 0 0 center .
    wm deiconify $top
  }

  #########################################################
  #
  #  ObexTool file functions - file interface
  #  ... no error checkin now ... somethin for todo!
  #
  #########################################################
  proc file_put { args } {
    variable file_types
  debug_out "file_put $args" 3

    set type ""
    set name [ObexList::do_select get $ObexList::list_mode]
    if ![string_empty $name] { 
      set path [lindex $ObexList::lb_entries($name) 0]
      set type [lindex $ObexList::lb_entries($name) 1]
    }

    if [string_empty $type] {
      set inpn [read_filename $name]
    } else {
      set inpn [read_filename $name $type]
    }
    if [string_empty $inpn] return

    set dir [ObexTree::curr_dir]
    if [string_empty $dir] return

    set size [file size $inpn]
    set name [file tail $inpn]
    set dest [make_path $dir $name]

    set_cursor on
    if [ObexFile::path_exists dir $dest] {
      set msg [get_text "A folder with the name '%s' already exists!"]
      append msg [get_text "\nCannot upload file."]
      warning [format $msg $dest]
      set_cursor 
      return
    }

    set overwrite 0
    if [ObexFile::path_exists file $dest] {
      set query [get_text "File '%s' already exists!"]
      append query [get_text "\nDo you want to overwrite the existing file?"]
      if ![ask_yes_no [get_text "Name collision"] [format $query $dest]] {
        status_msg [get_text "File upload cancelled!"]
        set_cursor
        return
      }
      set overwrite 1
    }

    if $overwrite { ObexFile::obexftp rm $dest }
    ObexFile::obexftp pf $inpn $dir

    if [ObexFile::path_exists file $dest] {
      set msg [get_text "File '%s' uploaded to '%s'"]
      ObexTree::refresh_list [format $msg $inpn $dest]
    } else {
      set msg [get_text "File '%s' could not be uploaded to '%s'!"]
      no_permission [format $msg $inpn $dest]
    }
    set_cursor
  }

  proc file_rename { args } {
    variable old_name

    if [llength $args] {
  debug_out "llength \$args=[llength $args]" 5
      set name [lindex $args 0]
      set path [make_path [ObexTree::curr_dir] $name]
    } else {
      set name [ObexList::do_select get $ObexList::list_mode]
  debug_var name 5
      if [string_empty $name] {
        warning [get_text "No file or folder selected to delete!"]
        return
      }
      set path [lindex $ObexList::lb_entries($name) 0]
    }

    set old_name $name
    set new_name [filename_dlg [get_text "New file name:"] $name]
    if [string_empty $new_name] return
    debug_var new_name

    if [string_equal $new_name $old_name] {
      warning [get_text "New name is identical to old name!"]
      return
    }

    set dir_name [ObexTree::curr_dir]
    if [string_empty $dir_name] return

    set_cursor on
    set opath [make_path $dir_name $old_name]
    set npath [make_path $dir_name $new_name]
    debug_out "opath=$opath, npath=$npath"
    ObexFile::obexftp mv $opath $npath

    if [ObexFile::path_exists any $npath] {
      set msg [get_text "File '%s' renamed to '%s'."]
      ObexTree::refresh_list [format $msg $opath $npath]
    } else {
      set msg [get_text "File or folder '%s' could not be renamed!"]
      no_permission [format $msg $opath]
    }
    set_cursor
  }

  proc file_delete { args } {
    debug_out "file_delete $args" 3

    if [llength $args] {
  debug_out "llength \$args=[llength $args]" 5
      set name [lindex $args 0]
      set path [make_path [ObexTree::curr_dir] $name]
    } else {
      set name [ObexList::do_select get $ObexList::list_mode]
  debug_var name 5
      if [string_empty $name] {
        warning [get_text "No file or folder selected to delete!"]
        return
      }
      set path [lindex $ObexList::lb_entries($name) 0]
    }
    set type [lindex $ObexList::lb_entries($name) 1]
  debug_var type 4
    if [string_equal $type "folder"] {
      set query [get_text "Do you really want to delete the folder '%s'?"]
    } else {
      set query [get_text "Do you really want to delete the file '%s'?"]
    }
    if ![ask_yes_no [get_text "Confirmation"] [format $query $path]] {
      status_msg [get_text "Delete action cancelled!"]
      return
    }
  debug_var path 3
    set_cursor on
    ObexFile::obexftp rm $path
    if [ObexFile::path_exists any $path] {
      set msg [get_text "File or folder '%s' could not be deleted!"]
      if [string_equal $type "folder"] {
        append msg [get_text "\nFolders must be empty before deleting."]
      }
      no_permission [format $msg $path]
    } else {
      if [string_equal $type "folder"] {
        ObexTree::refresh_list [format [get_text "Folder '%s' deleted."] $path]
      } else {
        ObexTree::refresh_list [format [get_text "File '%s' deleted."] $path]
      }
    }
    set_cursor 
  }

  ### Custom transport set to 'Siemens'
  ### Connecting...done
  ### Receiving info... Got info 233472:
  ### done
  ### Receiving info... Got info 96256:
  ### done
  ### Disconnecting...done
  proc file_status { show_text } {
    global ObexConfig
    variable status_prefix
    variable mainframe
    variable mem_used
    variable status
  debug_out "file_status $show_text" 3
    set total 0
    set mfree 0
    if ![getObexCfg config memstatus] return
    set_cursor on
    set lines [ObexFile::obexftp st]

    foreach line $lines {
  debug_var line
  debug_out "\[string first $status_prefix $line\]=[string first $status_prefix $line]" 
      if {[string first $status_prefix $line]>=0} {
        set nword [lindex [split $line] end]
        set value [string range $nword 0 end-1]
  debug_var value 3
        if $total {
          set mfree $value
        } else {
  debug_var total 3
          set total $value
        }
      }
    }
    if !$total {
      set msg [get_text "It seems, that your device does not"]
      append msg [get_text " support the memory status feature."]
      append msg [get_text "\nMemory status will be disabled."]
      set ObexConfig(config,memstatus) 0
      warning $msg
      set_cursor 
      return
    }
    set mem_used [expr $total-$mfree]
    set mem_stat [format [get_text "Total %4.1f\nUsed %4.1f\nFree %4.1f"] \
        [expr $total/1024.0] [expr $mem_used/1024.0] [expr $mfree/1024.0]]
    DynamicHelp::register .mainframe.status.prg.bar balloon $mem_stat
    $mainframe configure -progressmax $total
    
    set_cursor 
    if $show_text {
      set    msg [get_text " Memory status\n"]
      append msg [get_text "===============\n"]
      append msg [format [get_text "Memory total: %s bytes\n"] $total]
      append msg [format [get_text "Memory used:  %s bytes\n"] $mem_used]
      append msg [format [get_text "Memory free:  %s bytes\n"] $mfree]
      text_view [get_text "Device memory status"] $msg
    }
  }

  proc get_obexftp_ver {} {
    variable obexftp_version
    debug_out "ObexTool::get_obexftp_ver" 5

    set line [ObexFile::obexftp ve]

  # Try `obexftp --help' for more information.
  # ObexFTP 0.10.4-rc3
    if {[string range $line 0 6] eq "ObexFTP"} { 
      set obexftp_version [string range $line 7 end]
    }
  }

  proc filetype_icon { ext args } {
    set postfix icon
    if [llength $args] { set postfix [lindex $args 0] }
    foreach dir $Bitmap::path {
      set img [glob -nocomplain "$dir/${ext}_${postfix}.*"]
      if [llength $img] { return [lindex $img 0] }
    }
    set img [glob -nocomplain "$dir/file_${postfix}.*"]
    if [llength $img] { return [lindex $img 0] }
    return file
  }

  proc file_type { ext } {
    variable file_types

    if ![string_empty $ext] {
      if [string_equal [string index $ext 0] "."] {
        set typ [string range $ext 1 end]
      }
      set ext [string tolower $ext]
    }
    if {[lsearch [array names file_types] $ext] == -1} { 
      return [format [get_text "%s file"] $ext]
    } else {
##### return [get_text $file_types($ext)]
      return $file_types($ext)
    }
  }

  proc addtoolbar { tbar idx blist } {
  debug_out "ObexTool::addtoolbar $tbar $idx $blist" 3
    set bbox [ButtonBox $tbar.bbox$idx -spacing 0 -padx 1 -pady 1]
    foreach but $blist {
      set imgc [lindex $but 0]
      set help [lindex $but 1]
      set cmnd [lindex $but 2]
    debug_out "imgc=$imgc help=$help cmnd=$cmnd"
      $bbox add -image [Bitmap::get $imgc] \
        -highlightthickness 0 -takefocus 0 -relief link -borderwidth 1 \
        -padx 1 -pady 1 -helptext $help -command $cmnd
    }
    pack $bbox -side left -anchor w
    set sep [Separator $tbar.sep$idx -orient vertical]
    pack $sep -side left -fill y -padx 4 -anchor w
  }

  ###
  ### $font does not work !?!?!? - ger
  ###
  proc about {} {
    variable version
    variable obexftp_version
    variable mobile_manufact 
    variable mobile_model 
    set    msg [get_text "\nA program to communicate with mobile phones using"]
    append msg [get_text " the OBEX protocol (like Siemens, Ericsson or Nokia, ...)"]
    set    aut [format "\n%c Gerhard Reithofer, Techn. EDV Reithofer 2003-2008" 169]
    append aut "\ngerhard.reithofer@tech-edv.co.at, http://www.tech-edv.co.at"
    append msg [get_text "\nObexTool is licensed using the GNU General Public Licence,"]
    append msg [get_text "\nsee http://www.gnu.org/copyleft/gpl.html"]
   
  # set obxftpver [ObexFile::obexftp ve]
  #########################################
  #  set  tec "\nObexftp version: $obexftp_version"
  #  set_cursor on
  #########################################
    
    set info .about
    toplevel $info -borderwidth 0 -relief raised -background white
    wm withdraw $info
    wm title $info [get_text "Program information"]

    set logo [Bitmap::get ObexTool]
    set tfr $info
    label $tfr.l -image $logo -borderwidth 0
    set lfont "Helvetica 18 bold"
    set sfont "Helvetica 14"
    set txtf [frame $tfr.txt]
    Label $txtf.t1 -bg "#ffffff" -font $lfont \
          -text [format [get_text "Version %s"] $version]
    Label $txtf.t2 -bg "#ffffff" -font $sfont -wraplength 550 -text $msg 
    Label $txtf.t3 -bg "#ffffff" -font $sfont -wraplength 550 -text $aut 
    set b1 [Button $tfr.ok -text [get_text "Close"] -width 20 \
             -underline 0 -command "after idle {destroy $info}"]
    eval pack [winfo children $txtf] -fill x -expand yes
    eval pack [winfo children $tfr] -padx 50 -pady 20
    wm transient $info .
    BWidget::place $info 0 0 center 
    wm deiconify $info
    grab set .about
    return .about
  }

  proc create_mainframe { } {
    variable toolbar1 1
    variable mainframe
    variable mem_used
    variable status

    # Menu description
    set file_menu [list\
          [list command [get_text "A&bout"] {} \
                [get_text "Program information"] {Ctrl I}\
                -command {ObexTool::about} ]\
          {separator}\
          [list command [get_text "&Upload"] {} \
                [get_text "Upload a file"] {Ctrl U} \
                -command {ObexTool::file_put} ]\
          [list command [get_text "D&ownload"] {} \
                [get_text "Download a file"] {Ctrl O} \
                -command {ObexList::file_get} ]\
          {separator}\
          [list command [get_text "&New"] {} \
                [get_text "Create a new folder"] {Ctrl N} \
                -command {ObexTree::new_folder} ]\
          [list command [get_text "&Find"] {} \
                [get_text "Find file or folder"] {Ctrl W} \
                -command {ObexTree::find_file} ]\
          {separator}\
          [list command [get_text "&Quit"] {} \
                [get_text "Exit Obex tool"] {Ctrl Q} \
                -command exit ]\
      ]
    set edit_menu [list\
          [list command [get_text "&Cut"] {} \
                [get_text "Cut selection"] {Ctrl X} \
                 -command {ObexList::menu_edit cut} ]\
          [list command [get_text "&Copy"] {} \
                [get_text "Copy selection"] {Ctrl C} \
                -command {ObexList::menu_edit copy} ]\
          [list command [get_text "&Paste"] {} \
                [get_text "Paste selection"] {Ctrl V} \
                -command {ObexList::menu_edit paste} ]\
          {separator}\
          [list command [get_text "&Delete"] {} \
                [get_text "Delete selection"] {Ctrl D} \
                -command {ObexTool::file_delete} ]\
      ]
    if [getObexCfg config filemove] {
      lappend edit_menu \
         [list command [get_text "&Rename"] {}\
               [get_text "Rename selection"] {} \
              -command {ObexTool::file_rename} ]
    }
    set view_menu [list\
          [list command [get_text "&Folder up"] {} \
            [get_text "Up one folder level"] {} \
            -command {ObexTree::up_level}]\
          [list command [get_text "&Reload"] {} \
            [get_text "Reread folder contents"] {Ctrl R} \
            -command {ObexTree::refresh_list ""}]\
          [list command [get_text "&Properties"] {} \
            [get_text "File or folder information"] {Ctrl P} \
            -command {ObexList::show_props} ]\
      ]
    if [getObexCfg config memstatus] {
      lappend view_menu \
          {separator}\
          [list command [get_text "&Memory"] {} \
            [get_text "Memory status"] {Ctrl M} \
            -command {ObexTool::file_status 1} ]
    }
    set opts_menu [list\
          [list checkbutton [get_text "&Toolbar"] {all option} \
              [get_text "Show/hide toolbar"] {}\
              -variable ObexTool::toolbar1 \
              -command  {$ObexTool::mainframe showtoolbar 0 \
                         $ObexTool::toolbar1}\
          ]\
          {separator}\
          [list radiobutton [get_text "&Large icons"] {} \
                       [get_text "Display large icons"] {}  \
                       -command {ObexList::update_list icons}      \
                       -variable ObexTool::list_mode -value icons  ]\
          [list radiobutton [get_text "&File list"]   {} \
                       [get_text "Display file list"]  {}   \
                       -command {ObexList::update_list listb}      \
                       -variable ObexTool::list_mode -value listb  ]\
          [list radiobutton [get_text "&Details"]     {} \
                       [get_text "Display file details"]    {}   \
                       -command {ObexList::update_list detail}     \
                       -variable ObexTool::list_mode -value detail ]\
      ]
    set mainmenu [list \
      [get_text "&File"   ] all file 0 $file_menu\
      [get_text "&Edit"   ] all edit 0 $edit_menu\
      [get_text "&View"   ] all view 0 $view_menu\
      [get_text "&Options"] all options 0 $opts_menu\
    ]
  ### create mainframe, menues, toolbars, status line and status bar 
    if [getObexCfg config memstatus] {
      set mainframe [MainFrame .mainframe -menu $mainmenu \
                         -progressfg [getObexCfg gui status_bg] \
                         -progressvar ObexTool::mem_used \
                         -textvariable ObexTool::status]

  ### Next line is "hard coded" because the BWidgets have no method
  ### for retrieving the progress bar window path - ger
      .mainframe.status.prg.bar configure -bg [getObexCfg gui status_fg]
      $mainframe showstatusbar progression
    } else {
      set mainframe [MainFrame .mainframe -menu $mainmenu \
                         -textvariable ObexTool::status]
    }
  ### toolbar creation
    set tb1  [$mainframe addtoolbar]
    addtoolbar $tb1 1 [list \
      [list upload   [get_text "Upload a file"]  \
            {ObexTool::file_put}]\
      [list download [get_text "Download a file"]\
            {ObexList::file_get}]\
    ]
    addtoolbar $tb1 2 [list \
      [list edit_cut [get_text "Cut selection"]  \
            {ObexList::menu_edit cut  }]\
      [list editcopy [get_text "Copy selection"] \
            {ObexList::menu_edit copy }]\
      [list editpast [get_text "Paste selection"]\
            {ObexList::menu_edit paste}]\
    ]
    addtoolbar $tb1 3 [list \
      [list foldernew [get_text "Create a new folder"]\
            {ObexTree::new_folder}]\
      [list uplevel   [get_text "Up one folder level"]\
            {ObexTree::up_level  }]\
      [list filefind  [get_text "Find file or folder"]\
            {ObexTree::find_file }]\
    ]
    addtoolbar $tb1 4 [list \
      [list reload   [get_text "Reread folder contents"]    \
            {ObexTree::refresh_list ""}]\
      [list fileinfo [get_text "File or folder information"]\
            {ObexList::show_props     }]\
      [list editdele [get_text "Delete selection"]          \
            {ObexTool::file_delete    }]\
    ]
    addtoolbar $tb1 5 [list \
      [list iconlarg [get_text "Display large icons"] \
            {ObexList::update_list icons }]\
      [list iconlist [get_text "Display file list"]   \
            {ObexList::update_list listb }]\
      [list icondetl [get_text "Display file details"]\
            {ObexList::update_list detail}]\
    ]

    # Mainframe creation
    set frame [$mainframe getframe]
    set topframe [frame $frame.widget]

  # ObexTree::create $topframe
    pack $topframe -fill both -expand yes -padx 4 -pady 4
    pack $mainframe -fill both -expand yes -side top
    update idletasks
    return $topframe
  }

  proc main { w args } {
    variable version
    variable setup_variable
    variable setup_values
    variable top_window $w

    set wsize [getObexCfg gui initsize]
    debug_var wsize
    wm withdraw $w

    wm title $w "ObexTool $version"

    set widget [create_mainframe]
    set list_w [ObexTree::create $widget]
    set l_mode [ObexList::create $list_w]

    BWidget::place $w 0 0 center 
    raise $w
    focus -force $w
    wm deiconify $w
    wm geometry $w $wsize
    debug_out "wm geometry $w $wsize"
    ObexTool::get_obexftp_ver
  }
}

### MAIN PART BEGIN ###
###
### Adding our private icon path to search path - ger
###
Bitmap::get cut
lappend Bitmap::path $OBEXDIR/images

set top .
ObexTool::main $top $argv
if [info exists OBX_Debug] {bind $top <ButtonPress-3> "debug_win %W"}

ObexTree::init

after idle {
  ObexList::update_list [getObexCfg list initmode]
  eval "DynamicHelp::configure [getObexCfg gui help_options]"
  ObexTool::file_status 0
}