diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,6 @@ add_subdirectory(kio) add_subdirectory(wizard) add_subdirectory(applet) -add_subdirectory(fileitemactionplugin) install(FILES bluedevil.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR}) diff --git a/src/fileitemactionplugin/CMakeLists.txt b/src/fileitemactionplugin/CMakeLists.txt deleted file mode 100644 --- a/src/fileitemactionplugin/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -set(fileitemactionplugin_SRCS - sendfileitemaction.cpp) - -set(kded_bluedevil.xml ${CMAKE_SOURCE_DIR}/src/interfaces/kded_bluedevil.xml) -set_source_files_properties(${kded_bluedevil.xml} PROPERTIES INCLUDE ${CMAKE_SOURCE_DIR}/src/interfaces/kded_bluedevil_types.h) -qt5_add_dbus_interface(fileitemactionplugin_SRCS ${kded_bluedevil.xml} kdedbluedevil) - -add_library(bluetoothfileitemaction MODULE ${fileitemactionplugin_SRCS}) -kcoreaddons_desktop_to_json(bluetoothfileitemaction bluedevilfileitemaction.desktop) - -target_link_libraries(bluetoothfileitemaction - Qt5::Widgets - KF5::I18n - KF5::KIOFileWidgets) -target_include_directories(bluetoothfileitemaction SYSTEM - PUBLIC $) - -install(TARGETS bluetoothfileitemaction DESTINATION ${KDE_INSTALL_PLUGINDIR}) -install(FILES bluedevilfileitemaction.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/src/fileitemactionplugin/bluedevilfileitemaction.desktop b/src/fileitemactionplugin/bluedevilfileitemaction.desktop deleted file mode 100644 --- a/src/fileitemactionplugin/bluedevilfileitemaction.desktop +++ /dev/null @@ -1,96 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Send file via Bluetooth -Name[ar]=أرسل ملفًّا عبر بلوتوث -Name[bs]=Šalji datoteku preko Bluetoots -Name[ca]=Envia un fitxer per Bluetooth -Name[ca@valencia]=Envia un fitxer per Bluetooth -Name[cs]=Poslat soubor přes Bluetooth -Name[da]=Send fil via Bluetooth -Name[de]=Datei über Bluetooth versenden -Name[el]=Αποστολή αρχείου μέσω Bluetooth -Name[en_GB]=Send file via Bluetooth -Name[es]=Enviar archivo usando Bluetooth -Name[et]=Faili saatmine Bluetoothi kaudu -Name[eu]=Bluetooth bidez bidali -Name[fi]=Lähetä tiedosto Bluetoothin kautta -Name[fr]=Envoi de fichiers via Bluetooth -Name[gl]=Enviar o ficheiro por Bluetooth -Name[he]=שלח קובץ דרך הבלוטוס -Name[hu]=Fájl küldése Bluetoothon -Name[ia]=Invia file via Bluetooth -Name[id]=Kirim file via Bluetooth -Name[it]=Invia file via Bluetooth -Name[ja]=Bluetooth を通してファイルを送信 -Name[ko]=블루투스로 파일 보내기 -Name[lt]=Siųsti per Bluetooth -Name[nb]=Send fil over Bluetooth -Name[nl]=Verzendt bestand over bluetooth -Name[nn]=Send fil over Bluetooth -Name[pa]=ਫਾਇਲ ਨੂੰ ਬਲੂਟੁੱਥ ਰਾਹੀਂ ਭੇਜੋ -Name[pl]=Wyślij plik przez Bluetooth -Name[pt]=Enviar o ficheiro por Bluetooth -Name[pt_BR]=Enviar arquivo por Bluetooth -Name[ro]=Trimite fișier prin Bluetooth -Name[ru]=Отправить файл по Bluetooth -Name[sk]=Poslať súbor cez Bluetooth -Name[sl]=Pošlji datoteko preko Bluetooth-a -Name[sr]=Слање фајлова преко блутута -Name[sr@ijekavian]=Слање фајлова преко блутута -Name[sr@ijekavianlatin]=Slanje fajlova preko Bluetootha -Name[sr@latin]=Slanje fajlova preko Bluetootha -Name[sv]=Skicka fil via Blåtand -Name[tr]=Bluetooth üzerinden dosya gönder -Name[uk]=Надіслати файл за допомогою Bluetooth -Name[x-test]=xxSend file via Bluetoothxx -Name[zh_CN]=通过蓝牙发送文件 -Name[zh_TW]=透過藍牙傳送檔案 -X-KDE-Library=bluetoothfileitemaction -X-KDE-Submenu=Bluetooth -X-KDE-Submenu[ar]=بلوتوث -X-KDE-Submenu[bs]=Blutut -X-KDE-Submenu[ca]=Bluetooth -X-KDE-Submenu[ca@valencia]=Bluetooth -X-KDE-Submenu[cs]=Bluetooth -X-KDE-Submenu[da]=Bluetooth -X-KDE-Submenu[de]=Bluetooth -X-KDE-Submenu[el]=Bluetooth -X-KDE-Submenu[en_GB]=Bluetooth -X-KDE-Submenu[es]=Bluetooth -X-KDE-Submenu[et]=Bluetooth -X-KDE-Submenu[eu]=Bluetooth -X-KDE-Submenu[fi]=Bluetooth -X-KDE-Submenu[fr]=Bluetooth -X-KDE-Submenu[gl]=Bluetooth -X-KDE-Submenu[he]=בלוטוס -X-KDE-Submenu[hu]=Bluetooth -X-KDE-Submenu[ia]=Bluetooth -X-KDE-Submenu[id]=Bluetooth -X-KDE-Submenu[it]=Bluetooth -X-KDE-Submenu[ja]=Bluetooth -X-KDE-Submenu[ko]=블루투스 -X-KDE-Submenu[lt]=Bluetooth -X-KDE-Submenu[nb]=Bluetooth -X-KDE-Submenu[nl]=Bluetooth -X-KDE-Submenu[nn]=Bluetooth -X-KDE-Submenu[pa]=ਬਲੂਟੁੱਥ -X-KDE-Submenu[pl]=Bluetooth -X-KDE-Submenu[pt]=Bluetooth -X-KDE-Submenu[pt_BR]=Bluetooth -X-KDE-Submenu[ro]=Bluetooth -X-KDE-Submenu[ru]=Bluetooth -X-KDE-Submenu[sk]=Bluetooth -X-KDE-Submenu[sl]=Bluetooth -X-KDE-Submenu[sr]=Блутут -X-KDE-Submenu[sr@ijekavian]=Блутут -X-KDE-Submenu[sr@ijekavianlatin]=Bluetooth -X-KDE-Submenu[sr@latin]=Bluetooth -X-KDE-Submenu[sv]=Blåtand -X-KDE-Submenu[tr]=Bluetooth -X-KDE-Submenu[uk]=Bluetooth -X-KDE-Submenu[x-test]=xxBluetoothxx -X-KDE-Submenu[zh_CN]=蓝牙 -X-KDE-Submenu[zh_TW]=藍牙 -Icon=preferences-system-bluetooth -X-KDE-ServiceTypes=KFileItemAction/Plugin -MimeType=application/octet-stream; diff --git a/src/fileitemactionplugin/sendfileitemaction.h b/src/fileitemactionplugin/sendfileitemaction.h deleted file mode 100644 --- a/src/fileitemactionplugin/sendfileitemaction.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2011 Alejandro Fiestas Olivares - * Copyright (C) 2011 UFO Coders - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef SENDFILEITEMACTION_H -#define SENDFILEITEMACTION_H - -#include -#include - -#include "kdedbluedevil.h" - -class QAction; -class QWidget; - -class SendFileItemAction : public KAbstractFileItemActionPlugin -{ - Q_OBJECT - -public: - SendFileItemAction(QObject *parent, const QVariantList&); - QList actions(const KFileItemListProperties &fileItemInfos, QWidget *parent) override; - -private Q_SLOTS: - void deviceTriggered(); - void otherTriggered(); - -private: - void loadMenu(QMenu *menu); - - org::kde::BlueDevil *m_kded; - KFileItemListProperties m_infos; -}; - -#endif // SENDFILEITEMACTION_H diff --git a/src/fileitemactionplugin/sendfileitemaction.cpp b/src/fileitemactionplugin/sendfileitemaction.cpp deleted file mode 100644 --- a/src/fileitemactionplugin/sendfileitemaction.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2011 Alejandro Fiestas Olivares - * Copyright (C) 2011 UFO Coders - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "sendfileitemaction.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -K_PLUGIN_FACTORY_WITH_JSON(SendFileItemActionFactory, - "bluedevilfileitemaction.json", - registerPlugin();) - -SendFileItemAction::SendFileItemAction(QObject *parent, const QVariantList&) - : KAbstractFileItemActionPlugin(parent) -{ - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - - m_kded = new org::kde::BlueDevil(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/bluedevil"), - QDBusConnection::sessionBus(), this); -} - -QList SendFileItemAction::actions(const KFileItemListProperties &fileItemInfos, QWidget *parent) -{ - Q_UNUSED(parent) - - QList list; - - // Don't show the action for files that we can't send - if (!fileItemInfos.isLocal()) { - return list; - } - - m_infos = fileItemInfos; - - QAction *menuAction = new QAction(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")), i18n("Send via Bluetooth"), this); - QMenu *menu = new QMenu(); - menuAction->setMenu(menu); - loadMenu(menu); - - list.append(menuAction); - return list; -} - -void SendFileItemAction::deviceTriggered() -{ - QStringList args; - args.append(QStringLiteral("-u") % static_cast(sender())->data().toString()); - - const QList &fileList = m_infos.urlList(); - Q_FOREACH (const QUrl &url, fileList) { - args.append(QStringLiteral("-f") % url.path()); - } - - QProcess::startDetached(QStringLiteral("bluedevil-sendfile"), args); -} - -void SendFileItemAction::otherTriggered() -{ - QStringList args; - - const QList &fileList = m_infos.urlList(); - Q_FOREACH (const QUrl &url, fileList) { - args.append(QStringLiteral("-f") % url.path()); - } - - QProcess::startDetached(QStringLiteral("bluedevil-sendfile"), args); -} - -void SendFileItemAction::loadMenu(QMenu *menu) -{ - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(m_kded->isOnline()); - connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, menu](QDBusPendingCallWatcher *watcher) { - const QDBusPendingReply &reply = *watcher; - watcher->deleteLater(); - if (reply.isError() || !reply.value()) { - menu->menuAction()->setVisible(false); - return; - } - - watcher = new QDBusPendingCallWatcher(m_kded->allDevices()); - connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, menu](QDBusPendingCallWatcher *watcher) { - const QDBusPendingReply &reply = *watcher; - watcher->deleteLater(); - if (reply.isError()) { - menu->menuAction()->setVisible(false); - return; - } - - const QMapDeviceInfo &devices = m_kded->allDevices().value(); - Q_FOREACH (const DeviceInfo &device, devices) { - if (device.value(QStringLiteral("UUIDs")).contains(BluezQt::Services::ObexObjectPush)) { - const QIcon &icon = QIcon::fromTheme(device[QStringLiteral("icon")], QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth"))); - QAction *action = new QAction(icon, device.value(QStringLiteral("name")), this); - connect(action, &QAction::triggered, this, &SendFileItemAction::deviceTriggered); - action->setData(device.value(QStringLiteral("UBI"))); - menu->insertAction(nullptr, action); - } - } - - QAction *otherAction = new QAction(i18nc("Other Bluetooth device", "Other..."), this); - connect(otherAction, &QAction::triggered, this, &SendFileItemAction::otherTriggered); - - menu->addSeparator(); - menu->addAction(otherAction); - }); - }); -} - -#include "sendfileitemaction.moc"