Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
  • fix_opensuse_package_build
  • develop
  • release-1.0.0
  • release-1.0.1
  • release-2.0.0
  • release-2.0.1
  • release-2.0.2
  • release-2.0.3
  • release-3.0.0
  • release-3.0.1
  • release-3.0.2
  • release-3.0.3
  • release-3.1.0
14 results

Target

Select target project
0 results Searching
Select Git revision
  • master
  • fix_opensuse_package_build
  • develop
  • release-1.0.0
  • release-1.0.1
  • release-2.0.0
  • release-2.0.1
  • release-2.0.2
  • release-2.0.3
  • release-3.0.0
  • release-3.0.1
  • release-3.0.2
  • release-3.0.3
  • release-3.1.0
14 results
Show changes
83 files
+ 2696
1377
Compare changes
  • Side-by-side
  • Inline

Files

+2 −1
Original line number Diff line number Diff line
*.pro.user
pkg/build/
build_*/
lib/qtil/

.gitlab-ci.yml

0 → 100644
+54 −0
Original line number Diff line number Diff line
stages:
  - build

ubuntu_deb:
  stage: build
  image: ubuntu:14.04
  only:
    - master
    - /^release\-.+/
  script:
    - ./scripts/package ubuntu_deb
  artifacts:
    paths:
    - build_*/ocs-url*.deb
    expire_in: 2 days

fedora_rpm:
  stage: build
  image: fedora:20
  only:
    - master
    - /^release\-.+/
  script:
    - ./scripts/package fedora_rpm
  artifacts:
    paths:
    - build_*/RPMS/x86_64/ocs-url*.rpm
    expire_in: 2 days

opensuse_rpm:
  stage: build
  image: opensuse/leap:42.3
  only:
    - master
    - /^release\-.+/
  script:
    - ./scripts/package opensuse_rpm
  artifacts:
    paths:
    - build_*/RPMS/x86_64/ocs-url*.rpm
    expire_in: 2 days

archlinux_pkg:
  stage: build
  image: archlinux/base:latest
  only:
    - master
    - /^release\-.+/
  script:
    - ./scripts/package archlinux_pkg
  artifacts:
    paths:
    - build_*/ocs-url*.pkg.tar.xz
    expire_in: 2 days
+7 −7
Original line number Diff line number Diff line
# xdgurl
# ocs-url

An install helper program for desktop stuff.
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

