diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-19 16:33:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-22 22:07:38 +0100 |
commit | 6a4c464b49dbfa2801818ead1b50bc9580824d00 (patch) | |
tree | 3d6381b6b13576bc536670992b36784436486e95 /dbaccess/source | |
parent | tdf#68889: Fix the weight reported by the system for the problematic font (diff) | |
download | core-6a4c464b49dbfa2801818ead1b50bc9580824d00.tar.gz core-6a4c464b49dbfa2801818ead1b50bc9580824d00.zip |
weld native message dialogs
just the straight-forward MessageDialog cases first
a) remove border_width from message dialog .ui so as to take
the default border width
b) retain 12 as default message dialog border for vcl widget case
c) remove layour_style from message dialog button boxes so as to
take the default mode (a no-op for vcl widget case)
d) use gtk response ids (vcl builder will converts to vcl ones)
Change-Id: I7de281093a1b64f92f71ca11e7cbba42bb658154
Reviewed-on: https://gerrit.libreoffice.org/50143
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/ext/macromigration/macromigrationdialog.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppControllerDnD.cxx | 20 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppControllerGen.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/brwctrlr.cxx | 16 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/genericcontroller.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DbAdminImpl.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/UserAdmin.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/adminpages.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/directsql.cxx | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/indexdialog.cxx | 34 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/paramdialog.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/QueryDesignView.cxx | 16 | ||||
-rw-r--r-- | dbaccess/source/ui/relationdesign/RelationController.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableController.cxx | 21 |
17 files changed, 125 insertions, 76 deletions
diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx index e30bd2652daf..4edd380f1a63 100644 --- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx +++ b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx @@ -42,7 +42,7 @@ #include <svl/filenotation.hxx> #include <tools/diagnose_ex.h> #include <ucbhelper/content.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vector> @@ -384,8 +384,9 @@ namespace dbmm // check that the backup location isn't the same as the document itself if ( lcl_equalURLs_nothrow( m_pData->aContext, sBackupLocation, m_pData->xDocumentModel->getURL() ) ) { - ScopedVclPtrInstance< MessageDialog > aErrorBox( const_cast< MacroMigrationDialog* >( this ), DBA_RES( STR_INVALID_BACKUP_LOCATION ) ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, DBA_RES(STR_INVALID_BACKUP_LOCATION))); + xErrorBox->run(); rBackupPage.grabLocationFocus(); return false; } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index fcc781ae6ef5..d5339f785a0d 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -84,6 +84,7 @@ #include <vcl/svapp.hxx> #include <vcl/menu.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <unotools/closeveto.hxx> #include <unotools/pathoptions.hxx> @@ -522,7 +523,7 @@ sal_Bool SAL_CALL OApplicationController::suspend(sal_Bool bSuspend) ) ) { - switch (ExecuteQuerySaveDocument(getView(),getStrippedDatabaseName())) + switch (ExecuteQuerySaveDocument(getFrameWeld(),getStrippedDatabaseName())) { case RET_YES: Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>()); diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 940ca99e81ee..7012171dd72c 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -45,7 +45,7 @@ #include <unotools/ucbhelper.hxx> #include <dlgsave.hxx> #include <comphelper/types.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> #include <connectivity/dbexception.hxx> @@ -178,8 +178,10 @@ void OApplicationController::deleteTables(const std::vector< OUString>& _rList) else { OUString sMessage(DBA_RES(STR_MISSING_TABLES_XDROP)); - ScopedVclPtrInstance< MessageDialog > aError(getView(), sMessage); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + xError->run(); } } } @@ -190,7 +192,6 @@ void OApplicationController::deleteObjects( ElementType _eType, const std::vecto Reference< XHierarchicalNameContainer > xHierarchyName( xNames, UNO_QUERY ); if ( xNames.is() ) { - OString sDialogPosition; short eResult = _bConfirm ? svtools::QUERYDELETE_YES : svtools::QUERYDELETE_ALL; // The list of elements to delete is allowed to contain related elements: A given element may @@ -213,17 +214,12 @@ void OApplicationController::deleteObjects( ElementType _eType, const std::vecto if ( eResult != svtools::QUERYDELETE_ALL ) { - ScopedVclPtrInstance< svtools::QueryDeleteDlg_Impl > aDlg(getView(), *aThisRound); - - if ( !sDialogPosition.isEmpty() ) - aDlg->SetWindowState( sDialogPosition ); + svtools::QueryDeleteDlg_Impl aDlg(getFrameWeld(), *aThisRound); if ( nObjectsLeft > 1 ) - aDlg->EnableAllButton(); - - eResult = aDlg->Execute(); + aDlg.EnableAllButton(); - sDialogPosition = aDlg->GetWindowState( ); + eResult = aDlg.run(); } bool bSuccess = false; diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 1e0041d958c0..99a04d7b76e7 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -61,7 +61,7 @@ #include <tools/diagnose_ex.h> #include <osl/diagnose.h> #include <unotools/bootstrap.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> #include <vcl/waitobj.hxx> @@ -518,8 +518,10 @@ void OApplicationController::askToReconnect() bool bClear = true; if ( !m_pSubComponentManager->empty() ) { - ScopedVclPtrInstance< MessageDialog > aQry(getView(), DBA_RES(STR_QUERY_CLOSEDOCUMENTS), VclMessageType::Question, VclButtonsType::YesNo); - switch (aQry->Execute()) + std::unique_ptr<weld::MessageDialog> xQry(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_CLOSEDOCUMENTS))); + switch (xQry->run()) { case RET_YES: closeSubComponents(); diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 372bd7b8b2ef..a23f0f9d2437 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -84,7 +84,7 @@ #include <svx/svxdlg.hxx> #include <tools/diagnose_ex.h> #include <osl/diagnose.h> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> using namespace ::com::sun::star; @@ -1372,9 +1372,11 @@ void SbaXDataBrowserController::resetted(const css::lang::EventObject& rEvent) sal_Bool SbaXDataBrowserController::confirmDelete(const css::sdb::RowChangeEvent& /*aEvent*/) { - if (ScopedVclPtrInstance<MessageDialog>(getBrowserView(), DBA_RES(STR_QUERY_BRW_DELETE_ROWS), VclMessageType::Question, VclButtonsType::YesNo)->Execute() != RET_YES) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_BRW_DELETE_ROWS))); + if (xQuery->run() != RET_YES) return false; - return true; } @@ -2145,11 +2147,9 @@ bool SbaXDataBrowserController::SaveModified(bool bAskFor) { getBrowserView()->getVclControl()->GrabFocus(); - ScopedVclPtrInstance<MessageDialog> aQry( getBrowserView()->getVclControl(), - "SaveModifiedDialog", - "dbaccess/ui/savemodifieddialog.ui" ); - - switch (aQry->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/savemodifieddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQry(xBuilder->weld_message_dialog("SaveModifiedDialog")); + switch (xQry->run()) { case RET_NO: Execute(ID_BROWSER_UNDORECORD,Sequence<PropertyValue>()); diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 0c3ebaf937e3..474104a89191 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -22,6 +22,7 @@ #include <toolkit/awt/vclxwindow.hxx> #include <browserids.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <dbaccess/dataview.hxx> #include <tools/diagnose_ex.h> @@ -204,7 +205,7 @@ bool OGenericUnoController::Construct(vcl::Window* /*pParent*/) { SAL_WARN("dbaccess.ui","OGenericUnoController::Construct: could not create (or start listening at) the database context!"); // at least notify the user. Though the whole component does not make any sense without the database context ... - ShowServiceNotAvailableError(getView(), "com.sun.star.sdb.DatabaseContext", true); + ShowServiceNotAvailableError(getFrameWeld(), "com.sun.star.sdb.DatabaseContext", true); } return true; @@ -1273,6 +1274,11 @@ void SAL_CALL OGenericUnoController::dispose() OGenericUnoController_Base::dispose(); } +weld::Window* OGenericUnoController::getFrameWeld() const +{ + return m_pView ? m_pView->GetFrameWeld() : nullptr; +} + } // namespace dbaui /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 1ff255712dd4..3dd943d14990 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -68,6 +68,7 @@ #include <vcl/msgbox.hxx> #include <vcl/stdtext.hxx> #include <vcl/waitobj.hxx> +#include <vcl/weld.hxx> #include <algorithm> #include <iterator> @@ -204,7 +205,8 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer } catch(const Exception&) { - ShowServiceNotAvailableError(_pParent->GetParent(), "com.sun.star.sdb.DatabaseContext", true); + vcl::Window* pTopParent = _pParent->GetParent(); + ShowServiceNotAvailableError(pTopParent ? pTopParent->GetFrameWeld() : nullptr, "com.sun.star.sdb.DatabaseContext", true); } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 93e7b4b9277a..d3bdf381a3eb 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -32,7 +32,7 @@ #include <svl/intitem.hxx> #include <dsitems.hxx> #include "dbfindex.hxx" -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/mnemonic.hxx> #include <svl/cjkoptions.hxx> #if HAVE_FEATURE_JAVA @@ -309,7 +309,10 @@ namespace dbaui } else return true; - ScopedVclPtrInstance<MessageDialog>(nullptr, MnemonicGenerator::EraseAllMnemonicChars(aErrorText))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + MnemonicGenerator::EraseAllMnemonicChars(aErrorText))); + xBox->run(); pErrorWin->GrabFocus(); return false; } diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx index 2c26dfe85376..b4d23c0815ba 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.cxx +++ b/dbaccess/source/ui/dlg/UserAdmin.cxx @@ -37,7 +37,7 @@ #include <strings.hxx> #include <core_resource.hxx> #include <dbadmin.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <sfx2/passwd.hxx> using namespace ::com::sun::star::container; @@ -103,8 +103,10 @@ IMPL_LINK_NOARG(OPasswordDialog, OKHdl_Impl, Button*, void) else { OUString aErrorMsg( DBA_RES( STR_ERROR_PASSWORDS_NOT_IDENTICAL)); - ScopedVclPtrInstance< MessageDialog > aErrorBox(this, aErrorMsg); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aErrorMsg)); + xErrorBox->run(); m_pEDPassword->SetText( OUString() ); m_pEDPasswordRepeat->SetText( OUString() ); m_pEDPassword->GrabFocus(); @@ -258,8 +260,10 @@ IMPL_LINK( OUserAdmin, UserHdl, Button *, pButton, void ) Reference<XDrop> xDrop(m_xUsers,UNO_QUERY); if(xDrop.is()) { - ScopedVclPtrInstance< MessageDialog > aQry(this, DBA_RES(STR_QUERY_USERADMIN_DELETE_USER), VclMessageType::Question, VclButtonsType::YesNo); - if(aQry->Execute() == RET_YES) + std::unique_ptr<weld::MessageDialog> xQry(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_USERADMIN_DELETE_USER))); + if (xQry->run() == RET_YES) xDrop->dropByName(GetUser()); } } diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index d2fa05ff41a0..486a8189b969 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -37,8 +37,8 @@ #include <vcl/button.hxx> #include <vcl/edit.hxx> #include <vcl/field.hxx> -#include <vcl/layout.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <algorithm> #include <stdlib.h> @@ -129,8 +129,10 @@ namespace dbaui // show an error message OUString sError(DBA_RES(STR_COULD_NOT_LOAD_ODBC_LIB)); sError = sError.replaceFirst("#lib#", aEnumeration.getLibraryName()); - ScopedVclPtrInstance< MessageDialog > aDialog(this, sError); - aDialog->Execute(); + std::unique_ptr<weld::MessageDialog> xDialog(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sError)); + xDialog->run(); return false; } else diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index c5adf93792b2..7ca010ee3228 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -21,7 +21,7 @@ #include <directsql.hxx> #include <dbu_dlg.hxx> #include <strings.hrc> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <comphelper/types.hxx> #include <vcl/svapp.hxx> #include <osl/mutex.hxx> @@ -109,8 +109,10 @@ namespace dbaui { OUString sMessage(DBA_RES(STR_DIRECTSQL_CONNECTIONLOST)); - ScopedVclPtrInstance< MessageDialog > aError(this, sMessage); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + xError->run(); } PostUserEvent(LINK(this, DirectSQLDialog, OnClose), nullptr, true); diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index 0b7635fd8a35..41eb4cf381c8 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -28,9 +28,9 @@ #include <bitmaps.hlst> #include <indexfieldscontrol.hxx> #include <indexcollection.hxx> -#include <vcl/layout.hxx> -#include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> +#include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/sdb/SQLContext.hpp> #include <UITools.hxx> #include <svtools/imgdef.hxx> @@ -414,8 +414,10 @@ namespace dbaui { OUString sConfirm(DBA_RES(STR_CONFIRM_DROP_INDEX)); sConfirm = sConfirm.replaceFirst("$name$", m_pIndexList->GetEntryText(pSelected)); - ScopedVclPtrInstance< MessageDialog > aConfirm(this, sConfirm, VclMessageType::Question, VclButtonsType::YesNo); - if (RET_YES != aConfirm->Execute()) + std::unique_ptr<weld::MessageDialog> xConfirm(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + sConfirm)); + if (RET_YES != xConfirm->run()) return; } @@ -576,9 +578,9 @@ namespace dbaui if (aSelected->isModified() || aSelected->isNew()) { - ScopedVclPtrInstance<MessageDialog> aQuestion(this, "SaveIndexDialog", - "dbaccess/ui/saveindexdialog.ui" ); - nResponse = aQuestion->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "dbaccess/ui/saveindexdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("SaveIndexDialog")); + nResponse = xQuery->run(); } } @@ -618,8 +620,10 @@ namespace dbaui { OUString sError(DBA_RES(STR_INDEX_NAME_ALREADY_USED)); sError = sError.replaceFirst("$name$", sNewName); - ScopedVclPtrInstance< MessageDialog > aError(this, sError); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sError)); + xError->run(); updateToolbox(); m_bEditAgain = true; @@ -679,8 +683,10 @@ namespace dbaui // need at least one field if (0 == _rPos->aFields.size()) { - ScopedVclPtrInstance< MessageDialog > aError(this, DBA_RES(STR_NEED_INDEX_FIELDS)); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + DBA_RES(STR_NEED_INDEX_FIELDS))); + xError->run(); m_pFields->GrabFocus(); return false; } @@ -697,8 +703,10 @@ namespace dbaui // a column is specified twice ... won't work anyway, so prevent this here and now OUString sMessage(DBA_RES(STR_INDEXDESIGN_DOUBLE_COLUMN_NAME)); sMessage = sMessage.replaceFirst("$name$", aFieldCheck->sFieldName); - ScopedVclPtrInstance< MessageDialog > aError(this, sMessage); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xError(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + xError->run(); m_pFields->GrabFocus(); return false; } diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx index ee578a736466..7fa6db46298b 100644 --- a/dbaccess/source/ui/dlg/paramdialog.cxx +++ b/dbaccess/source/ui/dlg/paramdialog.cxx @@ -29,7 +29,7 @@ #include <connectivity/dbtools.hxx> #include <stringconstants.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <osl/diagnose.h> #include <tools/diagnose_ex.h> #include <unotools/syslocale.hxx> @@ -201,7 +201,10 @@ namespace dbaui OUString sMessage(DBA_RES(STR_COULD_NOT_CONVERT_PARAM)); sMessage = sMessage.replaceAll( "$name$", sName ); - ScopedVclPtrInstance<MessageDialog>(nullptr, sMessage)->Execute(); + std::unique_ptr<weld::MessageDialog> xDialog(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + xDialog->run(); m_pParam->GrabFocus(); return true; } diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index 8171442361fb..b3935df22d6c 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -48,7 +48,8 @@ #include <toolkit/helper/vclunohelper.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> namespace dbaui { @@ -303,8 +304,10 @@ namespace dbaui bool bReConnect = true; if ( _bUI ) { - ScopedVclPtrInstance< MessageDialog > aQuery(getView(), DBA_RES(STR_QUERY_CONNECTION_LOST), VclMessageType::Question, VclButtonsType::YesNo); - bReConnect = ( RET_YES == aQuery->Execute() ); + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_CONNECTION_LOST))); + bReConnect = (RET_YES == xQuery->run()); } // now really reconnect ... @@ -452,7 +455,9 @@ namespace dbaui if ( !pWin ) pWin = getView()->Window::GetParent(); - ScopedVclPtrInstance<MessageDialog>(pWin, aMessage, VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfo(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, aMessage)); + xInfo->run(); } const Reference< XConnection >& DBSubComponentController::getConnection() const { diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index ee67a9a69fe2..e26af4db59ae 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -31,7 +31,7 @@ #include <vcl/svapp.hxx> #include <vcl/combobox.hxx> #include <vcl/msgbox.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <browserids.hxx> #include "SelectionBrowseBox.hxx" #include <strings.hrc> @@ -741,7 +741,12 @@ namespace { // only show the messagebox the first time if (!bCritsOnAsterikWarning) - ScopedVclPtrInstance<MessageDialog>(_pView, DBA_RES(STR_QRY_CRITERIA_ON_ASTERISK))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(_pView ? _pView->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + DBA_RES(STR_QRY_CRITERIA_ON_ASTERISK))); + xBox->run(); + } bCritsOnAsterikWarning = true; continue; } @@ -892,7 +897,12 @@ namespace { // only show the MessageBox the first time if (!bCritsOnAsterikWarning) - ScopedVclPtrInstance<MessageDialog>(_pView, DBA_RES(STR_QRY_ORDERBY_ON_ASTERISK))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(_pView ? _pView->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + DBA_RES(STR_QRY_ORDERBY_ON_ASTERISK))); + xBox->run(); + } bCritsOnAsterikWarning = true; continue; } diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx index dfafc9291c24..316080ebca42 100644 --- a/dbaccess/source/ui/relationdesign/RelationController.cxx +++ b/dbaccess/source/ui/relationdesign/RelationController.cxx @@ -28,6 +28,7 @@ #include <strings.hrc> #include <strings.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <browserids.hxx> #include <comphelper/types.hxx> #include <core_resource.hxx> @@ -256,9 +257,9 @@ short ORelationController::saveModified() short nSaved = RET_YES; if(haveDataSource() && isModified()) { - ScopedVclPtrInstance<MessageDialog> aQry(getView(), "DesignSaveModifiedDialog", - "dbaccess/ui/designsavemodifieddialog.ui"); - nSaved = aQry->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/designsavemodifieddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DesignSaveModifiedDialog")); + nSaved = xQuery->run(); if(nSaved == RET_YES) Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>()); } diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index c117ef08ee91..0de9fce3f866 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -64,7 +64,8 @@ #include <cppuhelper/exc_hlp.hxx> #include <sfx2/sfxsids.hrc> #include <tools/diagnose_ex.h> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <algorithm> #include <functional> @@ -435,8 +436,10 @@ void OTableController::doEditIndexes() // table needs to be saved before editing indexes if (m_bNew || isModified()) { - ScopedVclPtrInstance< MessageDialog > aAsk(getView(), DBA_RES(STR_QUERY_SAVE_TABLE_EDIT_INDEXES), VclMessageType::Question, VclButtonsType::YesNo); - if (RET_YES != aAsk->Execute()) + std::unique_ptr<weld::MessageDialog> xAsk(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_QUERY_SAVE_TABLE_EDIT_INDEXES))); + if (RET_YES != xAsk->run()) return; if (!doSaveDoc(false)) @@ -550,9 +553,9 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) if ( std::any_of(m_vRowList.begin(),m_vRowList.end(), std::mem_fn(&OTableRow::isValid)) ) { - ScopedVclPtrInstance<MessageDialog> aQry(getView(), "TableDesignSaveModifiedDialog", - "dbaccess/ui/tabledesignsavemodifieddialog.ui"); - switch (aQry->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/tabledesignsavemodifieddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("TableDesignSaveModifiedDialog")); + switch (xQuery->run()) { case RET_YES: Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>()); @@ -568,9 +571,9 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) } else if ( !m_bNew ) { - ScopedVclPtrInstance<MessageDialog> aQry(getView(), "DeleteAllRowsDialog", - "dbaccess/ui/deleteallrowsdialog.ui"); - switch (aQry->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "dbaccess/ui/deleteallrowsdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DeleteAllRowsDialog")); + switch (xQuery->run()) { case RET_YES: { |