[Tkabber-dev] r1665 - in trunk/tkabber: . plugins/roster

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Feb 15 21:49:14 MSK 2009


Author: sergei
Date: 2009-02-15 21:49:13 +0300 (Sun, 15 Feb 2009)
New Revision: 1665

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/roster/metacontacts.tcl
Log:
	* plugins/roster/metacontacts.tcl: Fixed adding item by using entry and
	  added keyboard items reordering (by <Control-Up> and <Control-Down>).


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-02-15 14:33:50 UTC (rev 1664)
+++ trunk/tkabber/ChangeLog	2009-02-15 18:49:13 UTC (rev 1665)
@@ -19,6 +19,9 @@
 
 	* msgs/de.msg: Updated German translation (thanks to Roger Sondermann).
 
+	* plugins/roster/metacontacts.tcl: Fixed adding item by using entry and
+	  added keyboard items reordering (by <Control-Up> and <Control-Down>).
+
 2009-02-14  Sergei Golovan  <sgolovan at nes.ru>
 
 	* chats.tcl, ifacetk/iroster.tcl: Adapted to a new syntax of roster

Modified: trunk/tkabber/plugins/roster/metacontacts.tcl
===================================================================
--- trunk/tkabber/plugins/roster/metacontacts.tcl	2009-02-15 14:33:50 UTC (rev 1664)
+++ trunk/tkabber/plugins/roster/metacontacts.tcl	2009-02-15 18:49:13 UTC (rev 1665)
@@ -209,12 +209,15 @@
     pack $tools -side bottom -fill x
     
     set sw [ScrolledWindow $w.sw]
-    set lf [listbox $w.fields -selectmode single]
+    set lf [listbox $w.fields]
     pack $sw -side top -expand yes -fill both -in $f -pady 1m -padx 1m
     $sw setwidget $lf
 
     bind $lf <3> [namespace code [list select_and_popup_menu %W [double% $xlib] %x %y]]
 
+    bind $lf <Control-Key-Up> [namespace code [list move_selected %W [double% $xlib] -1]]
+    bind $lf <Control-Key-Down> [namespace code [list move_selected %W [double% $xlib] 1]]
+
     set addentry [entry $tools.addentry]
     set additem [button $tools.additem \
 		     -text [::msgcat::mc "Add JID"] \
@@ -223,6 +226,12 @@
     pack $additem -side right -padx 1m
     pack $addentry -side left -padx 1m -fill x -expand yes
 
+    bind $addentry <Key-Return> [list $additem invoke]
+    bind $addentry <Key-Return> +break
+
+    bind $additem <Key-Return> [list $additem invoke]
+    bind $additem <Key-Return> +break
+
     lower $lf $additem
     lower $sw
     lower $f
@@ -245,6 +254,16 @@
     $w draw
 }
 
+proc metacontacts::move_selected {f xlib shift} {
+    set index [$f index active]
+    set item [$f get $index]
+    $f delete $index
+    $f insert [expr {$index + $shift}] $item
+    $f activate $index
+
+    fix_dialog_title $f $xlib
+}
+
 proc metacontacts::fix_dialog_title {f xlib} {
     set w [winfo toplevel $f]
 
@@ -322,7 +341,7 @@
     set item [$entry get]
     $entry delete 0 end
 
-    add_jid $f $item
+    add_jid $f $xlib $item
 }
 
 proc metacontacts::add_jid {f xlib item {index end}} {



More information about the Tkabber-dev mailing list