Commit c15172d6 authored by Volker Krause's avatar Volker Krause
Browse files

enforce unique transport names

svn path=/trunk/KDE/kdepim/mailtransport/; revision=619867
parent f75077cd
......@@ -27,10 +27,6 @@ TransportComboBox
- handle ad-hoc transports (see identity dialog)
- keep selection on update if possible
TransportConfigDialog
---------------------
- enforce unique name
Transport
---------
- use int for port number instead of QString
......
......@@ -174,6 +174,20 @@ void TransportConfigDialog::save()
d->manager->updateSettings();
if ( d->passwordEdit )
d->transport->setPassword( d->passwordEdit->text() );
// enforce unique name
QStringList existingNames;
foreach ( Transport *t, TransportManager::self()->transports() )
if ( t->id() != d->transport->id() )
existingNames << t->name();
int suffix = 1;
QString origName = d->transport->name();
while ( existingNames.contains( d->transport->name() ) ) {
d->transport->setName( i18nc("%1: name; %2: number appended to it to make it unique among a list of names", "%1 %2",
origName, suffix ) );
++suffix;
}
d->transport->writeConfig();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment