diff --git a/plasmoid/package/contents/ui/BookmarkItemDelegate.qml b/plasmoid/package/contents/ui/BookmarkItemDelegate.qml index be9fa48..4b81cb7 100644 --- a/plasmoid/package/contents/ui/BookmarkItemDelegate.qml +++ b/plasmoid/package/contents/ui/BookmarkItemDelegate.qml @@ -1,79 +1,84 @@ /*************************************************************************** * Copyright (C) 2017 by A. Reinholdt * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.3 import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.smb4k.smb4kqmlplugin 2.0 PlasmaComponents.ListItem { id: delegate signal itemClicked() width: parent.width height: theme.mediumIconSize + 8 enabled: !object.isMounted focus: true Row { spacing: 10 Column { anchors.verticalCenter: parent.verticalCenter PlasmaCore.IconItem { id: delegateItemIcon - source: object.icon + source: (object.isGroup ? "folder-favorites" : "folder-network") + overlays: [ + (object.isMounted ? "emblem-mounted" : "") + ] width: theme.mediumIconSize - height: theme.mediumIconSice + height: theme.mediumIconSize + enabled: delegate.enabled MouseArea { anchors.fill: parent onClicked: { delegate.itemClicked() } } } } Column { anchors.verticalCenter: parent.verticalCenter PlasmaComponents.Label { id: delegateItemText elide: Text.ElideRight text: { if (!object.isGroup) { object.shareName+(object.label.length != 0 ? " ("+object.label+")" : "")+ "
"+i18n("on %1", object.hostName) } else { object.groupName } } + enabled: delegate.enabled MouseArea { anchors.fill: parent onClicked: { delegate.itemClicked() } } } } } } diff --git a/plasmoid/package/contents/ui/BookmarksPage.qml b/plasmoid/package/contents/ui/BookmarksPage.qml index bebb5db..02a3bc9 100644 --- a/plasmoid/package/contents/ui/BookmarksPage.qml +++ b/plasmoid/package/contents/ui/BookmarksPage.qml @@ -1,193 +1,203 @@ /*************************************************************************** * Copyright (C) 2017 by A. Reinholdt * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.3 import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras PlasmaComponents.Page { id: bookmarksPage // // Tool bar // PlasmaComponents.ToolBar { id: bookmarksToolBar anchors { top: parent.top left: parent.left right: parent.right } tools: PlasmaComponents.ToolBarLayout { PlasmaComponents.ToolButton { id: backButton tooltip: i18n("Go back") iconSource: "go-previous" width: minimumWidth onClicked: { back() } } PlasmaComponents.ToolButton { id: editButton tooltip: i18n("Edit bookmarks") iconSource: "bookmarks-organize" width: minimumWidth onClicked: { iface.editBookmarks() } } } } // // List view // PlasmaExtras.ScrollArea { id: bookmarksScrollArea anchors { top: bookmarksToolBar.bottom left: parent.left right: parent.right bottom: parent.bottom } ListView { id: bookmarksListView delegate: BookmarkItemDelegate { id: bookmarkItemDelegate onItemClicked: { var object = bookmarksListView.model.get(index).object if (object !== null) { bookmarkOrGroupClicked(object) } else { // Do nothing } } } model: ListModel {} focus: true highlightRangeMode: ListView.StrictlyEnforceRange } } // // Connections // Connections { target: iface onMountedSharesChanged: shareMountedOrUnmounted() onBookmarksListChanged: fillView() } // // Initialization // Component.onCompleted: { fillView() } // // Functions // function back() { // Since the 'Back' button is only useful when you // are currently in a group subfolder and want to // go back to the toplevel, just run fillView() here. fillView() } function bookmarkOrGroupClicked(object) { if (object.isGroup) { while (bookmarksListView.model.count != 0) { bookmarksListView.model.remove(0) } getBookmarks(object.groupName) } else { iface.mount(object.url) } } function shareMountedOrUnmounted() { for (var i = 0; i < bookmarksListView.model.count; i++) { - if (!bookmarksListView.model.get(i).object.isGroup) { - var object = iface.findMountedShare(bookmarksListView.model.get(i).object.url, false) - if (object !== null) { - bookmarksListView.model.get(i).object.icon = object.icon + var object = bookmarksListView.model.get(i).object + if (!object.isGroup) { + var mountedShare = iface.findMountedShare(object.url, false) + if (mountedShare !== null) { + object.isMounted = mountedShare.isMounted } else { - // Do nothing + object.isMounted = false } + bookmarksListView.model.set(i, {"object": object}) } else { // Do nothing } } } function fillView() { while (bookmarksListView.model.count != 0) { bookmarksListView.model.remove(0) } // Get groups if (iface.bookmarkGroups.length != 0) { for (var i = 0; i < iface.bookmarkGroups.length; i++) { if (iface.bookmarkGroups[i].groupName.length != 0) { bookmarksListView.model.append({"object": iface.bookmarkGroups[i]}) } else { // Do nothing } } } else { // Do nothing } // Get toplevel bookmarks getBookmarks("") } function getBookmarks(groupName) { if (iface.bookmarks.length != 0) { for (var i = 0; i < iface.bookmarks.length; i++) { if (iface.bookmarks[i].groupName == groupName) { - bookmarksListView.model.append({"object": iface.bookmarks[i]}) + var bookmark = iface.bookmarks[i] + var mountedShare = iface.findMountedShare(bookmark.url, false) + if (mountedShare !== null) { + bookmark.isMounted = mountedShare.isMounted + bookmarksListView.model.append({"object": bookmark}) + } + else { + // Do nothing + } } else { // Do nothing } } } else { // Do nothing } } } diff --git a/plasmoid/package/contents/ui/NetworkBrowserItemDelegate.qml b/plasmoid/package/contents/ui/NetworkBrowserItemDelegate.qml index 50b939e..764b1bd 100644 --- a/plasmoid/package/contents/ui/NetworkBrowserItemDelegate.qml +++ b/plasmoid/package/contents/ui/NetworkBrowserItemDelegate.qml @@ -1,124 +1,143 @@ /*************************************************************************** * Copyright (C) 2017 by A. Reinholdt * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.3 import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.smb4k.smb4kqmlplugin 2.0 PlasmaComponents.ListItem { id: delegate signal itemClicked() signal bookmarkClicked() signal configureClicked() width: parent.width height: theme.mediumIconSize + 8 focus: true Row { spacing: 10 Column { anchors.verticalCenter: parent.verticalCenter PlasmaCore.IconItem { id: delegateItemIcon - source: object.icon + source: { + switch (object.type) { + case NetworkObject.Workgroup: + "network-workgroup" + break + case NetworkObject.Host: + "network-server" + break + case NetworkObject.Share: + "folder-network" + break + default: + "" + break + } + } + overlays: [ + (object.isMounted ? "emblem-mounted" : "") + ] width: theme.mediumIconSize - height: theme.mediumIconSice + height: theme.mediumIconSize MouseArea { anchors.fill: parent onClicked: { delegate.itemClicked() } } } } Column { anchors.verticalCenter: parent.verticalCenter PlasmaComponents.Label { id: delegateItemText elide: Text.ElideRight text: object.name+(object.comment.length != 0 ? "
"+object.comment+"" : "") MouseArea { anchors.fill: parent onClicked: { delegate.itemClicked() } } } } } PlasmaComponents.ButtonRow { anchors { verticalCenter: parent.verticalCenter right: parent.right } exclusive: false spacing: 1 PlasmaComponents.ToolButton { id: bookmarkButton iconSource: "favorite" + tooltip: i18n("Bookmark") flat: true opacity: 0.2 visible: (object.type == NetworkObject.Share && !object.isPrinter) ? true : false enabled: (object.type == NetworkObject.Share && !object.isPrinter) ? true : false MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { parent.opacity = 1.0 } onExited: { parent.opacity = 0.2 } onClicked: { delegate.bookmarkClicked() } } } PlasmaComponents.ToolButton { id: configureButton - iconSource: "preferences-system-network" + iconSource: "settings-configure" flat: true opacity: 0.2 visible: (object.type != NetworkObject.Network && object.type != NetworkObject.Workgroup) ? true : false enabled: (object.type != NetworkObject.Network && object.type != NetworkObject.Workgroup) ? true : false MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { parent.opacity = 1.0 } onExited: { parent.opacity = 0.2 } onClicked: { delegate.configureClicked() } } } } } diff --git a/plasmoid/package/contents/ui/NetworkBrowserPage.qml b/plasmoid/package/contents/ui/NetworkBrowserPage.qml index 9b30f42..ef81bb2 100644 --- a/plasmoid/package/contents/ui/NetworkBrowserPage.qml +++ b/plasmoid/package/contents/ui/NetworkBrowserPage.qml @@ -1,336 +1,324 @@ /*************************************************************************** * Copyright (C) 2017 by A. Reinholdt * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.3 import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.smb4k.smb4kqmlplugin 2.0 PlasmaComponents.Page { id: networkBrowserPage anchors.fill: parent property var currentObject: 0 // // Tool bar // PlasmaComponents.ToolBar { id: networkBrowserToolBar anchors { top: parent.top left: parent.left right: parent.right } tools: PlasmaComponents.ToolBarLayout { PlasmaComponents.ToolButton { id: rescanButton tooltip: i18n("Rescan") iconSource: "view-refresh" onClicked: { rescan() } } PlasmaComponents.ToolButton { id: abortButton tooltip: i18n("Abort") iconSource: "process-stop" onClicked: { abort() } } PlasmaComponents.ToolButton { id: upButton tooltip: i18n("Go one level up") iconSource: "go-up-symbolic" onClicked: { if (networkBrowserListView.model.count != 0) { var object = networkBrowserListView.model.get(0).object up(object) } else { // Do nothing } } } PlasmaComponents.ToolButton { id: mountDialogButton tooltip: i18n("Open the mount dialog") iconSource: "view-form" onClicked: { // FIXME: Use Plasma dialog iface.openMountDialog() } } } } // // List view // PlasmaExtras.ScrollArea { id: networkBrowserScrollArea anchors { top: networkBrowserToolBar.bottom left: parent.left right: parent.right bottom: parent.bottom } ListView { id: networkBrowserListView anchors.fill: parent clip: true delegate: NetworkBrowserItemDelegate { id: networkBrowserItemDelegate onItemClicked: { currentObject = networkBrowserListView.model.get(index).object networkItemClicked(currentObject) } onBookmarkClicked: { var object = networkBrowserListView.model.get(index).object if (object !== null) { currentObject = object iface.addBookmark(object) } else { // Do nothing } } onConfigureClicked: { var object = networkBrowserListView.model.get(index).object if (object !== null) { currentObject = object iface.openCustomOptionsDialog(object) } else { // Do nothing } } } model: ListModel {} focus: true highlightRangeMode: ListView.StrictlyEnforceRange } } // // Connections // Connections { target: iface onWorkgroupsChanged: getWorkgroups() onHostsChanged: getHosts() onSharesChanged: getShares() onMountedSharesChanged: shareMountedOrUnmounted() } // // Functions // function rescan() { if (currentObject !== null) { iface.lookup(currentObject) } else { iface.lookup() } } function abort() { console.log("Stop only if running") iface.stopScanner() iface.stopMounter() iface.stopPrinter() } function up(object) { if (object !== null) { switch (object.type) { case NetworkObject.Workgroup: currentObject = null break case NetworkObject.Host: currentObject = null iface.lookup() break case NetworkObject.Share: var parentObject = iface.findNetworkItem(object.parentURL, object.parentType) if (parentObject !== null) { var grandparentObject = iface.findNetworkItem(parentObject.parentURL, parentObject.parentType) if (grandparentObject !== null) { currentObject = grandparentObject iface.lookup(grandparentObject) } else { // Do nothing } } else { // Do nothing } break default: break } } else { // Do nothing } } function networkItemClicked(object) { if (object !== null) { if (object.type == NetworkObject.Share) { if (!object.isPrinter) { iface.mount(object) } else { iface.print(object) } } else { iface.lookup(object) } } else { // Do nothing } } function getWorkgroups() { while (networkBrowserListView.model.count != 0) { networkBrowserListView.model.remove(0) } if (iface.workgroups.length != 0) { for (var i = 0; i < iface.workgroups.length; i++) { networkBrowserListView.model.append({"object": iface.workgroups[i]}) } } else { // Do nothing } } function getHosts() { var workgroupName = "" if (currentObject !== null) { workgroupName = currentObject.workgroupName } else { // Do nothing } while (networkBrowserListView.model.count != 0) { networkBrowserListView.model.remove(0) } if (iface.hosts.length != 0) { for (var i = 0; i < iface.hosts.length; i++) { if (workgroupName.length != 0 && workgroupName == iface.hosts[i].workgroupName) { networkBrowserListView.model.append({"object": iface.hosts[i]}) } else { // Do nothing } } } else { // Do nothing } } function getShares() { var hostName = "" if (currentObject !== null) { hostName = currentObject.hostName } else { // Do nothing } while (networkBrowserListView.model.count != 0) { networkBrowserListView.model.remove(0) } if (iface.shares.length != 0) { for (var i = 0; i < iface.shares.length; i++) { if (hostName.length != 0 && hostName == iface.shares[i].hostName) { networkBrowserListView.model.append({"object": iface.shares[i]}) } else { // Do nothing } } } else { // Do nothing } } function shareMountedOrUnmounted() { - if (networkBrowserListView.model.count != 0) { - for (var i = 0; i < networkBrowserListView.model.count; i++) { - var object = networkBrowserListView.model.get(i).object - if (object !== null) { - if (object.type == NetworkObject.Share) { - var mountedShare = iface.findMountedShare(object.url, false) - if (mountedShare !== null) { - object.icon = mountedShare.icon - } - else { - console.log("FIXME: Implement iface.defaultIcon()") - object.icon = QIcon("folder-network") - } - } - else { - break - } + for (var i = 0; i < networkBrowserListView.model.count; i++) { + var object = networkBrowserListView.model.get(i).object + if (object !== null && object.type == NetworkObject.Share) { + var mountedShare = iface.findMountedShare(object.url, false) + if (mountedShare !== null) { + object.isMounted = mountedShare.isMounted } else { - // Do nothing + object.isMounted = false } + networkBrowserListView.model.set(i, {"object": object}) + } + else { + // Do nothing } } - else { - // Do nothing - } - - networkBrowserListView.model.sync } } diff --git a/plasmoid/package/contents/ui/SharesViewItemDelegate.qml b/plasmoid/package/contents/ui/SharesViewItemDelegate.qml index 82a7f12..a3e34cc 100644 --- a/plasmoid/package/contents/ui/SharesViewItemDelegate.qml +++ b/plasmoid/package/contents/ui/SharesViewItemDelegate.qml @@ -1,142 +1,150 @@ /*************************************************************************** * Copyright (C) 2017 by A. Reinholdt * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.3 import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.smb4k.smb4kqmlplugin 2.0 PlasmaComponents.ListItem { id: delegate signal itemClicked() signal bookmarkClicked() signal unmountClicked() signal syncClicked() width: parent.width height: theme.mediumIconSize + 8 focus: true Row { spacing: 10 Column { anchors.verticalCenter: parent.verticalCenter PlasmaCore.IconItem { id: delegateItemIcon - source: object.icon + source: { + (!object.isInaccessible ? "folder-network" : "folder-locked") + } + overlays: [ + (object.isMounted ? "emblem-mounted" : "") + ] width: theme.mediumIconSize - height: theme.mediumIconSice + height: theme.mediumIconSize MouseArea { anchors.fill: parent onClicked: { delegate.itemClicked() } } } } Column { anchors.verticalCenter: parent.verticalCenter PlasmaComponents.Label { id: delegateItemText elide: Text.ElideRight text: object.shareName+"
"+i18n("on %1", object.hostName) MouseArea { anchors.fill: parent onClicked: { delegate.itemClicked() } } } } } PlasmaComponents.ButtonRow { anchors { verticalCenter: parent.verticalCenter right: parent.right } exclusive: false spacing: 1 PlasmaComponents.ToolButton { id: bookmarkButton iconSource: "favorite" + tooltip: i18n("Bookmark") flat: true opacity: 0.2 MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { parent.opacity = 1.0 } onExited: { parent.opacity = 0.2 } onClicked: { delegate.bookmarkClicked() } } } PlasmaComponents.ToolButton { id: syncButton iconSource: "folder-sync" + tooltip: i18n("Synchrionize") flat: true opacity: 0.2 MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { parent.opacity = 1.0 } onExited: { parent.opacity = 0.2 } onClicked: { delegate.syncClicked() } } } PlasmaComponents.ToolButton { id: unmountButton - iconSource: "emblem-unmounted" + iconSource: "media-eject" + tooltip: i18n("Unmount") flat: true opacity: 0.2 MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { parent.opacity = 1.0 } onExited: { parent.opacity = 0.2 } onClicked: { delegate.unmountClicked() } } } } } diff --git a/plasmoid/package/contents/ui/SharesViewPage.qml b/plasmoid/package/contents/ui/SharesViewPage.qml index bbe0885..c33a3f6 100644 --- a/plasmoid/package/contents/ui/SharesViewPage.qml +++ b/plasmoid/package/contents/ui/SharesViewPage.qml @@ -1,152 +1,153 @@ /*************************************************************************** * Copyright (C) 2017 by A. Reinholdt * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.3 import QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.smb4k.smb4kqmlplugin 2.0 PlasmaComponents.Page { id: sharesViewPage // // Tool bar // PlasmaComponents.ToolBar { id: sharesViewToolBar anchors { top: parent.top left: parent.left right: parent.right } tools: PlasmaComponents.ToolBarLayout { PlasmaComponents.ToolButton { id: unmountAllButton tooltip: i18n("Unmount all shares") iconSource: "system-run" width: minimumWidth onClicked: { iface.unmountAll() } } } } // // List view // PlasmaExtras.ScrollArea { id: sharesViewScrollArea anchors { top: sharesViewToolBar.bottom left: parent.left right: parent.right bottom: parent.bottom } ListView { id: sharesViewListView anchors.fill: parent clip: true delegate: SharesViewItemDelegate { id: sharesViewItemDelegate onItemClicked: { var object = sharesViewListView.model.get(index).object if (object !== null) { Qt.openUrlExternally(object.mountpoint) } else { // Do nothing } } onUnmountClicked: { var object = sharesViewListView.model.get(index).object if (object !== null) { iface.unmount(object) } else { // Do nothing } } onBookmarkClicked: { var object = sharesViewListView.model.get(index).object if (object !== null) { iface.addBookmark(object) } else { // Do nothing } } onSyncClicked: { var object = sharesViewListView.model.get(index).object if (object !== null) { iface.synchronize(object) } else { // Do nothing } } } model: ListModel {} focus: true highlightRangeMode: ListView.StrictlyEnforceRange } } // // Connections // Connections { target: iface onMountedSharesChanged: shareMountedOrUnmounted() } // // Functions // function shareMountedOrUnmounted() { while (sharesViewListView.model.count != 0) { sharesViewListView.model.remove(0) } for (var i = 0; i < iface.mountedShares.length; i++) { // The unmounted() signal is emitted before the share is // actually removed from the list. So, we need to check // here, if the share is still mounted. - if (iface.mountedShares[i].isMounted) { + var mountedShare = iface.mountedShares[i] + if (mountedShare !== null && mountedShare.isMounted) { sharesViewListView.model.append({"object": iface.mountedShares[i]}) } else { // Do nothing } } } }