summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/dlg/sqlmessage.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/dlg/sqlmessage.cxx')
-rw-r--r--dbaccess/source/ui/dlg/sqlmessage.cxx52
1 files changed, 25 insertions, 27 deletions
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index 39ba6dc8eed1..60b533f90c19 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -22,6 +22,7 @@
#include <strings.hrc>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
+#include <utility>
#include <vcl/stdtext.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -50,8 +51,8 @@ namespace
OUString m_defaultImageID;
public:
- explicit ImageProvider(const OUString& defaultImageID)
- : m_defaultImageID(defaultImageID)
+ explicit ImageProvider(OUString defaultImageID)
+ : m_defaultImageID(std::move(defaultImageID))
{
}
@@ -66,7 +67,7 @@ namespace
private:
OUString m_label;
public:
- explicit LabelProvider(const char* labelResourceID)
+ explicit LabelProvider(TranslateId labelResourceID)
: m_label(DBA_RES(labelResourceID))
{
}
@@ -95,7 +96,7 @@ namespace
std::shared_ptr< ImageProvider > const & getImageProvider( SQLExceptionInfo::TYPE _eType ) const
{
std::shared_ptr< ImageProvider >* ppProvider( &m_pErrorImage );
- OUString sNormalImageID("dialog-error");
+ OUString sNormalImageID(u"dialog-error"_ustr);
switch ( _eType )
{
@@ -121,7 +122,7 @@ namespace
std::shared_ptr< LabelProvider > const & getLabelProvider( SQLExceptionInfo::TYPE _eType, bool _bSubLabel ) const
{
std::shared_ptr< LabelProvider >* ppProvider( &m_pErrorLabel );
- const char* pLabelID( STR_EXCEPTION_ERROR );
+ TranslateId pLabelID( STR_EXCEPTION_ERROR );
switch ( _eType )
{
@@ -196,10 +197,7 @@ namespace
void lcl_buildExceptionChain( const SQLExceptionInfo& _rErrorInfo, const ProviderFactory& _rFactory, ExceptionDisplayChain& _out_rChain )
{
- {
- ExceptionDisplayChain empty;
- _out_rChain.swap( empty );
- }
+ ExceptionDisplayChain().swap(_out_rChain);
SQLExceptionIteratorHelper iter( _rErrorInfo );
while ( iter.hasMoreElements() )
@@ -209,7 +207,7 @@ namespace
iter.next( aCurrentElement );
const SQLException* pCurrentError = aCurrentElement;
- OSL_ENSURE( pCurrentError, "lcl_buildExceptionChain: iterator failure!" );
+ assert(pCurrentError && "lcl_buildExceptionChain: iterator failure!");
// hasMoreElements should not have returned <TRUE/> in this case
ExceptionDisplayInfo aDisplayInfo( aCurrentElement.getType() );
@@ -269,7 +267,7 @@ class OExceptionChainDialog : public weld::GenericDialogController
ExceptionDisplayChain m_aExceptions;
public:
- OExceptionChainDialog(weld::Window* pParent, const ExceptionDisplayChain& rExceptions);
+ OExceptionChainDialog(weld::Window* pParent, ExceptionDisplayChain&& rExceptions);
protected:
DECL_LINK(OnExceptionSelected, weld::TreeView&, void);
@@ -277,11 +275,11 @@ protected:
}
-OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, const ExceptionDisplayChain& rExceptions)
- : GenericDialogController(pParent, "dbaccess/ui/sqlexception.ui", "SQLExceptionDialog")
- , m_xExceptionList(m_xBuilder->weld_tree_view("list"))
- , m_xExceptionText(m_xBuilder->weld_text_view("description"))
- , m_aExceptions(rExceptions)
+OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, ExceptionDisplayChain&& rExceptions)
+ : GenericDialogController(pParent, u"dbaccess/ui/sqlexception.ui"_ustr, u"SQLExceptionDialog"_ustr)
+ , m_xExceptionList(m_xBuilder->weld_tree_view(u"list"_ustr))
+ , m_xExceptionText(m_xBuilder->weld_text_view(u"description"_ustr))
+ , m_aExceptions(std::move(rExceptions))
{
int nListWidth = m_xExceptionText->get_approximate_digit_width() * 28;
int nTextWidth = m_xExceptionText->get_approximate_digit_width() * 42;
@@ -292,7 +290,8 @@ OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, const Except
m_sStatusLabel = DBA_RES( STR_EXCEPTION_STATUS );
m_sErrorCodeLabel = DBA_RES( STR_EXCEPTION_ERRORCODE );
- m_xExceptionList->connect_changed(LINK(this, OExceptionChainDialog, OnExceptionSelected));
+ m_xExceptionList->connect_selection_changed(
+ LINK(this, OExceptionChainDialog, OnExceptionSelected));
bool bHave22018 = false;
size_t elementPos = 0;
@@ -484,7 +483,7 @@ void OSQLMessageBox::impl_createStandardButtons( MessBoxStyle _nStyle )
else
aTmp = m_sHelpURL;
- m_xDialog->set_help_id(OUStringToOString(aTmp, RTL_TEXTENCODING_UTF8));
+ m_xDialog->set_help_id(aTmp);
}
void OSQLMessageBox::impl_addDetailsButton()
@@ -509,7 +508,7 @@ void OSQLMessageBox::impl_addDetailsButton()
if ( bMoreDetailsAvailable )
{
m_xDialog->add_button(GetStandardText(StandardButtonType::More), RET_MORE);
- m_xMoreButton.reset(m_xDialog->weld_widget_for_response(RET_MORE));
+ m_xMoreButton = m_xDialog->weld_button_for_response(RET_MORE);
m_xMoreButton->connect_clicked(LINK(this, OSQLMessageBox, ButtonClickHdl));
}
}
@@ -548,7 +547,7 @@ void OSQLMessageBox::Construct(weld::Window* pParent, MessBoxStyle _nStyle, Mess
break;
}
- m_xDialog.reset(Application::CreateMessageDialog(pParent, eMessageType, VclButtonsType::NONE, ""));
+ m_xDialog.reset(Application::CreateMessageDialog(pParent, eMessageType, VclButtonsType::NONE, u""_ustr));
m_xDialog->set_title(utl::ConfigManager::getProductName() + " Base");
impl_fillMessages();
@@ -558,20 +557,19 @@ void OSQLMessageBox::Construct(weld::Window* pParent, MessBoxStyle _nStyle, Mess
impl_addDetailsButton();
}
-OSQLMessageBox::OSQLMessageBox(weld::Window* pParent, const SQLExceptionInfo& rException, MessBoxStyle nStyle, const OUString& rHelpURL)
+OSQLMessageBox::OSQLMessageBox(weld::Window* pParent, const SQLExceptionInfo& rException, MessBoxStyle nStyle, OUString sHelpURL)
: m_pImpl(new SQLMessageBox_Impl(rException))
- , m_sHelpURL(rHelpURL)
+ , m_sHelpURL(std::move(sHelpURL))
{
Construct(pParent, nStyle, AUTO);
}
OSQLMessageBox::OSQLMessageBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage, MessBoxStyle nStyle, MessageType eType, const ::dbtools::SQLExceptionInfo* pAdditionalErrorInfo )
{
- SQLContext aError;
- aError.Message = rTitle;
- aError.Details = rMessage;
+ css::uno::Any next;
if (pAdditionalErrorInfo)
- aError.NextException = pAdditionalErrorInfo->get();
+ next = pAdditionalErrorInfo->get();
+ SQLContext aError(rTitle, {}, {}, 0, next, rMessage);
m_pImpl.reset(new SQLMessageBox_Impl(SQLExceptionInfo(aError)));
@@ -584,7 +582,7 @@ OSQLMessageBox::~OSQLMessageBox()
IMPL_LINK_NOARG(OSQLMessageBox, ButtonClickHdl, weld::Button&, void)
{
- OExceptionChainDialog aDlg(m_xDialog.get(), m_pImpl->aDisplayInfo);
+ OExceptionChainDialog aDlg(m_xDialog.get(), std::vector(m_pImpl->aDisplayInfo));
aDlg.run();
}