mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 12:19:03 +03:00
Merge pull request #2058 from nextcloud/sbeyer-fix-nosync-crash
Fix/improve use case without local folder
This commit is contained in:
commit
6420725fb9
4 changed files with 15 additions and 8 deletions
|
@ -96,8 +96,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
||||||
relPath.prepend(folder->remotePath());
|
relPath.prepend(folder->remotePath());
|
||||||
list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
|
list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
|
||||||
if (list.count() > 0) {
|
if (list.count() > 0) {
|
||||||
QString path = "file:///" + QString(list.at(0));
|
return QUrl::fromLocalFile(list.at(0));
|
||||||
return QUrl(path);
|
|
||||||
}
|
}
|
||||||
// File does not exist anymore? Let's try to open its path
|
// File does not exist anymore? Let's try to open its path
|
||||||
if (QFileInfo(relPath).exists()) {
|
if (QFileInfo(relPath).exists()) {
|
||||||
|
|
|
@ -417,12 +417,11 @@ ActivityListModel *User::getActivityModel()
|
||||||
|
|
||||||
void User::openLocalFolder()
|
void User::openLocalFolder()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
const auto folder = getFolder();
|
||||||
QString path = "file:///" + this->getFolder()->path();
|
|
||||||
#else
|
if (folder != nullptr) {
|
||||||
QString path = "file://" + this->getFolder()->path();
|
QDesktopServices::openUrl(QUrl::fromLocalFile(folder->path()));
|
||||||
#endif
|
}
|
||||||
QDesktopServices::openUrl(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void User::login() const
|
void User::login() const
|
||||||
|
@ -764,6 +763,11 @@ bool UserModel::currentUserHasActivities()
|
||||||
return _users[currentUserIndex()]->hasActivities();
|
return _users[currentUserIndex()]->hasActivities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UserModel::currentUserHasLocalFolder()
|
||||||
|
{
|
||||||
|
return _users[currentUserIndex()]->getFolder() != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void UserModel::fetchCurrentActivityModel()
|
void UserModel::fetchCurrentActivityModel()
|
||||||
{
|
{
|
||||||
_users[currentUserId()]->slotRefresh();
|
_users[currentUserId()]->slotRefresh();
|
||||||
|
|
|
@ -101,6 +101,7 @@ public:
|
||||||
Q_INVOKABLE QString currentUserName();
|
Q_INVOKABLE QString currentUserName();
|
||||||
Q_INVOKABLE QString currentUserServer();
|
Q_INVOKABLE QString currentUserServer();
|
||||||
Q_INVOKABLE bool currentUserHasActivities();
|
Q_INVOKABLE bool currentUserHasActivities();
|
||||||
|
Q_INVOKABLE bool currentUserHasLocalFolder();
|
||||||
Q_INVOKABLE bool currentServerHasTalk();
|
Q_INVOKABLE bool currentServerHasTalk();
|
||||||
Q_INVOKABLE int currentUserId();
|
Q_INVOKABLE int currentUserId();
|
||||||
Q_INVOKABLE bool isUserConnected(const int &id);
|
Q_INVOKABLE bool isUserConnected(const int &id);
|
||||||
|
|
|
@ -30,6 +30,7 @@ Window {
|
||||||
currentAccountAvatar.source = "image://avatars/currentUser"
|
currentAccountAvatar.source = "image://avatars/currentUser"
|
||||||
currentAccountUser.text = userModelBackend.currentUserName();
|
currentAccountUser.text = userModelBackend.currentUserName();
|
||||||
currentAccountServer.text = userModelBackend.currentUserServer();
|
currentAccountServer.text = userModelBackend.currentUserServer();
|
||||||
|
openLocalFolderButton.visible = userModelBackend.currentUserHasLocalFolder();
|
||||||
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
||||||
currentAccountStateIndicator.source = ""
|
currentAccountStateIndicator.source = ""
|
||||||
currentAccountStateIndicator.source = userModelBackend.isUserConnected(userModelBackend.currentUserId()) ? "qrc:///client/theme/colored/state-ok.svg" : "qrc:///client/theme/colored/state-offline.svg"
|
currentAccountStateIndicator.source = userModelBackend.isUserConnected(userModelBackend.currentUserId()) ? "qrc:///client/theme/colored/state-ok.svg" : "qrc:///client/theme/colored/state-offline.svg"
|
||||||
|
@ -52,6 +53,7 @@ Window {
|
||||||
}
|
}
|
||||||
onNewUserSelected: {
|
onNewUserSelected: {
|
||||||
accountMenu.close();
|
accountMenu.close();
|
||||||
|
openLocalFolderButton.visible = userModelBackend.currentUserHasLocalFolder();
|
||||||
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
trayWindowTalkButton.visible = userModelBackend.currentServerHasTalk() ? true : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,6 +362,7 @@ Window {
|
||||||
Layout.preferredWidth: Style.trayWindowHeaderHeight
|
Layout.preferredWidth: Style.trayWindowHeaderHeight
|
||||||
Layout.preferredHeight: Style.trayWindowHeaderHeight
|
Layout.preferredHeight: Style.trayWindowHeaderHeight
|
||||||
flat: true
|
flat: true
|
||||||
|
visible: userModelBackend.currentUserHasLocalFolder()
|
||||||
|
|
||||||
icon.source: "qrc:///client/theme/white/folder.svg"
|
icon.source: "qrc:///client/theme/white/folder.svg"
|
||||||
icon.width: Style.headerButtonIconSize
|
icon.width: Style.headerButtonIconSize
|
||||||
|
|
Loading…
Reference in a new issue