18 #include "ui_qgsauthmethodplugins.h"
23 #include <QTableWidget>
39 mAuthNotifyLayout =
new QVBoxLayout;
40 this->setLayout( mAuthNotifyLayout );
42 mAuthNotifyLayout->addWidget( mAuthNotify );
47 connect( buttonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
54 void QgsAuthMethodPlugins::setupTable()
56 tblAuthPlugins->setColumnCount( 3 );
57 tblAuthPlugins->verticalHeader()->hide();
58 tblAuthPlugins->horizontalHeader()->setVisible(
true );
59 tblAuthPlugins->setHorizontalHeaderItem( 0,
new QTableWidgetItem( tr(
"Method" ) ) );
60 tblAuthPlugins->setHorizontalHeaderItem( 1,
new QTableWidgetItem( tr(
"Description" ) ) );
61 tblAuthPlugins->setHorizontalHeaderItem( 2,
new QTableWidgetItem( tr(
"Works with" ) ) );
62 tblAuthPlugins->horizontalHeader()->setStretchLastSection(
true );
63 tblAuthPlugins->setAlternatingRowColors(
true );
64 tblAuthPlugins->setColumnWidth( 0, 150 );
65 tblAuthPlugins->setColumnWidth( 1, 300 );
67 tblAuthPlugins->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
68 tblAuthPlugins->setSortingEnabled(
true );
69 tblAuthPlugins->setSelectionBehavior( QAbstractItemView::SelectRows );
72 void QgsAuthMethodPlugins::populateTable()
77 for ( QgsAuthMethodsMap::const_iterator it = authmethods.constBegin(); it != authmethods.constEnd(); ++it, i++ )
85 QTableWidgetItem *twi =
new QTableWidgetItem( authmethod->key() );
86 twi->setFlags( twi->flags() & ~Qt::ItemIsEditable );
87 tblAuthPlugins->setItem( i, 0, twi );
89 twi =
new QTableWidgetItem( authmethod->displayDescription() );
90 twi->setFlags( twi->flags() & ~Qt::ItemIsEditable );
91 tblAuthPlugins->setItem( i, 1, twi );
93 twi =
new QTableWidgetItem( authmethod->supportedDataProviders().join( QStringLiteral(
", " ) ) );
94 twi->setFlags( twi->flags() & ~Qt::ItemIsEditable );
95 tblAuthPlugins->setItem( i, 2, twi );
97 tblAuthPlugins->sortItems( 0 );
107 connect( btnCertManager, &QPushButton::clicked,
this, &QgsAuthEditorWidgets::btnCertManager_clicked );
108 connect( btnAuthPlugins, &QPushButton::clicked,
this, &QgsAuthEditorWidgets::btnAuthPlugins_clicked );
111 wdgtConfigEditor->setRelayMessages(
false );
112 wdgtConfigEditor->setShowUtilitiesButton(
false );
113 setupUtilitiesMenu();
117 grpbxManagers->setEnabled(
false );
121 void QgsAuthEditorWidgets::btnCertManager_clicked()
124 dlg->setWindowModality( Qt::ApplicationModal );
125 dlg->resize( 750, 500 );
130 void QgsAuthEditorWidgets::btnAuthPlugins_clicked()
133 dlg->setWindowModality( Qt::WindowModal );
134 dlg->resize( 675, 500 );
139 void QgsAuthEditorWidgets::setupUtilitiesMenu()
142 this, &QgsAuthEditorWidgets::authMessageOut );
145 mActionSetMasterPassword =
new QAction( tr(
"Input master password" ),
this );
146 mActionClearCachedMasterPassword =
new QAction( tr(
"Clear cached master password" ),
this );
147 mActionResetMasterPassword =
new QAction( tr(
"Reset master password" ),
this );
148 mActionClearCachedAuthConfigs =
new QAction( tr(
"Clear cached authentication configurations" ),
this );
149 mActionRemoveAuthConfigs =
new QAction( tr(
"Remove all authentication configurations" ),
this );
150 mActionEraseAuthDatabase =
new QAction( tr(
"Erase authentication database" ),
this );
152 mActionClearAccessCacheNow =
new QAction( tr(
"Clear network authentication access cache" ),
this );
153 mActionAutoClearAccessCache =
new QAction( tr(
"Automatically clear network authentication access cache on SSL errors" ),
this );
154 mActionAutoClearAccessCache->setCheckable(
true );
155 mActionAutoClearAccessCache->setChecked(
QgsSettings().value( QStringLiteral(
"clear_auth_cache_on_errors" ),
true, QgsSettings::Section::Auth ).toBool( ) );
157 mActionPasswordHelperSync =
new QAction( tr(
"Store/update the master password in your %1" )
159 mActionPasswordHelperDelete =
new QAction( tr(
"Clear the master password from your %1" )
161 mActionPasswordHelperEnable =
new QAction( tr(
"Integrate master password with your %1" )
163 mActionPasswordHelperLoggingEnable =
new QAction( tr(
"Enable password helper debug log" ),
this );
165 mActionPasswordHelperEnable->setCheckable(
true );
168 mActionPasswordHelperLoggingEnable->setCheckable(
true );
171 connect( mActionSetMasterPassword, &QAction::triggered,
this, &QgsAuthEditorWidgets::setMasterPassword );
172 connect( mActionClearCachedMasterPassword, &QAction::triggered,
this, &QgsAuthEditorWidgets::clearCachedMasterPassword );
173 connect( mActionResetMasterPassword, &QAction::triggered,
this, &QgsAuthEditorWidgets::resetMasterPassword );
174 connect( mActionClearCachedAuthConfigs, &QAction::triggered,
this, &QgsAuthEditorWidgets::clearCachedAuthenticationConfigs );
175 connect( mActionRemoveAuthConfigs, &QAction::triggered,
this, &QgsAuthEditorWidgets::removeAuthenticationConfigs );
176 connect( mActionEraseAuthDatabase, &QAction::triggered,
this, &QgsAuthEditorWidgets::eraseAuthenticationDatabase );
178 connect( mActionPasswordHelperSync, &QAction::triggered,
this, &QgsAuthEditorWidgets::passwordHelperSync );
179 connect( mActionPasswordHelperDelete, &QAction::triggered,
this, &QgsAuthEditorWidgets::passwordHelperDelete );
180 connect( mActionPasswordHelperEnable, &QAction::triggered,
this, &QgsAuthEditorWidgets::passwordHelperEnableTriggered );
181 connect( mActionPasswordHelperLoggingEnable, &QAction::triggered,
this, &QgsAuthEditorWidgets::passwordHelperLoggingEnableTriggered );
183 connect( mActionClearAccessCacheNow, &QAction::triggered,
this, [ = ]
186 messageBar()->
pushSuccess( tr(
"Auth cache cleared" ), tr(
"Network authentication cache has been cleared" ) );
188 connect( mActionAutoClearAccessCache, &QAction::triggered,
this, [ ](
bool checked )
190 QgsSettings().
setValue( QStringLiteral(
"clear_auth_cache_on_errors" ), checked, QgsSettings::Section::Auth );
193 mAuthUtilitiesMenu =
new QMenu(
this );
194 mAuthUtilitiesMenu->addAction( mActionSetMasterPassword );
195 mAuthUtilitiesMenu->addAction( mActionClearCachedMasterPassword );
196 mAuthUtilitiesMenu->addAction( mActionResetMasterPassword );
197 mAuthUtilitiesMenu->addSeparator();
198 mAuthUtilitiesMenu->addAction( mActionClearAccessCacheNow );
199 mAuthUtilitiesMenu->addAction( mActionAutoClearAccessCache );
200 mAuthUtilitiesMenu->addSeparator();
201 mAuthUtilitiesMenu->addAction( mActionPasswordHelperEnable );
202 mAuthUtilitiesMenu->addAction( mActionPasswordHelperSync );
203 mAuthUtilitiesMenu->addAction( mActionPasswordHelperDelete );
204 mAuthUtilitiesMenu->addAction( mActionPasswordHelperLoggingEnable );
205 mAuthUtilitiesMenu->addSeparator();
206 mAuthUtilitiesMenu->addAction( mActionClearCachedAuthConfigs );
207 mAuthUtilitiesMenu->addAction( mActionRemoveAuthConfigs );
208 mAuthUtilitiesMenu->addSeparator();
209 mAuthUtilitiesMenu->addAction( mActionEraseAuthDatabase );
211 btnAuthUtilities->setMenu( mAuthUtilitiesMenu );
214 void QgsAuthEditorWidgets::setMasterPassword()
219 void QgsAuthEditorWidgets::clearCachedMasterPassword()
224 void QgsAuthEditorWidgets::resetMasterPassword()
229 void QgsAuthEditorWidgets::clearCachedAuthenticationConfigs()
234 void QgsAuthEditorWidgets::removeAuthenticationConfigs()
239 void QgsAuthEditorWidgets::eraseAuthenticationDatabase()
246 int levelint =
static_cast<int>( level );
250 void QgsAuthEditorWidgets::passwordHelperDelete()
255 void QgsAuthEditorWidgets::passwordHelperSync()
260 void QgsAuthEditorWidgets::passwordHelperEnableTriggered()
266 void QgsAuthEditorWidgets::passwordHelperLoggingEnableTriggered()
276 int QgsAuthEditorWidgets::messageTimeout()
279 return settings.
value( QStringLiteral(
"qgis/messageTimeout" ), 5 ).toInt();