diff --git a/CMakeLists.txt b/CMakeLists.txt index 033b263..76ac4d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,89 +1,81 @@ cmake_minimum_required(VERSION 3.5) project(Purpose) find_package(ECM 5.67.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) set(REQUIRED_QT_VERSION 5.12.0) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core Qml Gui DBus Widgets Network Test) include(KDEInstallDirs) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(FeatureSummary) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMAddTests) include(ECMInstallIcons) include(ECMGenerateHeaders) include(ECMMarkNonGuiExecutable) include(ECMQtDeclareLoggingCategory) set(KF5_VERSION "5.68.0") # handled by release scripts set(KF5_DEP_VERSION "5.67.0") # handled by release scripts find_package(KF5 ${KF5_DEP_VERSION} REQUIRED COMPONENTS CoreAddons I18n Config Kirigami2) -# Debian is a special snow flake and uses nodejs as binary name -# https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html -if(EXISTS "/etc/debian_version") # is debian system? - set(NODEJS_BINARY "nodejs" CACHE PATH "The binary name for the nodejs interpreter") -else() # sane system - set(NODEJS_BINARY "node" CACHE PATH "The binary name for the nodejs interpreter") -endif() - ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX PURPOSE VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/purpose_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5PurposeConfigVersion.cmake" SOVERSION 5) # Wait until libaccounts-qt has a release that doesn't use QString::null https://gitlab.com/accounts-sso/libaccounts-qt/issues/4 #add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00) add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054300) add_definitions(-DQT_NO_FOREACH) add_subdirectory( src ) if (BUILD_TESTING) add_subdirectory( autotests ) add_subdirectory( tests ) endif() if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po") ki18n_install(po) endif() # create a Config.cmake and a ConfigVersion.cmake file and install them set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Purpose") include(CMakePackageConfigHelpers) configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5PurposeConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5PurposeConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5PurposeConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KF5PurposeConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KF5PurposeTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5PurposeTargets.cmake NAMESPACE KF5:: ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/purpose_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/purpose COMPONENT Devel ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) #TODO: Remove somewhen in the future install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/KDEExperimentalPurposeConfig.cmake" DESTINATION "${KDE_INSTALL_CMAKEPACKAGEDIR}/KDEExperimentalPurpose" COMPONENT Devel ) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 9790e76..906aeb0 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -1,55 +1,50 @@ function(add_share_plugin name) kcoreaddons_add_plugin(${name} SOURCES ${ARGN} JSON "${name}.json" INSTALL_NAMESPACE "kf5/purpose") target_link_libraries(${name} Qt5::Core KF5::Purpose) set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kf5/purpose") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${name}_config.qml") install(FILES "${name}_config.qml" DESTINATION ${DATA_INSTALL_DIR}/purpose) endif() endfunction() set(KPACKAGE_RELATIVE_DATA_INSTALL_DIR "kpackage") function(kpackage_install_package dir component root) set(install_dir ${ARGV3}) if(NOT install_dir) set(install_dir ${KPACKAGE_RELATIVE_DATA_INSTALL_DIR}) endif() install(DIRECTORY ${dir}/ USE_SOURCE_PERMISSIONS DESTINATION ${DATA_INSTALL_DIR}/${install_dir}/${root}/${component} PATTERN Messages.sh EXCLUDE) endfunction() include(ECMQMLModules) ecm_find_qmlmodule(Ubuntu.OnlineAccounts 0.1) ecm_find_qmlmodule(org.kde.kdeconnect 1.0) ecm_find_qmlmodule(org.kde.kquickcontrolsaddons 2.0) find_package(KAccounts) find_package(KF5KIO ${KF5_DEP_VERSION} REQUIRED) set_package_properties(KAccounts PROPERTIES PURPOSE "Used to find your system-wide defined, for now only for YouTube." TYPE OPTIONAL ) set_package_properties(KF5KIO PROPERTIES TYPE REQUIRED) add_subdirectory(saveas) add_subdirectory(imgur) add_subdirectory(pastebin) add_subdirectory(ktp-sendfile) if (KAccounts_FOUND) add_subdirectory(youtube) - - file(COPY twitter DESTINATION ${CMAKE_CURRENT_BINARY_DIR} PATTERN "main.js.in" EXCLUDE) - configure_file(twitter/contents/code/main.js.in ${CMAKE_CURRENT_BINARY_DIR}/twitter/contents/code/main.js @ONLY) - kpackage_install_package(${CMAKE_CURRENT_BINARY_DIR}/twitter Twitter Purpose) - kaccounts_add_service(${CMAKE_CURRENT_SOURCE_DIR}/twitter-microblog.service.in) add_subdirectory(nextcloud) endif() add_subdirectory(kdeconnect) add_subdirectory(reviewboard) add_subdirectory(phabricator) add_subdirectory(email) add_subdirectory(telegram) add_subdirectory(bluetooth) add_subdirectory(kdeconnect_sms) diff --git a/src/plugins/twitter-microblog.service.in b/src/plugins/twitter-microblog.service.in deleted file mode 100644 index 97ab4f0..0000000 --- a/src/plugins/twitter-microblog.service.in +++ /dev/null @@ -1,10 +0,0 @@ - - - twitter-microblog - - <_name>Twitter - twitter - twitter - kaccounts-providers - \ No newline at end of file diff --git a/src/plugins/twitter/Messages.sh b/src/plugins/twitter/Messages.sh deleted file mode 100644 index 93a6ae5..0000000 --- a/src/plugins/twitter/Messages.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -$XGETTEXT `find . -not -path \*/tests/\* -name \*.cpp -o -name \*.qml -o -name \*.cc -o -name \*.h` -o $podir/purpose_twitter.pot - diff --git a/src/plugins/twitter/contents/code/main.js.in b/src/plugins/twitter/contents/code/main.js.in deleted file mode 100755 index 09c4dfe..0000000 --- a/src/plugins/twitter/contents/code/main.js.in +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env @NODEJS_BINARY@ - -function processArgs() { - var ret = {}; - var last; - var argv = process.argv.slice(2); - for (var v in argv) { - var curr = argv[v]; - if (curr.indexOf("--")==0) { - last = curr; - } else { - ret[last] = curr; - } - } - return ret; -} - -function Communication(doStuff) { - var argsMap = processArgs(); - var path = argsMap["--server"]; - - var net = require('net'); - var client = new net.Socket(); - client.connect({path: path}); - client.on('data', function(dataStr) { - doStuff(JSON.parse(dataStr)); - }); - client.on('end', function() { console.warn('disconnected from server'); }); - - this.send = function(obj) { client.write(JSON.stringify(obj)+'\n'); }; - - this.setError = function(code, errorText) { - console.warn('ERROR [%s]', errorText); - this.send( { error: code, errorText: errorText } ); - process.exit(1); - }; - - this.setOutput = function(data) { - this.send(data); - process.exit(0); - }; -} - -//------------------- - -var comm = new Communication(main); - -//Callback functions -var error = function (err, response, body) { - comm.setError(1, JSON.stringify(err)); -}; -var postSuccess = function (dataString) { - var data = JSON.parse(dataString); - var outputUrl = ("https://twitter.com/"+data.user.screen_name+"/status/"+data.id_str); - comm.setOutput(comm.send({percent: 100, output: {url: outputUrl} })); -}; - -var Twitter = require('twitter-node-client').Twitter; - -var twitter = null; -var message; -var inputUrls; -var uploaded = []; - -function postIfDone() -{ - if (uploaded.length === inputUrls.length) { - comm.send({percent: 90}); - twitter.postTweet({ - status: message, - media_ids: uploaded - } - , error - , postSuccess - ); - } -} - -function mediaUploaded(dataString) { - var data = JSON.parse(dataString) - uploaded.push(data.media_id_string); - comm.send({percent: 60}); - postIfDone(); -}; - -function readUrl(url) { - var spawn = require('child_process').spawn; - var kiocat = spawn("kioclient5", ["cat", url], { stdio: ['ignore', 'pipe', 'ignore']}); - - var contents = []; //array of buffers - kiocat.stdout.on('data', function (data) { contents.push(data); }); - - kiocat.on('exit', function (exitCode) { - if (exitCode!=0) { - setError(exitCode, "couldn't read: " + url); - return; - } - comm.send({percent: 20}); - - var allData = Buffer.concat(contents); - twitter.postMedia( - { media_data: allData.toString("base64") } - , error - , mediaUploaded - ); - }); -} - -function main(data) -{ - message = data.tweetText; - inputUrls = data.urls; - console.log("Connected!"); - - var config = { - consumerKey: data.consumerKey, - consumerSecret: data.consumerSecret, - accessToken: data.accessToken, - accessTokenSecret: data.accessTokenSecret, - callBackUrl: "" - } - - for(var v in config) { - if (v!="callBackUrl" && config[v]=="") { - console.log("auth...", config); - comm.setError(2, "Missing auth information"); - } - } - - twitter = new Twitter(config); - - for (var v in inputUrls) { - readUrl(inputUrls[v]) - } - postIfDone(); -} diff --git a/src/plugins/twitter/contents/code/package.json b/src/plugins/twitter/contents/code/package.json deleted file mode 100644 index a305d2e..0000000 --- a/src/plugins/twitter/contents/code/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "purpose-twitter", - "version": "1.0.0", - "description": "", - "main": "twitter.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/src/plugins/twitter/contents/config/config.qml b/src/plugins/twitter/contents/config/config.qml deleted file mode 100644 index c415a31..0000000 --- a/src/plugins/twitter/contents/config/config.qml +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright 2015 Aleix Pol Gonzalez - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -*/ - -import QtQuick 2.2 -import QtQuick.Controls 1.2 -import QtQuick.Layouts 1.1 -import org.kde.kquickcontrolsaddons 2.0 as KQCA -import Ubuntu.OnlineAccounts 0.1 as OA - -ColumnLayout -{ - id: root - - property alias tweetText: tweet.text - property string consumerKey: accts.authData.parameters.ConsumerKey - property string consumerSecret: accts.authData.parameters.ConsumerSecret - property var accessToken - property var accessTokenSecret - - property var urls - property var mimeType - - OA.AccountService { - id: accts - objectHandle: accountsCombo.enabled && accountsCombo.currentIndex>=0 ? serviceModel.get(accountsCombo.currentIndex, "accountServiceHandle") : null - onAuthenticated: { -// console.log("Access token is ", JSON.stringify(reply)) - root.accessToken = reply.AccessToken - root.accessTokenSecret = reply.TokenSecret - } - onAuthenticationError: { console.log("Authentication failed, code " + error.code) } - - onAuthDataChanged: { - authenticate(accts.authData); - } - } - - Label { text: i18nd("purpose_twitter", "Account:") } - RowLayout { - Layout.fillWidth: true - ComboBox { - id: accountsCombo - - Layout.fillWidth: true - textRole: "displayName" - enabled: count>0 - model: OA.AccountServiceModel { - id: serviceModel - serviceType: "twitter-microblog" - } - } - Button { - iconName: "settings-configure" - onClicked: KQCA.KCMShell.open("kcm_kaccounts"); - } - } - - TextField { - id: tweet - Layout.fillWidth: true - Layout.fillHeight: true - placeholderText: i18nd("purpose_twitter","What's happening?") - } -} diff --git a/src/plugins/twitter/metadata.json b/src/plugins/twitter/metadata.json deleted file mode 100644 index 078fc18..0000000 --- a/src/plugins/twitter/metadata.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "KPlugin": { - "Authors": [ - { - "Name": "Aleix Pol", - "Name[ar]": "Aleix Pol", - "Name[ca@valencia]": "Aleix Pol", - "Name[ca]": "Aleix Pol", - "Name[cs]": "Aleix Pol", - "Name[da]": "Aleix Pol", - "Name[de]": "Aleix Pol", - "Name[el]": "Aleix Pol", - "Name[en_GB]": "Aleix Pol", - "Name[es]": "Aleix Pol", - "Name[et]": "Aleix Pol", - "Name[eu]": "Aleix Pol", - "Name[fi]": "Aleix Pol", - "Name[fr]": "Aleix Pol", - "Name[gl]": "Aleix Pol", - "Name[hu]": "Aleix Pol", - "Name[id]": "Aleix Pol", - "Name[it]": "Aleix Pol", - "Name[ko]": "Aleix Pol", - "Name[lt]": "Aleix Pol", - "Name[nl]": "Aleix Pol", - "Name[nn]": "Aleix Pol", - "Name[pl]": "Aleix Pol", - "Name[pt]": "Aleix Pol", - "Name[pt_BR]": "Aleix Pol", - "Name[ru]": "Aleix Pol", - "Name[sk]": "Aleix Pol", - "Name[sv]": "Aleix Pol", - "Name[tg]": "Алекс Пол (Aleix Pol)", - "Name[tr]": "Aleix Pol", - "Name[uk]": "Aleix Pol", - "Name[x-test]": "xxAleix Polxx", - "Name[zh_CN]": "Aleix Pol", - "Name[zh_TW]": "Aleix Pol" - } - ], - "Category": "Utilities", - "Description": "Shares media on Twitter.", - "Description[ar]": "شارِك الوسائط على «تويتر».", - "Description[ca@valencia]": "Comparteix fitxers multimèdia al Twitter.", - "Description[ca]": "Comparteix fitxers multimèdia al Twitter.", - "Description[cs]": "Sdílí média na Twitteru.", - "Description[da]": "Deler medier på Twitter.", - "Description[de]": "Gibt die Medien auf Twitter frei.", - "Description[el]": "Διαμοιρασμός πολυμέσων στο Twitter.", - "Description[en_GB]": "Shares media on Twitter.", - "Description[es]": "Comparte el medio en Twitter.", - "Description[et]": "Meedia jagamine Twitteris.", - "Description[eu]": "Partekatu multimedia edukia Twitterren.", - "Description[fi]": "Jakaa Twitteriin mediaa.", - "Description[fr]": "Partager le contenu sur Twitter.", - "Description[gl]": "Comparte contido en Twitter.", - "Description[hu]": "Média megosztása Twitteren.", - "Description[id]": "Membagikan media di Twitter.", - "Description[it]": "Condividi contenuto su Twitter.", - "Description[ko]": "트위터로 미디어를 공유합니다.", - "Description[lt]": "Bendrina mediją Twitter tinkle.", - "Description[nl]": "Deelt media op Twitter.", - "Description[nn]": "Del mediefil på Twitter.", - "Description[pl]": "Udostępnia multimedia na Twitterze.", - "Description[pt]": "Partilha conteúdos no Twitter.", - "Description[pt_BR]": "Compartilha mídias no Twitter.", - "Description[ru]": "Отправка файлов в Twitter.", - "Description[sk]": "Zdieľa médiu na Twitteri.", - "Description[sv]": "Dela media på Twitter.", - "Description[tg]": "Вocитаи аxбopи oммаро дар Twitter мубодила мекунад.", - "Description[tr]": "Twitter'da medya dosyası paylaşır.", - "Description[uk]": "Оприлюднює мультимедійні дані на Twitter.", - "Description[x-test]": "xxShares media on Twitter.xx", - "Description[zh_CN]": "在 Twitter 上分享媒体。", - "Description[zh_TW]": "在 Twitter 上分想多媒體。", - "Icon": "im-twitter", - "Id": "twitterplugin", - "License": "GPL", - "Name": "Twitter", - "Name[ar]": "تويتر", - "Name[ca@valencia]": "Twitter", - "Name[ca]": "Twitter", - "Name[cs]": "Twitter", - "Name[da]": "Twitter", - "Name[de]": "Twitter", - "Name[el]": "Twitter", - "Name[en_GB]": "Twitter", - "Name[es]": "Twitter", - "Name[et]": "Twitter", - "Name[eu]": "Twitter", - "Name[fi]": "Twitter", - "Name[fr]": "Twitter", - "Name[gl]": "Twitter", - "Name[hu]": "Twitter", - "Name[ia]": "Twitter", - "Name[id]": "Twitter", - "Name[it]": "Twitter", - "Name[ko]": "트위터", - "Name[lt]": "Twitter", - "Name[ml]": "ട്വിറ്റര്‍", - "Name[nl]": "Twitter", - "Name[nn]": "Twitter", - "Name[pl]": "Twitter", - "Name[pt]": "Twitter", - "Name[pt_BR]": "Twitter", - "Name[ru]": "Twitter", - "Name[sk]": "Twitter", - "Name[sv]": "Twitter", - "Name[tg]": "Twitter", - "Name[tr]": "Twitter", - "Name[uk]": "Twitter", - "Name[x-test]": "xxTwitterxx", - "Name[zh_CN]": "Twitter", - "Name[zh_TW]": "Twitter", - "X-Purpose-ActionDisplay": "Twitter...", - "X-Purpose-ActionDisplay[ca]": "Twitter...", - "X-Purpose-ActionDisplay[cs]": "Twitter...", - "X-Purpose-ActionDisplay[da]": "Twitter...", - "X-Purpose-ActionDisplay[de]": "Twitter ...", - "X-Purpose-ActionDisplay[en_GB]": "Twitter...", - "X-Purpose-ActionDisplay[es]": "Twitter...", - "X-Purpose-ActionDisplay[et]": "Twitter ...", - "X-Purpose-ActionDisplay[eu]": "Twitter...", - "X-Purpose-ActionDisplay[fi]": "Twitter…", - "X-Purpose-ActionDisplay[fr]": "Twitter...", - "X-Purpose-ActionDisplay[gl]": "Twitter…", - "X-Purpose-ActionDisplay[ia]": "Twitter...", - "X-Purpose-ActionDisplay[id]": "Twitter...", - "X-Purpose-ActionDisplay[it]": "Twitter...", - "X-Purpose-ActionDisplay[ko]": "트위터...", - "X-Purpose-ActionDisplay[lt]": "Twitter...", - "X-Purpose-ActionDisplay[ml]": "ട്വിറ്റര്‍... ", - "X-Purpose-ActionDisplay[nl]": "Twitter...", - "X-Purpose-ActionDisplay[nn]": "Twitter …", - "X-Purpose-ActionDisplay[pl]": "Twitter...", - "X-Purpose-ActionDisplay[pt]": "Twitter...", - "X-Purpose-ActionDisplay[pt_BR]": "Twitter...", - "X-Purpose-ActionDisplay[ru]": "Twitter...", - "X-Purpose-ActionDisplay[sk]": "Twitter...", - "X-Purpose-ActionDisplay[sv]": "Twitter...", - "X-Purpose-ActionDisplay[tg]": "Twitter...", - "X-Purpose-ActionDisplay[uk]": "Twitter…", - "X-Purpose-ActionDisplay[x-test]": "xxTwitter...xx", - "X-Purpose-ActionDisplay[zh_CN]": "Twitter...", - "X-Purpose-ActionDisplay[zh_TW]": "Twitter…" - }, - "X-Purpose-Configuration": [ - "tweetText", - "consumerKey", - "consumerSecret", - "accessToken", - "accessTokenSecret" - ], - "X-Purpose-Constraints": [], - "X-Purpose-PluginTypes": [ - "Export" - ] -}