Update ooo320-m1
[ooovba.git] / sw / source / ui / config / mailconfigpage.cxx
blobfd8d7969b68e9d625f33a3f72ce72939429eb9c7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mailconfigpage.cxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
35 #endif
38 #include <swtypes.hxx>
39 #include <mailconfigpage.hxx>
40 #include <svtools/svmedit.hxx>
41 #include <svtools/stdctrl.hxx>
42 #include <svtools/svtabbx.hxx>
43 #include <svtools/headbar.hxx>
44 #include <mmconfigitem.hxx>
45 #include <mailmergehelper.hxx>
46 #ifndef _CMDID_H
47 #include <cmdid.h>
48 #endif
49 #include <vcl/svapp.hxx>
50 #include <comphelper/processfactory.hxx>
51 #include "com/sun/star/mail/MailServiceType.hpp"
52 #include "com/sun/star/mail/XMailService.hpp"
53 #include "com/sun/star/mail/MailServiceProvider.hpp"
54 #include <vcl/msgbox.hxx>
55 #include <globals.hrc>
56 #include <mailconfigpage.hrc>
57 #include <config.hrc>
58 #include <helpid.h>
60 using namespace ::com::sun::star;
61 using namespace ::com::sun::star::lang;
62 using namespace ::com::sun::star::mail;
63 using namespace ::com::sun::star::beans;
64 using ::rtl::OUString;
65 /*-- 06.05.2004 12:04:11---------------------------------------------------
67 -----------------------------------------------------------------------*/
68 class SwTestAccountSettingsDialog : public SfxModalDialog
70 FixedInfo m_aInfoFI;
72 HeaderBar m_aStatusHB;
73 SvTabListBox m_aStatusLB;
75 FixedInfo m_aErrorFI;
76 MultiLineEdit m_eErrorsED;
78 FixedLine m_aSeparatorFL;
79 PushButton m_aStopPB;
80 CancelButton m_aCancelPB;
81 HelpButton m_aHelpPB;
83 ImageList m_aImageList;
85 String m_sTask ;
86 String m_sStatus ;
87 String m_sEstablish ;
88 String m_sFindServer ;
89 String m_sCompleted ;
90 String m_sFailed ;
91 String m_sErrorNetwork;
92 String m_sErrorServer ;
94 SwMailConfigPage* m_pParent;
96 bool m_bStop;
98 void Test();
99 DECL_LINK(StopHdl, PushButton*);
100 DECL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*);
101 public:
102 SwTestAccountSettingsDialog(SwMailConfigPage* pParent);
103 ~SwTestAccountSettingsDialog();
105 /*-- 19.08.2004 14:27:33---------------------------------------------------
107 -----------------------------------------------------------------------*/
108 class SwAuthenticationSettingsDialog : public SfxModalDialog
110 CheckBox m_aAuthenticationCB;
112 RadioButton m_aSeparateAuthenticationRB;
113 RadioButton m_aSMTPAfterPOPRB;
115 FixedInfo m_aOutgoingServerFT;
116 FixedText m_aUserNameFT;
117 Edit m_aUserNameED;
118 FixedText m_aOutPasswordFT;
119 Edit m_aOutPasswordED;
121 FixedInfo m_aIncomingServerFT;
122 FixedText m_aServerFT;
123 Edit m_aServerED;
124 FixedText m_aPortFT;
125 NumericField m_aPortNF;
126 FixedText m_aProtocolFT;
127 RadioButton m_aPOP3RB;
128 RadioButton m_aIMAPRB;
129 FixedText m_aInUsernameFT;
130 Edit m_aInUsernameED;
131 FixedText m_aInPasswordFT;
132 Edit m_aInPasswordED;
134 FixedLine m_aSeparatorFL;
136 OKButton m_aOKPB;
137 CancelButton m_aCancelPB;
138 HelpButton m_aHelpPB;
140 SwMailMergeConfigItem& rConfigItem;
142 DECL_LINK( OKHdl_Impl, OKButton*);
143 DECL_LINK( CheckBoxHdl_Impl, CheckBox*);
144 DECL_LINK( RadioButtonHdl_Impl, RadioButton*);
147 public:
148 SwAuthenticationSettingsDialog(SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem);
149 ~SwAuthenticationSettingsDialog();
152 /*-- 06.05.2004 10:59:40---------------------------------------------------
154 -----------------------------------------------------------------------*/
155 SwMailConfigPage::SwMailConfigPage( Window* pParent, const SfxItemSet& rSet ) :
156 SfxTabPage(pParent, SW_RES(TP_MAILCONFIG), rSet),
157 #ifdef MSC
158 #pragma warning (disable : 4355)
159 #endif
160 m_aIdentityFL( this, SW_RES( FL_IDENTITY)),
161 m_aDisplayNameFT( this, SW_RES( FT_DISPLAYNAME)),
162 m_aDisplayNameED( this, SW_RES( ED_DISPLAYNAME)),
163 m_aAddressFT( this, SW_RES( FT_ADDRESS)),
164 m_aAddressED( this, SW_RES( ED_ADDRESS)),
165 m_aReplyToCB( this, SW_RES( CB_REPLYTO)),
166 m_aReplyToFT( this, SW_RES( FT_REPLYTO)),
167 m_aReplyToED( this, SW_RES( ED_REPLYTO)),
168 m_aSMTPFL( this, SW_RES( FL_SMTP)),
169 m_aServerFT( this, SW_RES( FT_SERVER)),
170 m_aServerED( this, SW_RES( ED_SERVER)),
171 m_aPortFT( this, SW_RES( FT_PORT)),
172 m_aPortNF( this, SW_RES( NF_PORT)),
173 m_aSecureCB( this, SW_RES( CB_SECURE)),
174 m_aServerAuthenticationPB( this, SW_RES( PB_AUTHENTICATION )),
175 m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )),
176 m_aTestPB( this, SW_RES( PB_TEST)),
177 #ifdef MSC
178 #pragma warning (default : 4355)
179 #endif
180 m_pConfigItem( new SwMailMergeConfigItem )
182 FreeResource();
183 m_aReplyToCB.SetClickHdl(LINK(this, SwMailConfigPage, ReplyToHdl));
184 m_aServerAuthenticationPB.SetClickHdl(LINK(this, SwMailConfigPage, AuthenticationHdl));
185 m_aTestPB.SetClickHdl(LINK(this, SwMailConfigPage, TestHdl));
187 /*-- 06.05.2004 10:59:40---------------------------------------------------
189 -----------------------------------------------------------------------*/
190 SwMailConfigPage::~SwMailConfigPage()
192 delete m_pConfigItem;
194 /*-- 06.05.2004 10:59:40---------------------------------------------------
196 -----------------------------------------------------------------------*/
197 SfxTabPage* SwMailConfigPage::Create( Window* pParent, const SfxItemSet& rAttrSet)
199 return new SwMailConfigPage(pParent, rAttrSet);
201 /*-- 06.05.2004 10:59:41---------------------------------------------------
203 -----------------------------------------------------------------------*/
204 BOOL SwMailConfigPage::FillItemSet( SfxItemSet& /*rSet*/ )
206 if(m_aDisplayNameED.GetText() != m_aDisplayNameED.GetSavedValue())
207 m_pConfigItem->SetMailDisplayName(m_aDisplayNameED.GetText());
208 if(m_aAddressED.GetText() != m_aAddressED.GetSavedValue())
209 m_pConfigItem->SetMailAddress(m_aAddressED.GetText());
210 String sReplyTo;
211 if( m_aReplyToCB.GetSavedValue() != m_aReplyToCB.IsChecked())
212 m_pConfigItem->SetMailReplyTo(m_aReplyToCB.IsChecked());
213 if(m_aReplyToED.GetText() != m_aReplyToED.GetSavedValue())
214 m_pConfigItem->SetMailReplyTo(m_aReplyToED.GetText());
215 if(m_aServerED.GetText() != m_aServerED.GetSavedValue())
216 m_pConfigItem->SetMailServer(m_aServerED.GetText());
218 if(m_aPortNF.IsModified())
219 m_pConfigItem->SetMailPort((sal_Int16)m_aPortNF.GetValue());
221 m_pConfigItem->SetSecureConnection(m_aSecureCB.IsChecked());
223 m_pConfigItem->Commit();
224 return sal_True;
226 /*-- 06.05.2004 10:59:41---------------------------------------------------
228 -----------------------------------------------------------------------*/
229 void SwMailConfigPage::Reset( const SfxItemSet& /*rSet*/ )
231 m_aDisplayNameED.SetText(m_pConfigItem->GetMailDisplayName());
232 m_aAddressED.SetText(m_pConfigItem->GetMailAddress());
234 m_aReplyToED.SetText(m_pConfigItem->GetMailReplyTo()) ;
235 m_aReplyToCB.Check(m_pConfigItem->IsMailReplyTo());
236 m_aReplyToCB.GetClickHdl().Call(&m_aReplyToCB);
238 m_aServerED.SetText(m_pConfigItem->GetMailServer());
239 m_aPortNF.SetValue(m_pConfigItem->GetMailPort());
241 m_aSecureCB.Check(m_pConfigItem->IsSecureConnection());
243 m_aDisplayNameED.SaveValue();
244 m_aAddressED .SaveValue();
245 m_aReplyToCB .SaveValue();
246 m_aReplyToED .SaveValue();
247 m_aServerED .SaveValue();
248 m_aPortNF .SaveValue();
249 m_aSecureCB .SaveValue();
251 /*-- 06.05.2004 10:59:41---------------------------------------------------
253 -----------------------------------------------------------------------*/
254 IMPL_LINK(SwMailConfigPage, ReplyToHdl, CheckBox*, pBox)
256 sal_Bool bEnable = pBox->IsChecked();
257 m_aReplyToFT.Enable(bEnable);
258 m_aReplyToED.Enable(bEnable);
259 return 0;
261 /*-- 06.05.2004 10:59:41---------------------------------------------------
263 -----------------------------------------------------------------------*/
264 IMPL_LINK(SwMailConfigPage, AuthenticationHdl, PushButton*, EMPTYARG)
266 SwAuthenticationSettingsDialog aDlg(this, *m_pConfigItem);
267 aDlg.Execute();
268 return 0;
270 /*-- 06.05.2004 10:59:42---------------------------------------------------
272 -----------------------------------------------------------------------*/
273 IMPL_LINK(SwMailConfigPage, TestHdl, PushButton*, EMPTYARG)
275 SwTestAccountSettingsDialog(this).Execute();
276 return 0;
278 /*-- 06.05.2004 12:11:13---------------------------------------------------
280 -----------------------------------------------------------------------*/
281 SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pParent) :
282 SfxModalDialog(pParent, SW_RES(DLG_MM_TESTACCOUNTSETTINGS)),
283 #ifdef MSC
284 #pragma warning (disable : 4355)
285 #endif
286 m_aInfoFI( this, SW_RES( FI_INFO )),
287 m_aStatusHB( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
288 m_aStatusLB( this, SW_RES( LB_STATUS )),
289 m_aErrorFI( this, SW_RES( FI_ERROR )),
290 m_eErrorsED( this, SW_RES( ED_ERROR )),
291 m_aSeparatorFL( this, SW_RES( FL_SEPAPARATOR )),
292 m_aStopPB( this, SW_RES( PB_STOP )),
293 m_aCancelPB( this, SW_RES( PB_CANCEL )),
294 m_aHelpPB( this, SW_RES( PB_HELP )),
295 #ifdef MSC
296 #pragma warning (default : 4355)
297 #endif
298 m_aImageList( SW_RES( GetSettings().GetStyleSettings().GetWindowColor().IsDark() ? ILIST_HC : ILIST) ),
299 m_sTask( SW_RES( ST_TASK )),
300 m_sStatus( SW_RES( ST_STATUS )),
301 m_sEstablish( SW_RES( ST_ESTABLISH )),
302 m_sFindServer( SW_RES( ST_FINDSERVER )),
303 m_sCompleted( SW_RES( ST_COMPLETED )),
304 m_sFailed( SW_RES( ST_FAILED )),
305 m_sErrorServer( SW_RES( ST_ERROR_SERVER )),
306 m_pParent(pParent),
307 m_bStop(false)
309 FreeResource();
310 m_aStopPB.SetClickHdl(LINK(this, SwTestAccountSettingsDialog, StopHdl));
312 Size aLBSize(m_aStatusLB.GetOutputSizePixel());
313 m_aStatusHB.SetSizePixel(aLBSize);
314 Size aHeadSize(m_aStatusHB.CalcWindowSizePixel());
315 aHeadSize.Width() = aLBSize.Width();
316 m_aStatusHB.SetSizePixel(aHeadSize);
317 Point aLBPos(m_aStatusLB.GetPosPixel());
318 m_aStatusHB.SetPosPixel(aLBPos);
319 aLBPos.Y() += aHeadSize.Height();
320 aLBSize.Height() -= aHeadSize.Height();
321 m_aStatusLB.SetPosSizePixel(aLBPos, aLBSize);
323 Size aSz(m_aStatusHB.GetOutputSizePixel());
324 m_aStatusHB.InsertItem( 1, m_sTask,
325 aSz.Width()/2,
326 HIB_LEFT | HIB_VCENTER );
327 m_aStatusHB.InsertItem( 2, m_sStatus,
328 aSz.Width()/2,
329 HIB_LEFT | HIB_VCENTER );
331 m_aStatusHB.SetHelpId(HID_MM_TESTACCOUNTSETTINGS_HB );
332 m_aStatusHB.Show();
334 m_aStatusLB.SetHelpId(HID_MM_TESTACCOUNTSETTINGS_TLB);
335 static long nTabs[] = {2, 0, aSz.Width()/2 };
336 m_aStatusLB.SetWindowBits( WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP );
337 m_aStatusLB.SetSelectionMode( SINGLE_SELECTION );
338 m_aStatusLB.SetTabs(&nTabs[0], MAP_PIXEL);
339 short nEntryHeight = m_aStatusLB.GetEntryHeight();
340 m_aStatusLB.SetEntryHeight( nEntryHeight * 15 / 10 );
342 Application::PostUserEvent( STATIC_LINK( this, SwTestAccountSettingsDialog, TestHdl ), this );
344 /*-- 06.05.2004 12:11:13---------------------------------------------------
346 -----------------------------------------------------------------------*/
347 SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog()
350 /*-- 06.05.2004 12:15:43---------------------------------------------------
352 -----------------------------------------------------------------------*/
353 IMPL_LINK(SwTestAccountSettingsDialog, StopHdl, PushButton*, EMPTYARG)
355 m_bStop = true;
356 return 0;
358 /*-- 07.06.2004 12:44:50---------------------------------------------------
360 -----------------------------------------------------------------------*/
361 IMPL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*, EMPTYARG)
363 pThis->EnterWait();
364 pThis->Test();
365 pThis->LeaveWait();
366 return 0;
368 /*-- 07.06.2004 12:45:45---------------------------------------------------
370 -----------------------------------------------------------------------*/
371 void SwTestAccountSettingsDialog::Test()
373 uno::Reference<XMultiServiceFactory> rMgr = ::comphelper::getProcessServiceFactory();
375 bool bIsLoggedIn = false;
376 bool bIsServer = false;
377 if (rMgr.is())
381 uno::Reference< mail::XMailService > xInMailService;
382 uno::Reference< mail::XMailServiceProvider > xMailServiceProvider =
383 mail::MailServiceProvider::create(getCurrentCmpCtx(rMgr));
384 uno::Reference< mail::XMailService > xMailService =
385 xMailServiceProvider->create(
386 mail::MailServiceType_SMTP);
387 if(m_bStop)
388 return;
389 uno::Reference<XConnectionListener> xConnectionListener(new SwConnectionListener());
391 if(m_pParent->m_pConfigItem->IsAuthentication() &&
392 m_pParent->m_pConfigItem->IsSMTPAfterPOP())
394 xInMailService = xMailServiceProvider->create(
395 m_pParent->m_pConfigItem->IsInServerPOP() ?
396 mail::MailServiceType_POP3 : mail::MailServiceType_IMAP);
397 if(m_bStop)
398 return;
399 //authenticate at the POP or IMAP server first
400 uno::Reference<XAuthenticator> xAuthenticator =
401 new SwAuthenticator(
402 m_pParent->m_pConfigItem->GetInServerUserName(),
403 m_pParent->m_pConfigItem->GetInServerPassword(),
404 this);
406 xInMailService->addConnectionListener(xConnectionListener);
407 //check connection
408 uno::Reference< uno::XCurrentContext> xConnectionContext =
409 new SwConnectionContext(
410 m_pParent->m_pConfigItem->GetInServerName(),
411 m_pParent->m_pConfigItem->GetInServerPort(),
412 ::rtl::OUString::createFromAscii( "Insecure" ));
413 xInMailService->connect(xConnectionContext, xAuthenticator);
415 if(m_bStop)
416 return;
417 uno::Reference<XAuthenticator> xAuthenticator;
418 if(m_pParent->m_pConfigItem->IsAuthentication() &&
419 !m_pParent->m_pConfigItem->IsSMTPAfterPOP() &&
420 m_pParent->m_pConfigItem->GetMailUserName().getLength())
421 xAuthenticator =
422 new SwAuthenticator(
423 m_pParent->m_pConfigItem->GetMailUserName(),
424 m_pParent->m_pConfigItem->GetMailPassword(),
425 this);
426 else
427 xAuthenticator = new SwAuthenticator();
429 xMailService->addConnectionListener(xConnectionListener);
430 if(m_bStop)
431 return;
432 //just to check if the server exists
433 xMailService->getSupportedConnectionTypes();
434 if(m_bStop)
435 return;
436 bIsServer = true;
437 //check connection
438 uno::Reference< uno::XCurrentContext> xConnectionContext =
439 new SwConnectionContext(
440 m_pParent->m_aServerED.GetText(),
441 sal::static_int_cast< sal_Int16, sal_Int64 >(m_pParent->m_aPortNF.GetValue()),
442 ::rtl::OUString::createFromAscii(
443 m_pParent->m_aSecureCB.IsChecked() ? "Ssl" : "Insecure"));
444 xMailService->connect(xConnectionContext, xAuthenticator);
445 bIsLoggedIn = xMailService->isConnected();
446 if( xInMailService.is() )
447 xInMailService->disconnect();
448 if( xMailService->isConnected())
449 xMailService->disconnect();
451 catch(uno::Exception&)
453 DBG_ERROR("exception caught");
457 Image aFailedImg = m_aImageList.GetImage( FN_FORMULA_CANCEL );
458 Image aCompletedImg = m_aImageList.GetImage( FN_FORMULA_APPLY );
460 String sTmp(m_sEstablish);
461 sTmp += '\t';
462 sTmp += bIsServer ? m_sCompleted : m_sFailed;
463 m_aStatusLB.InsertEntry(sTmp,
464 bIsServer ? aCompletedImg : aFailedImg,
465 bIsServer ? aCompletedImg : aFailedImg);
467 sTmp = m_sFindServer;
468 sTmp += '\t';
469 sTmp += bIsLoggedIn ? m_sCompleted : m_sFailed;
470 m_aStatusLB.InsertEntry(sTmp,
471 bIsLoggedIn ? aCompletedImg : aFailedImg,
472 bIsLoggedIn ? aCompletedImg : aFailedImg);
474 if(!bIsServer || !bIsLoggedIn )
476 m_eErrorsED.SetText( m_sErrorServer );
479 /*-- 18.08.2004 12:18:38---------------------------------------------------
481 -----------------------------------------------------------------------*/
482 SwMailConfigDlg::SwMailConfigDlg(Window* pParent, SfxItemSet& rSet ) :
483 SfxSingleTabDialog(pParent, rSet, 0)
485 // TabPage erzeugen
486 SetTabPage(SwMailConfigPage::Create( this, rSet ));
488 /*-- 18.08.2004 12:18:38---------------------------------------------------
490 -----------------------------------------------------------------------*/
491 SwMailConfigDlg::~SwMailConfigDlg()
494 /*-- 19.08.2004 14:33:58---------------------------------------------------
496 -----------------------------------------------------------------------*/
497 SwAuthenticationSettingsDialog::SwAuthenticationSettingsDialog(
498 SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem) :
499 SfxModalDialog(pParent, SW_RES(DLG_MM_SERVERAUTHENTICATION)),
500 #ifdef MSC
501 #pragma warning (disable : 4355)
502 #endif
503 m_aAuthenticationCB( this, SW_RES( CB_AUTHENTICATION )),
504 m_aSeparateAuthenticationRB( this, SW_RES( RB_SEP_AUTHENTICATION )),
505 m_aSMTPAfterPOPRB( this, SW_RES( RB_SMPTAFTERPOP )),
506 m_aOutgoingServerFT( this, SW_RES( FT_OUTGOINGSERVER )),
507 m_aUserNameFT( this, SW_RES( FT_USERNAME )),
508 m_aUserNameED( this, SW_RES( ED_USERNAME )),
509 m_aOutPasswordFT( this, SW_RES( FT_OUTPASSWORD )),
510 m_aOutPasswordED( this, SW_RES( ED_OUTPASSWORD )),
511 m_aIncomingServerFT( this, SW_RES( FT_INCOMINGSERVER )),
512 m_aServerFT( this, SW_RES( FT_SERVER )),
513 m_aServerED( this, SW_RES( ED_SERVER )),
514 m_aPortFT( this, SW_RES( FT_PORT )),
515 m_aPortNF( this, SW_RES( NF_PORT )),
516 m_aProtocolFT( this, SW_RES( FT_PROTOCOL )),
517 m_aPOP3RB( this, SW_RES( RB_POP3 )),
518 m_aIMAPRB( this, SW_RES( RB_IMAP )),
519 m_aInUsernameFT( this, SW_RES( FT_INUSERNAME )),
520 m_aInUsernameED( this, SW_RES( ED_INUSERNAME )),
521 m_aInPasswordFT( this, SW_RES( FT_INPASSWORD )),
522 m_aInPasswordED( this, SW_RES( ED_INPASSWORD )),
523 m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )),
524 m_aOKPB( this, SW_RES( PB_OK )),
525 m_aCancelPB( this, SW_RES( PB_CANCEL )),
526 m_aHelpPB( this, SW_RES( PB_HELP )),
527 #ifdef MSC
528 #pragma warning (default : 4355)
529 #endif
530 rConfigItem( rItem )
532 FreeResource();
534 m_aAuthenticationCB.SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, CheckBoxHdl_Impl));
535 Link aRBLink = LINK( this, SwAuthenticationSettingsDialog, RadioButtonHdl_Impl );
536 m_aSeparateAuthenticationRB.SetClickHdl( aRBLink );
537 m_aSMTPAfterPOPRB.SetClickHdl( aRBLink );
538 m_aOKPB.SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, OKHdl_Impl));
540 m_aAuthenticationCB.Check( rConfigItem.IsAuthentication() );
541 if(rConfigItem.IsSMTPAfterPOP())
542 m_aSMTPAfterPOPRB.Check();
543 else
544 m_aSeparateAuthenticationRB.Check();
545 m_aUserNameED.SetText( rConfigItem.GetMailUserName() );
546 m_aOutPasswordED.SetText( rConfigItem.GetMailPassword() );
548 m_aServerED.SetText( rConfigItem.GetInServerName() );
549 m_aPortNF.SetValue( rConfigItem.GetInServerPort() );
550 if(rConfigItem.IsInServerPOP())
551 m_aPOP3RB.Check();
552 else
553 m_aIMAPRB.Check();
554 m_aInUsernameED.SetText( rConfigItem.GetInServerUserName());
555 m_aInPasswordED.SetText( rConfigItem.GetInServerPassword() );
557 CheckBoxHdl_Impl( &m_aAuthenticationCB );
559 /*-- 19.08.2004 14:33:58---------------------------------------------------
561 -----------------------------------------------------------------------*/
562 SwAuthenticationSettingsDialog::~SwAuthenticationSettingsDialog()
565 /*-- 19.08.2004 14:33:59---------------------------------------------------
567 -----------------------------------------------------------------------*/
568 IMPL_LINK( SwAuthenticationSettingsDialog, OKHdl_Impl, OKButton*, EMPTYARG)
570 rConfigItem.SetAuthentication( m_aAuthenticationCB.IsChecked() );
571 rConfigItem.SetSMTPAfterPOP(m_aSMTPAfterPOPRB.IsChecked());
572 rConfigItem.SetMailUserName(m_aUserNameED.GetText());
573 rConfigItem.SetMailPassword(m_aOutPasswordED.GetText());
574 rConfigItem.SetInServerName(m_aServerED.GetText());
575 rConfigItem.SetInServerPort(sal::static_int_cast< sal_Int16, sal_Int64 >(m_aPortNF.GetValue( ) ));
576 rConfigItem.SetInServerPOP(m_aPOP3RB.IsChecked());
577 rConfigItem.SetInServerUserName(m_aInUsernameED.GetText());
579 rConfigItem.SetInServerPassword(m_aInPasswordED.GetText());
580 EndDialog(RET_OK);
581 return 0;
583 /*-- 19.08.2004 14:33:59---------------------------------------------------
585 -----------------------------------------------------------------------*/
586 IMPL_LINK( SwAuthenticationSettingsDialog, CheckBoxHdl_Impl, CheckBox*, pBox)
588 sal_Bool bChecked = pBox->IsChecked();
589 m_aSeparateAuthenticationRB.Enable(bChecked);
590 m_aSMTPAfterPOPRB.Enable(bChecked);
591 RadioButtonHdl_Impl( 0 );
593 return 0;
595 /*-- 19.08.2004 14:33:59---------------------------------------------------
597 -----------------------------------------------------------------------*/
598 IMPL_LINK( SwAuthenticationSettingsDialog, RadioButtonHdl_Impl, RadioButton*, EMPTYARG)
600 sal_Bool bSeparate = m_aSeparateAuthenticationRB.IsChecked();
601 sal_Bool bIsEnabled = m_aSeparateAuthenticationRB.IsEnabled();
602 sal_Bool bNotSeparate = !bSeparate & bIsEnabled;
603 bSeparate &= bIsEnabled;
605 m_aOutgoingServerFT.Enable(bSeparate);
606 m_aUserNameFT.Enable(bSeparate);
607 m_aUserNameED.Enable(bSeparate);
608 m_aOutPasswordFT.Enable(bSeparate);
609 m_aOutPasswordED.Enable(bSeparate);
611 m_aIncomingServerFT.Enable(bNotSeparate);
612 m_aServerFT.Enable(bNotSeparate);
613 m_aServerED.Enable(bNotSeparate);
614 m_aPortFT.Enable(bNotSeparate);
615 m_aPortNF.Enable(bNotSeparate);
616 m_aInUsernameFT.Enable(bNotSeparate);
617 m_aInUsernameED.Enable(bNotSeparate);
618 m_aProtocolFT.Enable(bNotSeparate);
619 m_aPOP3RB.Enable(bNotSeparate);
620 m_aIMAPRB.Enable(bNotSeparate);
621 m_aInPasswordFT.Enable(bNotSeparate);
622 m_aInPasswordED.Enable(bNotSeparate);
624 return 0;