diff --git a/python/pyplugin_installer/installer.py b/python/pyplugin_installer/installer.py index e9a64bb2fc5..77d653b8e34 100644 --- a/python/pyplugin_installer/installer.py +++ b/python/pyplugin_installer/installer.py @@ -605,7 +605,7 @@ class QgsPluginInstaller(QObject): reposName = reposName + "(2)" # add to settings settings.setValue(reposName + "/url", reposURL) - settings.setValue(reposName + "/authcfg", dlg.editAuthCfg.text().strip()) + settings.setValue(reposName + "/authcfg", dlg.configId().strip()) settings.setValue( reposName + "/enabled", bool(dlg.checkBoxEnabled.checkState()) ) @@ -622,7 +622,7 @@ class QgsPluginInstaller(QObject): dlg = QgsPluginInstallerRepositoryDialog(iface.mainWindow()) dlg.editName.setText(reposName) dlg.editURL.setText(repositories.all()[reposName]["url"]) - dlg.editAuthCfg.setText(repositories.all()[reposName]["authcfg"]) + dlg.editAuthCfgWgt.setConfigId(repositories.all()[reposName]["authcfg"]) dlg.editParams.setText(repositories.urlParams()) dlg.checkBoxEnabled.setCheckState( checkState[repositories.all()[reposName]["enabled"]] @@ -658,10 +658,15 @@ class QgsPluginInstaller(QObject): if newName in repositories.all() and newName != reposName: newName = newName + "(2)" settings.setValue(newName + "/url", dlg.editURL.text().strip()) - settings.setValue(newName + "/authcfg", dlg.editAuthCfg.text().strip()) + settings.setValue(newName + "/authcfg", dlg.configId().strip()) settings.setValue(newName + "/enabled", bool(dlg.checkBoxEnabled.checkState())) - if dlg.editAuthCfg.text().strip() != repositories.all()[reposName]["authcfg"]: - repositories.all()[reposName]["authcfg"] = dlg.editAuthCfg.text().strip() + if ( + dlg.editAuthCfgWgt.configId().strip() + != repositories.all()[reposName]["authcfg"] + ): + repositories.all()[reposName][ + "authcfg" + ] = dlg.editAuthCfgWgt.configId().strip() if ( dlg.editURL.text().strip() == repositories.all()[reposName]["url"] and dlg.checkBoxEnabled.checkState() diff --git a/python/pyplugin_installer/qgsplugininstallerrepositorybase.ui b/python/pyplugin_installer/qgsplugininstallerrepositorybase.ui index 838c2e1f168..1181ac6e4f9 100644 --- a/python/pyplugin_installer/qgsplugininstallerrepositorybase.ui +++ b/python/pyplugin_installer/qgsplugininstallerrepositorybase.ui @@ -27,29 +27,16 @@ - - - - Qt::Horizontal + + + + Enter the repository URL, beginning with "http://" or "file:///" - - QSizePolicy::Fixed + + Enter the repository URL, beginning with "http://" or "file:///" - - - 351 - 23 - - - - - - - URL - - - editURL + @@ -63,36 +50,6 @@ - - - - Enter a name for the repository - - - Enter a name for the repository - - - - - - - false - - - ?qgis= - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - @@ -109,6 +66,80 @@ + + + + + + + true + + + + 0 + 0 + + + + Enable or disable the repository (disabled repositories will be omitted) + + + Enable or disable the repository (disabled repositories will be omitted) + + + + + + false + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 351 + 23 + + + + + + + + Enter a name for the repository + + + Enter a name for the repository + + + + + + + Parameters + + + editParams + + + + + + + URL + + + editURL + + + @@ -159,7 +190,6 @@ - 75 true @@ -171,51 +201,20 @@ - - + + - Parameters - - - editParams + Authentication - - - - true + + + + Qt::Horizontal - - - 0 - 0 - - - - Enable or disable the repository (disabled repositories will be omitted) - - - Enable or disable the repository (disabled repositories will be omitted) - - - - - - false - - - - - - - Enter the repository URL, beginning with "http://" or "file:///" - - - Enter the repository URL, beginning with "http://" or "file:///" - - - + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok @@ -232,55 +231,26 @@ - - + + + + false + - Authentication + ?qgis= - - - - 6 - - - - - true - - - - - - - - 16777215 - 22 - - - - Clear - - - - - - - - 16777215 - 22 - - - - Edit - - - - - + + + QgsAuthConfigSelect + QWidget +
qgsauthconfigselect.h
+ 1 +
+
editName editURL diff --git a/python/pyplugin_installer/qgsplugininstallerrepositorydialog.py b/python/pyplugin_installer/qgsplugininstallerrepositorydialog.py index 2499d859e4f..ac1fd73e13e 100644 --- a/python/pyplugin_installer/qgsplugininstallerrepositorydialog.py +++ b/python/pyplugin_installer/qgsplugininstallerrepositorydialog.py @@ -46,8 +46,6 @@ class QgsPluginInstallerRepositoryDialog( self.editURL.setText("http://") self.editName.textChanged.connect(self.textChanged) self.editURL.textChanged.connect(self.textChanged) - self.btnClearAuthCfg.clicked.connect(self.editAuthCfg.clear) - self.btnEditAuthCfg.clicked.connect(self.editAuthCfgId) self.textChanged(None) # ----------------------------------------- # @@ -55,21 +53,5 @@ class QgsPluginInstallerRepositoryDialog( enable = len(self.editName.text()) > 0 and len(self.editURL.text()) > 0 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enable) - def editAuthCfgId(self): - dlg = QDialog(self) - dlg.setWindowModality(Qt.WindowModality.WindowModal) - layout = QVBoxLayout() - selector = QgsAuthConfigSelect(self) - if self.editAuthCfg.text(): - selector.setConfigId(self.editAuthCfg.text()) - layout.addWidget(selector) - buttonBox = QDialogButtonBox( - QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Close - ) - buttonBox.accepted.connect(dlg.accept) - buttonBox.rejected.connect(dlg.reject) - layout.addWidget(buttonBox) - dlg.setLayout(layout) - if dlg.exec(): - self.editAuthCfg.setText(selector.configId()) - del dlg + def configId(self): + return self.editAuthCfgWgt.configId()