Kaydet (Commit) ccbd7731 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SwTestAccountSettingsDialog

Change-Id: Idead8d63dc472403e15eb9adf3cb82467e4d6721
Reviewed-on: https://gerrit.libreoffice.org/61106
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 896a1f86
......@@ -73,7 +73,7 @@ public:
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
/* Derived from SfxSingleTabDialog, in order to be informed about
/* Derived from SfxSingleTabDialogController, in order to be informed about
virtual methods by the control. */
class SvxConnectionDialog : public SfxSingleTabDialogController
{
......
......@@ -87,7 +87,7 @@ public:
};
/* Derived from SfxSingleTabDialog, in order to be able to be
/* Derived from SfxSingleTabDialogController, in order to be able to be
informed about virtual methods by the control. */
class SvxMeasureDialog : public SfxSingleTabDialogController
{
......
......@@ -41,36 +41,33 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::mail;
using namespace ::com::sun::star::beans;
class SwTestAccountSettingsDialog : public SfxModalDialog
class SwTestAccountSettingsDialog : public weld::GenericDialogController
{
VclPtr<VclMultiLineEdit> m_pErrorsED;
VclPtr<PushButton> m_pStopPB;
VclPtr<FixedText> m_pEstablish;
VclPtr<FixedText> m_pFind;
VclPtr<FixedText> m_pResult1;
VclPtr<FixedText> m_pResult2;
VclPtr<FixedImage> m_pImage1;
VclPtr<FixedImage> m_pImage2;
Image m_aCompletedImg;
Image m_aFailedImg;
ImplSVEvent* m_pPostedEvent;
OUString m_sCompleted;
OUString m_sFailed;
OUString m_sErrorServer;
bool m_bStop;
VclPtr<SwMailConfigPage> m_pParent;
bool m_bStop;
std::unique_ptr<weld::Button> m_xStopPB;
std::unique_ptr<weld::TextView> m_xErrorsED;
std::unique_ptr<weld::Label> m_xEstablish;
std::unique_ptr<weld::Label> m_xFind;
std::unique_ptr<weld::Label> m_xResult1;
std::unique_ptr<weld::Label> m_xResult2;
std::unique_ptr<weld::Image> m_xImage1;
std::unique_ptr<weld::Image> m_xImage2;
std::unique_ptr<weld::Image> m_xImage3;
std::unique_ptr<weld::Image> m_xImage4;
void Test();
DECL_LINK(StopHdl, Button*, void);
DECL_LINK(StopHdl, weld::Button&, void);
DECL_LINK(TestHdl, void*, void);
public:
explicit SwTestAccountSettingsDialog(SwMailConfigPage* pParent);
virtual ~SwTestAccountSettingsDialog() override;
virtual void dispose() override;
};
class SwAuthenticationSettingsDialog : public weld::GenericDialogController
......@@ -216,7 +213,8 @@ IMPL_LINK_NOARG(SwMailConfigPage, AuthenticationHdl, Button*, void)
IMPL_LINK_NOARG(SwMailConfigPage, TestHdl, Button*, void)
{
ScopedVclPtrInstance<SwTestAccountSettingsDialog>(this)->Execute();
SwTestAccountSettingsDialog aDlg(this);
aDlg.run();
}
IMPL_LINK(SwMailConfigPage, SecureHdl, Button*, pBox, void)
......@@ -228,61 +226,50 @@ IMPL_LINK(SwMailConfigPage, SecureHdl, Button*, pBox, void)
}
SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pParent)
: SfxModalDialog(pParent, "TestMailSettings", "modules/swriter/ui/testmailsettings.ui")
, m_aCompletedImg(BitmapEx(RID_BMP_FORMULA_APPLY))
, m_aFailedImg(BitmapEx(RID_BMP_FORMULA_CANCEL))
, m_pParent(pParent)
: GenericDialogController(pParent->GetFrameWeld(), "modules/swriter/ui/testmailsettings.ui", "TestMailSettings")
, m_bStop(false)
, m_pParent(pParent)
, m_xStopPB(m_xBuilder->weld_button("stop"))
, m_xErrorsED(m_xBuilder->weld_text_view("errors"))
, m_xEstablish(m_xBuilder->weld_label("establish"))
, m_xFind(m_xBuilder->weld_label("find"))
, m_xResult1(m_xBuilder->weld_label("result1"))
, m_xResult2(m_xBuilder->weld_label("result2"))
, m_xImage1(m_xBuilder->weld_image("image1"))
, m_xImage2(m_xBuilder->weld_image("image2"))
, m_xImage3(m_xBuilder->weld_image("image3"))
, m_xImage4(m_xBuilder->weld_image("image4"))
{
get(m_pStopPB, "stop");
get(m_pErrorsED, "errors");
m_pErrorsED->SetMaxTextWidth(80 * m_pErrorsED->approximate_char_width());
m_pErrorsED->set_height_request(8 * m_pErrorsED->GetTextHeight());
m_sErrorServer = m_pErrorsED->GetText();
m_pErrorsED->SetText("");
get(m_pEstablish, "establish");
get(m_pFind, "find");
get(m_pImage1, "image1");
get(m_pResult1, "result1");
get(m_pImage2, "image2");
get(m_pResult2, "result2");
m_sCompleted = m_pResult1->GetText();
m_sFailed = m_pResult2->GetText();
m_pStopPB->SetClickHdl(LINK(this, SwTestAccountSettingsDialog, StopHdl));
Application::PostUserEvent( LINK( this, SwTestAccountSettingsDialog, TestHdl ), this, true );
}
m_xErrorsED->set_size_request(m_xErrorsED->get_approximate_digit_width() * 72,
m_xErrorsED->get_height_rows(8));
m_sErrorServer = m_xErrorsED->get_text();
m_xErrorsED->set_text("");
m_sCompleted = m_xResult1->get_label();
m_sFailed = m_xResult2->get_label();
SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog()
{
disposeOnce();
m_xStopPB->connect_clicked(LINK(this, SwTestAccountSettingsDialog, StopHdl));
m_pPostedEvent = Application::PostUserEvent(LINK(this, SwTestAccountSettingsDialog, TestHdl));
}
void SwTestAccountSettingsDialog::dispose()
SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog()
{
m_pErrorsED.clear();
m_pStopPB.clear();
m_pEstablish.clear();
m_pFind.clear();
m_pResult1.clear();
m_pResult2.clear();
m_pImage1.clear();
m_pImage2.clear();
m_pParent.clear();
SfxModalDialog::dispose();
if (m_pPostedEvent)
{
Application::RemoveUserEvent(m_pPostedEvent);
}
}
IMPL_LINK_NOARG(SwTestAccountSettingsDialog, StopHdl, Button*, void)
IMPL_LINK_NOARG(SwTestAccountSettingsDialog, StopHdl, weld::Button&, void)
{
m_bStop = true;
}
IMPL_LINK_NOARG(SwTestAccountSettingsDialog, TestHdl, void*, void)
{
EnterWait();
m_pPostedEvent = nullptr;
weld::WaitObject aWait(m_xDialog.get());
Test();
LeaveWait();
}
void SwTestAccountSettingsDialog::Test()
......@@ -318,7 +305,7 @@ void SwTestAccountSettingsDialog::Test()
new SwAuthenticator(
m_pParent->m_pConfigItem->GetInServerUserName(),
m_pParent->m_pConfigItem->GetInServerPassword(),
this);
m_xDialog.get());
xInMailService->addConnectionListener(xConnectionListener);
//check connection
......@@ -339,7 +326,7 @@ void SwTestAccountSettingsDialog::Test()
new SwAuthenticator(
m_pParent->m_pConfigItem->GetMailUserName(),
m_pParent->m_pConfigItem->GetMailPassword(),
this);
m_xDialog.get());
else
xAuthenticator = new SwAuthenticator();
......@@ -369,18 +356,20 @@ void SwTestAccountSettingsDialog::Test()
sException = e.Message;
}
m_pResult1->SetText(bIsServer ? m_sCompleted : m_sFailed);
m_pImage1->SetImage(bIsServer ? m_aCompletedImg : m_aFailedImg);
m_xResult1->set_label(bIsServer ? m_sCompleted : m_sFailed);
m_xImage1->show(!bIsServer);
m_xImage3->show(bIsServer);
m_pResult2->SetText(bIsLoggedIn ? m_sCompleted : m_sFailed);
m_pImage2->SetImage(bIsLoggedIn ? m_aCompletedImg : m_aFailedImg);
m_xResult2->set_label(bIsLoggedIn ? m_sCompleted : m_sFailed);
m_xImage2->show(!bIsLoggedIn);
m_xImage4->show(bIsLoggedIn);
if (!bIsServer || !bIsLoggedIn)
{
OUString aErrorMessage(m_sErrorServer);
if (!sException.isEmpty())
aErrorMessage += "\n--\n" + sException;
m_pErrorsED->SetText(aErrorMessage);
m_xErrorsED->set_text(aErrorMessage);
}
}
......
......@@ -418,7 +418,7 @@ void SwSendMailDialog::SendMails()
uno::Reference< mail::XSmtpService > xSmtpServer =
SwMailMergeHelper::ConnectToSmtpServer( *m_pConfigItem,
m_pImpl->xConnectedInMailService,
aEmptyOUStr, aEmptyOUStr, this );
aEmptyOUStr, aEmptyOUStr, GetFrameWeld() );
bool bIsLoggedIn = xSmtpServer.is() && xSmtpServer->isConnected();
LeaveWait();
if(!bIsLoggedIn)
......
......@@ -87,7 +87,7 @@ uno::Reference< mail::XSmtpService > ConnectToSmtpServer(
uno::Reference< mail::XMailService >& rxInMailService,
const OUString& rInMailServerPassword,
const OUString& rOutMailServerPassword,
vcl::Window* pDialogParentWindow )
weld::Window* pDialogParentWindow )
{
uno::Reference< mail::XSmtpService > xSmtpServer;
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
......@@ -611,7 +611,7 @@ OUString SwAuthenticator::getPassword( )
{
if(!m_aUserName.isEmpty() && m_aPassword.isEmpty() && m_pParentWindow)
{
SfxPasswordDialog aPasswdDlg(m_pParentWindow->GetFrameWeld());
SfxPasswordDialog aPasswdDlg(m_pParentWindow);
aPasswdDlg.SetMinLen(0);
if (RET_OK == aPasswdDlg.execute())
m_aPassword = aPasswdDlg.GetPassword();
......
......@@ -49,7 +49,7 @@ namespace SwMailMergeHelper
css::uno::Reference<css::mail::XMailService>& xInMailService,
const OUString& rInMailServerPassword,
const OUString& rOutMailServerPassword,
vcl::Window* pDialogParentWindow = nullptr);
weld::Window* pDialogParentWindow = nullptr);
}
struct SwAddressPreview_Impl;
......@@ -142,12 +142,12 @@ class SW_DLLPUBLIC SwAuthenticator :
{
OUString m_aUserName;
OUString m_aPassword;
VclPtr<vcl::Window> m_pParentWindow;
weld::Window* m_pParentWindow;
public:
SwAuthenticator()
: m_pParentWindow(nullptr)
{}
SwAuthenticator(const OUString& username, const OUString& password, vcl::Window* pParent)
SwAuthenticator(const OUString& username, const OUString& password, weld::Window* pParent)
: m_aUserName(username)
, m_aPassword(password)
, m_pParentWindow(pParent)
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
<object class="GtkTextBuffer" id="textbuffer1">
......@@ -10,6 +10,9 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="testmailsettings|TestMailSettings">Test Account Settings</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
......@@ -95,72 +98,118 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkImage" id="image1">
<object class="GtkLabel" id="establish">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
<property name="label" translatable="yes" context="testmailsettings|establish">Establish network connection</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image2">
<object class="GtkLabel" id="find">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
<property name="label" translatable="yes" context="testmailsettings|find">Find outgoing mail server</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="establish">
<object class="GtkLabel" id="result1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="testmailsettings|result1">Successful</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="testmailsettings|establish">Establish network connection</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="find">
<object class="GtkLabel" id="result2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="testmailsettings|result2">Failed</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="testmailsettings|find">Find outgoing mail server</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="result1">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="testmailsettings|result1">Successful</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-dialog-error</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-apply</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="result2">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="testmailsettings|result2">Failed</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-dialog-error</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-apply</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
......@@ -213,7 +262,7 @@
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTextView" id="errors:border">
<object class="GtkTextView" id="errors">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
......@@ -254,7 +303,6 @@
</object>
</child>
<action-widgets>
<action-widget response="0">stop</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
......
......@@ -138,6 +138,7 @@
#define SPINNER_64_12 "vcl/res/spinner-64-12.png"
//end, Throbber::getDefaultImageURLs
#define IMG_APPLY "sw/res/sc20558.png"
#define IMG_WARN "dbaccess/res/exwarning.png"
#define IMG_ERROR "dbaccess/res/exerror.png"
#define IMG_INFO "dbaccess/res/exinfo.png"
......
......@@ -70,6 +70,10 @@ namespace
return OUString(SV_RESID_BITMAP_INDEX);
else if (sType == "gtk-refresh")
return OUString(SV_RESID_BITMAP_REFRESH);
else if (sType == "gtk-apply")
return OUString(IMG_APPLY);
else if (sType == "gtk-dialog-error")
return OUString(IMG_ERROR);
return OUString();
}
......@@ -627,7 +631,7 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
pTargetButton->SetStyle(pTargetButton->GetStyle() | WB_SMALLSTYLE);
}
else
SAL_WARN_IF(eType != SymbolType::IMAGE, "vcl.layout", "inimplemented symbol type for radiobuttons");
SAL_WARN_IF(eType != SymbolType::IMAGE, "vcl.layout", "unimplemented symbol type for radiobuttons");
if (eType == SymbolType::IMAGE)
{
BitmapEx aBitmap(mapStockToImageResource(rImageInfo.m_sStock));
......@@ -658,6 +662,28 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
delete_by_name(elem.toUtf8());
}
//fill in any stock icons in surviving images
for (auto const& elem : m_pParserState->m_aStockMap)
{
FixedImage *pImage = get<FixedImage>(elem.first);
SAL_WARN_IF(!pImage, "vcl", "missing elements of image/stock");
if (!pImage)
continue;
const stockinfo &rImageInfo = elem.second;
if (rImageInfo.m_sStock == "gtk-missing-image")
continue;
SymbolType eType = mapStockToSymbol(rImageInfo.m_sStock);
SAL_WARN_IF(eType != SymbolType::IMAGE, "vcl", "unimplemented symbol type for images");
if (eType != SymbolType::IMAGE)
continue;
BitmapEx aBitmap(mapStockToImageResource(rImageInfo.m_sStock));
const Image aImage(aBitmap);
pImage->SetImage(aImage);
}
//Set button menus when everything has been imported
for (auto const& elem : m_pParserState->m_aButtonMenuMaps)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment