From b5b717785e8d8d696455844d561f3b47f36a2f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 2 Oct 2014 22:55:35 +0200 Subject: [PATCH] HaikuDepot: Specific error for untracked packages The web service currently only synchronizes with HaikuPorts. Packages from 3rd party repositories which were added by the user cannot be rated. Also, use a warning alert for errors in the UserLoginWindow and RatePackageWindow. --- src/apps/haikudepot/ui/RatePackageWindow.cpp | 16 +++++++++++----- src/apps/haikudepot/ui/UserLoginWindow.cpp | 6 ++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/apps/haikudepot/ui/RatePackageWindow.cpp b/src/apps/haikudepot/ui/RatePackageWindow.cpp index f83e7aae30..2f7b908b13 100644 --- a/src/apps/haikudepot/ui/RatePackageWindow.cpp +++ b/src/apps/haikudepot/ui/RatePackageWindow.cpp @@ -503,8 +503,6 @@ RatePackageWindow::_SendRatingThread() languageCode, comment, stability, rating, info); } - info.PrintToStream(); - BString error = B_TRANSLATE( "There was a puzzling response from the web service."); @@ -516,8 +514,15 @@ RatePackageWindow::_SendRatingThread() result.PrintToStream(); BString message; if (result.FindString("message", &message) == B_OK) { - error << B_TRANSLATE(" It responded with: "); - error << message; + if (message == "objectnotfound") { + error = B_TRANSLATE("The package was not found by the " + "web service. This probably means that it comes " + "from a depot which is not tracked there. Rating " + "such packages is unfortunately not supported."); + } else { + error << B_TRANSLATE(" It responded with: "); + error << message; + } } } } else { @@ -535,7 +540,8 @@ RatePackageWindow::_SendRatingThread() BAlert* alert = new(std::nothrow) BAlert( failedTitle, error, - B_TRANSLATE("Close")); + B_TRANSLATE("Close"), NULL, NULL, + B_WIDTH_AS_USUAL, B_WARNING_ALERT); if (alert != NULL) alert->Go(); diff --git a/src/apps/haikudepot/ui/UserLoginWindow.cpp b/src/apps/haikudepot/ui/UserLoginWindow.cpp index 09fda03346..f2598e5120 100644 --- a/src/apps/haikudepot/ui/UserLoginWindow.cpp +++ b/src/apps/haikudepot/ui/UserLoginWindow.cpp @@ -427,7 +427,8 @@ UserLoginWindow::_AuthenticateThread() BAlert* alert = new(std::nothrow) BAlert( B_TRANSLATE("Authentication failed"), error, - B_TRANSLATE("Close")); + B_TRANSLATE("Close"), NULL, NULL, + B_WIDTH_AS_USUAL, B_WARNING_ALERT); if (alert != NULL) alert->Go(); @@ -556,7 +557,8 @@ UserLoginWindow::_CreateAccountThread() BAlert* alert = new(std::nothrow) BAlert( B_TRANSLATE("Failed to create account"), error, - B_TRANSLATE("Close")); + B_TRANSLATE("Close"), NULL, NULL, + B_WIDTH_AS_USUAL, B_WARNING_ALERT); if (alert != NULL) alert->Go();