Attachment "tkchatquitpatch" to
ticket [2913790fff]
added by
stwo
2009-12-14 01:12:09.
Index: tkchat.tcl
===================================================================
RCS file: /cvsroot/tcllib/tclapps/apps/tkchat/tkchat.tcl,v
retrieving revision 1.477
diff -u -p -r1.477 tkchat.tcl
--- tkchat.tcl 13 Dec 2009 01:23:58 -0000 1.477
+++ tkchat.tcl 13 Dec 2009 18:06:43 -0000
@@ -4183,6 +4183,9 @@ proc ::tkchat::checkCommand { msg } {
# check against commands that can be used while logged off
set moreToGo 0
switch -re -- $msg {
+ {^/quit$} {
+ ::tkchat::quit
+ }
{^/smiley?s?$} {
ShowSmiles
}
@@ -4405,9 +4408,6 @@ proc ::tkchat::checkCommand { msg } {
regexp {^/back\s*(.*)$} $msg -> status
::tkjabber::back $status
}
- {^/quit$} {
- ::tkchat::quit
- }
{^/kick\s} -
{^/mute\s} -
{^/unmute\s} -
@@ -5454,14 +5454,14 @@ proc ::tkchat::OpenErrorLog {opt} {
}
proc ::tkchat::quit {} {
- set q [mc "Are you sure you want to quit?"]
- set a [tk_messageBox -type yesno -default yes \
- -title [mc "Tkchat confirm quit"] \
- -message $q]
- if { $a eq "yes" } {
- ::tkchat::saveRC
- exit
- }
+ global Options
+ if {!$Options(AskBeforeQuit) ||
+ [tk_messageBox -type yesno -default yes \
+ -title [mc "Tkchat confirm quit"] \
+ -message [mc "Are you sure you want to quit?"]] eq "yes"} {
+ ::tkchat::saveRC
+ exit
+ }
}
proc ::tkchat::saveRC {} {
@@ -5507,8 +5507,8 @@ proc ::tkchat::saveRC {} {
# Save these options to resource file
set keep {
- Alert,* AnimEmoticons AutoAway AutoAwayMsg AutoBookmark AutoConnect
- AutoFade AutoFadeLimit Browser BrowserTab ChatLogFile
+ Alert,* AnimEmoticons AskBeforeQuit AutoAway AutoAwayMsg AutoBookmark
+ AutoConnect AutoFade AutoFadeLimit Browser BrowserTab ChatLogFile
ChatLogOff Color,* DisplayUsers ClickFocusEntry
Emoticons EnableWhiteboard EntryMessageColor errLog ExitMessageColor
Font,* Fullname FunkyTraffic Geometry HistoryLines JabberConference
@@ -6205,6 +6205,7 @@ proc ::tkchat::GetDefaultOptions {} {
Alert,SOUND 0
Alert,TOPIC 1
AnimEmoticons 0
+ AskBeforeQuit 1
AutoAway -1
AutoAwayMsg "no activity"
AutoBookmark 0
@@ -7006,6 +7007,7 @@ proc ::tkchat::PreferencesPage {parent}
set EditOptions(StoreMessages) $Options(StoreMessages)
set EditOptions(ClickFocusEntry) $Options(ClickFocusEntry)
set EditOptions(LogPrivateChat) $Options(LogPrivateChat)
+ set EditOptions(AskBeforeQuit) $Options(AskBeforeQuit)
set EditOptions(ShowNormalInline) $Options(ShowNormalInline)
set dlg [winfo toplevel $parent]
@@ -7027,6 +7029,8 @@ proc ::tkchat::PreferencesPage {parent}
-variable ::tkchat::EditOptions(ClickFocusEntry) -onvalue 1
${NS}::checkbutton $af.lpc -text "Log private chat" -offvalue 0 \
-variable ::tkchat::EditOptions(LogPrivateChat) -onvalue 1
+ ${NS}::checkbutton $af.abq -text "Ask before quitting" -offvalue 0 \
+ -variable ::tkchat::EditOptions(AskBeforeQuit) -onvalue 1
${NS}::label $af.aal -text "Inactive message" -underline 0 \
-anchor ne
${NS}::entry $af.aae -textvariable ::tkchat::EditOptions(AutoAwayMsg)
@@ -7052,6 +7056,7 @@ proc ::tkchat::PreferencesPage {parent}
on the main chat widget."
tooltip::tooltip $af.lpc "Enable logging of private chat conversations\
to a per-remote-user file in ~/.tkchat_logs."
+ tooltip::tooltip $af.abq "Toggle asking before quitting."
}
bind $dlg <Alt-s> [list $af.store invoke]
@@ -7064,6 +7069,7 @@ proc ::tkchat::PreferencesPage {parent}
grid $af.catz - -sticky ew -padx 2
grid $af.cfe - -sticky ew -padx 2
grid $af.lpc - -sticky ew -padx 2
+ grid $af.abq - -sticky ew -padx 2
grid $af.aal $af.aae -sticky ew -padx 2
grid columnconfigure $af 1 -weight 1
@@ -7177,7 +7183,7 @@ proc ::tkchat::PreferencesPage {parent}
set Options(BrowserTab) $EditOptions(BrowserTab)
foreach property {Style AutoFade AutoFadeLimit UseTkOnly
AutoAwayMsg HateLolcatz FunkyTraffic StoreMessages
- ClickFocusEntry LogPrivateChat ShowNormalInline} {
+ ClickFocusEntry LogPrivateChat AskBeforeQuit ShowNormalInline} {
if { $Options($property) ne $EditOptions($property) } {
set Options($property) $EditOptions($property)
}