mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Folder: Generate an alias for new folders
Before commit 1a51b6718a, the wizard was
making sure folder had an alias but this is no longer the case.
So generate still an unique alias.
Alias is not used in the UI any longer, it's just use for internal purposes.
For issue #4737
This commit is contained in:
parent
4e7c09de83
commit
cd29875b76
@ -277,7 +277,6 @@ void AccountSettings::slotFolderWizardAccepted()
|
||||
qDebug() << "* Folder wizard completed";
|
||||
|
||||
FolderDefinition definition;
|
||||
definition.alias = folderWizard->field(QLatin1String("alias")).toString();
|
||||
definition.localPath = FolderDefinition::prepareLocalPath(
|
||||
folderWizard->field(QLatin1String("sourceFolder")).toString());
|
||||
definition.targetPath = folderWizard->property("targetPath").toString();
|
||||
|
||||
@ -200,7 +200,7 @@ int FolderMan::setupFolders()
|
||||
foreach (const auto& folderAlias, settings->childGroups()) {
|
||||
FolderDefinition folderDefinition;
|
||||
if (FolderDefinition::load(*settings, folderAlias, &folderDefinition)) {
|
||||
Folder* f = addFolderInternal(folderDefinition, account.data());
|
||||
Folder* f = addFolderInternal(std::move(folderDefinition), account.data());
|
||||
if (f) {
|
||||
slotScheduleSync(f);
|
||||
emit folderSyncStateChange(f);
|
||||
@ -777,8 +777,15 @@ Folder* FolderMan::addFolder(AccountState* accountState, const FolderDefinition&
|
||||
return folder;
|
||||
}
|
||||
|
||||
Folder* FolderMan::addFolderInternal(const FolderDefinition& folderDefinition, AccountState* accountState)
|
||||
Folder* FolderMan::addFolderInternal(FolderDefinition folderDefinition, AccountState* accountState)
|
||||
{
|
||||
auto alias = folderDefinition.alias;
|
||||
int count = 0;
|
||||
while (folderDefinition.alias.isEmpty() || _folderMap.contains(folderDefinition.alias)) {
|
||||
// There is already a folder configured with this name and folder names need to be unique
|
||||
folderDefinition.alias = alias + QString::number(++count);
|
||||
}
|
||||
|
||||
auto folder = new Folder(folderDefinition, accountState, this );
|
||||
|
||||
qDebug() << "Adding folder to Folder Map " << folder;
|
||||
|
||||
@ -201,7 +201,7 @@ private:
|
||||
/** Adds a new folder, does not add it to the account settings and
|
||||
* does not set an account on the new folder.
|
||||
*/
|
||||
Folder* addFolderInternal(const FolderDefinition& folderDefinition, AccountState* accountState);
|
||||
Folder* addFolderInternal(FolderDefinition folderDefinition, AccountState* accountState);
|
||||
|
||||
/* unloads a folder object, does not delete it */
|
||||
void unloadFolder( Folder * );
|
||||
|
||||
@ -459,13 +459,6 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
|
||||
if (!startFromScratch || ensureStartFromScratch(localFolder)) {
|
||||
qDebug() << "Adding folder definition for" << localFolder << _remoteFolder;
|
||||
FolderDefinition folderDefinition;
|
||||
auto alias = Theme::instance()->appName();
|
||||
int count = 0;
|
||||
folderDefinition.alias = alias;
|
||||
while (folderMan->folder(folderDefinition.alias)) {
|
||||
// There is already a folder configured with this name and folder names need to be unique
|
||||
folderDefinition.alias = alias + QString::number(++count);
|
||||
}
|
||||
folderDefinition.localPath = localFolder;
|
||||
folderDefinition.targetPath = _remoteFolder;
|
||||
folderDefinition.ignoreHiddenFiles = folderMan->ignoreHiddenFiles();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user