Revision: 7340
http://mahogany.svn.sourceforge.net/mahogany/?rev=7340&view=rev
Author: vadz
Date: 2007-08-25 12:35:01 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
fix vararg AsyncStatusHandler methods to work correctly with strings in Unicode
build
Modified Paths:
--------------
trunk/M/src/gui/wxMsgCmdProc.cpp
Modified: trunk/M/src/gui/wxMsgCmdProc.cpp
===================================================================
--- trunk/M/src/gui/wxMsgCmdProc.cpp 2007-08-25 19:34:44 UTC (rev 7339)
+++ trunk/M/src/gui/wxMsgCmdProc.cpp 2007-08-25 19:35:01 UTC (rev 7340)
@@ -286,11 +286,13 @@
class AsyncStatusHandler
{
public:
- AsyncStatusHandler(MsgCmdProcImpl *msgCmdProc, const wxChar *fmt, ...);
+ // create the handler for a new async operation and show the given message
+ // to the user
+ AsyncStatusHandler(MsgCmdProcImpl *msgCmdProc, const wxString& msgInitial);
// monitor the given ticket, give error message if the corresponding
// operation terminates with an error
- bool Monitor(Ticket ticket, const wxChar *fmt, ...);
+ bool Monitor(Ticket ticket, const wxString& msgError);
// used by OnASFolderResultEvent() to find the matching progress indicator
Ticket GetTicket() const { return m_ticket; }
@@ -299,7 +301,7 @@
void Fail() { m_ticket = ILLEGAL_TICKET; }
// use different message on success (default is initial message + done)
- void SetSuccessMsg(const wxChar *fmt, ...);
+ void SetSuccessMsg(const wxString& msgOk);
// give the appropriate message
~AsyncStatusHandler();
@@ -329,28 +331,21 @@
// ----------------------------------------------------------------------------
AsyncStatusHandler::AsyncStatusHandler(MsgCmdProcImpl *msgCmdProc,
- const wxChar *fmt, ...)
+ const wxString& msgInitial)
+ : m_msgInitial(msgInitial)
{
m_msgCmdProc = msgCmdProc;
m_ticket = ILLEGAL_TICKET;
- va_list argptr;
- va_start(argptr, fmt);
- m_msgInitial.PrintfV(fmt, argptr);
- va_end(argptr);
-
m_msgCmdProc->AddAsyncStatus(this);
wxLogStatus(GetFrame(), m_msgInitial);
MBeginBusyCursor();
}
-bool AsyncStatusHandler::Monitor(Ticket ticket, const wxChar *fmt, ...)
+bool AsyncStatusHandler::Monitor(Ticket ticket, const wxString& msgError)
{
- va_list argptr;
- va_start(argptr, fmt);
- m_msgError.PrintfV(fmt, argptr);
- va_end(argptr);
+ m_msgError = msgError;
m_ticket = ticket;
@@ -370,12 +365,9 @@
return TRUE;
}
-void AsyncStatusHandler::SetSuccessMsg(const wxChar *fmt, ...)
+void AsyncStatusHandler::SetSuccessMsg(const wxString& msgOk)
{
- va_list argptr;
- va_start(argptr, fmt);
- m_msgOk.PrintfV(fmt, argptr);
- va_end(argptr);
+ m_msgOk = msgOk;
}
AsyncStatusHandler::~AsyncStatusHandler()
@@ -1352,8 +1344,11 @@
size_t count = selections.GetCount();
AsyncStatusHandler *status =
- new AsyncStatusHandler(this, _("Marking %d message(s) as %s..."),
- count, (read ? "read" : "unread"));
+ new AsyncStatusHandler(this, wxString::Format
+ (
+ _("Marking %d message(s) as %s..."),
+ count, (read ? "read" : "unread")
+ ));
Ticket t = m_asmf->MarkRead(&selections, this, read);
@@ -1383,16 +1378,21 @@
}
AsyncStatusHandler *status =
- new AsyncStatusHandler(this, _("Saving %d message(s) to '%s'..."),
- selections.GetCount(),
- (const wxChar *)folder->GetFullName().c_str());
+ new AsyncStatusHandler(this, wxString::Format
+ (
+ _("Saving %d message(s) to '%s'..."),
+ selections.GetCount(),
+ folder->GetFullName().c_str()
+ ));
Ticket t = m_asmf->
SaveMessagesToFolder(&selections, GetFrame(), folder, this);
- status->Monitor(t,
- _("Failed to save messages to the folder '%s'."),
- (const wxChar *)folder->GetFullName().c_str());
+ status->Monitor(t, wxString::Format
+ (
+ _("Failed to save messages to the folder '%s'."),
+ folder->GetFullName().c_str()
+ ));
folder->DecRef();
@@ -1416,8 +1416,11 @@
MsgCmdProcImpl::SaveMessagesToFile(const UIdArray& selections)
{
AsyncStatusHandler *status =
- new AsyncStatusHandler(this, _("Saving %d message(s) to file..."),
- selections.GetCount());
+ new AsyncStatusHandler(this, wxString::Format
+ (
+ _("Saving %d message(s) to file..."),
+ selections.GetCount()
+ ));
Ticket t = m_asmf->SaveMessagesToFile(&selections, GetFrame(), this);
status->Monitor(t, _("Saving messages to file failed."));
@@ -1633,15 +1636,21 @@
size_t count = selections.GetCount();
AsyncStatusHandler *status =
- new AsyncStatusHandler(this,
- _("Applying filter rules to %u "
- "message(s)..."), count);
+ new AsyncStatusHandler(this, wxString::Format
+ (
+ _("Applying filter rules to %u
message(s)..."),
+ count
+ ));
+
Ticket t = m_asmf->ApplyFilterRules(&selections, this);
if ( status->Monitor(t, _("Failed to apply filter rules.")) )
{
- status->SetSuccessMsg(_("Applied filters to %u message(s), "
+ status->SetSuccessMsg(wxString::Format
+ (
+ _("Applied filters to %u message(s), "
"see log window for details."),
- count);
+ count
+ ));
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates