summaryrefslogtreecommitdiffstats
path: root/extensions/source/update/check/updatehdl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/source/update/check/updatehdl.cxx')
-rw-r--r--extensions/source/update/check/updatehdl.cxx87
1 files changed, 29 insertions, 58 deletions
diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx
index b0ecb69e37f9..a5c6429aee69 100644
--- a/extensions/source/update/check/updatehdl.cxx
+++ b/extensions/source/update/check/updatehdl.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstddef>
#include "updatehdl.hxx"
#include <helpids.h>
@@ -59,22 +62,22 @@
#include <strings.hrc>
#include <unotools/resmgr.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
-constexpr OUStringLiteral COMMAND_CLOSE = u"close";
+constexpr OUString COMMAND_CLOSE = u"close"_ustr;
-constexpr OUStringLiteral CTRL_THROBBER = u"throbber";
-constexpr OUStringLiteral CTRL_PROGRESS = u"progress";
+constexpr OUString CTRL_THROBBER = u"throbber"_ustr;
+constexpr OUString CTRL_PROGRESS = u"progress"_ustr;
-constexpr OUStringLiteral TEXT_STATUS = u"text_status";
-constexpr OUStringLiteral TEXT_PERCENT = u"text_percent";
-constexpr OUStringLiteral TEXT_DESCRIPTION = u"text_description";
+constexpr OUString TEXT_STATUS = u"text_status"_ustr;
+constexpr OUString TEXT_PERCENT = u"text_percent"_ustr;
+constexpr OUString TEXT_DESCRIPTION = u"text_description"_ustr;
constexpr OUStringLiteral FIXED_LINE_MODEL = u"com.sun.star.awt.UnoControlFixedLineModel";
-constexpr OUStringLiteral FIXED_TEXT_MODEL = u"com.sun.star.awt.UnoControlFixedTextModel";
-constexpr OUStringLiteral EDIT_FIELD_MODEL = u"com.sun.star.awt.UnoControlEditModel";
-constexpr OUStringLiteral BUTTON_MODEL = u"com.sun.star.awt.UnoControlButtonModel";
-constexpr OUStringLiteral GROUP_BOX_MODEL = u"com.sun.star.awt.UnoControlGroupBoxModel";
+constexpr OUString FIXED_TEXT_MODEL = u"com.sun.star.awt.UnoControlFixedTextModel"_ustr;
+constexpr OUString EDIT_FIELD_MODEL = u"com.sun.star.awt.UnoControlEditModel"_ustr;
+constexpr OUString BUTTON_MODEL = u"com.sun.star.awt.UnoControlButtonModel"_ustr;
+constexpr OUString GROUP_BOX_MODEL = u"com.sun.star.awt.UnoControlGroupBoxModel"_ustr;
using namespace com::sun::star;
@@ -142,7 +145,7 @@ void UpdateHandler::setDownloadBtnLabel( bool bAppendDots )
aLabel += "...";
setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "Label", uno::Any( aLabel ) );
- setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD2 ) );
+ setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD2 )) );
mbDownloadBtnHasDots = bAppendDots;
}
@@ -240,13 +243,13 @@ void UpdateHandler::setErrorMessage( const OUString& rErrorMsg )
}
-void UpdateHandler::setDownloadFile( const OUString& rFilePath )
+void UpdateHandler::setDownloadFile( std::u16string_view rFilePath )
{
- sal_Int32 nLast = rFilePath.lastIndexOf( '/' );
- if ( nLast != -1 )
+ std::size_t nLast = rFilePath.rfind( '/' );
+ if ( nLast != std::u16string_view::npos )
{
- msDownloadFile = rFilePath.copy( nLast+1 );
- const OUString aDownloadURL = rFilePath.copy( 0, nLast );
+ msDownloadFile = rFilePath.substr( nLast+1 );
+ const OUString aDownloadURL(rFilePath.substr( 0, nLast ));
osl::FileBase::getSystemPathFromFileURL( aDownloadURL, msDownloadPath );
}
}
@@ -284,15 +287,6 @@ OUString UpdateHandler::getBubbleTitle( UpdateState eState )
}
-OUString UpdateHandler::getDefaultInstErrMsg()
-{
- osl::MutexGuard aGuard( maMutex );
-
- loadStrings();
-
- return substVariables( msInstallError );
-}
-
// XActionListener
void SAL_CALL UpdateHandler::disposing( const lang::EventObject& rEvt )
@@ -347,10 +341,6 @@ void SAL_CALL UpdateHandler::actionPerformed( awt::ActionEvent const & rEvent )
case DOWNLOAD_BUTTON:
mxActionListener->download();
break;
- case INSTALL_BUTTON:
- if ( showWarning( msInstallMessage ) )
- mxActionListener->install();
- break;
case PAUSE_BUTTON:
mxActionListener->pause();
break;
@@ -570,10 +560,8 @@ void UpdateHandler::updateState( UpdateState eState )
break;
case UPDATESTATE_DOWNLOAD_AVAIL:
showControls( 0 );
- enableControls( (1<<CLOSE_BUTTON) + (1<<INSTALL_BUTTON) );
setControlProperty( TEXT_STATUS, "Text", uno::Any( substVariables(msReady2Install) ) );
setControlProperty( TEXT_DESCRIPTION, "Text", uno::Any( substVariables(msDownloadDescr) ) );
- focusControl( INSTALL_BUTTON );
break;
case UPDATESTATE_AUTO_START:
case UPDATESTATES_COUNT:
@@ -624,8 +612,6 @@ void UpdateHandler::loadStrings()
msDownloading = loadString( loc, RID_UPDATE_STR_DOWNLOADING );
msReady2Install = loadString( loc, RID_UPDATE_STR_READY_INSTALL );
msCancelMessage = loadString( loc, RID_UPDATE_STR_CANCEL_DOWNLOAD );
- msInstallMessage = loadString( loc, RID_UPDATE_STR_BEGIN_INSTALL );
- msInstallError = loadString( loc, RID_UPDATE_STR_INSTALL_ERROR );
msOverwriteWarning = loadString( loc, RID_UPDATE_STR_OVERWRITE_WARNING );
msPercent = loadString( loc, RID_UPDATE_STR_PERCENT );
msReloadWarning = loadString( loc, RID_UPDATE_STR_RELOAD_WARNING );
@@ -637,7 +623,6 @@ void UpdateHandler::loadStrings()
msClose = loadString( loc, RID_UPDATE_BTN_CLOSE );
msDownload = loadString( loc, RID_UPDATE_BTN_DOWNLOAD );
- msInstall = loadString( loc, RID_UPDATE_BTN_INSTALL );
msPauseBtn = loadString( loc, RID_UPDATE_BTN_PAUSE );
msResumeBtn = loadString( loc, RID_UPDATE_BTN_RESUME );
msCancelBtn = loadString( loc, RID_UPDATE_BTN_CANCEL );
@@ -880,7 +865,7 @@ bool UpdateHandler::showWarning( const OUString &rWarningText,
{
uno::Sequence< uno::Reference< awt::XWindow > > xChildren = xMsgBoxCtrls->getWindows();
- for ( uno::Reference< awt::XWindow > const & child : std::as_const(xChildren) )
+ for (uno::Reference<awt::XWindow> const& child : xChildren)
{
uno::Reference< awt::XVclWindowPeer > xMsgBoxCtrl( child, uno::UNO_QUERY );
if ( xMsgBoxCtrl.is() )
@@ -1032,7 +1017,7 @@ void UpdateHandler::createDialog()
xPropSet->setPropertyValue( "PositionY", uno::Any(sal_Int32( 100 )) );
xPropSet->setPropertyValue( "Width", uno::Any(sal_Int32( DIALOG_WIDTH )) );
xPropSet->setPropertyValue( "Height", uno::Any(sal_Int32( DIALOG_HEIGHT )) );
- xPropSet->setPropertyValue( "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DLG ) );
+ xPropSet->setPropertyValue( "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DLG )) );
}
{ // Label (fixed text) <status>
uno::Sequence< beans::NamedValue > aProps { { "Label", uno::Any( msStatusFL ) } };
@@ -1057,7 +1042,7 @@ void UpdateHandler::createDialog()
{ "MultiLine", uno::Any( true ) },
{ "ReadOnly", uno::Any( true ) },
{ "AutoVScroll", uno::Any( true ) },
- { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_STATUS ) }
+ { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_STATUS )) }
};
insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_STATUS,
@@ -1090,7 +1075,7 @@ void UpdateHandler::createDialog()
{ "Enabled", uno::Any( true ) },
{ "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) },
{ "Label", uno::Any( msPauseBtn ) },
- { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_PAUSE ) }
+ { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_PAUSE )) }
};
insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[PAUSE_BUTTON],
@@ -1104,7 +1089,7 @@ void UpdateHandler::createDialog()
{ "Enabled", uno::Any( true ) },
{ "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) },
{ "Label", uno::Any( msResumeBtn ) },
- { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_RESUME ) }
+ { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_RESUME )) }
};
insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[RESUME_BUTTON],
@@ -1121,7 +1106,7 @@ void UpdateHandler::createDialog()
{ "Enabled", uno::Any( true ) },
{ "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) },
{ "Label", uno::Any( msCancelBtn ) },
- { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CANCEL ) }
+ { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CANCEL )) }
};
insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[CANCEL_BUTTON],
@@ -1154,7 +1139,7 @@ void UpdateHandler::createDialog()
{ "MultiLine", uno::Any( true ) },
{ "ReadOnly", uno::Any( true ) },
{ "AutoVScroll", uno::Any( true ) },
- { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DESCRIPTION ) }
+ { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DESCRIPTION )) }
};
insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_DESCRIPTION,
@@ -1183,27 +1168,13 @@ void UpdateHandler::createDialog()
// setProperty( aProps, 2, "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_CANCEL) ) );
// [property] string Label // only if PushButtonType_STANDARD
{ "Label", uno::Any( msClose ) },
- { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CLOSE ) }
+ { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CLOSE )) }
};
insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[ CLOSE_BUTTON ],
awt::Rectangle( CLOSE_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ),
aProps );
}
- { // install button
- uno::Sequence< beans::NamedValue > aProps
- {
- { "DefaultButton", uno::Any( false ) },
- { "Enabled", uno::Any( true ) },
- { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) },
- { "Label", uno::Any( msInstall ) },
- { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_INSTALL ) }
- };
-
- insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[INSTALL_BUTTON],
- awt::Rectangle( INSTALL_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ),
- aProps );
- }
{ // download button
uno::Sequence< beans::NamedValue > aProps
{
@@ -1211,7 +1182,7 @@ void UpdateHandler::createDialog()
{ "Enabled", uno::Any( true ) },
{ "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) },
{ "Label", uno::Any( msDownload ) },
- { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD ) }
+ { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD )) }
};
insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[DOWNLOAD_BUTTON],