Changeset View
Changeset View
Standalone View
Standalone View
applets/colorpicker/package/contents/ui/main.qml
Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Line(s) | 161 | DropArea { | |||
---|---|---|---|---|---|
162 | id: dropArea | 162 | id: dropArea | ||
163 | 163 | | |||
164 | property bool containsAcceptableDrag: false | 164 | property bool containsAcceptableDrag: false | ||
165 | 165 | | |||
166 | width: buttonSize | 166 | width: buttonSize | ||
167 | height: buttonSize | 167 | height: buttonSize | ||
168 | preventStealing: true | 168 | preventStealing: true | ||
169 | // why the hell is hasColor not a property?! | 169 | // why the hell is hasColor not a property?! | ||
170 | onDragEnter: containsAcceptableDrag = event.mimeData.hasColor() | 170 | onDragEnter: containsAcceptableDrag = (event.mimeData.hasColor() || ColorPicker.Utils.isValidColor(event.mimeData.text)) | ||
171 | onDragLeave: containsAcceptableDrag = false | 171 | onDragLeave: containsAcceptableDrag = false | ||
172 | onDrop: { | 172 | onDrop: { | ||
173 | if (event.mimeData.hasColor()) { | 173 | if (event.mimeData.hasColor()) { | ||
174 | addColorToHistory(event.mimeData.color) | 174 | addColorToHistory(event.mimeData.color) | ||
175 | } else if (ColorPicker.Utils.isValidColor(event.mimeData.text)) { | ||||
176 | addColorToHistory(event.mimeData.text) | ||||
175 | } | 177 | } | ||
176 | containsAcceptableDrag = false | 178 | containsAcceptableDrag = false | ||
177 | } | 179 | } | ||
178 | 180 | | |||
179 | PlasmaComponents.ToolButton { | 181 | PlasmaComponents.ToolButton { | ||
180 | anchors.fill: parent | 182 | anchors.fill: parent | ||
181 | tooltip: i18n("Color Options") | 183 | tooltip: i18n("Color Options") | ||
182 | onClicked: plasmoid.expanded = !plasmoid.expanded | 184 | onClicked: plasmoid.expanded = !plasmoid.expanded | ||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |