Use correct object
[LibreOffice.git] / cui / source / options / optgenrl.cxx
blobacecb3de9a3a5d77433d4088343661d3b39d66fb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <comphelper/diagnose_ex.hxx>
21 #include <comphelper/string.hxx>
22 #include <comphelper/processfactory.hxx>
24 #include <config_gpgme.h>
25 #if HAVE_FEATURE_GPGME
26 # include <com/sun/star/xml/crypto/GPGSEInitializer.hpp>
27 # include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
28 #endif
29 #include <com/sun/star/xml/crypto/SEInitializer.hpp>
30 #include <comphelper/xmlsechelper.hxx>
31 #include <com/sun/star/security/DocumentDigitalSignatures.hpp>
33 #include <i18nlangtag/languagetag.hxx>
34 #include <i18nlangtag/mslangid.hxx>
35 #include <o3tl/safeint.hxx>
36 #include <vcl/svapp.hxx>
37 #include <svl/intitem.hxx>
38 #include <vcl/settings.hxx>
40 #include <officecfg/Office/Common.hxx>
41 #include <unotools/useroptions.hxx>
42 #include <cuioptgenrl.hxx>
43 #include <svx/svxids.hrc>
44 #include <svx/optgenrl.hxx>
46 using namespace css;
48 namespace
51 // rows
52 enum RowType
54 Row_Company,
55 Row_Name,
56 Row_Name_Russian,
57 Row_Name_Eastern,
58 Row_Street,
59 Row_Street_Russian,
60 Row_City,
61 Row_City_US,
62 Row_Country,
63 Row_TitlePos,
64 Row_Phone,
65 Row_FaxMail,
67 nRowCount
70 // language flags
71 namespace Lang
73 unsigned const Others = 1;
74 unsigned const Russian = 2;
75 unsigned const Eastern = 4;
76 unsigned const US = 8;
77 unsigned const All = static_cast<unsigned>(-1);
81 // vRowInfo[] -- rows (text + one or more edit boxes)
82 // The order is the same as in RowType above, which is up to down.
84 struct
86 // id of the lockimage
87 OUString pLockId;
88 // id of the text
89 OUString pTextId;
90 // language flags (see Lang above):
91 // which language is this row for?
92 unsigned nLangFlags;
94 const vRowInfo[] =
96 { u"lockcompanyft"_ustr, u"companyft"_ustr, Lang::All },
97 { u"locknameft"_ustr, u"nameft"_ustr, Lang::All & ~Lang::Russian & ~Lang::Eastern },
98 { u"lockrusnameft"_ustr, u"rusnameft"_ustr, Lang::Russian },
99 { u"lockeastnameft"_ustr, u"eastnameft"_ustr, Lang::Eastern },
100 { u"lockstreetft"_ustr, u"streetft"_ustr, Lang::All & ~Lang::Russian },
101 { u"lockrusstreetft"_ustr,u"russtreetft"_ustr, Lang::Russian },
102 { u"lockicityft"_ustr, u"icityft"_ustr, Lang::All & ~Lang::US },
103 { u"lockcityft"_ustr, u"cityft"_ustr, Lang::US },
104 { u"lockcountryft"_ustr, u"countryft"_ustr, Lang::All },
105 { u"locktitleft"_ustr, u"titleft"_ustr, Lang::All },
106 { u"lockphoneft"_ustr, u"phoneft"_ustr, Lang::All },
107 { u"lockfaxft"_ustr, u"faxft"_ustr, Lang::All },
111 // vFieldInfo[] -- edit boxes
112 // The order is up to down, and then left to right.
114 struct
116 // in which row?
117 RowType eRow;
118 // id of the edit box
119 OUString pEditId;
120 // id for SvtUserOptions in unotools/useroptions.hxx
121 UserOptToken nUserOptionsId;
122 // id for settings the focus (defined in svx/optgenrl.hxx)
123 EditPosition nGrabFocusId;
125 const vFieldInfo[] =
127 // Company
128 { Row_Company, u"company"_ustr, UserOptToken::Company, EditPosition::COMPANY },
129 // Name
130 { Row_Name, u"firstname"_ustr, UserOptToken::FirstName, EditPosition::FIRSTNAME },
131 { Row_Name, u"lastname"_ustr, UserOptToken::LastName, EditPosition::LASTNAME },
132 { Row_Name, u"shortname"_ustr, UserOptToken::ID, EditPosition::SHORTNAME },
133 // Name (russian)
134 { Row_Name_Russian, u"ruslastname"_ustr, UserOptToken::LastName, EditPosition::LASTNAME },
135 { Row_Name_Russian, u"rusfirstname"_ustr, UserOptToken::FirstName, EditPosition::FIRSTNAME },
136 { Row_Name_Russian, u"rusfathersname"_ustr, UserOptToken::FathersName, EditPosition::UNKNOWN },
137 { Row_Name_Russian, u"russhortname"_ustr, UserOptToken::ID, EditPosition::SHORTNAME },
138 // Name (eastern: reversed name ord
139 { Row_Name_Eastern, u"eastlastname"_ustr, UserOptToken::LastName, EditPosition::LASTNAME },
140 { Row_Name_Eastern, u"eastfirstname"_ustr, UserOptToken::FirstName, EditPosition::FIRSTNAME },
141 { Row_Name_Eastern, u"eastshortname"_ustr, UserOptToken::ID, EditPosition::SHORTNAME },
142 // Street
143 { Row_Street, u"street"_ustr, UserOptToken::Street, EditPosition::STREET },
144 // Street (russian)
145 { Row_Street_Russian, u"russtreet"_ustr, UserOptToken::Street, EditPosition::STREET },
146 { Row_Street_Russian, u"apartnum"_ustr, UserOptToken::Apartment, EditPosition::UNKNOWN },
147 // City
148 { Row_City, u"izip"_ustr, UserOptToken::Zip, EditPosition::PLZ },
149 { Row_City, u"icity"_ustr, UserOptToken::City, EditPosition::CITY },
150 // City (US)
151 { Row_City_US, u"city"_ustr, UserOptToken::City, EditPosition::CITY },
152 { Row_City_US, u"state"_ustr, UserOptToken::State, EditPosition::STATE },
153 { Row_City_US, u"zip"_ustr, UserOptToken::Zip, EditPosition::PLZ },
154 // Country
155 { Row_Country, u"country"_ustr, UserOptToken::Country, EditPosition::COUNTRY },
156 // Title/Position
157 { Row_TitlePos, u"title"_ustr, UserOptToken::Title, EditPosition::TITLE },
158 { Row_TitlePos, u"position"_ustr, UserOptToken::Position, EditPosition::POSITION },
159 // Phone
160 { Row_Phone, u"home"_ustr, UserOptToken::TelephoneHome, EditPosition::TELPRIV },
161 { Row_Phone, u"work"_ustr, UserOptToken::TelephoneWork, EditPosition::TELCOMPANY },
162 // Fax/Mail
163 { Row_FaxMail, u"fax"_ustr, UserOptToken::Fax, EditPosition::FAX },
164 { Row_FaxMail, u"email"_ustr, UserOptToken::Email, EditPosition::EMAIL },
168 } // namespace
171 // Row
173 struct SvxGeneralTabPage::Row
175 // row lockdown icon
176 std::unique_ptr<weld::Widget> xLockImg;
177 // row label
178 std::unique_ptr<weld::Label> xLabel;
179 // first and last field in the row (last is exclusive)
180 unsigned nFirstField, nLastField;
182 public:
183 explicit Row (std::unique_ptr<weld::Widget> xLockImg_, std::unique_ptr<weld::Label> xLabel_)
184 : xLockImg(std::move(xLockImg_))
185 , xLabel(std::move(xLabel_))
186 , nFirstField(0)
187 , nLastField(0)
189 xLabel->show();
194 // Field
196 struct SvxGeneralTabPage::Field
198 // which field is this? (in vFieldInfo[] above)
199 unsigned iField;
200 // edit box
201 std::unique_ptr<weld::Entry> xEdit;
202 std::unique_ptr<weld::Container> xParent;
204 public:
205 Field (std::unique_ptr<weld::Entry> xEdit_, unsigned iField_)
206 : iField(iField_)
207 , xEdit(std::move(xEdit_))
208 , xParent(xEdit->weld_parent())
210 //We want all widgets inside a container, so each row of the toplevel
211 //grid has another container in it. To avoid adding spacing to these
212 //empty grids they all default to invisible, so show them if their
213 //children are visible
214 xParent->show();
215 xEdit->show();
219 SvxGeneralTabPage::SvxGeneralTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreSet)
220 : SfxTabPage(pPage, pController, u"cui/ui/optuserpage.ui"_ustr, u"OptUserPage"_ustr, &rCoreSet)
221 , m_xUseDataCB(m_xBuilder->weld_check_button(u"usefordocprop"_ustr))
222 , m_xUseDataImg(m_xBuilder->weld_widget(u"lockusefordocprop"_ustr))
223 , m_xCryptoFrame(m_xBuilder->weld_widget( u"cryptography"_ustr))
224 , m_xSigningKeyLB(m_xBuilder->weld_entry(u"signingkey"_ustr))
225 , m_xSigningKeyFT(m_xBuilder->weld_label(u"signingkeylabel"_ustr))
226 , m_xSigningKeyImg(m_xBuilder->weld_widget(u"locksigningkey"_ustr))
227 , m_xSigningKeyButton(m_xBuilder->weld_button(u"picksigningkey"_ustr))
228 , m_xRemoveSigningKeyButton(m_xBuilder->weld_button(u"removesigningkey"_ustr))
229 , m_xEncryptionKeyLB(m_xBuilder->weld_entry(u"encryptionkey"_ustr))
230 , m_xEncryptionKeyFT(m_xBuilder->weld_label(u"encryptionkeylabel"_ustr))
231 , m_xEncryptionKeyImg(m_xBuilder->weld_widget(u"lockencryptionkey"_ustr))
232 , m_xEncryptionKeyButton(m_xBuilder->weld_button(u"pickencryptionkey"_ustr))
233 , m_xRemoveEncryptionKeyButton(m_xBuilder->weld_button(u"removeencryptionkey"_ustr))
234 , m_xEncryptToSelfCB(m_xBuilder->weld_check_button(u"encrypttoself"_ustr))
235 , m_xEncryptToSelfImg(m_xBuilder->weld_widget(u"lockencrypttoself"_ustr))
237 InitControls();
238 #if HAVE_FEATURE_GPGME
239 InitCryptography();
240 #else
241 m_xCryptoFrame->hide();
242 #endif
244 SetExchangeSupport(); // this page needs ExchangeSupport
245 SetLinks();
248 SvxGeneralTabPage::~SvxGeneralTabPage()
252 // Initializes the titles and the edit boxes,
253 // according to vRowInfo[] and vFieldInfo[] above.
254 void SvxGeneralTabPage::InitControls ()
256 // which language bit do we use? (see Lang and vRowInfo[] above)
257 unsigned LangBit;
258 LanguageType l = Application::GetSettings().GetUILanguageTag().getLanguageType();
259 if (l == LANGUAGE_ENGLISH_US)
260 LangBit = Lang::US;
261 else if (l == LANGUAGE_RUSSIAN)
262 LangBit = Lang::Russian;
263 else
265 if (MsLangId::isFamilyNameFirst(l))
266 LangBit = Lang::Eastern;
267 else
268 LangBit = Lang::Others;
271 // creating rows
272 unsigned iField = 0;
273 for (unsigned iRow = 0; iRow != nRowCount; ++iRow)
275 RowType const eRow = static_cast<RowType>(iRow);
276 // is the row visible?
277 if (!(vRowInfo[iRow].nLangFlags & LangBit))
278 continue;
279 // creating row
280 vRows.push_back(std::make_shared<Row>(m_xBuilder->weld_widget(vRowInfo[iRow].pLockId),
281 m_xBuilder->weld_label(vRowInfo[iRow].pTextId)));
282 Row& rRow = *vRows.back();
283 // fields in the row
284 static unsigned const nFieldCount = std::size(vFieldInfo);
285 // skipping other (invisible) rows
286 while (iField != nFieldCount && vFieldInfo[iField].eRow != eRow)
287 ++iField;
288 // fields in the row
289 rRow.nFirstField = vFields.size();
290 for ( ; iField != nFieldCount && vFieldInfo[iField].eRow == eRow; ++iField)
292 // creating edit field
293 vFields.push_back(std::make_shared<Field>(
294 m_xBuilder->weld_entry(vFieldInfo[iField].pEditId), iField));
295 // "short name" field?
296 if (vFieldInfo[iField].nUserOptionsId == UserOptToken::ID)
298 nNameRow = vRows.size() - 1;
299 nShortNameField = vFields.size() - 1;
302 rRow.nLastField = vFields.size();
306 void SvxGeneralTabPage::InitCryptography()
308 #if HAVE_FEATURE_GPGME
309 m_xCryptoFrame->show();
310 m_xSigningKeyButton->connect_clicked(LINK(this, SvxGeneralTabPage, ChooseKeyButtonHdl));
311 m_xEncryptionKeyButton->connect_clicked(LINK(this, SvxGeneralTabPage, ChooseKeyButtonHdl));
313 m_xRemoveSigningKeyButton->connect_clicked(LINK(this, SvxGeneralTabPage, RemoveKeyButtonHdl));
314 m_xRemoveEncryptionKeyButton->connect_clicked(LINK(this, SvxGeneralTabPage, RemoveKeyButtonHdl));
315 #endif
319 IMPL_LINK(SvxGeneralTabPage, ChooseKeyButtonHdl, weld::Button&, rButton, void)
323 uno::Reference<security::XDocumentDigitalSignatures> xD(
324 security::DocumentDigitalSignatures::createDefault(
325 comphelper::getProcessComponentContext()));
326 xD->setParentWindow(GetDialogController()->getDialog()->GetXWindow());
328 OUString aDescription;
330 uno::Reference<security::XCertificate> xCertificate;
331 if (m_xSigningKeyButton.get() == &rButton)
333 xCertificate = xD->selectSigningCertificate(aDescription);
335 else if (m_xEncryptionKeyButton.get() == &rButton)
337 auto xCerts = xD->chooseEncryptionCertificate(css::security::CertificateKind_OPENPGP);
338 if(xCerts.hasElements())
339 xCertificate = xCerts[0];
342 if(!xCertificate.is())
343 return;
345 OUString aKeyThumbprint
346 = comphelper::xmlsec::GetHexString(xCertificate->getSHA1Thumbprint(), "");
347 OUString aIssuer = comphelper::xmlsec::GetContentPart(xCertificate->getIssuerName(),
348 xCertificate->getCertificateKind());
349 OUString aSubject = comphelper::xmlsec::GetContentPart(xCertificate->getSubjectName(),
350 xCertificate->getCertificateKind());
351 OUString aKeyDisplayName;
352 switch (xCertificate->getCertificateKind())
354 case security::CertificateKind::CertificateKind_X509:
355 aKeyDisplayName = u"(X.509) "_ustr + aIssuer + u" "_ustr + aSubject;
356 break;
357 case security::CertificateKind::CertificateKind_OPENPGP:
358 aKeyDisplayName = u"(OpenPGP) "_ustr + aIssuer;
359 break;
360 default:
361 break;
364 if (m_xSigningKeyButton.get() == &rButton)
366 msCurrentSigningKey = aKeyThumbprint;
367 m_xSigningKeyLB->set_text(aKeyDisplayName);
369 else if (m_xEncryptionKeyButton.get() == &rButton)
371 msCurrentEncryptionKey = aKeyThumbprint;
372 m_xEncryptionKeyLB->set_text(aKeyDisplayName);
375 catch (const css::uno::Exception&)
377 TOOLS_WARN_EXCEPTION("cui.options", "" );
381 IMPL_LINK(SvxGeneralTabPage, RemoveKeyButtonHdl, weld::Button&, rButton, void)
383 if (m_xRemoveSigningKeyButton.get() == &rButton)
385 msCurrentSigningKey.clear();
386 m_xSigningKeyLB->set_text(u""_ustr);
388 else if (m_xRemoveEncryptionKeyButton.get() == &rButton)
390 msCurrentEncryptionKey.clear();
391 m_xEncryptionKeyLB->set_text(u""_ustr);
395 void SvxGeneralTabPage::SetLinks ()
397 // link for updating the initials
398 Link<weld::Entry&,void> aLink = LINK( this, SvxGeneralTabPage, ModifyHdl_Impl );
399 Row& rNameRow = *vRows[nNameRow];
400 for (unsigned i = rNameRow.nFirstField; i != rNameRow.nLastField - 1; ++i)
401 vFields[i]->xEdit->connect_changed(aLink);
405 std::unique_ptr<SfxTabPage> SvxGeneralTabPage::Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet )
407 return std::make_unique<SvxGeneralTabPage>( pPage, pController, *rAttrSet );
410 OUString SvxGeneralTabPage::GetAllStrings()
412 OUString sAllStrings;
413 OUString labels[]
414 = { u"label1"_ustr, u"companyft"_ustr, u"nameft"_ustr, u"rusnameft"_ustr,
415 u"eastnameft"_ustr, u"streetft"_ustr, u"russtreetft"_ustr, u"icityft"_ustr,
416 u"cityft"_ustr, u"countryft"_ustr, u"titleft"_ustr, u"phoneft"_ustr,
417 u"faxft"_ustr, u"cryptographylabel"_ustr, u"signingkeylabel"_ustr, u"encryptionkeylabel"_ustr };
419 for (const auto& label : labels)
421 if (const auto pString = m_xBuilder->weld_label(label))
422 sAllStrings += pString->get_label() + " ";
425 sAllStrings += m_xUseDataCB->get_label() + " " + m_xEncryptToSelfCB->get_label() + " ";
427 return sAllStrings.replaceAll("_", "");
430 bool SvxGeneralTabPage::FillItemSet( SfxItemSet* )
432 // remove leading and trailing whitespaces
433 for (auto const & i: vFields)
434 i->xEdit->set_text(comphelper::string::strip(i->xEdit->get_text(), ' '));
436 bool bModified = false;
437 bModified |= GetData_Impl();
438 if (m_xUseDataCB->get_active() != officecfg::Office::Common::Save::Document::UseUserData::get())
440 auto xChanges = comphelper::ConfigurationChanges::create();
441 officecfg::Office::Common::Save::Document::UseUserData::set(m_xUseDataCB->get_active(), xChanges);
442 xChanges->commit();
443 bModified = true;
445 return bModified;
448 void SvxGeneralTabPage::Reset( const SfxItemSet* rSet )
450 SetData_Impl();
452 if (rSet->GetItemState(SID_FIELD_GRABFOCUS) == SfxItemState::SET)
454 EditPosition nField = static_cast<EditPosition>(rSet->Get(SID_FIELD_GRABFOCUS).GetValue());
455 if (nField != EditPosition::UNKNOWN)
457 for (auto const & i: vFields)
458 if (nField == vFieldInfo[i->iField].nGrabFocusId)
459 i->xEdit->grab_focus();
461 else
462 vFields.front()->xEdit->grab_focus();
465 m_xUseDataCB->set_active(officecfg::Office::Common::Save::Document::UseUserData::get());
469 // ModifyHdl_Impl()
470 // This handler updates the initials (short name)
471 // when one of the name fields was updated.
472 IMPL_LINK( SvxGeneralTabPage, ModifyHdl_Impl, weld::Entry&, rEdit, void )
474 // short name field and row
475 Field& rShortName = *vFields[nShortNameField];
476 Row& rNameRow = *vRows[nNameRow];
477 // number of initials
478 unsigned const nInits = rNameRow.nLastField - rNameRow.nFirstField - 1;
479 // which field was updated? (in rNameRow)
480 unsigned nField = nInits;
481 for (unsigned i = 0; i != nInits; ++i)
483 if (vFields[rNameRow.nFirstField + i]->xEdit.get() == &rEdit)
484 nField = i;
486 // updating the initial
487 if (!(nField < nInits && rShortName.xEdit->get_sensitive()))
488 return;
490 OUString sShortName = rShortName.xEdit->get_text();
491 // clear short name if it contains more characters than the number of initials
492 if (o3tl::make_unsigned(sShortName.getLength()) > nInits)
494 rShortName.xEdit->set_text(OUString());
496 while (o3tl::make_unsigned(sShortName.getLength()) < nInits)
497 sShortName += " ";
498 OUString sName = rEdit.get_text();
499 OUString sLetter = sName.isEmpty()
500 ? OUString(u' ') : sName.copy(0, 1);
501 rShortName.xEdit->set_text(sShortName.replaceAt(nField, 1, sLetter).trim());
505 bool SvxGeneralTabPage::GetData_Impl()
507 // updating
508 SvtUserOptions aUserOpt;
509 for (auto const & i: vFields)
510 aUserOpt.SetToken(
511 vFieldInfo[i->iField].nUserOptionsId,
512 i->xEdit->get_text()
515 // modified?
516 bool bModified = false;
517 for (auto const & i: vFields)
519 if (i->xEdit->get_value_changed_from_saved())
521 bModified = true;
522 break;
526 #if HAVE_FEATURE_GPGME
527 aUserOpt.SetToken( UserOptToken::SigningKey, msCurrentSigningKey );
528 aUserOpt.SetToken( UserOptToken::SigningKeyDisplayName, m_xSigningKeyLB->get_text() );
529 aUserOpt.SetToken( UserOptToken::EncryptionKey, msCurrentEncryptionKey );
530 aUserOpt.SetToken( UserOptToken::EncryptionKeyDisplayName, m_xEncryptionKeyLB->get_text() );
531 aUserOpt.SetBoolValue( UserOptToken::EncryptToSelf, m_xEncryptToSelfCB->get_active() );
533 bModified |= m_xSigningKeyLB->get_value_changed_from_saved() ||
534 m_xEncryptionKeyLB->get_value_changed_from_saved() ||
535 m_xEncryptToSelfCB->get_state_changed_from_saved();
536 #endif
538 return bModified;
542 void SvxGeneralTabPage::SetData_Impl()
544 // updating and disabling edit boxes
545 SvtUserOptions aUserOpt;
546 for (auto const & i: vRows)
548 Row& rRow = *i;
549 // the label is enabled if any of its edit fields are enabled
550 bool bEnableLabel = false;
551 for (unsigned iField = rRow.nFirstField; iField != rRow.nLastField; ++iField)
553 Field& rField = *vFields[iField];
554 // updating content
555 UserOptToken const nToken = vFieldInfo[rField.iField].nUserOptionsId;
556 rField.xEdit->set_text(aUserOpt.GetToken(nToken));
557 // is enabled?
558 bool const bEnableEdit = !aUserOpt.IsTokenReadonly(nToken);
559 rField.xEdit->set_sensitive(bEnableEdit);
560 bEnableLabel = bEnableLabel || bEnableEdit;
562 rRow.xLabel->set_sensitive(bEnableLabel);
563 rRow.xLockImg->set_visible(!bEnableLabel);
566 // saving
567 for (auto const & i: vFields)
568 i->xEdit->save_value();
570 //enabling and disabling remaining fields
571 bool bEnable = !officecfg::Office::Common::Save::Document::UseUserData::isReadOnly();
572 m_xUseDataCB->set_sensitive(bEnable);
573 m_xUseDataImg->set_visible(!bEnable);
575 #if HAVE_FEATURE_GPGME
576 bEnable = !aUserOpt.IsTokenReadonly(UserOptToken::SigningKey);
577 m_xSigningKeyButton->set_sensitive(bEnable);
578 m_xSigningKeyFT->set_sensitive(bEnable);
579 m_xSigningKeyImg->set_visible(!bEnable);
581 bEnable = !aUserOpt.IsTokenReadonly(UserOptToken::EncryptionKey);
582 m_xEncryptionKeyButton->set_sensitive(bEnable);
583 m_xEncryptionKeyFT->set_sensitive(bEnable);
584 m_xEncryptionKeyImg->set_visible(!bEnable);
586 bEnable = !aUserOpt.IsTokenReadonly(UserOptToken::EncryptToSelf);
587 m_xEncryptToSelfCB->set_sensitive(bEnable);
588 m_xEncryptToSelfImg->set_visible(!bEnable);
590 msCurrentSigningKey = aUserOpt.GetToken(UserOptToken::SigningKey);
591 m_xSigningKeyLB->set_text(aUserOpt.GetToken(UserOptToken::SigningKeyDisplayName));
593 msCurrentEncryptionKey = aUserOpt.GetToken(UserOptToken::EncryptionKey);
594 m_xEncryptionKeyLB->set_text(aUserOpt.GetToken(UserOptToken::EncryptionKeyDisplayName));
596 m_xEncryptToSelfCB->set_active( aUserOpt.GetEncryptToSelf() );
597 #endif
601 DeactivateRC SvxGeneralTabPage::DeactivatePage( SfxItemSet* pSet_ )
603 if ( pSet_ )
604 FillItemSet( pSet_ );
605 return DeactivateRC::LeavePage;
608 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */