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
  • akiraohgaki / ocs-url
  • ab3875o / ocs-url
  • dembego3 / ocs-url
  • arakun / ocs-url
  • longviauroy / ocs-url
  • rolfen / ocs-url
  • hemm / ocs-url
  • simonsvw0000 / ocs-url
  • DFN2 / ocs-url
  • rws77 / ocs-url
  • bitwalk / ocs-url
  • visdom / ocs-url
  • ricatfarker / ocs-url
  • mussah / ocs-url
  • tigefa / ocs-url
  • cobalt2727 / ocs-url
  • ammark226 / ocs-url
  • violethaze74 / ocs-url
  • armedssault / ocs-url
  • billflick / ocs-url
20 results
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
84 files
+ 2696
1641
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

.travis.yml

deleted100644 → 0
+0 −26
Original line number Diff line number Diff line
language: cpp
sudo: required
dist: trusty

before_install:
  - sudo add-apt-repository -y ppa:beineri/opt-qt57-trusty
  - sudo apt-get update -qq

install:
  - sudo apt-get -y install build-essential fuse zsync desktop-file-utils
  - sudo apt-get -y install qt57base qt57svg qt57quickcontrols qt57quickcontrols2
  # Replace linuxdeployqt download URL to official download URL when the stable version released
  - curl -L -o linuxdeployqt https://dl.dropboxusercontent.com/u/150776/temp/linuxdeployqt-799f704-x86-64.appimage
  - sudo install -m 755 -p linuxdeployqt /usr/local/bin/linuxdeployqt
  - rm linuxdeployqt

before_script:
  - sudo modprobe fuse
  - source /opt/qt57/bin/qt57-env.sh

script:
  - sh ./pkg/build.sh appimage

after_script:
  - appimage_file="$(ls ./pkg/build/*.AppImage)"
  - [ -f "${appimage_file}" ] && curl -T "${appimage_file}" "https://transfer.sh/${appimage_file}"
+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 = $${PWD}/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>
        <location filename="../app/qml/main.qml" line="100"/>
        <location filename="../app/qml/main.qml" line="160"/>
        <source>Cancel</source>
        <translation>キャンセル</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="111"/>
        <source>Open</source>
        <translation>開く</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="116"/>
        <location filename="../app/qml/main.qml" line="127"/>
        <source>Close</source>
        <translation>閉じる</translation>
    </message>
</context>
</TS>

i18n/messages.qm

0 → 100644
+1 −0
Original line number Diff line number Diff line
<d!`
 No newline at end of file

i18n/messages.tr_TR.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="tr_TR">
<context>
    <name>OcsUrlHandler</name>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="37"/>
        <source>Invalid OCS-URL</source>
        <translation>Geçersiz 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>Veri kaydedilemedi</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="148"/>
        <source>The file has been downloaded</source>
        <translation>Dosya indirildi</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="176"/>
        <source>The file has been installed as program</source>
        <translation>Dosya program olarak kuruldu</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="180"/>
        <source>The plasmoid has been installed</source>
        <translation>Plasmoid kuruldu</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="184"/>
        <source>The plasma look and feel has been installed</source>
        <translation>Plasma görünüş ve işleyişi kuruldu</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="188"/>
        <source>The plasma desktop theme has been installed</source>
        <translation>Plasma masaüstü teması kuruldu</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="192"/>
        <source>The KWin effect has been installed</source>
        <translation>KWin efekti kuruldu</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="196"/>
        <source>The KWin script has been installed</source>
        <translation>KWin betiği kuruldu</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="200"/>
        <source>The KWin window switcher has been installed</source>
        <translation>KWin pencere seçicisi kuruldu</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="203"/>
        <source>The archive file has been extracted</source>
        <translation>Arşiv açıldı</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="206"/>
        <source>The file has been installed</source>
        <translation>Dosya kuruldu</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="210"/>
        <source>Failed to installation</source>
        <translation>Kurulum başarısız oldu</translation>
    </message>
</context>
<context>
    <name>main</name>
    <message>
        <location filename="../app/qml/main.qml" line="26"/>
        <source>Download successful</source>
        <translation>Başarıyla indirildi</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="27"/>
        <source>Installation successful</source>
        <translation>Başarıyla kuruldu</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="28"/>
        <source>Validation error</source>
        <translation>Doğrulama hatası</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="29"/>
        <source>Network error</source>
        <translation> hatası</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="30"/>
        <source>Saving file failed</source>
        <translation>Dosya kaydedilemedi</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="31"/>
        <source>Installation failed</source>
        <translation>Kurulum başarısız oldu</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="56"/>
        <source>Downloading</source>
        <translation>İndiriliyor</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="66"/>
        <source>Do you want to download?</source>
        <translation>İndirmek istiyor musunuz?</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="69"/>
        <source>Do you want to install?</source>
        <translation>Kurmak istiyor musunuz?</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="73"/>
        <source>URL</source>
        <translation>Bağlantı Adresi</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="74"/>
        <source>File</source>
        <translation>Dosya</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="75"/>
        <source>Type</source>
        <translation>Tür</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="80"/>
        <source>Invalid OCS-URL</source>
        <translation>Geçersiz 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>Ayrıntılar</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="98"/>
        <source>OK</source>
        <translation>Tamam</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="100"/>
        <location filename="../app/qml/main.qml" line="160"/>
        <source>Cancel</source>
        <translation>İptal</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="111"/>
        <source>Open</source>
        <translation></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="116"/>
        <location filename="../app/qml/main.qml" line="127"/>
        <source>Close</source>
        <translation>Kapat</translation>
    </message>
</context>
</TS>

i18n/messages.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">
<context>
    <name>OcsUrlHandler</name>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="37"/>
        <source>Invalid OCS-URL</source>
        <translation type="unfinished"></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 type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="148"/>
        <source>The file has been downloaded</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="176"/>
        <source>The file has been installed as program</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="180"/>
        <source>The plasmoid has been installed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="184"/>
        <source>The plasma look and feel has been installed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="188"/>
        <source>The plasma desktop theme has been installed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="192"/>
        <source>The KWin effect has been installed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="196"/>
        <source>The KWin script has been installed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="200"/>
        <source>The KWin window switcher has been installed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="203"/>
        <source>The archive file has been extracted</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="206"/>
        <source>The file has been installed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="210"/>
        <source>Failed to installation</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>main</name>
    <message>
        <location filename="../app/qml/main.qml" line="26"/>
        <source>Download successful</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="27"/>
        <source>Installation successful</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="28"/>
        <source>Validation error</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="29"/>
        <source>Network error</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="30"/>
        <source>Saving file failed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="31"/>
        <source>Installation failed</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="56"/>
        <source>Downloading</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="66"/>
        <source>Do you want to download?</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="69"/>
        <source>Do you want to install?</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="73"/>
        <source>URL</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="74"/>
        <source>File</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="75"/>
        <source>Type</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="80"/>
        <source>Invalid OCS-URL</source>
        <translation type="unfinished"></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 type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="98"/>
        <source>OK</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="100"/>
        <location filename="../app/qml/main.qml" line="160"/>
        <source>Cancel</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="111"/>
        <source>Open</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="116"/>
        <location filename="../app/qml/main.qml" line="127"/>
        <source>Close</source>
        <translation type="unfinished"></translation>
    </message>
</context>
</TS>

i18n/messages.zh_TW.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="zh_TW">
<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 外觀與感覺已被安裝</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="188"/>
        <source>The plasma desktop theme has been installed</source>
        <translation>Plasma 桌面主題已被安裝</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="192"/>
        <source>The KWin effect has been installed</source>
        <translation>KWin 特效已被安裝</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="196"/>
        <source>The KWin script has been installed</source>
        <translation>KWin 指令稿已被安裝</translation>
    </message>
    <message>
        <location filename="../app/src/handlers/ocsurlhandler.cpp" line="200"/>
        <source>The KWin window switcher has been installed</source>
        <translation>KWin 視窗切換器已被安裝</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>確定</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="100"/>
        <location filename="../app/qml/main.qml" line="160"/>
        <source>Cancel</source>
        <translation>取消</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="111"/>
        <source>Open</source>
        <translation>開啟</translation>
    </message>
    <message>
        <location filename="../app/qml/main.qml" line="116"/>
        <location filename="../app/qml/main.qml" line="127"/>
        <source>Close</source>
        <translation>關閉</translation>
    </message>
</context>
</TS>

lib/lib.pri

0 → 100644
+1 −0
Original line number Diff line number Diff line
include($${PWD}/qtil/qtil.pri)

ocs-url.pro

0 → 100644
+15 −0
Original line number Diff line number Diff line
TARGET = ocs-url

TEMPLATE = app

DEFINES += QT_DEPRECATED_WARNINGS

DISTFILES += $${PWD}/README.md

include($${PWD}/lib/lib.pri)
include($${PWD}/app/app.pri)
include($${PWD}/desktop/desktop.pri)
include($${PWD}/i18n/i18n.pri)
include($${PWD}/pkg/pkg.pri)
include($${PWD}/scripts/scripts.pri)
include($${PWD}/deployment.pri)
Original line number Diff line number Diff line
# Maintainer: Akira Ohgaki <akiraohgaki@gmail.com>

pkgname='xdgurl'
pkgver='2.0.0'
pkgname='ocs-url'
pkgver='3.1.0'
pkgrel='1'
pkgdesc='An install helper program for desktop stuff.'
pkgdesc='An install helper program for items served via OpenCollaborationServices (ocs://).'
arch=('i686' 'x86_64')
url='https://github.com/xdgurl/xdgurl'
url='https://git.opendesktop.org/akiraohgaki/ocs-url'
license=('GPL3')
depends=('qt5-base>=5.3.0' 'qt5-svg>=5.3.0' 'qt5-declarative>=5.3.0' 'qt5-quickcontrols>=5.3.0')
#source=("https://github.com/xdgurl/xdgurl/archive/release-${pkgver}.tar.gz")
depends=('qt5-base>=5.2.0' 'qt5-svg>=5.2.0' 'qt5-declarative>=5.2.0' 'qt5-quickcontrols>=5.2.0')
makedepends=('git')
#source=("https://git.opendesktop.org/akiraohgaki/ocs-url/-/archive/release-${pkgver}/ocs-url-release-${pkgver}.tar.gz")
source=("${pkgname}.tar.gz")
md5sums=() #autofill using updpkgsums

prepare() {
    #cd "${pkgname}-release-${pkgver}"
    cd "${pkgname}"
    ./scripts/prepare
}

build() {
    #cd "${pkgname}-release-${pkgver}"
    cd "${pkgname}"
    qmake PREFIX='/usr'
    qmake PREFIX=/usr
    make
}

pkg/build.sh

deleted100644 → 0
+0 −121
Original line number Diff line number Diff line
#!/bin/bash

PKGNAME='xdgurl'

PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"

BUILDDIR="${PROJDIR}/pkg/build"

BUILDTYPE=''
if [ "${1}" ]; then
    BUILDTYPE="${1}"
fi

TREEISH='HEAD'
if [ "${2}" ]; then
    TREEISH="${2}"
fi

export_source() {
    destdir="${BUILDDIR}"
    if [ "${1}" ]; then
        destdir="${1}"
    fi
    $(cd "${PROJDIR}" && git archive --prefix="${PKGNAME}/" --output="${destdir}/${PKGNAME}.tar.gz" "${TREEISH}")
}

build_ubuntu() {
    #sudo apt install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev devscripts debhelper fakeroot

    cd "${PROJDIR}"

    mkdir -p "${BUILDDIR}"
    export_source "${BUILDDIR}"
    tar -xzvf "${BUILDDIR}/${PKGNAME}.tar.gz" -C "${BUILDDIR}"
    cp -r "${PROJDIR}/pkg/ubuntu/debian" "${BUILDDIR}/${PKGNAME}"

    cd "${BUILDDIR}/${PKGNAME}"
    debuild -uc -us -b
}

build_fedora() {
    #sudo dnf install make automake gcc gcc-c++ libtool qt5-qtbase-devel qt5-qtsvg-devel qt5-qtdeclarative-devel rpm-build

    cd "${PROJDIR}"

    mkdir -p "${BUILDDIR}"
    mkdir "${BUILDDIR}/SOURCES"
    mkdir "${BUILDDIR}/SPECS"
    export_source "${BUILDDIR}/SOURCES"
    cp "${PROJDIR}/pkg/fedora/xdgurl.spec" "${BUILDDIR}/SPECS"

    rpmbuild --define "_topdir ${BUILDDIR}" -bb "${BUILDDIR}/SPECS/xdgurl.spec"
}

build_arch() {
    #sudo pacman -S base-devel qt5-base qt5-svg qt5-declarative qt5-quickcontrols

    cd "${PROJDIR}"

    mkdir -p "${BUILDDIR}"
    export_source "${BUILDDIR}"
    cp "${PROJDIR}/pkg/arch/PKGBUILD" "${BUILDDIR}"

    cd "${BUILDDIR}"
    updpkgsums
    makepkg -s
}

build_appimage() {
    #sudo add-apt-repository ppa:beineri/opt-qt57-xenial
    #sudo apt update

    #sudo apt install build-essential fuse zsync desktop-file-utils
    #sudo apt install qt57base qt57svg qt57quickcontrols qt57quickcontrols2
    # Replace linuxdeployqt download URL to official download URL when the stable version released
    #curl -L -o linuxdeployqt https://dl.dropboxusercontent.com/u/150776/temp/linuxdeployqt-799f704-x86-64.appimage
    #sudo install -m 755 -p linuxdeployqt /usr/local/bin/linuxdeployqt

    #sudo modprobe fuse
    #source /opt/qt57/bin/qt57-env.sh

    cd "${PROJDIR}"

    export VERSION="$(git describe --always)"
    mkdir -p "${BUILDDIR}"
    export_source "${BUILDDIR}"
    tar -xzvf "${BUILDDIR}/${PKGNAME}.tar.gz" -C "${BUILDDIR}"

    cd "${BUILDDIR}/${PKGNAME}"
    #qmake
    /opt/qt57/bin/qmake
    make
    strip ./xdgurl

    cd "${BUILDDIR}"
    mkdir -p "${BUILDDIR}/${PKGNAME}.AppDir/usr/bin"
    install -m 755 -p "${BUILDDIR}/${PKGNAME}/xdgurl" "${BUILDDIR}/${PKGNAME}.AppDir/xdgurl"
    install -m 644 -p "${BUILDDIR}/${PKGNAME}/src/desktop/xdgurl.desktop" "${BUILDDIR}/${PKGNAME}.AppDir/xdgurl.desktop"
    install -m 644 -p "${BUILDDIR}/${PKGNAME}/src/desktop/xdgurl.svg" "${BUILDDIR}/${PKGNAME}.AppDir/xdgurl.svg"
    install -m 755 -p /usr/bin/update-desktop-database "${BUILDDIR}/${PKGNAME}.AppDir/usr/bin/update-desktop-database"
    install -m 755 -p /usr/bin/desktop-file-validate "${BUILDDIR}/${PKGNAME}.AppDir/usr/bin/desktop-file-validate"
    install -m 755 -p /usr/bin/desktop-file-install "${BUILDDIR}/${PKGNAME}.AppDir/usr/bin/desktop-file-install"
    linuxdeployqt "${BUILDDIR}/${PKGNAME}.AppDir/xdgurl" -qmldir="${BUILDDIR}/${PKGNAME}/src/app/qml" -verbose=2 -bundle-non-qt-libs # https://github.com/probonopd/linuxdeployqt/issues/25
    linuxdeployqt "${BUILDDIR}/${PKGNAME}.AppDir/xdgurl" -qmldir="${BUILDDIR}/${PKGNAME}/src/app/qml" -verbose=2 -bundle-non-qt-libs # twice because of #25
    rm "${BUILDDIR}/${PKGNAME}.AppDir/AppRun"
    install -m 755 -p "${BUILDDIR}/${PKGNAME}/src/desktop/appimage-desktopintegration" "${BUILDDIR}/${PKGNAME}.AppDir/AppRun"
    linuxdeployqt --appimage-extract
    ./squashfs-root/usr/bin/appimagetool "${BUILDDIR}/${PKGNAME}.AppDir"
}

if [ "${BUILDTYPE}" = 'ubuntu' ]; then
    build_ubuntu
elif [ "${BUILDTYPE}" = 'fedora' ]; then
    build_fedora
elif [ "${BUILDTYPE}" = 'arch' ]; then
    build_arch
elif [ "${BUILDTYPE}" = 'appimage' ]; then
    build_appimage
else
    echo "sh $(basename "${0}") [ubuntu|fedora|arch|appimage] [tree_ish]"
fi
+94 −0
Original line number Diff line number Diff line
Summary: OCS-URL
Name: ocs-url
Version: 3.1.0
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Internet
URL: https://git.opendesktop.org/akiraohgaki/ocs-url

#Source0: https://git.opendesktop.org/akiraohgaki/ocs-url/-/archive/release-%{version}/ocs-url-release-%{version}.tar.gz
Source0: %{name}.tar.gz

Requires: qt5-qtbase >= 5.2.0, qt5-qtbase-gui >= 5.2.0, qt5-qtsvg >= 5.2.0, qt5-qtdeclarative >= 5.2.0, qt5-qtquickcontrols >= 5.2.0
BuildRequires: git, make, automake, gcc, gcc-c++, libtool, qt5-qtbase-devel >= 5.2.0, qt5-qtsvg-devel >= 5.2.0, qt5-qtdeclarative-devel >= 5.2.0, rpm-build

%description
An install helper program for items served via OpenCollaborationServices (ocs://).

%prep
#%%autosetup -n %{name}-release-%{version}
%autosetup -n %{name}
./scripts/prepare

%build
%define debug_package %{nil}
qmake-qt5 PREFIX=/usr
make

%install
make INSTALL_ROOT="%{buildroot}" install

%files
%defattr(-,root,root)
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%clean
rm -rf %{buildroot}

%changelog
* Thu Jul 05 2018 Akira Ohgaki <akiraohgaki@gmail.com> - 3.1.0-1
- Drop old xdg:// and xdgs:// schemes
- Update library

* Tue Feb 06 2018 Akira Ohgaki <akiraohgaki@gmail.com> - 3.0.3-1
- Update library
- Fix spelling

* Fri Jun 23 2017 Akira Ohgaki <akiraohgaki@gmail.com> - 3.0.2-1
- Add zh_TW translations (by s8321414)

* Mon Jun 05 2017 Akira Ohgaki <akiraohgaki@gmail.com> - 3.0.1-1
- Update qtlib
- Fix for C++11
- Fix installation/download destination
- Fix translation messages (by otsoga)

* Sun Mar 05 2017 Akira Ohgaki <akiraohgaki@gmail.com> - 3.0.0-1
- Rename xdgurl to ocs-url
- Add ocs:// and ocss:// schemes
- xdg:// and xdgs:// schemes still available for backward compatibile
- New app icon
- New dialog window
- Labels and messages are translatable
- Qt 5.2 support
- Use the same configs of install-types with ocsstore
- Add en_US translation
- Add ja_JP translation
- Add tr_TR translation (by tarakbumba)

* Wed Jan 25 2017 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.3-1
- Change installation destination of type bin
- Update qtlib
- Fix for dialog

* Thu Nov 17 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.2-1
- Update qtlibs
- Small fix

* Mon Nov 14 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.1-1
- Update library
- Fix download/installation process

* Fri Oct 28 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.0-1
- Re-implemented xdgurl as Qt program
- Download progress bar
- Add install-type "bin"

* Fri Jul 15 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 1.0.1-1
- Clean successful message
- Return exit code

* Wed Jul 06 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 1.0.0-1
- Initial release

pkg/fedora/xdgurl.spec

deleted100644 → 0
+0 −50
Original line number Diff line number Diff line
Summary: An install helper program for desktop stuff
Name: xdgurl
Version: 2.0.0
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Internet
URL: https://github.com/xdgurl/xdgurl

#Source0: https://github.com/xdgurl/xdgurl/archive/release-%{version}.tar.gz
Source0: %{name}.tar.gz

Requires: qt5-qtbase >= 5.3.0, qt5-qtbase-gui >= 5.3.0, qt5-qtsvg >= 5.3.0, qt5-qtdeclarative >= 5.3.0, qt5-qtquickcontrols >= 5.3.0
BuildRequires: make, automake, gcc, gcc-c++, libtool, qt5-qtbase-devel, qt5-qtsvg-devel, qt5-qtdeclarative-devel, rpm-build

%description
An install helper program for desktop stuff.

%prep
#%%autosetup -n %{name}-release-%{version}
%autosetup -n %{name}

%build
%define debug_package %{nil}
qmake-qt5 PREFIX='/usr'
make

%install
make INSTALL_ROOT="%{buildroot}" install

%files
%defattr(-,root,root)
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%clean
rm -rf %{buildroot}

%changelog
* Fri Oct 28 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.0-1
- Re-implemented xdgurl as Qt program
- Download progress bar
- Add install-type "bin"

* Fri Jul 15 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 1.0.1-1
- Clean successfull message
- Return exit code

* Wed Jul 06 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 1.0.0-1
- Initial release
+94 −0
Original line number Diff line number Diff line
Summary: OCS-URL
Name: ocs-url
Version: 3.1.0
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Internet
URL: https://git.opendesktop.org/akiraohgaki/ocs-url

#Source0: https://git.opendesktop.org/akiraohgaki/ocs-url/-/archive/release-%{version}/ocs-url-release-%{version}.tar.gz
Source0: %{name}.tar.gz

Requires: libQt5Svg5 >= 5.2.0, libqt5-qtquickcontrols >= 5.2.0
BuildRequires: git, make, automake, gcc, gcc-c++, libtool, libqt5-qtbase-devel >= 5.2.0, libqt5-qtsvg-devel >= 5.2.0, libqt5-qtdeclarative-devel >= 5.2.0, rpm-build

%description
An install helper program for items served via OpenCollaborationServices (ocs://).

%prep
#%%autosetup -n %{name}-release-%{version}
%autosetup -n %{name}
./scripts/prepare

%build
%define debug_package %{nil}
qmake-qt5 PREFIX=/usr
make

%install
make INSTALL_ROOT="%{buildroot}" install

%files
%defattr(-,root,root)
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%clean
rm -rf %{buildroot}

%changelog
* Thu Jul 05 2018 Akira Ohgaki <akiraohgaki@gmail.com> - 3.1.0-1
- Drop old xdg:// and xdgs:// schemes
- Update library

* Tue Feb 06 2018 Akira Ohgaki <akiraohgaki@gmail.com> - 3.0.3-1
- Update library
- Fix spelling

* Fri Jun 23 2017 Akira Ohgaki <akiraohgaki@gmail.com> - 3.0.2-1
- Add zh_TW translations (by s8321414)

* Mon Jun 05 2017 Akira Ohgaki <akiraohgaki@gmail.com> - 3.0.1-1
- Update qtlib
- Fix for C++11
- Fix installation/download destination
- Fix translation messages (by otsoga)

* Sun Mar 05 2017 Akira Ohgaki <akiraohgaki@gmail.com> - 3.0.0-1
- Rename xdgurl to ocs-url
- Add ocs:// and ocss:// schemes
- xdg:// and xdgs:// schemes still available for backward compatibile
- New app icon
- New dialog window
- Labels and messages are translatable
- Qt 5.2 support
- Use the same configs of install-types with ocsstore
- Add en_US translation
- Add ja_JP translation
- Add tr_TR translation (by tarakbumba)

* Wed Jan 25 2017 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.3-1
- Change installation destination of type bin
- Update qtlib
- Fix for dialog

* Thu Nov 17 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.2-1
- Update qtlibs
- Small fix

* Mon Nov 14 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.1-1
- Update library
- Fix download/installation process

* Fri Oct 28 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 2.0.0-1
- Re-implemented xdgurl as Qt program
- Download progress bar
- Add install-type "bin"

* Fri Jul 15 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 1.0.1-1
- Clean successful message
- Return exit code

* Wed Jul 06 2016 Akira Ohgaki <akiraohgaki@gmail.com> - 1.0.0-1
- Initial release

pkg/pkg.pri

0 → 100644
+10 −0
Original line number Diff line number Diff line
DISTFILES += \
    $${PWD}/ubuntu/debian/changelog \
    $${PWD}/ubuntu/debian/compat \
    $${PWD}/ubuntu/debian/control \
    $${PWD}/ubuntu/debian/copyright \
    $${PWD}/ubuntu/debian/rules \
    $${PWD}/ubuntu/debian/ocs-url.install \
    $${PWD}/fedora/ocs-url.spec \
    $${PWD}/opensuse/ocs-url.spec \
    $${PWD}/archlinux/PKGBUILD
Original line number Diff line number Diff line
xdgurl (2.0.0-0ubuntu1) xenial; urgency=low
ocs-url (3.1.0-0ubuntu1) trusty; urgency=low

  * Drop old xdg:// and xdgs:// schemes
  * Update library

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Thu, 05 Jul 2018 05:43:18 +0000

ocs-url (3.0.3-0ubuntu1) trusty; urgency=low

  * Update library
  * Fix spelling

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Tue, 06 Feb 2018 12:00:06 +0000

ocs-url (3.0.2-0ubuntu1) trusty; urgency=low

  * Add zh_TW translations (by s8321414)

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Fri, 23 Jun 2017 13:20:37 +0000

ocs-url (3.0.1-0ubuntu1) trusty; urgency=low

  * Update qtlib
  * Fix for C++11
  * Fix installation/download destination
  * Fix translation messages (by otsoga)

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Mon, 05 Jun 2017 04:33:07 +0000

ocs-url (3.0.0-0ubuntu1) trusty; urgency=low

  * Rename xdgurl to ocs-url
  * Add ocs:// and ocss:// schemes
  * xdg:// and xdgs:// schemes still available for backward compatibile
  * New app icon
  * New dialog window
  * Labels and messages are translatable
  * Qt 5.2 support
  * Use the same configs of install-types with ocsstore
  * Add en_US translation
  * Add ja_JP translation
  * Add tr_TR translation (by tarakbumba)

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Sun, 05 Mar 2017 16:53:43 +0000

ocs-url (2.0.3-0ubuntu1) trusty; urgency=low

  * Change installation destination of type bin
  * Update qtlib
  * Fix for dialog

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Wed, 25 Jan 2017 19:58:44 +0000

ocs-url (2.0.2-0ubuntu1) trusty; urgency=low

  * Update qtlibs
  * Small fix

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Thu, 17 Nov 2016 17:30:24 +0000

ocs-url (2.0.1-0ubuntu1) trusty; urgency=low

  * Update library
  * Fix download/installation process
  * Package depends for xenial and later

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Mon, 14 Nov 2016 01:40:41 +0000

ocs-url (2.0.0-0ubuntu1) trusty; urgency=low

  * Re-implemented xdgurl as Qt program
  * Download progress bar
@@ -6,14 +74,14 @@ xdgurl (2.0.0-0ubuntu1) xenial; urgency=low

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Fri, 28 Oct 2016 08:53:57 +0000

xdgurl (1.0.1-0ubuntu1) xenial; urgency=low
ocs-url (1.0.1-0ubuntu1) trusty; urgency=low

  * Clean successfull message
  * Clean successful message
  * Return exit code

 -- Akira Ohgaki <akiraohgaki@gmail.com>  Fri, 15 Jul 2016 18:55:06 +0000

xdgurl (1.0.0-0ubuntu1) xenial; urgency=low
ocs-url (1.0.0-0ubuntu1) trusty; urgency=low

  * Initial release

Original line number Diff line number Diff line
Source: xdgurl
Source: ocs-url
Section: web
Priority: optional
Maintainer: Akira Ohgaki <akiraohgaki@gmail.com>
Build-Depends: build-essential (>= 11), qt5-default (>= 5.3.0), libqt5svg5-dev (>= 5.3.0), qtdeclarative5-dev (>= 5.3.0), devscripts (>= 2.14), debhelper (>= 9), fakeroot (>= 1.20)
Build-Depends: git, build-essential, qt5-default (>= 5.2.0), libqt5svg5-dev (>= 5.2.0), qtdeclarative5-dev (>= 5.2.0), devscripts, debhelper, fakeroot
Standards-Version: 3.9.4

Package: xdgurl
Package: ocs-url
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libqt5svg5 (>= 5.3.0), qtdeclarative5-qtquick2-plugin (>= 5.3.0), qtdeclarative5-window-plugin (>= 5.3.0), qtdeclarative5-controls-plugin (>= 5.3.0), qtdeclarative5-dialogs-plugin (>= 5.3.0)
Description: An install helper program for desktop stuff
 An install helper program for desktop stuff.
Depends: ${shlibs:Depends}, ${misc:Depends}, libqt5svg5 (>= 5.2.0), qml-module-qtquick2 (>= 5.2.0) | qtdeclarative5-qtquick2-plugin (>= 5.2.0), qml-module-qtquick-window2 (>= 5.2.0) | qtdeclarative5-window-plugin (>= 5.2.0), qml-module-qtquick-controls (>= 5.2.0) | qtdeclarative5-controls-plugin (>= 5.2.0)
Description: OCS-URL
 An install helper program for items served via OpenCollaborationServices (ocs://).
Original line number Diff line number Diff line
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: xdgurl
Upstream-Contact: Akira Ohgaki <akiraohgaki@gmail.com>
Source: https://github.com/xdgurl/xdgurl
Upstream-Name: ocs-url
Upstream-Contact: Opendesktop.org <contact@opendesktop.org>
Source: https://git.opendesktop.org/akiraohgaki/ocs-url

Files: *
Copyright: 2016, Akira Ohgaki
Copyright: 2016-2019, Opendesktop.org
License: GPL-3+
 On Debian systems, the full text of the GNU General Public License version 3
 can be found in the `/usr/share/common-licenses/GPL-3' file.
+3 −0
Original line number Diff line number Diff line
usr/bin/ocs-url
usr/share/applications/ocs-url.desktop
usr/share/icons/hicolor/scalable/apps/ocs-url.svg
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@
	dh $@

override_dh_auto_configure:
	qmake PREFIX='/usr'
	./scripts/prepare
	qmake PREFIX=/usr

override_dh_auto_install:
	make INSTALL_ROOT="$(CURDIR)/debian/tmp" install

pkg/ubuntu/debian/xdgurl.install

deleted100644 → 0
+0 −3
Original line number Diff line number Diff line
usr/bin/xdgurl
usr/share/applications/xdgurl.desktop
usr/share/icons/hicolor/scalable/apps/xdgurl.svg

rpath.pri

deleted100644 → 0
+0 −5
Original line number Diff line number Diff line
unix:!android {
    QMAKE_LFLAGS += -Wl,-rpath=\\\$\$ORIGIN
    QMAKE_LFLAGS += -Wl,-rpath=/usr/lib/$${TARGET}
    QMAKE_RPATH =
}

scripts/package

0 → 100755
+117 −0
Original line number Diff line number Diff line
#!/bin/bash

PKGNAME='ocs-url'

PKGUSER='pkgbuilder'

PKGSCRIPT="${0}"

PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"

BUILDDIR="${PROJDIR}/build_${PKGNAME}"

ubuntu_deb() { # docker-image: ubuntu:14.04
    install_build_deps_ubuntu_deb
    add_pkguser
    su -c "export HOME=/home/${PKGUSER} && "${PKGSCRIPT}" build_ubuntu_deb" ${PKGUSER}
}

install_build_deps_ubuntu_deb() {
    apt update -qq
    apt -y install curl git
    apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
    apt -y install devscripts debhelper fakeroot
}

build_ubuntu_deb() {
    rm -rf "${BUILDDIR}"
    mkdir -p "${BUILDDIR}"
    export_srcarchive "${BUILDDIR}/${PKGNAME}.tar.gz"
    tar -xzf "${BUILDDIR}/${PKGNAME}.tar.gz" -C "${BUILDDIR}"
    cp -r "${PROJDIR}/pkg/ubuntu/debian" "${BUILDDIR}/${PKGNAME}"
    cd "${BUILDDIR}/${PKGNAME}"
    debuild -uc -us -b
}

fedora_rpm() { # docker-image: fedora:20
    install_build_deps_fedora_rpm
    add_pkguser
    su -c "export HOME=/home/${PKGUSER} && "${PKGSCRIPT}" build_fedora_rpm" ${PKGUSER}
}

install_build_deps_fedora_rpm() {
    yum -y install curl git
    yum -y install make automake gcc gcc-c++ libtool qt5-qtbase-devel qt5-qtsvg-devel qt5-qtdeclarative-devel
    yum -y install rpm-build
}

build_fedora_rpm() {
    rm -rf "${BUILDDIR}"
    mkdir -p "${BUILDDIR}"
    mkdir "${BUILDDIR}/SOURCES"
    mkdir "${BUILDDIR}/SPECS"
    export_srcarchive "${BUILDDIR}/SOURCES/${PKGNAME}.tar.gz"
    cp "${PROJDIR}/pkg/fedora/${PKGNAME}.spec" "${BUILDDIR}/SPECS"
    rpmbuild --define "_topdir ${BUILDDIR}" -bb "${BUILDDIR}/SPECS/${PKGNAME}.spec"
}

opensuse_rpm() { # docker-image: opensuse:42.3
    install_build_deps_opensuse_rpm
    add_pkguser
    su -c "export HOME=/home/${PKGUSER} && "${PKGSCRIPT}" build_opensuse_rpm" ${PKGUSER}
}

install_build_deps_opensuse_rpm() {
    zypper --non-interactive refresh
    zypper --non-interactive install curl git
    zypper --non-interactive install make automake gcc gcc-c++ libtool libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qtdeclarative-devel
    zypper --non-interactive install rpm-build
}

build_opensuse_rpm() {
    rm -rf "${BUILDDIR}"
    mkdir -p "${BUILDDIR}"
    mkdir "${BUILDDIR}/SOURCES"
    mkdir "${BUILDDIR}/SPECS"
    export_srcarchive "${BUILDDIR}/SOURCES/${PKGNAME}.tar.gz"
    cp "${PROJDIR}/pkg/opensuse/${PKGNAME}.spec" "${BUILDDIR}/SPECS"
    rpmbuild --define "_topdir ${BUILDDIR}" -bb "${BUILDDIR}/SPECS/${PKGNAME}.spec"
}

archlinux_pkg() { # docker-image: archlinux/base:latest
    install_build_deps_archlinux_pkg
    add_pkguser
    su -c "export HOME=/home/${PKGUSER} && "${PKGSCRIPT}" build_archlinux_pkg" ${PKGUSER}
}

install_build_deps_archlinux_pkg() {
    pacman -Syu --noconfirm
    pacman -S --noconfirm curl git
    pacman -S --noconfirm base-devel qt5-base qt5-svg qt5-declarative qt5-quickcontrols
    pacman -S --noconfirm pacman-contrib
}

build_archlinux_pkg() {
    rm -rf "${BUILDDIR}"
    mkdir -p "${BUILDDIR}"
    export_srcarchive "${BUILDDIR}/${PKGNAME}.tar.gz"
    cp "${PROJDIR}/pkg/archlinux/PKGBUILD" "${BUILDDIR}"
    cd "${BUILDDIR}"
    updpkgsums
    makepkg -s
}

add_pkguser() {
    useradd -m ${PKGUSER}
    chown -R ${PKGUSER} "${PROJDIR}"
}

export_srcarchive() {
    if [ "${1}" ]; then
        (cd "${PROJDIR}" && git archive --prefix="${PKGNAME}/" --output="${1}" HEAD)
    fi
}

if [ "${1}" ]; then
    ${1}
fi

scripts/prepare

0 → 100755
+7 −0
Original line number Diff line number Diff line
#!/bin/bash

PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"

if [ ! -d "${PROJDIR}/lib/qtil" ]; then
    git clone https://github.com/akiraohgaki/qtil.git -b release-0.4.0 --single-branch --depth=1 "${PROJDIR}/lib/qtil"
fi

scripts/scripts.pri

0 → 100644
+3 −0
Original line number Diff line number Diff line
DISTFILES += \
    $${PWD}/package \
    $${PWD}/prepare

src/app/configs/application.json

deleted100644 → 0
+0 −13
Original line number Diff line number Diff line
{
    "id": "xdgurl",
    "name": "xdgurl",
    "version": "2.0.0",
    "organization": "xdgurl",
    "domain": "com.xdgurl.xdgurl",
    "icon": ":/desktop/xdgurl.svg",
    "description": "An install helper program for desktop stuff.",
    "license": "GPL-3+",
    "author": "Akira Ohgaki",
    "contact": "akiraohgaki@gmail.com",
    "homepage": "https://github.com/xdgurl/xdgurl"
}

src/app/configs/destinations.json

deleted100644 → 0
+0 −38
Original line number Diff line number Diff line
{
    "bin": "$HOME/.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"
}
+0 −17
Original line number Diff line number Diff line
{
    "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"
}

src/app/handlers/xdgurl.h

deleted100644 → 0
+0 −54
Original line number Diff line number Diff line
#pragma once

#include <QObject>
#include <QJsonObject>

class QNetworkReply;

namespace utils {
class Config;
class Network;
}

