This file is indexed.

/usr/share/amsn/plugins/Notes/notes.tcl is in amsn-data 0.98.9-1.

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

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
  #===========================================#
  #         AMSN's User Notes System          #
  #                By Fred                    #
  #         Started on May 1st 2004           #
  #         Made a plugin by Karel Demeyer    #
  #===========================================#


namespace eval ::notesplugin {

	proc Init { dir } {
		::plugins::RegisterPlugin "Notes"
		::plugins::RegisterEvent "Notes" chatmenu addCommandToCWMenu
		::plugins::RegisterEvent "Notes" right_menu addCommandToCLMenu
	}
	
	proc DeInit { } {
		namespace delete ::notes ::notesplugin
	}

	proc addCommandToCWMenu { event evpar } {
		upvar 2 $evpar newvar
		$newvar(menu_name).contact insert [trans cfgalarm] command -label "[trans note]..."\
			-command "::amsn::ShowChatList \"[trans note]\" \[::ChatWindow::getCurrentTab $newvar(window_name)\] ::notes::Display_Notes"
	}
	
	proc addCommandToCLMenu { event evpar } {
		upvar 2 $evpar newvar
		$newvar(menu_name) insert [trans cfgalarm] command -label "[trans note]..." -command "::notes::Display_Notes $newvar(user_login)"

	}
}

# The ::notes namespace contains all the notes
# related functions
namespace eval ::notes {


#//////////////////////////////////////////////////////////////
# Get the available notes for a contact

	proc get_Note { email } {

		global HOME

		set ::notes::notes [list]

		set file [file join $HOME notes ${email}_note.xml]

		if { [file exists $file] } {

			set id [::sxml::init $file]
  			sxml::register_routine $id "notes:note" "::notes::XML_Note"
  			sxml::parse $id
  			sxml::end $id

		} else {
			set ::notes::notes ""
		}
  	 
  	}
  	 
  	 
  	proc XML_Note { cstack cdata saved_data cattr saved_attr args } {
  		upvar $saved_data sdata
  	 
  		set ::notes::notes [lappend ::notes::notes [list "$sdata(${cstack}:created)" "$sdata(${cstack}:modified)" "$sdata(${cstack}:subject)" "$sdata(${cstack}:content)"]]
  	 
  		return 0
  	 
  	}


#//////////////////////////////////////////////////////////////
# Display the notes

	proc Display_Notes { {email ""} } {

		global HOME

		set w ".notemanager"
  	 
  		if {[winfo exists $w]} {
  			raise $w
  			return
  		}
  	 
  		toplevel $w
  		wm title $w "[trans note]"
  		wm geometry $w 660x526+30+30
  		wm protocol $w DELETE_WINDOW "::notes::Display_Notes_Close"		


		# Create the frame containing the list of the contacts
		frame $w.contact -relief sunken -borderwidth 3 
  		listbox $w.contact.box -yscrollcommand "$w.contact.ys set" -font splainf -relief flat -highlightthickness 0 -height 10 -width 20
  		scrollbar $w.contact.ys -command "$w.contact.box yview" -highlightthickness 0 -borderwidth 1 -elementborderwidth 2
  		pack $w.contact.ys -side right -fill y
  		pack $w.contact.box -side left -expand true -fill both

		foreach contact [::abook::getAllContacts] {
			#Selects the contacts who are in our list
			if { [string last "FL" [::abook::getContactData $contact lists]] != -1 } {
				lappend contact_list $contact
			}
		}

		# Sorts contacts
		set sortedcontact_list [lsort -dictionary $contact_list]
		set ::notes::contacts $sortedcontact_list
		set ::notes::contactswithnotes [list]
		# Search contacts with notes
		foreach contact $sortedcontact_list {
			if { [file exists [file join $HOME notes ${contact}_note.xml]] == 1 } {
				lappend ::notes::contactswithnotes $contact
			}
		}
			
		
		foreach contact $sortedcontact_list {
			$w.contact.box insert end "$contact"
		}


		frame $w.right -borderwidth 30


		# Display the E-Mail of the contact
		frame $w.right.contact
		frame $w.right.contact.right
		label $w.right.contact.right.note -text "[trans contact]" -font bigfont
		set nickname "[trunc [::abook::getDisplayNick $email] $w 410 sboldf]"
		label $w.right.contact.right.txt -text "$email\n$nickname" -font sboldf
		pack configure $w.right.contact.right.note -expand false
		pack configure $w.right.contact.right.txt -expand true
		pack configure $w.right.contact.right -expand true -side right
		# Display the show/hide button
		frame $w.right.contact.left
		image create photo hide -file [::skin::GetSkinFile pixmaps contract.gif] -format cximage
		image create photo show -file [::skin::GetSkinFile pixmaps expand.gif] -format cximage
		label $w.right.contact.left.showhide
		pack configure $w.right.contact.left.showhide -side left
		pack configure $w.right.contact.left -side left


		# Create the listbox containing the notes
  		frame $w.right.notes -relief sunken -borderwidth 3
		label $w.right.notes.current -text "[trans currentnotes]" -font sboldf \
			-bg [::skin::getKey extralistboxtitlebg] -fg [::skin::getKey extralistboxtitlefg]
  		listbox $w.right.notes.box -yscrollcommand "$w.right.notes.ys set" -height 5 -width 60
  		scrollbar $w.right.notes.ys -command "$w.right.notes.box yview"
   		pack $w.right.notes.current -expand false -fill x
  		pack $w.right.notes.box -side left -expand true -fill both
			
		#We are not using pixmapscroll on Mac OS X
		if { ![OnMac] } {
			$w.right.notes.ys configure -height [winfo height $w.right.notes.box]
		}
  		pack $w.right.notes.ys -side right -fill y -expand false


		# Create the frame containing informations about the note
		frame $w.right.info -borderwidth 3
		label $w.right.info.date -text "[trans clicktoadd]"
		pack configure $w.right.info.date -side top -fill x


		# Display the subject of the note
		frame $w.right.subject -relief sunken -borderwidth 3
		label $w.right.subject.desc -text "[trans subject]" -font sboldf \
			-bg [::skin::getKey extralistboxtitlebg] -fg [::skin::getKey extralistboxtitlefg]
		text $w.right.subject.txt -height 1 -width 60 -state disabled
		pack $w.right.subject.txt -expand false -fill both
		

		# Display the note
		frame $w.right.note -relief sunken -borderwidth 3
		label $w.right.note.desc -text "[trans note]" -font sboldf \
			-bg [::skin::getKey extralistboxtitlebg] -fg [::skin::getKey extralistboxtitlefg]
		text $w.right.note.txt -yscrollcommand "$w.right.note.ys set" -height 5 -width 60 -state disabled -wrap word -exportselection 1
  		scrollbar $w.right.note.ys -command "$w.right.note.txt yview"
  		pack $w.right.note.desc -expand false -fill x
  		pack $w.right.note.ys -side right -fill y
  		pack $w.right.note.txt -side left -expand true -fill both


		# Display a warning message when no subject is given to a note
		frame $w.right.warning
		label $w.right.warning.txt -text ""
		pack configure $w.right.warning.txt -fill x


		# Create the buttons
		frame $w.right.button
		button $w.right.button.edit -text "[trans edit]" -command "::notes::Note_Edit" -state disabled
		button $w.right.button.delete -text "[trans delete]" -command "::notes::Note_Delete" -state disabled
		button $w.right.button.new -text "[trans add]" -command "::notes::Note_New" -state disabled

		button $w.right.button.save_edit -text "[trans save]" -command "::notes::Note_SaveEdit"
		button $w.right.button.save -text "[trans save]" -command "::notes::Note_SaveNew"
		button $w.right.button.cancel -text "[trans cancel]" -command "::notes::Note_Cancel"

		pack configure $w.right.button.edit -side left -padx 3 -pady 3
		pack configure $w.right.button.delete -side right -padx 3 -pady 3
		pack configure $w.right.button.new -side right -padx 3 -pady 3
		# Create the close button
		frame $w.right.close
		button $w.right.close.button -text "[trans close]" -command "::notes::Display_Notes_Close"
		pack configure $w.right.close.button -side right -padx 3

		
		#If user click on a note, display the note
  		bind $w.right.notes.box <<ListboxSelect>> "::notes::Notes_Selected_Note"
  		#If user click on a contact at left
		bind $w.contact.box <<ListboxSelect>> "::notes::Notes_Selected_Contact"
		bind $w.right.subject.txt <Button1-ButtonRelease> "::notes::Note_New"
		bind $w.right.note.txt <Button1-ButtonRelease> "::notes::Note_New"
		
		
  		pack $w.contact -side left -fill y -expand false
		pack $w.right -side right -fill both -expand true

		pack $w.right.close $w.right.button -side bottom -fill x
		pack $w.right.contact -side top -fill x
		pack $w.right.notes -side top -fill both -expand true

		pack $w.right.info -side top -fill x
		pack $w.right.subject -side top -fill x
		pack $w.right.note -side top -fill both  -expand true
		pack $w.right.warning -side top -fill x


		bind $w.right.subject.txt <Tab> "focus $w.right.note.txt; break"

		# If the E-Mail is not given, display the first contact and show the contact list
		if { $email == "" } {
			::notes::ShowContact
			set email [lindex $::notes::contacts 0]
		
		} else {
			::notes::HideContact
		
		}
		set ::notes::email $email
		::notes::get_Note $email
  		foreach note $::notes::notes {
  			set subject [lindex $note 2]
  			$w.right.notes.box insert end "$subject"
  		}

		$w.right.button.new configure -state normal
		set ::notes::selectedcontact [lsearch $::notes::contacts $email]
		set ::notes::selected "-1"

		::notes::Update_Contact_Background

		bind $w <<Escape>> "::notes::Display_Notes_Close"
		
		bind $w <<Cut>> "tk_textCut $w.right.note.txt"
		bind $w <<Copy>> "tk_textCopy $w.right.note.txt"
		bind $w <<Paste>> "::notes::Paste"
		
	}


#//////////////////////////////////////////////////////////////

