File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -1367,8 +1367,28 @@ void QgsPluginManager::mZipFileWidget_fileChanged( const QString &filePath )
1367
1367
1368
1368
void QgsPluginManager::buttonInstallFromZip_clicked ()
1369
1369
{
1370
- QgsPythonRunner::run ( QStringLiteral ( " pyplugin_installer.instance().installFromZipFile(r'%1')" ).arg ( mZipFileWidget ->filePath () ) );
1371
- mZipFileWidget ->setFilePath ( " " );
1370
+ QgsSettings settings;
1371
+ bool showInstallFromZipWarning = settings.value ( QStringLiteral ( " UI/showInstallFromZipWarning" ), true ).toBool ();
1372
+
1373
+ QMessageBox msgbox;
1374
+ if ( showInstallFromZipWarning )
1375
+ {
1376
+ msgbox.setText ( tr ( " Security warning: installing a plugin from an untrusted source can lead to data loss and/or leak. Continue?" ) );
1377
+ msgbox.setIcon ( QMessageBox::Icon::Warning );
1378
+ msgbox.addButton ( QMessageBox::Yes );
1379
+ msgbox.addButton ( QMessageBox::No );
1380
+ msgbox.setDefaultButton ( QMessageBox::No );
1381
+ QCheckBox *cb = new QCheckBox ( tr ( " Don't show this again." ) );
1382
+ msgbox.setCheckBox ( cb );
1383
+ msgbox.exec ();
1384
+ settings.setValue ( QStringLiteral ( " UI/showInstallFromZipWarning" ), !msgbox.checkBox ()->isChecked () );
1385
+ }
1386
+
1387
+ if ( !showInstallFromZipWarning || msgbox.result () == QMessageBox::Yes )
1388
+ {
1389
+ QgsPythonRunner::run ( QStringLiteral ( " pyplugin_installer.instance().installFromZipFile(r'%1')" ).arg ( mZipFileWidget ->filePath () ) );
1390
+ mZipFileWidget ->setFilePath ( " " );
1391
+ }
1372
1392
}
1373
1393
1374
1394
You can’t perform that action at this time.
0 commit comments