Commit c9cdedee authored by Carson Black's avatar Carson Black

Use QtQuick.Dialogs instead of kdialog and remove unused imports

parent 4becbfb2
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Window 2.12 import QtQuick.Window 2.12
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
import QtQuick.Dialogs 1.0 import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import org.kde.kirigami 2.5 as Kirigami import org.kde.kirigami 2.5 as Kirigami
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import QtGraphicalEffects 1.12 import QtGraphicalEffects 1.12
import me.appadeia.Ikona 1.0 import me.appadeia.Ikona 1.0
import Qt.labs.settings 1.1 import Qt.labs.settings 1.1
...@@ -604,158 +602,35 @@ Kirigami.ApplicationWindow { ...@@ -604,158 +602,35 @@ Kirigami.ApplicationWindow {
iconThemeNameDrawer.open() iconThemeNameDrawer.open()
} }
} }
PlasmaCore.DataSource { FileDialog {
id: savePicker id: savePicker
engine: "executable" selectExisting: false
connectedSources: [] selectMultiple: false
property var callbacks: ({}) selectFolder: false
onNewData: { onAccepted: {
var exitCode = data["exit code"] setter.copy(root.fromIconTemplate, savePicker.fileUrl)
var stdout = data["stdout"] root.imageSource = savePicker.fileUrl
if (exitCode == 0) {
print(stdout.trim())
setter.copy(root.fromIconTemplate, stdout.trim())
root.imageSource = "file:" + stdout.trim()
print(root.imageSource)
setter.xdgOpen(stdout.trim())
} else {
}
if (callbacks[sourceName] !== undefined) {
callbacks[sourceName](stdout);
}
exited(sourceName, stdout)
disconnectSource(sourceName) // cmd finished
} }
nameFilters: ["Icon SVGs (*.svg)"]
function exec(cmd, onNewDataCallback) {
if (onNewDataCallback !== undefined){
callbacks[cmd] = onNewDataCallback
}
connectSource(cmd)
}
function open() {
savePicker.exec("kdialog --getsavefilename . 'SVG Icon Files (*.svg)'", function(){});
}
signal exited(string sourceName, string stdout)
} }
PlasmaCore.DataSource { FileDialog {
id: picker id: picker
engine: "executable" onAccepted: {
connectedSources: [] root.imageSource = picker.fileUrl
property var callbacks: ({})
onNewData: {
var exitCode = data["exit code"]
var stdout = data["stdout"]
if (exitCode == 0) {
root.imageSource = "file:" + stdout.trim()
console.log(stdout.trim())
} else {
}
if (callbacks[sourceName] !== undefined) {
callbacks[sourceName](stdout);
}
exited(sourceName, stdout)
disconnectSource(sourceName) // cmd finished
} }
nameFilters: ["Icon SVGs (*.svg)"]
function exec(cmd, onNewDataCallback) {
if (onNewDataCallback !== undefined){
callbacks[cmd] = onNewDataCallback
}
connectSource(cmd)
}
function open() {
picker.exec("kdialog --getopenfilename . 'SVG Icon Files (*.svg)'", function(){});
}
signal exited(string sourceName, string stdout)
} }
PlasmaCore.DataSource { ColorDialog {
id: leftColorPicker id: leftColorPicker
engine: "executable" onAccepted: {
connectedSources: [] root.leftColor = leftColorPicker.color
property var callbacks: ({})
onNewData: {
var exitCode = data["exit code"]
var stdout = data["stdout"]
if (exitCode == 0) {
root.leftColor = stdout.trim()
} else {
}
if (callbacks[sourceName] !== undefined) {
callbacks[sourceName](stdout);
}
exited(sourceName, stdout)
disconnectSource(sourceName) // cmd finished
} }
function exec(cmd, onNewDataCallback) {
if (onNewDataCallback !== undefined){
callbacks[cmd] = onNewDataCallback
}
connectSource(cmd)
}
function open() {
leftColorPicker.exec("kdialog --getcolor", function(){});
}
signal exited(string sourceName, string stdout)
} }
PlasmaCore.DataSource { ColorDialog {
id: rightColorPicker id: rightColorPicker
engine: "executable" onAccepted: {
connectedSources: [] root.rightColor = rightColorPicker.color
property var callbacks: ({})
onNewData: {
var exitCode = data["exit code"]
var stdout = data["stdout"]
if (exitCode == 0) {
root.rightColor = stdout.trim()
} else {
}
if (callbacks[sourceName] !== undefined) {
callbacks[sourceName](stdout);
}
exited(sourceName, stdout)
disconnectSource(sourceName) // cmd finished
} }
function exec(cmd, onNewDataCallback) {
if (onNewDataCallback !== undefined){
callbacks[cmd] = onNewDataCallback
}
connectSource(cmd)
}
function open() {
rightColorPicker.exec("kdialog --getcolor", function(){});
}
signal exited(string sourceName, string stdout)
} }
Timer { Timer {
interval: 250 interval: 250
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment