diff options
author | Stephan Bergmann <sb@openoffice.org> | 2001-08-21 07:35:29 +0000 |
---|---|---|
committer | Stephan Bergmann <sb@openoffice.org> | 2001-08-21 07:35:29 +0000 |
commit | 4eb629ce0081816ec3b3c22efd70b2b50b500d06 (patch) | |
tree | ebd7086f6e3b99a8c9d63b57a99196627ff21639 | |
parent | 40052c59e39614a1dca9742b120984c211cc83b1 (diff) |
#89890# Improved handling of DEVICE_NOT_READY errors.
-rw-r--r-- | uui/source/iahndl.cxx | 120 | ||||
-rw-r--r-- | uui/source/ids.hrc | 11 | ||||
-rw-r--r-- | uui/source/ids.src | 30 |
3 files changed, 122 insertions, 39 deletions
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index b109c6503b5a..4960e4a5ac76 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: iahndl.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: obo $ $Date: 2001-08-20 12:31:10 $ + * last change: $Author: sb $ $Date: 2001-08-21 08:34:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -357,9 +357,10 @@ getAuthenticationContinuations( } } -bool getArgument(star::uno::Sequence< star::uno::Any > const & rArguments, - rtl::OUString const & rKey, - rtl::OUString * pValue) +bool +getStringArgument(star::uno::Sequence< star::uno::Any > const & rArguments, + rtl::OUString const & rKey, + rtl::OUString * pValue) SAL_THROW(()) { for (sal_Int32 i = 0; i < rArguments.getLength(); ++i) @@ -379,24 +380,47 @@ bool getArgument(star::uno::Sequence< star::uno::Any > const & rArguments, return false; } +bool +getBoolArgument(star::uno::Sequence< star::uno::Any > const & rArguments, + rtl::OUString const & rKey, + bool * pValue) + SAL_THROW(()) +{ + for (sal_Int32 i = 0; i < rArguments.getLength(); ++i) + { + star::beans::PropertyValue aProperty; + if ((rArguments[i] >>= aProperty) && aProperty.Name == rKey) + { + sal_Bool bValue; + if (aProperty.Value >>= bValue) + { + if (pValue) + *pValue = bValue; + return true; + } + } + } + return false; +} + bool getResourceNameArgument(star::uno::Sequence< star::uno::Any > const & rArguments, rtl::OUString * pValue) SAL_THROW(()) { - if (!getArgument(rArguments, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri")), - pValue)) + if (!getStringArgument(rArguments, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri")), + pValue)) return false; // Use the resource name only for file URLs, to avoid confusion: //TODO! work with ucp locality concept instead of hardcoded "file"? if (pValue && pValue->matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM( "file:"))) - getArgument(rArguments, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "ResourceName")), - pValue); + getStringArgument(rArguments, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "ResourceName")), + pValue); return true; } @@ -555,8 +579,8 @@ UUIInteractionHandler::handle( // CANT_WRITE { ERRCODE_IO_CURRENTDIR, ERRCODE_UUI_IO_CURRENTDIR }, // CURRENT_DIRECTORY - { ERRCODE_IO_DEVICENOTREADY, - ERRCODE_UUI_IO_DEVICENOTREADY }, // DEVICE_NOT_READY + { ERRCODE_IO_DEVICENOTREADY, ERRCODE_UUI_IO_NOTREADY }, + // DEVICE_NOT_READY { ERRCODE_IO_NOTSAMEDEVICE, ERRCODE_UUI_IO_NOTSAMEDEVICE }, // DIFFERENT_DEVICES { ERRCODE_IO_GENERAL, ERRCODE_UUI_IO_GENERAL }, // GENERAL @@ -678,11 +702,12 @@ UUIInteractionHandler::handle( || getResourceNameArgument(aArguments, &aArgUri)) && (bArgFolder - || getArgument(aArguments, - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "Folder")), - &aArgFolder)) ? + || getStringArgument( + aArguments, + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "Folder")), + &aArgFolder)) ? *new TwoStringErrorInfo( aID[aIOException.Code][1], aArgUri, @@ -690,15 +715,51 @@ UUIInteractionHandler::handle( aID[aIOException.Code][0]; break; + case star::ucb::IOErrorCode_DEVICE_NOT_READY: + if (bArgUri + || getResourceNameArgument(aArguments, &aArgUri)) + { + rtl::OUString aResourceType; + getStringArgument( + aArguments, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "ResourceType")), + &aResourceType); + bool bRemovable = false; + getBoolArgument( + aArguments, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "Removable")), + &bRemovable); + nErrorID + = aResourceType. + equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( + "volume")) ? + *new StringErrorInfo( + bRemovable ? + ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE : + ERRCODE_UUI_IO_NOTREADY_VOLUME, + aArgUri) : + *new StringErrorInfo( + bRemovable ? + ERRCODE_UUI_IO_NOTREADY_REMOVABLE : + ERRCODE_UUI_IO_NOTREADY, + aArgUri); + } + else + nErrorID = aID[aIOException.Code][0]; + break; + case star::ucb::IOErrorCode_DIFFERENT_DEVICES: nErrorID = bArgVolumes - || getArgument(aArguments, - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "Volume")), - &aArgVolume) - && getArgument( + || getStringArgument( + aArguments, + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "Volume")), + &aArgVolume) + && getStringArgument( aArguments, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -716,10 +777,11 @@ UUIInteractionHandler::handle( || getResourceNameArgument(aArguments, &aArgUri)) { rtl::OUString aResourceType; - getArgument(aArguments, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "ResourceType")), - &aResourceType); + getStringArgument(aArguments, + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "ResourceType")), + &aResourceType); nErrorID = *new StringErrorInfo( aResourceType. diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc index fa2448406e8d..a4239be0cd3e 100644 --- a/uui/source/ids.hrc +++ b/uui/source/ids.hrc @@ -2,9 +2,9 @@ * * $RCSfile: ids.hrc,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: sb $ $Date: 2001-08-16 13:41:57 $ + * last change: $Author: sb $ $Date: 2001-08-21 08:35:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,7 +62,7 @@ // // The UUI Resources // -// $Author: sb $ $Date: 2001-08-16 13:41:57 $ $Revision: 1.7 $ +// $Author: sb $ $Date: 2001-08-21 08:35:29 $ $Revision: 1.8 $ //============================================================================ #ifndef UUI_IDS_HRC @@ -111,7 +111,7 @@ #define ERRCODE_UUI_IO_CANTTELL (ERRCODE_AREA_UUI + 7) #define ERRCODE_UUI_IO_CANTWRITE (ERRCODE_AREA_UUI + 8) #define ERRCODE_UUI_IO_CURRENTDIR (ERRCODE_AREA_UUI + 9) -#define ERRCODE_UUI_IO_DEVICENOTREADY (ERRCODE_AREA_UUI + 10) +#define ERRCODE_UUI_IO_NOTREADY (ERRCODE_AREA_UUI + 10) #define ERRCODE_UUI_IO_NOTSAMEDEVICE (ERRCODE_AREA_UUI + 11) #define ERRCODE_UUI_IO_GENERAL (ERRCODE_AREA_UUI + 12) #define ERRCODE_UUI_IO_INVALIDACCESS (ERRCODE_AREA_UUI + 13) @@ -145,6 +145,9 @@ #define ERRCODE_UUI_WRONGJAVA_VERSION_MIN (ERRCODE_AREA_UUI + 41) #define ERRCODE_UUI_BADPARTNERSHIP (ERRCODE_AREA_UUI + 42) #define ERRCODE_UUI_BADPARTNERSHIP_NAME (ERRCODE_AREA_UUI + 43) +#define ERRCODE_UUI_IO_NOTREADY_VOLUME (ERRCODE_AREA_UUI + 44) +#define ERRCODE_UUI_IO_NOTREADY_REMOVABLE (ERRCODE_AREA_UUI + 45) +#define ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE (ERRCODE_AREA_UUI + 46) //============================================================================ #define HID_DLG_LOGIN (HID_UUI_START + 0) diff --git a/uui/source/ids.src b/uui/source/ids.src index 7b8127a84b0e..e1b23250dce4 100644 --- a/uui/source/ids.src +++ b/uui/source/ids.src @@ -2,9 +2,9 @@ * * $RCSfile: ids.src,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * - * last change: $Author: rt $ $Date: 2001-08-17 20:06:46 $ + * last change: $Author: sb $ $Date: 2001-08-21 08:35:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,7 +62,7 @@ // // Miscellaneous Resources // -// $Author: rt $ $Date: 2001-08-17 20:06:46 $ $Revision: 1.27 $ +// $Author: sb $ $Date: 2001-08-21 08:35:29 $ $Revision: 1.28 $ //============================================================================ #define __RSC @@ -443,10 +443,10 @@ Resource RID_UUI_ERRHDL Text[ catalan ] = "Action not allowed: $(ARG1) is the current directory"; }; // IOErrorCode_DEVICE_NOT_READY = 10, - String ( ERRCODE_UUI_IO_DEVICENOTREADY & ERRCODE_RES_MASK ) + String ( ERRCODE_UUI_IO_NOTREADY & ERRCODE_RES_MASK ) { - Text = "Das Gert (Laufwerk) $(ARG1) ist nicht bereit" ; - Text [ english ] = "The Device (drive) $(ARG1) is not ready" ; + Text = "$(ARG1) ist nicht bereit" ; + Text [ english ] = "$(ARG1) is not ready" ; Text[ english_us ] = "The device (drive) $(ARG1) is not ready"; Text[ portuguese ] = "O dispositivo (unidade) $(ARG1) no est preparado."; Text[ russian ] = " () $(ARG1) "; @@ -1205,5 +1205,23 @@ Resource RID_UUI_ERRHDL Text = "Die zu der Partnerschaft $(ARG1) gespeicherten Daten sind defekt"; Text[english] = "The data associated with the partnership $(ARG1) are corrupted"; }; + + String (ERRCODE_UUI_IO_NOTREADY_VOLUME & ERRCODE_RES_MASK) + { + Text = "Laufwerk $(ARG1) ist nicht bereit"; + Text [ english ] = "Volume $(ARG1) is not ready"; + }; + + String (ERRCODE_UUI_IO_NOTREADY_REMOVABLE & ERRCODE_RES_MASK) + { + Text = "$(ARG1) ist nicht bereit; bitte legen Sie ein Speichermedium ein"; + Text [ english ] = "$(ARG1) is not ready; please insert a storage medium"; + }; + + String (ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE & ERRCODE_RES_MASK) + { + Text = "Laufwerk $(ARG1) ist nicht bereit; bitte legen Sie ein Speichermedium ein"; + Text [ english ] = "Volume $(ARG1) is not ready; please insert a storage medium"; + }; }; |