From: Markus Goetz Date: Tue, 26 Apr 2016 14:38:03 +0000 (+0200) Subject: UI: Fix account name/alias display oddities #4577 X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1176^2~18^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ce5ca8a42e5456a1d557575a7e1718638a8eaefe;p=nextcloud-desktop.git UI: Fix account name/alias display oddities #4577 --- diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index dfb4654ac..a2652e0b7 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -335,12 +335,12 @@ void AccountSettings::slotRemoveCurrentFolder() qDebug() << "Remove Folder alias " << alias; if( !alias.isEmpty() ) { FolderMan *folderMan = FolderMan::instance(); - QString aliasGui = folderMan->folder(alias)->aliasGui(); + QString shortGuiLocalPath = folderMan->folder(alias)->shortGuiLocalPath(); 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(aliasGui), + "

Note: This will not delete any files.

").arg(shortGuiLocalPath), QMessageBox::NoButton, this); QPushButton* yesButton = diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 6ab67cba3..a5825e9f7 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -142,7 +142,7 @@ void Folder::checkLocalPath() } } -QString Folder::aliasGui() const +QString Folder::shortGuiRemotePathOrAppName() const { if (remotePath().length() > 0 && remotePath() != QLatin1String("/")) { QString a = QFile(remotePath()).fileName(); @@ -169,7 +169,7 @@ QString Folder::path() const return p; } -QString Folder::shortGuiPath() const +QString Folder::shortGuiLocalPath() const { QString p = _definition.localPath; QString home = QDir::homePath(); @@ -975,7 +975,7 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel) "the files were manually removed.\n" "Are you sure you want to perform this operation?"); QMessageBox msgBox(QMessageBox::Warning, tr("Remove All Files?"), - msg.arg(aliasGui())); + msg.arg(shortGuiLocalPath())); msgBox.addButton(tr("Remove all files"), QMessageBox::DestructiveRole); QPushButton* keepBtn = msgBox.addButton(tr("Keep files"), QMessageBox::AcceptRole); if (msgBox.exec() == -1) { @@ -1001,7 +1001,7 @@ void Folder::slotAboutToRestoreBackup(bool *restore) "file in an earlier state. " "Do you want to keep your local most recent files as conflict files?"); QMessageBox msgBox(QMessageBox::Warning, tr("Backup detected"), - msg.arg(aliasGui())); + msg.arg(shortGuiLocalPath())); msgBox.addButton(tr("Normal Synchronisation"), QMessageBox::DestructiveRole); QPushButton* keepBtn = msgBox.addButton(tr("Keep Local Files as Conflict"), QMessageBox::AcceptRole); diff --git a/src/gui/folder.h b/src/gui/folder.h index c0c3580c9..b6928aa38 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -95,12 +95,12 @@ public: * alias or nickname */ QString alias() const; - QString aliasGui() const; // since 2.0 we don't want to show aliases anymore, show the path instead + QString shortGuiRemotePathOrAppName() const; // since 2.0 we don't want to show aliases anymore, show the path instead /** - * short path to display on the GUI (native separators) + * short local path to display on the GUI (native separators) */ - QString shortGuiPath() const; + QString shortGuiLocalPath() const; /** * local folder path diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 8c5168171..ac623c118 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -781,7 +781,7 @@ Folder* FolderMan::addFolderInternal(const FolderDefinition& folderDefinition, A { auto folder = new Folder(folderDefinition, accountState, this ); - qDebug() << "Adding folder to Folder Map " << folder; + qDebug() << "Adding folder to Folder Map " << folder << folder->alias(); _folderMap[folder->alias()] = folder; if (folder->syncPaused()) { _disabledFolders.insert(folder); diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 7fb8d9db0..55f35b43b 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -185,11 +185,11 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const const bool accountConnected = _accountState->isConnected(); switch (role) { - case FolderStatusDelegate::FolderPathRole : return f->shortGuiPath(); + case FolderStatusDelegate::FolderPathRole : return f->shortGuiLocalPath(); case FolderStatusDelegate::FolderSecondPathRole : return f->remotePath(); case FolderStatusDelegate::FolderErrorMsg : return f->syncResult().errorStrings(); case FolderStatusDelegate::SyncRunning : return f->syncResult().status() == SyncResult::SyncRunning; - case FolderStatusDelegate::HeaderRole : return f->aliasGui(); + case FolderStatusDelegate::HeaderRole : return f->shortGuiRemotePathOrAppName(); case FolderStatusDelegate::FolderAliasRole : return f->alias(); case FolderStatusDelegate::FolderSyncPaused : return f->syncPaused(); case FolderStatusDelegate::FolderAccountConnected : return accountConnected; diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 69358835f..d32995455 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -314,7 +314,7 @@ void ownCloudGui::slotComputeOverallSyncStatus() foreach(Folder* folder, map.values()) { //qDebug() << "Folder in overallStatus Message: " << folder << " with name " << folder->alias(); QString folderMessage = folderMan->statusToString(folder->syncResult().status(), folder->syncPaused()); - allStatusStrings += tr("Folder %1: %2").arg(folder->aliasGui(), folderMessage); + allStatusStrings += tr("Folder %1: %2").arg(folder->shortGuiLocalPath(), folderMessage); } trayMessage = allStatusStrings.join(QLatin1String("\n")); #endif @@ -367,7 +367,7 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men menu->addAction(tr("Managed Folders:"))->setDisabled(true); } - QAction *action = new QAction( tr("Open folder '%1'").arg(folder->shortGuiPath()), this ); + QAction *action = new QAction( tr("Open folder '%1'").arg(folder->shortGuiLocalPath()), this ); connect(action, SIGNAL(triggered()),_folderOpenActionMapper, SLOT(map())); _folderOpenActionMapper->setMapping( action, folder->alias() ); menu->addAction(action); diff --git a/src/gui/protocolwidget.cpp b/src/gui/protocolwidget.cpp index e07b99409..5a175afed 100644 --- a/src/gui/protocolwidget.cpp +++ b/src/gui/protocolwidget.cpp @@ -167,7 +167,7 @@ QTreeWidgetItem* ProtocolWidget::createCompletedTreewidgetItem(const QString& fo columns << timeStr; columns << Utility::fileNameForGuiUse(item._originalFile); - columns << f->shortGuiPath(); + columns << f->shortGuiLocalPath(); // If the error string is set, it's prefered because it is a useful user message. QString message = item._errorString;