	proc Paste { } {
	
	set w ".notemanager"
	#set text [clipboard get]
	set text ""
	if { [OnLinux] } {
                catch {set text [selection get -type UTF8_STRING -selection CLIPBOARD]}
	#clipboard might be empty!
        } else {
                catch {set text [ selection get -selection CLIPBOARD ]}
        }
	$w.right.note.txt insert insert "$text"
	
	}


#//////////////////////////////////////////////////////////////
# When the window is closed



	proc Display_Notes_Close { } {



		unset -nocomplain ::notes::email

		unset -nocomplain ::notes::selected

		unset -nocomplain ::notes::selectedcontact

		unset -nocomplain ::notes::notes

		unset -nocomplain ::notes::contacts

		unset -nocomplain ::notes::contactswithnotes


		destroy .notemanager



	}


#//////////////////////////////////////////////////////////////
# Display the content of a note when its subject is selected

	proc Notes_Selected_Note { {selec current} {selection 0} } {

		set w ".notemanager"


		switch $selec {

			choose {
				$w.right.notes.box selection set $selection
			}

			current {
				set selection [$w.right.notes.box curselection]
				if { $selection == "" } {
					return
				}
			}

			last {
				set selection [expr {[.notemanager.right.notes.box size] - 1}]
				$w.right.notes.box selection set $selection
			}

		}


		set ::notes::selected $selection

		set note [lindex $::notes::notes $selection]

		set created [lindex $note 0]
		set modified [lindex $note 1]
		set subject [lindex $note 2]
		set text  [lindex $note 3]

		$w.right.note.txt configure -state normal
		$w.right.note.txt delete 0.0 end
		$w.right.note.txt insert end "$text"
		$w.right.note.txt configure -state disabled

		$w.right.subject.txt configure -state normal
		$w.right.subject.txt delete 0.0 end
		$w.right.subject.txt insert end "$subject"
		$w.right.subject.txt configure -state disabled
		
		#Show created and modified info only if it exists
		if { $created != "" & $modified != ""} {
			$w.right.info.date configure -text "[trans created] : [::abook::dateconvert $created]  -  [trans modified] : [::abook::dateconvert $modified]"
		} else {
			$w.right.info.date configure -text "[trans clicktoadd]"
		}

		$w.right.button.edit configure -state normal
		$w.right.button.delete configure -state normal
		$w.contact.box itemconfigure $::notes::selectedcontact -background gray

		
	}


#//////////////////////////////////////////////////////////////
# Display the notes of a contact when they are selected

	proc Notes_Selected_Contact { } {

		global HOME

		set w ".notemanager"
		if {[$w.contact.box cget -state] == "disabled"} {
			return
		}


		$w.contact.box itemconfigure $::notes::selectedcontact

		set selection [$w.contact.box curselection]
		set ::notes::selectedcontact $selection
		set ::notes::selected "-1"

		set contact [lindex $::notes::contacts $selection]

		$w.right.notes.box delete 0 end

		if { [file exists [file join $HOME notes ${contact}_note.xml]] } {
			::notes::get_Note $contact
			foreach note $::notes::notes {
  				set subject [lindex $note 2]
  				$w.right.notes.box insert end "$subject"
  			}
		} else {
			set ::notes::notes ""
		}

		set ::notes::email $contact
		set nickname "[trunc [::abook::getDisplayNick $contact] $w 410 sboldf]"
		$w.right.contact.right.txt configure -text "$contact\n$nickname" -font sboldf

		$w.right.button.new configure -state normal
		$w.right.note.txt configure -state normal
		$w.right.note.txt delete 0.0 end
		$w.right.note.txt configure -state disabled
		$w.right.subject.txt configure -state normal
		$w.right.subject.txt delete 0.0 end
		$w.right.subject.txt configure -state disabled
		$w.right.info.date configure -text "[trans clicktoadd]"

		$w.right.button.edit configure -state disabled
		$w.right.button.delete configure -state disabled
		
		#Add binding for the subject and note field
		bind $w.right.subject.txt <Button1-ButtonRelease> "::notes::Note_New"
		bind $w.right.note.txt <Button1-ButtonRelease> "::notes::Note_New"
		::notes::Update_Contact_Background

	}


#//////////////////////////////////////////////////////////////
# When we delete a note

	proc Note_Delete { } {

		global HOME

		set w ".notemanager"

		set selection $::notes::selected

		set ::notes::notes [lreplace $::notes::notes $selection $selection]

		::notes::Notes_Save
		::notes::Update_Notes

		$w.right.notes.box selection set $selection
		
		if { $selection == [.notemanager.right.notes.box size] } {
			$w.right.button.edit configure -state disabled
			$w.right.button.delete configure -state disabled
		}
		
		if { [.notemanager.right.notes.box size] == 0 } {
			file delete [file join $HOME notes ${::notes::email}_note.xml]
			set idx [lsearch $::notes::contactswithnotes $::notes::email]
			set ::notes::contactswithnotes [lreplace $::notes::contactswithnotes $idx $idx]
		}

	}


#//////////////////////////////////////////////////////////////
# When we edit a note