Copyright: 2016, Akira Ohgaki
An install helper program for items served via OpenCollaborationServices (ocs://).

Copyright: 2016-2019, Opendesktop.org

License: GPL-3+

Download Linux package from:

https://www.linux-apps.com/p/1136805/

And please check the xdgurl wiki for more information.
https://www.opendesktop.org/p/1136805/

https://github.com/xdgurl/xdgurl/wiki
And please see docs/* for more information.

app/app.pri

0 → 100644
+25 −0
Original line number Diff line number Diff line
CONFIG += c++11

QT += \
    core \
    gui \
    widgets \
    qml \
    quick \
    svg

HEADERS += \
    $${PWD}/src/handlers/confighandler.h \
    $${PWD}/src/handlers/ocsurlhandler.h

SOURCES += \
    $${PWD}/src/main.cpp \
    $${PWD}/src/handlers/confighandler.cpp \
    $${PWD}/src/handlers/ocsurlhandler.cpp

RESOURCES += \
    $${PWD}/configs/configs.qrc \
    $${PWD}/images/images.qrc \
    $${PWD}/qml/qml.qrc

INCLUDEPATH += $${PWD}/src
+13 −0
Original line number Diff line number Diff line
{
    "id": "ocs-url",
    "name": "ocs-url",
    "version": "3.1.0",
    "organization": "Opendesktop.org",
    "domain": "org.opendesktop.ocs-url",
    "icon": ":/desktop/ocs-url.svg",
    "description": "An install helper program for items served via OpenCollaborationServices (ocs://).",
    "license": "GPL-3+",
    "author": "Opendesktop.org",
    "contact": "contact@opendesktop.org",
    "homepage": "https://git.opendesktop.org/akiraohgaki/ocs-url"
}
Original line number Diff line number Diff line
<RCC>
    <qresource prefix="/configs">
        <file>application.json</file>
        <file>destinations.json</file>
        <file>destinations_alias.json</file>
        <file>install_types.json</file>
        <file>install_types_alias.json</file>
    </qresource>
</RCC>
+192 −0
Original line number Diff line number Diff line
{
    "bin": {
        "name": "Software",
        "destination": "$HOME/.local/bin",
        "generic_destination": "$APP_DATA/bin"
    },
    "downloads": {
        "name": "Downloads",
        "destination": "$XDG_DOWNLOAD_DIR",
        "generic_destination": "$APP_DATA/downloads"
    },
    "documents": {
        "name": "Documents",
        "destination": "$XDG_DOCUMENTS_DIR",
        "generic_destination": "$APP_DATA/documents"
    },
    "pictures": {
        "name": "Pictures",
        "destination": "$XDG_PICTURES_DIR",
        "generic_destination": "$APP_DATA/pictures"
    },
    "music": {
        "name": "Music",
        "destination": "$XDG_MUSIC_DIR",
        "generic_destination": "$APP_DATA/music"
    },
    "videos": {
        "name": "Videos",
        "destination": "$XDG_VIDEOS_DIR",
        "generic_destination": "$APP_DATA/videos"
    },
    "wallpapers": {
        "name": "Wallpapers",
        "destination": "$XDG_DATA_HOME/wallpapers",
        "generic_destination": "$APP_DATA/wallpapers"
    },
    "fonts": {
        "name": "Fonts",
        "destination": "$HOME/.fonts",
        "generic_destination": "$APP_DATA/fonts"
    },
    "cursors": {
        "name": "Cursors",
        "destination": "$HOME/.icons",
        "generic_destination": "$APP_DATA/cursors"
    },
    "icons": {
        "name": "Icons",
        "destination": "$XDG_DATA_HOME/icons",
        "generic_destination": "$APP_DATA/icons"
    },
    "emoticons": {
        "name": "Emoticons",
        "destination": "$XDG_DATA_HOME/emoticons",
        "generic_destination": "$APP_DATA/emoticons"
    },
    "themes": {
        "name": "Desktop Themes",
        "destination": "$HOME/.themes",
        "generic_destination": "$APP_DATA/themes"
    },
    "emerald_themes": {
        "name": "Emerald Themes",
        "destination": "$HOME/.emerald/themes",
        "generic_destination": "$APP_DATA/emerald_themes"
    },
    "enlightenment_themes": {
        "name": "Enlightenment Themes",
        "destination": "$HOME/.e/e/themes",
        "generic_destination": "$APP_DATA/enlightenment_themes"
    },
    "enlightenment_backgrounds": {
        "name": "Enlightenment Backgrounds",
        "destination": "$HOME/.e/e/backgrounds",
        "generic_destination": "$APP_DATA/enlightenment_backgrounds"
    },
    "fluxbox_styles": {
        "name": "Fluxbox Styles",
        "destination": "$HOME/.fluxbox/styles",
        "generic_destination": "$APP_DATA/fluxbox_styles"
    },
    "pekwm_themes": {
        "name": "PekWM Themes",
        "destination": "$HOME/.pekwm/themes",
        "generic_destination": "$APP_DATA/pekwm_themes"
    },
    "icewm_themes": {
        "name": "IceWM Themes",
        "destination": "$HOME/.icewm/themes",
        "generic_destination": "$APP_DATA/icewm_themes"
    },
    "plasma_plasmoids": {
        "name": "Plasma Plasmoids",
        "destination": "$XDG_DATA_HOME/plasma/plasmoids",
        "generic_destination": "$APP_DATA/plasma_plasmoids"
    },
    "plasma_look_and_feel": {
        "name": "Plasma Look and Feel",
        "destination": "$XDG_DATA_HOME/plasma/look-and-feel",
        "generic_destination": "$APP_DATA/plasma_look_and_feel"
    },
    "plasma_desktopthemes": {
        "name": "Plasma Desktop Themes",
        "destination": "$XDG_DATA_HOME/plasma/desktoptheme",
        "generic_destination": "$APP_DATA/plasma_desktopthemes"
    },
    "kwin_effects": {
        "name": "KWin Effects",
        "destination": "$XDG_DATA_HOME/kwin/effects",
        "generic_destination": "$APP_DATA/kwin_effects"
    },
    "kwin_scripts": {
        "name": "KWin Scripts",
        "destination": "$XDG_DATA_HOME/kwin/scripts",
        "generic_destination": "$APP_DATA/kwin_scripts"
    },
    "kwin_tabbox": {
        "name": "KWin Window Switcher",
        "destination": "$XDG_DATA_HOME/kwin/tabbox",
        "generic_destination": "$APP_DATA/kwin_tabbox"
    },
    "aurorae_themes": {
        "name": "Aurorae Themes",
        "destination": "$XDG_DATA_HOME/aurorae/themes",
        "generic_destination": "$APP_DATA/aurorae_themes"
    },
    "dekorator_themes": {
        "name": "deKorator Themes",
        "destination": "$XDG_DATA_HOME/deKorator/themes",
        "generic_destination": "$APP_DATA/dekorator_themes"
    },
    "qtcurve": {
        "name": "QtCurve Themes",
        "destination": "$XDG_DATA_HOME/QtCurve",
        "generic_destination": "$APP_DATA/qtcurve"
    },
    "color_schemes": {
        "name": "KDE Color Schemes",
        "destination": "$XDG_DATA_HOME/color-schemes",
        "generic_destination": "$APP_DATA/color_schemes"
    },
    "gnome_shell_extensions": {
        "name": "Gnome Shell Extensions",
        "destination": "$XDG_DATA_HOME/gnome-shell/extensions",
        "generic_destination": "$APP_DATA/gnome_shell_extensions"
    },
    "cinnamon_applets": {
        "name": "Cinnamon Applets",
        "destination": "$XDG_DATA_HOME/cinnamon/applets",
        "generic_destination": "$APP_DATA/cinnamon_applets"
    },
    "cinnamon_desklets": {
        "name": "Cinnamon Desklets",
        "destination": "$XDG_DATA_HOME/cinnamon/desklets",
        "generic_destination": "$APP_DATA/cinnamon_desklets"
    },
    "cinnamon_extensions": {
        "name": "Cinnamon Extensions",
        "destination": "$XDG_DATA_HOME/cinnamon/extensions",
        "generic_destination": "$APP_DATA/cinnamon_extensions"
    },
    "nautilus_scripts": {
        "name": "Nautilus Scripts",
        "destination": "$XDG_DATA_HOME/nautilus/scripts",
        "generic_destination": "$APP_DATA/nautilus_scripts"
    },
    "amarok_scripts": {
        "name": "Amarok Scripts",
        "destination": "$KDEHOME/share/apps/amarok/scripts",
        "generic_destination": "$APP_DATA/amarok_scripts"
    },
    "yakuake_skins": {
        "name": "Yakuake Skins",
        "destination": "$KDEHOME/share/apps/yakuake/skins",
        "generic_destination": "$APP_DATA/yakuake_skins"
    },
    "cairo_clock_themes": {
        "name": "Cairo-Clock Themes",
        "destination": "$HOME/.cairo-clock/themes",
        "generic_destination": "$APP_DATA/cairo_clock_themes"
    },
    "books": {
        "name": "Books",
        "destination": "$APP_DATA/books",
        "generic_destination": "$APP_DATA/books"
    },
    "comics": {
        "name": "Comics",
        "destination": "$APP_DATA/comics",
        "generic_destination": "$APP_DATA/comics"
    }
}
+62 −0
Original line number Diff line number Diff line
{
    "gnome_shell_themes": {
        "base": "themes",
        "name": "Gnome Shell Themes"
    },
    "cinnamon_themes": {
        "base": "themes",
        "name": "Cinnamon Themes"
    },
    "gtk2_themes": {
        "base": "themes",
        "name": "GTK2 Themes"
    },
    "gtk3_themes": {
        "base": "themes",
        "name": "GTK3 Themes"
    },
    "metacity_themes": {
        "base": "themes",
        "name": "Metacity Themes"
    },
    "xfwm4_themes": {
        "base": "themes",
        "name": "XFWM4 Themes"
    },
    "openbox_themes": {
        "base": "themes",
        "name": "Openbox Themes"
    },
    "kvantum_themes": {
        "base": "themes",
        "name": "Kvantum Themes"
    },
    "compiz_themes": {
        "base": "emerald_themes",
        "name": "Compiz Themes"
    },
    "beryl_themes": {
        "base": "emerald_themes",
        "name": "Beryl Themes"
    },
    "plasma4_plasmoids": {
        "base": "plasma_plasmoids",
        "name": "Plasma4 Plasmoids"
    },
    "plasma5_plasmoids": {
        "base": "plasma_plasmoids",
        "name": "Plasma5 Plasmoids"
    },
    "plasma5_look_and_feel": {
        "base": "plasma_look_and_feel",
        "name": "Plasma5 Look and Feel"
    },
    "plasma5_desktopthemes": {
        "base": "plasma_desktopthemes",
        "name": "Plasma5 Desktop Themes"
    },
    "plasma_color_schemes": {
        "base": "color_schemes",
        "name": "Plasma Color Schemes"
    }
}
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="128" height="128" viewBox="0, 0, 128, 128">
  <g id="icon">
    <path d="M64,8 C33.072,8 8,33.072 8,64 C8,94.928 33.072,120 64,120 C94.928,120 120,94.928 120,64 C120,33.072 94.928,8 64,8 z M64,24 C68.418,24 72,27.582 72,32 C72,36.418 68.418,40 64,40 C59.582,40 56,36.418 56,32 C56,27.582 59.582,24 64,24 z M48,48 L72,48 L72,96 L80,96 L80,104 L48,104 L48,96 L56,96 L56,56 L48,56 L48,48 z" fill="#000000" id="dialog-information"/>
  </g>
</svg>
+7 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="128" height="128" viewBox="0, 0, 128, 128">
  <g id="icon">
    <path d="M64,16 L8,112 L120,112 L64,16 z M56,48 L72,48 L72,80 L56,80 L56,48 z M64,88 C68.418,88 72,91.582 72,96 C72,100.418 68.418,104 64,104 C59.582,104 56,100.418 56,96 C56,91.582 59.582,88 64,88 z" fill="#000000" id="dialog-warning"/>
  </g>
</svg>
+7 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="128" height="128" viewBox="0, 0, 128, 128">
  <g id="icon">
    <path d="M64,8 C33.072,8 8,33.072 8,64 C8,94.928 33.072,120 64,120 C94.928,120 120,94.928 120,64 C120,33.072 94.928,8 64,8 z M80,32 L104,32 L56,104 L32,80 L32,56 L56,80 L80,32 z" fill="#000000" id="emblem-default"/>
  </g>
</svg>
+7 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="128" height="128" viewBox="0, 0, 128, 128">
  <g id="icon">
    <path d="M40,8 L40,48 L16,48 L64,96 L112,48 L88,48 L88,8 L40,8 z M8,72 L8,120 L120,120 L120,72 L104,72 L104,104 L24,104 L24,72 L8,72 z" fill="#000000" id="emblem-downloads"/>
  </g>
</svg>

app/images/images.qrc

0 → 100644
+8 −0
Original line number Diff line number Diff line
<RCC>
    <qresource prefix="/images">
        <file>icons/dialog-information.svg</file>
        <file>icons/dialog-warning.svg</file>
        <file>icons/emblem-default.svg</file>
        <file>icons/emblem-downloads.svg</file>
    </qresource>
</RCC>

app/qml/main.qml

0 → 100644
+169 −0
Original line number Diff line number Diff line
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0

import "ui" as Ui

import "scripts/Utility.js" as Utility

ApplicationWindow {
    id: app

    title: configHandler.getAppConfigApplication().name

    visible: true
    width: 400
    minimumWidth: width
    maximumWidth: width
    height: 200
    minimumHeight: height
    maximumHeight: height

    function init() {
        var metadata = ocsUrlHandler.metadata();

        var primaryMessages = {
            "success_download": qsTr("Download successful"),
            "success_install": qsTr("Installation successful"),
            "error_validation": qsTr("Validation error"),
            "error_network": qsTr("Network error"),
            "error_save": qsTr("Saving file failed"),
            "error_install": qsTr("Installation failed")
        };

        ocsUrlHandler.started.connect(function() {
            confirmDialog.close();
            progressDialog.open();
        });

        ocsUrlHandler.finishedWithSuccess.connect(function(result) {
            progressDialog.close();
            infoDialog.primaryText = primaryMessages[result.status];
            infoDialog.informativeText = metadata.filename;
            infoDialog.detailedText = result.message;
            infoDialog.open();
        });

        ocsUrlHandler.finishedWithError.connect(function(result) {
            progressDialog.close();
            errorDialog.primaryText = primaryMessages[result.status];
            errorDialog.informativeText = metadata.filename;
            errorDialog.detailedText = result.message;
            errorDialog.open();
        });

        ocsUrlHandler.downloadProgress.connect(function(id, bytesReceived, bytesTotal) {
            progressDialog.primaryText = qsTr("Downloading");
            progressDialog.informativeText = metadata.filename;
            progressDialog.detailedContentLoader.item.progressBar = bytesReceived / bytesTotal;
            progressDialog.detailedContentLoader.item.progressText
                    = Utility.convertByteToHumanReadable(bytesReceived)
                    + " / " + Utility.convertByteToHumanReadable(bytesTotal);
        });

        if (ocsUrlHandler.isValid()) {
            if (metadata.command === "download") {
                confirmDialog.primaryText = qsTr("Do you want to download?");
            }
            else if (metadata.command === "install") {
                confirmDialog.primaryText = qsTr("Do you want to install?");
            }
            confirmDialog.informativeText = metadata.filename;
            confirmDialog.detailedText
                    = qsTr("URL") + ": " + metadata.url + "\n"
                    + qsTr("File") + ": " + metadata.filename + "\n"
                    + qsTr("Type") + ": " + configHandler.getAppConfigInstallTypes()[metadata.type].name;
            confirmDialog.open();
        }
        else {
            errorDialog.primaryText = primaryMessages["error_validation"];
            errorDialog.detailedText = qsTr("Invalid OCS-URL");
            errorDialog.open();
        }
    }

    function fixWindowSize(dialog) {
        if (dialog.visible) {
            app.height = dialog.implicitHeight + (dialog.anchors.margins * 2);
            app.minimumHeight = app.height;
            app.maximumHeight = app.height;
        }
    }

    Ui.Dialog {
        id: confirmDialog
        icon: "qrc:/images/icons/dialog-information.svg"
        actionButton.text: qsTr("Details")
        actionButton.onClicked: toggleDetails()
        acceptButton.text: qsTr("OK")
        acceptButton.onClicked: ocsUrlHandler.process()
        rejectButton.text: qsTr("Cancel")
        rejectButton.onClicked: Qt.quit()
        onVisibleChanged: app.fixWindowSize(confirmDialog)
        onImplicitHeightChanged: app.fixWindowSize(confirmDialog)
    }

    Ui.Dialog {
        id: infoDialog
        icon: "qrc:/images/icons/emblem-default.svg"
        actionButton.text: qsTr("Details")
        actionButton.onClicked: toggleDetails()
        acceptButton.text: qsTr("Open")
        acceptButton.onClicked: {
            ocsUrlHandler.openDestination();
            Qt.quit();
        }
        rejectButton.text: qsTr("Close")
        rejectButton.onClicked: Qt.quit()
        onVisibleChanged: app.fixWindowSize(infoDialog)
        onImplicitHeightChanged: app.fixWindowSize(infoDialog)
    }

    Ui.Dialog {
        id: errorDialog
        icon: "qrc:/images/icons/dialog-warning.svg"
        actionButton.text: qsTr("Details")
        actionButton.onClicked: toggleDetails()
        rejectButton.text: qsTr("Close")
        rejectButton.onClicked: Qt.quit()
        onVisibleChanged: app.fixWindowSize(errorDialog)
        onImplicitHeightChanged: app.fixWindowSize(errorDialog)
    }

    Component {
        id: progressComponent
        ColumnLayout {
            property alias progressBar: progressBar.value
            property alias progressText: progressText.text
            anchors.fill: parent
            spacing: 4
            ProgressBar {
                id: progressBar
                minimumValue: 0
                maximumValue: 1
                value: 0
                Layout.fillWidth: true
            }
            Label {
                id: progressText
                text: ""
                Layout.alignment: Qt.AlignRight
            }
        }
    }

    Ui.Dialog {
        id: progressDialog
        icon: "qrc:/images/icons/emblem-downloads.svg"
        detailsVisible: true
        detailedContentLoader.sourceComponent: progressComponent
        rejectButton.text: qsTr("Cancel")
        rejectButton.onClicked: Qt.quit()
        onVisibleChanged: app.fixWindowSize(progressDialog)
        onImplicitHeightChanged: app.fixWindowSize(progressDialog)
    }

    Component.onCompleted: {
        app.init();
    }
}
Original line number Diff line number Diff line
<RCC>
    <qresource prefix="/qml">
        <file>main.qml</file>
        <file>ui/Dialog.qml</file>
        <file>scripts/Utility.js</file>
    </qresource>
</RCC>

app/qml/ui/Dialog.qml

0 → 100644
+113 −0
Original line number Diff line number Diff line
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0

ColumnLayout {
    id: dialog

    visible: false
    anchors.fill: parent
    anchors.margins: 12
    spacing: 12

    property alias icon: icon.source
    property alias primaryText: primaryText.text
    property alias informativeText: informativeText.text

    property alias detailsVisible: details.visible
    property alias detailedText: detailedText.text
    property alias detailedContentLoader: detailedContentLoader

    property alias actionButton: actionButton
    property alias acceptButton: acceptButton
    property alias rejectButton: rejectButton

    function open() {
        dialog.visible = true;
    }

    function close() {
        dialog.visible = false;
    }

    function toggleDetails() {
        details.visible = details.visible ? false : true;
    }

    RowLayout {
        Layout.fillWidth: true
        spacing: 12
        Image {
            id: icon
            source: ""
            visible: source.toString() ? true : false
            Layout.preferredWidth: 48
            Layout.preferredHeight: 48
            sourceSize.width: 128
            sourceSize.height: 128
        }
        ColumnLayout {
            Layout.fillWidth: true
            spacing: 4
            Label {
                id: primaryText
                text: ""
                visible: text ? true : false
                Layout.fillWidth: true
                wrapMode: Text.WrapAnywhere
                font.bold: true
                font.pixelSize: 14
            }
            Label {
                id: informativeText
                text: ""
                visible: text ? true : false
                Layout.fillWidth: true
                wrapMode: Text.WrapAnywhere
            }
        }
    }

    ColumnLayout {
        id: details
        visible: false
        Layout.fillWidth: true
        Layout.fillHeight: true
        spacing: 12
        Label {
            id: detailedText
            text: ""
            visible: text ? true : false
            Layout.fillWidth: true
            wrapMode: Text.WrapAnywhere
        }
        Loader {
            id: detailedContentLoader
            visible: (source.toString() || sourceComponent) ? true : false
            Layout.fillWidth: true
        }
    }

    RowLayout {
        Layout.fillWidth: true
        spacing: 4
        Button {
            id: actionButton
            text: ""
            visible: text ? true : false
        }
        Item {
            Layout.fillWidth: true
        }
        Button {
            id: acceptButton
            text: ""
            visible: text ? true : false
        }
        Button {
            id: rejectButton
            text: ""
            visible: text ? true : false
        }
    }
}
+85 −0
Original line number Diff line number Diff line
#include "confighandler.h"

#include <QStringList>
#include <QStandardPaths>

#include "qtil_dir.h"

ConfigHandler::ConfigHandler(QObject *parent)
    : QObject(parent)
{
    appConfig_ = Qtil::Config(":/configs");
    importAppConfigApplication();
    importAppConfigInstallTypes();
}

QJsonObject ConfigHandler::getAppConfigApplication() const
{
    return appConfigApplication_;
}

QJsonObject ConfigHandler::getAppConfigInstallTypes() const
{
    return appConfigInstallTypes_;
}

void ConfigHandler::importAppConfigApplication()
{
    appConfigApplication_ = appConfig_.get("application");
}

void ConfigHandler::importAppConfigInstallTypes()
{
    auto installTypes = appConfig_.get("install_types");
    for (const auto &key : installTypes.keys()) {
        auto installtype = installTypes[key].toObject();
        installtype["destination"] = convertPathString(installtype["destination"].toString());
        installtype["generic_destination"] = convertPathString(installtype["generic_destination"].toString());
        installTypes[key] = installtype;
    }
    auto installTypesAlias = appConfig_.get("install_types_alias");
    for (const auto &key : installTypesAlias.keys()) {
        auto installTypeAlias = installTypesAlias[key].toObject();
        auto baseKey = installTypeAlias["base"].toString();
        if (installTypes.contains(baseKey)) {
            auto installType = installTypes[baseKey].toObject();
            installType["base"] = baseKey;
            installType["name"] = installTypeAlias["name"].toString();
            installTypes[key] = installType;
        }
    }
    appConfigInstallTypes_ = installTypes;
}

QString ConfigHandler::convertPathString(const QString &path) const
{
    auto newPath = path;
    if (newPath.contains("$HOME")) {
        newPath.replace("$HOME", Qtil::Dir::homePath());
    }
    else if (newPath.contains("$XDG_DOCUMENTS_DIR")) {
        newPath.replace("$XDG_DOCUMENTS_DIR", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
    }
    else if (newPath.contains("$XDG_DOWNLOAD_DIR")) {
        newPath.replace("$XDG_DOWNLOAD_DIR", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
    }
    else if (newPath.contains("$XDG_PICTURES_DIR")) {
        newPath.replace("$XDG_PICTURES_DIR", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
    }
    else if (newPath.contains("$XDG_MUSIC_DIR")) {
        newPath.replace("$XDG_MUSIC_DIR", QStandardPaths::writableLocation(QStandardPaths::MusicLocation));
    }
    else if (newPath.contains("$XDG_VIDEOS_DIR")) {
        newPath.replace("$XDG_VIDEOS_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
    }
    else if (newPath.contains("$XDG_DATA_HOME")) {
        newPath.replace("$XDG_DATA_HOME", Qtil::Dir::genericDataPath());
    }
    else if (newPath.contains("$KDEHOME")) {
        newPath.replace("$KDEHOME", Qtil::Dir::kdehomePath());
    }
    else if (newPath.contains("$APP_DATA")) {
        newPath.replace("$APP_DATA", Qtil::Dir::genericDataPath() + "/" + getAppConfigApplication()["id"].toString());
    }
    return newPath;
}
+27 −0
Original line number Diff line number Diff line
#pragma once

#include <QObject>
#include <QJsonObject>

#include "qtil_config.h"

class ConfigHandler : public QObject
{
    Q_OBJECT

public:
    explicit ConfigHandler(QObject *parent = nullptr);

public slots:
    QJsonObject getAppConfigApplication() const;
    QJsonObject getAppConfigInstallTypes() const;

private:
    void importAppConfigApplication();
    void importAppConfigInstallTypes();
    QString convertPathString(const QString &path) const;

    Qtil::Config appConfig_;
    QJsonObject appConfigApplication_;
    QJsonObject appConfigInstallTypes_;
};
Original line number Diff line number Diff line
#include "xdgurl.h"
#include "ocsurlhandler.h"

#include <QUrl>
#include <QUrlQuery>
#include <QTemporaryFile>
#include <QNetworkReply>
#include <QDesktopServices>

#include "../../libs/utils/config.h"
#include "../../libs/utils/network.h"
#include "../../libs/utils/file.h"
#include "../../libs/utils/package.h"
#include "qtil_file.h"
#include "qtil_dir.h"
#include "qtil_networkresource.h"
#include "qtil_package.h"

namespace handlers {
#include "handlers/confighandler.h"

XdgUrl::XdgUrl(const QString &xdgUrl, utils::Config *config, utils::Network *network, QObject *parent) :
    QObject(parent), xdgUrl_(xdgUrl), config_(config), network_(network)
OcsUrlHandler::OcsUrlHandler(const QString &ocsUrl, ConfigHandler *configHandler, QObject *parent)
    : QObject(parent), ocsUrl_(ocsUrl), configHandler_(configHandler)
{
    parse();
    loadDestinations();
}

    connect(network_, &utils::Network::finished, this, &handlers::XdgUrl::downloaded);
    connect(network_, &utils::Network::downloadProgress, this, &handlers::XdgUrl::downloadProgress);
QString OcsUrlHandler::ocsUrl() const
{
    return ocsUrl_;
}

void XdgUrl::process()
QJsonObject OcsUrlHandler::metadata() const
{
    /**
     * xdgs scheme is a reserved name, so the process of xdgs
     * is the same process of the xdg scheme currently.
     */
    return metadata_;
}

void OcsUrlHandler::process()
{
    // ocss scheme is a reserved name, so the process of ocss
    // is the same process of the ocs scheme currently.

    if (!isValid()) {
        QJsonObject result;
        result["status"] = QString("error_validation");
        result["message"] = QString("Invalid XDG-URL " + xdgUrl_);
        emit error(result);
        result["message"] = tr("Invalid OCS-URL");
        emit finishedWithError(result);
        return;
    }

    network_->get(QUrl(metadata_["url"].toString()));
    auto url = metadata_["url"].toString();
    auto *resource = new Qtil::NetworkResource(url, QUrl(url), true, this);
    connect(resource, &Qtil::NetworkResource::downloadProgress, this, &OcsUrlHandler::downloadProgress);
    connect(resource, &Qtil::NetworkResource::finished, this, &OcsUrlHandler::networkResourceFinished);
    resource->get();
    emit started();
}

bool XdgUrl::isValid()
bool OcsUrlHandler::isValid() const
{
    QString scheme = metadata_["scheme"].toString();
    QString command = metadata_["command"].toString();
@@ -50,74 +55,47 @@ bool XdgUrl::isValid()
    QString type = metadata_["type"].toString();
    QString filename = metadata_["filename"].toString();

    if ((scheme == "xdg" || scheme == "xdgs")
    if ((scheme == "ocs" || scheme == "ocss")
            && (command == "download" || command == "install")
            && QUrl(url).isValid()
            && destinations_.contains(type)
            && configHandler_->getAppConfigInstallTypes().contains(type)
            && !filename.isEmpty()) {
        return true;
    }

    return false;
}

void XdgUrl::openDestination()
{
    if (!destination_.isEmpty()) {
        QDesktopServices::openUrl(QUrl("file://" + destination_));
    }
}

QString XdgUrl::xdgUrl() const
{
    return xdgUrl_;
}

QJsonObject XdgUrl::metadata() const
void OcsUrlHandler::openDestination() const
{
    return metadata_;
    auto type = metadata_["type"].toString();
    QDesktopServices::openUrl(QUrl("file://" + configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString()));
}

void XdgUrl::downloaded(QNetworkReply *reply)
void OcsUrlHandler::networkResourceFinished(Qtil::NetworkResource *resource)
{
    if (reply->error() != QNetworkReply::NoError) {
    if (!resource->isFinishedWithNoError()) {
        QJsonObject result;
        result["status"] = QString("error_network");
        result["message"] = reply->errorString();
        emit error(result);
        return;
    }
    else if (reply->hasRawHeader("Location")) {
        QString redirectUrl = QString(reply->rawHeader("Location"));
        if (redirectUrl.startsWith("/")) {
            redirectUrl = reply->url().authority() + redirectUrl;
        }
        network_->get(QUrl(redirectUrl));
        return;
    }
    else if (reply->hasRawHeader("Refresh")) {
        QString refreshUrl = QString(reply->rawHeader("Refresh")).split("url=").last();
        if (refreshUrl.startsWith("/")) {
            refreshUrl = reply->url().authority() + refreshUrl;
        }
        network_->get(QUrl(refreshUrl));
        result["message"] = resource->reply()->errorString();
        emit finishedWithError(result);
        resource->deleteLater();
        return;
    }

    if (metadata_["command"].toString() == "download") {
        saveDownloadedFile(reply);
        saveDownloadedFile(resource);
    }
    else if (metadata_["command"].toString() == "install") {
        installDownloadedFile(reply);
        installDownloadedFile(resource);
    }
}

void XdgUrl::parse()
void OcsUrlHandler::parse()
{
    QUrl url(xdgUrl_);
    QUrl url(ocsUrl_);
    QUrlQuery query(url);

    metadata_["scheme"] = QString("xdg");
    metadata_["scheme"] = QString("ocs");
    metadata_["command"] = QString("download");
    metadata_["url"] = QString("");
    metadata_["type"] = QString("downloads");
@@ -148,139 +126,95 @@ void XdgUrl::parse()
    }
}

void XdgUrl::loadDestinations()
{
    QJsonObject configDestinations = config_->get("destinations");
    QJsonObject configDestinationsAlias = config_->get("destinations_alias");

    foreach (const QString key, configDestinations.keys()) {
        destinations_[key] = convertPathString(configDestinations[key].toString());
    }

    foreach (const QString key, configDestinationsAlias.keys()) {
        QString value = configDestinationsAlias[key].toString();
        if (destinations_.contains(value)) {
            destinations_[key] = destinations_.value(value);
        }
    }
}

QString XdgUrl::convertPathString(const QString &path)
{
    QString newPath = path;

    if (newPath.contains("$HOME")) {
        newPath.replace("$HOME", utils::File::homePath());
    }
    else if (newPath.contains("$XDG_DATA_HOME")) {
        newPath.replace("$XDG_DATA_HOME", utils::File::genericDataPath());
    }
    else if (newPath.contains("$KDEHOME")) {
        newPath.replace("$KDEHOME", utils::File::kdehomePath());
    }

    return newPath;
}

void XdgUrl::saveDownloadedFile(QNetworkReply *reply)
void OcsUrlHandler::saveDownloadedFile(Qtil::NetworkResource *resource)
{
    QJsonObject result;

    QTemporaryFile temporaryFile;
    auto type = metadata_["type"].toString();
    Qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString());
    destDir.make();
    Qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString());

    if (!temporaryFile.open() || temporaryFile.write(reply->readAll()) == -1) {
    if (!resource->saveData(destFile.path())) {
        result["status"] = QString("error_save");
        result["message"] = temporaryFile.errorString();
        emit error(result);
        result["message"] = tr("Failed to save data");
        emit finishedWithError(result);
        resource->deleteLater();
        return;
    }

    QString type = metadata_["type"].toString();
    QString destination = destinations_[type].toString();
    QString path = destination + "/" + metadata_["filename"].toString();

    utils::File::makeDir(destination);
    utils::File::remove(path); // Remove previous downloaded file

    if (!temporaryFile.copy(path)) {
        result["status"] = QString("error_save");
        result["message"] = temporaryFile.errorString();
        emit error(result);
        return;
    }

    destination_ = destination;

    result["status"] = QString("success_download");
    result["message"] = QString("The file has been stored into " + destination);
    emit finished(result);
    result["message"] = tr("The file has been downloaded");
    emit finishedWithSuccess(result);

    resource->deleteLater();
}

