From 1a51b6718a345f1e5f28dd1f4e0c04bdaeeb5357 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Wed, 20 Apr 2016 14:27:50 +0200 Subject: [PATCH] UI: Remove alias from more places #4577 #4695 --- src/gui/accountsettings.cpp | 6 ++++-- src/gui/folderwizard.cpp | 30 ------------------------------ src/gui/folderwizardsourcepage.ui | 19 +------------------ 3 files changed, 5 insertions(+), 50 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index fe44fdc9223..dfb4654acc6 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -334,10 +334,13 @@ void AccountSettings::slotRemoveCurrentFolder() QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString(); qDebug() << "Remove Folder alias " << alias; if( !alias.isEmpty() ) { + FolderMan *folderMan = FolderMan::instance(); + QString aliasGui = folderMan->folder(alias)->aliasGui(); + QMessageBox messageBox(QMessageBox::Question, tr("Confirm Folder Sync Connection Removal"), tr("

Do you really want to stop syncing the folder %1?

" - "

Note: This will not delete any files.

").arg(alias), + "

Note: This will not delete any files.

").arg(aliasGui), QMessageBox::NoButton, this); QPushButton* yesButton = @@ -349,7 +352,6 @@ void AccountSettings::slotRemoveCurrentFolder() return; } - FolderMan *folderMan = FolderMan::instance(); folderMan->slotRemoveFolder( folderMan->folder(alias) ); _model->removeRow(row); diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index 54534278e24..c5668421111 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -68,17 +68,13 @@ FolderWizardLocalPath::FolderWizardLocalPath() _ui.localFolderLineEdit->setText( QDir::toNativeSeparators( defaultPath ) ); _ui.localFolderLineEdit->setToolTip(tr("Enter the path to the local folder.")); - registerField(QLatin1String("alias*"), _ui.aliasLineEdit); - QString newAlias = Theme::instance()->appName(); int count = 0; while (FolderMan::instance()->folder(newAlias)) { // There is already a folder configured with this name and folder names need to be unique newAlias = Theme::instance()->appName() + QString::number(++count); } - _ui.aliasLineEdit->setText( newAlias ); - _ui.aliasLineEdit->setToolTip(tr("The folder alias is a descriptive name for this sync connection.")); _ui.warnLabel->setTextFormat(Qt::RichText); _ui.warnLabel->hide(); } @@ -109,29 +105,6 @@ bool FolderWizardLocalPath::isComplete() const warnStrings << errorStr; } - // check if the alias is unique. - QString alias = _ui.aliasLineEdit->text(); - if( alias.isEmpty() ) { - warnStrings.append( tr("The alias can not be empty. Please provide a descriptive alias word.") ); - isOk = false; - } - - auto map = FolderMan::instance()->map(); - Folder::Map::const_iterator i = map.constBegin(); - bool goon = true; - while( goon && i != map.constEnd() ) { - Folder *f = i.value(); - if( f ) { - qDebug() << "Checking local alias: " << f->alias(); - if( f->alias() == alias ) { - warnStrings.append( tr("The alias %1 is already in use. Please pick another alias.").arg(alias) ); - isOk = false; - goon = false; - } - } - i++; - } - _ui.warnLabel->setWordWrap(true); if( isOk ) { _ui.warnLabel->hide(); @@ -170,9 +143,6 @@ void FolderWizardLocalPath::slotChooseLocalFolder() // There is already a folder configured with this name and folder names need to be unique newAlias = pickedDir.dirName() + QString::number(++count); } - if( !newAlias.isEmpty() ) { - _ui.aliasLineEdit->setText(newAlias); - } } emit completeChanged(); } diff --git a/src/gui/folderwizardsourcepage.ui b/src/gui/folderwizardsourcepage.ui index 5dc05c4fcad..cccb4c16431 100644 --- a/src/gui/folderwizardsourcepage.ui +++ b/src/gui/folderwizardsourcepage.ui @@ -7,7 +7,7 @@ 0 0 423 - 155 + 174 @@ -47,23 +47,6 @@ - - - - - - &Directory alias name: - - - aliasLineEdit - - - - - - - -