	proc Note_Edit { } {

		set w ".notemanager"
		
		#Remove binding on theses 2 textbox
		bind $w.right.subject.txt <Button1-ButtonRelease> ""
		bind $w.right.note.txt <Button1-ButtonRelease> ""
		
		$w.right.notes.box configure -state disabled
		$w.contact.box configure -state disabled

		$w.right.note.txt configure -state normal
		$w.right.subject.txt configure -state normal
		$w.right.info.date configure -text "[trans editcontent]"

		pack forget $w.right.button.delete
		pack forget $w.right.button.new
		pack forget $w.right.button.edit

		pack configure $w.right.button.save_edit -side right -padx 3 -pady 3
		pack configure $w.right.button.cancel -side right -padx 3 -pady 3


	}


	proc Note_SaveEdit { } {

		set w ".notemanager"

		set selection $::notes::selected

		set contact $::notes::email

		set created "[lindex [lindex $::notes::notes $selection] 0]"
		set modified "[clock format [clock seconds] -format "%D - %T"]"
		set subject "[.notemanager.right.subject.txt get 1.0 1.end]"
		set note "[.notemanager.right.note.txt get 0.0 {end - 1 chars}]"

		if { $subject == "" } {
			$w.right.warning.txt configure -text "[trans subjectrequired]" -foreground red
		} else {

			set ::notes::notes [lreplace $::notes::notes $selection $selection [list "$created" "$modified" "$subject" "$note"]]

			::notes::Notes_Save
			::notes::Update_Notes
			::notes::Notes_Selected_Note choose $::notes::selected

		}
		
		bind $w.right.subject.txt <Button1-ButtonRelease> "::notes::Note_New"
		bind $w.right.note.txt <Button1-ButtonRelease> "::notes::Note_New"

	}


#//////////////////////////////////////////////////////////////
# When we create a new note

	proc Note_New { } {

		set w ".notemanager"
		#Remove binding on theses 2 textbox
		bind $w.right.subject.txt <Button1-ButtonRelease> ""
		bind $w.right.note.txt <Button1-ButtonRelease> ""
		
		$w.right.notes.box configure -state disabled
		$w.contact.box configure -state disabled

		$w.right.note.txt configure -state normal
		$w.right.note.txt delete 0.0 end
		$w.right.subject.txt configure -state normal
		$w.right.subject.txt delete 0.0 end
		$w.right.info.date configure -text "[trans inserttextnote]"

		pack forget $w.right.button.delete
		pack forget $w.right.button.new
		pack forget $w.right.button.edit

		pack configure $w.right.button.save -side right -padx 3 -pady 3
		pack configure $w.right.button.cancel -side right -padx 3 -pady 3
		
		focus $w.right.subject.txt

	}


	proc Note_SaveNew { } {

		set w ".notemanager"

		set contact $::notes::email

		set time "[clock format [clock seconds] -format "%D - %T"]"
		set subject "[$w.right.subject.txt get 1.0 1.end]"
		set note "[.notemanager.right.note.txt get 0.0 {end - 1 chars}]"

		if { $subject == "" } {
			$w.right.warning.txt configure -text "[trans subjectrequired]" -foreground red -font sboldf

		} else {

			set ::notes::notes [lappend ::notes::notes [list "$time" "$time" "$subject" "$note"]]

			::notes::Notes_Save
			::notes::Update_Notes
			::notes::Notes_Selected_Note last

			if { [lsearch $::notes::contactswithnotes $::notes::email] == -1 } {
				set ::notes::contactswithnotes [lappend ::notes::contactswithnotes $::notes::email]
			}

		}

		bind $w.right.subject.txt <Button1-ButtonRelease> "::notes::Note_New"
		bind $w.right.note.txt <Button1-ButtonRelease> "::notes::Note_New"

	}


#//////////////////////////////////////////////////////////////
# When we cancel what we were doing (editing or creating a note)

