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

Target

Select target project
  • akiraohgaki/ocs-manager
  • dfn2/ocs-manager
  • azubieta/ocs-manager
  • rws77/ocs-manager
4 results
Show changes
Commits on Source (18)
......@@ -9,4 +9,7 @@ appimage:
- /^release\-.+/
script:
- ./scripts/package appimage
- cat transfer.log
artifacts:
paths:
- build_*/ocs-manager*.AppImage
expire_in: 2 days
{
"id": "ocs-manager",
"name": "ocs-manager",
"version": "0.7.0",
"version": "0.8.1",
"organization": "Opendesktop.org",
"domain": "org.opendesktop.ocs-manager",
"icon": ":/desktop/ocs-manager.svg",
......
{
"bin": {
"name": "Software",
"destination": "$HOME/.local/bin",
"destination": "",
"xdg_destination": "$HOME/.local/bin",
"generic_destination": "$APP_DATA/bin"
},
"downloads": {
"name": "Downloads",
"destination": "$XDG_DOWNLOAD_DIR",
"destination": "",
"xdg_destination": "$XDG_DOWNLOAD_DIR",
"generic_destination": "$APP_DATA/downloads"
},
"documents": {
"name": "Documents",
"destination": "$XDG_DOCUMENTS_DIR",
"destination": "",
"xdg_destination": "$XDG_DOCUMENTS_DIR",
"generic_destination": "$APP_DATA/documents"
},
"pictures": {
"name": "Pictures",
"destination": "$XDG_PICTURES_DIR",
"destination": "",
"xdg_destination": "$XDG_PICTURES_DIR",
"generic_destination": "$APP_DATA/pictures"
},
"music": {
"name": "Music",
"destination": "$XDG_MUSIC_DIR",
"destination": "",
"xdg_destination": "$XDG_MUSIC_DIR",
"generic_destination": "$APP_DATA/music"
},
"videos": {
"name": "Videos",
"destination": "$XDG_VIDEOS_DIR",
"destination": "",
"xdg_destination": "$XDG_VIDEOS_DIR",
"generic_destination": "$APP_DATA/videos"
},
"wallpapers": {
"name": "Wallpapers",
"destination": "$XDG_DATA_HOME/wallpapers",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/wallpapers",
"generic_destination": "$APP_DATA/wallpapers"
},
"fonts": {
"name": "Fonts",
"destination": "$HOME/.fonts",
"destination": "",
"xdg_destination": "$HOME/.fonts",
"generic_destination": "$APP_DATA/fonts"
},
"cursors": {
"name": "Cursors",
"destination": "$HOME/.icons",
"destination": "",
"xdg_destination": "$HOME/.icons",
"generic_destination": "$APP_DATA/cursors"
},
"icons": {
"name": "Icons",
"destination": "$XDG_DATA_HOME/icons",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/icons",
"generic_destination": "$APP_DATA/icons"
},
"emoticons": {
"name": "Emoticons",
"destination": "$XDG_DATA_HOME/emoticons",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/emoticons",
"generic_destination": "$APP_DATA/emoticons"
},
"themes": {
"name": "Desktop Themes",
"destination": "$HOME/.themes",
"destination": "",
"xdg_destination": "$HOME/.themes",
"generic_destination": "$APP_DATA/themes"
},
"emerald_themes": {
"name": "Emerald Themes",
"destination": "$HOME/.emerald/themes",
"destination": "",
"xdg_destination": "$HOME/.emerald/themes",
"generic_destination": "$APP_DATA/emerald_themes"
},
"enlightenment_themes": {
"name": "Enlightenment Themes",
"destination": "$HOME/.e/e/themes",
"destination": "",
"xdg_destination": "$HOME/.e/e/themes",
"generic_destination": "$APP_DATA/enlightenment_themes"
},
"enlightenment_backgrounds": {
"name": "Enlightenment Backgrounds",
"destination": "$HOME/.e/e/backgrounds",
"destination": "",
"xdg_destination": "$HOME/.e/e/backgrounds",
"generic_destination": "$APP_DATA/enlightenment_backgrounds"
},
"fluxbox_styles": {
"name": "Fluxbox Styles",
"destination": "$HOME/.fluxbox/styles",
"destination": "",
"xdg_destination": "$HOME/.fluxbox/styles",
"generic_destination": "$APP_DATA/fluxbox_styles"
},
"pekwm_themes": {
"name": "PekWM Themes",
"destination": "$HOME/.pekwm/themes",
"destination": "",
"xdg_destination": "$HOME/.pekwm/themes",
"generic_destination": "$APP_DATA/pekwm_themes"
},
"icewm_themes": {
"name": "IceWM Themes",
"destination": "$HOME/.icewm/themes",
"destination": "",
"xdg_destination": "$HOME/.icewm/themes",
"generic_destination": "$APP_DATA/icewm_themes"
},
"plasma_plasmoids": {
"name": "Plasma Plasmoids",
"destination": "$XDG_DATA_HOME/plasma/plasmoids",
"destination": "",
"xdg_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",
"destination": "",
"xdg_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",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/plasma/desktoptheme",
"generic_destination": "$APP_DATA/plasma_desktopthemes"
},
"kwin_effects": {
"name": "KWin Effects",
"destination": "$XDG_DATA_HOME/kwin/effects",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/kwin/effects",
"generic_destination": "$APP_DATA/kwin_effects"
},
"kwin_scripts": {
"name": "KWin Scripts",
"destination": "$XDG_DATA_HOME/kwin/scripts",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/kwin/scripts",
"generic_destination": "$APP_DATA/kwin_scripts"
},
"kwin_tabbox": {
"name": "KWin Window Switcher",
"destination": "$XDG_DATA_HOME/kwin/tabbox",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/kwin/tabbox",
"generic_destination": "$APP_DATA/kwin_tabbox"
},
"aurorae_themes": {
"name": "Aurorae Themes",
"destination": "$XDG_DATA_HOME/aurorae/themes",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/aurorae/themes",
"generic_destination": "$APP_DATA/aurorae_themes"
},
"dekorator_themes": {
"name": "deKorator Themes",
"destination": "$XDG_DATA_HOME/deKorator/themes",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/deKorator/themes",
"generic_destination": "$APP_DATA/dekorator_themes"
},
"qtcurve": {
"name": "QtCurve Themes",
"destination": "$XDG_DATA_HOME/QtCurve",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/QtCurve",
"generic_destination": "$APP_DATA/qtcurve"
},
"color_schemes": {
"name": "KDE Color Schemes",
"destination": "$XDG_DATA_HOME/color-schemes",
"destination": "",
"xdg_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",
"destination": "",
"xdg_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",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/cinnamon/applets",
"generic_destination": "$APP_DATA/cinnamon_applets"
},
"cinnamon_desklets": {
"name": "Cinnamon Desklets",
"destination": "$XDG_DATA_HOME/cinnamon/desklets",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/cinnamon/desklets",
"generic_destination": "$APP_DATA/cinnamon_desklets"
},
"cinnamon_extensions": {
"name": "Cinnamon Extensions",
"destination": "$XDG_DATA_HOME/cinnamon/extensions",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/cinnamon/extensions",
"generic_destination": "$APP_DATA/cinnamon_extensions"
},
"nautilus_scripts": {
"name": "Nautilus Scripts",
"destination": "$XDG_DATA_HOME/nautilus/scripts",
"destination": "",
"xdg_destination": "$XDG_DATA_HOME/nautilus/scripts",
"generic_destination": "$APP_DATA/nautilus_scripts"
},
"amarok_scripts": {
"name": "Amarok Scripts",
"destination": "$KDEHOME/share/apps/amarok/scripts",
"destination": "",
"xdg_destination": "$KDEHOME/share/apps/amarok/scripts",
"generic_destination": "$APP_DATA/amarok_scripts"
},
"yakuake_skins": {
"name": "Yakuake Skins",
"destination": "$KDEHOME/share/apps/yakuake/skins",
"destination": "",
"xdg_destination": "$KDEHOME/share/apps/yakuake/skins",
"generic_destination": "$APP_DATA/yakuake_skins"
},
"cairo_clock_themes": {
"name": "Cairo-Clock Themes",
"destination": "$HOME/.cairo-clock/themes",
"destination": "",
"xdg_destination": "$HOME/.cairo-clock/themes",
"generic_destination": "$APP_DATA/cairo_clock_themes"
},
"books": {
"name": "Books",
"destination": "$APP_DATA/books",
"destination": "",
"xdg_destination": "$APP_DATA/books",
"generic_destination": "$APP_DATA/books"
},
"comics": {
"name": "Comics",
"destination": "$APP_DATA/comics",
"destination": "",
"xdg_destination": "$APP_DATA/comics",
"generic_destination": "$APP_DATA/comics"
}
}
......@@ -207,8 +207,15 @@ 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());
auto xdgDestination = convertPathString(installtype["xdg_destination"].toString());
auto genericDestination = convertPathString(installtype["generic_destination"].toString());
installtype["xdg_destination"] = xdgDestination;
installtype["generic_destination"] = genericDestination;
#ifdef APP_DESKTOP
installtype["destination"] = xdgDestination;
#else
installtype["destination"] = genericDestination;
#endif
installTypes[key] = installtype;
}
auto installTypesAlias = appConfig_.get("install_types_alias");
......
......@@ -7,7 +7,9 @@
#include <QDateTime>
#ifdef APP_DESKTOP
#include <QProcess>
#include <QStringList>
#include <QDir>
#include <QDirIterator>
#endif
#include "qtil_dir.h"
......@@ -145,26 +147,18 @@ void ItemHandler::uninstall(const QString &itemKey)
auto installedItem = configHandler_->getUsrConfigInstalledItems()[itemKey].toObject();
auto installType = installedItem["install_type"].toString();
Qtil::Dir destDir;
#ifdef APP_DESKTOP
destDir.setPath(configHandler_->getAppConfigInstallTypes()[installType].toObject()["destination"].toString());
Qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[installType].toObject()["destination"].toString());
#ifdef APP_DESKTOP
for (const auto filename : installedItem["files"].toArray()) {
QFileInfo fileInfo(destDir.path() + "/" + filename.toString());
// plasmapkg: Installation process has should be saved plasmapkg into destination directory
// plasmapkg: Installation process will saved plasmapkg into destination directory
Qtil::Package package(fileInfo.filePath());
// Uninstall
if (installType == "bin") {
if (fileInfo.filePath().endsWith(".appimage", Qt::CaseInsensitive)) {
QProcess process;
process.start(fileInfo.filePath() + " --remove-appimage-desktop-integration");
process.waitForFinished();
}
}
else if (installType == "plasma_plasmoids" || installType == "plasma4_plasmoids" || installType == "plasma5_plasmoids") {
if (installType == "plasma_plasmoids" || installType == "plasma4_plasmoids" || installType == "plasma5_plasmoids") {
package.uninstallAsPlasmapkg("plasmoid");
}
else if (installType == "plasma_look_and_feel" || installType == "plasma5_look_and_feel") {
......@@ -192,8 +186,6 @@ void ItemHandler::uninstall(const QString &itemKey)
}
}
#else
destDir.setPath(configHandler_->getAppConfigInstallTypes()[installType].toObject()["generic_destination"].toString());
for (const auto filename : installedItem["files"].toArray()) {
QFileInfo fileInfo(destDir.path() + "/" + filename.toString());
if (fileInfo.isDir()) {
......@@ -321,6 +313,8 @@ void ItemHandler::installDownloadedFile(Qtil::NetworkResource *resource)
tempDir.make();
Qtil::Dir tempDestDir(tempDir.path() + "/dest");
tempDestDir.make();
Qtil::Dir tempSrcDir(tempDir.path() + "/src");
tempSrcDir.make();
Qtil::Package package(tempDir.path() + "/" + filename);
if (!resource->saveData(package.path())) {
......@@ -341,11 +335,10 @@ void ItemHandler::installDownloadedFile(Qtil::NetworkResource *resource)
result["message"] = tr("Installing");
emit installStarted(result);
Qtil::Dir destDir;
#ifdef APP_DESKTOP
destDir.setPath(configHandler_->getAppConfigInstallTypes()[installType].toObject()["destination"].toString());
Qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[installType].toObject()["destination"].toString());
// plasmapkg: Need to save package to remove installed files later
#ifdef APP_DESKTOP
// plasmapkg: Should save a package to remove installed files in uninstall process
if (installType == "bin"
&& package.installAsProgram(tempDestDir.path() + "/" + filename)) {
......@@ -381,6 +374,32 @@ void ItemHandler::installDownloadedFile(Qtil::NetworkResource *resource)
package.installAsFile(tempDestDir.path() + "/" + filename);
result["message"] = tr("The KWin window switcher has been installed");
}
else if (installType == "cursors"
&& package.installAsArchive(tempSrcDir.path())
&& installThemes("cursors", filename.section(".", 0, 0), tempSrcDir.path(), tempDestDir.path())) {
result["message"] = tr("The cursor theme has been installed");
}
else if (installType == "icons"
&& package.installAsArchive(tempSrcDir.path())
&& installThemes("icons", filename.section(".", 0, 0), tempSrcDir.path(), tempDestDir.path())) {
result["message"] = tr("The icon theme has been installed");
}
else if (installType == "emoticons"
&& package.installAsArchive(tempSrcDir.path())
&& installThemes("emoticons", filename.section(".", 0, 0), tempSrcDir.path(), tempDestDir.path())) {
result["message"] = tr("The emoticon theme has been installed");
}
else if ((installType == "themes"
|| installType == "gnome_shell_themes"
|| installType == "cinnamon_themes"
|| installType == "gtk2_themes"
|| installType == "gtk3_themes"
|| installType == "metacity_themes"
|| installType == "xfwm4_themes")
&& package.installAsArchive(tempSrcDir.path())
&& installThemes("themes", filename.section(".", 0, 0), tempSrcDir.path(), tempDestDir.path())) {
result["message"] = tr("The desktop theme has been installed");
}
else if (package.installAsArchive(tempDestDir.path())) {
result["message"] = tr("The archive file has been extracted");
}
......@@ -396,8 +415,6 @@ void ItemHandler::installDownloadedFile(Qtil::NetworkResource *resource)
return;
}
#else
destDir.setPath(configHandler_->getAppConfigInstallTypes()[installType].toObject()["generic_destination"].toString());
if (Qtil::File(package.path()).copy(tempDestDir.path() + "/" + filename)) {
result["message"] = tr("The file has been installed");
}
......@@ -432,6 +449,15 @@ void ItemHandler::installDownloadedFile(Qtil::NetworkResource *resource)
installedFiles.append(QJsonValue(destFilename));
}
if (installedFiles.isEmpty()) {
result["status"] = QString("error_install");
result["message"] = tr("Failed to installation");
emit installFinished(result);
tempDir.remove();
resource->deleteLater();
return;
}
// Installation post-process
metadata.remove("command");
metadata["files"] = installedFiles;
......@@ -445,3 +471,66 @@ void ItemHandler::installDownloadedFile(Qtil::NetworkResource *resource)
tempDir.remove();
resource->deleteLater();
}
#ifdef APP_DESKTOP
bool ItemHandler::installThemes(const QString &installType, const QString &name, const QString &srcDir, const QString &destDir)
{
QStringList themeDirs;
if (installType == "cursors") {
//QDirIterator iterator(srcDir, QStringList() << "index.theme", QDir::Files, QDirIterator::Subdirectories);
QDirIterator iterator(srcDir, QStringList() << "cursors", QDir::Dirs, QDirIterator::Subdirectories);
while (iterator.hasNext()) {
auto path = iterator.next();
path.truncate(path.lastIndexOf("/"));
themeDirs << path;
}
}
else if (installType == "icons") {
QDirIterator iterator(srcDir, QStringList() << "index.theme", QDir::Files, QDirIterator::Subdirectories);
while (iterator.hasNext()) {
auto path = iterator.next();
path.truncate(path.lastIndexOf("/"));
themeDirs << path;
}
}
else if (installType == "emoticons") {
QDirIterator iterator(srcDir, QStringList() << "emoticons.xml", QDir::Files, QDirIterator::Subdirectories);
while (iterator.hasNext()) {
auto path = iterator.next();
path.truncate(path.lastIndexOf("/"));
themeDirs << path;
}
}
else if (installType == "themes") {
/*QDirIterator iterator(srcDir,
QStringList() << "cinnamon"
<< "gnome-shell"
<< "gtk-2.0"
<< "gtk-3.0"
<< "metacity-1"
<< "plank"
<< "unity"
<< "xfwm4",
QDir::Dirs, QDirIterator::Subdirectories);*/
QDirIterator iterator(srcDir, QStringList() << "index.theme", QDir::Files, QDirIterator::Subdirectories);
while (iterator.hasNext()) {
auto path = iterator.next();
path.truncate(path.lastIndexOf("/"));
themeDirs << path;
}
}
if (!themeDirs.isEmpty()) {
for (const auto &themeDir : themeDirs) {
auto themeName = name;
if (themeDir != srcDir) {
themeName = themeDir.split("/").last();
}
Qtil::Dir(themeDir).move(destDir + "/" + themeName);
}
return true;
}
return false;
}
#endif
......@@ -45,6 +45,10 @@ private:
void saveDownloadedFile(Qtil::NetworkResource *resource);
void installDownloadedFile(Qtil::NetworkResource *resource);
#ifdef APP_DESKTOP
bool installThemes(const QString &installType, const QString &name, const QString &srcDir, const QString &destDir);
#endif
ConfigHandler *configHandler_;
QJsonObject metadataSet_;
};
......@@ -16,14 +16,6 @@ SystemHandler::SystemHandler(QObject *parent)
: QObject(parent)
{}
bool SystemHandler::isUnix() const
{
#ifdef APP_DESKTOP
return true;
#endif
return false;
}
bool SystemHandler::isMobileDevice() const
{
#if defined(APP_MOBILE)
......
......@@ -10,7 +10,6 @@ public:
explicit SystemHandler(QObject *parent = nullptr);
public slots:
bool isUnix() const;
bool isMobileDevice() const;
bool openUrl(const QString &url) const;
};
......@@ -37,12 +37,7 @@ void UpdateHandler::checkAll()
auto filename = installedItem["filename"].toString();
auto installType = installedItem["install_type"].toString();
QString filePath = "";
#ifdef APP_DESKTOP
filePath = configHandler_->getAppConfigInstallTypes()[installType].toObject()["destination"].toString() + "/" + filename;
#else
filePath = configHandler_->getAppConfigInstallTypes()[installType].toObject()["generic_destination"].toString() + "/" + filename;
#endif
auto filePath = configHandler_->getAppConfigInstallTypes()[installType].toObject()["destination"].toString() + "/" + filename;
QString updateMethod = "";
......
......@@ -335,9 +335,6 @@ void WebSocketServer::receiveMessage(const QString &id, const QString &func, con
resultData.append(configHandler_->removeUsrConfigUpdateAvailableItemsItem(data.at(0).toString()));
}
// SystemHandler
else if (func == "SystemHandler::isUnix") {
resultData.append(systemHandler_->isUnix());
}
else if (func == "SystemHandler::isMobileDevice") {
resultData.append(systemHandler_->isMobileDevice());
}
......
#!/bin/bash
PKGNAME='ocs-manager'
PKGVER='0.7.0'
PKGVER='0.8.1'
PKGREL='1'
#UPDINFO='zsync|http://***/ocs-manager-x86_64.AppImage.zsync'
......@@ -29,4 +29,4 @@ install -D -m 755 /usr/bin/unar ${APPDIR}/usr/bin/unar
./squashfs-root/AppRun ${APPDIR}/usr/share/applications/${PKGNAME}.desktop -appimage
mv *-x86_64.AppImage ${PKGNAME}-${PKGVER}-${PKGREL}-x86_64.AppImage
mv *-x86_64.AppImage ../${PKGNAME}-${PKGVER}-${PKGREL}-x86_64.AppImage
......@@ -14,7 +14,6 @@ appimage() { # docker-image: ubuntu:14.04
install_build_deps_appimage
add_pkguser
su -c "export HOME=/home/${PKGUSER} && source /opt/qt59/bin/qt59-env.sh && "${PKGSCRIPT}" build_appimage" ${PKGUSER}
transfer_file "$(find "${BUILDDIR}" -type f -name "${PKGNAME}*-x86_64.AppImage")"
}
install_build_deps_appimage() {
......@@ -56,16 +55,6 @@ export_srcarchive() {
fi
}
transfer_file() {
if [ -f "${1}" ]; then
filename="$(basename "${1}")"
transferlog="${PROJDIR}/transfer.log"
echo "Uploading ${filename}" >> "${transferlog}"
curl -fsSL -T "${1}" "https://transfer.sh/${filename}" >> "${transferlog}"
echo '' >> "${transferlog}"
fi
}
if [ "${1}" ]; then
${1}
fi