LCOV - code coverage report
Current view: top level - sw/source/ui/config - mailconfigpage.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 307 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 35 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <swmodule.hxx>
      21             : #include <swtypes.hxx>
      22             : #include <mailconfigpage.hxx>
      23             : #include <sfx2/imgmgr.hxx>
      24             : #include <svtools/svmedit.hxx>
      25             : #include <svtools/stdctrl.hxx>
      26             : #include <svtools/svtabbx.hxx>
      27             : #include <svtools/headbar.hxx>
      28             : #include <mmconfigitem.hxx>
      29             : #include <mailmergehelper.hxx>
      30             : #include <cmdid.h>
      31             : #include <vcl/svapp.hxx>
      32             : #include <comphelper/processfactory.hxx>
      33             : #include <com/sun/star/mail/MailServiceType.hpp>
      34             : #include <com/sun/star/mail/XMailService.hpp>
      35             : #include <com/sun/star/mail/MailServiceProvider.hpp>
      36             : #include <vcl/msgbox.hxx>
      37             : #include <globals.hrc>
      38             : #include <config.hrc>
      39             : #include <helpid.h>
      40             : 
      41             : using namespace ::com::sun::star;
      42             : using namespace ::com::sun::star::lang;
      43             : using namespace ::com::sun::star::mail;
      44             : using namespace ::com::sun::star::beans;
      45             : 
      46             : class SwTestAccountSettingsDialog : public SfxModalDialog
      47             : {
      48             :     VclPtr<VclMultiLineEdit>   m_pErrorsED;
      49             : 
      50             :     VclPtr<PushButton>         m_pStopPB;
      51             : 
      52             :     VclPtr<FixedText>          m_pEstablish;
      53             :     VclPtr<FixedText>          m_pFind;
      54             :     VclPtr<FixedText>          m_pResult1;
      55             :     VclPtr<FixedText>          m_pResult2;
      56             :     VclPtr<FixedImage>         m_pImage1;
      57             :     VclPtr<FixedImage>         m_pImage2;
      58             : 
      59             :     Image               m_aCompletedImg;
      60             :     Image               m_aFailedImg;
      61             :     OUString            m_sCompleted;
      62             :     OUString            m_sFailed;
      63             :     OUString            m_sErrorServer;
      64             : 
      65             :     VclPtr<SwMailConfigPage>   m_pParent;
      66             : 
      67             :     bool                m_bStop;
      68             : 
      69             :     void                Test();
      70             :     DECL_LINK(StopHdl, void *);
      71             :     DECL_LINK(TestHdl, void*);
      72             : public:
      73             :     explicit SwTestAccountSettingsDialog(SwMailConfigPage* pParent);
      74             :     virtual ~SwTestAccountSettingsDialog();
      75             :     virtual void dispose() SAL_OVERRIDE;
      76             : };
      77             : 
      78             : class SwAuthenticationSettingsDialog : public SfxModalDialog
      79             : {
      80             :     VclPtr<CheckBox>        m_pAuthenticationCB;
      81             : 
      82             :     VclPtr<RadioButton>     m_pSeparateAuthenticationRB;
      83             :     VclPtr<RadioButton>     m_pSMTPAfterPOPRB;
      84             : 
      85             :     VclPtr<FixedText>       m_pOutgoingServerFT;
      86             :     VclPtr<FixedText>       m_pUserNameFT;
      87             :     VclPtr<Edit>            m_pUserNameED;
      88             :     VclPtr<FixedText>       m_pOutPasswordFT;
      89             :     VclPtr<Edit>            m_pOutPasswordED;
      90             : 
      91             :     VclPtr<FixedText>       m_pIncomingServerFT;
      92             :     VclPtr<FixedText>       m_pServerFT;
      93             :     VclPtr<Edit>            m_pServerED;
      94             :     VclPtr<FixedText>       m_pPortFT;
      95             :     VclPtr<NumericField>    m_pPortNF;
      96             :     VclPtr<FixedText>       m_pProtocolFT;
      97             :     VclPtr<RadioButton>     m_pPOP3RB;
      98             :     VclPtr<RadioButton>     m_pIMAPRB;
      99             :     VclPtr<FixedText>       m_pInUsernameFT;
     100             :     VclPtr<Edit>            m_pInUsernameED;
     101             :     VclPtr<FixedText>       m_pInPasswordFT;
     102             :     VclPtr<Edit>            m_pInPasswordED;
     103             : 
     104             :     VclPtr<OKButton>        m_pOKPB;
     105             : 
     106             :     SwMailMergeConfigItem& rConfigItem;
     107             : 
     108             :     DECL_LINK(OKHdl_Impl, void *);
     109             :     DECL_LINK( CheckBoxHdl_Impl, CheckBox*);
     110             :     DECL_LINK(RadioButtonHdl_Impl, void *);
     111             : 
     112             : public:
     113             :     SwAuthenticationSettingsDialog(SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem);
     114             :     virtual ~SwAuthenticationSettingsDialog();
     115             :     virtual void dispose() SAL_OVERRIDE;
     116             : };
     117             : 
     118           0 : SwMailConfigPage::SwMailConfigPage( vcl::Window* pParent, const SfxItemSet& rSet ) :
     119             :     SfxTabPage(pParent, "MailConfigPage" , "modules/swriter/ui/mailconfigpage.ui", &rSet),
     120             : 
     121           0 :     m_pConfigItem( new SwMailMergeConfigItem )
     122             : {
     123           0 :     get(m_pDisplayNameED,"displayname");
     124           0 :     get(m_pAddressED,"address");
     125           0 :     get(m_pReplyToCB,"replytocb");
     126           0 :     get(m_pReplyToFT,"replyto_label");
     127           0 :     get(m_pReplyToED,"replyto");
     128           0 :     get(m_pServerED,"server");
     129           0 :     get(m_pPortNF,"port");
     130           0 :     get(m_pSecureCB,"secure");
     131           0 :     get(m_pServerAuthenticationPB,"serverauthentication");
     132           0 :     get(m_pTestPB,"test");
     133             : 
     134           0 :     m_pReplyToCB->SetClickHdl(LINK(this, SwMailConfigPage, ReplyToHdl));
     135           0 :     m_pServerAuthenticationPB->SetClickHdl(LINK(this, SwMailConfigPage, AuthenticationHdl));
     136           0 :     m_pTestPB->SetClickHdl(LINK(this, SwMailConfigPage, TestHdl));
     137           0 : }
     138             : 
     139           0 : SwMailConfigPage::~SwMailConfigPage()
     140             : {
     141           0 :     disposeOnce();
     142           0 : }
     143             : 
     144           0 : void SwMailConfigPage::dispose()
     145             : {
     146           0 :     delete m_pConfigItem;
     147           0 :     m_pDisplayNameED.clear();
     148           0 :     m_pAddressED.clear();
     149           0 :     m_pReplyToCB.clear();
     150           0 :     m_pReplyToFT.clear();
     151           0 :     m_pReplyToED.clear();
     152           0 :     m_pServerED.clear();
     153           0 :     m_pPortNF.clear();
     154           0 :     m_pSecureCB.clear();
     155           0 :     m_pServerAuthenticationPB.clear();
     156           0 :     m_pTestPB.clear();
     157           0 :     SfxTabPage::dispose();
     158           0 : }
     159             : 
     160           0 : VclPtr<SfxTabPage> SwMailConfigPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet)
     161             : {
     162           0 :     return VclPtr<SwMailConfigPage>::Create(pParent, *rAttrSet);
     163             : }
     164             : 
     165           0 : bool SwMailConfigPage::FillItemSet( SfxItemSet* /*rSet*/ )
     166             : {
     167           0 :     if(m_pDisplayNameED->IsValueChangedFromSaved())
     168           0 :         m_pConfigItem->SetMailDisplayName(m_pDisplayNameED->GetText());
     169           0 :     if(m_pAddressED->IsValueChangedFromSaved())
     170           0 :         m_pConfigItem->SetMailAddress(m_pAddressED->GetText());
     171           0 :     if( m_pReplyToCB->IsValueChangedFromSaved() )
     172           0 :         m_pConfigItem->SetMailReplyTo(m_pReplyToCB->IsChecked());
     173           0 :     if(m_pReplyToED->IsValueChangedFromSaved())
     174           0 :         m_pConfigItem->SetMailReplyTo(m_pReplyToED->GetText());
     175           0 :     if(m_pServerED->IsValueChangedFromSaved())
     176           0 :         m_pConfigItem->SetMailServer(m_pServerED->GetText());
     177             : 
     178           0 :     if(m_pPortNF->IsModified())
     179           0 :         m_pConfigItem->SetMailPort((sal_Int16)m_pPortNF->GetValue());
     180             : 
     181           0 :     m_pConfigItem->SetSecureConnection(m_pSecureCB->IsChecked());
     182             : 
     183           0 :     m_pConfigItem->Commit();
     184           0 :     return true;
     185             : }
     186             : 
     187           0 : void SwMailConfigPage::Reset( const SfxItemSet* /*rSet*/ )
     188             : {
     189           0 :     m_pDisplayNameED->SetText(m_pConfigItem->GetMailDisplayName());
     190           0 :     m_pAddressED->SetText(m_pConfigItem->GetMailAddress());
     191             : 
     192           0 :     m_pReplyToED->SetText(m_pConfigItem->GetMailReplyTo()) ;
     193           0 :     m_pReplyToCB->Check(m_pConfigItem->IsMailReplyTo());
     194           0 :     m_pReplyToCB->GetClickHdl().Call(m_pReplyToCB.get());
     195             : 
     196           0 :     m_pServerED->SetText(m_pConfigItem->GetMailServer());
     197           0 :     m_pPortNF->SetValue(m_pConfigItem->GetMailPort());
     198             : 
     199           0 :     m_pSecureCB->Check(m_pConfigItem->IsSecureConnection());
     200             : 
     201           0 :     m_pDisplayNameED->SaveValue();
     202           0 :     m_pAddressED    ->SaveValue();
     203           0 :     m_pReplyToCB    ->SaveValue();
     204           0 :     m_pReplyToED    ->SaveValue();
     205           0 :     m_pServerED     ->SaveValue();
     206           0 :     m_pPortNF       ->SaveValue();
     207           0 :     m_pSecureCB     ->SaveValue();
     208           0 : }
     209             : 
     210           0 : IMPL_LINK(SwMailConfigPage, ReplyToHdl, CheckBox*, pBox)
     211             : {
     212           0 :     bool bEnable = pBox->IsChecked();
     213           0 :     m_pReplyToFT->Enable(bEnable);
     214           0 :     m_pReplyToED->Enable(bEnable);
     215           0 :     return 0;
     216             : }
     217             : 
     218           0 : IMPL_LINK_NOARG(SwMailConfigPage, AuthenticationHdl)
     219             : {
     220           0 :     ScopedVclPtrInstance< SwAuthenticationSettingsDialog > aDlg(this, *m_pConfigItem);
     221           0 :     aDlg->Execute();
     222           0 :     return 0;
     223             : }
     224             : 
     225           0 : IMPL_LINK_NOARG(SwMailConfigPage, TestHdl)
     226             : {
     227           0 :     ScopedVclPtrInstance<SwTestAccountSettingsDialog>::Create(this)->Execute();
     228           0 :     return 0;
     229             : }
     230             : 
     231           0 : SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pParent)
     232             :     : SfxModalDialog(pParent, "TestMailSettings", "modules/swriter/ui/testmailsettings.ui")
     233             :     , m_pParent(pParent)
     234           0 :     , m_bStop(false)
     235             : {
     236           0 :     get(m_pStopPB, "stop");
     237           0 :     get(m_pErrorsED, "errors");
     238           0 :     m_pErrorsED->SetMaxTextWidth(80 * m_pErrorsED->approximate_char_width());
     239           0 :     m_pErrorsED->set_height_request(8 * m_pErrorsED->GetTextHeight());
     240           0 :     m_sErrorServer = m_pErrorsED->GetText();
     241           0 :     m_pErrorsED->SetText("");
     242           0 :     get(m_pEstablish, "establish");
     243           0 :     get(m_pFind, "find");
     244           0 :     get(m_pImage1, "image1");
     245           0 :     get(m_pResult1, "result1");
     246           0 :     get(m_pImage2, "image2");
     247           0 :     get(m_pResult2, "result2");
     248           0 :     m_sCompleted = m_pResult1->GetText();
     249           0 :     m_sFailed = m_pResult2->GetText();
     250             : 
     251           0 :     SfxImageManager* pManager = SfxImageManager::GetImageManager(*SW_MOD());
     252           0 :     m_aFailedImg = pManager->GetImage(FN_FORMULA_CANCEL);
     253           0 :     m_aCompletedImg = pManager->GetImage(FN_FORMULA_APPLY);
     254             : 
     255           0 :     m_pStopPB->SetClickHdl(LINK(this, SwTestAccountSettingsDialog, StopHdl));
     256             : 
     257           0 :     Application::PostUserEvent( LINK( this, SwTestAccountSettingsDialog, TestHdl ), this, true );
     258           0 : }
     259             : 
     260           0 : SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog()
     261             : {
     262           0 :     disposeOnce();
     263           0 : }
     264             : 
     265           0 : void SwTestAccountSettingsDialog::dispose()
     266             : {
     267           0 :     m_pErrorsED.clear();
     268           0 :     m_pStopPB.clear();
     269           0 :     m_pEstablish.clear();
     270           0 :     m_pFind.clear();
     271           0 :     m_pResult1.clear();
     272           0 :     m_pResult2.clear();
     273           0 :     m_pImage1.clear();
     274           0 :     m_pImage2.clear();
     275           0 :     m_pParent.clear();
     276           0 :     SfxModalDialog::dispose();
     277           0 : }
     278             : 
     279           0 : IMPL_LINK_NOARG(SwTestAccountSettingsDialog, StopHdl)
     280             : {
     281           0 :     m_bStop = true;
     282           0 :     return 0;
     283             : }
     284             : 
     285           0 : IMPL_LINK_NOARG(SwTestAccountSettingsDialog, TestHdl)
     286             : {
     287           0 :     EnterWait();
     288           0 :     Test();
     289           0 :     LeaveWait();
     290           0 :     return 0;
     291             : }
     292             : 
     293           0 : void SwTestAccountSettingsDialog::Test()
     294             : {
     295           0 :     uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
     296             : 
     297           0 :     OUString sException;
     298             : 
     299           0 :     bool bIsLoggedIn = false;
     300           0 :     bool bIsServer = false;
     301             :     try
     302             :     {
     303           0 :         uno::Reference< mail::XMailService > xInMailService;
     304             :         uno::Reference< mail::XMailServiceProvider > xMailServiceProvider(
     305           0 :             mail::MailServiceProvider::create(xContext) );
     306             :         uno::Reference< mail::XMailService > xMailService =
     307           0 :                 xMailServiceProvider->create(
     308           0 :                 mail::MailServiceType_SMTP);
     309           0 :         if(m_bStop)
     310           0 :             return;
     311           0 :         uno::Reference<XConnectionListener> xConnectionListener(new SwConnectionListener());
     312             : 
     313           0 :         if(m_pParent->m_pConfigItem->IsAuthentication() &&
     314           0 :                 m_pParent->m_pConfigItem->IsSMTPAfterPOP())
     315             :         {
     316           0 :             xInMailService = xMailServiceProvider->create(
     317           0 :                     m_pParent->m_pConfigItem->IsInServerPOP() ?
     318           0 :                         mail::MailServiceType_POP3 : mail::MailServiceType_IMAP);
     319           0 :             if(m_bStop)
     320           0 :                 return;
     321             :             //authenticate at the POP or IMAP server first
     322             :             uno::Reference<XAuthenticator> xAuthenticator =
     323             :                 new SwAuthenticator(
     324           0 :                     m_pParent->m_pConfigItem->GetInServerUserName(),
     325           0 :                     m_pParent->m_pConfigItem->GetInServerPassword(),
     326           0 :                     this);
     327             : 
     328           0 :             xInMailService->addConnectionListener(xConnectionListener);
     329             :             //check connection
     330             :             uno::Reference< uno::XCurrentContext> xConnectionContext =
     331             :                     new SwConnectionContext(
     332           0 :                         m_pParent->m_pConfigItem->GetInServerName(),
     333           0 :                         m_pParent->m_pConfigItem->GetInServerPort(),
     334           0 :                         OUString("Insecure"));
     335           0 :             xInMailService->connect(xConnectionContext, xAuthenticator);
     336             :         }
     337           0 :         if(m_bStop)
     338           0 :             return;
     339           0 :         uno::Reference<XAuthenticator> xAuthenticator;
     340           0 :         if(m_pParent->m_pConfigItem->IsAuthentication() &&
     341           0 :                 !m_pParent->m_pConfigItem->IsSMTPAfterPOP() &&
     342           0 :                 !m_pParent->m_pConfigItem->GetMailUserName().isEmpty())
     343           0 :             xAuthenticator =
     344             :                 new SwAuthenticator(
     345           0 :                     m_pParent->m_pConfigItem->GetMailUserName(),
     346           0 :                     m_pParent->m_pConfigItem->GetMailPassword(),
     347           0 :                     this);
     348             :         else
     349           0 :             xAuthenticator =  new SwAuthenticator();
     350             : 
     351           0 :         xMailService->addConnectionListener(xConnectionListener);
     352           0 :         if(m_bStop)
     353           0 :             return;
     354             :         //just to check if the server exists
     355           0 :         xMailService->getSupportedConnectionTypes();
     356           0 :         if(m_bStop)
     357           0 :             return;
     358           0 :         bIsServer = true;
     359             :         //check connection
     360             :         uno::Reference< uno::XCurrentContext> xConnectionContext =
     361             :                 new SwConnectionContext(
     362           0 :                     m_pParent->m_pServerED->GetText(),
     363           0 :                     sal::static_int_cast< sal_Int16, sal_Int64 >(m_pParent->m_pPortNF->GetValue()),
     364           0 :                     m_pParent->m_pSecureCB->IsChecked() ? OUString("Ssl") : OUString("Insecure"));
     365           0 :         xMailService->connect(xConnectionContext, xAuthenticator);
     366           0 :         bIsLoggedIn = xMailService->isConnected();
     367           0 :         if( xInMailService.is() )
     368           0 :             xInMailService->disconnect();
     369           0 :         if( xMailService->isConnected())
     370           0 :             xMailService->disconnect();
     371             :     }
     372           0 :     catch (const uno::Exception& e)
     373             :     {
     374           0 :         sException = e.Message;
     375             :     }
     376             : 
     377           0 :     m_pResult1->SetText(bIsServer ? m_sCompleted : m_sFailed);
     378           0 :     m_pImage1->SetImage(bIsServer ? m_aCompletedImg : m_aFailedImg);
     379             : 
     380           0 :     m_pResult2->SetText(bIsLoggedIn ? m_sCompleted : m_sFailed);
     381           0 :     m_pImage2->SetImage(bIsLoggedIn ? m_aCompletedImg : m_aFailedImg);
     382             : 
     383           0 :     if (!bIsServer || !bIsLoggedIn)
     384             :     {
     385           0 :         OUStringBuffer aErrorMessage(m_sErrorServer);
     386           0 :         if (!sException.isEmpty())
     387           0 :             aErrorMessage.append("\n--\n").append(sException);
     388           0 :         m_pErrorsED->SetText(aErrorMessage.makeStringAndClear());
     389           0 :     }
     390             : }
     391             : 
     392           0 : SwMailConfigDlg::SwMailConfigDlg(vcl::Window* pParent, SfxItemSet& rSet)
     393           0 :     : SfxSingleTabDialog(pParent, rSet)
     394             : {
     395             :     // create TabPage
     396           0 :     SetTabPage(SwMailConfigPage::Create(get_content_area(), &rSet));
     397           0 : }
     398             : 
     399           0 : SwAuthenticationSettingsDialog::SwAuthenticationSettingsDialog(
     400             :     SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem)
     401             :     : SfxModalDialog(pParent, "AuthenticationSettingsDialog", "modules/swriter/ui/authenticationsettingsdialog.ui")
     402           0 :     , rConfigItem( rItem )
     403             : {
     404           0 :     get(m_pAuthenticationCB,"authentication");
     405           0 :     get(m_pSeparateAuthenticationRB,"separateauthentication");
     406           0 :     get(m_pSMTPAfterPOPRB,"smtpafterpop");
     407           0 :     get(m_pOutgoingServerFT,"label1");
     408           0 :     get(m_pUserNameFT,"username_label");
     409           0 :     get(m_pUserNameED,"username");
     410           0 :     get(m_pOutPasswordFT,"outpassword_label");
     411           0 :     get(m_pOutPasswordED,"outpassword");
     412           0 :     get(m_pIncomingServerFT,"label2");
     413           0 :     get(m_pServerFT,"server_label");
     414           0 :     get(m_pServerED,"server");
     415           0 :     get(m_pPortFT,"port_label");
     416           0 :     get(m_pPortNF,"port");
     417           0 :     get(m_pProtocolFT,"label3");
     418           0 :     get(m_pPOP3RB,"pop3");
     419           0 :     get(m_pIMAPRB,"imap");
     420           0 :     get(m_pInUsernameFT,"inusername_label");
     421           0 :     get(m_pInUsernameED,"inusername");
     422           0 :     get(m_pInPasswordFT,"inpassword_label");
     423           0 :     get(m_pInPasswordED,"inpassword");
     424             : 
     425           0 :     get(m_pOKPB,"ok");
     426             : 
     427           0 :     m_pAuthenticationCB->SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, CheckBoxHdl_Impl));
     428           0 :     Link<> aRBLink = LINK( this, SwAuthenticationSettingsDialog, RadioButtonHdl_Impl );
     429           0 :     m_pSeparateAuthenticationRB->SetClickHdl( aRBLink );
     430           0 :     m_pSMTPAfterPOPRB->SetClickHdl( aRBLink );
     431           0 :     m_pOKPB->SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, OKHdl_Impl));
     432             : 
     433           0 :     m_pAuthenticationCB->Check( rConfigItem.IsAuthentication() );
     434           0 :     if(rConfigItem.IsSMTPAfterPOP())
     435           0 :         m_pSMTPAfterPOPRB->Check();
     436             :     else
     437           0 :         m_pSeparateAuthenticationRB->Check();
     438           0 :     m_pUserNameED->SetText( rConfigItem.GetMailUserName() );
     439           0 :     m_pOutPasswordED->SetText( rConfigItem.GetMailPassword() );
     440             : 
     441           0 :     m_pServerED->SetText( rConfigItem.GetInServerName() );
     442           0 :     m_pPortNF->SetValue( rConfigItem.GetInServerPort() );
     443           0 :     if(rConfigItem.IsInServerPOP())
     444           0 :         m_pPOP3RB->Check();
     445             :     else
     446           0 :         m_pIMAPRB->Check();
     447           0 :     m_pInUsernameED->SetText( rConfigItem.GetInServerUserName());
     448           0 :     m_pInPasswordED->SetText( rConfigItem.GetInServerPassword() );
     449             : 
     450           0 :     CheckBoxHdl_Impl( m_pAuthenticationCB );
     451           0 : }
     452             : 
     453           0 : SwAuthenticationSettingsDialog::~SwAuthenticationSettingsDialog()
     454             : {
     455           0 :     disposeOnce();
     456           0 : }
     457             : 
     458           0 : void SwAuthenticationSettingsDialog::dispose()
     459             : {
     460           0 :     m_pAuthenticationCB.clear();
     461           0 :     m_pSeparateAuthenticationRB.clear();
     462           0 :     m_pSMTPAfterPOPRB.clear();
     463           0 :     m_pOutgoingServerFT.clear();
     464           0 :     m_pUserNameFT.clear();
     465           0 :     m_pUserNameED.clear();
     466           0 :     m_pOutPasswordFT.clear();
     467           0 :     m_pOutPasswordED.clear();
     468           0 :     m_pIncomingServerFT.clear();
     469           0 :     m_pServerFT.clear();
     470           0 :     m_pServerED.clear();
     471           0 :     m_pPortFT.clear();
     472           0 :     m_pPortNF.clear();
     473           0 :     m_pProtocolFT.clear();
     474           0 :     m_pPOP3RB.clear();
     475           0 :     m_pIMAPRB.clear();
     476           0 :     m_pInUsernameFT.clear();
     477           0 :     m_pInUsernameED.clear();
     478           0 :     m_pInPasswordFT.clear();
     479           0 :     m_pInPasswordED.clear();
     480           0 :     m_pOKPB.clear();
     481           0 :     SfxModalDialog::dispose();
     482           0 : }
     483             : 
     484           0 : IMPL_LINK_NOARG(SwAuthenticationSettingsDialog, OKHdl_Impl)
     485             : {
     486           0 :     rConfigItem.SetAuthentication( m_pAuthenticationCB->IsChecked() );
     487           0 :     rConfigItem.SetSMTPAfterPOP(m_pSMTPAfterPOPRB->IsChecked());
     488           0 :     rConfigItem.SetMailUserName(m_pUserNameED->GetText());
     489           0 :     rConfigItem.SetMailPassword(m_pOutPasswordED->GetText());
     490           0 :     rConfigItem.SetInServerName(m_pServerED->GetText());
     491           0 :     rConfigItem.SetInServerPort(sal::static_int_cast< sal_Int16, sal_Int64 >(m_pPortNF->GetValue( ) ));
     492           0 :     rConfigItem.SetInServerPOP(m_pPOP3RB->IsChecked());
     493           0 :     rConfigItem.SetInServerUserName(m_pInUsernameED->GetText());
     494             : 
     495           0 :     rConfigItem.SetInServerPassword(m_pInPasswordED->GetText());
     496           0 :     EndDialog(RET_OK);
     497           0 :     return 0;
     498             : }
     499             : 
     500           0 : IMPL_LINK( SwAuthenticationSettingsDialog, CheckBoxHdl_Impl, CheckBox*, pBox)
     501             : {
     502           0 :     bool bChecked = pBox->IsChecked();
     503           0 :     m_pSeparateAuthenticationRB->Enable(bChecked);
     504           0 :     m_pSMTPAfterPOPRB->Enable(bChecked);
     505           0 :     RadioButtonHdl_Impl( 0 );
     506             : 
     507           0 :     return 0;
     508             : }
     509             : 
     510           0 : IMPL_LINK_NOARG(SwAuthenticationSettingsDialog, RadioButtonHdl_Impl)
     511             : {
     512           0 :     bool bSeparate = m_pSeparateAuthenticationRB->IsChecked();
     513           0 :     bool bIsEnabled = m_pSeparateAuthenticationRB->IsEnabled();
     514           0 :     bool bNotSeparate = !bSeparate && bIsEnabled;
     515           0 :     bSeparate &= bIsEnabled;
     516             : 
     517           0 :     m_pOutgoingServerFT->Enable(bSeparate);
     518           0 :     m_pUserNameFT->Enable(bSeparate);
     519           0 :     m_pUserNameED->Enable(bSeparate);
     520           0 :     m_pOutPasswordFT->Enable(bSeparate);
     521           0 :     m_pOutPasswordED->Enable(bSeparate);
     522             : 
     523           0 :     m_pIncomingServerFT->Enable(bNotSeparate);
     524           0 :     m_pServerFT->Enable(bNotSeparate);
     525           0 :     m_pServerED->Enable(bNotSeparate);
     526           0 :     m_pPortFT->Enable(bNotSeparate);
     527           0 :     m_pPortNF->Enable(bNotSeparate);
     528           0 :     m_pInUsernameFT->Enable(bNotSeparate);
     529           0 :     m_pInUsernameED->Enable(bNotSeparate);
     530           0 :     m_pProtocolFT->Enable(bNotSeparate);
     531           0 :     m_pPOP3RB->Enable(bNotSeparate);
     532           0 :     m_pIMAPRB->Enable(bNotSeparate);
     533           0 :     m_pInPasswordFT->Enable(bNotSeparate);
     534           0 :     m_pInPasswordED->Enable(bNotSeparate);
     535             : 
     536           0 :     return 0;
     537           0 : }
     538             : 
     539             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11