namespace handlers {

class XdgUrl : public QObject
{
    Q_OBJECT

public:
    explicit XdgUrl(const QString &xdgUrl, utils::Config *config, utils::Network *network, QObject *parent = 0);

signals:
    void started();
    void finished(const QJsonObject &result);
    void error(const QJsonObject &result);
    void downloadProgress(const qint64 &received, const qint64 &total);

public slots:
    void process();
    bool isValid();
    void openDestination();
    QString xdgUrl() const;
    QJsonObject metadata() const;

private slots:
    void downloaded(QNetworkReply *reply);

private:
    void parse();
    void loadDestinations();
    QString convertPathString(const QString &path);
    void saveDownloadedFile(QNetworkReply *reply);
    void installDownloadedFile(QNetworkReply *reply);

    QString xdgUrl_;
    utils::Config *config_;
    utils::Network *network_;

    QJsonObject metadata_;
    QJsonObject destinations_;
    QString destination_;
};

} // namespace handlers

src/app/main.cpp

deleted100644 → 0
+0 −59
Original line number Diff line number Diff line
#include <QtGlobal>
#include <QString>
#include <QStringList>
#include <QUrl>
#include <QJsonObject>
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QGuiApplication>
#include <QIcon>
#include <QQmlApplicationEngine>
#include <QQmlContext>

#include "../libs/utils/config.h"
#include "../libs/utils/network.h"

#include "handlers/xdgurl.h"

int main(int argc, char *argv[])
{
    // Init
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
    QGuiApplication app(argc, argv);
    utils::Config *config = new utils::Config(":/configs");
    utils::Network *network = new utils::Network(true);

    QJsonObject configApplication = config->get("application");

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

    // Setup CLI
    QCommandLineParser clParser;
    clParser.setApplicationDescription(configApplication["description"].toString());
    clParser.addHelpOption();
    clParser.addVersionOption();
    clParser.addPositionalArgument("xdgurl", "XDG-URL");
    clParser.process(app);

    QStringList args = clParser.positionalArguments();

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

    QString xdgUrl = args.at(0);

    // Setup QML
    QQmlApplicationEngine qmlAppEngine;
    QQmlContext *qmlContext = qmlAppEngine.rootContext();
    qmlContext->setContextProperty("xdgUrlHandler", new handlers::XdgUrl(xdgUrl, config, network));
    qmlAppEngine.load(QUrl("qrc:/qml/main.qml"));

    return app.exec();
}

src/app/qml/main.qml

deleted100644 → 0
+0 −155
Original line number Diff line number Diff line
import QtQuick 2.3
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2

import 'scripts/Utility.js' as Utility

Window {
    id: root
    title: Qt.application.name
    width: 400
    height: 200
    minimumWidth: 400
    minimumHeight: 200
    maximumWidth: 800
    maximumHeight: 400

    MessageDialog {
        id: confirmDialog
        title: root.title
        icon: StandardIcon.Question
        text: ''
        informativeText: ''
        detailedText: ''
        standardButtons: StandardButton.Ok | StandardButton.Cancel
        onAccepted: xdgUrlHandler.process()
        onRejected: Qt.quit()
    }

    MessageDialog {
        id: infoDialog
        title: root.title
        icon: StandardIcon.Information
        text: ''
        informativeText: ''
        detailedText: ''
        standardButtons: StandardButton.Open | StandardButton.Close
        onAccepted: {
            xdgUrlHandler.openDestination();
            Qt.quit();
        }
        onRejected: Qt.quit()
    }

    MessageDialog {
        id: errorDialog
        title: root.title
        icon: StandardIcon.Warning
        text: ''
        informativeText: ''
        detailedText: ''
        standardButtons: StandardButton.Close
        onRejected: Qt.quit()
    }

    Dialog {
        id: progressDialog
        title: root.title
        contentItem: Item {
            implicitWidth: 400
            implicitHeight: 150
            Column {
                anchors.fill: parent
                anchors.margins: 12
                spacing: 8
                Label {
                    id: primaryLabel
                    text: ''
                    font.bold: true
                }
                Label {
                    id: informativeLabel
                    text: ''
                }
                ProgressBar {
                    id: progressBar
                    maximumValue: 1
                    minimumValue: 0
                    value: 0
                    anchors.left: parent.left
                    anchors.right: parent.right
                }
                Label {
                    id: progressLabel
                    text: ''
                    anchors.right: parent.right
                }
                Button {
                    id: cancelButton
                    text: 'Cancel'
                    anchors.right: parent.right
                    onClicked: Qt.quit()
                }
            }
        }
        property alias primaryLabel: primaryLabel
        property alias informativeLabel: informativeLabel
        property alias progressBar: progressBar
        property alias progressLabel: progressLabel
    }

    Component.onCompleted: {
        var metadata = xdgUrlHandler.metadata();
        var primaryMessages = {
            'success_download': 'Download successfull',
            'success_install': 'Installation successfull',
            'error_validation': 'Validation error',
            'error_network': 'Network error',
            'error_save': 'Saving file failed',
            'error_install': 'Installation failed'
        };

        xdgUrlHandler.started.connect(function() {
            progressDialog.open();
        });

        xdgUrlHandler.finished.connect(function(result) {
            progressDialog.close();
            infoDialog.text = primaryMessages[result.status];
            infoDialog.informativeText = metadata.filename;
            infoDialog.detailedText = result.message;
            infoDialog.open();
        });

        xdgUrlHandler.error.connect(function(result) {
            progressDialog.close();
            errorDialog.text = primaryMessages[result.status];
            errorDialog.informativeText = metadata.filename;
            errorDialog.detailedText = result.message;
            errorDialog.open();
        });

        xdgUrlHandler.downloadProgress.connect(function(received, total) {
            progressDialog.primaryLabel.text = 'Downloading... ';
            progressDialog.informativeLabel.text = metadata.filename;
            progressDialog.progressBar.value = received / total;
            progressDialog.progressLabel.text = Utility.convertByteToHumanReadable(received)
                    + ' / ' + Utility.convertByteToHumanReadable(total)
        });

        if (xdgUrlHandler.isValid()) {
            confirmDialog.text = 'Do you want to ' + metadata.command + '?';
            confirmDialog.informativeText = metadata.filename;
            confirmDialog.detailedText = 'URL: ' + metadata.url + '\n\n'
                    + 'File: ' + metadata.filename + '\n\n'
                    + 'Type: ' + metadata.type;
            confirmDialog.open();
        }
        else {
            errorDialog.text = 'Validation error';
            errorDialog.detailedText = 'Invalid XDG-URL ' + xdgUrlHandler.xdgUrl();
            errorDialog.open();
        }
    }
}
+0 −208
Original line number Diff line number Diff line
#!/bin/bash

# The purpose of this script is to provide lightweight desktop integration
# into the host system without special help from the host system.
# If you want to have fuller and automatic desktop integration, you might
# consider to use the optional appimaged daemon instead.

# Exit on errors
set -e

# Be verbose if $DEBUG=1 is set
if [ ! -z "$DEBUG" ] ; then
  env
  set -x
fi

THIS="$0"
args=("$@") # http://stackoverflow.com/questions/3190818/
NUMBER_OF_ARGS="$#"

# Please do not change $VENDORPREFIX as it will allow for desktop files
# belonging to AppImages to be recognized by future AppImageKit components
# such as desktop integration daemons
VENDORPREFIX=appimagekit

APPDIR="$(dirname "$(readlink -f "${THIS}")")"

BIN="${APPDIR}/xdgurl"
export PATH="${APPDIR}/usr/bin:$PATH"

trap atexit EXIT

# Note that the following handles 0, 1 or more arguments (file paths)
# which can include blanks but uses a bashism; can the same be achieved
# in POSIX-shell? (FIXME)
# http://stackoverflow.com/questions/3190818
atexit()
{
if [ $NUMBER_OF_ARGS -eq 0 ] ; then
  exec "${BIN}"
else
  exec "${BIN}" "${args[@]}"
fi
}

error()
{
  if [ -x /usr/bin/zenity ] ; then
    LD_LIBRARY_PATH="" zenity --error --text "${1}" 2>/dev/null
  elif [ -x /usr/bin/kdialog ] ; then
    LD_LIBRARY_PATH="" kdialog --msgbox "${1}" 2>/dev/null
  elif [ -x /usr/bin/Xdialog ] ; then
    LD_LIBRARY_PATH="" Xdialog --msgbox "${1}" 2>/dev/null
  else
    echo "${1}"
  fi
  exit 1
}

yesno()
{
  TITLE=$1
  TEXT=$2
  if [ -x /usr/bin/zenity ] ; then
    LD_LIBRARY_PATH="" zenity --question --title="$TITLE" --text="$TEXT" 2>/dev/null || exit 0
  elif [ -x /usr/bin/kdialog ] ; then
    LD_LIBRARY_PATH="" kdialog --caption "" --title "$TITLE" -yesno "$TEXT" || exit 0
  elif [ -x /usr/bin/Xdialog ] ; then
    LD_LIBRARY_PATH="" Xdialog --title "$TITLE" --clear --yesno "$TEXT" 10 80 || exit 0
  else
    echo "zenity, kdialog, Xdialog missing. Skipping ${THIS}."
    exit 0
  fi
}

check_prevent()
{
  FILE=$1
  if [ -e "$FILE" ] ; then
    exit 0
  fi
}

# Exit immediately of one of these files is present
# (e.g., because the desktop environment wants to handle desktop integration itself)
check_prevent "$HOME/.local/share/$VENDORPREFIX/no_desktopintegration"
check_prevent "/usr/share/$VENDORPREFIX/no_desktopintegration"
check_prevent "/etc/$VENDORPREFIX/no_desktopintegration"

# Exit immediately if appimaged is running
pidof appimaged 2>/dev/null && exit 0

# Exit immediately if $DESKTOPINTEGRATION is not empty
if [ ! -z "$DESKTOPINTEGRATION" ] ; then
  exit 0
fi

check_dep()
{
  DEP=$1
  if [ -z $(which $DEP) ] ; then
    echo "$DEP is missing. Skipping ${THIS}."
    exit 0
  fi
}

DIRNAME="$APPDIR"

# Check whether dependencies are present in base system (we do not bundle these)
# http://cgit.freedesktop.org/xdg/desktop-file-utils/
check_dep desktop-file-validate
check_dep update-desktop-database
check_dep desktop-file-install
check_dep xdg-icon-resource
check_dep xdg-mime
check_dep xdg-desktop-menu

DESKTOPFILE=$(find "$APPDIR" -maxdepth 1 -name "*.desktop" | head -n 1)
# echo "$DESKTOPFILE"
DESKTOPFILE_NAME=$(basename "${DESKTOPFILE}")

if [ ! -f "$DESKTOPFILE" ] ; then
  echo "Desktop file is missing. Please run ${THIS} from within an AppImage."
  exit 0
fi

if [ -z "$APPIMAGE" ] ; then
  APPIMAGE="$APPDIR/AppRun"
  # Not running from within an AppImage; hence using the AppRun for Exec=
fi

ABS_APPIMAGE=$(readlink -e "$APPIMAGE")
ICONFILE="$APPDIR/.DirIcon"

# $XDG_DATA_DIRS contains the default paths /usr/local/share:/usr/share
# desktop file has to be installed in an applications subdirectory
# of one of the $XDG_DATA_DIRS components
if [ -z "$XDG_DATA_DIRS" ] ; then
  XDG_DATA_DIRS=/usr/local/share:/usr/share
fi

# Determine where the desktop file should be installed
if [[ $EUID -ne 0 ]]; then
   DESTINATION_DIR_DESKTOP="$HOME/.local/share/applications"
   SYSTEM_WIDE=""
else
   # TODO: Check $XDG_DATA_DIRS
   DESTINATION_DIR_DESKTOP="/usr/local/share/applications"
   SYSTEM_WIDE="--mode system" # for xdg-mime and xdg-icon-resource
fi

# Check if the desktop file is already there
# and if so, whether it points to the same AppImage
if [ -e "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-$DESKTOPFILE_NAME" ] ; then
  # echo "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-$DESKTOPFILE_NAME already there"
  EXEC=$(grep "^Exec=" "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-$DESKTOPFILE_NAME" | head -n 1 | cut -d " " -f 1)
  # echo $EXEC
  if [ "Exec=\"$APPIMAGE\"" == "$EXEC" ] ; then
    exit 0
  fi
fi

# We ask the user only if we have found no reason to skip until here
if [ -z "$SKIP" ] ; then
  yesno "Install" "Would you like to integrate $APPIMAGE with your system?\n\nThis will add it to your applications menu and install icons.\nIf you don't do this you can still launch the application by double-clicking on the AppImage."
fi

APP=$(echo "$DESKTOPFILE_NAME" | sed -e 's/.desktop//g')

# If the user has agreed, rewrite and install the desktop file, and the MIME information
if [ -z "$SKIP" ] ; then
  # desktop-file-install is supposed to install .desktop files to the user's
  # applications directory when run as a non-root user,
  # and to /usr/share/applications if run as root
  # but that does not really work for me...
  #
  # For Exec we must use quotes
  # For TryExec quotes is not supported, so, space must be replaced to \s
  # https://askubuntu.com/questions/175404/how-to-add-space-to-exec-path-in-a-thumbnailer-descrption/175567
  desktop-file-install --rebuild-mime-info-cache \
    --vendor=$VENDORPREFIX --set-key=Exec --set-value="\"${APPIMAGE}\" %u" \
    --set-key=X-AppImage-Comment --set-value="Generated by ${THIS}" \
    --set-icon="$ICONFILE" --set-key=TryExec --set-value=${APPIMAGE// /\\s} "$DESKTOPFILE" \
    --dir "$DESTINATION_DIR_DESKTOP"
  chmod a+x "$DESTINATION_DIR_DESKTOP/"*
  RESOURCE_NAME=$(echo "$VENDORPREFIX-$DESKTOPFILE_NAME" | sed -e 's/.desktop//g')
  # echo $RESOURCE_NAME

  # Install the icon files for the application; TODO: scalable
  ICONS=$(find "${APPDIR}/usr/share/icons/" -wholename "*/apps/${APP}.png" 2>/dev/null || true)
  for ICON in $ICONS ; do
    ICON_SIZE=$(echo "${ICON}" | rev | cut -d "/" -f 3 | rev | cut -d "x" -f 1)
    xdg-icon-resource install --context apps --size ${ICON_SIZE} "${ICON}" "${RESOURCE_NAME}"
  done

  # Install mime type
  find "${APPDIR}/usr/share/mime/" -type f -name *xml -exec xdg-mime install $SYSTEM_WIDE --novendor {} \; 2>/dev/null || true

  # Install the icon files for the mime type; TODO: scalable
  ICONS=$(find "${APPDIR}/usr/share/icons/" -wholename "*/mimetypes/*.png" 2>/dev/null || true)
  for ICON in $ICONS ; do
    ICON_SIZE=$(echo "${ICON}" | rev | cut -d "/" -f 3 | rev | cut -d "x" -f 1)
    xdg-icon-resource install --context mimetypes --size ${ICON_SIZE} "${ICON}" $(basename $ICON | sed -e 's/.png//g')
  done

  xdg-desktop-menu forceupdate
  gtk-update-icon-cache # for MIME
fi

src/desktop/xdgurl.svg

deleted100644 → 0
+0 −75
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   version="1.1"
   id="svg2"
   viewBox="0 0 1000 1000"
   height="1000"
   width="1000">
  <defs
     id="defs4" />
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     transform="translate(0,-52.362161)"
     id="layer1">
    <circle
       r="475"
       cy="552.36218"
       cx="500"
       id="path4138"
       style="fill:#19a2ff;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
    <circle
       r="450"
       cy="552.36218"
       cx="500"
       id="path4138-0"
       style="fill:#53b2ff;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
    <g
       transform="translate(0,20)"
       id="g4205">
      <path
         id="path4145"
         style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:Futura;-inkscape-font-specification:'Futura Medium';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
         d="m 192.87313,533.47911 -74.36008,-101.11803 56.93857,0 46.10326,64.24502 46.95309,-64.24502 58.63824,0 -76.48467,101.11803 88.59474,119.21524 -56.93858,0 -60.76282,-82.34221 -62.25002,82.34221 -58.42577,0 91.99404,-119.21524 z" />
      <path
         id="path4147"
         style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:Futura;-inkscape-font-specification:'Futura Medium';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
         d="m 472.62967,312.47491 48.01537,0 0,340.84056 -48.01537,0 0,-21.67066 c -18.83789,18.41297 -40.15445,27.61946 -63.94968,27.61946 -28.32765,0 -51.83961,-10.33959 -70.53586,-31.01878 -18.55461,-21.1041 -27.83192,-47.44882 -27.83192,-79.03415 0,-30.87715 9.27731,-56.65531 27.83192,-77.3345 18.41298,-20.82082 41.57084,-31.23123 69.47357,-31.23123 24.22015,0 45.8908,9.91468 65.01197,29.74403 z M 359.17742,549.21134 c 0,19.82935 5.31143,35.97612 15.9343,48.44029 10.90615,12.60581 24.64506,18.90871 41.21674,18.90871 17.70478,0 32.01024,-6.09045 42.91639,-18.27134 10.90615,-12.60581 16.35922,-28.61093 16.35922,-48.01537 0,-19.40445 -5.45307,-35.40957 -16.35922,-48.01538 -10.90615,-12.32253 -25.06997,-18.48379 -42.49148,-18.48379 -16.43004,0 -30.16895,6.23208 -41.21673,18.69625 -10.90615,12.60581 -16.35922,28.18602 -16.35922,46.74063 z" />
      <path
         id="path4149"
         style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:medium;line-height:125%;font-family:Futura;-inkscape-font-specification:'Futura Medium';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
         d="m 722.24998,648.95295 c 0,9.77304 -0.3541,18.34215 -1.06229,25.70734 -0.56655,7.50683 -1.41638,14.09301 -2.54949,19.75854 -3.39932,15.58021 -10.05632,28.96502 -19.97099,40.15445 -18.69625,21.52901 -44.4036,32.29352 -77.12204,32.29352 -27.61947,0 -50.35241,-7.43601 -68.19883,-22.30802 -18.41297,-15.29693 -29.03584,-36.47186 -31.86861,-63.52477 l 48.01537,0 c 1.8413,10.19796 4.88652,18.05889 9.13567,23.58278 9.91468,12.88908 24.36178,19.33362 43.34131,19.33362 34.98465,0 52.47698,-21.4582 52.47698,-64.37459 l 0,-28.89421 c -18.97953,19.40444 -40.86264,29.10666 -65.64934,29.10666 -28.18601,0 -51.27305,-10.19795 -69.26111,-30.59386 -18.1297,-20.67919 -27.19455,-46.52817 -27.19455,-77.54695 0,-30.16895 8.42748,-55.80548 25.28243,-76.90959 18.1297,-22.37884 42.06657,-33.56826 71.81061,-33.56826 26.06144,0 47.73209,9.70222 65.01196,29.10666 l 0,-27.37031 47.80292,0 z m -45.8908,-98.15532 c 0,-20.11264 -5.38225,-36.18859 -16.14676,-48.22784 C 649.30627,490.24726 635.3549,484.086 618.35831,484.086 c -18.1297,0 -32.43517,6.72782 -42.9164,20.18345 -9.48976,12.03925 -14.23464,27.61946 -14.23464,46.74063 0,18.83789 4.74488,34.27647 14.23464,46.31572 10.33959,13.17236 24.64506,19.75854 42.9164,19.75854 18.27133,0 32.71844,-6.657 43.34131,-19.971 9.77304,-12.03925 14.65956,-27.47782 14.65956,-46.31571 z" />
      <path
         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
         d="m 739.50519,490.21255 36,0 0,36 -36,0 z"
         id="rect4156" />
      <path
         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
         d="m 739.53345,589.21057 36,0 0,36 -36,0 z"
         id="rect4156-9" />
      <path
         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
         d="m 852.99238,412.46896 22,0 -94.33913,290.17369 -22,0 z"
         id="rect4156-5" />
      <path
         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
         d="m 902.99238,412.46896 22,0 -94.33913,290.17369 -22,0 z"
         id="rect4156-5-3" />
    </g>
  </g>
</svg>

src/libs/utils/android.cpp

deleted100644 → 0
+0 −38
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#include "android.h"

#include <QAndroidJniObject>

namespace utils {

Android::Android(QObject *parent) : QObject(parent)
{}

bool Android::openApk(const QString &uri)
{
    QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;");
    if (activity.isValid()) {
        QAndroidJniObject fileUri = QAndroidJniObject::fromString(uri);
        QAndroidJniObject parsedUri = QAndroidJniObject::callStaticObjectMethod("android/net/Uri", "parse", "(Ljava/lang/String;)Landroid/net/Uri;", fileUri.object());
        QAndroidJniObject mimeType = QAndroidJniObject::fromString("application/vnd.android.package-archive");
        QAndroidJniObject activityKind = QAndroidJniObject::fromString("android.intent.action.VIEW");
        QAndroidJniObject intent("android/content/Intent", "(Ljava/lang/String;)V", activityKind.object());
        intent = intent.callObjectMethod("setDataAndType", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;", parsedUri.object(), mimeType.object());
        intent = intent.callObjectMethod("setFlags", "(I)Landroid/content/Intent;", 0x10000000); // 0x10000000 = FLAG_ACTIVITY_NEW_TASK
        activity.callObjectMethod("startActivity", "(Landroid/content/Intent;)V", intent.object());
        return true;
    }
    return false;
}

} // namespace utils

src/libs/utils/android.h

deleted100644 → 0
+0 −28
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#pragma once

#include <QObject>

namespace utils {

class Android : public QObject
{
    Q_OBJECT

public:
    explicit Android(QObject *parent = 0);

    static bool openApk(const QString &uri);
};

} // namespace utils

src/libs/utils/config.cpp

deleted100644 → 0
+0 −50
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#include "config.h"

#include "file.h"
#include "json.h"

namespace utils {

Config::Config(const QString &configsDir, QObject *parent) :
    QObject(parent), configsDir_(configsDir)
{}

QJsonObject Config::get(const QString &name)
{
    QString configFile = configsDir_ + "/" + name + ".json";

    if (!cacheData_.contains(name)) {
        QString json = utils::File::readText(configFile);
        if (json.isEmpty()) {
            json = "{}"; // Blank JSON data as default
        }
        cacheData_[name] = utils::Json::convertStrToObj(json);
    }
    return cacheData_[name].toObject();
}

bool Config::set(const QString &name, const QJsonObject &jsonObj)
{
    QString configFile = configsDir_ + "/" + name + ".json";
    QString json = utils::Json::convertObjToStr(jsonObj);

    utils::File::makeDir(configsDir_);
    if (utils::File::writeText(configFile, json)) {
        cacheData_[name] = jsonObj;
        return true;
    }
    return false;
}

} // namespace utils

src/libs/utils/config.h

deleted100644 → 0
+0 −34
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#pragma once

#include <QObject>
#include <QJsonObject>

namespace utils {

class Config : public QObject
{
    Q_OBJECT

public:
    explicit Config(const QString &configsDir, QObject *parent = 0);

    QJsonObject get(const QString &name);
    bool set(const QString &name, const QJsonObject &jsonObj);

private:
    QString configsDir_;
    QJsonObject cacheData_;
};

} // namespace utils

src/libs/utils/file.cpp

deleted100644 → 0
+0 −201
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#include "file.h"

#include <QIODevice>
#include <QStandardPaths>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QTextStream>

namespace utils {

File::File(QObject *parent) : QObject(parent)
{}

QString File::rootPath()
{
    return QDir::rootPath();
}

QString File::tempPath()
{
    return QDir::tempPath();
}

QString File::homePath()
{
    return QDir::homePath();
}

QString File::genericDataPath()
{
    return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
}

QString File::genericConfigPath()
{
    return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
}

QString File::genericCachePath()
{
    return QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
}

QString File::kdehomePath()
{
    // KDE System Administration/Environment Variables
    // https://userbase.kde.org/KDE_System_Administration/Environment_Variables

    // KDE 4 maybe uses $KDEHOME
    QString path = QString::fromLocal8Bit(qgetenv("KDEHOME").constData());
    if (path.isEmpty()) {
        path = homePath() + "/.kde";
    }
    return path;
}

QFileInfoList File::readDir(const QString &path)
{
    QDir dir(path);
    dir.setFilter(QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
    //dir.setSorting(QDir::DirsFirst | QDir::Name);
    return dir.entryInfoList();
}

bool File::makeDir(const QString &path)
{
    // This function will create all parent directories
    QDir dir(path);
    if (!dir.exists() && dir.mkpath(path)) {
        return true;
    }
    return false;
}

QString File::readText(const QString &path)
{
    QString data;
    QFile file(path);
    if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&file);
        in.setCodec("UTF-8");
        data = in.readAll();
        file.close();
    }
    return data;
}

bool File::writeText(const QString &path, const QString &data)
{
    QFile file(path);
    if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
        QTextStream out(&file);
        out.setCodec("UTF-8");
        out << data;
        file.close();
        return true;
    }
    return false;
}

QByteArray File::readBinary(const QString &path)
{
    QByteArray data;
    QFile file(path);
    if (file.exists() && file.open(QIODevice::ReadOnly)) {
        data = file.readAll();
        file.close();
    }
    return data;
}

bool File::writeBinary(const QString &path, const QByteArray &data)
{
    QFile file(path);
    if (file.open(QIODevice::WriteOnly)) {
        file.write(data);
        file.close();
        return true;
    }
    return false;
}

bool File::copy(const QString &path, const QString &targetPath)
{
    // This function will copy files recursively
    QFileInfo fileInfo(path);
    if (fileInfo.isFile()) {
        QFile file(path);
        if (file.copy(targetPath)) {
            return true;
        }
    }
    else if (fileInfo.isDir()) {
        QDir targetDir(targetPath);
        QString targetDirName = targetDir.dirName();
        targetDir.cdUp();
        if (targetDir.mkdir(targetDirName)) {
            QDir dir(path);
            dir.setFilter(QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
            QStringList entries = dir.entryList();
            foreach (const QString &entry, entries) {
                if (!copy(path + "/" + entry, targetPath + "/" + entry)) {
                    return false;
                }
            }
            return true;
        }
    }
    return false;
}

bool File::move(const QString &path, const QString &targetPath)
{
    QFileInfo fileInfo(path);
    if (fileInfo.isFile()) {
        QFile file(path);
        if (file.rename(targetPath)) {
            return true;
        }
    }
    else if (fileInfo.isDir()) {
        QDir dir(path);
        if (dir.rename(path, targetPath)) {
            return true;
        }
    }
    return false;
}

bool File::remove(const QString &path)
{
    // This function will remove files recursively
    QFileInfo fileInfo(path);
    if (fileInfo.isFile()) {
        QFile file(path);
        if (file.remove()) {
            return true;
        }
    }
    else if (fileInfo.isDir()) {
        QDir dir(path);
        if (dir.removeRecursively()) {
            return true;
        }
    }
    return false;
}

} // namespace utils

src/libs/utils/file.h

deleted100644 → 0
+0 −46
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#pragma once

#include <QObject>

class QFileInfo;
typedef QList<QFileInfo> QFileInfoList;

namespace utils {

class File : public QObject
{
    Q_OBJECT

public:
    explicit File(QObject *parent = 0);

    static QString rootPath();
    static QString tempPath();
    static QString homePath();
    static QString genericDataPath();
    static QString genericConfigPath();
    static QString genericCachePath();
    static QString kdehomePath();
    static QFileInfoList readDir(const QString &path);
    static bool makeDir(const QString &path);
    static QString readText(const QString &path);
    static bool writeText(const QString &path, const QString &data);
    static QByteArray readBinary(const QString &path);
    static bool writeBinary(const QString &path, const QByteArray &data);
    static bool copy(const QString &path, const QString &targetPath);
    static bool move(const QString &path, const QString &targetPath);
    static bool remove(const QString &path);
};

} // namespace utils

src/libs/utils/json.cpp

deleted100644 → 0
+0 −50
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#include "json.h"

#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonParseError>

namespace utils {

Json::Json(QObject *parent) : QObject(parent)
{}

QString Json::convertObjToStr(const QJsonObject &jsonObj)
{
    QJsonDocument jsonDoc(jsonObj);
    return QString::fromUtf8(jsonDoc.toJson());
}

QJsonObject Json::convertStrToObj(const QString &json)
{
    QJsonObject jsonObj;
    QJsonParseError jsonError;
    QJsonDocument jsonDoc = QJsonDocument::fromJson(json.toUtf8(), &jsonError);
    if (jsonError.error == QJsonParseError::NoError && jsonDoc.isObject()) {
        jsonObj = jsonDoc.object();
    }
    return jsonObj;
}

bool Json::isValid(const QString &json)
{
    QJsonParseError jsonError;
    QJsonDocument::fromJson(json.toUtf8(), &jsonError);
    if (jsonError.error == QJsonParseError::NoError) {
        return true;
    }
    return false;
}

} // namespace utils

src/libs/utils/json.h

deleted100644 → 0
+0 −30
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#pragma once

#include <QObject>

namespace utils {

class Json : public QObject
{
    Q_OBJECT

public:
    explicit Json(QObject *parent = 0);

    static QString convertObjToStr(const QJsonObject &jsonObj);
    static QJsonObject convertStrToObj(const QString &json);
    static bool isValid(const QString &json);
};

} // namespace utils

src/libs/utils/network.cpp

deleted100644 → 0
+0 −59
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#include "network.h"

#include <QEventLoop>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>

namespace utils {

Network::Network(const bool &async, QObject *parent) :
    QObject(parent), async_(async)
{
    manager_ = new QNetworkAccessManager(this);
    connect(manager_, &QNetworkAccessManager::finished, this, &utils::Network::finished);
    if (!async_) {
        eventLoop_ = new QEventLoop();
        connect(manager_, &QNetworkAccessManager::finished, eventLoop_, &QEventLoop::quit);
    }
}

Network::~Network()
{
    manager_->deleteLater();
    if (!async_) {
        delete eventLoop_;
    }
}

QNetworkReply *Network::head(const QUrl &uri)
{
    QNetworkReply *reply = manager_->head(QNetworkRequest(uri));
    if (!async_) {
        eventLoop_->exec();
    }
    return reply;
}

QNetworkReply *Network::get(const QUrl &uri)
{
    QNetworkReply *reply = manager_->get(QNetworkRequest(uri));
    connect(reply, &QNetworkReply::downloadProgress, this, &utils::Network::downloadProgress);
    if (!async_) {
        eventLoop_->exec();
    }
    return reply;
}

} // namespace utils

src/libs/utils/network.h

deleted100644 → 0
+0 −43
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#pragma once

#include <QObject>

class QEventLoop;
class QNetworkAccessManager;
class QNetworkReply;

namespace utils {

class Network : public QObject
{
    Q_OBJECT

public:
    explicit Network(const bool &async = true, QObject *parent = 0);
    ~Network();

    QNetworkReply *head(const QUrl &uri);
    QNetworkReply *get(const QUrl &uri);

signals:
    void finished(QNetworkReply *reply);
    void downloadProgress(const qint64 &received, const qint64 &total);

private:
    bool async_;
    QNetworkAccessManager *manager_;
    QEventLoop *eventLoop_;
};

} // namespace utils

src/libs/utils/package.cpp

deleted100644 → 0
+0 −120
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#include "package.h"

#include <QJsonObject>
#include <QMimeDatabase>
#include <QProcess>

namespace utils {

Package::Package(QObject *parent) : QObject(parent)
{}

bool Package::installProgram(const QString &path, const QString &targetPath)
{
    QString program = "install";
    QStringList arguments;
    arguments << "-m" << "755" << "-p" << path << targetPath;
    return execute(program, arguments);
}

bool Package::installFile(const QString &path, const QString &targetPath)
{
    QString program = "install";
    QStringList arguments;
    arguments << "-m" << "644" << "-p" << path << targetPath;
    return execute(program, arguments);
}

bool Package::installPlasmapkg(const QString &path, const QString &type)
{
    QString program = "plasmapkg2";
    QStringList arguments;
    arguments << "-t" << type << "-i" << path;
    return execute(program, arguments);
}

bool Package::uninstallPlasmapkg(const QString &path, const QString &type)
{
    QString program = "plasmapkg2";
    QStringList arguments;
    arguments << "-t" << type << "-r" << path;
    return execute(program, arguments);
}

bool Package::uncompressArchive(const QString &path, const QString &targetDir)
{
    QJsonObject archiveTypes;
    archiveTypes["application/x-tar"] = QString("tar");
    archiveTypes["application/x-gzip"] = QString("tar");
    archiveTypes["application/gzip"] = QString("tar");
    archiveTypes["application/x-bzip"] = QString("tar");
    archiveTypes["application/x-bzip2"] = QString("tar");
    archiveTypes["application/x-xz"] = QString("tar");
    archiveTypes["application/x-lzma"] = QString("tar");
    archiveTypes["application/x-lzip"] = QString("tar");
    archiveTypes["application/x-compressed-tar"] = QString("tar");
    archiveTypes["application/x-bzip-compressed-tar"] = QString("tar");
    archiveTypes["application/x-bzip2-compressed-tar"] = QString("tar");
    archiveTypes["application/x-xz-compressed-tar"] = QString("tar");
    archiveTypes["application/x-lzma-compressed-tar"] = QString("tar");
    archiveTypes["application/x-lzip-compressed-tar"] = QString("tar");
    archiveTypes["application/zip"] = QString("zip");
    archiveTypes["application/x-7z-compressed"] = QString("7z");
    archiveTypes["application/x-rar"] = QString("rar");
    archiveTypes["application/x-rar-compressed"] = QString("rar");

    QMimeDatabase mimeDb;
    QString mimeType = mimeDb.mimeTypeForFile(path).name();

    if (archiveTypes.contains(mimeType)) {
        QString archiveType = archiveTypes[mimeType].toString();

        QString program;
        QStringList arguments;

        if (archiveType == "tar") {
            program = "tar";
            arguments << "-xf" << path << "-C" << targetDir;
        }
        else if (archiveType == "zip") {
            program = "unzip";
            arguments << "-o" << path << "-d" << targetDir;
        }
        else if (archiveType == "7z") {
            program = "7z";
            arguments << "x" << path << "-o" + targetDir; // No space between -o and directory
        }
        else if (archiveType == "rar") {
            program = "unrar";
            arguments << "e" << path << targetDir;
        }

        return execute(program, arguments);
    }

    return false;
}

bool Package::execute(const QString &program, const QStringList &arguments)
{
    QProcess process;
    process.start(program, arguments);
    if (process.waitForFinished()) {
        process.waitForReadyRead();
        return true;
    }
    return false;
}

} // namespace utils

src/libs/utils/package.h

deleted100644 → 0
+0 −35
Original line number Diff line number Diff line
/**
 * A library for Qt app
 *
 * LICENSE: The GNU Lesser General Public License, version 3.0
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
 * @license     https://opensource.org/licenses/LGPL-3.0  The GNU Lesser General Public License, version 3.0
 * @link        https://github.com/akiraohgaki/qt-libs
 */

#pragma once

#include <QObject>

namespace utils {

class Package : public QObject
{
    Q_OBJECT

public:
    explicit Package(QObject *parent = 0);

    static bool installProgram(const QString &path, const QString &targetPath);
    static bool installFile(const QString &path, const QString &targetPath);
    static bool installPlasmapkg(const QString &path, const QString &type = "plasmoid");
    static bool uninstallPlasmapkg(const QString &path, const QString &type = "plasmoid");
    static bool uncompressArchive(const QString &path, const QString &targetDir);

private:
    static bool execute(const QString &program, const QStringList &arguments);
};

} // namespace utils

xdgurl.pro

deleted100644 → 0
+0 −55
Original line number Diff line number Diff line
TARGET = xdgurl

TEMPLATE = app

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

CONFIG += c++11

SOURCES += \
    src/app/main.cpp \
    src/app/handlers/xdgurl.cpp \
    src/libs/utils/config.cpp \
    src/libs/utils/network.cpp \
    src/libs/utils/file.cpp \
    src/libs/utils/json.cpp \
    src/libs/utils/package.cpp

HEADERS += \
    src/app/handlers/xdgurl.h \
    src/libs/utils/config.h \
    src/libs/utils/network.h \
    src/libs/utils/file.h \
    src/libs/utils/json.h \
    src/libs/utils/package.h

RESOURCES += \
    src/app/configs/configs.qrc \
    src/app/qml/qml.qrc \
    src/desktop/desktop.qrc

DISTFILES += \
    README.md \
    src/desktop/xdgurl.desktop \
    src/desktop/appimage-desktopintegration \
    pkg/build.sh \
    pkg/ubuntu/debian/changelog \
    pkg/ubuntu/debian/compat \
    pkg/ubuntu/debian/control \
    pkg/ubuntu/debian/copyright \
    pkg/ubuntu/debian/rules \
    pkg/ubuntu/debian/xdgurl.install \
    pkg/fedora/xdgurl.spec \
    pkg/arch/PKGBUILD

# Additional RPATH
#include(rpath.pri)

# Deployment rules
include(deployment.pri)