Skip to content

Commit

Permalink
UI: Avoid showing folder alias owncloud#783 owncloud#3576
Browse files Browse the repository at this point in the history
  • Loading branch information
guruz committed Aug 11, 2015
1 parent 3b59960 commit 6152ce4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@ void Folder::checkLocalPath()
}
}

QString Folder::aliasGui() const
{
if (remotePath().length() > 0 && remotePath() != QLatin1String("/")) {
QString a = QFile(remotePath()).fileName();
if (a.startsWith('/')) {
a = a.remove(0, 1);
}
return a;
} else {
return Theme::instance()->appNameGUI();
}
}

QString Folder::alias() const
{
return _definition.alias;
Expand Down
1 change: 1 addition & 0 deletions src/gui/folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ 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

/**
* local folder path
Expand Down
2 changes: 1 addition & 1 deletion src/gui/folderstatusmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
switch (role) {
case FolderStatusDelegate::FolderPathRole : return f->nativePath();
case FolderStatusDelegate::FolderSecondPathRole : return f->remotePath();
case FolderStatusDelegate::FolderAliasRole : return f->alias();
case FolderStatusDelegate::FolderAliasRole : return f->aliasGui();
case FolderStatusDelegate::FolderSyncPaused : return f->syncPaused();
case FolderStatusDelegate::FolderAccountConnected : return accountConnected;
case Qt::ToolTipRole:
Expand Down
2 changes: 1 addition & 1 deletion src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men
folderName = Theme::instance()->appNameGUI();
}

QAction *action = new QAction( tr("Open folder '%1'").arg(folder->alias()), this );
QAction *action = new QAction( tr("Open folder '%1'").arg(folder->path()), this );
connect(action, SIGNAL(triggered()),_folderOpenActionMapper, SLOT(map()));
_folderOpenActionMapper->setMapping( action, folder->alias() );
menu->addAction(action);
Expand Down

0 comments on commit 6152ce4

Please sign in to comment.