# HG changeset patch
# User Simon Heimberg <[email protected]>
# Date 1238149237 -3600
# Node ID d3334761f6e67028b47c04caf0c4a42c559bd01a
# Parent 7f9a6241a93608874e1283bc9003c8726bbb618c
hgemail: allow to preview
new button for command "hg email --test"
diff -r 7f9a6241a936 -r d3334761f6e6 hggtk/hgemail.py
--- a/hggtk/hgemail.py Fre Mär 27 11:20:35 2009 +0100
+++ b/hggtk/hgemail.py Fre Mär 27 11:20:37 2009 +0100
@@ -35,6 +35,9 @@
self._toolbutton(gtk.STOCK_GOTO_LAST, _('send'),
self._on_send_clicked,
_('Send email(s)')),
+ self._toolbutton(gtk.STOCK_FIND, _('test'),
+ self._on_test_clicked,
+ _('Show email(s) which would be sent')),
gtk.SeparatorToolItem(),
self._toolbutton(gtk.STOCK_PREFERENCES, _('configure'),
self._on_conf_clicked,
@@ -230,6 +233,12 @@
self._refresh(False)
def _on_send_clicked(self, button):
+ self.send()
+
+ def _on_test_clicked(self, button):
+ self.send(True)
+
+ def send(self, test = False):
def record_new_value(cpath, history, newvalue):
if not newvalue: return
if cpath not in history.get_keys():
@@ -256,7 +265,7 @@
if not self.repo:
return
- if self.repo.ui.config('email', 'method', 'smtp') == 'smtp':
+ if self.repo.ui.config('email', 'method', 'smtp') == 'smtp' and not
test:
if not self.repo.ui.config('smtp', 'host'):
info_dialog(self, _('Info required'),
_('You must configure SMTP'))
@@ -268,15 +277,18 @@
self._refresh(False)
return
- history = shlib.Settings('config_history')
- record_new_value('email.to', history, totext)
- record_new_value('email.cc', history, cctext)
- record_new_value('email.from', history, fromtext)
- record_new_value('email.subject', history, subjtext)
- history.write()
+ if not test:
+ history = shlib.Settings('config_history')
+ record_new_value('email.to', history, totext)
+ record_new_value('email.cc', history, cctext)
+ record_new_value('email.from', history, fromtext)
+ record_new_value('email.subject', history, subjtext)
+ history.write()
cmdline = ['hg', 'email', '-f', fromtext, '-t', totext, '-c', cctext]
cmdline += ['--repository', self.repo.root]
+ if test:
+ cmdline.insert(2, '--test')
if subjtext:
cmdline += ['--subject', subjtext]
if self._bundle.get_active():
------------------------------------------------------------------------------
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop