22#include <com/sun/star/task/InteractionHandler.hpp>
23#include <com/sun/star/task/PasswordContainer.hpp>
24#include <com/sun/star/task/UrlRecord.hpp>
25#include <com/sun/star/task/XPasswordContainer2.hpp>
38 : GenericDialogController(pParent,
"cui/ui/storedwebconnectiondialog.ui",
"StoredWebConnectionDialog")
40 , m_xRemoveBtn(m_xBuilder->weld_button(
"remove"))
41 , m_xRemoveAllBtn(m_xBuilder->weld_button(
"removeall"))
42 , m_xChangeBtn(m_xBuilder->weld_button(
"change"))
43 , m_xPasswordsLB(m_xBuilder->weld_tree_view(
"logins"))
45 std::vector<int> aWidths
47 o3tl::narrowing<int>(
m_xPasswordsLB->get_approximate_digit_width() * 50)
76 m_xPasswordsLB->set_sort_order(!m_xPasswordsLB->get_sort_order());
87 if ( xMasterPasswd->isPersistentStoringAllowed() )
94 for ( task::UrlRecord
const & urlEntry : aURLEntries )
96 for (
auto const & user : urlEntry.UserList )
108 = xMasterPasswd->getUrls(
true );
110 for ( OUString
const & url : aUrls )
118 catch( uno::Exception& )
127 int nEntry = m_xPasswordsLB->get_selected_index();
130 OUString
aURL = m_xPasswordsLB->get_text(nEntry, 0);
131 OUString aUserName = m_xPasswordsLB->get_text(nEntry, 1);
136 int nPos = m_xPasswordsLB->get_id(nEntry).toInt32();
139 xPasswdContainer->removePersistent(
aURL, aUserName );
143 xPasswdContainer->removeUrl(
aURL );
146 m_xPasswordsLB->remove(nEntry);
149 catch( uno::Exception& )
161 xPasswdContainer->removeAllPersistent();
164 = xPasswdContainer->getUrls(
true );
165 for ( OUString
const & url : aUrls )
166 xPasswdContainer->removeUrl( url );
168 m_xPasswordsLB->clear();
170 catch( uno::Exception& )
178 int nEntry = m_xPasswordsLB->get_selected_index();
181 OUString
aURL = m_xPasswordsLB->get_text(nEntry, 0);
182 OUString aUserName = m_xPasswordsLB->get_text(nEntry, 1);
185 = new ::comphelper::SimplePasswordRequest;
189 xInteractionHandler->handle( pPasswordRequest );
191 if ( pPasswordRequest->isPassword() )
193 OUString aNewPass = pPasswordRequest->getPassword();
198 xPasswdContainer->addPersistent(
199 aURL, aUserName, aPasswd, xInteractionHandler );
203 catch( uno::Exception& )
210 int nEntry = m_xPasswordsLB->get_selected_index();
213 m_xRemoveBtn->set_sensitive(
false);
214 m_xChangeBtn->set_sensitive(
false);
218 m_xRemoveBtn->set_sensitive(
true);
222 int nPos = m_xPasswordsLB->get_id(nEntry).toInt32();
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Button > m_xRemoveBtn
std::unique_ptr< weld::Button > m_xChangeBtn
virtual ~WebConnectionInfoDialog() override
std::unique_ptr< weld::TreeView > m_xPasswordsLB
std::unique_ptr< weld::Button > m_xRemoveAllBtn
WebConnectionInfoDialog(weld::Window *pParent)
#define LINK(Instance, Class, Member)
Reference< XComponentContext > getProcessComponentContext()
IMPL_LINK(ClassificationDialog, SelectClassificationHdl, weld::ComboBox &, rBox, void)
IMPL_LINK_NOARG(ClassificationDialog, OnAsyncExpandHdl, void *, void)