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,
28 QObject::tr(
"Remove Connections" ),
29 QObject::tr(
"Are you sure you want to remove all %1 selected connections?" ).arg( connectionNames.size() ),
30 QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
35 if ( QMessageBox::question(
nullptr, QObject::tr(
"Remove Connection" ),
36 QObject::tr(
"Are you sure you want to remove the connection to “%1”?" ).arg( connectionNames.at( 0 ) ),
37 QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
41 for (
const QString &connectionName : std::as_const( connectionNames ) )
43 deleteConnection( connectionName );
47 firstParent->refreshConnections();
53 QString newConnectionName( name );
54 while ( connectionNames.contains( newConnectionName ) )
57 newConnectionName = QObject::tr(
"%1 (copy %2)" ).arg( name ) .arg( i );
60 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...