23void QgsDataItemGuiProviderUtils::deleteConnectionsPrivate(
const QStringList &connectionNames,
const std::function<
void(
const QString & )> &deleteConnection, QPointer<QgsDataItem> firstParent )
25 if ( connectionNames.size() > 1 )
27 if ( QMessageBox::question(
nullptr, QObject::tr(
"Remove Connections" ), QObject::tr(
"Are you sure you want to remove all %1 selected connections?" ).arg( connectionNames.size() ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
32 if ( QMessageBox::question(
nullptr, QObject::tr(
"Remove Connection" ), QObject::tr(
"Are you sure you want to remove the connection to “%1”?" ).arg( connectionNames.at( 0 ) ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
36 for (
const QString &connectionName : std::as_const( connectionNames ) )
38 deleteConnection( connectionName );
42 firstParent->refreshConnections();
48 QString newConnectionName( name );
49 while ( connectionNames.contains( newConnectionName ) )
52 newConnectionName = QObject::tr(
"%1 (copy %2)" ).arg( name ).arg( i );
55 return newConnectionName;
static const QString uniqueName(const QString &name, const QStringList &connectionNames)
Check if connection with name exists in connectionNames list and then try to append a number to it to...