Changeset View
Changeset View
Standalone View
Standalone View
applets/quickshare/plasmoid/contents/ui/main.qml
Show All 23 Lines | |||||
24 | import org.kde.kquickcontrolsaddons 2.0 as QtExtra | 24 | import org.kde.kquickcontrolsaddons 2.0 as QtExtra | ||
25 | import QtQuick.Layouts 1.1 | 25 | import QtQuick.Layouts 1.1 | ||
26 | import org.kde.plasma.private.purpose 1.0 | 26 | import org.kde.plasma.private.purpose 1.0 | ||
27 | 27 | | |||
28 | DropArea { | 28 | DropArea { | ||
29 | id: root | 29 | id: root | ||
30 | 30 | | |||
31 | Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation | 31 | Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation | ||
32 | Layout.fillWidth: false | 32 | | ||
33 | Layout.fillHeight:false | 33 | readonly property bool inPanel: (plasmoid.location === PlasmaCore.Types.TopEdge | ||
34 | Layout.minimumWidth: 0 | 34 | || plasmoid.location === PlasmaCore.Types.RightEdge | ||
35 | Layout.minimumHeight: 0 | 35 | || plasmoid.location === PlasmaCore.Types.BottomEdge | ||
36 | || plasmoid.location === PlasmaCore.Types.LeftEdge) | ||||
37 | | ||||
38 | Layout.minimumWidth: units.iconSizes.small | ||||
39 | Layout.minimumHeight: Layout.minimumWidth | ||||
40 | | ||||
41 | Layout.maximumWidth: inPanel ? units.iconSizeHints.panel : -1 | ||||
42 | Layout.maximumHeight: inPanel ? units.iconSizeHints.panel : -1 | ||||
36 | 43 | | |||
37 | property string url: "" | 44 | property string url: "" | ||
38 | property string errorMessage: "" | 45 | property string errorMessage: "" | ||
39 | property var pasteUrls: [] | 46 | property var pasteUrls: [] | ||
40 | property int nextPaste: 0 | 47 | property int nextPaste: 0 | ||
41 | 48 | | |||
42 | function firstMimeType(formats) { | 49 | function firstMimeType(formats) { | ||
43 | for (var v in formats) { | 50 | for (var v in formats) { | ||
44 | var curr = formats[v]; | 51 | var curr = formats[v]; | ||
45 | 52 | | |||
46 | if (curr == "text/uri-list") { | 53 | if (curr == "text/uri-list") { | ||
47 | return { name: "text/uri-list" }; | 54 | return { name: "text/uri-list" }; | ||
48 | } else { | 55 | } else { | ||
49 | var mime = mimeDb.mimeTypeForName(curr); | 56 | var mime = mimeDb.mimeTypeForName(curr); | ||
50 | if (mime.hasOwnProperty("iconName")) { | 57 | if (mime.hasOwnProperty("iconName")) { | ||
51 | return mime; | 58 | return mime; | ||
52 | } | 59 | } | ||
53 | } | 60 | } | ||
54 | } | 61 | } | ||
55 | return {}; | 62 | return {}; | ||
56 | } | 63 | } | ||
57 | 64 | | |||
58 | function urlsMimetype(urls) | 65 | function urlsMimetype(urls) | ||
broulik: Unrelated change | |||||
59 | { | 66 | { | ||
60 | return mimeDb.mimeTypeForUrl(urls[0]); | 67 | return mimeDb.mimeTypeForUrl(urls[0]); | ||
61 | } | 68 | } | ||
62 | 69 | | |||
63 | function filenameFromUrl(url) { | 70 | function filenameFromUrl(url) { | ||
64 | var parts = url.split("/"); | 71 | var parts = url.split("/"); | ||
65 | return parts[parts.length - 1]; | 72 | return parts[parts.length - 1]; | ||
66 | } | 73 | } | ||
▲ Show 20 Lines • Show All 258 Lines • Show Last 20 Lines |
Unrelated change