[Tkabber-dev] r870 - in trunk/tkabber: . plugins/general

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Jan 14 14:08:41 MSK 2007


Author: sergei
Date: 2007-01-14 14:08:37 +0300 (Sun, 14 Jan 2007)
New Revision: 870

Added:
   trunk/tkabber/plugins/general/copy_jid.tcl
Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/custom.tcl
   trunk/tkabber/muc.tcl
Log:
	* custom.tcl: Raise customize tab on Tkabber->Customize if it is
	  already opened (thanks to Pavel Borzenkov).
	  Save page offsets in the history (not very accurately because
	  ScrolledWindow changes window width).

	* muc.tcl: Replaced labels by entries in owner/admin/moderator/etc.
	  list editing form.

	* plugins/general/copy_jid.tcl: Added "Copy JID to clipboard" menu
	  item to roster, chat, groupchat, message, search menus.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2007-01-11 17:58:39 UTC (rev 869)
+++ trunk/tkabber/ChangeLog	2007-01-14 11:08:37 UTC (rev 870)
@@ -1,3 +1,16 @@
+2007-01-13  Sergei Golovan  <sgolovan at nes.ru>
+
+	* custom.tcl: Raise customize tab on Tkabber->Customize if it is
+	  already opened (thanks to Pavel Borzenkov).
+	  Save page offsets in the history (not very accurately because
+	  ScrolledWindow changes window width).
+
+	* muc.tcl: Replaced labels by entries in owner/admin/moderator/etc.
+	  list editing form.
+
+	* plugins/general/copy_jid.tcl: Added "Copy JID to clipboard" menu
+	  item to roster, chat, groupchat, message, search menus.
+
 2007-01-11  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/richtext/urls.tcl: Fixed proc, which adds leading http://

Modified: trunk/tkabber/custom.tcl
===================================================================
--- trunk/tkabber/custom.tcl	2007-01-11 17:58:39 UTC (rev 869)
+++ trunk/tkabber/custom.tcl	2007-01-14 11:08:37 UTC (rev 870)
@@ -168,7 +168,10 @@
 
     set w .customize
     if {[winfo exists $w]} {
-	return
+	if {$::usetabbar} {
+	.nb raise [::ifacetk::nbpage $w]
+	}
+	return    
     }
 
     add_win $w -title [::msgcat::mc "Customize"] \
@@ -229,16 +232,15 @@
 
 proc custom::go {} {
     variable curgroup
-    history_add $curgroup
-    fill_group .customize.fields $curgroup
+    goto $curgroup $offset
 }
 
 proc custom::goto {gid} {
     history_add $gid
-    fill_group .customize.fields $gid
+    fill_group .customize.fields $gid 0
 }
 
-proc custom::fill_group {t gid} {
+proc custom::fill_group {t gid offset} {
     variable group
     variable var
     variable curgroup
@@ -320,6 +322,7 @@
     }
 
     $t configure -state disabled
+    $t yview moveto $offset
 }
 
 proc custom::fill_var {t varname idx} {
@@ -770,9 +773,20 @@
 
     set custom_loaded 1
 }
+
 hook::add postload_hook custom::restore 60
 
 
+proc custom::update_page_offset {} {
+    variable history
+
+    lassign [.customize.fields yview] offset
+    lassign [lindex $history(list) $history(pos)] page
+
+    set history(list) [lreplace $history(list) $history(pos) $history(pos) \
+				[list $page $offset]]
+}
+
 proc custom::history_move {shift} {
     variable history
     variable curgroup
@@ -787,22 +801,25 @@
 	return
     }
 
-    set newgroup [lindex $history(list) $newpos]
+    update_page_offset
+
+    lassign [lindex $history(list) $newpos] newgroup offset
     set history(pos) $newpos
     
     set curgroup $newgroup
 
