Skip to content

Commit 74f08c5

Browse files
committed
[Plugin Manager] Prevent from removing the official repository
1 parent 3400211 commit 74f08c5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/pyplugin_installer/installer.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,15 @@ def deleteRepository(self, reposName):
485485
""" delete repository connection """
486486
if not reposName:
487487
return
488+
settings = QSettings()
489+
settings.beginGroup(reposGroup)
490+
if settings.value(reposName+"/url", "", type=unicode) == officialRepo[1]:
491+
QMessageBox.warning(iface.mainWindow(), self.tr("QGIS Python Plugin Installer"), self.tr("You can't remove the official QGIS Plugin Repository. You can disable it if needed."))
492+
return
488493
warning = self.tr("Are you sure you want to remove the following repository?") + "\n" + reposName
489494
if QMessageBox.warning(iface.mainWindow(), self.tr("QGIS Python Plugin Installer"), warning , QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
490495
return
491496
# delete from the settings, refresh data and repopulate all the widgets
492-
settings = QSettings()
493-
settings.beginGroup(reposGroup)
494497
settings.remove(reposName)
495498
repositories.remove(reposName)
496499
plugins.removeRepository(reposName)

0 commit comments

Comments
 (0)