void XdgUrl::installDownloadedFile(QNetworkReply *reply)
void OcsUrlHandler::installDownloadedFile(Qtil::NetworkResource *resource)
{
    QJsonObject result;

    QTemporaryFile temporaryFile;
    Qtil::File tempFile(Qtil::Dir::tempPath() + "/" + metadata_["filename"].toString());

    if (!temporaryFile.open() || temporaryFile.write(reply->readAll()) == -1) {
    if (!resource->saveData(tempFile.path())) {
        result["status"] = QString("error_save");
        result["message"] = temporaryFile.errorString();
        emit error(result);
        result["message"] = tr("Failed to save data");
        emit finishedWithError(result);
        resource->deleteLater();
        return;
    }

    QString type = metadata_["type"].toString();
    QString destination = destinations_[type].toString();
    QString path = destination + "/" + metadata_["filename"].toString();

    utils::File::makeDir(destination);
    utils::File::remove(path); // Remove previous downloaded file
    Qtil::Package package(tempFile.path());
    auto type = metadata_["type"].toString();
    Qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString());
    destDir.make();
    Qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString());

    if (type == "bin"
            && utils::Package::installProgram(temporaryFile.fileName(), path)) {
        result["message"] = QString("The program has been installed into " + destination);
            && package.installAsProgram(destFile.path())) {
        result["message"] = tr("The file has been installed as program");
    }
    else if ((type == "plasma_plasmoids" || type == "plasma4_plasmoids" || type == "plasma5_plasmoids")
             && utils::Package::installPlasmapkg(temporaryFile.fileName(), "plasmoid")) {
        result["message"] = QString("The plasmoid has been installed");
             && package.installAsPlasmapkg("plasmoid")) {
        result["message"] = tr("The plasmoid has been installed");
    }
    else if ((type == "plasma_look_and_feel" || type == "plasma5_look_and_feel")
             && utils::Package::installPlasmapkg(temporaryFile.fileName(), "lookandfeel")) {
        result["message"] = QString("The plasma look and feel has been installed");
             && package.installAsPlasmapkg("lookandfeel")) {
        result["message"] = tr("The plasma look and feel has been installed");
    }
    else if ((type == "plasma_desktopthemes" || type == "plasma5_desktopthemes")
             && utils::Package::installPlasmapkg(temporaryFile.fileName(), "theme")) {
        result["message"] = QString("The plasma desktop theme has been installed");
             && package.installAsPlasmapkg("theme")) {
        result["message"] = tr("The plasma desktop theme has been installed");
    }
    else if (type == "kwin_effects"
             && utils::Package::installPlasmapkg(temporaryFile.fileName(), "kwineffect")) {
        result["message"] = QString("The KWin effect has been installed");
             && package.installAsPlasmapkg("kwineffect")) {
        result["message"] = tr("The KWin effect has been installed");
    }
    else if (type == "kwin_scripts"
             && utils::Package::installPlasmapkg(temporaryFile.fileName(), "kwinscript")) {
        result["message"] = QString("The KWin script has been installed");
             && package.installAsPlasmapkg("kwinscript")) {
        result["message"] = tr("The KWin script has been installed");
    }
    else if (type == "kwin_tabbox"
             && utils::Package::installPlasmapkg(temporaryFile.fileName(), "windowswitcher")) {
        result["message"] = QString("The KWin window switcher has been installed");
             && package.installAsPlasmapkg("windowswitcher")) {
        result["message"] = tr("The KWin window switcher has been installed");
    }
    else if (utils::Package::uncompressArchive(temporaryFile.fileName(), destination)) {
        result["message"] = QString("The archive file has been uncompressed into " + destination);
    else if (package.installAsArchive(destDir.path())) {
        result["message"] = tr("The archive file has been extracted");
    }
    else if (temporaryFile.copy(path)) {
        result["message"] = QString("The file has been stored into " + destination);
    else if (package.installAsFile(destFile.path())) {
        result["message"] = tr("The file has been installed");
    }
    else {
        result["status"] = QString("error_install");
        result["message"] = temporaryFile.errorString();
        emit error(result);
        result["message"] = tr("Failed to installation");
        emit finishedWithError(result);
        tempFile.remove();
        return;
    }

    destination_ = destination;

    result["status"] = QString("success_install");
    emit finished(result);
}
    emit finishedWithSuccess(result);

} // namespace handlers
    tempFile.remove();
    resource->deleteLater();
}
+44 −0
Original line number Diff line number Diff line
#pragma once

