Skip to content

Commit

Permalink
UI: Remove alias from more places #4577 #4695
Browse files Browse the repository at this point in the history
  • Loading branch information
guruz committed Apr 20, 2016
1 parent 93ad61a commit 1a51b67
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 50 deletions.
6 changes: 4 additions & 2 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>"
"<p><b>Note:</b> This will <b>not</b> delete any files.</p>").arg(alias),
"<p><b>Note:</b> This will <b>not</b> delete any files.</p>").arg(aliasGui),
QMessageBox::NoButton,
this);
QPushButton* yesButton =
Expand All @@ -349,7 +352,6 @@ void AccountSettings::slotRemoveCurrentFolder()
return;
}

FolderMan *folderMan = FolderMan::instance();
folderMan->slotRemoveFolder( folderMan->folder(alias) );
_model->removeRow(row);

Expand Down
30 changes: 0 additions & 30 deletions src/gui/folderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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 <i>%1</i> is already in use. Please pick another alias.").arg(alias) );
isOk = false;
goon = false;
}
}
i++;
}

_ui.warnLabel->setWordWrap(true);
if( isOk ) {
_ui.warnLabel->hide();
Expand Down Expand Up @@ -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();
}
Expand Down
19 changes: 1 addition & 18 deletions src/gui/folderwizardsourcepage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>423</width>
<height>155</height>
<height>174</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -47,23 +47,6 @@
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Directory alias name:</string>
</property>
<property name="buddy">
<cstring>aliasLineEdit</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="aliasLineEdit"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 1a51b67

Please sign in to comment.