Changeset View
Changeset View
Standalone View
Standalone View
applets/kickoff/package/contents/ui/ConfigGeneral.qml
Show All 10 Lines | |||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.0 | 19 | import QtQuick 2.5 | ||
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 | ||
21 | import QtQuick.Controls 1.0 as QtControls | 21 | import QtQuick.Controls 2.5 | ||
22 | 22 | | |||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 23 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import org.kde.plasma.components 2.0 as PlasmaComponents | | |||
25 | | ||||
26 | import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons | 24 | import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons | ||
27 | 25 | import org.kde.kirigami 2.5 as Kirigami | |||
28 | import org.kde.plasma.extras 2.0 as PlasmaExtras | | |||
29 | 26 | | |||
30 | ColumnLayout { | 27 | ColumnLayout { | ||
28 | | ||||
31 | property string cfg_icon: plasmoid.configuration.icon | 29 | property string cfg_icon: plasmoid.configuration.icon | ||
32 | property alias cfg_switchTabsOnHover: switchTabsOnHoverCheckbox.checked | 30 | property alias cfg_switchTabsOnHover: switchTabsOnHoverCheckbox.checked | ||
33 | property alias cfg_showAppsByName: showApplicationsByNameCheckbox.checked | 31 | property alias cfg_showAppsByName: showApplicationsByNameCheckbox.checked | ||
34 | property alias cfg_useExtraRunners: useExtraRunners.checked | 32 | property alias cfg_useExtraRunners: useExtraRunners.checked | ||
35 | property alias cfg_alphaSort: alphaSort.checked | 33 | property alias cfg_alphaSort: alphaSort.checked | ||
36 | property alias cfg_menuItems: configButtons.menuItems | 34 | property alias cfg_menuItems: configButtons.menuItems | ||
37 | 35 | | |||
38 | spacing: units.smallSpacing | 36 | Kirigami.FormLayout { | ||
39 | 37 | | |||
40 | RowLayout { | 38 | Button { | ||
41 | spacing: units.smallSpacing | 39 | id: iconButton | ||
42 | 40 | | |||
43 | QtControls.Label { | 41 | Kirigami.FormData.label: i18n("Icon:") | ||
44 | text: i18n("Icon:") | | |||
45 | } | | |||
46 | 42 | | |||
47 | QtControls.Button { | 43 | Layout.preferredWidth: previewFrame.width + units.smallSpacing * 2 | ||
broulik: Did you try `Layout.preferredHeight`? | |||||
48 | id: iconButton | 44 | Layout.preferredHeight: previewFrame.height + units.smallSpacing * 2 | ||
49 | Layout.minimumWidth: previewFrame.width + units.smallSpacing * 2 | | |||
50 | Layout.maximumWidth: Layout.minimumWidth | | |||
51 | Layout.minimumHeight: previewFrame.height + units.smallSpacing * 2 | | |||
52 | Layout.maximumHeight: Layout.minimumWidth | | |||
53 | 45 | | |||
54 | KQuickAddons.IconDialog { | 46 | KQuickAddons.IconDialog { | ||
55 | id: iconDialog | 47 | id: iconDialog | ||
56 | onIconNameChanged: cfg_icon = iconName || "start-here-kde" // TODO use actual default | 48 | onIconNameChanged: cfg_icon = iconName || "start-here-kde" | ||
57 | } | 49 | } | ||
58 | 50 | | |||
59 | // just to provide some visual feedback, cannot have checked without checkable enabled | 51 | onClicked: iconMenu.opened ? iconMenu.close() : iconMenu.open() | ||
I was wondering, while at it, can we make the menu open onPressed to be consistent with all other menus and buttons with menus? broulik: I was wondering, while at it, can we make the menu open `onPressed` to be consistent with all… | |||||
60 | checkable: true | | |||
61 | onClicked: { | | |||
62 | checked = Qt.binding(function() { // never actually allow it being checked | | |||
63 | return iconMenu.status === PlasmaComponents.DialogStatus.Open | | |||
64 | }) | | |||
65 | | ||||
66 | iconMenu.open(0, height) | | |||
67 | } | | |||
68 | 52 | | |||
69 | PlasmaCore.FrameSvgItem { | 53 | PlasmaCore.FrameSvgItem { | ||
70 | id: previewFrame | 54 | id: previewFrame | ||
71 | anchors.centerIn: parent | 55 | anchors.centerIn: parent | ||
72 | imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal | 56 | imagePath: plasmoid.location === PlasmaCore.Types.Vertical || plasmoid.location === PlasmaCore.Types.Horizontal | ||
73 | ? "widgets/panel-background" : "widgets/background" | 57 | ? "widgets/panel-background" : "widgets/background" | ||
74 | width: units.iconSizes.large + fixedMargins.left + fixedMargins.right | 58 | width: units.iconSizes.large + fixedMargins.left + fixedMargins.right | ||
75 | height: units.iconSizes.large + fixedMargins.top + fixedMargins.bottom | 59 | height: units.iconSizes.large + fixedMargins.top + fixedMargins.bottom | ||
76 | 60 | | |||
77 | PlasmaCore.IconItem { | 61 | PlasmaCore.IconItem { | ||
78 | anchors.centerIn: parent | 62 | anchors.centerIn: parent | ||
79 | width: units.iconSizes.large | 63 | width: units.iconSizes.large | ||
80 | height: width | 64 | height: width | ||
81 | source: cfg_icon | 65 | source: cfg_icon | ||
82 | } | 66 | } | ||
83 | } | 67 | } | ||
84 | } | | |||
85 | 68 | | |||
86 | // QQC Menu can only be opened at cursor position, not a random one | 69 | Menu { | ||
87 | PlasmaComponents.ContextMenu { | | |||
88 | id: iconMenu | 70 | id: iconMenu | ||
89 | visualParent: iconButton | | |||
90 | 71 | | |||
91 | PlasmaComponents.MenuItem { | 72 | // Appear below the button | ||
73 | y: +parent.height | ||||
74 | | ||||
75 | MenuItem { | ||||
92 | text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") | 76 | text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") | ||
93 | icon: "document-open-folder" | 77 | icon.name: "document-open-folder" | ||
94 | onClicked: iconDialog.open() | 78 | onPressed: iconDialog.open() | ||
95 | } | 79 | } | ||
96 | PlasmaComponents.MenuItem { | 80 | MenuItem { | ||
97 | text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") | 81 | text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") | ||
98 | icon: "edit-clear" | 82 | icon.name: "edit-clear" | ||
99 | onClicked: cfg_icon = "start-here-kde" // TODO reset to actual default | 83 | onClicked: cfg_icon = "start-here-kde" | ||
100 | } | 84 | } | ||
101 | } | 85 | } | ||
102 | } | 86 | } | ||
103 | 87 | | |||
104 | QtControls.CheckBox { | 88 | CheckBox { | ||
105 | id: switchTabsOnHoverCheckbox | 89 | id: switchTabsOnHoverCheckbox | ||
90 | | ||||
91 | Kirigami.FormData.label: i18n("General:") | ||||
92 | | ||||
106 | text: i18n("Switch tabs on hover") | 93 | text: i18n("Switch tabs on hover") | ||
107 | } | 94 | } | ||
108 | 95 | | |||
109 | QtControls.CheckBox { | 96 | CheckBox { | ||
110 | id: showApplicationsByNameCheckbox | 97 | id: showApplicationsByNameCheckbox | ||
111 | text: i18n("Show applications by name") | 98 | text: i18n("Show applications by name") | ||
112 | } | 99 | } | ||
113 | 100 | | |||
114 | QtControls.CheckBox { | 101 | CheckBox { | ||
115 | id: useExtraRunners | 102 | id: useExtraRunners | ||
116 | text: i18n("Expand search to bookmarks, files and emails") | 103 | text: i18n("Expand search to bookmarks, files and emails") | ||
117 | } | 104 | } | ||
118 | 105 | | |||
119 | QtControls.CheckBox { | 106 | CheckBox { | ||
120 | id: alphaSort | 107 | id: alphaSort | ||
121 | text: i18n("Sort alphabetically") | 108 | text: i18n("Sort alphabetically") | ||
122 | } | 109 | } | ||
123 | | ||||
124 | Item { | | |||
125 | width: height | | |||
126 | height: units.gridUnit / 2 | | |||
127 | } | | |||
128 | | ||||
129 | SystemPalette { | | |||
130 | id: palette | | |||
131 | } | 110 | } | ||
132 | 111 | | |||
133 | PlasmaExtras.Heading { | | |||
134 | level: 2 | | |||
135 | text: i18n("Menu Buttons") | | |||
136 | color: palette.text | | |||
137 | } | | |||
138 | | ||||
139 | Row { | | |||
140 | spacing: units.gridUnit | | |||
141 | Column { | | |||
142 | QtControls.Label { | | |||
143 | text: i18n("Visible Tabs") | | |||
144 | height: configButtons.cellHeight | | |||
145 | } | | |||
146 | QtControls.Label { | | |||
147 | text: i18n("Hidden Tabs") | | |||
148 | height: configButtons.cellHeight | | |||
149 | } | | |||
150 | } | | |||
151 | Column { | | |||
152 | ConfigButtons { | 112 | ConfigButtons { | ||
153 | id: configButtons | 113 | id: configButtons | ||
154 | } | 114 | } | ||
155 | } | | |||
156 | } | | |||
157 | 115 | | |||
158 | QtControls.Label { | 116 | Label { | ||
159 | Layout.fillWidth: true | 117 | Layout.fillWidth: true | ||
160 | text: i18n("Drag tabs between the boxes to show/hide them, or reorder the visible tabs by dragging.") | 118 | text: i18n("Drag tabs between the boxes to show/hide them, or reorder the visible tabs by dragging.") | ||
161 | wrapMode: Text.WordWrap | 119 | wrapMode: Text.WordWrap | ||
162 | } | 120 | } | ||
163 | | ||||
164 | Item { | | |||
165 | //spacer | | |||
166 | Layout.fillHeight: true | | |||
167 | } | | |||
168 | } | 121 | } |
Did you try Layout.preferredHeight?