[Tkabber-dev] r1099 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Thu Apr 12 10:44:01 MSD 2007


Author: sergei
Date: 2007-04-12 10:44:00 +0400 (Thu, 12 Apr 2007)
New Revision: 1099

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/datagathering.tcl
   trunk/tkabber/messages.tcl
   trunk/tkabber/muc.tcl
   trunk/tkabber/register.tcl
   trunk/tkabber/search.tcl
Log:
	* messages.tcl: Fixed jabber:x:data form processing. Before this fix
	  Tkabber displayed not the form itself.

	* datagathering.tcl, muc.tcl: Returned cancel_command ardument to
	  data::draw_window routine. Use it while configuring MUC rooms.

	* register.tcl, search.tcl: Manage focus using return value from
	  data::fill_fields procedure.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-04-12 05:08:00 UTC (rev 1098)
+++ trunk/tkabber/ChangeLog	2007-04-12 06:44:00 UTC (rev 1099)
@@ -3,6 +3,15 @@
 	* jabberlib-tclxml/jabberlib.tcl: Fixed bug with delayed delivery
 	  timestamps.
 
+	* messages.tcl: Fixed jabber:x:data form processing. Before this fix
+	  Tkabber displayed not the form itself.
+
+	* datagathering.tcl, muc.tcl: Returned cancel_command ardument to
+	  data::draw_window routine. Use it while configuring MUC rooms.
+
+	* register.tcl, search.tcl: Manage focus using return value from
+	  data::fill_fields procedure.
+
 2007-04-11  Sergei Golovan  <sgolovan at nes.ru>
 
 	* jabberlib-tclxml/jabberlib.tcl: Added partial support of XEP-0203

Modified: trunk/tkabber/datagathering.tcl
===================================================================
--- trunk/tkabber/datagathering.tcl	2007-04-12 05:08:00 UTC (rev 1098)
+++ trunk/tkabber/datagathering.tcl	2007-04-12 06:44:00 UTC (rev 1099)
@@ -84,7 +84,7 @@
 		    -textvariable [namespace current]::data(var,$tag,$g) \
 		    -show * -font $font
 		if {$focus == ""} {
-		    set focus $g.row
+		    set focus $g.$row
 		}
 	    }
 	    default {
@@ -92,7 +92,7 @@
 		    -textvariable [namespace current]::data(var,$tag,$g) \
 		    -font $font
 		if {$focus == ""} {
-		    set focus $g.row
+		    set focus $g.$row
 		}
 	    }
 	}
@@ -568,20 +568,16 @@
     set f [$sf getframe]
     $sf configure -height 10
     $sw setwidget $sf
-    data::fill_fields $f $items
+    set focus [data::fill_fields $f $items]
 
     set bbox [ButtonBox $w.bbox -spacing 10 -padx 10 -default 0]
     pack $bbox -side bottom -anchor e -padx 2m -pady 2m
     $bbox add -text [::msgcat::mc "Send"] \
-	-command [list eval $send_cmd $w \[data::get_tags $f\]]
+	-command [list eval $send_cmd [list $w] \[data::get_tags $f\]]
     $bbox add -text [::msgcat::mc "Cancel"] \
-	-command [list eval $send_cmd $w \
-		      [list [list [jlib::wrapper:createtag x \
-				       -vars [list xmlns jabber:x:data \
-						  type cancel]]]]]
-	#-command [list eval $cancel_cmd [list $w]]
-    bind $w <Return> "ButtonBox::invoke $bbox default"
-    bind $w <Escape> "ButtonBox::invoke $bbox 1"
+	-command [list eval $cancel_cmd [list $w]]
+    bind $w <Return> [list ButtonBox::invoke $bbox default]
+    bind $w <Escape> [list ButtonBox::invoke $bbox 1]
     bind $f <Destroy> [list [namespace current]::cleanup $f]
 
     bindscroll $f $sf
@@ -604,6 +600,9 @@
     }
     $vf configure -height $h
     wm deiconify $w
+    if {$focus != ""} {
+	focus $focus
+    }
 
     return $w
 }
@@ -661,9 +660,17 @@
     }
 
     data::draw_window $children \
-	[list [namespace current]::send_data $connid $xmlns $jid $node]
+	[list [namespace current]::send_data $connid $xmlns $jid $node] \
+	[list [namespace current]::cancel_data $connid $xmlns $jid $node]
 }
 
+proc data::cancel_data {connid xmlns jid node w} {
+    send_data $connid $xmlns $jid $node $w \
+	      [list [jlib::wrapper:createtag x \
+			 -vars [list xmlns jabber:x:data \
+				     type cancel]]]
+}
+
 proc data::send_data {connid xmlns jid node w restags} {
     switch -- $xmlns {
 	jabber:iq:data {

Modified: trunk/tkabber/messages.tcl
===================================================================
--- trunk/tkabber/messages.tcl	2007-04-12 05:08:00 UTC (rev 1098)
+++ trunk/tkabber/messages.tcl	2007-04-12 06:44:00 UTC (rev 1099)
@@ -229,7 +229,7 @@
 	    } \
 	    $::NS(data) {
 		if {![lempty $children]} {
-		    process_x_data $f $from $children
+		    process_x_data $f $from $xa
 		}
 	    } \
 	}

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2007-04-12 05:08:00 UTC (rev 1098)
+++ trunk/tkabber/muc.tcl	2007-04-12 06:44:00 UTC (rev 1099)
@@ -893,7 +893,8 @@
 
     jlib::wrapper:splitxml $child tag vars isempty chdata children
 
-    data::draw_window $children [list muc::send_config $chatid]
+    data::draw_window $children [list muc::send_config $chatid] \
+				[list muc::cancel_config $chatid]
     return
 }
 
@@ -914,6 +915,23 @@
 
 ###############################################################################
 
+proc muc::cancel_config {chatid w} {
+    set connid [chat::get_connid $chatid]
+    set group [chat::get_jid $chatid]
+    jlib::send_iq set [jlib::wrapper:createtag query \
+			   -vars [list xmlns $::NS(muc#owner)] \
+			   -subtags [list [jlib::wrapper:createtag x \
+					       -vars [list xmlns jabber:x:data \
+							   type cancel]]]] \
+	-to $group \
+	-connection $connid \
+	-command [list muc::test_error_res \
+		       [::msgcat::mc "Cancelling configure form"] $connid $group]
+    destroy $w
+}
+
+###############################################################################
+
 proc muc::test_error_res {op connid group res child} {
     if {![cequal $res OK]} {
 	set chatid [chat::chatid $connid $group]

Modified: trunk/tkabber/register.tcl
===================================================================
--- trunk/tkabber/register.tcl	2007-04-12 05:08:00 UTC (rev 1098)
+++ trunk/tkabber/register.tcl	2007-04-12 06:44:00 UTC (rev 1099)
@@ -89,7 +89,7 @@
 	    jlib::wrapper:splitxml $child tag vars isempty chdata children
 
 	    if {[jlib::wrapper:getattr $vars xmlns] == $::NS(register)} {
-		data::fill_fields $f $children
+		set focus [data::fill_fields $f $children]
 	    }
 
 	    $w.bbox itemconfigure 0 -state normal
@@ -108,12 +108,8 @@
 	    $w.vf configure -height $h
 	    wm deiconify $w
 
-	    foreach child [winfo children $w.fields] {
-		if {[cequal [winfo class $child] Entry] && \
-			[cequal [$child cget -state] normal]} {
-		    focus $child
-		    break
-		}
+	    if {$focus != ""} {
+		focus $focus
 	    }
 	}
 	default {

Modified: trunk/tkabber/search.tcl
===================================================================
--- trunk/tkabber/search.tcl	2007-04-12 05:08:00 UTC (rev 1098)
+++ trunk/tkabber/search.tcl	2007-04-12 06:44:00 UTC (rev 1099)
@@ -75,18 +75,14 @@
     jlib::wrapper:splitxml $child tag vars isempty chdata children
 
     if {[cequal [jlib::wrapper:getattr $vars xmlns] jabber:iq:search]} {
-	data::fill_fields $sw.fields $children
+	set focus [data::fill_fields $sw.fields $children]
     }
 
     $sw configure -cursor {}
     $sw.bbox itemconfigure 0 -state normal
 
-    foreach child [winfo children $sw.fields] {
-        if {[cequal [winfo class $child] Entry] && \
-		[cequal [$child cget -state] normal]} {
-	    focus $child
-	    break
-	}
+    if {$focus != ""} {
+	focus $focus
     }
     update idletasks
     wm deiconify $sw



More information about the Tkabber-dev mailing list