|
| 1 | +/* |
| 2 | +* Files app - File manager for Papyros |
| 3 | +* Copyright (C) 2015 Ricardo Vieira <ricardo.vieira@tecnico.ulisboa.pt> |
| 4 | +* |
| 5 | +* This program is free software: you can redistribute it and/or modify |
| 6 | +* it under the terms of the GNU General Public License as published by |
| 7 | +* the Free Software Foundation, either version 3 of the License, or |
| 8 | +* (at your option) any later version. |
| 9 | +* |
| 10 | +* This program is distributed in the hope that it will be useful, |
| 11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +* GNU General Public License for more details. |
| 14 | +* |
| 15 | +* You should have received a copy of the GNU General Public License |
| 16 | +* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | +*/ |
| 18 | + |
| 19 | +import QtQuick 2.2 |
| 20 | +import Material 0.1 |
| 21 | +import Material.Extras 0.1 |
| 22 | +import Material.ListItems 0.1 as ListItem |
| 23 | + |
| 24 | +Dialog { |
| 25 | + title: "Settings" |
| 26 | + height: parent.height * 0.7 |
| 27 | + |
| 28 | + Column { |
| 29 | + id: settingsList |
| 30 | + anchors.left: parent.left |
| 31 | + anchors.right: parent.right |
| 32 | + CheckBox { |
| 33 | + id: hiddenCheck |
| 34 | + text: qsTr("Show hidden files") |
| 35 | + checked: folderModel.model.showHiddenFiles |
| 36 | + onClicked: folderModel.model.toggleShowHiddenFiles(); |
| 37 | + |
| 38 | + // If the checkbox is clicked it loses the connection with |
| 39 | + // folderModel.model.showHiddenFiles so we need connect to the signal |
| 40 | + Connections { |
| 41 | + target: folderModel.model |
| 42 | + onShowHiddenFilesChanged: |
| 43 | + hiddenCheck.checked = folderModel.model.showHiddenFiles |
| 44 | + } |
| 45 | + } |
| 46 | + ListItem.SimpleMenu { |
| 47 | + id: sortByMenu |
| 48 | + text: "Sort by:" |
| 49 | + model: ["Name", "Date"] |
| 50 | + selectedIndex: folderModel.model.sortBy |
| 51 | + // Here we can't just toggle, we need to set the selected option |
| 52 | + onSelectedIndexChanged: folderModel.model.sortBy = selectedIndex |
| 53 | + |
| 54 | + Connections { |
| 55 | + target: folderModel.model |
| 56 | + onSortByChanged: |
| 57 | + sortByMenu.selectedIndex = folderModel.model.sortBy |
| 58 | + } |
| 59 | + } |
| 60 | + ListItem.SimpleMenu { |
| 61 | + id: sortOrderMenu |
| 62 | + text: "Sort order:" |
| 63 | + model: ["Ascending", "Descending"] |
| 64 | + onSelectedIndexChanged: folderModel.model.sortOrder = selectedIndex |
| 65 | + |
| 66 | + Connections { |
| 67 | + target: folderModel.model |
| 68 | + onSortOrderChanged: |
| 69 | + sortOrderMenu.selectedIndex = folderModel.model.sortOrder |
| 70 | + } |
| 71 | + } |
| 72 | + } |
| 73 | +} |
0 commit comments