#include <QObject>
#include <QJsonObject>

namespace Qtil {
class NetworkResource;
}

class ConfigHandler;

class OcsUrlHandler : public QObject
{
    Q_OBJECT

public:
    explicit OcsUrlHandler(const QString &ocsUrl, ConfigHandler *configHandler, QObject *parent = nullptr);

signals:
    void started();
    void finishedWithSuccess(QJsonObject result);
    void finishedWithError(QJsonObject result);
    void downloadProgress(QString id, qint64 bytesReceived, qint64 bytesTotal);

public slots:
    QString ocsUrl() const;
    QJsonObject metadata() const;

    void process();
    bool isValid() const;
    void openDestination() const;

private slots:
    void networkResourceFinished(Qtil::NetworkResource *resource);

private:
    void parse();
    void saveDownloadedFile(Qtil::NetworkResource *resource);
    void installDownloadedFile(Qtil::NetworkResource *resource);

    QString ocsUrl_;
    ConfigHandler *configHandler_;
    QJsonObject metadata_;
};

app/src/main.cpp

0 → 100644
+61 −0
Original line number Diff line number Diff line
#include <QString>
#include <QStringList>
#include <QUrl>
#include <QJsonObject>
#include <QTranslator>
#include <QLocale>
#include <QCommandLineParser>
#include <QApplication>
#include <QIcon>
#include <QQmlApplicationEngine>
#include <QQmlContext>