-    fill_group .customize.fields $newgroup
+    fill_group .customize.fields $newgroup $offset
 }
 
 
 proc custom::history_add {gid} {
     variable history
 
-    set history(list) [lreplace $history(list) 0 \
-			   [expr {$history(pos) - 1}]]
+    update_page_offset
+
+    set history(list) [lreplace $history(list) 0 [expr {$history(pos) - 1}]]
     
-    lvarpush history(list) $gid
+    lvarpush history(list) [list $gid 0]
     set history(pos) 0
 
     debugmsg custom [array get history]

Modified: trunk/tkabber/muc.tcl
===================================================================
--- trunk/tkabber/muc.tcl	2007-01-11 17:58:39 UTC (rev 869)
+++ trunk/tkabber/muc.tcl	2007-01-14 11:08:37 UTC (rev 870)
@@ -613,15 +613,28 @@
     }
 
     foreach item [lsort -dictionary -index 1 $items2] {
-	lassign $item nick jid role affiliation
+	lassign $item listdata($f,nick,$row) listdata($f,jid,$row) \
+		      role affiliation
 
-	label $f.nick$row -text $nick -font $font \
-	    -textvariable muc::listdata($f,nick,$row)
+	entry $f.nick$row -font $font \
+	    -textvariable muc::listdata($f,nick,$row) \
+	    -takefocus 0 \
+	    -highlightthickness 0 \
+	    -width 20
+	if {[catch {$f.nick$row configure -state readonly}]} {
+	    $f.nick$row configure -state disabled
+	}
 	grid $f.nick$row -row $row -column 0 -sticky w -padx 1m
 	bindscroll $f.nick$row $sf
 
-	label $f.jid$row -text $jid -font $font \
-	    -textvariable muc::listdata($f,jid,$row)
+	entry $f.jid$row -font $font \
+	    -textvariable muc::listdata($f,jid,$row) \
+	    -takefocus 0 \
+	    -highlightthickness 0 \
+	    -width 30
+	if {[catch {$f.jid$row configure -state readonly}]} {
+	    $f.jid$row configure -state disabled
+	}
 	grid $f.jid$row -row $row -column 1 -sticky w -padx 1m
 	bindscroll $f.jid$row $sf
 
@@ -647,7 +660,8 @@
 	}
 
 	entry $f.reason$row -font $font \
-	    -textvariable muc::listdata($f,reason,$row)
+	    -textvariable muc::listdata($f,reason,$row) \
+	    -width 40
 	grid $f.reason$row -row $row -column 3 -sticky we -padx 1m
 	bindscroll $f.reason$row $sf
 	

Added: trunk/tkabber/plugins/general/copy_jid.tcl
===================================================================
--- trunk/tkabber/plugins/general/copy_jid.tcl	                        (rev 0)
+++ trunk/tkabber/plugins/general/copy_jid.tcl	2007-01-14 11:08:37 UTC (rev 870)
@@ -0,0 +1,41 @@
+# $Id$
+# Copy JID to clipboard
+
+###############################################################################
+
+namespace eval copy_jid {}
+
+###############################################################################
+
+proc copy_jid::copy {m jid} {
+    clipboard clear -displayof $m
+    clipboard append -displayof $m $jid
+}
+
+###############################################################################
+
+proc copy_jid::add_menu_item {m connid jid} {
+    $m add command \
+	   -label [::msgcat::mc "Copy JID to clipboard"] \
+	   -command [list [namespace current]::copy $m $jid]
+}
+
+hook::add roster_create_groupchat_user_menu_hook \
+    [namespace current]::copy_jid::add_menu_item 44
+hook::add chat_create_user_menu_hook \
+    [namespace current]::copy_jid::add_menu_item 44
+hook::add chat_create_conference_menu_hook \
+    [namespace current]::copy_jid::add_menu_item 44
+hook::add roster_jid_popup_menu_hook \
+    [namespace current]::copy_jid::add_menu_item 44
+hook::add roster_conference_popup_menu_hook \
+    [namespace current]::copy_jid::add_menu_item 44
+hook::add roster_service_popup_menu_hook \
+    [namespace current]::copy_jid::add_menu_item 44
+hook::add message_dialog_menu_hook \
+    [namespace current]::copy_jid::add_menu_item 44
+hook::add search_popup_menu_hook \
+    [namespace current]::copy_jid::add_menu_item 44
+
+###############################################################################
+


Property changes on: trunk/tkabber/plugins/general/copy_jid.tcl
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native



More information about the Tkabber-dev mailing list