	proc Note_Cancel { } {

		set w ".notemanager"

		pack forget $w.right.button.save
		pack forget $w.right.button.save_edit
		pack forget $w.right.button.cancel

		pack configure $w.right.button.edit -side left -padx 3 -pady 3
		pack configure $w.right.button.delete -side right -padx 3 -pady 3
		pack configure $w.right.button.new -side right -padx 3 -pady 3

		$w.right.notes.box configure -state normal
		$w.contact.box configure -state normal
		$w.right.warning.txt configure -text ""
		bind $w.right.subject.txt <Button1-ButtonRelease> "::notes::Note_New"
		bind $w.right.note.txt <Button1-ButtonRelease> "::notes::Note_New"

		::notes::Update_Notes
		::notes::Notes_Selected_Note choose $::notes::selected
		
	}


#//////////////////////////////////////////////////////////////
# Save all the notes of a contact

	proc Notes_Save { } {

		global HOME

		set email $::notes::email

		set w ".notemanager"

		set file [file join $HOME notes ${email}_note.xml]

		if { ![file isdirectory [file join $HOME notes]] } {
			file mkdir [file join $HOME notes]
		}

		set file_id [open $file w]

		fconfigure $file_id -encoding utf-8

		puts $file_id "<?xml version=\"1.0\"?>\n\n<notes>\n"

		foreach note $::notes::notes {
			set created [::sxml::xmlreplace [lindex $note 0]]
			set modified [::sxml::xmlreplace [lindex $note 1]]
			set subject [::sxml::xmlreplace [lindex $note 2]]
			set content [::sxml::xmlreplace [lindex $note 3]]
			puts -nonewline $file_id "\t<note>\n\t\t<created>$created</created>\n\t\t<modified>$modified</modified>\n\t\t<subject>$subject</subject>\n\t\t<content>$content</content>\n\t</note>\n"
		}

		puts $file_id "</notes>"

		close $file_id

		$w.right.subject.txt configure -state disabled
		$w.right.note.txt configure -state disabled

		pack forget $w.right.button.save
		pack forget $w.right.button.save_edit
		pack forget $w.right.button.cancel

		pack configure $w.right.button.edit -side left -padx 3 -pady 3
		pack configure $w.right.button.delete -side right -padx 3 -pady 3
		pack configure $w.right.button.new -side right -padx 3 -pady 3

		$w.right.notes.box configure -state normal
		$w.contact.box configure -state normal

		$w.right.warning.txt configure -text ""

		::notes::Notes_Selected_Note

	}


#//////////////////////////////////////////////////////////////
# Update the display of the notes

	proc Update_Notes { } {

		global HOME

		set w ".notemanager"

		set contact $::notes::email

		$w.right.notes.box delete 0 end

		if { [file exists [file join $HOME notes ${contact}_note.xml]] } {
			::notes::get_Note $contact
			foreach note $::notes::notes {
  				set subject [lindex $note 2]
  				$w.right.notes.box insert end "$subject"
  			}
		} else {
			set ::notes::notes ""
		}

	}


#//////////////////////////////////////////////////////////////

# Update the background of the items of the contact list

proc Update_Contact_Background { } {

	for {set i 0} {$i< [llength $::notes::contacts]} {incr i} {
		if { $i == $::notes::selectedcontact } {
			.notemanager.contact.box itemconfigure $i -background gray
		} elseif { [lsearch $::notes::contactswithnotes [lindex $::notes::contacts $i]] != -1 } {
			.notemanager.contact.box itemconfigure $i -background #DDF3FE
		} else {
			.notemanager.contact.box itemconfigure $i -background white
		}

	}
	
}


#//////////////////////////////////////////////////////////////
#

proc HideContact { } {

	set w ".notemanager"
	pack forget $w.contact
	#pack configure $w.right -side right -fill both -expand true
#	wm geometry $w 550x526
	$w.right.contact.left.showhide configure -image show
	bind $w.right.contact.left.showhide <Button1-ButtonRelease> "::notes::ShowContact"
	
}


proc ShowContact { } {

	set w ".notemanager"
	pack configure $w.contact -side left -fill y
#	wm geometry $w 660x526
	$w.right.contact.left.showhide configure -image hide
	bind $w.right.contact.left.showhide <Button1-ButtonRelease> "::notes::HideContact"
	
}

}