UI: Avoid showing folder alias #783 #3576

This commit is contained in:
Markus Goetz 2015-08-11 15:12:43 +02:00
parent 3b59960fb3
commit 6152ce4187
4 changed files with 16 additions and 2 deletions

View file

@ -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;

View file

@ -101,6 +101,7 @@ 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
/**
* local folder path

View file

@ -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:

View file

@ -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);