#include "handlers/confighandler.h"
#include "handlers/ocsurlhandler.h"

int main(int argc, char *argv[])
{
    // Init
    QApplication app(argc, argv);

    auto *configHandler = new ConfigHandler();
    auto appConfigApplication = configHandler->getAppConfigApplication();

    app.setApplicationName(appConfigApplication["name"].toString());
    app.setApplicationVersion(appConfigApplication["version"].toString());
    app.setOrganizationName(appConfigApplication["organization"].toString());
    app.setOrganizationDomain(appConfigApplication["domain"].toString());
    app.setWindowIcon(QIcon::fromTheme(appConfigApplication["id"].toString(), QIcon(appConfigApplication["icon"].toString())));

    // Setup translator
    QTranslator translator;
    if (translator.load(QLocale(), "messages", ".", ":/i18n")) {
        app.installTranslator(&translator);
    }

    // Setup CLI
    QCommandLineParser clParser;
    clParser.setApplicationDescription(appConfigApplication["description"].toString());
    clParser.addHelpOption();
    clParser.addVersionOption();
    clParser.addPositionalArgument("OCS-URL", "OCS-URL that starts with ocs://");
    clParser.process(app);

    auto args = clParser.positionalArguments();

    if (args.size() != 1) {
        clParser.showHelp(1);
    }

    auto ocsUrl = QString(args.at(0));

    // Setup QML
    QQmlApplicationEngine qmlAppEngine;
    auto *qmlContext = qmlAppEngine.rootContext();
    configHandler->setParent(&qmlAppEngine);
    qmlContext->setContextProperty("configHandler", configHandler);
    qmlContext->setContextProperty("ocsUrlHandler", new OcsUrlHandler(ocsUrl, configHandler, &qmlAppEngine));
    qmlAppEngine.load(QUrl("qrc:/qml/main.qml"));

    return app.exec();
}
+2 −2
Original line number Diff line number Diff line
unix:!android {
unix:!ios:!android {
    isEmpty(PREFIX) {
        PREFIX = /usr/local
    }

    SRCDIR = src
    SRCDIR = $${PWD}
    BINDIR = $${PREFIX}/bin
    DATADIR = $${PREFIX}/share

desktop/desktop.pri

0 → 100644
+3 −0
Original line number Diff line number Diff line
RESOURCES += $${PWD}/desktop.qrc

DISTFILES += $${PWD}/ocs-url.desktop
Original line number Diff line number Diff line
[Desktop Entry]
Name=xdgurl
Exec=xdgurl %u
Icon=xdgurl
Name=ocs-url
Exec=ocs-url %u
Icon=ocs-url
Type=Application
Terminal=false
NoDisplay=true
Categories=Network;Utility;
MimeType=x-scheme-handler/xdg;x-scheme-handler/xdgs;
MimeType=x-scheme-handler/ocs;x-scheme-handler/ocss;

desktop/ocs-url.svg

0 → 100644
+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="1000" height="1000" viewBox="0, 0, 1000, 1000">
  <g id="icon">
    <g id="background">
      <path d="M975,500 C975,762.335 762.335,975 500,975 C237.665,975 25,762.335 25,500 C25,237.665 237.665,25 500,25 C762.335,25 975,237.665 975,500 z" fill="#19A2FF" id="background-2"/>
      <path d="M950,500 C950,748.528 748.528,950 500,950 C251.472,950 50,748.528 50,500 C50,251.472 251.472,50 500,50 C748.528,50 950,251.472 950,500 z" fill="#53B2FF" id="background-1"/>
    </g>
    <g id="ocs-url">
      <path d="M902.992,380.107 L924.992,380.107 L830.653,670.28 L808.653,670.28 z" fill="#FFFFFF" id="slash-2"/>
      <path d="M852.992,380.107 L874.992,380.107 L780.653,670.28 L758.653,670.28 z" fill="#FFFFFF" id="slash-1"/>
      <path d="M739.533,556.848 L775.533,556.848 L775.533,592.848 L739.533,592.848 z" fill="#FFFFFF" id="colon-2"/>
      <path d="M739.505,457.85 L775.505,457.85 L775.505,493.85 L739.505,493.85 z" fill="#FFFFFF" id="colon-1"/>
      <path d="M619.548,389.93 Q581.46,389.931 559.59,399.494 Q537.719,409.057 526.825,425.772 Q515.931,442.487 515.931,461.281 Q515.931,489.888 537.22,508.349 Q558.342,526.811 607.906,537.954 Q638.175,544.607 646.491,552.091 Q654.807,559.576 654.807,569.055 Q654.807,579.035 646.076,586.602 Q637.343,594.17 621.211,594.169 Q599.589,594.17 587.947,579.367 Q580.795,570.22 578.467,552.756 L506.784,557.247 Q509.943,594.17 533.893,618.12 Q557.843,642.07 620.047,642.069 Q655.472,642.07 678.757,631.84 Q702.041,621.612 715.014,601.82 Q727.987,582.029 727.987,558.577 Q727.987,538.619 718.258,522.486 Q708.528,506.354 687.156,495.459 Q665.784,484.566 616.388,473.921 Q596.429,469.764 591.108,464.94 Q585.618,460.283 585.619,454.462 Q585.618,446.479 592.272,440.907 Q598.924,435.336 612.063,435.335 Q628.03,435.336 637.094,442.819 Q646.158,450.304 648.986,466.77 L720.005,462.611 Q715.347,424.691 690.815,407.31 Q666.283,389.931 619.548,389.93 z" fill="#FFFFFF" id="s"/>
      <path d="M449.767,389.931 Q424.743,389.931 401.937,399.275 Q379.13,408.62 361.867,425.249 Q344.604,441.879 334.31,464.844 Q324.015,487.809 324.015,515.366 Q324.015,542.925 334.468,566.206 Q344.921,589.488 362.184,606.434 Q379.447,623.381 402.095,632.724 Q424.743,642.069 449.451,642.069 Q461.487,642.069 473.841,639.693 Q486.194,637.318 500.448,632.249 L506.784,630.032 L506.784,556.544 Q483.027,581.886 453.252,581.885 Q439.631,581.886 427.911,576.817 Q416.191,571.75 407.48,562.88 Q398.769,554.011 393.86,541.974 Q388.95,529.938 388.95,515.683 Q388.95,501.746 393.86,489.709 Q398.769,477.673 407.322,468.961 Q415.874,460.251 427.753,455.182 Q439.631,450.115 453.568,450.114 Q485.244,450.115 506.784,476.405 L506.784,402.284 Q491.579,395.95 477.8,392.94 Q464.021,389.931 449.767,389.931 z" fill="#FFFFFF" id="c"/>
      <path d="M223.997,389.93 Q252.822,389.932 277.212,399.591 Q301.602,409.254 319.183,426.357 Q336.762,443.463 346.582,466.427 Q356.401,489.393 356.402,515.999 Q356.401,542.608 346.582,565.572 Q336.762,588.538 319.183,605.641 Q301.602,622.748 277.212,632.407 Q252.822,642.07 223.997,642.068 Q194.855,642.07 170.624,632.407 Q146.392,622.748 128.97,605.641 Q111.548,588.538 101.729,565.572 Q91.91,542.608 91.91,515.999 Q91.91,489.393 101.729,466.427 Q111.548,443.463 128.97,426.357 Q146.392,409.254 170.624,399.591 Q194.855,389.932 223.997,389.93 z M223.997,450.114 Q210.377,450.115 198.182,455.024 Q185.986,459.935 176.801,468.803 Q167.614,477.673 162.23,489.709 Q156.845,501.747 156.845,515.999 Q156.845,530.255 162.23,542.29 Q167.614,554.328 176.801,563.196 Q185.986,572.067 198.182,576.975 Q210.377,581.886 223.997,581.885 Q237.618,581.886 249.813,576.975 Q262.008,572.067 271.352,563.196 Q280.697,554.328 286.082,542.29 Q291.466,530.255 291.466,515.999 Q291.466,501.747 286.082,489.709 Q280.697,477.673 271.352,468.803 Q262.008,459.935 249.813,455.024 Q237.618,450.115 223.997,450.114 z" fill="#FFFFFF" id="o"/>
    </g>
  </g>
</svg>

docs/How-to-install.md

0 → 100644
+57 −0
Original line number Diff line number Diff line
# How to install


## Install from package

Download Linux package from: https://www.opendesktop.org/p/1136805/

Then click the downloaded package and continue to installation with package manager.

Or install the downloaded package using terminal:

Ubuntu 14.04

    $ sudo apt install libqt5svg5 qtdeclarative5-qtquick2-plugin qtdeclarative5-window-plugin qtdeclarative5-controls-plugin
    $ sudo dpkg -i /path/to/ocs-url*.deb

Ubuntu 16.04

    $ sudo apt install libqt5svg5 qml-module-qtquick-controls
    $ sudo dpkg -i /path/to/ocs-url*.deb

Fedora 20

    # yum insall qt5-qtbase qt5-qtbase-gui qt5-qtsvg qt5-qtdeclarative qt5-qtquickcontrols
    # rpm -i /path/to/ocs-url*.rpm

Fedora 22

    # dnf insall qt5-qtbase qt5-qtbase-gui qt5-qtsvg qt5-qtdeclarative qt5-qtquickcontrols
    # rpm -i /path/to/ocs-url*.rpm

openSUSE 42.1

    # zypper install libQt5Svg5 libqt5-qtquickcontrols
    # rpm -i /path/to/ocs-url*.rpm

Arch Linux

    # pacman -S qt5-base qt5-svg qt5-declarative qt5-quickcontrols
    # pacman -U /path/to/ocs-url*.pkg.tar.xz


## Install from source

Make git clone, or download the source archive and extract it.

Build and install

    $ cd /path/to/ocs-url
    $ ./scripts/prepare
    $ qmake PREFIX=/usr
    $ make
    $ sudo make install

Uninstall

    $ sudo make uninstall

docs/How-to-use.md

0 → 100644
+19 −0
Original line number Diff line number Diff line
# How to use


## Web browser

Just click a OCS-URL (ocs://) links, or type OCS-URL in browser's address bar.

If you use Firefox, a program selection window opens the first time you open OCS-URL,
and you can choose "ocs-url" as custom URL handler.

If you don't get the program selection window or you are using another browser,
please set the ocs-url program as custom URL handler for ocs:// scheme in the browser's settings.


## Command-line

Execute ocs-url program with argument OCS-URL.

    $ ocs-url "ocs://install?url=http%3A%2F%2Fexample.com%2Ficons.tar.gz&type=icons"
+28 −0
Original line number Diff line number Diff line
# Internationalization

ocs-url/i18n/ is sub project for program internationalization.


## Localization for program

Using two tools lupdate and lrelease to make translation.

Text is gathered from program source files and included in QM files for translation along with other resource files.

### Creating TS (Translation Source) files

To generate TS files, sets TS file name to definition TRANSLATIONS in i18n.pro and run lupdate with i18n.pro.

    $ cd /path/to/ocs-url/i18n/
    $ lupdate i18n.pro

Then adds translations to the generated TS files using Qt Linguist or text editor.

### Creating QM (Qt Message) files

To generate QM files, run lrelease with i18n.pro.

    $ cd /path/to/ocs-url/i18n/
    $ lrelease i18n.pro

Then adds the path of the generated QM files to i18n.qrc.
+113 −0
Original line number Diff line number Diff line
# OCS-URL specification

OCS-URL is a custom URL that represent the installation method of items served on OpenCollaborationServices (OCS).


## URL structure

    [scheme]://[command]?[query string]

For example:

    ocs://install?url=http%3A%2F%2Fexample.com%2Ficons.tar.gz&type=icons


## Scheme

Scheme | Description
-------|------------
ocs | ocs scheme
ocss | ocs scheme for secure protocol

"ocss" scheme is the same of the ocs scheme for now,
it's a reserved name for secure protocol in the future.


## Command

Command | Description
--------|------------
download | Download the file from specified URL to the installation destination of specified install-type.
install | Make file downloading and trigger installation process.


## Query string

OCS-URL's query string is an option of command.

*All query string values should be urlencoded.*

Parameter | Required | Default | Description
----------|----------|---------|------------
url | Yes | - | File URL
type | - | downloads | Install-type
filename | - | File name from URL | Alternative file name

"filename" option is useful if the file URL does not represent a file name.

### Install-type

Available install-type:

Install-type | Installation destination
-------------|------------------
bin | $HOME/.local/bin
downloads | $HOME/Downloads
documents | $HOME/Documents
pictures | $HOME/Pictures
music | $HOME/Music
videos | $HOME/Videos
wallpapers | $XDG_DATA_HOME/wallpapers
fonts | $HOME/.fonts
cursors | $HOME/.icons
icons | $XDG_DATA_HOME/icons
emoticons | $XDG_DATA_HOME/emoticons
themes | $HOME/.themes
emerald_themes | $HOME/.emerald/themes
enlightenment_themes | $HOME/.e/e/themes
enlightenment_backgrounds | $HOME/.e/e/backgrounds
fluxbox_styles | $HOME/.fluxbox/styles
pekwm_themes | $HOME/.pekwm/themes
icewm_themes | $HOME/.icewm/themes
plasma_plasmoids | $XDG_DATA_HOME/plasma/plasmoids
plasma_look_and_feel | $XDG_DATA_HOME/plasma/look-and-feel
plasma_desktopthemes | $XDG_DATA_HOME/plasma/desktoptheme
kwin_effects | $XDG_DATA_HOME/kwin/effects
kwin_scripts | $XDG_DATA_HOME/kwin/scripts
kwin_tabbox | $XDG_DATA_HOME/kwin/tabbox
aurorae_themes | $XDG_DATA_HOME/aurorae/themes
dekorator_themes | $XDG_DATA_HOME/deKorator/themes
qtcurve | $XDG_DATA_HOME/QtCurve
color_schemes | $XDG_DATA_HOME/color-schemes
gnome_shell_extensions | $XDG_DATA_HOME/gnome-shell/extensions
cinnamon_applets | $XDG_DATA_HOME/cinnamon/applets
cinnamon_desklets | $XDG_DATA_HOME/cinnamon/desklets
cinnamon_extensions | $XDG_DATA_HOME/cinnamon/extensions
nautilus_scripts | $XDG_DATA_HOME/nautilus/scripts
amarok_scripts | $KDEHOME/share/apps/amarok/scripts
yakuake_skins | $KDEHOME/share/apps/yakuake/skins
cairo_clock_themes | $HOME/.cairo-clock/themes
books | $APP_DATA/books
comics | $APP_DATA/comics

$APP_DATA is not environment variable, it's internal variable in the program and expressed to $XDG_DATA_HOME/{application ID or name}.

Available alias name of the install-type:

Alias | Install-type
------|-------------
gnome_shell_themes | themes
cinnamon_themes | themes
gtk2_themes | themes
gtk3_themes | themes
metacity_themes | themes
xfwm4_themes | themes
openbox_themes | themes
kvantum_themes | themes
compiz_themes | emerald_themes
beryl_themes | emerald_themes
plasma4_plasmoids | plasma_plasmoids
plasma5_plasmoids | plasma_plasmoids
plasma5_look_and_feel | plasma_look_and_feel
plasma5_desktopthemes | plasma_desktopthemes
plasma_color_schemes | color_schemes

i18n/i18n.pri

0 → 100644
+1 −0
Original line number Diff line number Diff line
RESOURCES += $${PWD}/i18n.qrc

i18n/i18n.pro

0 → 100644
+10 −0
Original line number Diff line number Diff line
SOURCES += $$system(find $${PWD}/../app -type f -name "*.cpp" -or -name "*.qml" -or -name "*.js")

TRANSLATIONS += \
    $${PWD}/messages.ts \
    $${PWD}/messages.en_US.ts \
    $${PWD}/messages.ja_JP.ts \
    $${PWD}/messages.tr_TR.ts \
    $${PWD}/messages.zh_TW.ts

include($${PWD}/i18n.pri)

i18n/i18n.qrc

0 → 100644
+9 −0
Original line number Diff line number Diff line
<RCC>
    <qresource prefix="/i18n">
        <file>messages.qm</file>
        <file>messages.en_US.qm</file>
        <file>messages.ja_JP.qm</file>
        <file>messages.tr_TR.qm</file>
        <file>messages.zh_TW.qm</file>
    </qresource>
</RCC>

i18n/messages.en_US.ts

0 → 100644
+170 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
    <name>OcsUrlHandler</name>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="37"/>
        <source>Invalid OCS-URL</source>
        <translation>Invalid OCS-URL</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="141"/>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="162"/>
        <source>Failed to save data</source>
        <translation>Failed to save data</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="148"/>
        <source>The file has been downloaded</source>
        <translation>The file has been downloaded</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="176"/>
        <source>The file has been installed as program</source>
        <translation>The file has been installed as program</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="180"/>
        <source>The plasmoid has been installed</source>
        <translation>The plasmoid has been installed</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="184"/>
        <source>The plasma look and feel has been installed</source>
        <translation>The plasma look and feel has been installed</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="188"/>
        <source>The plasma desktop theme has been installed</source>
        <translation>The plasma desktop theme has been installed</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="192"/>
        <source>The KWin effect has been installed</source>
        <translation>The KWin effect has been installed</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="196"/>
        <source>The KWin script has been installed</source>
        <translation>The KWin script has been installed</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="200"/>
        <source>The KWin window switcher has been installed</source>
        <translation>The KWin window switcher has been installed</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="203"/>
        <source>The archive file has been extracted</source>
        <translation>The archive file has been extracted</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="206"/>
        <source>The file has been installed</source>
        <translation>The file has been installed</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="210"/>
        <source>Failed to installation</source>
        <translation>Failed to installation</translation>
    </message>
</context>
<context>
    <name>main</name>
    <message>
        <location filename="../app/qml/main.qml" line="26"/>
        <source>Download successful</source>
        <translation>Download successful</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="27"/>
        <source>Installation successful</source>
        <translation>Installation successful</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="28"/>
        <source>Validation error</source>
        <translation>Validation error</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="29"/>
        <source>Network error</source>
        <translation>Network error</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="30"/>
        <source>Saving file failed</source>
        <translation>Saving file failed</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="31"/>
        <source>Installation failed</source>
        <translation>Installation failed</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="56"/>
        <source>Downloading</source>
        <translation>Downloading</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="66"/>
        <source>Do you want to download?</source>
        <translation>Do you want to download?</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="69"/>
        <source>Do you want to install?</source>
        <translation>Do you want to install?</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="73"/>
        <source>URL</source>
        <translation>URL</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="74"/>
        <source>File</source>
        <translation>File</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="75"/>
        <source>Type</source>
        <translation>Type</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="80"/>
        <source>Invalid OCS-URL</source>
        <translation>Invalid OCS-URL</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="96"/>
        <location filename="../app/qml/main.qml" line="109"/>
        <location filename="../app/qml/main.qml" line="125"/>
        <source>Details</source>
        <translation>Details</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="98"/>
        <source>OK</source>
        <translation>OK</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="100"/>
        <location filename="../app/qml/main.qml" line="160"/>
        <source>Cancel</source>
        <translation>Cancel</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="111"/>
        <source>Open</source>
        <translation>Open</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="116"/>
        <location filename="../app/qml/main.qml" line="127"/>
        <source>Close</source>
        <translation>Close</translation>
    </message>
</context>
</TS>

i18n/messages.ja_JP.ts

0 → 100644
+170 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ja_JP">
<context>
    <name>OcsUrlHandler</name>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="37"/>
        <source>Invalid OCS-URL</source>
        <translation>無効なOCS-URL</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="141"/>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="162"/>
        <source>Failed to save data</source>
        <translation>ファイルの保存に失敗</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="148"/>
        <source>The file has been downloaded</source>
        <translation>ファイルがダウンロードされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="176"/>
        <source>The file has been installed as program</source>
        <translation>ファイルがプログラムとしてインストールされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="180"/>
        <source>The plasmoid has been installed</source>
        <translation>plasmoidがインストールされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="184"/>
        <source>The plasma look and feel has been installed</source>
        <translation>plasma look and feelがインストールされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="188"/>
        <source>The plasma desktop theme has been installed</source>
        <translation>plasma desktop themeがインストールされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="192"/>
        <source>The KWin effect has been installed</source>
        <translation>KWin effectがインストールされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="196"/>
        <source>The KWin script has been installed</source>
        <translation>KWin scriptがインストールされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="200"/>
        <source>The KWin window switcher has been installed</source>
        <translation>KWin window switcherがインストールされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="203"/>
        <source>The archive file has been extracted</source>
        <translation>圧縮ファイルが展開されました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="206"/>
        <source>The file has been installed</source>
        <translation>ファイルがインストールされました</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="210"/>
        <source>Failed to installation</source>
        <translation>インストールに失敗</translation>
    </message>
</context>
<context>
    <name>main</name>
    <message>
        <location filename="../app/qml/main.qml" line="26"/>
        <source>Download successful</source>
        <translation>ダウンロード成功</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="27"/>
        <source>Installation successful</source>
        <translation>インストール成功</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="28"/>
        <source>Validation error</source>
        <translation>検証エラー</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="29"/>
        <source>Network error</source>
        <translation>通信エラー</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="30"/>
        <source>Saving file failed</source>
        <translation>ファイル保存失敗</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="31"/>
        <source>Installation failed</source>
        <translation>インストール失敗</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="56"/>
        <source>Downloading</source>
        <translation>ダウンロード中</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="66"/>
        <source>Do you want to download?</source>
        <translation>ダウンロードしますか?</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="69"/>
        <source>Do you want to install?</source>
        <translation>インストールしますか?</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="73"/>
        <source>URL</source>
        <translation>URL</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="74"/>
        <source>File</source>
        <translation>ファイル</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="75"/>
        <source>Type</source>
        <translation>タイプ</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="80"/>
        <source>Invalid OCS-URL</source>
        <translation>無効なOCS-URL</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="96"/>
        <location filename="../app/qml/main.qml" line="109"/>
        <location filename="../app/qml/main.qml" line="125"/>
        <source>Details</source>
        <translation>詳細</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="98"/>
        <source>OK</source>
        <translation>OK</translation>
    </message>
    <message>