Ugly (and I hope temporary) fix for #1933, based on substring matching.

This commit is contained in:
fgerlits 2007-02-01 13:42:04 +00:00
parent af78a12f6c
commit 5fe6ffbd15
3 changed files with 33 additions and 4 deletions

View File

@ -357,7 +357,8 @@ TransportList :: setStatus(Gtk::TreeIter iter,
iter->set_value(modelColumns.statusColumn,
faultStatusKey);
iter->set_value(modelColumns.statusDisplayColumn,
*formatMessage(faultStatusKey, *errorMsg));
*formatMessage(faultStatusKey,
*processException(errorMsg)));
return false;
} else {
@ -491,3 +492,18 @@ TransportList :: onCancelTransport(void) throw ()
}
}
/*------------------------------------------------------------------------------
* Handle some known exception types.
*----------------------------------------------------------------------------*/
Ptr<const Glib::ustring>::Ref
TransportList :: processException(Ptr<const Glib::ustring>::Ref rawMessage)
throw ()
{
if (rawMessage->find("[888]") != Glib::ustring::npos) {
return getResourceUstring("duplicateFileMsg");
} else {
return rawMessage;
}
}

View File

@ -147,6 +147,17 @@ class TransportList : public Gtk::VBox,
bool
update(Gtk::TreeIter iter) throw (XmlRpcException);
/**
* Handle some known exception types.
*
* @param rawMessage the error message to be processed.
* @return a localized error message if rawMessage contains
* [xxx], where xxx is a recognized error code.
*/
Ptr<const Glib::ustring>::Ref
processException(Ptr<const Glib::ustring>::Ref rawMessage)
throw ();
protected:
/**

View File

@ -394,9 +394,9 @@ root:table
transportList:table
{
workingStatus:string { "in progress" }
successStatus:string { "ready" }
faultStatus:string { "error: {0}" }
workingStatus:string { "In progress..." }
successStatus:string { "Ready" }
faultStatus:string { "Error: {0}" }
titleColumnLabel:string { "Title" }
dateColumnLabel:string { "Date" }
@ -406,6 +406,8 @@ root:table
cancelDownloadMenuItem:string { "Cancel download" }
cannotCancelTransportMsg:string { "Canceling failed: {0}." }
duplicateFileMsg:string { "the file is in the network "
"hub already." }
}
restoreBackupWindow:table