Skip to content

Commit

Permalink
Merge pull request #4744 from owncloud/fixAliasesOnceMore2
Browse files Browse the repository at this point in the history
UI: Fix account name/alias display oddities #4577
  • Loading branch information
guruz committed Apr 26, 2016
2 parents 09eea7f + ce5ca8a commit 85bc3b2
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("<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(aliasGui),
"<p><b>Note:</b> This will <b>not</b> delete any files.</p>").arg(shortGuiLocalPath),
QMessageBox::NoButton,
this);
QPushButton* yesButton =
Expand Down
8 changes: 4 additions & 4 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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) {
Expand All @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ class Folder : public QObject
* 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
Expand Down
2 changes: 1 addition & 1 deletion src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/folderstatusmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/protocolwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 85bc3b2

Please sign in to comment.