OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/bluedevil5?expand=0&rev=16
7391 lines
264 KiB
Diff
7391 lines
264 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
index 9e1f264..98a8c70 100644
|
||
--- a/CMakeLists.txt
|
||
+++ b/CMakeLists.txt
|
||
@@ -1,5 +1,6 @@
|
||
project(bluedevil)
|
||
-set(PROJECT_VERSION "5.2.2")
|
||
+set(PROJECT_VERSION "5.2.90")
|
||
+set(PROJECT_VERSION_MAJOR 5)
|
||
|
||
cmake_minimum_required(VERSION 2.8.12)
|
||
|
||
@@ -8,7 +9,7 @@ configure_file(version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||
find_package(ECM REQUIRED NO_MODULE)
|
||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||
|
||
-set(QT_MIN_VERSION "5.2.0")
|
||
+set(QT_MIN_VERSION "5.4.0")
|
||
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
||
Core
|
||
Widgets
|
||
diff --git a/README b/README
|
||
index b701b77..b819ed7 100644
|
||
--- a/README
|
||
+++ b/README
|
||
@@ -1,14 +1,11 @@
|
||
BlueDevil runtime dependencies:
|
||
- -obex-data-server
|
||
+ -bluez5
|
||
+ -General Bluetooth management
|
||
+
|
||
+ -bluez-obexd
|
||
-Be able to "Browse File" aka kio_obexftp
|
||
+ -Be able to "Send Files" (bluedevil-sendfile)
|
||
-Be able to receive files
|
||
|
||
- -obexd-client
|
||
- -Be able to Send files (bluedevil-sendfile)
|
||
-
|
||
- -If you're using Alsa:
|
||
- The best way of having "automagical headset configuration" is having the bluetooth.conf hook
|
||
- enabled
|
||
-
|
||
- NOTE: Be sure to install only obexd-client and not obexd-server, since the last will conflic
|
||
- with obex-data-server.
|
||
\ No newline at end of file
|
||
+ -pulseaudio-module-bluetooth
|
||
+ -Be able to connect A2DP profile
|
||
diff --git a/src/XmlMessages.sh b/src/XmlMessages.sh
|
||
new file mode 100755
|
||
index 0000000..05651f5
|
||
--- /dev/null
|
||
+++ b/src/XmlMessages.sh
|
||
@@ -0,0 +1,22 @@
|
||
+function get_files
|
||
+{
|
||
+ echo bluedevil-mime.xml
|
||
+}
|
||
+
|
||
+function po_for_file
|
||
+{
|
||
+ case "$1" in
|
||
+ bluedevil-mime.xml)
|
||
+ echo bluedevil_xml_mimetypes.po
|
||
+ ;;
|
||
+ esac
|
||
+}
|
||
+
|
||
+function tags_for_file
|
||
+{
|
||
+ case "$1" in
|
||
+ bluedevil-mime.xml)
|
||
+ echo comment
|
||
+ ;;
|
||
+ esac
|
||
+}
|
||
diff --git a/src/bluedevil-mime.xml b/src/bluedevil-mime.xml
|
||
index 669147d..dc4af15 100644
|
||
--- a/src/bluedevil-mime.xml
|
||
+++ b/src/bluedevil-mime.xml
|
||
@@ -17,27 +17,195 @@ Notes:
|
||
<sub-class-of type="inode/directory"/>
|
||
<generic-icon name="video-display"/>
|
||
<comment>Known Device</comment>
|
||
+ <comment xml:lang="bs">Poznat uređaj</comment>
|
||
+ <comment xml:lang="ca">Dispositiu conegut</comment>
|
||
+ <comment xml:lang="cs">Známé zařízení</comment>
|
||
+ <comment xml:lang="da">Kendt enhed</comment>
|
||
+ <comment xml:lang="de">Bekanntes Gerät</comment>
|
||
+ <comment xml:lang="el">Γνωστή συσκευή</comment>
|
||
+ <comment xml:lang="en_GB">Known Device</comment>
|
||
+ <comment xml:lang="es">Dispositivo conocido</comment>
|
||
+ <comment xml:lang="fi">Tunnettu laite</comment>
|
||
+ <comment xml:lang="fr">Périphérique connu</comment>
|
||
+ <comment xml:lang="it">Dispositivo conosciuto</comment>
|
||
+ <comment xml:lang="nl">Bekend apparaat</comment>
|
||
+ <comment xml:lang="pl">Znane urządzenie</comment>
|
||
+ <comment xml:lang="pt">Dispositivo Conhecido</comment>
|
||
+ <comment xml:lang="pt_BR">Dispositivo conhecido</comment>
|
||
+ <comment xml:lang="sk">Známe zariadenie</comment>
|
||
+ <comment xml:lang="sl">Znana naprava</comment>
|
||
+ <comment xml:lang="sr">познати уређај</comment>
|
||
+ <comment xml:lang="sr@ijekavian">познати уређај</comment>
|
||
+ <comment xml:lang="sr@ijekavianlatin">poznati uređaj</comment>
|
||
+ <comment xml:lang="sr@latin">poznati uređaj</comment>
|
||
+ <comment xml:lang="sv">Känd enhet</comment>
|
||
+ <comment xml:lang="uk">Відомий пристрій</comment>
|
||
+ <comment xml:lang="zh_TW">已知的裝置</comment>
|
||
</mime-type>
|
||
<mime-type type="inode/vnd.kde.bluedevil.device.discovered">
|
||
<sub-class-of type="inode/vnd.kde.bluedevil.device"/>
|
||
<generic-icon name="video-display"/>
|
||
<comment>Discovered Device</comment>
|
||
+ <comment xml:lang="bs">Otkriven uređaj</comment>
|
||
+ <comment xml:lang="ca">Dispositiu descobert</comment>
|
||
+ <comment xml:lang="cs">Objevené zařízení</comment>
|
||
+ <comment xml:lang="da">Opdaget enhed</comment>
|
||
+ <comment xml:lang="de">Erkanntes Gerät</comment>
|
||
+ <comment xml:lang="el">Ευρεθείσα συσκευή</comment>
|
||
+ <comment xml:lang="en_GB">Discovered Device</comment>
|
||
+ <comment xml:lang="es">Dispositivo descubierto</comment>
|
||
+ <comment xml:lang="fi">Löydetty palvelu</comment>
|
||
+ <comment xml:lang="fr">Périphérique découvert</comment>
|
||
+ <comment xml:lang="it">Dispositivo scoperto</comment>
|
||
+ <comment xml:lang="nl">Gevonden apparaat</comment>
|
||
+ <comment xml:lang="pl">Odkryte urządzenie</comment>
|
||
+ <comment xml:lang="pt">Dispositivo Descoberto</comment>
|
||
+ <comment xml:lang="pt_BR">Dispositivo descoberto</comment>
|
||
+ <comment xml:lang="sk">Objavené zariadenie</comment>
|
||
+ <comment xml:lang="sl">Odkrita naprava</comment>
|
||
+ <comment xml:lang="sr">откривени уређај</comment>
|
||
+ <comment xml:lang="sr@ijekavian">откривени уређај</comment>
|
||
+ <comment xml:lang="sr@ijekavianlatin">otkriveni uređaj</comment>
|
||
+ <comment xml:lang="sr@latin">otkriveni uređaj</comment>
|
||
+ <comment xml:lang="sv">Upptäckt enhet</comment>
|
||
+ <comment xml:lang="uk">Виявлений пристрій</comment>
|
||
+ <comment xml:lang="zh_TW">已發現的裝置</comment>
|
||
</mime-type>
|
||
<mime-type type="inode/vnd.kde.bluedevil.service">
|
||
<sub-class-of type="inode/directory"/>
|
||
<generic-icon name="preferences-system-bluetooth"/>
|
||
<comment>Service</comment>
|
||
+ <comment xml:lang="bs">Usluga</comment>
|
||
+ <comment xml:lang="ca">Servei</comment>
|
||
+ <comment xml:lang="cs">Služba</comment>
|
||
+ <comment xml:lang="da">Tjeneste</comment>
|
||
+ <comment xml:lang="de">Dienst</comment>
|
||
+ <comment xml:lang="el">Υπηρεσία</comment>
|
||
+ <comment xml:lang="en_GB">Service</comment>
|
||
+ <comment xml:lang="es">Servicio</comment>
|
||
+ <comment xml:lang="fi">Palvelu</comment>
|
||
+ <comment xml:lang="fr">Service</comment>
|
||
+ <comment xml:lang="it">Servizio</comment>
|
||
+ <comment xml:lang="nl">Service</comment>
|
||
+ <comment xml:lang="pl">Usługa</comment>
|
||
+ <comment xml:lang="pt">Serviço</comment>
|
||
+ <comment xml:lang="pt_BR">Serviço</comment>
|
||
+ <comment xml:lang="sk">Služba</comment>
|
||
+ <comment xml:lang="sl">Storitev</comment>
|
||
+ <comment xml:lang="sr">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavian">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavianlatin">servis</comment>
|
||
+ <comment xml:lang="sr@latin">servis</comment>
|
||
+ <comment xml:lang="sv">Tjänst</comment>
|
||
+ <comment xml:lang="uk">Служба</comment>
|
||
+ <comment xml:lang="zh_TW">服務</comment>
|
||
</mime-type>
|
||
<mime-type type="application/vnd.kde.bluedevil-audio">
|
||
<comment>Service</comment>
|
||
+ <comment xml:lang="bs">Usluga</comment>
|
||
+ <comment xml:lang="ca">Servei</comment>
|
||
+ <comment xml:lang="cs">Služba</comment>
|
||
+ <comment xml:lang="da">Tjeneste</comment>
|
||
+ <comment xml:lang="de">Dienst</comment>
|
||
+ <comment xml:lang="el">Υπηρεσία</comment>
|
||
+ <comment xml:lang="en_GB">Service</comment>
|
||
+ <comment xml:lang="es">Servicio</comment>
|
||
+ <comment xml:lang="fi">Palvelu</comment>
|
||
+ <comment xml:lang="fr">Service</comment>
|
||
+ <comment xml:lang="it">Servizio</comment>
|
||
+ <comment xml:lang="nl">Service</comment>
|
||
+ <comment xml:lang="pl">Usługa</comment>
|
||
+ <comment xml:lang="pt">Serviço</comment>
|
||
+ <comment xml:lang="pt_BR">Serviço</comment>
|
||
+ <comment xml:lang="sk">Služba</comment>
|
||
+ <comment xml:lang="sl">Storitev</comment>
|
||
+ <comment xml:lang="sr">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavian">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavianlatin">servis</comment>
|
||
+ <comment xml:lang="sr@latin">servis</comment>
|
||
+ <comment xml:lang="sv">Tjänst</comment>
|
||
+ <comment xml:lang="uk">Служба</comment>
|
||
+ <comment xml:lang="zh_TW">服務</comment>
|
||
</mime-type>
|
||
<mime-type type="application/vnd.kde.bluedevil-network-panu">
|
||
<comment>Service</comment>
|
||
+ <comment xml:lang="bs">Usluga</comment>
|
||
+ <comment xml:lang="ca">Servei</comment>
|
||
+ <comment xml:lang="cs">Služba</comment>
|
||
+ <comment xml:lang="da">Tjeneste</comment>
|
||
+ <comment xml:lang="de">Dienst</comment>
|
||
+ <comment xml:lang="el">Υπηρεσία</comment>
|
||
+ <comment xml:lang="en_GB">Service</comment>
|
||
+ <comment xml:lang="es">Servicio</comment>
|
||
+ <comment xml:lang="fi">Palvelu</comment>
|
||
+ <comment xml:lang="fr">Service</comment>
|
||
+ <comment xml:lang="it">Servizio</comment>
|
||
+ <comment xml:lang="nl">Service</comment>
|
||
+ <comment xml:lang="pl">Usługa</comment>
|
||
+ <comment xml:lang="pt">Serviço</comment>
|
||
+ <comment xml:lang="pt_BR">Serviço</comment>
|
||
+ <comment xml:lang="sk">Služba</comment>
|
||
+ <comment xml:lang="sl">Storitev</comment>
|
||
+ <comment xml:lang="sr">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavian">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavianlatin">servis</comment>
|
||
+ <comment xml:lang="sr@latin">servis</comment>
|
||
+ <comment xml:lang="sv">Tjänst</comment>
|
||
+ <comment xml:lang="uk">Служба</comment>
|
||
+ <comment xml:lang="zh_TW">服務</comment>
|
||
</mime-type>
|
||
<mime-type type="application/vnd.kde.bluedevil-network-dun">
|
||
<comment>Service</comment>
|
||
+ <comment xml:lang="bs">Usluga</comment>
|
||
+ <comment xml:lang="ca">Servei</comment>
|
||
+ <comment xml:lang="cs">Služba</comment>
|
||
+ <comment xml:lang="da">Tjeneste</comment>
|
||
+ <comment xml:lang="de">Dienst</comment>
|
||
+ <comment xml:lang="el">Υπηρεσία</comment>
|
||
+ <comment xml:lang="en_GB">Service</comment>
|
||
+ <comment xml:lang="es">Servicio</comment>
|
||
+ <comment xml:lang="fi">Palvelu</comment>
|
||
+ <comment xml:lang="fr">Service</comment>
|
||
+ <comment xml:lang="it">Servizio</comment>
|
||
+ <comment xml:lang="nl">Service</comment>
|
||
+ <comment xml:lang="pl">Usługa</comment>
|
||
+ <comment xml:lang="pt">Serviço</comment>
|
||
+ <comment xml:lang="pt_BR">Serviço</comment>
|
||
+ <comment xml:lang="sk">Služba</comment>
|
||
+ <comment xml:lang="sl">Storitev</comment>
|
||
+ <comment xml:lang="sr">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavian">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavianlatin">servis</comment>
|
||
+ <comment xml:lang="sr@latin">servis</comment>
|
||
+ <comment xml:lang="sv">Tjänst</comment>
|
||
+ <comment xml:lang="uk">Служба</comment>
|
||
+ <comment xml:lang="zh_TW">服務</comment>
|
||
</mime-type>
|
||
<mime-type type="application/vnd.kde.bluedevil-sendfile">
|
||
<comment>Service</comment>
|
||
+ <comment xml:lang="bs">Usluga</comment>
|
||
+ <comment xml:lang="ca">Servei</comment>
|
||
+ <comment xml:lang="cs">Služba</comment>
|
||
+ <comment xml:lang="da">Tjeneste</comment>
|
||
+ <comment xml:lang="de">Dienst</comment>
|
||
+ <comment xml:lang="el">Υπηρεσία</comment>
|
||
+ <comment xml:lang="en_GB">Service</comment>
|
||
+ <comment xml:lang="es">Servicio</comment>
|
||
+ <comment xml:lang="fi">Palvelu</comment>
|
||
+ <comment xml:lang="fr">Service</comment>
|
||
+ <comment xml:lang="it">Servizio</comment>
|
||
+ <comment xml:lang="nl">Service</comment>
|
||
+ <comment xml:lang="pl">Usługa</comment>
|
||
+ <comment xml:lang="pt">Serviço</comment>
|
||
+ <comment xml:lang="pt_BR">Serviço</comment>
|
||
+ <comment xml:lang="sk">Služba</comment>
|
||
+ <comment xml:lang="sl">Storitev</comment>
|
||
+ <comment xml:lang="sr">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavian">сервис</comment>
|
||
+ <comment xml:lang="sr@ijekavianlatin">servis</comment>
|
||
+ <comment xml:lang="sr@latin">servis</comment>
|
||
+ <comment xml:lang="sv">Tjänst</comment>
|
||
+ <comment xml:lang="uk">Служба</comment>
|
||
+ <comment xml:lang="zh_TW">服務</comment>
|
||
</mime-type>
|
||
</mime-info>
|
||
diff --git a/src/bluedevil.notifyrc b/src/bluedevil.notifyrc
|
||
index bda24b0..81433dd 100644
|
||
--- a/src/bluedevil.notifyrc
|
||
+++ b/src/bluedevil.notifyrc
|
||
@@ -1,16 +1,26 @@
|
||
[Global]
|
||
IconName=preferences-system-bluetooth
|
||
Comment=Bluetooth system
|
||
+Comment[ast]=Sistema Bluetooth
|
||
+Comment[bs]=Bluetooth sistem
|
||
Comment[ca]=Sistema Bluetooth
|
||
Comment[cs]=Systém Bluetooth
|
||
Comment[de]=Bluetooth-System
|
||
+Comment[el]=Σύστημα Bluetooth
|
||
Comment[en_GB]=Bluetooth system
|
||
Comment[es]=Sistema Bluetooth
|
||
+Comment[et]=Bluetoothi süsteem
|
||
Comment[fi]=Bluetooth-järjestelmä
|
||
Comment[fr]=Système Bluetooth
|
||
Comment[it]=Sistema Bluetooth
|
||
+Comment[ja]=Bluetooth システム
|
||
+Comment[kk]=Bluetooth жүйесі
|
||
+Comment[ko]=블루투스 시스템
|
||
+Comment[lt]=Bluetooth
|
||
+Comment[mr]=ब्लूटूथ प्रणाली
|
||
Comment[nb]=Blåtann-system
|
||
Comment[nl]=Bluetooth-systeem
|
||
+Comment[pa]=ਬਲਿਊਟੁੱਥ ਸਿਸਟਮ
|
||
Comment[pl]=System Bluetooth
|
||
Comment[pt]=Sistema Bluetooth
|
||
Comment[pt_BR]=Sistema Bluetooth
|
||
@@ -21,20 +31,31 @@ Comment[sr@ijekavian]=Блутут систем
|
||
Comment[sr@ijekavianlatin]=Bluetooth sistem
|
||
Comment[sr@latin]=Bluetooth sistem
|
||
Comment[sv]=Blåtandsystem
|
||
+Comment[tr]=Bluetooth sistemi
|
||
Comment[uk]=Система Bluetooth
|
||
Comment[x-test]=xxBluetooth systemxx
|
||
Comment[zh_CN]=蓝牙系统
|
||
+Comment[zh_TW]=藍牙系統
|
||
Name=Bluetooth
|
||
+Name[bs]=Blutut
|
||
Name[ca]=Bluetooth
|
||
Name[cs]=Bluetooth
|
||
Name[de]=Bluetooth
|
||
+Name[el]=Bluetooth
|
||
Name[en_GB]=Bluetooth
|
||
Name[es]=Bluetooth
|
||
+Name[et]=Bluetooth
|
||
Name[fi]=Bluetooth
|
||
Name[fr]=Bluetooth
|
||
Name[it]=Bluetooth
|
||
+Name[ja]=Bluetooth
|
||
+Name[kk]=Bluetooth
|
||
+Name[ko]=블루투스
|
||
+Name[lt]=Bluetooth
|
||
+Name[mr]=ब्लूटूथ
|
||
Name[nb]=Blåtann
|
||
Name[nl]=Bluetooth
|
||
+Name[pa]=ਬਲਿਊਟੁੱਥ
|
||
Name[pl]=Bluetooth
|
||
Name[pt]=Bluetooth
|
||
Name[pt_BR]=Bluetooth
|
||
@@ -45,18 +66,23 @@ Name[sr@ijekavian]=Блутут
|
||
Name[sr@ijekavianlatin]=Bluetooth
|
||
Name[sr@latin]=Bluetooth
|
||
Name[sv]=Blåtand
|
||
+Name[tr]=Bluetooth
|
||
Name[uk]=Bluetooth
|
||
Name[x-test]=xxBluetoothxx
|
||
Name[zh_CN]=蓝牙
|
||
+Name[zh_TW]=藍牙
|
||
Ignore=true
|
||
|
||
[Event/bluedevilAuthorize]
|
||
Name=Authorization Requested
|
||
+Name[bs]=Zahtijeva odobrenje
|
||
Name[ca]=Sol·licitud d'autorització
|
||
Name[cs]=Je vyžadováno udělení oprávnění
|
||
Name[de]=Autorisierung gefordert
|
||
+Name[el]=Απαιτείται ταυτοποίηση
|
||
Name[en_GB]=Authorisation Requested
|
||
Name[es]=Se ha solicitado autorización
|
||
+Name[et]=Autentimise nõue
|
||
Name[fi]=Valtuutusta pyydetty
|
||
Name[fr]=Autorisation demandée
|
||
Name[it]=Richiesta autorizzazione
|
||
@@ -72,15 +98,20 @@ Name[sr@ijekavian]=Неопходно овлашћивање
|
||
Name[sr@ijekavianlatin]=Neophodno ovlašćivanje
|
||
Name[sr@latin]=Neophodno ovlašćivanje
|
||
Name[sv]=Behörighet begärd
|
||
+Name[tr]=Yetkilendirme Gerekli
|
||
Name[uk]=Слід пройти розпізнавання
|
||
Name[x-test]=xxAuthorization Requestedxx
|
||
Name[zh_CN]=要求认证
|
||
+Name[zh_TW]=請求認證
|
||
Comment=A device wants to connect
|
||
+Comment[bs]=Uređaj se zeli konektovati
|
||
Comment[ca]=Un dispositiu es vol connectar
|
||
Comment[cs]=Zařízení se chce připojit
|
||
Comment[de]=Ein Gerät möchte sich verbinden
|
||
+Comment[el]=Μία συσκευή επιθυμεί να συνδεθεί
|
||
Comment[en_GB]=A device wants to connect
|
||
-Comment[es]=Un dispositivo quiere conectarse
|
||
+Comment[es]=Un dispositivo desea conectarse
|
||
+Comment[et]=Seade soovib ühendust luua
|
||
Comment[fi]=Laite haluaa ottaa yhteyden
|
||
Comment[fr]=Un périphérique veut se connecter
|
||
Comment[it]=Un dispositivo vuole connettersi
|
||
@@ -96,18 +127,23 @@ Comment[sr@ijekavian]=Уређај жели да се повеже
|
||
Comment[sr@ijekavianlatin]=Uređaj želi da se poveže
|
||
Comment[sr@latin]=Uređaj želi da se poveže
|
||
Comment[sv]=En enhet vill ansluta
|
||
+Comment[tr]=Bir aygıt bağlanmak istiyor
|
||
Comment[uk]=Отримано запит щодо з’єднання пристрою з комп’ютером
|
||
Comment[x-test]=xxA device wants to connectxx
|
||
Comment[zh_CN]=一个设备想要连接
|
||
+Comment[zh_TW]=某個裝置希望能與您連線
|
||
Action=Popup
|
||
|
||
[Event/bluedevilConfirmModechange]
|
||
Name=Confirm Mode Change
|
||
+Name[bs]=Povrdi promijene moda
|
||
Name[ca]=Confirmació del canvi de mode
|
||
Name[cs]=Potvrdit změnu režimu
|
||
Name[de]=Moduswechsel bestätigen
|
||
+Name[el]=Επιβεβαίωση αλλαγής λειτουργίας
|
||
Name[en_GB]=Confirm Mode Change
|
||
Name[es]=Confirmar el cambio de modo
|
||
+Name[et]=Režiimimuutuse kinnitus
|
||
Name[fi]=Vahvistan tilan vaihto
|
||
Name[fr]=Confirmer le changement de mode
|
||
Name[it]=Conferma cambio di modalità
|
||
@@ -123,13 +159,17 @@ Name[sr@ijekavian]=Потврди промену режима
|
||
Name[sr@ijekavianlatin]=Potvrdi promenu režima
|
||
Name[sr@latin]=Potvrdi promenu režima
|
||
Name[sv]=Bekräfta lägesändring
|
||
+Name[tr]=Kip Değişikliğini Onayla
|
||
Name[uk]=Підтвердження зміни режиму
|
||
Name[x-test]=xxConfirm Mode Changexx
|
||
Name[zh_CN]=确认模式变更
|
||
+Name[zh_TW]=確認模式變更
|
||
Comment=Bluetooth mode is about to be changed (normal to flight for example)
|
||
+Comment[bs]=Režim blututa će biti promijenjen (npr. s normalnog na ljetni)
|
||
Comment[ca]=El mode Bluetooth és a punt de canviar (de mode normal a mode avió per exemple)
|
||
Comment[cs]=Bude změněn režim Bluetooth (např. Normální na V letadle)
|
||
Comment[de]=Der Bluetooth-Modus ist im Begriff, sich zu ändern (z. B. von normal auf Flugzeugmodus)
|
||
+Comment[el]=Η λειτουργία του Bluetooth πρόκειται να αλλάξει (π.χ. από κανονική σε πτήσης)
|
||
Comment[en_GB]=Bluetooth mode is about to be changed (normal to flight for example)
|
||
Comment[es]=El modo Bluetooth está a punto de cambiar (de normal a vuelo, por ejemplo)
|
||
Comment[fi]=Bluetooth-tilaa muutetaan (esim. tavallisesta lentokonetilaksi)
|
||
@@ -147,23 +187,31 @@ Comment[sr@ijekavian]=Режим блутута ће бити промијење
|
||
Comment[sr@ijekavianlatin]=Režim Bluetootha će biti promijenjen (npr. s normalnog na ljetni)
|
||
Comment[sr@latin]=Režim Bluetootha će biti promenjen (npr. s normalnog na letni)
|
||
Comment[sv]=Blåtandläget ska just ändras (exempelvis från normal till flygning)
|
||
+Comment[th]=โหมดของบลูทูทจะถูกเปลี่ยนโหมด (เช่น จากโหมดปกติเป็นโหมดไฟลท์ เป็นต้น)
|
||
+Comment[tr]=Bluetooth kipi değiştirilmek üzere (örn. normal -> uçuş kipi)
|
||
+Comment[ug]=كۆكچىش ھالىتى ئۆزگەرتىلدى(مەسىلەن: نورمال -› ئۈچۈشقا)
|
||
Comment[uk]=Зміна режиму роботи Bluetooth (наприклад, зі звичайного на автономний)
|
||
Comment[x-test]=xxBluetooth mode is about to be changed (normal to flight for example)xx
|
||
Comment[zh_CN]=蓝牙模式即将更改(例如从正常变到飞行模式)
|
||
+Comment[zh_TW]=即將改變藍牙模式(例如從一般模式轉換為飛航模式)
|
||
Action=Popup
|
||
|
||
[Event/bluedevilRequestConfirmation]
|
||
Name=Confirm PIN
|
||
+Name[bs]=Potvrdi pin
|
||
Name[ca]=Confirmació del PIN
|
||
Name[cs]=Potvrdit PIN
|
||
Name[de]=PIN bestätigen
|
||
+Name[el]=Επιβεβαίωση PIN
|
||
Name[en_GB]=Confirm PIN
|
||
Name[es]=Confirmar PIN
|
||
+Name[et]=PIN-i kinnitus
|
||
Name[fi]=Vahvista PIN
|
||
Name[fr]=Confirmer le code « PIN »
|
||
Name[it]=Conferma PIN
|
||
Name[nb]=Bekreft PIN
|
||
Name[nl]=PIN bevestigen
|
||
+Name[pa]=ਤਸਦੀਕ ਪਿਨ
|
||
Name[pl]=Potwierdź numer PIN
|
||
Name[pt]=Confirmar o PIN
|
||
Name[pt_BR]=Confirmar o PIN
|
||
@@ -174,15 +222,20 @@ Name[sr@ijekavian]=Потврди ПИН
|
||
Name[sr@ijekavianlatin]=Potvrdi PIN
|
||
Name[sr@latin]=Potvrdi PIN
|
||
Name[sv]=Bekräfta PIN-kod
|
||
+Name[tr]=PIN'i Onaylayın
|
||
Name[uk]=Підтвердження PIN
|
||
Name[x-test]=xxConfirm PINxx
|
||
Name[zh_CN]=确认 PIN
|
||
+Name[zh_TW]=確認 PIN 碼
|
||
Comment=Confirm a device request using matching PINs
|
||
+Comment[bs]=Potvrdi zahtjev uređaja koristeci odgovarajuce pinove
|
||
Comment[ca]=Confirma una sol·licitud d'un dispositiu usant PIN que coincideixin
|
||
Comment[cs]=Potvrďte požadavek zařízení použitím odpovídajících PINů
|
||
Comment[de]=Eine Geräteanforderung mit passenden PINs bestätigen
|
||
+Comment[el]=Επιβεβαίωση αίτησης συσκευής που χρησιμοποιεί ταιριαστά PIN
|
||
Comment[en_GB]=Confirm a device request using matching PINs
|
||
-Comment[es]=Confirmar la solicitud de un dispositivo usando un PIN coincidente
|
||
+Comment[es]=Confirmar la petición de un dispositivo usando PIN emparejados
|
||
+Comment[et]=Seadme nõude kinnitamine sobivate PIN-idega
|
||
Comment[fi]=Vahvista laitepyyntö käyttämällä samoja PIN-lukuja
|
||
Comment[fr]=Confirme une demande d'un périphérique utilisant une correspondance de codes « PIN »
|
||
Comment[it]=Conferma la richiesta di un dispositivo usando PIN corrispondenti
|
||
@@ -198,16 +251,20 @@ Comment[sr@ijekavian]=Потврдите захтев уређаја одгов
|
||
Comment[sr@ijekavianlatin]=Potvrdite zahtev uređaja odgovarajućim PIN‑om
|
||
Comment[sr@latin]=Potvrdite zahtev uređaja odgovarajućim PIN‑om
|
||
Comment[sv]=Bekräfta att en enhetsbegäran använder PIN-koder som stämmer
|
||
+Comment[tr]=Eşleştirme PIN'i kullanarak bir aygıt isteğini onaylayın
|
||
Comment[uk]=Підтвердження запиту пристрою відповідними PIN-кодами
|
||
Comment[x-test]=xxConfirm a device request using matching PINsxx
|
||
Comment[zh_CN]=确认设备请求使用了匹配的 PIN
|
||
+Comment[zh_TW]=利用比對 PIN 碼確認裝置的要求
|
||
Action=Popup
|
||
|
||
[Event/bluedevilRequestPin]
|
||
Name=Request PIN
|
||
+Name[bs]=Zahtijevaj PIN
|
||
Name[ca]=Sol·licita el PIN
|
||
Name[cs]=Vyžádat PIN
|
||
Name[de]=PIN anfordern
|
||
+Name[el]=Αίτηση PIN
|
||
Name[en_GB]=Request PIN
|
||
Name[es]=Solicitar PIN
|
||
Name[fi]=Pyydä PINiä
|
||
@@ -215,6 +272,7 @@ Name[fr]=Demande de code « PIN »
|
||
Name[it]=Richiesta PIN
|
||
Name[nb]=Be om PIN
|
||
Name[nl]=Om PIN verzoeken
|
||
+Name[pa]=ਬੇਨਤੀ ਪਿਨ
|
||
Name[pl]=Żąda numeru PIN
|
||
Name[pt]=Pedir o PIN
|
||
Name[pt_BR]=Solicitar o PIN
|
||
@@ -225,20 +283,31 @@ Name[sr@ijekavian]=Захтијевај ПИН
|
||
Name[sr@ijekavianlatin]=Zahtijevaj PIN
|
||
Name[sr@latin]=Zahtevaj PIN
|
||
Name[sv]=Begär PIN-kod
|
||
+Name[tr]=PIN iste
|
||
Name[uk]=Запит щодо PIN-коду
|
||
Name[x-test]=xxRequest PINxx
|
||
Name[zh_CN]=请求 PIN
|
||
+Name[zh_TW]=需要 PIN 碼
|
||
Comment=A PIN is needed
|
||
+Comment[bs]=Potreban je PIN
|
||
Comment[ca]=Es necessita un PIN
|
||
Comment[cs]=Je potřeba PIN
|
||
Comment[de]=Eine PIN wird benötigt
|
||
+Comment[el]=Απαιτείται PIN
|
||
Comment[en_GB]=A PIN is needed
|
||
Comment[es]=Se necesita un PIN
|
||
Comment[fi]=PIN vaaditaan
|
||
Comment[fr]=Un code « PIN » est nécessaire
|
||
Comment[it]=Un PIN è richiesto
|
||
+Comment[ja]=PIN が必要です
|
||
+Comment[kk]=PIN -коды керек
|
||
+Comment[km]=ត្រូវការ PIN
|
||
+Comment[ko]=PIN이 필요함
|
||
+Comment[lt]=Reikia PIN
|
||
+Comment[mr]=PIN ची गरज आहे
|
||
Comment[nb]=En PIN kreves
|
||
Comment[nl]=Er is een PIN nodig
|
||
+Comment[pa]=ਪਿਨ ਦੀ ਲੋੜ ਹੈ
|
||
Comment[pl]=Potrzebny jest numer PIN
|
||
Comment[pt]=É necessário um PIN
|
||
Comment[pt_BR]=É necessário um PIN
|
||
@@ -249,16 +318,20 @@ Comment[sr@ijekavian]=Потребан је ПИН
|
||
Comment[sr@ijekavianlatin]=Potreban je PIN
|
||
Comment[sr@latin]=Potreban je PIN
|
||
Comment[sv]=En PIN-kod behövs
|
||
+Comment[tr]=PIN gerekiyor
|
||
Comment[uk]=Потрібен PIN-код
|
||
Comment[x-test]=xxA PIN is neededxx
|
||
Comment[zh_CN]=需要 PIN
|
||
+Comment[zh_TW]=需要 PIN 碼
|
||
Action=Popup
|
||
|
||
[Event/bluedevilIncomingFile]
|
||
Name=Incoming File
|
||
+Name[bs]=Dolazeća datoteka
|
||
Name[ca]=Fitxer entrant
|
||
Name[cs]=Příchozí soubor
|
||
Name[de]=Eingehende Datei
|
||
+Name[el]=Εισερχόμενο αρχείο
|
||
Name[en_GB]=Incoming File
|
||
Name[es]=Archivo entrante
|
||
Name[fi]=Saapuva tiedosto
|
||
@@ -266,6 +339,7 @@ Name[fr]=Fichier entrant
|
||
Name[it]=File in arrivo
|
||
Name[nb]=Innkommende fil
|
||
Name[nl]=Bestand aangeboden
|
||
+Name[pa]=ਆ ਰਹੀ ਫਾਇਲ
|
||
Name[pl]=Przychodzący plik
|
||
Name[pt]=Ficheiro Recebido
|
||
Name[pt_BR]=Arquivo recebido
|
||
@@ -276,20 +350,26 @@ Name[sr@ijekavian]=Долазни фајл
|
||
Name[sr@ijekavianlatin]=Dolazni fajl
|
||
Name[sr@latin]=Dolazni fajl
|
||
Name[sv]=Inkommande fil
|
||
+Name[tr]=Gelen Dosya
|
||
Name[uk]=Вхідний файл
|
||
Name[x-test]=xxIncoming Filexx
|
||
Name[zh_CN]=正在传入的文件
|
||
+Name[zh_TW]=要傳進來的檔案
|
||
Comment=Incoming file transfer
|
||
+Comment[bs]=Dolazni transfer datoteke
|
||
Comment[ca]=Transferència de fitxer entrant
|
||
Comment[cs]=Příchozí přenos souboru
|
||
Comment[de]=Eingehende Dateiübertragung
|
||
+Comment[el]=Μεταφορά εισερχόμενου αρχείου
|
||
Comment[en_GB]=Incoming file transfer
|
||
Comment[es]=Transferencia de archivo entrante
|
||
+Comment[et]=Sisenev failiedastus
|
||
Comment[fi]=Saapuva tiedostonsiirto
|
||
Comment[fr]=Transfert de fichier entrant
|
||
Comment[it]=Trasferimento di file in arrivo
|
||
Comment[nb]=Innkommende filoverføring
|
||
Comment[nl]=Inkomende bestandsoverdracht
|
||
+Comment[pa]=ਆ ਰਹੀ ਫਾਇਲ ਟਰਾਂਸਫਰ
|
||
Comment[pl]=Przychodzące przesyłanie pliku
|
||
Comment[pt]=Transferência de ficheiro recebida
|
||
Comment[pt_BR]=Transferência de arquivo recebida
|
||
@@ -300,7 +380,9 @@ Comment[sr@ijekavian]=Долазни пренос фајла
|
||
Comment[sr@ijekavianlatin]=Dolazni prenos fajla
|
||
Comment[sr@latin]=Dolazni prenos fajla
|
||
Comment[sv]=Inkommande filöverföring
|
||
+Comment[tr]=Gelen dosya aktarımı
|
||
Comment[uk]=Вхідне перенесення файла
|
||
Comment[x-test]=xxIncoming file transferxx
|
||
Comment[zh_CN]=收到文件传输
|
||
+Comment[zh_TW]=進來的檔案傳輸
|
||
Action=Popup
|
||
diff --git a/src/daemon/helpers/authorize/authorize.cpp b/src/daemon/helpers/authorize/authorize.cpp
|
||
index c6f44da..6847ba9 100644
|
||
--- a/src/daemon/helpers/authorize/authorize.cpp
|
||
+++ b/src/daemon/helpers/authorize/authorize.cpp
|
||
@@ -39,33 +39,33 @@ Authorize::Authorize()
|
||
|
||
notification->setText(i18nc(
|
||
"Show a notification asking to authorize or deny access to this computer from Bluetooth. The %1 is the name of the bluetooth device",
|
||
- "%1 is requesting access to this computer", qApp->arguments()[1])
|
||
+ "%1 is requesting access to this computer", qApp->arguments().at(1))
|
||
);
|
||
|
||
QStringList actions;
|
||
actions.append(i18nc("Button to trust a bluetooth remote device and authorize it to connect", "Trust and Authorize"));
|
||
- actions.append(i18nc("Button to authorize a bluetooth remote device to connect ", "Authorize Only"));
|
||
+ actions.append(i18nc("Button to authorize a bluetooth remote device to connect", "Authorize Only"));
|
||
actions.append(i18nc("Deny access to a remote bluetooth device", "Deny"));
|
||
|
||
notification->setActions(actions);
|
||
|
||
- connect(notification, SIGNAL(action1Activated()),this, SLOT(trust()));
|
||
- connect(notification, SIGNAL(action2Activated()),this, SLOT(authorize()));
|
||
- connect(notification, SIGNAL(action3Activated()),this, SLOT(deny()));
|
||
- connect(notification, SIGNAL(closed()), this, SLOT(deny()));
|
||
- connect(notification, SIGNAL(ignored()), this, SLOT(deny()));
|
||
+ connect(notification, &KNotification::action1Activated, this, &Authorize::trust);
|
||
+ connect(notification, &KNotification::action2Activated, this, &Authorize::authorize);
|
||
+ connect(notification, &KNotification::action3Activated, this, &Authorize::deny);
|
||
+ connect(notification, &KNotification::closed, this, &Authorize::deny);
|
||
+ connect(notification, &KNotification::ignored, this, &Authorize::deny);
|
||
|
||
- notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(42, 42));
|
||
+ notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(42));
|
||
|
||
// We're using persistent notifications so we have to use our own timeout (10s)
|
||
- QTimer::singleShot(10000, notification, SLOT(close()));
|
||
+ QTimer::singleShot(10000, notification, &KNotification::close);
|
||
notification->sendEvent();
|
||
}
|
||
|
||
void Authorize::trust()
|
||
{
|
||
qDebug() << "Trusted";
|
||
- BlueDevil::Manager::self()->usableAdapter()->deviceForUBI(qApp->arguments()[2])->setTrusted(true);
|
||
+ BlueDevil::Manager::self()->usableAdapter()->deviceForUBI(qApp->arguments().at(2))->setTrusted(true);
|
||
qApp->exit(0);
|
||
}
|
||
|
||
diff --git a/src/daemon/helpers/authorize/authorize.h b/src/daemon/helpers/authorize/authorize.h
|
||
index d881baa..b3b4190 100644
|
||
--- a/src/daemon/helpers/authorize/authorize.h
|
||
+++ b/src/daemon/helpers/authorize/authorize.h
|
||
@@ -32,8 +32,7 @@
|
||
* Deny quits the app with 1 (which means denied)
|
||
* @internal
|
||
*/
|
||
-class Authorize
|
||
- : public QObject
|
||
+class Authorize : public QObject
|
||
{
|
||
Q_OBJECT
|
||
|
||
@@ -42,7 +41,7 @@ public:
|
||
* Launch the KNotification which the respective actions, also makes the needed connection
|
||
* between those actions and the slots
|
||
*/
|
||
- Authorize();
|
||
+ explicit Authorize();
|
||
|
||
private Q_SLOTS:
|
||
/**
|
||
@@ -60,4 +59,5 @@ private Q_SLOTS:
|
||
*/
|
||
void deny();
|
||
};
|
||
-#endif
|
||
+
|
||
+#endif // AUTHORIZE_H
|
||
diff --git a/src/daemon/helpers/authorize/main.cpp b/src/daemon/helpers/authorize/main.cpp
|
||
index 615245f..8106ff6 100644
|
||
--- a/src/daemon/helpers/authorize/main.cpp
|
||
+++ b/src/daemon/helpers/authorize/main.cpp
|
||
@@ -18,15 +18,10 @@
|
||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
|
||
*************************************************************************************/
|
||
|
||
-
|
||
#include "authorize.h"
|
||
|
||
#include <QApplication>
|
||
|
||
-#include <KLocalizedString>
|
||
-
|
||
-static const KLocalizedString description = ki18n("KDE Bluetooth System");
|
||
-
|
||
int main(int argc, char *argv[])
|
||
{
|
||
QApplication app(argc, argv);
|
||
diff --git a/src/daemon/helpers/confirmmodechange/confirmmodechange.cpp b/src/daemon/helpers/confirmmodechange/confirmmodechange.cpp
|
||
index 1328f74..62eccd3 100644
|
||
--- a/src/daemon/helpers/confirmmodechange/confirmmodechange.cpp
|
||
+++ b/src/daemon/helpers/confirmmodechange/confirmmodechange.cpp
|
||
@@ -37,7 +37,7 @@ ConfirmModeChange::ConfirmModeChange()
|
||
|
||
notification->setText(i18nc(
|
||
"Showed in a notification when the Bluetooth mode is going to be changed (for example to flight mode), the %1 is the name of the mode",
|
||
- "Change Bluetooth mode to '%1'?", qApp->arguments()[1])
|
||
+ "Change Bluetooth mode to '%1'?", qApp->arguments().at(1))
|
||
);
|
||
|
||
QStringList actions;
|
||
@@ -46,14 +46,14 @@ ConfirmModeChange::ConfirmModeChange()
|
||
|
||
notification->setActions(actions);
|
||
|
||
- connect(notification, SIGNAL(action1Activated()),this, SLOT(confirm()));
|
||
- connect(notification, SIGNAL(action2Activated()),this, SLOT(deny()));
|
||
- connect(notification, SIGNAL(closed()), this, SLOT(deny()));
|
||
- connect(notification, SIGNAL(ignored()), this, SLOT(deny()));
|
||
+ connect(notification, &KNotification::action1Activated,this, &ConfirmModeChange::confirm);
|
||
+ connect(notification, &KNotification::action2Activated,this, &ConfirmModeChange::deny);
|
||
+ connect(notification, &KNotification::closed, this, &ConfirmModeChange::deny);
|
||
+ connect(notification, &KNotification::ignored, this, &ConfirmModeChange::deny);
|
||
|
||
// We're using persistent notifications so we have to use our own timeout (10s)
|
||
- QTimer::singleShot(10000, notification, SLOT(close()));
|
||
- notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(42, 42));
|
||
+ QTimer::singleShot(10000, notification, &KNotification::close);
|
||
+ notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(42));
|
||
notification->sendEvent();
|
||
}
|
||
|
||
@@ -68,4 +68,3 @@ void ConfirmModeChange::deny()
|
||
qDebug() << "Denied";
|
||
qApp->exit(1);
|
||
}
|
||
-
|
||
diff --git a/src/daemon/helpers/confirmmodechange/confirmmodechange.h b/src/daemon/helpers/confirmmodechange/confirmmodechange.h
|
||
index 4d79b02..572fb57 100644
|
||
--- a/src/daemon/helpers/confirmmodechange/confirmmodechange.h
|
||
+++ b/src/daemon/helpers/confirmmodechange/confirmmodechange.h
|
||
@@ -19,8 +19,8 @@
|
||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||
***************************************************************************/
|
||
|
||
-#ifndef AUTHORIZE_H
|
||
-#define AUTHORIZE_H
|
||
+#ifndef CONFIRM_MODE_CHANGE_H
|
||
+#define CONFIRM_MODE_CHANGE_H
|
||
|
||
#include <QObject>
|
||
|
||
@@ -32,8 +32,7 @@
|
||
* Deny quits the app with 1 (which means denied)
|
||
* @internal
|
||
*/
|
||
-class ConfirmModeChange
|
||
- : public QObject
|
||
+class ConfirmModeChange : public QObject
|
||
{
|
||
Q_OBJECT
|
||
|
||
@@ -42,7 +41,7 @@ public:
|
||
* Launch the KNotification which the respective actions, also makes the needed connection
|
||
* between those actions and the slots
|
||
*/
|
||
- ConfirmModeChange();
|
||
+ explicit ConfirmModeChange();
|
||
|
||
private Q_SLOTS:
|
||
/**
|
||
@@ -55,4 +54,5 @@ private Q_SLOTS:
|
||
*/
|
||
void deny();
|
||
};
|
||
-#endif
|
||
+
|
||
+#endif // CONFIRM_MODE_CHANGE_H
|
||
diff --git a/src/daemon/helpers/confirmmodechange/main.cpp b/src/daemon/helpers/confirmmodechange/main.cpp
|
||
index b4ed946..a2e05bb 100644
|
||
--- a/src/daemon/helpers/confirmmodechange/main.cpp
|
||
+++ b/src/daemon/helpers/confirmmodechange/main.cpp
|
||
@@ -18,15 +18,10 @@
|
||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
|
||
*************************************************************************************/
|
||
|
||
-
|
||
#include "confirmmodechange.h"
|
||
|
||
#include <QApplication>
|
||
|
||
-#include <KLocalizedString>
|
||
-
|
||
-static const KLocalizedString description = ki18n("KDE Bluetooth System");
|
||
-
|
||
int main(int argc, char *argv[])
|
||
{
|
||
QApplication app(argc,argv);
|
||
diff --git a/src/daemon/helpers/requestconfirmation/main.cpp b/src/daemon/helpers/requestconfirmation/main.cpp
|
||
index e7ecde0..f324060 100644
|
||
--- a/src/daemon/helpers/requestconfirmation/main.cpp
|
||
+++ b/src/daemon/helpers/requestconfirmation/main.cpp
|
||
@@ -22,10 +22,6 @@
|
||
|
||
#include <QApplication>
|
||
|
||
-#include <KLocalizedString>
|
||
-
|
||
-static const KLocalizedString description = ki18n("KDE Bluetooth System");
|
||
-
|
||
int main(int argc, char *argv[])
|
||
{
|
||
QApplication app(argc, argv);
|
||
diff --git a/src/daemon/helpers/requestconfirmation/requestconfirmation.cpp b/src/daemon/helpers/requestconfirmation/requestconfirmation.cpp
|
||
index ac24731..31b15c3 100644
|
||
--- a/src/daemon/helpers/requestconfirmation/requestconfirmation.cpp
|
||
+++ b/src/daemon/helpers/requestconfirmation/requestconfirmation.cpp
|
||
@@ -35,7 +35,7 @@ RequestConfirmation::RequestConfirmation() : QObject()
|
||
|
||
notification->setText(i18nc(
|
||
"The text is shown in a notification to know if the PIN is correct, %1 is the remote bluetooth device and %2 is the pin",
|
||
- "%1 is asking if the PIN is correct: %2", qApp->arguments()[1], qApp->arguments()[2])
|
||
+ "%1 is asking if the PIN is correct: %2", qApp->arguments().at(1), qApp->arguments().at(2))
|
||
);
|
||
|
||
QStringList actions;
|
||
@@ -44,14 +44,14 @@ RequestConfirmation::RequestConfirmation() : QObject()
|
||
|
||
notification->setActions(actions);
|
||
|
||
- connect(notification, SIGNAL(action1Activated()),this, SLOT(pinCorrect()));
|
||
- connect(notification, SIGNAL(action2Activated()),this, SLOT(pinWrong()));
|
||
- connect(notification, SIGNAL(closed()), this, SLOT(pinWrong()));
|
||
- connect(notification, SIGNAL(ignored()), this, SLOT(pinWrong()));
|
||
+ connect(notification, &KNotification::action1Activated, this, &RequestConfirmation::pinCorrect);
|
||
+ connect(notification, &KNotification::action2Activated, this, &RequestConfirmation::pinWrong);
|
||
+ connect(notification, &KNotification::closed, this, &RequestConfirmation::pinWrong);
|
||
+ connect(notification, &KNotification::ignored, this, &RequestConfirmation::pinWrong);
|
||
|
||
- //We're using persistent notifications so we have to use our own timeout (10s)
|
||
- QTimer::singleShot(10000, notification, SLOT(close()));
|
||
- notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(42,42));
|
||
+ // We're using persistent notifications so we have to use our own timeout (10s)
|
||
+ QTimer::singleShot(10000, notification, &KNotification::close);
|
||
+ notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(42));
|
||
notification->sendEvent();
|
||
}
|
||
|
||
diff --git a/src/daemon/helpers/requestconfirmation/requestconfirmation.h b/src/daemon/helpers/requestconfirmation/requestconfirmation.h
|
||
index 60ebff8..59c6cfa 100644
|
||
--- a/src/daemon/helpers/requestconfirmation/requestconfirmation.h
|
||
+++ b/src/daemon/helpers/requestconfirmation/requestconfirmation.h
|
||
@@ -19,8 +19,8 @@
|
||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||
***************************************************************************/
|
||
|
||
-#ifndef AUTHORIZE_H
|
||
-#define AUTHORIZE_H
|
||
+#ifndef REQUEST_CONFIRMATION_H
|
||
+#define REQUEST_CONFIRMATION_H
|
||
|
||
#include <QObject>
|
||
|
||
@@ -32,8 +32,7 @@
|
||
* Deny quits the app with 1 (which means denied)
|
||
* @internal
|
||
*/
|
||
-class RequestConfirmation
|
||
- : public QObject
|
||
+class RequestConfirmation : public QObject
|
||
{
|
||
Q_OBJECT
|
||
|
||
@@ -42,7 +41,7 @@ public:
|
||
* Launch the KNotification which the respective actions, also makes the needed connection
|
||
* between those actions and the slots
|
||
*/
|
||
- RequestConfirmation();
|
||
+ explicit RequestConfirmation();
|
||
|
||
private Q_SLOTS:
|
||
/**
|
||
@@ -55,4 +54,5 @@ private Q_SLOTS:
|
||
*/
|
||
void pinWrong();
|
||
};
|
||
-#endif
|
||
+
|
||
+#endif // REQUEST_CONFIRMATION_H
|
||
diff --git a/src/daemon/helpers/requestpin/dialogWidget.ui b/src/daemon/helpers/requestpin/dialogWidget.ui
|
||
index 478f1be..8e769a3 100644
|
||
--- a/src/daemon/helpers/requestpin/dialogWidget.ui
|
||
+++ b/src/daemon/helpers/requestpin/dialogWidget.ui
|
||
@@ -7,7 +7,7 @@
|
||
<x>0</x>
|
||
<y>0</y>
|
||
<width>259</width>
|
||
- <height>127</height>
|
||
+ <height>138</height>
|
||
</rect>
|
||
</property>
|
||
<property name="minimumSize">
|
||
@@ -61,12 +61,6 @@
|
||
<verstretch>0</verstretch>
|
||
</sizepolicy>
|
||
</property>
|
||
- <property name="inputMask">
|
||
- <string notr="true"/>
|
||
- </property>
|
||
- <property name="maxLength">
|
||
- <number>32767</number>
|
||
- </property>
|
||
<property name="placeholderText">
|
||
<string>1234</string>
|
||
</property>
|
||
diff --git a/src/daemon/helpers/requestpin/main.cpp b/src/daemon/helpers/requestpin/main.cpp
|
||
index 8472108..e3cfb29 100644
|
||
--- a/src/daemon/helpers/requestpin/main.cpp
|
||
+++ b/src/daemon/helpers/requestpin/main.cpp
|
||
@@ -22,10 +22,6 @@
|
||
|
||
#include <QApplication>
|
||
|
||
-#include <KLocalizedString>
|
||
-
|
||
-static const KLocalizedString description = ki18n("KDE Bluetooth System");
|
||
-
|
||
int main(int argc, char *argv[])
|
||
{
|
||
QApplication app(argc, argv);
|
||
diff --git a/src/daemon/helpers/requestpin/requestpin.cpp b/src/daemon/helpers/requestpin/requestpin.cpp
|
||
index 7402b25..8b5f88c 100644
|
||
--- a/src/daemon/helpers/requestpin/requestpin.cpp
|
||
+++ b/src/daemon/helpers/requestpin/requestpin.cpp
|
||
@@ -37,9 +37,7 @@
|
||
#include <KNotification>
|
||
#include <KLocalizedString>
|
||
|
||
-using namespace std;
|
||
-RequestPin::RequestPin()
|
||
- : QObject()
|
||
+RequestPin::RequestPin() : QObject()
|
||
, m_dialogWidget(0)
|
||
{
|
||
m_notification = new KNotification(QStringLiteral("bluedevilRequestPin"),
|
||
@@ -47,7 +45,7 @@ RequestPin::RequestPin()
|
||
|
||
m_notification->setText(i18nc(
|
||
"Shown in a notification to announce that a PIN is needed to accomplish a pair action, %1 is the name of the bluetooth device",
|
||
- "PIN needed to pair with %1",qApp->arguments()[1])
|
||
+ "PIN needed to pair with %1", qApp->arguments().at(1))
|
||
);
|
||
|
||
QStringList actions;
|
||
@@ -58,17 +56,17 @@ RequestPin::RequestPin()
|
||
|
||
m_notification->setActions(actions);
|
||
|
||
- connect(m_notification, SIGNAL(action1Activated()),this, SLOT(introducePin()));
|
||
- connect(m_notification, SIGNAL(closed()), this, SLOT(quit()));
|
||
- connect(m_notification, SIGNAL(ignored()), this, SLOT(quit()));
|
||
+ connect(m_notification, &KNotification::action1Activated,this, &RequestPin::introducePin);
|
||
+ connect(m_notification, &KNotification::closed, this, &RequestPin::quit);
|
||
+ connect(m_notification, &KNotification::ignored, this, &RequestPin::quit);
|
||
|
||
- //We're using persistent notifications so we have to use our own timeout (10s)
|
||
+ // We're using persistent notifications so we have to use our own timeout (10s)
|
||
m_timer.setSingleShot(true);
|
||
m_timer.setInterval(10000);
|
||
m_timer.start();
|
||
- connect(&m_timer, SIGNAL(timeout()), m_notification, SLOT(close()));
|
||
+ connect(&m_timer, &QTimer::timeout, m_notification, &KNotification::close);
|
||
|
||
- m_notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(42,42));
|
||
+ m_notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(42));
|
||
m_notification->sendEvent();
|
||
}
|
||
|
||
@@ -90,27 +88,27 @@ void RequestPin::introducePin()
|
||
m_dialogWidget->descLabel->setText(i18nc(
|
||
"Shown in a dialog which asks to introduce a PIN that will be used to pair a Bluetooth device, %1 is the name of the Bluetooth device",
|
||
"In order to pair this computer with %1, you have to enter a PIN. Please do it below.",
|
||
- qApp->arguments()[1])
|
||
+ qApp->arguments().at(1))
|
||
);
|
||
- m_dialogWidget->pixmap->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(64,64));
|
||
+ m_dialogWidget->pixmap->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(64));
|
||
|
||
- connect(m_dialogWidget->pin, SIGNAL(textChanged(QString)), SLOT(checkPin(QString)));
|
||
- connect(m_dialogWidget->pin, SIGNAL(returnPressed()), dialog, SLOT(accept()));
|
||
+ connect(m_dialogWidget->pin, &KLineEdit::textChanged, this, &RequestPin::checkPin);
|
||
+ connect(m_dialogWidget->pin, &KLineEdit::returnPressed, dialog, &QDialog::accept);
|
||
|
||
m_dialogWidget->pin->setFocus(Qt::ActiveWindowFocusReason);
|
||
- qDebug() << qApp->arguments();
|
||
- if (qApp->arguments().count() > 2 && qApp->arguments()[2] == QLatin1String("numeric")) {
|
||
- m_dialogWidget->pin->setValidator(new QRegExpValidator(QRegExp(QStringLiteral("[0-9]{1,6}")), this ));
|
||
+
|
||
+ if (qApp->arguments().count() > 2 && qApp->arguments().at(2) == QLatin1String("numeric")) {
|
||
+ m_dialogWidget->pin->setValidator(new QRegExpValidator(QRegExp(QStringLiteral("[0-9]{1,6}")), this));
|
||
} else {
|
||
- m_dialogWidget->pin->setValidator(new QRegExpValidator(QRegExp(QStringLiteral("[A-Za-z0-9]{1,16}")), this ));
|
||
+ m_dialogWidget->pin->setValidator(new QRegExpValidator(QRegExp(QStringLiteral("[A-Za-z0-9]{1,16}")), this));
|
||
}
|
||
|
||
m_dialogWidget->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||
dialog->setMinimumSize(dialog->sizeHint());
|
||
dialog->setMaximumSize(dialog->sizeHint());
|
||
if (dialog->exec()) {
|
||
- cout << m_dialogWidget->pin->text().toLatin1().constData();
|
||
- flush(cout);
|
||
+ std::cout << m_dialogWidget->pin->text().toLatin1().constData();
|
||
+ std::flush(std::cout);
|
||
delete dialog;
|
||
qApp->exit(0);
|
||
return;
|
||
@@ -120,7 +118,7 @@ void RequestPin::introducePin()
|
||
qApp->exit(1);
|
||
}
|
||
|
||
-void RequestPin::checkPin(const QString& pin)
|
||
+void RequestPin::checkPin(const QString &pin)
|
||
{
|
||
m_dialogWidget->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!pin.isEmpty());
|
||
}
|
||
diff --git a/src/daemon/helpers/requestpin/requestpin.h b/src/daemon/helpers/requestpin/requestpin.h
|
||
index 3cc09e6..bfa96dc 100644
|
||
--- a/src/daemon/helpers/requestpin/requestpin.h
|
||
+++ b/src/daemon/helpers/requestpin/requestpin.h
|
||
@@ -19,14 +19,15 @@
|
||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||
***************************************************************************/
|
||
|
||
-#ifndef REQUESTPIN_H
|
||
-#define REQUESTPIN_H
|
||
+#ifndef REQUEST_PIN_H
|
||
+#define REQUEST_PIN_H
|
||
|
||
#include <QObject>
|
||
#include <QTimer>
|
||
|
||
-namespace Ui {
|
||
-class dialogWidget;
|
||
+namespace Ui
|
||
+{
|
||
+ class dialogWidget;
|
||
}
|
||
|
||
class KNotification;
|
||
@@ -39,8 +40,7 @@ class KNotification;
|
||
* Deny quits the app with 1 (which means denied)
|
||
* @internal
|
||
*/
|
||
-class RequestPin
|
||
- : public QObject
|
||
+class RequestPin : public QObject
|
||
{
|
||
Q_OBJECT
|
||
|
||
@@ -49,7 +49,7 @@ public:
|
||
* Launch the KNotification which the respective actions, also makes the needed connection
|
||
* between those actions and the slots
|
||
*/
|
||
- RequestPin();
|
||
+ explicit RequestPin();
|
||
|
||
private Q_SLOTS:
|
||
/**
|
||
@@ -70,4 +70,5 @@ private:
|
||
Ui::dialogWidget *m_dialogWidget;
|
||
KNotification *m_notification;
|
||
};
|
||
-#endif //REQUESTPIN_H
|
||
+
|
||
+#endif // REQUEST_PIN_H
|
||
diff --git a/src/daemon/kded/BlueDevilDaemon.cpp b/src/daemon/kded/BlueDevilDaemon.cpp
|
||
index 1211103..0b59ce5 100644
|
||
--- a/src/daemon/kded/BlueDevilDaemon.cpp
|
||
+++ b/src/daemon/kded/BlueDevilDaemon.cpp
|
||
@@ -38,6 +38,7 @@
|
||
#include <KLocalizedString>
|
||
#include <kfileplacesmodel.h>
|
||
#include <kdirnotify.h>
|
||
+#include <ksharedconfig.h>
|
||
|
||
#include <bluedevil/bluedevilmanager.h>
|
||
#include <bluedevil/bluedeviladapter.h>
|
||
@@ -59,21 +60,21 @@ struct BlueDevilDaemon::Private
|
||
Offline
|
||
} m_status;
|
||
|
||
- BluezAgent *m_bluezAgent;
|
||
- KFilePlacesModel *m_placesModel;
|
||
- Adapter *m_adapter;
|
||
- QDBusServiceWatcher *m_monolithicWatcher;
|
||
- FileReceiver *m_fileReceiver;
|
||
- QList <DeviceInfo> m_discovered;
|
||
- QTimer m_timer;
|
||
+ BluezAgent *m_bluezAgent;
|
||
+ KFilePlacesModel *m_placesModel;
|
||
+ Adapter *m_adapter;
|
||
+ QDBusServiceWatcher *m_monolithicWatcher;
|
||
+ FileReceiver *m_fileReceiver;
|
||
+ KSharedConfig::Ptr m_config;
|
||
+ QTimer m_timer;
|
||
};
|
||
|
||
BlueDevilDaemon::BlueDevilDaemon(QObject *parent, const QList<QVariant>&)
|
||
: KDEDModule(parent)
|
||
, d(new Private)
|
||
{
|
||
- qDBusRegisterMetaType <DeviceInfo> ();
|
||
- qDBusRegisterMetaType <QMapDeviceInfo> ();
|
||
+ qDBusRegisterMetaType<DeviceInfo>();
|
||
+ qDBusRegisterMetaType<QMapDeviceInfo>();
|
||
|
||
d->m_bluezAgent = 0;
|
||
d->m_adapter = 0;
|
||
@@ -81,8 +82,8 @@ BlueDevilDaemon::BlueDevilDaemon(QObject *parent, const QList<QVariant>&)
|
||
d->m_fileReceiver = 0;
|
||
d->m_monolithicWatcher = new QDBusServiceWatcher(QStringLiteral("org.kde.bluedevilmonolithic")
|
||
, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForUnregistration, this);
|
||
- d->m_timer.setInterval(20000);
|
||
d->m_timer.setSingleShot(true);
|
||
+ d->m_config = KSharedConfig::openConfig(QStringLiteral("bluedevilglobalrc"));
|
||
|
||
KAboutData aboutData(
|
||
QStringLiteral("bluedevildaemon"),
|
||
@@ -102,12 +103,25 @@ BlueDevilDaemon::BlueDevilDaemon(QObject *parent, const QList<QVariant>&)
|
||
aboutData.setComponentName(QStringLiteral("bluedevil"));
|
||
KAboutData::registerPluginData(aboutData);
|
||
|
||
- connect(d->m_monolithicWatcher, SIGNAL(serviceUnregistered(const QString &)), SLOT(monolithicFinished(const QString &)));
|
||
+ connect(d->m_monolithicWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &BlueDevilDaemon::monolithicFinished);
|
||
+ connect(&d->m_timer, &QTimer::timeout, this, &BlueDevilDaemon::stopDiscovering);
|
||
|
||
- connect(Manager::self(), SIGNAL(usableAdapterChanged(Adapter*)),
|
||
- this, SLOT(usableAdapterChanged(Adapter*)));
|
||
+ connect(Manager::self(), &Manager::usableAdapterChanged, this, &BlueDevilDaemon::usableAdapterChanged);
|
||
+ connect(Manager::self(), &Manager::adapterAdded, this, &BlueDevilDaemon::adapterAdded);
|
||
+ connect(Manager::self(), &Manager::adapterRemoved, this, &BlueDevilDaemon::adapterRemoved);
|
||
+
|
||
+ // Catch suspend/resume events
|
||
+ QDBusConnection::systemBus().connect(QStringLiteral("org.freedesktop.login1"),
|
||
+ QStringLiteral("/org/freedesktop/login1"),
|
||
+ QStringLiteral("org.freedesktop.login1.Manager"),
|
||
+ QStringLiteral("PrepareForSleep"),
|
||
+ this,
|
||
+ SLOT(login1PrepareForSleep(bool))
|
||
+ );
|
||
|
||
d->m_status = Private::Offline;
|
||
+
|
||
+ restoreAdaptersState();
|
||
usableAdapterChanged(Manager::self()->usableAdapter());
|
||
|
||
if (!Manager::self()->adapters().isEmpty()) {
|
||
@@ -117,6 +131,8 @@ BlueDevilDaemon::BlueDevilDaemon(QObject *parent, const QList<QVariant>&)
|
||
|
||
BlueDevilDaemon::~BlueDevilDaemon()
|
||
{
|
||
+ saveAdaptersState();
|
||
+
|
||
if (d->m_status == Private::Online) {
|
||
offlineMode();
|
||
}
|
||
@@ -124,93 +140,111 @@ BlueDevilDaemon::~BlueDevilDaemon()
|
||
delete d;
|
||
}
|
||
|
||
-bool BlueDevilDaemon::isOnline()
|
||
+void BlueDevilDaemon::login1PrepareForSleep(bool active)
|
||
{
|
||
- if (d->m_status == Private::Offline) {
|
||
- return false;
|
||
+ if (active) {
|
||
+ qCDebug(BLUEDAEMON) << "About to suspend";
|
||
+ saveAdaptersState();
|
||
+ } else {
|
||
+ qCDebug(BLUEDAEMON) << "About to resume";
|
||
+ restoreAdaptersState();
|
||
}
|
||
- return true;
|
||
}
|
||
|
||
-QMapDeviceInfo BlueDevilDaemon::knownDevices()
|
||
+bool BlueDevilDaemon::isOnline()
|
||
+{
|
||
+ return d->m_status == Private::Online;
|
||
+}
|
||
+
|
||
+QMapDeviceInfo BlueDevilDaemon::allDevices()
|
||
{
|
||
QMapDeviceInfo devices;
|
||
+ QList<Device*> list = Manager::self()->usableAdapter()->devices();
|
||
|
||
- QList <Device* > list = Manager::self()->usableAdapter()->devices();
|
||
- qCDebug(BLUEDAEMON) << "List: " << list.length();
|
||
- DeviceInfo info;
|
||
- Q_FOREACH(Device *const device, list) {
|
||
- info[QStringLiteral("name")] = device->friendlyName();
|
||
- info[QStringLiteral("icon")] = device->icon();
|
||
- info[QStringLiteral("address")] = device->address();
|
||
- info[QStringLiteral("UUIDs")] = device->UUIDs().join(QStringLiteral(","));
|
||
- devices[device->address()] = info;
|
||
+ Q_FOREACH (Device *const device, list) {
|
||
+ devices[device->address()] = deviceToInfo(device);
|
||
}
|
||
|
||
- if (!d->m_timer.isActive()) {
|
||
- qCDebug(BLUEDAEMON) << "Start Discovery";
|
||
- Manager::self()->usableAdapter()->startStableDiscovery();
|
||
- d->m_discovered.clear();
|
||
- d->m_timer.start();
|
||
- }
|
||
+ return devices;
|
||
+}
|
||
|
||
- Q_FOREACH(const DeviceInfo& info, d->m_discovered) {
|
||
- if (!devices.contains(info[QStringLiteral("address")])) {
|
||
- devices[info[QStringLiteral("address")]] = info;
|
||
+DeviceInfo BlueDevilDaemon::device(const QString &address)
|
||
+{
|
||
+ Q_FOREACH (Device *const device, Manager::self()->devices()) {
|
||
+ if (device->address() == address) {
|
||
+ return deviceToInfo(device);
|
||
}
|
||
}
|
||
- return devices;
|
||
+
|
||
+ return DeviceInfo();
|
||
+}
|
||
+
|
||
+void BlueDevilDaemon::startDiscovering(quint32 timeout)
|
||
+{
|
||
+ if (!d->m_adapter) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
+ qCDebug(BLUEDAEMON) << "Start discovering for" << timeout << "ms";
|
||
+
|
||
+ d->m_adapter->startDiscovery();
|
||
+
|
||
+ if (timeout > 0) {
|
||
+ d->m_timer.start(timeout);
|
||
+ }
|
||
}
|
||
|
||
void BlueDevilDaemon::stopDiscovering()
|
||
{
|
||
- qCDebug(BLUEDAEMON) << "Stopping discovering";
|
||
- d->m_timer.stop();
|
||
- Manager::self()->usableAdapter()->stopDiscovery();
|
||
+ if (!d->m_adapter) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
+ qCDebug(BLUEDAEMON) << "Stop discovering";
|
||
+
|
||
+ if (d->m_adapter->isDiscovering()) {
|
||
+ d->m_adapter->stopDiscovery();
|
||
+ }
|
||
}
|
||
|
||
void BlueDevilDaemon::executeMonolithic()
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
-
|
||
QProcess process;
|
||
if (!process.startDetached(QStringLiteral("bluedevil-monolithic"))) {
|
||
- qCritical() << "Could not start bluedevil-monolithic";
|
||
+ qCCritical(BLUEDAEMON) << "Could not start bluedevil-monolithic";
|
||
}
|
||
}
|
||
|
||
void BlueDevilDaemon::killMonolithic()
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
QDBusMessage msg = QDBusMessage::createMethodCall(
|
||
QStringLiteral("org.kde.bluedevilmonolithic"),
|
||
QStringLiteral("/MainApplication"),
|
||
QStringLiteral("org.kde.KApplication"),
|
||
QStringLiteral("quit")
|
||
);
|
||
+
|
||
QDBusPendingCall pending = QDBusConnection::sessionBus().asyncCall(msg);
|
||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pending);
|
||
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(monolithicQuit(QDBusPendingCallWatcher*)));
|
||
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, &BlueDevilDaemon::monolithicQuit);
|
||
}
|
||
|
||
void BlueDevilDaemon::onlineMode()
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
if (d->m_status == Private::Online) {
|
||
qCDebug(BLUEDAEMON) << "Already in onlineMode";
|
||
return;
|
||
}
|
||
|
||
d->m_bluezAgent = new BluezAgent(new QObject());
|
||
- connect(d->m_bluezAgent, SIGNAL(agentReleased()), this, SLOT(agentReleased()));
|
||
-
|
||
- connect(d->m_adapter, SIGNAL(deviceFound(Device*)), this, SLOT(deviceFound(Device*)));
|
||
- connect(&d->m_timer, SIGNAL(timeout()), d->m_adapter, SLOT(stopDiscovery()));
|
||
+ connect(d->m_bluezAgent, &BluezAgent::agentReleased, this, &BlueDevilDaemon::agentReleased);
|
||
+ connect(d->m_adapter, &Adapter::deviceFound, this, &BlueDevilDaemon::deviceFound);
|
||
|
||
FileReceiverSettings::self()->load();
|
||
if (!d->m_fileReceiver && FileReceiverSettings::self()->enabled()) {
|
||
d->m_fileReceiver = new FileReceiver(this);
|
||
}
|
||
+
|
||
if (d->m_fileReceiver && !FileReceiverSettings::self()->enabled()) {
|
||
qCDebug(BLUEDAEMON) << "Stoppping server";
|
||
delete d->m_fileReceiver;
|
||
@@ -221,7 +255,7 @@ void BlueDevilDaemon::onlineMode()
|
||
d->m_placesModel = new KFilePlacesModel();
|
||
}
|
||
|
||
- //Just in case kded was killed or crashed
|
||
+ // Just in case kded was killed or crashed
|
||
QModelIndex index = d->m_placesModel->closestItem(QUrl(QStringLiteral("bluetooth:/")));
|
||
while (index.row() != -1) {
|
||
d->m_placesModel->removePlace(index);
|
||
@@ -237,8 +271,6 @@ void BlueDevilDaemon::onlineMode()
|
||
|
||
void BlueDevilDaemon::monolithicFinished(const QString &)
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
-
|
||
if (d->m_status == Private::Online) {
|
||
executeMonolithic();
|
||
}
|
||
@@ -247,6 +279,7 @@ void BlueDevilDaemon::monolithicFinished(const QString &)
|
||
void BlueDevilDaemon::offlineMode()
|
||
{
|
||
qCDebug(BLUEDAEMON) << "Offline mode";
|
||
+
|
||
if (d->m_status == Private::Offline) {
|
||
qCDebug(BLUEDAEMON) << "Already in offlineMode";
|
||
return;
|
||
@@ -255,7 +288,7 @@ void BlueDevilDaemon::offlineMode()
|
||
d->m_adapter = 0;
|
||
|
||
if (d->m_bluezAgent) {
|
||
- delete d->m_bluezAgent->parent(); // we meed to delete the parent for not leaking it
|
||
+ delete d->m_bluezAgent->parent(); // we need to delete the parent for not leaking it
|
||
d->m_bluezAgent = 0;
|
||
}
|
||
|
||
@@ -265,15 +298,12 @@ void BlueDevilDaemon::offlineMode()
|
||
d->m_fileReceiver = 0;
|
||
}
|
||
|
||
- //Just to be sure that online was called
|
||
+ // Just to be sure that online was called
|
||
if (d->m_placesModel) {
|
||
QModelIndex index = d->m_placesModel->closestItem(QUrl(QStringLiteral("bluetooth:/")));
|
||
d->m_placesModel->removePlace(index);
|
||
}
|
||
|
||
- if (BlueDevil::Manager::self()->adapters().isEmpty()) {
|
||
- killMonolithic();
|
||
- }
|
||
d->m_status = Private::Offline;
|
||
}
|
||
|
||
@@ -301,31 +331,84 @@ void BlueDevilDaemon::usableAdapterChanged(Adapter *adapter)
|
||
}
|
||
}
|
||
|
||
+void BlueDevilDaemon::adapterAdded(Adapter *adapter)
|
||
+{
|
||
+ restoreAdapterState(adapter);
|
||
+}
|
||
+
|
||
+void BlueDevilDaemon::adapterRemoved(Adapter *adapter)
|
||
+{
|
||
+ Q_UNUSED(adapter)
|
||
+
|
||
+ if (BlueDevil::Manager::self()->adapters().isEmpty()) {
|
||
+ killMonolithic();
|
||
+ }
|
||
+}
|
||
+
|
||
void BlueDevilDaemon::deviceFound(Device *device)
|
||
{
|
||
qCDebug(BLUEDAEMON) << "DeviceFound: " << device->name();
|
||
- d->m_discovered.append(deviceToInfo(device));
|
||
org::kde::KDirNotify::emitFilesAdded(QUrl(QStringLiteral("bluetooth:/")));
|
||
}
|
||
|
||
-void BlueDevilDaemon::monolithicQuit(QDBusPendingCallWatcher* watcher)
|
||
+void BlueDevilDaemon::monolithicQuit(QDBusPendingCallWatcher *watcher)
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
QDBusPendingReply<void> reply = *watcher;
|
||
if (reply.isError()) {
|
||
- qDebug() << "Error response: " << reply.error().message();
|
||
- killMonolithic();
|
||
+ qCDebug(BLUEDAEMON) << "Error response: " << reply.error().message();
|
||
+ }
|
||
+}
|
||
+
|
||
+void BlueDevilDaemon::saveAdaptersState()
|
||
+{
|
||
+ Manager *manager = Manager::self();
|
||
+ if (!manager) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
+ KConfigGroup adaptersGroup = d->m_config->group("Adapters");
|
||
+
|
||
+ Q_FOREACH (Adapter *adapter, manager->adapters()) {
|
||
+ const QString key = QString(QStringLiteral("%1_powered")).arg(adapter->address());
|
||
+ adaptersGroup.writeEntry<bool>(key, adapter->isPowered());
|
||
+ }
|
||
+
|
||
+ d->m_config->sync();
|
||
+}
|
||
+
|
||
+// New adapters are automatically powered on
|
||
+void BlueDevilDaemon::restoreAdaptersState()
|
||
+{
|
||
+ Manager *manager = Manager::self();
|
||
+ if (!manager) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
+ KConfigGroup adaptersGroup = d->m_config->group("Adapters");
|
||
+
|
||
+ Q_FOREACH (Adapter *adapter, manager->adapters()) {
|
||
+ const QString key = QString(QStringLiteral("%1_powered")).arg(adapter->address());
|
||
+ adapter->setPowered(adaptersGroup.readEntry<bool>(key, true));
|
||
}
|
||
}
|
||
|
||
+void BlueDevilDaemon::restoreAdapterState(Adapter *adapter)
|
||
+{
|
||
+ KConfigGroup adaptersGroup = d->m_config->group("Adapters");
|
||
+
|
||
+ const QString key = QString(QStringLiteral("%1_powered")).arg(adapter->address());
|
||
+ adapter->setPowered(adaptersGroup.readEntry<bool>(key, true));
|
||
+}
|
||
+
|
||
DeviceInfo BlueDevilDaemon::deviceToInfo(Device *const device) const
|
||
{
|
||
DeviceInfo info;
|
||
+
|
||
info[QStringLiteral("name")] = device->friendlyName();
|
||
info[QStringLiteral("icon")] = device->icon();
|
||
info[QStringLiteral("address")] = device->address();
|
||
- info[QStringLiteral("discovered")] = QStringLiteral("true");
|
||
- info[QStringLiteral("UUIDs")] = device->UUIDs().join(QStringLiteral(","));
|
||
+ info[QStringLiteral("UBI")] = device->UBI();
|
||
+ info[QStringLiteral("UUIDs")] = device->UUIDs().join(QLatin1Char(','));
|
||
|
||
return info;
|
||
}
|
||
diff --git a/src/daemon/kded/BlueDevilDaemon.h b/src/daemon/kded/BlueDevilDaemon.h
|
||
index a8688ae..a4a396b 100644
|
||
--- a/src/daemon/kded/BlueDevilDaemon.h
|
||
+++ b/src/daemon/kded/BlueDevilDaemon.h
|
||
@@ -22,43 +22,59 @@
|
||
#ifndef BLUEDEVILDAEMON_H
|
||
#define BLUEDEVILDAEMON_H
|
||
|
||
-#include <kdedmodule.h>
|
||
+#include <KDEDModule>
|
||
#include <QLoggingCategory>
|
||
|
||
-typedef QMap <QString, QString> DeviceInfo;
|
||
+typedef QMap<QString, QString> DeviceInfo;
|
||
typedef QMap<QString, DeviceInfo > QMapDeviceInfo;
|
||
|
||
class QDBusPendingCallWatcher;
|
||
-namespace BlueDevil {
|
||
+
|
||
+namespace BlueDevil
|
||
+{
|
||
class Adapter;
|
||
class Device;
|
||
}
|
||
+
|
||
using namespace BlueDevil;
|
||
|
||
-class Q_DECL_EXPORT BlueDevilDaemon
|
||
- : public KDEDModule
|
||
+class Q_DECL_EXPORT BlueDevilDaemon : public KDEDModule
|
||
{
|
||
Q_OBJECT
|
||
Q_CLASSINFO("D-Bus Interface", "org.kde.BlueDevil")
|
||
|
||
public:
|
||
/**
|
||
- * Stablish basics connections with libbluedevil signals and calls online if interfaces are availables
|
||
+ * Establish basics connections with libbluedevil signals and calls online if interfaces are availables
|
||
*/
|
||
BlueDevilDaemon(QObject *parent, const QList<QVariant>&);
|
||
- virtual ~BlueDevilDaemon();
|
||
+ ~BlueDevilDaemon();
|
||
|
||
public Q_SLOTS:
|
||
+ /**
|
||
+ * Returns whether the daemon is in online mode (eg. Bluez services are
|
||
+ * running and we have usable adapter)
|
||
+ */
|
||
Q_SCRIPTABLE bool isOnline();
|
||
|
||
/**
|
||
- * This slot will return a list of devices made of: configured and discovered devices.
|
||
- * Going deeper, the first time that this slot is called a discovery of X seconds will start
|
||
- * Then if this slot is consulted again it will return configured and discovered device. Once
|
||
- * the discovery ends it won't start a new discovery until N seconds pass.
|
||
+ * Returns QMap<Address, DeviceInfo> with all known devices
|
||
+ */
|
||
+ Q_SCRIPTABLE QMapDeviceInfo allDevices();
|
||
+
|
||
+ /**
|
||
+ * Returns DeviceInfo for one device.
|
||
*/
|
||
- Q_SCRIPTABLE QMapDeviceInfo knownDevices();
|
||
+ Q_SCRIPTABLE DeviceInfo device(const QString &address);
|
||
|
||
+ /**
|
||
+ * Starts discovery for timeout miliseconds (0 = forever)
|
||
+ */
|
||
+ Q_SCRIPTABLE void startDiscovering(quint32 timeout);
|
||
+
|
||
+ /**
|
||
+ * Stops discovery (if it was previously started)
|
||
+ */
|
||
Q_SCRIPTABLE void stopDiscovering();
|
||
|
||
private:
|
||
@@ -81,20 +97,29 @@ private Q_SLOTS:
|
||
*/
|
||
void usableAdapterChanged(Adapter *adapter);
|
||
|
||
+ void adapterAdded(Adapter *adapter);
|
||
+ void adapterRemoved(Adapter *adapter);
|
||
+
|
||
/**
|
||
* When the agent is released this is called to unload it
|
||
*/
|
||
void agentReleased();
|
||
|
||
- void deviceFound(Device*);
|
||
- void monolithicQuit(QDBusPendingCallWatcher* watcher);
|
||
+ void login1PrepareForSleep(bool active);
|
||
+
|
||
+ void deviceFound(Device *device);
|
||
+ void monolithicQuit(QDBusPendingCallWatcher *watcher);
|
||
void monolithicFinished(const QString &);
|
||
|
||
private:
|
||
void executeMonolithic();
|
||
void killMonolithic();
|
||
|
||
- DeviceInfo deviceToInfo (Device *const device) const;
|
||
+ void saveAdaptersState();
|
||
+ void restoreAdaptersState();
|
||
+ void restoreAdapterState(Adapter *adapter);
|
||
+
|
||
+ DeviceInfo deviceToInfo(Device *const device) const;
|
||
|
||
private:
|
||
struct Private;
|
||
diff --git a/src/daemon/kded/CMakeLists.txt b/src/daemon/kded/CMakeLists.txt
|
||
index 3a8ddb7..651e68d 100644
|
||
--- a/src/daemon/kded/CMakeLists.txt
|
||
+++ b/src/daemon/kded/CMakeLists.txt
|
||
@@ -26,7 +26,7 @@ kconfig_add_kcfg_files(kded_bluedevil_SRCS ../../settings/filereceiversettings.k
|
||
|
||
add_library(kded_bluedevil MODULE ${kded_bluedevil_SRCS})
|
||
|
||
-kservice_desktop_to_json(kded_bluedevil bluedevil.desktop)
|
||
+kcoreaddons_desktop_to_json(kded_bluedevil bluedevil.desktop)
|
||
|
||
target_link_libraries(kded_bluedevil
|
||
Qt5::Gui
|
||
diff --git a/src/daemon/kded/bluedevil.desktop b/src/daemon/kded/bluedevil.desktop
|
||
index 6799d91..b65cc5a 100644
|
||
--- a/src/daemon/kded/bluedevil.desktop
|
||
+++ b/src/daemon/kded/bluedevil.desktop
|
||
@@ -9,16 +9,25 @@ X-KDE-Kded-load-on-demand=false
|
||
X-KDE-Kded-phase=1
|
||
|
||
Name=Bluetooth
|
||
+Name[bs]=Blutut
|
||
Name[ca]=Bluetooth
|
||
Name[cs]=Bluetooth
|
||
Name[de]=Bluetooth
|
||
+Name[el]=Bluetooth
|
||
Name[en_GB]=Bluetooth
|
||
Name[es]=Bluetooth
|
||
+Name[et]=Bluetooth
|
||
Name[fi]=Bluetooth
|
||
Name[fr]=Bluetooth
|
||
Name[it]=Bluetooth
|
||
+Name[ja]=Bluetooth
|
||
+Name[kk]=Bluetooth
|
||
+Name[ko]=블루투스
|
||
+Name[lt]=Bluetooth
|
||
+Name[mr]=ब्लूटूथ
|
||
Name[nb]=Blåtann
|
||
Name[nl]=Bluetooth
|
||
+Name[pa]=ਬਲਿਊਟੁੱਥ
|
||
Name[pl]=Bluetooth
|
||
Name[pt]=Bluetooth
|
||
Name[pt_BR]=Bluetooth
|
||
@@ -29,21 +38,27 @@ Name[sr@ijekavian]=Блутут
|
||
Name[sr@ijekavianlatin]=Bluetooth
|
||
Name[sr@latin]=Bluetooth
|
||
Name[sv]=Blåtand
|
||
+Name[tr]=Bluetooth
|
||
Name[uk]=Bluetooth
|
||
Name[x-test]=xxBluetoothxx
|
||
Name[zh_CN]=蓝牙
|
||
+Name[zh_TW]=藍牙
|
||
|
||
Comment=Handles Bluetooth events
|
||
+Comment[bs]=Obrađuje Bluetooth događaje
|
||
Comment[ca]=Gestiona els esdeveniments del Bluetooth
|
||
Comment[cs]=Ovládá události Bluetooth
|
||
Comment[de]=Verarbeitung von Bluetooth-Ereignissen
|
||
+Comment[el]=Χειρίζεται γεγονότα Bluetooth
|
||
Comment[en_GB]=Handles Bluetooth events
|
||
-Comment[es]=Gestiona los eventos de Bluetooth
|
||
+Comment[es]=Maneja eventos de Bluetooth
|
||
+Comment[et]=Bluetoothi sündmuste käitlemine
|
||
Comment[fi]=Käsittelee Bluetooth-tapahtumia
|
||
Comment[fr]=Gère les évènements Bluetooth
|
||
Comment[it]=Gestisce eventi Bluetooth
|
||
Comment[nb]=Håndterer Blåtann-hendelser
|
||
Comment[nl]=Behandelt bluetooth-gebeurtenissen
|
||
+Comment[pa]=ਬਲਿਊਟੁੱਥ ਘਟਨਾਵਾਂ ਕੰਟਰੋਲ ਕਰਨ ਲਈ
|
||
Comment[pl]=Obsługa zdarzeń Bluetooth
|
||
Comment[pt]=Lida com os eventos de Bluetooth
|
||
Comment[pt_BR]=Lida com os eventos de Bluetooth
|
||
@@ -54,6 +69,8 @@ Comment[sr@ijekavian]=Рукује блутут догађајима
|
||
Comment[sr@ijekavianlatin]=Rukuje bluetooth događajima
|
||
Comment[sr@latin]=Rukuje bluetooth događajima
|
||
Comment[sv]=Hanterar Blåtandhändelser
|
||
+Comment[tr]=Bluetooth olaylarını ele alır
|
||
Comment[uk]=Обробляє події Bluetooth
|
||
Comment[x-test]=xxHandles Bluetooth eventsxx
|
||
Comment[zh_CN]=处理蓝牙事件
|
||
+Comment[zh_TW]=處理藍牙事件
|
||
diff --git a/src/daemon/kded/bluezagent.h b/src/daemon/kded/bluezagent.h
|
||
index aedfc90..d5f4db7 100644
|
||
--- a/src/daemon/kded/bluezagent.h
|
||
+++ b/src/daemon/kded/bluezagent.h
|
||
@@ -19,7 +19,6 @@
|
||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||
***************************************************************************/
|
||
|
||
-
|
||
#ifndef BLUEZAGENT_H
|
||
#define BLUEZAGENT_H
|
||
|
||
@@ -28,7 +27,9 @@
|
||
#include <QDBusAbstractAdaptor>
|
||
|
||
class QProcess;
|
||
-namespace BlueDevil {
|
||
+
|
||
+namespace BlueDevil
|
||
+{
|
||
class Adapter;
|
||
}
|
||
|
||
@@ -41,8 +42,7 @@ namespace BlueDevil {
|
||
* @ref AgentListenerWorker
|
||
* @since 1.0
|
||
*/
|
||
-class BluezAgent
|
||
- : public QDBusAbstractAdaptor
|
||
+class BluezAgent : public QDBusAbstractAdaptor
|
||
{
|
||
Q_OBJECT
|
||
Q_CLASSINFO("D-Bus Interface", "org.bluez.Agent1")
|
||
@@ -51,7 +51,7 @@ public:
|
||
/**
|
||
* Register the path and initialize the m_adapter
|
||
*/
|
||
- BluezAgent(QObject *parent);
|
||
+ explicit BluezAgent(QObject *parent);
|
||
|
||
public Q_SLOTS:
|
||
/**
|
||
@@ -62,12 +62,12 @@ public Q_SLOTS:
|
||
/**
|
||
* Called by bluez to ask for a device authoritation
|
||
*/
|
||
- void AuthorizeService(const QDBusObjectPath &device, const QString& uuid, const QDBusMessage &msg);
|
||
+ void AuthorizeService(const QDBusObjectPath &device, const QString &uuid, const QDBusMessage &msg);
|
||
|
||
/**
|
||
* Called by bluez to ask for a PIN
|
||
*/
|
||
- QString RequestPinCode(const QDBusObjectPath& device, const QDBusMessage& msg);
|
||
+ QString RequestPinCode(const QDBusObjectPath &device, const QDBusMessage &msg);
|
||
|
||
/**
|
||
* Called by bluez to ask for a passkey, currently is a aslias of RequestPinCode
|
||
@@ -112,6 +112,7 @@ public Q_SLOTS:
|
||
* This slot gets called when the RequestPasskey helper ends
|
||
*/
|
||
void processClosedPasskey(int exitCode);
|
||
+
|
||
Q_SIGNALS:
|
||
/**
|
||
* Emited to propagate the release call (so BlueDevil can decide what to do)
|
||
@@ -131,7 +132,7 @@ private:
|
||
* @param helper Name of the helper
|
||
* @param msg The msg got from bluez
|
||
*/
|
||
- void sendBluezError(const QString& helper, const QDBusMessage &msg);
|
||
+ void sendBluezError(const QString &helper, const QDBusMessage &msg);
|
||
|
||
/**
|
||
* Returns the name of the device if it is registered on the bus
|
||
@@ -142,8 +143,9 @@ private:
|
||
QString deviceName(const QString &UBI);
|
||
|
||
private:
|
||
- QProcess *m_process;
|
||
- QDBusMessage m_msg;
|
||
- QString m_currentHelper;
|
||
+ QProcess *m_process;
|
||
+ QDBusMessage m_msg;
|
||
+ QString m_currentHelper;
|
||
};
|
||
-#endif
|
||
+
|
||
+#endif // BLUEZAGENT_H
|
||
diff --git a/src/daemon/kded/filereceiver/filereceiver.cpp b/src/daemon/kded/filereceiver/filereceiver.cpp
|
||
index 00405b1..91d2005 100644
|
||
--- a/src/daemon/kded/filereceiver/filereceiver.cpp
|
||
+++ b/src/daemon/kded/filereceiver/filereceiver.cpp
|
||
@@ -19,40 +19,46 @@
|
||
#include "filereceiver.h"
|
||
#include "../BlueDevilDaemon.h"
|
||
#include "obexagent.h"
|
||
-#include "obex_agent_manager.h"
|
||
|
||
#include <QDBusConnection>
|
||
#include <QDBusPendingCall>
|
||
#include <QDBusPendingCallWatcher>
|
||
+#include <QDBusServiceWatcher>
|
||
|
||
-FileReceiver::FileReceiver(QObject* parent)
|
||
+FileReceiver::FileReceiver(QObject *parent)
|
||
: QObject(parent)
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
qDBusRegisterMetaType<QVariantMap>();
|
||
|
||
new ObexAgent(this);
|
||
- org::bluez::obex::AgentManager1 *agent = new org::bluez::obex::AgentManager1(QStringLiteral("org.bluez.obex"),
|
||
- QStringLiteral("/org/bluez/obex"),
|
||
- QDBusConnection::sessionBus(),
|
||
- this);
|
||
+ m_agentManager = new org::bluez::obex::AgentManager1(QStringLiteral("org.bluez.obex"),
|
||
+ QStringLiteral("/org/bluez/obex"),
|
||
+ QDBusConnection::sessionBus(),
|
||
+ this);
|
||
|
||
- QDBusPendingReply <void > r = agent->RegisterAgent(QDBusObjectPath(QStringLiteral("/BlueDevil_receiveAgent")));
|
||
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(r, this);
|
||
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(agentRegistered(QDBusPendingCallWatcher*)));
|
||
+ registerAgent();
|
||
+
|
||
+ // obexd should be set to auto-start by D-Bus (D-Bus activation), so this should restart it in case of crash
|
||
+ QDBusServiceWatcher *serviceWatcher = new QDBusServiceWatcher(QStringLiteral("org.bluez.obex"), QDBusConnection::sessionBus(),
|
||
+ QDBusServiceWatcher::WatchForUnregistration, this);
|
||
+ connect(serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &FileReceiver::registerAgent);
|
||
}
|
||
|
||
-FileReceiver::~FileReceiver()
|
||
+void FileReceiver::registerAgent()
|
||
{
|
||
-
|
||
+ QDBusPendingReply<void> r = m_agentManager->RegisterAgent(QDBusObjectPath(QStringLiteral("/BlueDevil_receiveAgent")));
|
||
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(r, this);
|
||
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, &FileReceiver::agentRegistered);
|
||
}
|
||
|
||
-void FileReceiver::agentRegistered(QDBusPendingCallWatcher* call)
|
||
+void FileReceiver::agentRegistered(QDBusPendingCallWatcher *call)
|
||
{
|
||
- QDBusPendingReply <void > r = *call;
|
||
- qCDebug(BLUEDAEMON) << "Error: " << r.isError();
|
||
+ QDBusPendingReply<void> r = *call;
|
||
+
|
||
if (r.isError()) {
|
||
- qCDebug(BLUEDAEMON) << r.error().message();
|
||
+ qCWarning(BLUEDAEMON) << "Error registering agent" << r.error().message();
|
||
+ } else {
|
||
+ qCDebug(BLUEDAEMON) << "Agent registered";
|
||
}
|
||
|
||
call->deleteLater();
|
||
diff --git a/src/daemon/kded/filereceiver/filereceiver.h b/src/daemon/kded/filereceiver/filereceiver.h
|
||
index e6dc6fb..7011f4a 100644
|
||
--- a/src/daemon/kded/filereceiver/filereceiver.h
|
||
+++ b/src/daemon/kded/filereceiver/filereceiver.h
|
||
@@ -21,16 +21,23 @@
|
||
|
||
#include <QObject>
|
||
|
||
+#include "obex_agent_manager.h"
|
||
+
|
||
class QDBusPendingCallWatcher;
|
||
+
|
||
class FileReceiver : public QObject
|
||
{
|
||
Q_OBJECT
|
||
- public:
|
||
- explicit FileReceiver(QObject* parent = 0);
|
||
- virtual ~FileReceiver();
|
||
|
||
- private Q_SLOTS:
|
||
- void agentRegistered(QDBusPendingCallWatcher* call);
|
||
+public:
|
||
+ explicit FileReceiver(QObject *parent = 0);
|
||
+
|
||
+private Q_SLOTS:
|
||
+ void registerAgent();
|
||
+ void agentRegistered(QDBusPendingCallWatcher *call);
|
||
+
|
||
+private:
|
||
+ org::bluez::obex::AgentManager1 *m_agentManager;
|
||
};
|
||
|
||
-#endif //FILE_RECEIVER_H
|
||
+#endif // FILE_RECEIVER_H
|
||
diff --git a/src/daemon/kded/filereceiver/obexagent.cpp b/src/daemon/kded/filereceiver/obexagent.cpp
|
||
index 7fc7bca..5af1400 100644
|
||
--- a/src/daemon/kded/filereceiver/obexagent.cpp
|
||
+++ b/src/daemon/kded/filereceiver/obexagent.cpp
|
||
@@ -24,24 +24,17 @@
|
||
#include <QDebug>
|
||
#include <QDBusConnection>
|
||
|
||
-ObexAgent::ObexAgent(QObject* parent)
|
||
+ObexAgent::ObexAgent(QObject *parent)
|
||
: QDBusAbstractAdaptor(parent)
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
if (!QDBusConnection::sessionBus().registerObject(QStringLiteral("/BlueDevil_receiveAgent"), parent)) {
|
||
- qDebug() << "The dbus object can't be registered";
|
||
- return;
|
||
+ qCWarning(BLUEDAEMON) << "The DBus object can't be registered";
|
||
}
|
||
}
|
||
|
||
-ObexAgent::~ObexAgent()
|
||
-{
|
||
-
|
||
-}
|
||
-
|
||
QString ObexAgent::AuthorizePush(const QDBusObjectPath& path, const QDBusMessage &msg)
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
+ qCDebug(BLUEDAEMON) << "AuthorizePush" << path.path();
|
||
|
||
msg.setDelayedReply(true);
|
||
|
||
@@ -53,11 +46,10 @@ QString ObexAgent::AuthorizePush(const QDBusObjectPath& path, const QDBusMessage
|
||
|
||
void ObexAgent::Cancel()
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
+ qCDebug(BLUEDAEMON) << "Cancel";
|
||
}
|
||
|
||
-
|
||
void ObexAgent::Release()
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
+ qCDebug(BLUEDAEMON) << "Release";
|
||
}
|
||
diff --git a/src/daemon/kded/filereceiver/obexagent.h b/src/daemon/kded/filereceiver/obexagent.h
|
||
index 72c3220..2300fe3 100644
|
||
--- a/src/daemon/kded/filereceiver/obexagent.h
|
||
+++ b/src/daemon/kded/filereceiver/obexagent.h
|
||
@@ -24,20 +24,19 @@
|
||
#include <QDBusObjectPath>
|
||
|
||
class QDBusMessage;
|
||
+
|
||
class ObexAgent : public QDBusAbstractAdaptor
|
||
{
|
||
Q_OBJECT
|
||
Q_CLASSINFO("D-Bus Interface", "org.bluez.obex.Agent1")
|
||
|
||
- public:
|
||
- explicit ObexAgent(QObject* parent);
|
||
- virtual ~ObexAgent();
|
||
-
|
||
- public Q_SLOTS:
|
||
- QString AuthorizePush(const QDBusObjectPath &path, const QDBusMessage &msg);
|
||
+public:
|
||
+ explicit ObexAgent(QObject *parent);
|
||
|
||
- void Release();
|
||
- void Cancel();
|
||
+public Q_SLOTS:
|
||
+ QString AuthorizePush(const QDBusObjectPath &path, const QDBusMessage &msg);
|
||
+ void Release();
|
||
+ void Cancel();
|
||
};
|
||
|
||
-#endif //OBEX_AGENT_H
|
||
+#endif // OBEX_AGENT_H
|
||
diff --git a/src/daemon/kded/filereceiver/receivefilejob.cpp b/src/daemon/kded/filereceiver/receivefilejob.cpp
|
||
index 5b9a8f4..f6342fd 100644
|
||
--- a/src/daemon/kded/filereceiver/receivefilejob.cpp
|
||
+++ b/src/daemon/kded/filereceiver/receivefilejob.cpp
|
||
@@ -42,7 +42,7 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-ReceiveFileJob::ReceiveFileJob(const QDBusMessage& msg, const QString &path, QObject* parent)
|
||
+ReceiveFileJob::ReceiveFileJob(const QDBusMessage &msg, const QString &path, QObject *parent)
|
||
: KJob(parent)
|
||
, m_speedBytes(0)
|
||
, m_path(path)
|
||
@@ -51,11 +51,6 @@ ReceiveFileJob::ReceiveFileJob(const QDBusMessage& msg, const QString &path, QOb
|
||
setCapabilities(Killable);
|
||
}
|
||
|
||
-ReceiveFileJob::~ReceiveFileJob()
|
||
-{
|
||
-
|
||
-}
|
||
-
|
||
void ReceiveFileJob::start()
|
||
{
|
||
QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);
|
||
@@ -63,7 +58,6 @@ void ReceiveFileJob::start()
|
||
|
||
bool ReceiveFileJob::doKill()
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
m_transfer->Cancel();
|
||
return true;
|
||
}
|
||
@@ -85,28 +79,40 @@ void ReceiveFileJob::init()
|
||
m_path,
|
||
QDBusConnection::sessionBus(),
|
||
this);
|
||
- connect(m_transferProps,
|
||
- SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
|
||
- SLOT(transferPropertiesChanged(QString,QVariantMap,QStringList)));
|
||
+ connect(m_transferProps, &org::freedesktop::DBus::Properties::PropertiesChanged,
|
||
+ this, &ReceiveFileJob::transferPropertiesChanged);
|
||
|
||
m_session = new org::bluez::obex::Session1(QStringLiteral("org.bluez.obex"),
|
||
m_transfer->session().path(),
|
||
QDBusConnection::sessionBus(),
|
||
this);
|
||
+
|
||
qCDebug(BLUEDAEMON) << m_session->destination();
|
||
|
||
- Device* device = Manager::self()->usableAdapter()->deviceForAddress(m_session->destination());
|
||
+ Device *device = 0;
|
||
+ bool isDeviceTrusted = false;
|
||
+
|
||
+ Q_FOREACH (Adapter *adapter, Manager::self()->adapters()) {
|
||
+ if (adapter->address() == m_session->source()) {
|
||
+ device = adapter->deviceForAddress(m_session->destination());
|
||
+ break;
|
||
+ }
|
||
+ }
|
||
+
|
||
qCDebug(BLUEDAEMON) << device;
|
||
|
||
m_deviceName = m_session->destination();
|
||
+
|
||
if (device) {
|
||
qCDebug(BLUEDAEMON) << device->name();
|
||
m_deviceName = device->name();
|
||
+ isDeviceTrusted = device->isTrusted();
|
||
}
|
||
|
||
FileReceiverSettings::self()->load();
|
||
qCDebug(BLUEDAEMON) << "Auto Accept: " << FileReceiverSettings::self()->autoAccept();
|
||
- if (FileReceiverSettings::self()->autoAccept() == 1 && device->isTrusted()) {
|
||
+
|
||
+ if (FileReceiverSettings::self()->autoAccept() == 1 && isDeviceTrusted) {
|
||
slotAccept();
|
||
return;
|
||
} else if (FileReceiverSettings::self()->autoAccept() == 2) {
|
||
@@ -133,9 +139,9 @@ void ReceiveFileJob::showNotification()
|
||
|
||
m_notification->setActions(actions);
|
||
|
||
- connect(m_notification, SIGNAL(action1Activated()), SLOT(slotAccept()));
|
||
- connect(m_notification, SIGNAL(action2Activated()), SLOT(slotCancel()));
|
||
- connect(m_notification, SIGNAL(closed()), SLOT(slotCancel()));
|
||
+ connect(m_notification, &KNotification::action1Activated, this, &ReceiveFileJob::slotAccept);
|
||
+ connect(m_notification, &KNotification::action2Activated, this, &ReceiveFileJob::slotCancel);
|
||
+ connect(m_notification, &KNotification::closed, this, &ReceiveFileJob::slotCancel);
|
||
|
||
int size = IconSize(KIconLoader::Desktop);
|
||
m_notification->setPixmap(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")).pixmap(size, size));
|
||
@@ -145,12 +151,13 @@ void ReceiveFileJob::showNotification()
|
||
|
||
void ReceiveFileJob::slotAccept()
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
KIO::getJobTracker()->registerJob(this);
|
||
|
||
m_originalFileName = m_transfer->name();
|
||
m_tempPath = createTempPath(m_transfer->name());
|
||
+
|
||
qCDebug(BLUEDAEMON) << m_tempPath;
|
||
+
|
||
QDBusMessage msg = m_msg.createReply(m_tempPath);
|
||
QDBusConnection::sessionBus().send(msg);
|
||
}
|
||
@@ -166,13 +173,12 @@ void ReceiveFileJob::slotSaveAs()
|
||
|
||
void ReceiveFileJob::slotCancel()
|
||
{
|
||
- qCDebug(BLUEDAEMON);
|
||
QDBusMessage msg = m_msg.createErrorReply(QStringLiteral("org.bluez.obex.Error.Rejected"),
|
||
QStringLiteral("org.bluez.obex.Error.Rejected"));
|
||
QDBusConnection::sessionBus().send(msg);
|
||
}
|
||
|
||
-void ReceiveFileJob::transferPropertiesChanged(const QString& interface, const QVariantMap& properties, const QStringList& invalidatedProperties)
|
||
+void ReceiveFileJob::transferPropertiesChanged(const QString &interface, const QVariantMap &properties, const QStringList &invalidatedProperties)
|
||
{
|
||
qCDebug(BLUEDAEMON) << interface;
|
||
qCDebug(BLUEDAEMON) << properties;
|
||
@@ -188,9 +194,10 @@ void ReceiveFileJob::transferPropertiesChanged(const QString& interface, const Q
|
||
}
|
||
}
|
||
|
||
-void ReceiveFileJob::statusChanged(const QVariant& value)
|
||
+void ReceiveFileJob::statusChanged(const QVariant &value)
|
||
{
|
||
qCDebug(BLUEDAEMON) << value;
|
||
+
|
||
QString status = value.toString();
|
||
|
||
FileReceiverSettings::self()->load();
|
||
@@ -210,7 +217,7 @@ void ReceiveFileJob::statusChanged(const QVariant& value)
|
||
} else if (status == QLatin1String("complete")) {
|
||
KIO::CopyJob* job = KIO::move(QUrl::fromLocalFile(m_tempPath), savePath, KIO::HideProgressInfo);
|
||
job->setUiDelegate(0);
|
||
- connect(job, SIGNAL(finished(KJob*)), SLOT(moveFinished(KJob*)));
|
||
+ connect(job, &KIO::CopyJob::finished, this, &ReceiveFileJob::moveFinished);
|
||
return;
|
||
} else if (status == QLatin1String("error")) {
|
||
setError(KJob::UserDefinedError);
|
||
@@ -224,6 +231,7 @@ void ReceiveFileJob::statusChanged(const QVariant& value)
|
||
void ReceiveFileJob::transferChanged(const QVariant& value)
|
||
{
|
||
qCDebug(BLUEDAEMON) << value;
|
||
+
|
||
bool ok = false;
|
||
qulonglong bytes = value.toULongLong(&ok);
|
||
if (!ok) {
|
||
@@ -231,7 +239,7 @@ void ReceiveFileJob::transferChanged(const QVariant& value)
|
||
return;
|
||
}
|
||
|
||
- //If a least 1 second has passed since last update
|
||
+ // If a least 1 second has passed since last update
|
||
int secondsSinceLastTime = m_time.secsTo(QTime::currentTime());
|
||
if (secondsSinceLastTime > 0) {
|
||
float speed = (bytes - m_speedBytes) / secondsSinceLastTime;
|
||
@@ -260,13 +268,13 @@ QString ReceiveFileJob::createTempPath(const QString &fileName) const
|
||
{
|
||
QString xdgCacheHome = QFile::decodeName(qgetenv("XDG_CACHE_HOME"));
|
||
if (xdgCacheHome.isEmpty()) {
|
||
- xdgCacheHome = QDir::homePath() + QLatin1String("/.cache");
|
||
+ xdgCacheHome = QDir::homePath() + QLatin1String("/.cache");
|
||
}
|
||
|
||
xdgCacheHome.append(QLatin1String("/obexd/"));
|
||
- QString path = xdgCacheHome + fileName;
|
||
- int i = 0;
|
||
+ QString path = xdgCacheHome + fileName;
|
||
|
||
+ int i = 0;
|
||
while (QFile::exists(path)) {
|
||
path = xdgCacheHome + fileName + QString::number(i);
|
||
i++;
|
||
diff --git a/src/daemon/kded/filereceiver/receivefilejob.h b/src/daemon/kded/filereceiver/receivefilejob.h
|
||
index 13c6913..68a88fe 100644
|
||
--- a/src/daemon/kded/filereceiver/receivefilejob.h
|
||
+++ b/src/daemon/kded/filereceiver/receivefilejob.h
|
||
@@ -16,7 +16,6 @@
|
||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
|
||
*************************************************************************************/
|
||
|
||
-
|
||
#ifndef RECEIVE_FILE_JOB_H
|
||
#define RECEIVE_FILE_JOB_H
|
||
|
||
@@ -28,42 +27,44 @@
|
||
class OrgBluezObexSession1Interface;
|
||
class OrgBluezObexTransfer1Interface;
|
||
class OrgFreedesktopDBusPropertiesInterface;
|
||
+
|
||
class ReceiveFileJob : public KJob
|
||
{
|
||
Q_OBJECT
|
||
- public:
|
||
- explicit ReceiveFileJob(const QDBusMessage &msg, const QString &path, QObject* parent = 0);
|
||
- virtual ~ReceiveFileJob();
|
||
|
||
- virtual void start();
|
||
- protected:
|
||
- virtual bool doKill();
|
||
+public:
|
||
+ explicit ReceiveFileJob(const QDBusMessage &msg, const QString &path, QObject *parent = 0);
|
||
+
|
||
+ void start() Q_DECL_OVERRIDE;
|
||
+
|
||
+protected:
|
||
+ bool doKill() Q_DECL_OVERRIDE;
|
||
|
||
- private Q_SLOTS:
|
||
- void init();
|
||
- void showNotification();
|
||
- void slotCancel();
|
||
- void slotAccept();
|
||
- void slotSaveAs();
|
||
- void transferPropertiesChanged(const QString &interface, const QVariantMap &properties, const QStringList &invalidatedProperties);
|
||
- void moveFinished(KJob* job);
|
||
+private Q_SLOTS:
|
||
+ void init();
|
||
+ void showNotification();
|
||
+ void slotCancel();
|
||
+ void slotAccept();
|
||
+ void slotSaveAs();
|
||
+ void transferPropertiesChanged(const QString &interface, const QVariantMap &properties, const QStringList &invalidatedProperties);
|
||
+ void moveFinished(KJob *job);
|
||
|
||
- private:
|
||
- void transferChanged(const QVariant &value);
|
||
- void statusChanged(const QVariant &value);
|
||
- QString createTempPath(const QString &fileName) const;
|
||
+private:
|
||
+ void transferChanged(const QVariant &value);
|
||
+ void statusChanged(const QVariant &value);
|
||
+ QString createTempPath(const QString &fileName) const;
|
||
|
||
- QTime m_time;
|
||
- qulonglong m_speedBytes;
|
||
- QString m_path;
|
||
- QString m_tempPath;
|
||
- QString m_originalFileName;
|
||
- QString m_deviceName;
|
||
- QDBusMessage m_msg;
|
||
- OrgBluezObexSession1Interface *m_session;
|
||
- OrgBluezObexTransfer1Interface *m_transfer;
|
||
- OrgFreedesktopDBusPropertiesInterface *m_transferProps;
|
||
+ QTime m_time;
|
||
+ qulonglong m_speedBytes;
|
||
+ QString m_path;
|
||
+ QString m_tempPath;
|
||
+ QString m_originalFileName;
|
||
+ QString m_deviceName;
|
||
+ QDBusMessage m_msg;
|
||
+ OrgBluezObexSession1Interface *m_session;
|
||
+ OrgBluezObexTransfer1Interface *m_transfer;
|
||
+ OrgFreedesktopDBusPropertiesInterface *m_transferProps;
|
||
};
|
||
|
||
-#endif //RECEIVE_FILE_JOB_H
|
||
+#endif // RECEIVE_FILE_JOB_H
|
||
|
||
diff --git a/src/fileitemactionplugin/CMakeLists.txt b/src/fileitemactionplugin/CMakeLists.txt
|
||
index 3737c68..39d6e33 100644
|
||
--- a/src/fileitemactionplugin/CMakeLists.txt
|
||
+++ b/src/fileitemactionplugin/CMakeLists.txt
|
||
@@ -1,9 +1,17 @@
|
||
-add_library(bluetoothfileitemaction MODULE sendfileitemaction.cpp)
|
||
-kservice_desktop_to_json(bluetoothfileitemaction bluedevilsendfile.desktop)
|
||
+set(fileitemactionplugin_SRCS
|
||
+ sendfileitemaction.cpp)
|
||
+
|
||
+set(kded_bluedevil.xml ${CMAKE_CURRENT_SOURCE_DIR}/kded_bluedevil.xml)
|
||
+set_source_files_properties(${kded_bluedevil.xml} PROPERTIES INCLUDE "types.h")
|
||
+qt5_add_dbus_interface(fileitemactionplugin_SRCS ${kded_bluedevil.xml} kded_bluedevil)
|
||
+
|
||
+add_library(bluetoothfileitemaction MODULE ${fileitemactionplugin_SRCS})
|
||
+kcoreaddons_desktop_to_json(bluetoothfileitemaction bluedevilsendfile.desktop)
|
||
target_link_libraries(bluetoothfileitemaction
|
||
Qt5::Widgets
|
||
KF5::I18n
|
||
KF5::KIOFileWidgets
|
||
${LibBlueDevil_LIBRARIES})
|
||
+
|
||
install(TARGETS bluetoothfileitemaction DESTINATION ${PLUGIN_INSTALL_DIR})
|
||
install(FILES bluedevilsendfile.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||
diff --git a/src/fileitemactionplugin/bluedevilsendfile.desktop b/src/fileitemactionplugin/bluedevilsendfile.desktop
|
||
index 1896d55..4ce580d 100644
|
||
--- a/src/fileitemactionplugin/bluedevilsendfile.desktop
|
||
+++ b/src/fileitemactionplugin/bluedevilsendfile.desktop
|
||
@@ -1,16 +1,26 @@
|
||
[Desktop Entry]
|
||
Type=Service
|
||
Name=Send file via Bluetooth
|
||
+Name[bs]=Šalji datoteku preko Bluetoots
|
||
Name[ca]=Envia un fitxer per Bluetooth
|
||
Name[cs]=Poslat soubor přes Bluetooth
|
||
Name[de]=Datei über Bluetooth versenden
|
||
+Name[el]=Αποστολή αρχείου μέσω Bluetooth
|
||
Name[en_GB]=Send file via Bluetooth
|
||
-Name[es]=Enviar archivo usando Bluetooth
|
||
+Name[es]=Enviar archivo por Bluetooth
|
||
+Name[et]=Faili saatmine Bluetoothi kaudu
|
||
Name[fi]=Lähetä tiedosto Bluetoothin kautta
|
||
Name[fr]=Envoi de fichiers via Bluetooth
|
||
Name[it]=Invia file via Bluetooth
|
||
+Name[ja]=Bluetooth を通してファイルを送信
|
||
+Name[kk]=Bluetooth арқылы файлды жіберу
|
||
+Name[km]=ផ្ញើឯកសារតាមប៊្លូធូស
|
||
+Name[ko]=블루투스로 파일 보내기
|
||
+Name[lt]=Siųsti per Bluetooth
|
||
+Name[mr]=ब्लूटूथ द्वारे फाईल पाठवा
|
||
Name[nb]=Send fil over Blåtann
|
||
Name[nl]=Verzendt bestand 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
|
||
@@ -21,21 +31,32 @@ 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[bs]=Blutut
|
||
X-KDE-Submenu[ca]=Bluetooth
|
||
X-KDE-Submenu[cs]=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[fi]=Bluetooth
|
||
X-KDE-Submenu[fr]=Bluetooth
|
||
X-KDE-Submenu[it]=Bluetooth
|
||
+X-KDE-Submenu[ja]=Bluetooth
|
||
+X-KDE-Submenu[kk]=Bluetooth
|
||
+X-KDE-Submenu[km]=ប៊្លូធូស
|
||
+X-KDE-Submenu[ko]=블루투스
|
||
+X-KDE-Submenu[lt]=Bluetooth
|
||
+X-KDE-Submenu[mr]=ब्लूटूथ
|
||
X-KDE-Submenu[nb]=Blåtann
|
||
X-KDE-Submenu[nl]=Bluetooth
|
||
+X-KDE-Submenu[pa]=ਬਲਿਊਟੁੱਥ
|
||
X-KDE-Submenu[pl]=Bluetooth
|
||
X-KDE-Submenu[pt]=Bluetooth
|
||
X-KDE-Submenu[pt_BR]=Bluetooth
|
||
@@ -46,9 +67,11 @@ 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
|
||
ServiceTypes=KFileItemAction/Plugin
|
||
MimeType=application/octet-stream;
|
||
diff --git a/src/fileitemactionplugin/kded_bluedevil.xml b/src/fileitemactionplugin/kded_bluedevil.xml
|
||
new file mode 100644
|
||
index 0000000..e447897
|
||
--- /dev/null
|
||
+++ b/src/fileitemactionplugin/kded_bluedevil.xml
|
||
@@ -0,0 +1,23 @@
|
||
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||
+<node>
|
||
+ <interface name="org.kde.BlueDevil">
|
||
+ <method name="isOnline">
|
||
+ <arg type="b" direction="out"/>
|
||
+ </method>
|
||
+ <method name="allDevices">
|
||
+ <arg type="aa{ss}" direction="out"/>
|
||
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QMapDeviceInfo"/>
|
||
+ </method>
|
||
+ <method name="device">
|
||
+ <arg name="address" type="s" direction="in"/>
|
||
+ <arg type="a{ss}" direction="out"/>
|
||
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="DeviceInfo"/>
|
||
+ </method>
|
||
+ <method name="startDiscovering">
|
||
+ <arg name="timeout" type="u" direction="in"/>
|
||
+ </method>
|
||
+ <method name="stopDiscovering">
|
||
+ </method>
|
||
+ </interface>
|
||
+</node>
|
||
diff --git a/src/fileitemactionplugin/sendfileitemaction.cpp b/src/fileitemactionplugin/sendfileitemaction.cpp
|
||
index c750bc4..ba9d1fd 100644
|
||
--- a/src/fileitemactionplugin/sendfileitemaction.cpp
|
||
+++ b/src/fileitemactionplugin/sendfileitemaction.cpp
|
||
@@ -33,57 +33,56 @@
|
||
#include <KProcess>
|
||
#include <KLocalizedString>
|
||
|
||
-#include <bluedevil/bluedevil.h>
|
||
-
|
||
-using namespace BlueDevil;
|
||
-
|
||
K_PLUGIN_FACTORY_WITH_JSON(SendFileItemActionFactory,
|
||
"bluedevilsendfile.json",
|
||
registerPlugin<SendFileItemAction>();)
|
||
|
||
-SendFileItemAction::SendFileItemAction(QObject* parent, const QVariantList& args)
|
||
+SendFileItemAction::SendFileItemAction(QObject *parent, const QVariantList &args)
|
||
: KAbstractFileItemActionPlugin(parent)
|
||
{
|
||
Q_UNUSED(args)
|
||
+
|
||
+ qDBusRegisterMetaType<DeviceInfo>();
|
||
+ qDBusRegisterMetaType<QMapDeviceInfo>();
|
||
+
|
||
+ m_kded = new org::kde::BlueDevil(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/bluedevil"),
|
||
+ QDBusConnection::sessionBus(), this);
|
||
}
|
||
|
||
-QList< QAction* > SendFileItemAction::actions(const KFileItemListProperties& fileItemInfos, QWidget* parentWidget)
|
||
+QList<QAction*> SendFileItemAction::actions(const KFileItemListProperties &infos, QWidget *parent)
|
||
{
|
||
- Q_UNUSED(parentWidget)
|
||
- QList< QAction* > list;
|
||
+ Q_UNUSED(parent)
|
||
|
||
- m_fileItemInfos = fileItemInfos;
|
||
+ QList<QAction*> list;
|
||
|
||
- //If there is no adaptor, there is no bluetooth
|
||
- if (!Manager::self()->usableAdapter()) {
|
||
+ // Don't show the action for files that we can't send or when Bluetooth is offline.
|
||
+ if (!infos.isLocal() || !m_kded->isOnline()) {
|
||
return list;
|
||
}
|
||
- Adapter *adapter = Manager::self()->usableAdapter();
|
||
+
|
||
+ m_infos = infos;
|
||
|
||
QAction *menuAction = new QAction(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")), i18n("Send via Bluetooth"), this);
|
||
QMenu *menu = new QMenu();
|
||
|
||
- //If we have configured devices, put them first
|
||
- QList< Device * > devices = adapter->devices();
|
||
- if (!devices.isEmpty()) {
|
||
- Q_FOREACH(Device *device, devices) {
|
||
- if (device->UUIDs().contains(QLatin1String("00001105-0000-1000-8000-00805F9B34FB"), Qt::CaseInsensitive)) {
|
||
- QAction *action = new QAction(QIcon::fromTheme(device->icon()), device->name(), this);
|
||
- connect(action, SIGNAL(triggered(bool)), this, SLOT(deviceTriggered()));
|
||
- action->setData(device->UBI());
|
||
- menu->addAction(action);
|
||
- }
|
||
+ const QMapDeviceInfo &devices = m_kded->allDevices().value();
|
||
+ Q_FOREACH (const DeviceInfo &device, devices) {
|
||
+ if (device.value(QStringLiteral("UUIDs")).contains(QLatin1String("00001105-0000-1000-8000-00805F9B34FB"))) {
|
||
+ QAction *action = new QAction(QIcon::fromTheme(device[QStringLiteral("icon")]), device.value(QStringLiteral("name")), this);
|
||
+ connect(action, &QAction::triggered, this, &SendFileItemAction::deviceTriggered);
|
||
+ action->setData(device.value(QStringLiteral("UBI")));
|
||
+ menu->addAction(action);
|
||
}
|
||
}
|
||
|
||
QAction *otherAction = new QAction(this);
|
||
- connect(otherAction, SIGNAL(triggered(bool)), this, SLOT(otherTriggered()));
|
||
if (menu->actions().isEmpty()) {
|
||
otherAction->setText(i18nc("Find Bluetooth device", "Find Device..."));
|
||
} else {
|
||
menu->addSeparator();
|
||
otherAction->setText(i18nc("Other Bluetooth device", "Other..."));
|
||
}
|
||
+ connect(otherAction, &QAction::triggered, this, &SendFileItemAction::otherTriggered);
|
||
menu->addAction(otherAction);
|
||
|
||
menuAction->setMenu(menu);
|
||
@@ -94,13 +93,13 @@ QList< QAction* > SendFileItemAction::actions(const KFileItemListProperties& fil
|
||
void SendFileItemAction::deviceTriggered()
|
||
{
|
||
QStringList args;
|
||
- args.append(QLatin1String("-u") % static_cast<QAction *>(sender())->data().toString());
|
||
+ args.append(QStringLiteral("-u") % static_cast<QAction*>(sender())->data().toString());
|
||
|
||
- const QList<QUrl> &fileList = m_fileItemInfos.urlList();
|
||
- Q_FOREACH(const QUrl &url, fileList) {
|
||
- args.append(QLatin1String("-f") % url.path());
|
||
+ const QList<QUrl> &fileList = m_infos.urlList();
|
||
+ Q_FOREACH (const QUrl &url, fileList) {
|
||
+ args.append(QStringLiteral("-f") % url.path());
|
||
}
|
||
- qDebug() << args;
|
||
+
|
||
KProcess process;
|
||
process.setProgram(QStringLiteral("bluedevil-sendfile"), args);
|
||
process.startDetached();
|
||
@@ -108,12 +107,11 @@ void SendFileItemAction::deviceTriggered()
|
||
|
||
void SendFileItemAction::otherTriggered()
|
||
{
|
||
- qDebug();
|
||
QStringList args;
|
||
|
||
- const QList<QUrl> &fileList = m_fileItemInfos.urlList();
|
||
- Q_FOREACH(const QUrl &url, fileList) {
|
||
- args.append(QLatin1String("-f") % url.path());
|
||
+ const QList<QUrl> &fileList = m_infos.urlList();
|
||
+ Q_FOREACH (const QUrl &url, fileList) {
|
||
+ args.append(QStringLiteral("-f") % url.path());
|
||
}
|
||
|
||
KProcess process;
|
||
diff --git a/src/fileitemactionplugin/sendfileitemaction.h b/src/fileitemactionplugin/sendfileitemaction.h
|
||
index f9eecc3..a194831 100644
|
||
--- a/src/fileitemactionplugin/sendfileitemaction.h
|
||
+++ b/src/fileitemactionplugin/sendfileitemaction.h
|
||
@@ -24,22 +24,26 @@
|
||
#include <KAbstractFileItemActionPlugin>
|
||
#include <KFileItemListProperties>
|
||
|
||
+#include "kded_bluedevil.h"
|
||
+
|
||
class QAction;
|
||
class QWidget;
|
||
|
||
class SendFileItemAction : public KAbstractFileItemActionPlugin
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
+
|
||
public:
|
||
- SendFileItemAction(QObject* parent, const QVariantList &args);
|
||
- virtual QList< QAction* > actions(const KFileItemListProperties& fileItemInfos, QWidget* parentWidget);
|
||
+ SendFileItemAction(QObject *parent, const QVariantList &args);
|
||
+ QList<QAction*> actions(const KFileItemListProperties &infos, QWidget *parent) Q_DECL_OVERRIDE;
|
||
|
||
private Q_SLOTS:
|
||
void deviceTriggered();
|
||
void otherTriggered();
|
||
|
||
private:
|
||
- KFileItemListProperties m_fileItemInfos;
|
||
+ org::kde::BlueDevil *m_kded;
|
||
+ KFileItemListProperties m_infos;
|
||
};
|
||
|
||
#endif // SENDFILEITEMACTION_H
|
||
diff --git a/src/fileitemactionplugin/types.h b/src/fileitemactionplugin/types.h
|
||
new file mode 100644
|
||
index 0000000..53f2e4a
|
||
--- /dev/null
|
||
+++ b/src/fileitemactionplugin/types.h
|
||
@@ -0,0 +1,11 @@
|
||
+#ifndef FILEITEMACTIONPLUGINTYPES
|
||
+#define FILEITEMACTIONPLUGINTYPES
|
||
+
|
||
+#include <QMetaType>
|
||
+
|
||
+typedef QMap<QString, QString> DeviceInfo;
|
||
+typedef QMap<QString, DeviceInfo> QMapDeviceInfo;
|
||
+Q_DECLARE_METATYPE(DeviceInfo)
|
||
+Q_DECLARE_METATYPE(QMapDeviceInfo)
|
||
+
|
||
+#endif
|
||
diff --git a/src/kcmodule/CMakeLists.txt b/src/kcmodule/CMakeLists.txt
|
||
index 64e6050..4145c1b 100644
|
||
--- a/src/kcmodule/CMakeLists.txt
|
||
+++ b/src/kcmodule/CMakeLists.txt
|
||
@@ -24,9 +24,9 @@ add_library(kcm_bluedevildevices MODULE ${kcm_bluedevildevices_PART_SRCS})
|
||
add_library(kcm_bluedeviladapters MODULE ${kcm_bluedeviladapters_PART_SRCS})
|
||
add_library(kcm_bluedeviltransfer MODULE ${kcm_bluedeviltransfer_PART_SRCS} ${kcm_bluedeviltransfer_PART_SRCS_UI})
|
||
|
||
-kservice_desktop_to_json(kcm_bluedevildevices bluedevildevices.desktop)
|
||
-kservice_desktop_to_json(kcm_bluedeviladapters bluedeviladapters.desktop)
|
||
-kservice_desktop_to_json(kcm_bluedeviltransfer bluedeviltransfer.desktop)
|
||
+kcoreaddons_desktop_to_json(kcm_bluedevildevices bluedevildevices.desktop)
|
||
+kcoreaddons_desktop_to_json(kcm_bluedeviladapters bluedeviladapters.desktop)
|
||
+kcoreaddons_desktop_to_json(kcm_bluedeviltransfer bluedeviltransfer.desktop)
|
||
|
||
target_link_libraries(kcm_bluedevildevices
|
||
Qt5::Widgets
|
||
diff --git a/src/kcmodule/bluedeviladapters.cpp b/src/kcmodule/bluedeviladapters.cpp
|
||
index 9185552..13504c9 100644
|
||
--- a/src/kcmodule/bluedeviladapters.cpp
|
||
+++ b/src/kcmodule/bluedeviladapters.cpp
|
||
@@ -62,8 +62,8 @@ AdapterSettings::AdapterSettings(Adapter *adapter, KCModule *parent)
|
||
buttonGroup->addButton(m_alwaysVisible);
|
||
buttonGroup->addButton(m_temporaryVisible);
|
||
|
||
- m_name->setText(adapter->alias());
|
||
- m_nameOrig = adapter->alias();
|
||
+ m_name->setText(adapter->name());
|
||
+ m_nameOrig = adapter->name();
|
||
m_hiddenOrig = false;
|
||
m_alwaysVisibleOrig = false;
|
||
m_temporaryVisibleOrig = false;
|
||
@@ -119,9 +119,9 @@ AdapterSettings::AdapterSettings(Adapter *adapter, KCModule *parent)
|
||
connect(m_powered, SIGNAL(stateChanged(int)), this, SLOT(slotSettingsChanged()));
|
||
|
||
if (BlueDevil::Manager::self()->usableAdapter() == adapter) {
|
||
- setTitle(i18n("Default adapter: %1 (%2)", adapter->alias(), adapter->address()));
|
||
+ setTitle(i18n("Default adapter: %1 (%2)", adapter->name(), adapter->address()));
|
||
} else {
|
||
- setTitle(i18n("Adapter: %1 (%2)", adapter->alias(), adapter->address()));
|
||
+ setTitle(i18n("Adapter: %1 (%2)", adapter->name(), adapter->address()));
|
||
}
|
||
}
|
||
|
||
@@ -188,7 +188,7 @@ void AdapterSettings::readChanges()
|
||
{
|
||
blockSignals(true);
|
||
|
||
- m_nameOrig = m_adapter->alias();
|
||
+ m_nameOrig = m_adapter->name();
|
||
m_hiddenOrig = !m_adapter->isDiscoverable();
|
||
m_alwaysVisibleOrig = m_adapter->isDiscoverable() && !m_adapter->discoverableTimeout();
|
||
m_temporaryVisibleOrig = m_adapter->isDiscoverable() && m_adapter->discoverableTimeout();
|
||
@@ -204,9 +204,9 @@ void AdapterSettings::readChanges()
|
||
|
||
m_discoverTimeLabel->setText(i18np("1 minute", "%1 minutes", m_discoverTime->value()));
|
||
if (BlueDevil::Manager::self()->usableAdapter() == m_adapter) {
|
||
- setTitle(i18n("Default adapter: %1 (%2)", m_adapter->alias(), m_adapter->address()));
|
||
+ setTitle(i18n("Default adapter: %1 (%2)", m_adapter->name(), m_adapter->address()));
|
||
} else {
|
||
- setTitle(i18n("Adapter: %1 (%2)", m_adapter->alias(), m_adapter->address()));
|
||
+ setTitle(i18n("Adapter: %1 (%2)", m_adapter->name(), m_adapter->address()));
|
||
}
|
||
|
||
blockSignals(false);
|
||
@@ -320,7 +320,7 @@ void KCMBlueDevilAdapters::generateNoAdaptersMessage()
|
||
QGridLayout *layout = new QGridLayout;
|
||
m_noAdaptersMessage = new QWidget(this);
|
||
QLabel *label = new QLabel(m_noAdaptersMessage);
|
||
- label->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(128, 128));
|
||
+ label->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(128));
|
||
layout->addWidget(label, 0, 1, Qt::AlignHCenter);
|
||
layout->addWidget(new QLabel(i18n("No adapters found. Please connect one."), m_noAdaptersMessage),
|
||
1, 1, Qt::AlignHCenter);
|
||
diff --git a/src/kcmodule/bluedeviladapters.desktop b/src/kcmodule/bluedeviladapters.desktop
|
||
index f1f5e50..7a32916 100644
|
||
--- a/src/kcmodule/bluedeviladapters.desktop
|
||
+++ b/src/kcmodule/bluedeviladapters.desktop
|
||
@@ -12,16 +12,25 @@ X-KDE-System-Settings-Parent-Category=bluetooth
|
||
X-KDE-Weight=100
|
||
|
||
Name=Adapters
|
||
+Name[bs]=Adapteri
|
||
Name[ca]=Adaptadors
|
||
Name[cs]=Adaptéry
|
||
Name[de]=Adapter
|
||
+Name[el]=Προσαρμογείς
|
||
Name[en_GB]=Adapters
|
||
Name[es]=Adaptadores
|
||
Name[fi]=Sovittimet
|
||
Name[fr]=Adaptateurs
|
||
Name[it]=Adattatori
|
||
+Name[ja]=アダプタ
|
||
+Name[kk]=Адаптерлері
|
||
+Name[km]=អាដាប់ទ័រ
|
||
+Name[ko]=어댑터
|
||
+Name[lt]=Adapteriai
|
||
+Name[mr]=एडाप्टर्स
|
||
Name[nb]=Adaptere
|
||
Name[nl]=Adapters
|
||
+Name[pa]=ਅਡੈਪਟਰ
|
||
Name[pl]=Adaptery
|
||
Name[pt]=Adaptadores
|
||
Name[pt_BR]=Adaptadores
|
||
@@ -32,21 +41,27 @@ Name[sr@ijekavian]=Адаптери
|
||
Name[sr@ijekavianlatin]=Adapteri
|
||
Name[sr@latin]=Adapteri
|
||
Name[sv]=Anslutningar
|
||
+Name[tr]=Bağdaştırıcılar
|
||
Name[uk]=Адаптери
|
||
Name[x-test]=xxAdaptersxx
|
||
Name[zh_CN]=适配器
|
||
+Name[zh_TW]=轉接器
|
||
|
||
Comment=Configure Bluetooth adapters
|
||
+Comment[bs]=Konfigurisanje Blutut adaptera
|
||
Comment[ca]=Configura els adaptadors Bluetooth
|
||
Comment[cs]=Nastavte adaptéry Bluetooth
|
||
Comment[de]=Bluetooth-Adapter einrichten
|
||
+Comment[el]=Διαμόρφωση προσαρμογέων Bluetooth
|
||
Comment[en_GB]=Configure Bluetooth adapters
|
||
Comment[es]=Configurar adaptadores Bluetooth
|
||
+Comment[et]=Bluetoothi adapterite seadistamine
|
||
Comment[fi]=Bluetooth-sovittimien asetukset
|
||
Comment[fr]=Configure les adaptateurs Bluetooth
|
||
Comment[it]=Configura gli adattatori Bluetooth
|
||
Comment[nb]=Sett opp Blåtann-adaptere
|
||
Comment[nl]=Bluetooth-adapters instellen
|
||
+Comment[pa]=ਬਲਿਊਟੁੱਥ ਐਡਪਟਰ ਸੰਰਚਨਾ
|
||
Comment[pl]=Ustawienia adapterów Bluetooth
|
||
Comment[pt]=Configurar os adaptadores de Bluetooth
|
||
Comment[pt_BR]=Configura os adaptadores Bluetooth
|
||
@@ -57,14 +72,18 @@ Comment[sr@ijekavian]=Подесите блутут адаптере
|
||
Comment[sr@ijekavianlatin]=Podesite bluetooth adaptere
|
||
Comment[sr@latin]=Podesite bluetooth adaptere
|
||
Comment[sv]=Anpassa Blåtandanslutningar
|
||
+Comment[tr]=Bluetooth bağdaştırıcılarını yapılandır
|
||
Comment[uk]=Налаштування адаптерів Bluetooth
|
||
Comment[x-test]=xxConfigure Bluetooth adaptersxx
|
||
Comment[zh_CN]=配置蓝牙适配器
|
||
+Comment[zh_TW]=設定藍牙轉接器
|
||
|
||
X-KDE-Keywords=Network,Connectivity,Bluetooth
|
||
+X-KDE-Keywords[bs]=Network,Connectivity,Bluetooth
|
||
X-KDE-Keywords[ca]=Xarxa,Connectivitat,Bluetooth
|
||
X-KDE-Keywords[cs]=Síť,Konektivita,Bluetooth
|
||
X-KDE-Keywords[de]=Netzwerk,Verbindungen,Bluetooth
|
||
+X-KDE-Keywords[el]=Δίκτυο,Συνδεσιμότητα,Bluetooth
|
||
X-KDE-Keywords[en_GB]=Network,Connectivity,Bluetooth
|
||
X-KDE-Keywords[es]=Red,Conectividad,Bluetooth
|
||
X-KDE-Keywords[fi]=Verkko,Yhteydet,Bluetooth
|
||
@@ -72,6 +91,7 @@ X-KDE-Keywords[fr]=Réseau, connectivité, Bluetooth
|
||
X-KDE-Keywords[it]=Rete,Connettività,Bluetooth
|
||
X-KDE-Keywords[nb]=Nettverk,sammenkobling,blåtann
|
||
X-KDE-Keywords[nl]=Netwerkverbinding,connectiviteit,bluetooth
|
||
+X-KDE-Keywords[pa]=ਨੈਟਵਰਕ,ਕਨੈਕਟਵਿਟੀ,ਬਲਿਊਟੁੱਥ
|
||
X-KDE-Keywords[pl]=Sieć,Łączność,Bluetooth
|
||
X-KDE-Keywords[pt]=Rede,Conectividade,Bluetooth
|
||
X-KDE-Keywords[pt_BR]=Rede,Conectividade,Bluetooth
|
||
@@ -82,8 +102,10 @@ X-KDE-Keywords[sr@ijekavian]=Network,Connectivity,Bluetooth,мрежа,пове
|
||
X-KDE-Keywords[sr@ijekavianlatin]=Network,Connectivity,Bluetooth,mreža,povezivanje,Bluetooth
|
||
X-KDE-Keywords[sr@latin]=Network,Connectivity,Bluetooth,mreža,povezivanje,Bluetooth
|
||
X-KDE-Keywords[sv]=Nätverk,Anslutningar,Blåtand
|
||
+X-KDE-Keywords[tr]=Ağ, Bağlanılabilirlik, Bluetooth
|
||
X-KDE-Keywords[uk]=Network,Connectivity,Bluetooth,мережа,з’єднання,з'єднання
|
||
X-KDE-Keywords[x-test]=xxNetworkxx,xxConnectivityxx,xxBluetoothxx
|
||
X-KDE-Keywords[zh_CN]=Network,Connectivity,Bluetooth,网络,连接,蓝牙
|
||
+X-KDE-Keywords[zh_TW]=Network,Connectivity,Bluetooth
|
||
|
||
Categories=Qt;KDE;X-KDE-settings-bluetooth;
|
||
diff --git a/src/kcmodule/bluedeviladapters.h b/src/kcmodule/bluedeviladapters.h
|
||
index 5a775bd..7ecbeb8 100644
|
||
--- a/src/kcmodule/bluedeviladapters.h
|
||
+++ b/src/kcmodule/bluedeviladapters.h
|
||
@@ -36,7 +36,8 @@ class QLineEdit;
|
||
class SystemCheck;
|
||
class AdapterSettings;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Adapter;
|
||
}
|
||
|
||
diff --git a/src/kcmodule/bluedevildevices.cpp b/src/kcmodule/bluedevildevices.cpp
|
||
index 1135d6f..9474e93 100644
|
||
--- a/src/kcmodule/bluedevildevices.cpp
|
||
+++ b/src/kcmodule/bluedevildevices.cpp
|
||
@@ -226,11 +226,11 @@ BluetoothDevicesDelegate::BluetoothDevicesDelegate(QObject *parent)
|
||
: QStyledItemDelegate(parent)
|
||
, smallIconSize(IconSize(KIconLoader::Toolbar))
|
||
{
|
||
- m_blockedPixmap = QIcon::fromTheme(QStringLiteral("dialog-cancel")).pixmap(smallIconSize, smallIconSize);
|
||
- m_trustedPixmap = QIcon::fromTheme(QStringLiteral("security-high")).pixmap(smallIconSize, smallIconSize);
|
||
- m_untrustedPixmap = QIcon::fromTheme(QStringLiteral("security-low")).pixmap(smallIconSize, smallIconSize);
|
||
- m_connectedPixmap = QIcon::fromTheme(QStringLiteral("user-online")).pixmap(smallIconSize, smallIconSize);
|
||
- m_disconnectedPixmap = QIcon::fromTheme(QStringLiteral("user-offline")).pixmap(smallIconSize, smallIconSize);
|
||
+ m_blockedPixmap = QIcon::fromTheme(QStringLiteral("dialog-cancel")).pixmap(smallIconSize);
|
||
+ m_trustedPixmap = QIcon::fromTheme(QStringLiteral("security-high")).pixmap(smallIconSize);
|
||
+ m_untrustedPixmap = QIcon::fromTheme(QStringLiteral("security-low")).pixmap(smallIconSize);
|
||
+ m_connectedPixmap = QIcon::fromTheme(QStringLiteral("user-online")).pixmap(smallIconSize);
|
||
+ m_disconnectedPixmap = QIcon::fromTheme(QStringLiteral("user-offline")).pixmap(smallIconSize);
|
||
}
|
||
|
||
BluetoothDevicesDelegate::~BluetoothDevicesDelegate()
|
||
@@ -518,7 +518,11 @@ void KCMBlueDevilDevices::usableAdapterChanged(Adapter *adapter)
|
||
if (adapter) {
|
||
connect(adapter, SIGNAL(discoverableChanged(bool)),
|
||
this, SLOT(adapterDiscoverableChanged()));
|
||
- connect(adapter, SIGNAL(devicesChanged(QList<Device*>)),
|
||
+ connect(adapter, SIGNAL(deviceChanged(Device*)),
|
||
+ this, SLOT(adapterDevicesChanged()));
|
||
+ connect(adapter, SIGNAL(deviceRemoved(Device*)),
|
||
+ this, SLOT(adapterDevicesChanged()));
|
||
+ connect(adapter, SIGNAL(deviceFound(Device*)),
|
||
this, SLOT(adapterDevicesChanged()));
|
||
}
|
||
fillRemoteDevicesModelInformation();
|
||
@@ -547,7 +551,7 @@ void KCMBlueDevilDevices::generateNoDevicesMessage()
|
||
m_noDevicesMessage->setBackgroundRole(QPalette::Base);
|
||
m_noDevicesMessage->setAutoFillBackground(true);
|
||
QLabel *label = new QLabel(m_noDevicesMessage);
|
||
- label->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(128, 128));
|
||
+ label->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(128));
|
||
layout->addWidget(label, 0, 1, Qt::AlignHCenter);
|
||
layout->addWidget(new QLabel(i18n("No remote devices have been added"), m_noDevicesMessage),
|
||
1, 1, Qt::AlignHCenter);
|
||
diff --git a/src/kcmodule/bluedevildevices.desktop b/src/kcmodule/bluedevildevices.desktop
|
||
index ecf6b45..38b83f9 100644
|
||
--- a/src/kcmodule/bluedevildevices.desktop
|
||
+++ b/src/kcmodule/bluedevildevices.desktop
|
||
@@ -12,16 +12,27 @@ X-KDE-System-Settings-Parent-Category=bluetooth
|
||
X-KDE-Weight=50
|
||
|
||
Name=Devices
|
||
+Name[bs]=uređaji
|
||
Name[ca]=Dispositius
|
||
Name[cs]=Zařízení
|
||
Name[de]=Geräte
|
||
+Name[el]=Συσκευές
|
||
Name[en_GB]=Devices
|
||
Name[es]=Dispositivos
|
||
Name[fi]=Laitteet
|
||
Name[fr]=Périphériques
|
||
Name[it]=Dispositivi
|
||
+Name[ja]=デバイス
|
||
+Name[kk]=Құрылғылар
|
||
+Name[km]=ឧបករណ៍
|
||
+Name[ko]=장치
|
||
+Name[lt]=Įrenginiai
|
||
+Name[mai]=डिवाइस
|
||
+Name[mr]=साधने
|
||
+Name[ms]=Peranti
|
||
Name[nb]=Enheter
|
||
Name[nl]=Apparaten
|
||
+Name[pa]=ਯੰਤਰ
|
||
Name[pl]=Urządzenia
|
||
Name[pt]=Dispositivos
|
||
Name[pt_BR]=Dispositivos
|
||
@@ -32,19 +43,29 @@ Name[sr@ijekavian]=Уређаји
|
||
Name[sr@ijekavianlatin]=Uređaji
|
||
Name[sr@latin]=Uređaji
|
||
Name[sv]=Enheter
|
||
+Name[tr]=Aygıtlar
|
||
Name[uk]=Пристрої
|
||
Name[x-test]=xxDevicesxx
|
||
Name[zh_CN]=设备
|
||
+Name[zh_TW]=裝置
|
||
|
||
Comment=Manage Bluetooth devices
|
||
+Comment[bs]=Upravljanje Blutut uređaje
|
||
Comment[ca]=Gestiona els dispositius Bluetooth
|
||
Comment[cs]=Spravovat zařízení Bluetooth
|
||
Comment[de]=Bluetooth-Geräte verwalten
|
||
+Comment[el]=Διαχείριση συσκευών Bluetooth
|
||
Comment[en_GB]=Manage Bluetooth devices
|
||
-Comment[es]=Gestionar los dispositivos Bluetooth
|
||
+Comment[es]=Gestión de dispositivos Bluetooth
|
||
+Comment[et]=Bluetoothi seadmete haldamine
|
||
Comment[fi]=Bluetooth-laitteiden asetukset
|
||
Comment[fr]=Gère les périphériques Bluetooth
|
||
Comment[it]=Gestisci i dispositivi Bluetooth
|
||
+Comment[ja]=Bluetooth デバイスを管理
|
||
+Comment[kk]=Bluetooth құрылығыларын басқару
|
||
+Comment[ko]=블루투스 장치 관리
|
||
+Comment[lt]=Konfigūruoti Bluetooth failų gavimą
|
||
+Comment[mr]=ब्लूटूथ साधने व्यवस्थापीत करा
|
||
Comment[nb]=Håndter Blåtann-enheter
|
||
Comment[nl]=Bluetooth-apparaten beheren
|
||
Comment[pl]=Zarządzaj urządzeniami Bluetooth
|
||
@@ -57,14 +78,18 @@ Comment[sr@ijekavian]=Управљајте блутут уређајима
|
||
Comment[sr@ijekavianlatin]=Upravljajte bluetooth uređajima
|
||
Comment[sr@latin]=Upravljajte bluetooth uređajima
|
||
Comment[sv]=Hantera Blåtandenheter
|
||
+Comment[tr]=Bluetooth aygıtlarını yönet
|
||
Comment[uk]=Керування пристроями Bluetooth
|
||
Comment[x-test]=xxManage Bluetooth devicesxx
|
||
Comment[zh_CN]=管理蓝牙设备
|
||
+Comment[zh_TW]=管理藍牙裝置
|
||
|
||
X-KDE-Keywords=Network,Connectivity,Bluetooth
|
||
+X-KDE-Keywords[bs]=Network,Connectivity,Bluetooth
|
||
X-KDE-Keywords[ca]=Xarxa,Connectivitat,Bluetooth
|
||
X-KDE-Keywords[cs]=Síť,Konektivita,Bluetooth
|
||
X-KDE-Keywords[de]=Netzwerk,Verbindungen,Bluetooth
|
||
+X-KDE-Keywords[el]=Δίκτυο,Συνδεσιμότητα,Bluetooth
|
||
X-KDE-Keywords[en_GB]=Network,Connectivity,Bluetooth
|
||
X-KDE-Keywords[es]=Red,Conectividad,Bluetooth
|
||
X-KDE-Keywords[fi]=Verkko,Yhteydet,Bluetooth
|
||
@@ -72,6 +97,7 @@ X-KDE-Keywords[fr]=Réseau, connectivité, Bluetooth
|
||
X-KDE-Keywords[it]=Rete,Connettività,Bluetooth
|
||
X-KDE-Keywords[nb]=Nettverk,sammenkobling,blåtann
|
||
X-KDE-Keywords[nl]=Netwerkverbinding,connectiviteit,bluetooth
|
||
+X-KDE-Keywords[pa]=ਨੈਟਵਰਕ,ਕਨੈਕਟਵਿਟੀ,ਬਲਿਊਟੁੱਥ
|
||
X-KDE-Keywords[pl]=Sieć,Łączność,Bluetooth
|
||
X-KDE-Keywords[pt]=Rede,Conectividade,Bluetooth
|
||
X-KDE-Keywords[pt_BR]=Rede,Conectividade,Bluetooth
|
||
@@ -82,8 +108,10 @@ X-KDE-Keywords[sr@ijekavian]=Network,Connectivity,Bluetooth,мрежа,пове
|
||
X-KDE-Keywords[sr@ijekavianlatin]=Network,Connectivity,Bluetooth,mreža,povezivanje,Bluetooth
|
||
X-KDE-Keywords[sr@latin]=Network,Connectivity,Bluetooth,mreža,povezivanje,Bluetooth
|
||
X-KDE-Keywords[sv]=Nätverk,Anslutningar,Blåtand
|
||
+X-KDE-Keywords[tr]=Ağ, Bağlanılabilirlik, Bluetooth
|
||
X-KDE-Keywords[uk]=Network,Connectivity,Bluetooth,мережа,з’єднання,з'єднання
|
||
X-KDE-Keywords[x-test]=xxNetworkxx,xxConnectivityxx,xxBluetoothxx
|
||
X-KDE-Keywords[zh_CN]=Network,Connectivity,Bluetooth,网络,连接,蓝牙
|
||
+X-KDE-Keywords[zh_TW]=Network,Connectivity,Bluetooth
|
||
|
||
Categories=Qt;KDE;X-KDE-settings-bluetooth;
|
||
diff --git a/src/kcmodule/bluedevildevices.h b/src/kcmodule/bluedevildevices.h
|
||
index e47b43e..db28629 100644
|
||
--- a/src/kcmodule/bluedevildevices.h
|
||
+++ b/src/kcmodule/bluedevildevices.h
|
||
@@ -32,7 +32,8 @@ class QCheckBox;
|
||
class QPushButton;
|
||
class QItemSelection;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Adapter;
|
||
class Device;
|
||
}
|
||
diff --git a/src/kcmodule/bluedeviltransfer.cpp b/src/kcmodule/bluedeviltransfer.cpp
|
||
index fd1b120..fa0d55f 100644
|
||
--- a/src/kcmodule/bluedeviltransfer.cpp
|
||
+++ b/src/kcmodule/bluedeviltransfer.cpp
|
||
@@ -40,6 +40,8 @@ K_PLUGIN_FACTORY_WITH_JSON(BlueDevilFactory,
|
||
"bluedeviltransfer.json",
|
||
registerPlugin<KCMBlueDevilTransfer>();)
|
||
|
||
+using namespace BlueDevil;
|
||
+
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
||
KCMBlueDevilTransfer::KCMBlueDevilTransfer(QWidget *parent, const QVariantList&)
|
||
@@ -78,8 +80,7 @@ KCMBlueDevilTransfer::KCMBlueDevilTransfer(QWidget *parent, const QVariantList&)
|
||
|
||
addConfig(FileReceiverSettings::self(), transfer);
|
||
|
||
- connect(BlueDevil::Manager::self(), SIGNAL(usableAdapterChanged(Adapter*)),
|
||
- this, SLOT(usableAdapterChanged(Adapter*)));
|
||
+ connect(BlueDevil::Manager::self(), &Manager::usableAdapterChanged, this, &KCMBlueDevilTransfer::usableAdapterChanged);
|
||
|
||
BlueDevil::Adapter *const usableAdapter = BlueDevil::Manager::self()->usableAdapter();
|
||
if (usableAdapter) {
|
||
@@ -90,10 +91,6 @@ KCMBlueDevilTransfer::KCMBlueDevilTransfer(QWidget *parent, const QVariantList&)
|
||
updateInformationState();
|
||
}
|
||
|
||
-KCMBlueDevilTransfer::~KCMBlueDevilTransfer()
|
||
-{
|
||
-}
|
||
-
|
||
void KCMBlueDevilTransfer::save()
|
||
{
|
||
if (!m_restartNeeded) {
|
||
diff --git a/src/kcmodule/bluedeviltransfer.desktop b/src/kcmodule/bluedeviltransfer.desktop
|
||
index 804b118..5bea142 100644
|
||
--- a/src/kcmodule/bluedeviltransfer.desktop
|
||
+++ b/src/kcmodule/bluedeviltransfer.desktop
|
||
@@ -12,16 +12,20 @@ X-KDE-System-Settings-Parent-Category=bluetooth
|
||
X-KDE-Weight=60
|
||
|
||
Name=File Transfers
|
||
+Name[bs]=Transfer datoteke
|
||
Name[ca]=Transferències de fitxers
|
||
Name[cs]=Přenosy souborů
|
||
Name[de]=Dateiübertragungen
|
||
+Name[el]=Μεταφορές αρχείων
|
||
Name[en_GB]=File Transfers
|
||
-Name[es]=Transferencias de archivos
|
||
+Name[es]=Transferencias de archivo
|
||
+Name[et]=Failiedastused
|
||
Name[fi]=Tiedostonsiirto
|
||
Name[fr]=Transferts de fichiers
|
||
Name[it]=Trasferimenti di file
|
||
Name[nb]=Filoverføringer
|
||
Name[nl]=Bestandsoverdrachten
|
||
+Name[pa]=ਫਾਇਲ ਟਰਾਂਸਫਰ
|
||
Name[pl]=Przesyłanie plików
|
||
Name[pt]=Transferência de Ficheiros
|
||
Name[pt_BR]=Transferência de arquivos
|
||
@@ -32,21 +36,27 @@ Name[sr@ijekavian]=Преноси фајлова
|
||
Name[sr@ijekavianlatin]=Prenosi fajlova
|
||
Name[sr@latin]=Prenosi fajlova
|
||
Name[sv]=Filöverföringar
|
||
+Name[tr]=Dosya Aktarımı
|
||
Name[uk]=Перенесення файла
|
||
Name[x-test]=xxFile Transfersxx
|
||
Name[zh_CN]=文件传送
|
||
+Name[zh_TW]=檔案傳輸
|
||
|
||
Comment=Configure Bluetooth file sharing and transfers
|
||
+Comment[bs]=Konfiguriranje Blutut dijeljenje datoteka i prijenos
|
||
Comment[ca]=Configura la compartició i transferència de fitxers per Bluetooth
|
||
Comment[cs]=Nastavte sdílení souborů přes Bluetooth
|
||
Comment[de]=Dateifreigaben und Dateiübertragung für Bluetooth einrichten
|
||
+Comment[el]=Διαμόρφωση διαμοιρασμού και μεταφοράς αρχείων με Bluetooth
|
||
Comment[en_GB]=Configure Bluetooth file sharing and transfers
|
||
-Comment[es]=Configurar la función de compartir archivos y las transferencias por Bluetooth
|
||
+Comment[es]=Configurar compartición y transferencias de archivos por Bluetooth
|
||
+Comment[et]=Bluetoothi failide jagamise ja edastamine seadistamine
|
||
Comment[fi]=Bluetooth-tiedostonjaon ja -siirron asetukset
|
||
Comment[fr]=Configure le partage et les transferts de fichiers par Bluetooth
|
||
Comment[it]=Configura la condivisione e il trasferimento di file via Bluetooth
|
||
Comment[nb]=Sett opp deling og overføring av filer over Blåtann
|
||
Comment[nl]=Bestandsdeling en -overdracht via bluetooth instellen
|
||
+Comment[pa]=ਬਲਿਊਟੁੱਥ ਫਾਇਲ ਸਾਂਝ ਤੇ ਟਰਾਂਸਫਰ ਸੰਰਚਨਾ
|
||
Comment[pl]=Ustawienia udostępniania i przesyłanie plików przez Bluetooth
|
||
Comment[pt]=Configura a partilha e as transferências de ficheiros por Bluetooth
|
||
Comment[pt_BR]=Configura o compartilhamento e a transferência de arquivos por Bluetooth
|
||
@@ -57,14 +67,18 @@ Comment[sr@ijekavian]=Подесите преносе и дељење фајло
|
||
Comment[sr@ijekavianlatin]=Podesite prenose i deljenje fajlova preko Bluetoothom
|
||
Comment[sr@latin]=Podesite prenose i deljenje fajlova preko Bluetoothom
|
||
Comment[sv]=Anpassa fildelning och överföringar med Blåtand
|
||
+Comment[tr]=Bluetooth dosya paylaşımı ve transferlerini yapılandır
|
||
Comment[uk]=Налаштування надсилання та отримання файлів Bluetooth
|
||
Comment[x-test]=xxConfigure Bluetooth file sharing and transfersxx
|
||
Comment[zh_CN]=配置蓝牙文件共享和传输
|
||
+Comment[zh_TW]=設定藍牙檔案共用與傳輸
|
||
|
||
X-KDE-Keywords=Network,Connectivity,Bluetooth
|
||
+X-KDE-Keywords[bs]=Network,Connectivity,Bluetooth
|
||
X-KDE-Keywords[ca]=Xarxa,Connectivitat,Bluetooth
|
||
X-KDE-Keywords[cs]=Síť,Konektivita,Bluetooth
|
||
X-KDE-Keywords[de]=Netzwerk,Verbindungen,Bluetooth
|
||
+X-KDE-Keywords[el]=Δίκτυο,Συνδεσιμότητα,Bluetooth
|
||
X-KDE-Keywords[en_GB]=Network,Connectivity,Bluetooth
|
||
X-KDE-Keywords[es]=Red,Conectividad,Bluetooth
|
||
X-KDE-Keywords[fi]=Verkko,Yhteydet,Bluetooth
|
||
@@ -72,6 +86,7 @@ X-KDE-Keywords[fr]=Réseau, connectivité, Bluetooth
|
||
X-KDE-Keywords[it]=Rete,Connettività,Bluetooth
|
||
X-KDE-Keywords[nb]=Nettverk,sammenkobling,blåtann
|
||
X-KDE-Keywords[nl]=Netwerkverbinding,connectiviteit,bluetooth
|
||
+X-KDE-Keywords[pa]=ਨੈਟਵਰਕ,ਕਨੈਕਟਵਿਟੀ,ਬਲਿਊਟੁੱਥ
|
||
X-KDE-Keywords[pl]=Sieć,Łączność,Bluetooth
|
||
X-KDE-Keywords[pt]=Rede,Conectividade,Bluetooth
|
||
X-KDE-Keywords[pt_BR]=Rede,Conectividade,Bluetooth
|
||
@@ -82,8 +97,10 @@ X-KDE-Keywords[sr@ijekavian]=Network,Connectivity,Bluetooth,мрежа,пове
|
||
X-KDE-Keywords[sr@ijekavianlatin]=Network,Connectivity,Bluetooth,mreža,povezivanje,Bluetooth
|
||
X-KDE-Keywords[sr@latin]=Network,Connectivity,Bluetooth,mreža,povezivanje,Bluetooth
|
||
X-KDE-Keywords[sv]=Nätverk,Anslutningar,Blåtand
|
||
+X-KDE-Keywords[tr]=Ağ, Bağlanılabilirlik, Bluetooth
|
||
X-KDE-Keywords[uk]=Network,Connectivity,Bluetooth,мережа,з’єднання,з'єднання
|
||
X-KDE-Keywords[x-test]=xxNetworkxx,xxConnectivityxx,xxBluetoothxx
|
||
X-KDE-Keywords[zh_CN]=Network,Connectivity,Bluetooth,网络,连接,蓝牙
|
||
+X-KDE-Keywords[zh_TW]=Network,Connectivity,Bluetooth
|
||
|
||
Categories=Qt;KDE;X-KDE-settings-bluetooth;
|
||
diff --git a/src/kcmodule/bluedeviltransfer.h b/src/kcmodule/bluedeviltransfer.h
|
||
index 5be3ae3..ace8542 100644
|
||
--- a/src/kcmodule/bluedeviltransfer.h
|
||
+++ b/src/kcmodule/bluedeviltransfer.h
|
||
@@ -24,26 +24,28 @@
|
||
#include <kcmodule.h>
|
||
|
||
class SystemCheck;
|
||
-namespace Ui {
|
||
+
|
||
+namespace Ui
|
||
+{
|
||
class Transfer;
|
||
}
|
||
-namespace BlueDevil {
|
||
+
|
||
+namespace BlueDevil
|
||
+{
|
||
class Adapter;
|
||
}
|
||
|
||
-typedef BlueDevil::Adapter Adapter;
|
||
-
|
||
class KCMBlueDevilTransfer : public KCModule
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
KCMBlueDevilTransfer(QWidget *parent, const QVariantList&);
|
||
- virtual ~KCMBlueDevilTransfer();
|
||
|
||
- virtual void save();
|
||
+ void save() Q_DECL_OVERRIDE;
|
||
+
|
||
private Q_SLOTS:
|
||
- void usableAdapterChanged(Adapter *adapter);
|
||
+ void usableAdapterChanged(BlueDevil::Adapter *adapter);
|
||
void adapterDiscoverableChanged();
|
||
void updateInformationState();
|
||
void changed(bool);
|
||
@@ -54,4 +56,4 @@ private:
|
||
bool m_restartNeeded;
|
||
};
|
||
|
||
-#endif
|
||
+#endif // _BLUEDEVILTRANSFER_H
|
||
diff --git a/src/kcmodule/devicedetails.h b/src/kcmodule/devicedetails.h
|
||
index b612587..37326da 100644
|
||
--- a/src/kcmodule/devicedetails.h
|
||
+++ b/src/kcmodule/devicedetails.h
|
||
@@ -28,7 +28,8 @@ class QLineEdit;
|
||
class QAbstractButton;
|
||
class QDialogButtonBox;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
}
|
||
|
||
diff --git a/src/kcmodule/systemcheck.cpp b/src/kcmodule/systemcheck.cpp
|
||
index 122021b..43cd864 100644
|
||
--- a/src/kcmodule/systemcheck.cpp
|
||
+++ b/src/kcmodule/systemcheck.cpp
|
||
@@ -41,6 +41,7 @@ SystemCheck::SystemCheck(QWidget *parent)
|
||
, m_kded(new KDED(QStringLiteral("org.kde.kded5"), QStringLiteral("/kded"), QDBusConnection::sessionBus()))
|
||
, m_parent(parent)
|
||
, m_noAdaptersError(0)
|
||
+ , m_noUsableAdapterError(0)
|
||
, m_notDiscoverableAdapterError(0)
|
||
, m_disabledNotificationsError(0)
|
||
{
|
||
@@ -48,9 +49,6 @@ SystemCheck::SystemCheck(QWidget *parent)
|
||
|
||
SystemCheck::~SystemCheck()
|
||
{
|
||
- m_noAdaptersError = 0;
|
||
- m_notDiscoverableAdapterError = 0;
|
||
- m_disabledNotificationsError = 0;
|
||
delete m_kded;
|
||
}
|
||
|
||
@@ -66,6 +64,16 @@ void SystemCheck::createWarnings(QVBoxLayout *layout)
|
||
m_noAdaptersError->setText(i18n("No Bluetooth adapters have been found."));
|
||
layout->addWidget(m_noAdaptersError);
|
||
|
||
+ m_noUsableAdapterError = new KMessageWidget(m_parent);
|
||
+ m_noUsableAdapterError->setMessageType(KMessageWidget::Warning);
|
||
+ m_noUsableAdapterError->setCloseButtonVisible(false);
|
||
+ m_noUsableAdapterError->setText(i18n("Your Bluetooth adapter is powered off."));
|
||
+
|
||
+ QAction *fixNoUsableAdapter = new QAction(QIcon::fromTheme(QStringLiteral("dialog-ok-apply")), i18nc("Action to fix a problem", "Fix it"), m_noUsableAdapterError);
|
||
+ connect(fixNoUsableAdapter, SIGNAL(triggered(bool)), this, SLOT(fixNoUsableAdapterError()));
|
||
+ m_noUsableAdapterError->addAction(fixNoUsableAdapter);
|
||
+ layout->addWidget(m_noUsableAdapterError);
|
||
+
|
||
m_notDiscoverableAdapterError = new KMessageWidget(m_parent);
|
||
m_notDiscoverableAdapterError->setMessageType(KMessageWidget::Warning);
|
||
m_notDiscoverableAdapterError->setCloseButtonVisible(false);
|
||
@@ -142,6 +150,7 @@ void SystemCheck::updateInformationState()
|
||
{
|
||
m_noAdaptersError->setEnabled(true);
|
||
m_noAdaptersError->setVisible(false);
|
||
+ m_noUsableAdapterError->setVisible(false);
|
||
m_notDiscoverableAdapterError->setVisible(false);
|
||
m_disabledNotificationsError->setVisible(false);
|
||
m_noKDEDRunning->setVisible(false);
|
||
@@ -151,9 +160,14 @@ void SystemCheck::updateInformationState()
|
||
return;
|
||
}
|
||
|
||
+ if (BlueDevil::Manager::self()->adapters().isEmpty()) {
|
||
+ m_noAdaptersError->setVisible(true);
|
||
+ return;
|
||
+ }
|
||
+
|
||
BlueDevil::Adapter *const usableAdapter = BlueDevil::Manager::self()->usableAdapter();
|
||
if (!usableAdapter) {
|
||
- m_noAdaptersError->setVisible(true);
|
||
+ m_noUsableAdapterError->setVisible(true);
|
||
return;
|
||
}
|
||
if (!usableAdapter->isDiscoverable()) {
|
||
@@ -176,6 +190,12 @@ void SystemCheck::fixNoKDEDRunning()
|
||
m_kded->loadModule(QStringLiteral("bluedevil"));
|
||
}
|
||
|
||
+void SystemCheck::fixNoUsableAdapterError()
|
||
+{
|
||
+ m_noUsableAdapterError->setVisible(false);
|
||
+ BlueDevil::Manager::self()->adapters().first()->setPowered(true);
|
||
+}
|
||
+
|
||
void SystemCheck::fixNotDiscoverableAdapterError()
|
||
{
|
||
m_notDiscoverableAdapterError->setVisible(false);
|
||
diff --git a/src/kcmodule/systemcheck.h b/src/kcmodule/systemcheck.h
|
||
index 74f9128..cccf899 100644
|
||
--- a/src/kcmodule/systemcheck.h
|
||
+++ b/src/kcmodule/systemcheck.h
|
||
@@ -36,17 +36,6 @@ public:
|
||
SystemCheck(QWidget *parent);
|
||
virtual ~SystemCheck();
|
||
|
||
- struct SystemCheckResult {
|
||
- enum Result {
|
||
- NoWarnings = 0,
|
||
- BluetoothDisabled,
|
||
- NoAdapters,
|
||
- NotificationsDisabled,
|
||
- DefaultAdapterHidden
|
||
- } result;
|
||
- QWidget *warningWidget;
|
||
- };
|
||
-
|
||
void createWarnings(QVBoxLayout *layout);
|
||
|
||
bool checkKDEDModuleLoaded();
|
||
@@ -61,6 +50,7 @@ public Q_SLOTS:
|
||
|
||
private Q_SLOTS:
|
||
void fixNoKDEDRunning();
|
||
+ void fixNoUsableAdapterError();
|
||
void fixNotDiscoverableAdapterError();
|
||
void fixDisabledNotificationsError();
|
||
|
||
@@ -68,6 +58,7 @@ private:
|
||
KDED *m_kded;
|
||
QWidget *m_parent;
|
||
KMessageWidget *m_noAdaptersError;
|
||
+ KMessageWidget *m_noUsableAdapterError;
|
||
KMessageWidget *m_noKDEDRunning;
|
||
KMessageWidget *m_notDiscoverableAdapterError;
|
||
KMessageWidget *m_disabledNotificationsError;
|
||
diff --git a/src/kio/bluetooth/kded_bluedevil.xml b/src/kio/bluetooth/kded_bluedevil.xml
|
||
index cb4d6fd..e447897 100644
|
||
--- a/src/kio/bluetooth/kded_bluedevil.xml
|
||
+++ b/src/kio/bluetooth/kded_bluedevil.xml
|
||
@@ -5,11 +5,19 @@
|
||
<method name="isOnline">
|
||
<arg type="b" direction="out"/>
|
||
</method>
|
||
- <method name="knownDevices">
|
||
+ <method name="allDevices">
|
||
<arg type="aa{ss}" direction="out"/>
|
||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QMapDeviceInfo"/>
|
||
</method>
|
||
+ <method name="device">
|
||
+ <arg name="address" type="s" direction="in"/>
|
||
+ <arg type="a{ss}" direction="out"/>
|
||
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="DeviceInfo"/>
|
||
+ </method>
|
||
+ <method name="startDiscovering">
|
||
+ <arg name="timeout" type="u" direction="in"/>
|
||
+ </method>
|
||
<method name="stopDiscovering">
|
||
</method>
|
||
</interface>
|
||
-</node>
|
||
\ No newline at end of file
|
||
+</node>
|
||
diff --git a/src/kio/bluetooth/kiobluetooth.cpp b/src/kio/bluetooth/kiobluetooth.cpp
|
||
index e7b1289..7d529e6 100644
|
||
--- a/src/kio/bluetooth/kiobluetooth.cpp
|
||
+++ b/src/kio/bluetooth/kiobluetooth.cpp
|
||
@@ -30,10 +30,6 @@
|
||
#include <KProcess>
|
||
#include <KLocalizedString>
|
||
|
||
-#include <bluedevil/bluedevil.h>
|
||
-
|
||
-using namespace BlueDevil;
|
||
-
|
||
extern "C" int Q_DECL_EXPORT kdemain(int argc, char **argv)
|
||
{
|
||
QCoreApplication app(argc, argv);
|
||
@@ -61,27 +57,30 @@ KioBluetooth::KioBluetooth(const QByteArray &pool, const QByteArray &app)
|
||
s.icon = QStringLiteral("edit-copy");
|
||
s.mimetype = QStringLiteral("application/vnd.kde.bluedevil-sendfile");
|
||
s.uuid = QStringLiteral("00001105-0000-1000-8000-00805F9B34FB");
|
||
- m_supportedServices.insert(QStringLiteral("00001105-0000-1000-8000-00805F9B34FB"), s);
|
||
+ m_supportedServices.insert(s.uuid, s);
|
||
+
|
||
s.name = i18n("Browse Files");
|
||
s.icon = QStringLiteral("edit-find");
|
||
s.mimetype = QString();
|
||
s.uuid = QStringLiteral("00001106-0000-1000-8000-00805F9B34FB");
|
||
- m_supportedServices.insert(QStringLiteral("00001106-0000-1000-8000-00805F9B34FB"), s);
|
||
+ m_supportedServices.insert(s.uuid, s);
|
||
|
||
- if (!Manager::self()->usableAdapter()) {
|
||
- qCDebug(BLUETOOTH) << "No available interface";
|
||
+ qCDebug(BLUETOOTH) << "Kio Bluetooth instanced!";
|
||
+
|
||
+ m_kded = new org::kde::BlueDevil(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/bluedevil"),
|
||
+ QDBusConnection::sessionBus());
|
||
+
|
||
+ if (!m_kded->isOnline()) {
|
||
+ qCDebug(BLUETOOTH) << "Bluetooth is offline";
|
||
infoMessage(i18n("No Bluetooth adapters have been found."));
|
||
return;
|
||
}
|
||
-
|
||
- qCDebug(BLUETOOTH) << "Kio Bluetooth instanced!";
|
||
- m_kded = new org::kde::BlueDevil(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/bluedevil"),
|
||
- QDBusConnection::sessionBus(), 0);
|
||
}
|
||
|
||
QList<KioBluetooth::Service> KioBluetooth::getSupportedServices(const QStringList &uuids)
|
||
{
|
||
qCDebug(BLUETOOTH) << "supported services: " << uuids;
|
||
+
|
||
QList<Service> retValue;
|
||
Q_FOREACH (const QString &uuid, uuids) {
|
||
if (m_supportedServices.contains(uuid)) {
|
||
@@ -93,14 +92,22 @@ QList<KioBluetooth::Service> KioBluetooth::getSupportedServices(const QStringLis
|
||
|
||
void KioBluetooth::listRemoteDeviceServices()
|
||
{
|
||
- m_kded->stopDiscovering();
|
||
infoMessage(i18n("Retrieving services..."));
|
||
|
||
qCDebug(BLUETOOTH) << "Listing remote devices";
|
||
- m_currentHost = Manager::self()->usableAdapter()->deviceForAddress(m_currentHostname.replace('-', ':').toUpper());
|
||
- m_currentHostServices = getSupportedServices(m_currentHost->UUIDs());
|
||
+
|
||
+ const DeviceInfo &info = m_kded->device(m_currentHostAddress).value();
|
||
+ if (info.isEmpty()) {
|
||
+ qCDebug(BLUETOOTH) << "Invalid hostname!";
|
||
+ infoMessage(i18n("This address is unavailable."));
|
||
+ finished();
|
||
+ return;
|
||
+ }
|
||
+
|
||
+ m_currentHostServices = getSupportedServices(info.value(QStringLiteral("UUIDs")).split(QLatin1Char(',')));
|
||
|
||
qCDebug(BLUETOOTH) << "Num of supported services: " << m_currentHostServices.size();
|
||
+
|
||
totalSize(m_currentHostServices.count());
|
||
int i = 1;
|
||
Q_FOREACH (const Service &service, m_currentHostServices) {
|
||
@@ -109,7 +116,7 @@ void KioBluetooth::listRemoteDeviceServices()
|
||
entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, service.name);
|
||
entry.insert(KIO::UDSEntry::UDS_ICON_NAME, service.icon);
|
||
|
||
- //If it is browse files, act as a folder
|
||
+ // If it is browse files, act as a folder
|
||
if (service.uuid == QLatin1String("00001106-0000-1000-8000-00805F9B34FB")) {
|
||
QUrl obexUrl;
|
||
obexUrl.setScheme(QStringLiteral("obexftp"));
|
||
@@ -137,11 +144,15 @@ void KioBluetooth::listRemoteDeviceServices()
|
||
void KioBluetooth::listDevices()
|
||
{
|
||
qCDebug(BLUETOOTH) << "Asking kded for devices";
|
||
- QMapDeviceInfo devices = m_kded->knownDevices().value();
|
||
+ const QMapDeviceInfo &devices = m_kded->allDevices().value();
|
||
qCDebug(BLUETOOTH) << devices.keys();
|
||
+
|
||
Q_FOREACH(const DeviceInfo device, devices) {
|
||
listDevice(device);
|
||
}
|
||
+
|
||
+ m_kded->startDiscovering(10 * 1000);
|
||
+
|
||
infoMessage(i18n("Scanning for new devices..."));
|
||
finished();
|
||
}
|
||
@@ -173,8 +184,8 @@ void KioBluetooth::listDir(const QUrl &url)
|
||
{
|
||
qCDebug(BLUETOOTH) << "Listing..." << url;
|
||
|
||
- /// Url is not used here becuase all we could care about the url is the host, and that's already
|
||
- /// handled in @p setHost
|
||
+ // Url is not used here becuase all we could care about the url is the host, and that's already
|
||
+ // handled in @p setHost
|
||
Q_UNUSED(url);
|
||
|
||
// If we are not online (ie. there's no working bluetooth adapter), list an empty dir
|
||
@@ -207,24 +218,24 @@ void KioBluetooth::get(const QUrl &url)
|
||
finished();
|
||
}
|
||
|
||
-void KioBluetooth::setHost(const QString &constHostname, quint16 port, const QString &user,
|
||
- const QString &pass)
|
||
+void KioBluetooth::setHost(const QString &hostname, quint16 port, const QString &user, const QString &pass)
|
||
{
|
||
- qCDebug(BLUETOOTH) << "Setting host: " << constHostname;
|
||
+ qCDebug(BLUETOOTH) << "Setting host: " << hostname;
|
||
|
||
// In this kio only the hostname (constHostname) is used
|
||
Q_UNUSED(port)
|
||
Q_UNUSED(user)
|
||
Q_UNUSED(pass)
|
||
|
||
- QString hostname = constHostname;
|
||
- hostname = hostname.replace(QLatin1Char('-'), QLatin1Char(':')).toUpper();
|
||
if (hostname.isEmpty()) {
|
||
m_hasCurrentHost = false;
|
||
} else {
|
||
m_hasCurrentHost = true;
|
||
- m_currentHostname = constHostname;
|
||
m_currentHostServices.clear();
|
||
+
|
||
+ m_currentHostname = hostname;
|
||
+ m_currentHostAddress = hostname.toUpper();
|
||
+ m_currentHostAddress.replace(QLatin1Char('-'), QLatin1Char(':'));
|
||
}
|
||
}
|
||
|
||
diff --git a/src/kio/bluetooth/kiobluetooth.h b/src/kio/bluetooth/kiobluetooth.h
|
||
index a353ca9..756bf92 100644
|
||
--- a/src/kio/bluetooth/kiobluetooth.h
|
||
+++ b/src/kio/bluetooth/kiobluetooth.h
|
||
@@ -36,13 +36,6 @@
|
||
*/
|
||
class KioBluetoothPrivate;
|
||
|
||
-namespace BlueDevil {
|
||
- class Device;
|
||
- class Adapter;
|
||
-}
|
||
-
|
||
-using namespace BlueDevil;
|
||
-
|
||
class KioBluetooth : public QObject, public KIO::SlaveBase
|
||
{
|
||
Q_OBJECT
|
||
@@ -62,7 +55,7 @@ public:
|
||
* get function shall not do much other than setting a mimetype and returning some data that
|
||
* could be useful for the mimetype handler.
|
||
*/
|
||
- void get(const QUrl &url);
|
||
+ void get(const QUrl &url) Q_DECL_OVERRIDE;
|
||
|
||
/**
|
||
* List current directory. There are two types of current directories in this kio:
|
||
@@ -72,16 +65,16 @@ public:
|
||
* 2. Remote device directory (something like bluetoth:/00_12_34_56_6d_34). This directory lists
|
||
* the services provided by the given remote device.
|
||
*/
|
||
- void listDir(const QUrl &url);
|
||
+ void listDir(const QUrl &url) Q_DECL_OVERRIDE;
|
||
|
||
- void stat(const QUrl &url);
|
||
+ void stat(const QUrl &url) Q_DECL_OVERRIDE;
|
||
|
||
/**
|
||
* As at the momento we don't handle more than one level url paths, @p setHost has not much
|
||
* difference with @p listDir
|
||
*
|
||
*/
|
||
- void setHost(const QString &constHostname, quint16 port, const QString &user, const QString &pass);
|
||
+ void setHost(const QString &hostname, quint16 port, const QString &user, const QString &pass) Q_DECL_OVERRIDE;
|
||
|
||
/**
|
||
* Returns a list of supported service names corresponding to the given uuids list. If an uuid is
|
||
@@ -104,7 +97,6 @@ public Q_SLOTS:
|
||
void listDevice(const DeviceInfo device);
|
||
|
||
private:
|
||
-
|
||
/**
|
||
* This is set to true when @p setHost is called to list a given remote device, like for example
|
||
* 00:2a:5E:8e:6e:f5. If listing the remote devices (bluetooth:/ uri), it's set back to false.
|
||
@@ -120,10 +112,9 @@ private:
|
||
QString m_currentHostname;
|
||
|
||
/**
|
||
- * Represents the current host when @p hasCurrentHost is set to true. This is set in
|
||
- * @p listRemoteDeviceServices function.
|
||
+ * Uppercase colon separated address (ex. 00:2A:5E:8E:6E:F5)
|
||
*/
|
||
- Device *m_currentHost;
|
||
+ QString m_currentHostAddress;
|
||
|
||
/**
|
||
* When @p hasCurrentHost to true, this list holds the list of service names provided by the
|
||
@@ -133,12 +124,6 @@ private:
|
||
|
||
/**
|
||
* This is an array containing as key the uuid and as value the name of the service that the
|
||
- * given uuid represents.
|
||
- */
|
||
- QMap<QString, QString> m_serviceNames;
|
||
-
|
||
- /**
|
||
- * This is an array containing as key the uuid and as value the name of the service that the
|
||
* given uuid represents, and a representative icon. It only contains the supported service names.
|
||
*/
|
||
QMap<QString, Service> m_supportedServices;
|
||
diff --git a/src/kio/obexftp/CMakeLists.txt b/src/kio/obexftp/CMakeLists.txt
|
||
index d50825b..a770238 100644
|
||
--- a/src/kio/obexftp/CMakeLists.txt
|
||
+++ b/src/kio/obexftp/CMakeLists.txt
|
||
@@ -1,5 +1,3 @@
|
||
-project(kio_obexftp)
|
||
-
|
||
add_subdirectory(daemon)
|
||
|
||
set(kio_obexftp_SRCS
|
||
diff --git a/src/kio/obexftp/daemon/CMakeLists.txt b/src/kio/obexftp/daemon/CMakeLists.txt
|
||
index b7ad5d2..8a4ff87 100644
|
||
--- a/src/kio/obexftp/daemon/CMakeLists.txt
|
||
+++ b/src/kio/obexftp/daemon/CMakeLists.txt
|
||
@@ -12,7 +12,7 @@ qt5_add_dbus_interface(kded_obexftp_SRCS org.freedesktop.DBus.ObjectManager.xml
|
||
|
||
add_library(kded_obexftpdaemon MODULE ${kded_obexftp_SRCS})
|
||
|
||
-kservice_desktop_to_json(kded_obexftpdaemon obexftpdaemon.desktop)
|
||
+kcoreaddons_desktop_to_json(kded_obexftpdaemon obexftpdaemon.desktop)
|
||
|
||
target_link_libraries(kded_obexftpdaemon
|
||
Qt5::Core
|
||
diff --git a/src/kio/obexftp/daemon/ObexFtpDaemon.cpp b/src/kio/obexftp/daemon/ObexFtpDaemon.cpp
|
||
index af66c7c..4170193 100644
|
||
--- a/src/kio/obexftp/daemon/ObexFtpDaemon.cpp
|
||
+++ b/src/kio/obexftp/daemon/ObexFtpDaemon.cpp
|
||
@@ -29,10 +29,6 @@
|
||
#include <KPluginFactory>
|
||
#include <KLocalizedString>
|
||
|
||
-#include <bluedevil/bluedevilmanager.h>
|
||
-#include <bluedevil/bluedeviladapter.h>
|
||
-
|
||
-using namespace BlueDevil;
|
||
K_PLUGIN_FACTORY_WITH_JSON(ObexFtpFactory,
|
||
"obexftpdaemon.json",
|
||
registerPlugin<ObexFtpDaemon>();)
|
||
@@ -58,8 +54,6 @@ ObexFtpDaemon::ObexFtpDaemon(QObject *parent, const QList<QVariant>&)
|
||
qDBusRegisterMetaType<DBusManagerStruct>();
|
||
qDBusRegisterMetaType<QVariantMapMap>();
|
||
|
||
- d->m_status = Private::Offline;
|
||
-
|
||
KAboutData aboutData(QStringLiteral("obexftpdaemon"),
|
||
i18n("ObexFtp Daemon"),
|
||
bluedevil_version,
|
||
@@ -70,13 +64,10 @@ ObexFtpDaemon::ObexFtpDaemon(QObject *parent, const QList<QVariant>&)
|
||
aboutData.addAuthor(i18n("Alejandro Fiestas Olivares"), i18n("Maintainer"),
|
||
QStringLiteral("afiestas@kde.org"), QStringLiteral("http://www.afiestas.org"));
|
||
|
||
- connect(Manager::self(), SIGNAL(usableAdapterChanged(Adapter*)),
|
||
- SLOT(usableAdapterChanged(Adapter*)));
|
||
-
|
||
+ d->m_status = Private::Offline;
|
||
d->m_interface = new OrgFreedesktopDBusObjectManagerInterface(QStringLiteral("org.bluez.obex"),
|
||
QStringLiteral("/"),
|
||
QDBusConnection::sessionBus(), this);
|
||
-
|
||
connect(d->m_interface, SIGNAL(InterfacesRemoved(QDBusObjectPath,QStringList)),
|
||
SLOT(interfaceRemoved(QDBusObjectPath,QStringList)));
|
||
|
||
@@ -84,11 +75,13 @@ ObexFtpDaemon::ObexFtpDaemon(QObject *parent, const QList<QVariant>&)
|
||
QDBusConnection::sessionBus(),
|
||
QDBusServiceWatcher::WatchForUnregistration, this);
|
||
|
||
- connect(d->m_serviceWatcher, SIGNAL(serviceUnregistered(QString)), SLOT(serviceUnregistered(QString)));
|
||
+ connect(d->m_serviceWatcher, SIGNAL(serviceRegistered(QString)), SLOT(serviceRegistered()));
|
||
+ connect(d->m_serviceWatcher, SIGNAL(serviceUnregistered(QString)), SLOT(serviceUnregistered()));
|
||
|
||
- //WARNING this blocks if org.bluez in system bus is dead
|
||
- if (Manager::self()->usableAdapter()) {
|
||
+ if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.bluez.obex"))) {
|
||
onlineMode();
|
||
+ } else {
|
||
+ offlineMode();
|
||
}
|
||
}
|
||
|
||
@@ -114,6 +107,7 @@ void ObexFtpDaemon::onlineMode()
|
||
void ObexFtpDaemon::offlineMode()
|
||
{
|
||
qCDebug(OBEXDAEMON) << "Offline mode";
|
||
+
|
||
if (d->m_status == Private::Offline) {
|
||
qCDebug(OBEXDAEMON) << "Already in offlineMode";
|
||
return;
|
||
@@ -125,33 +119,28 @@ void ObexFtpDaemon::offlineMode()
|
||
d->m_status = Private::Offline;
|
||
}
|
||
|
||
-void ObexFtpDaemon::usableAdapterChanged(Adapter *adapter)
|
||
+bool ObexFtpDaemon::isOnline()
|
||
{
|
||
- if (!adapter) {
|
||
- offlineMode();
|
||
- return;
|
||
- }
|
||
-
|
||
- onlineMode();
|
||
+ return d->m_status == Private::Online;
|
||
}
|
||
|
||
-QString ObexFtpDaemon::session(QString address, const QDBusMessage& msg)
|
||
+QString ObexFtpDaemon::session(const QString &address, const QString &target, const QDBusMessage& msg)
|
||
{
|
||
- qCDebug(OBEXDAEMON) << address;
|
||
- address.replace(QLatin1Char('-'), QLatin1Char(':'));
|
||
-
|
||
if (d->m_sessionMap.contains(address)) {
|
||
return d->m_sessionMap[address];
|
||
}
|
||
|
||
- //At this point we always want delayed reply
|
||
+ qCDebug(OBEXDAEMON) << "Creating session for" << address << "target" << target;
|
||
+
|
||
+ // At this point we always want delayed reply
|
||
msg.setDelayedReply(true);
|
||
+
|
||
if (d->m_wipSessions.contains(address)) {
|
||
d->m_wipSessions[address]->addMessage(msg);
|
||
return QString();
|
||
}
|
||
|
||
- CreateSessionJob *job = new CreateSessionJob(address, msg);
|
||
+ CreateSessionJob *job = new CreateSessionJob(address, target, msg);
|
||
connect(job, SIGNAL(finished(KJob*)), SLOT(sessionCreated(KJob*)));
|
||
job->start();
|
||
|
||
@@ -159,30 +148,46 @@ QString ObexFtpDaemon::session(QString address, const QDBusMessage& msg)
|
||
return QString();
|
||
}
|
||
|
||
+bool ObexFtpDaemon::cancelTransfer(const QString &transfer)
|
||
+{
|
||
+ // We need this function because kio_obexftp is not owner of the transfer,
|
||
+ // and thus cannot cancel it.
|
||
+
|
||
+ QDBusMessage call = QDBusMessage::createMethodCall(QStringLiteral("org.bluez.obex"),
|
||
+ transfer,
|
||
+ QStringLiteral("org.bluez.obex.Transfer1"),
|
||
+ QStringLiteral("Cancel"));
|
||
+
|
||
+ QDBusReply<void> reply = QDBusConnection::sessionBus().call(call);
|
||
+ return reply.isValid();
|
||
+}
|
||
+
|
||
void ObexFtpDaemon::sessionCreated(KJob* job)
|
||
{
|
||
CreateSessionJob* cJob = qobject_cast<CreateSessionJob*>(job);
|
||
qCDebug(OBEXDAEMON) << cJob->path();
|
||
|
||
d->m_wipSessions.remove(cJob->address());
|
||
- d->m_sessionMap.insert(cJob->address(), cJob->path());
|
||
- d->m_reverseSessionMap.insert(cJob->path(), cJob->address());
|
||
|
||
- const QList<QDBusMessage> messages = cJob->messages();
|
||
- Q_FOREACH(const QDBusMessage &msg, messages) {
|
||
+ Q_FOREACH (const QDBusMessage &msg, cJob->messages()) {
|
||
QDBusMessage reply = msg.createReply(cJob->path());
|
||
- QDBusConnection::sessionBus().asyncCall(reply);
|
||
+ QDBusConnection::sessionBus().send(reply);
|
||
+ }
|
||
+
|
||
+ if (!cJob->error()) {
|
||
+ d->m_sessionMap.insert(cJob->address(), cJob->path());
|
||
+ d->m_reverseSessionMap.insert(cJob->path(), cJob->address());
|
||
}
|
||
}
|
||
|
||
-void ObexFtpDaemon::serviceUnregistered(const QString& service)
|
||
+void ObexFtpDaemon::serviceRegistered()
|
||
{
|
||
- if (service != QLatin1String("org.bluez.obex")) {
|
||
- return;
|
||
- }
|
||
+ onlineMode();
|
||
+}
|
||
|
||
- d->m_sessionMap.clear();
|
||
- d->m_reverseSessionMap.clear();
|
||
+void ObexFtpDaemon::serviceUnregistered()
|
||
+{
|
||
+ offlineMode();
|
||
}
|
||
|
||
void ObexFtpDaemon::interfaceRemoved(const QDBusObjectPath &dbusPath, const QStringList& interfaces)
|
||
diff --git a/src/kio/obexftp/daemon/ObexFtpDaemon.h b/src/kio/obexftp/daemon/ObexFtpDaemon.h
|
||
index d56b73d..28c34ab 100644
|
||
--- a/src/kio/obexftp/daemon/ObexFtpDaemon.h
|
||
+++ b/src/kio/obexftp/daemon/ObexFtpDaemon.h
|
||
@@ -30,44 +30,28 @@ class QDBusMessage;
|
||
class QDBusObjectPath;
|
||
class QDBusPendingCallWatcher;
|
||
|
||
-namespace BlueDevil {
|
||
- class Adapter;
|
||
-};
|
||
-using namespace BlueDevil;
|
||
-
|
||
-class Q_DECL_EXPORT ObexFtpDaemon
|
||
- : public KDEDModule
|
||
+class Q_DECL_EXPORT ObexFtpDaemon : public KDEDModule
|
||
{
|
||
Q_OBJECT
|
||
Q_CLASSINFO("D-Bus Interface", "org.kde.ObexFtp")
|
||
|
||
public:
|
||
- /**
|
||
- * Connects to usableAdapterChanged
|
||
- */
|
||
ObexFtpDaemon(QObject *parent, const QList<QVariant>&);
|
||
virtual ~ObexFtpDaemon();
|
||
|
||
public Q_SLOTS:
|
||
- Q_SCRIPTABLE QString session(QString address, const QDBusMessage &msg);
|
||
+ Q_SCRIPTABLE bool isOnline();
|
||
+ Q_SCRIPTABLE QString session(const QString &address, const QString &target, const QDBusMessage &msg);
|
||
+ Q_SCRIPTABLE bool cancelTransfer(const QString &transfer);
|
||
|
||
private Q_SLOTS:
|
||
- void usableAdapterChanged(Adapter* adapter);
|
||
void sessionCreated(KJob* job);
|
||
- void serviceUnregistered(const QString &service);
|
||
+ void serviceRegistered();
|
||
+ void serviceUnregistered();
|
||
void interfaceRemoved(const QDBusObjectPath &path, const QStringList &interfaces);
|
||
|
||
private:
|
||
- /**
|
||
- * Called by constructor or eventually by adapterAdded initialize all the helpers
|
||
- * @see helpers
|
||
- */
|
||
- void onlineMode();
|
||
-
|
||
- /**
|
||
- * Called eventually adapterRemoved shutdown all the helpers
|
||
- * @see helpers
|
||
- */
|
||
+ void onlineMode();
|
||
void offlineMode();
|
||
|
||
struct Private;
|
||
diff --git a/src/kio/obexftp/daemon/createsessionjob.cpp b/src/kio/obexftp/daemon/createsessionjob.cpp
|
||
index 2eba356..c019156 100644
|
||
--- a/src/kio/obexftp/daemon/createsessionjob.cpp
|
||
+++ b/src/kio/obexftp/daemon/createsessionjob.cpp
|
||
@@ -24,9 +24,10 @@
|
||
#include <QDebug>
|
||
|
||
// class
|
||
-CreateSessionJob::CreateSessionJob(const QString& address, const QDBusMessage& msg, QObject* parent)
|
||
+CreateSessionJob::CreateSessionJob(const QString &address, const QString &target, const QDBusMessage &msg, QObject *parent)
|
||
: KJob(parent)
|
||
, m_address(address)
|
||
+ , m_target(target)
|
||
, m_client(0)
|
||
{
|
||
m_messages.append(msg);
|
||
@@ -52,7 +53,7 @@ void CreateSessionJob::addMessage(const QDBusMessage& msg)
|
||
m_messages.append(msg);
|
||
}
|
||
|
||
-const QList< QDBusMessage > CreateSessionJob::messages() const
|
||
+const QList<QDBusMessage> CreateSessionJob::messages() const
|
||
{
|
||
return m_messages;
|
||
}
|
||
@@ -61,8 +62,7 @@ void CreateSessionJob::createSession()
|
||
{
|
||
qCDebug(OBEXDAEMON);
|
||
QVariantMap args;
|
||
- args[QStringLiteral("Target")] = QStringLiteral("ftp");
|
||
-// args["Source"] = "00:02:72:D6:8F:2C";
|
||
+ args[QStringLiteral("Target")] = m_target;
|
||
m_client = new OrgBluezObexClient1Interface(QStringLiteral("org.bluez.obex"),
|
||
QStringLiteral("/org/bluez/obex"),
|
||
QDBusConnection::sessionBus(), this);
|
||
@@ -70,7 +70,6 @@ void CreateSessionJob::createSession()
|
||
QDBusPendingReply <QDBusObjectPath > reply = m_client->CreateSession(m_address, args);
|
||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply);
|
||
|
||
- qCDebug(OBEXDAEMON) << "DROGUES";
|
||
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(sessionCreated(QDBusPendingCallWatcher*)));
|
||
}
|
||
|
||
@@ -83,12 +82,7 @@ void CreateSessionJob::sessionCreated(QDBusPendingCallWatcher* watcher)
|
||
qCDebug(OBEXDAEMON) << "Error:";
|
||
qCDebug(OBEXDAEMON) << reply.error().name();
|
||
qCDebug(OBEXDAEMON) << reply.error().message();
|
||
-// Q_FOREACH(const QDBusMessage &msg, m_msgs) {
|
||
-// qCDebug(OBEXDAEMON) << msg.service() << msg.path();
|
||
-// QDBusMessage errorMsg = msg.createErrorReply("org.kde.kded.Error", i18n("Can't stablish connection"));
|
||
-// QDBusConnection::sessionBus().send(errorMsg);
|
||
-// }C
|
||
-// m_status = Error;
|
||
+
|
||
setError(reply.error().type());
|
||
setErrorText(reply.error().message());
|
||
emitResult();
|
||
diff --git a/src/kio/obexftp/daemon/createsessionjob.h b/src/kio/obexftp/daemon/createsessionjob.h
|
||
index a457b02..667384b 100644
|
||
--- a/src/kio/obexftp/daemon/createsessionjob.h
|
||
+++ b/src/kio/obexftp/daemon/createsessionjob.h
|
||
@@ -29,7 +29,7 @@ class CreateSessionJob : public KJob
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
- explicit CreateSessionJob(const QString &address, const QDBusMessage &msg, QObject* parent = 0);
|
||
+ explicit CreateSessionJob(const QString &address, const QString &target, const QDBusMessage &msg, QObject *parent = 0);
|
||
|
||
virtual void start();
|
||
QString path();
|
||
@@ -44,9 +44,10 @@ private Q_SLOTS:
|
||
private:
|
||
QString m_path;
|
||
QString m_address;
|
||
+ QString m_target;
|
||
QList<QDBusMessage> m_messages;
|
||
|
||
OrgBluezObexClient1Interface* m_client;
|
||
};
|
||
|
||
-#endif //CREATE_SESSION_JOB_H
|
||
\ No newline at end of file
|
||
+#endif //CREATE_SESSION_JOB_H
|
||
diff --git a/src/kio/obexftp/daemon/obexftpdaemon.desktop b/src/kio/obexftp/daemon/obexftpdaemon.desktop
|
||
index 07b7b2e..b23a6d1 100644
|
||
--- a/src/kio/obexftp/daemon/obexftpdaemon.desktop
|
||
+++ b/src/kio/obexftp/daemon/obexftpdaemon.desktop
|
||
@@ -9,16 +9,20 @@ X-KDE-Kded-load-on-demand=true
|
||
X-KDE-Kded-phase=1
|
||
|
||
Name=Bluetooth File Transfer
|
||
+Name[bs]=Transfer Bluetooth Daoteke
|
||
Name[ca]=Transferència de fitxer per Bluetooth
|
||
Name[cs]=Přenos souborů Bluetooth
|
||
Name[de]=Bluetooth-Dateiübertragung
|
||
+Name[el]=Μεταφορά αρχείων με Bluetooth
|
||
Name[en_GB]=Bluetooth File Transfer
|
||
-Name[es]=Transferencia de archivos por Bluetooth
|
||
+Name[es]=Transferencia de archivo por Bluetooth
|
||
+Name[et]=Bluetoothi failiedastus
|
||
Name[fi]=Bluetooth-tiedostonsiirto
|
||
Name[fr]=Transfert de fichiers Bluetooth
|
||
Name[it]=Trasferimento file via Bluetooth
|
||
Name[nb]=Blåtann filoverføring
|
||
Name[nl]=Bestandsoverdracht via bluetooth
|
||
+Name[pa]=ਬਲਿਊਟੁੱਥ ਫਾਇਲ ਟਰਾਂਸਫਰ
|
||
Name[pl]=Przesyłanie plików Bluetooth
|
||
Name[pt]=Transferência de Ficheiros por Bluetooth
|
||
Name[pt_BR]=Transferência de arquivos por Bluetooth
|
||
@@ -29,16 +33,21 @@ Name[sr@ijekavian]=Блутут пренос фајла
|
||
Name[sr@ijekavianlatin]=Bluetooth prenos fajla
|
||
Name[sr@latin]=Bluetooth prenos fajla
|
||
Name[sv]=Filöverföring med Blåtand
|
||
+Name[tr]=Bluetooth Dosya Aktarımı
|
||
Name[uk]=Перенесення файла за допомогою Bluetooth
|
||
Name[x-test]=xxBluetooth File Transferxx
|
||
Name[zh_CN]=蓝牙文件传输
|
||
+Name[zh_TW]=藍牙檔案傳輸
|
||
|
||
Comment=Supports Bluetooth file transfer using ObexFTP
|
||
+Comment[bs]=Podržava Blutut prijenos datoteka koristeći ObexFTP
|
||
Comment[ca]=Accepta transferència de fitxer per Bluetooth usant ObexFTP
|
||
Comment[cs]=Podporuje přenos souborů Bluetooth použitím ObexFTP
|
||
Comment[de]=Unterstützt Bluetooth-Datenübertragung mittels ObexFTP
|
||
+Comment[el]=Υποστηρίζει μεταφορά αρχείων με Bluetooth με χρήση ObexFTP
|
||
Comment[en_GB]=Supports Bluetooth file transfer using ObexFTP
|
||
-Comment[es]=Permite la transferencia de archivos por Bluetooth usando ObexFTP
|
||
+Comment[es]=Permite transferencias de archivos por Bluetooth usando ObexFTP
|
||
+Comment[et]=Bluetoothi failiedastuse toetamine ObexFTP vahendusel
|
||
Comment[fi]=Tukee Bluetooth-tiedostonsiirtoa ObexFTP:tä käyttäen
|
||
Comment[fr]=Prend en charge le transfert de fichiers Bluetooth à l'aide de « ObexFTP »
|
||
Comment[it]=Supporta i trasferimenti di file Bluetooth usando ObexFTP
|
||
@@ -54,6 +63,8 @@ Comment[sr@ijekavian]=Подршка за блутут преносе фајло
|
||
Comment[sr@ijekavianlatin]=Podrška za bluetooth prenose fajlova pomoću ObexFTP‑a
|
||
Comment[sr@latin]=Podrška za bluetooth prenose fajlova pomoću ObexFTP‑a
|
||
Comment[sv]=Stöder filöverföringar för Blåtand med ObexFTP
|
||
+Comment[tr]=ObexFTP kullanarak Bluetooth dosya transferlerini destekler
|
||
Comment[uk]=Підтримує перенесення файлів Bluetooth за допомогою ObexFTP
|
||
Comment[x-test]=xxSupports Bluetooth file transfer using ObexFTPxx
|
||
Comment[zh_CN]=支持使用 ObexFTP 进行蓝牙文件传输
|
||
+Comment[zh_TW]=使用 ObexFTP 支援藍牙檔案傳輸
|
||
diff --git a/src/kio/obexftp/kded_obexftp.xml b/src/kio/obexftp/kded_obexftp.xml
|
||
index 24c6c5c..06e3b14 100644
|
||
--- a/src/kio/obexftp/kded_obexftp.xml
|
||
+++ b/src/kio/obexftp/kded_obexftp.xml
|
||
@@ -3,9 +3,17 @@
|
||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||
<node>
|
||
<interface name="org.kde.ObexFtp">
|
||
+ <method name="isOnline">
|
||
+ <arg name="online" type="b" direction="out"/>
|
||
+ </method>
|
||
<method name="session">
|
||
<arg name="address" type="s" direction="in"/>
|
||
+ <arg name="target" type="s" direction="in"/>
|
||
<arg name="sessionPath" type="s" direction="out"/>
|
||
</method>
|
||
+ <method name="cancelTransfer">
|
||
+ <arg name="transfer" type="s" direction="in"/>
|
||
+ <arg name="success" type="b" direction="out"/>
|
||
+ </method>
|
||
</interface>
|
||
-</node>
|
||
\ No newline at end of file
|
||
+</node>
|
||
diff --git a/src/kio/obexftp/kio_obexftp.cpp b/src/kio/obexftp/kio_obexftp.cpp
|
||
index b5b93d8..17eefec 100644
|
||
--- a/src/kio/obexftp/kio_obexftp.cpp
|
||
+++ b/src/kio/obexftp/kio_obexftp.cpp
|
||
@@ -61,16 +61,21 @@ static QString urlFileName(const QUrl &url)
|
||
return u.fileName();
|
||
}
|
||
|
||
+static bool urlIsRoot(const QUrl &url)
|
||
+{
|
||
+ const QString &directory = urlDirectory(url);
|
||
+ return (directory.isEmpty() || directory == QLatin1String("/")) && urlFileName(url).isEmpty();
|
||
+}
|
||
+
|
||
KioFtp::KioFtp(const QByteArray &pool, const QByteArray &app)
|
||
: SlaveBase(QByteArrayLiteral("obexftp"), pool, app)
|
||
- , m_settingHost(false)
|
||
, m_transfer(0)
|
||
{
|
||
- qDBusRegisterMetaType<QVariantMapList>();
|
||
-
|
||
m_timer = new QTimer();
|
||
m_timer->setInterval(100);
|
||
|
||
+ qDBusRegisterMetaType<DeviceInfo>();
|
||
+ qDBusRegisterMetaType<QVariantMapList>();
|
||
m_kded = new org::kde::ObexFtp(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/obexftpdaemon"),
|
||
QDBusConnection::sessionBus(), 0);
|
||
}
|
||
@@ -88,6 +93,63 @@ void KioFtp::launchProgressBar()
|
||
m_timer->start();
|
||
}
|
||
|
||
+void KioFtp::connectToHost()
|
||
+{
|
||
+ // Prefer pcsuite target on S60 devices
|
||
+ if (m_uuids.contains(QLatin1String("00005005-0000-1000-8000-0002EE000001"))) {
|
||
+ if (createSession("pcsuite")) {
|
||
+ return;
|
||
+ }
|
||
+ // Fallback to ftp
|
||
+ }
|
||
+
|
||
+ createSession("ftp");
|
||
+}
|
||
+
|
||
+bool KioFtp::testConnection()
|
||
+{
|
||
+ if (!m_kded->isOnline().value()) {
|
||
+ error(KIO::ERR_SLAVE_DEFINED, i18n("Obexd service is not running."));
|
||
+ return false;
|
||
+ }
|
||
+
|
||
+ connectToHost();
|
||
+
|
||
+ if (!m_transfer) {
|
||
+ error(KIO::ERR_COULD_NOT_CONNECT, m_host);
|
||
+ return false;
|
||
+ }
|
||
+ return true;
|
||
+}
|
||
+
|
||
+bool KioFtp::createSession(const QString &target)
|
||
+{
|
||
+ QDBusPendingReply<QString> reply = m_kded->session(m_host, target);
|
||
+ reply.waitForFinished();
|
||
+
|
||
+ const QString &sessionPath = reply.value();
|
||
+
|
||
+ if (reply.isError() || sessionPath.isEmpty()) {
|
||
+ qCDebug(OBEXFTP) << reply.error().message();
|
||
+ qCDebug(OBEXFTP) << reply.error().name();
|
||
+
|
||
+ delete m_transfer;
|
||
+ m_transfer = 0;
|
||
+ m_sessionPath.clear();
|
||
+ return false;
|
||
+ }
|
||
+
|
||
+ if (m_sessionPath != sessionPath) {
|
||
+ m_statMap.clear();
|
||
+ delete m_transfer;
|
||
+ m_transfer = new org::bluez::obex::FileTransfer1(QStringLiteral("org.bluez.obex"), sessionPath, QDBusConnection::sessionBus());
|
||
+ m_sessionPath = sessionPath;
|
||
+ }
|
||
+
|
||
+ return true;
|
||
+}
|
||
+
|
||
+
|
||
void KioFtp::updateProcess()
|
||
{
|
||
if (m_counter == 49) {
|
||
@@ -102,34 +164,27 @@ void KioFtp::updateProcess()
|
||
|
||
void KioFtp::listDir(const QUrl &url)
|
||
{
|
||
+ if (!testConnection()) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
qCDebug(OBEXFTP) << "listdir: " << url;
|
||
|
||
infoMessage(i18n("Retrieving information from remote device..."));
|
||
|
||
- qCDebug(OBEXFTP) << "Asking for listFolder";
|
||
-
|
||
- //TODO: Check if changeFolder fails
|
||
- m_transfer->ChangeFolder(url.path()).waitForFinished();
|
||
+ qCDebug(OBEXFTP) << "Asking for listFolder" << url.path();
|
||
|
||
- QDBusPendingReply <QVariantMapList > reply = m_transfer->ListFolder();
|
||
- reply.waitForFinished();
|
||
-
|
||
- if (reply.isError()) {
|
||
- qCDebug(OBEXFTP) << reply.error().message();
|
||
- error(KIO::ERR_SLAVE_DEFINED, i18n("Bluetooth is not enabled"));
|
||
+ if (!changeFolder(url.path())) {
|
||
return;
|
||
}
|
||
- QVariantMapList folderList = reply.value();
|
||
- Q_FOREACH(const QVariantMap folder, folderList) {
|
||
- KIO::UDSEntry entry = entryFromInfo(folder);
|
||
|
||
- QUrl statUrl = url.adjusted(QUrl::RemoveFilename);
|
||
- statUrl.setPath(statUrl.path() + folder[QStringLiteral("Name")].toString());
|
||
- if (!m_statMap.contains(statUrl.toDisplayString())) {
|
||
- qCDebug(OBEXFTP) << "Stat: " << statUrl.toDisplayString() << entry.numberValue(KIO::UDSEntry::UDS_SIZE);
|
||
- m_statMap.insert(statUrl.toDisplayString(), entry);
|
||
- }
|
||
+ bool ok;
|
||
+ const QList<KIO::UDSEntry> &list = listFolder(url, &ok);
|
||
+ if (!ok) {
|
||
+ return;
|
||
+ }
|
||
|
||
+ Q_FOREACH (const KIO::UDSEntry &entry, list) {
|
||
listEntry(entry);
|
||
}
|
||
|
||
@@ -141,10 +196,13 @@ void KioFtp::copy(const QUrl &src, const QUrl &dest, int permissions, KIO::JobFl
|
||
Q_UNUSED(permissions)
|
||
Q_UNUSED(flags)
|
||
|
||
+ if (!testConnection()) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
qCDebug(OBEXFTP) << "copy: " << src.url() << " to " << dest.url();
|
||
|
||
copyHelper(src, dest);
|
||
-
|
||
finished();
|
||
}
|
||
|
||
@@ -154,11 +212,15 @@ void KioFtp::rename(const QUrl& src, const QUrl& dest, KIO::JobFlags flags)
|
||
Q_UNUSED(dest)
|
||
Q_UNUSED(flags)
|
||
|
||
- error(KIO::ERR_UNSUPPORTED_ACTION, src.toDisplayString());
|
||
+ error(KIO::ERR_UNSUPPORTED_ACTION, QString());
|
||
}
|
||
|
||
void KioFtp::get(const QUrl& url)
|
||
{
|
||
+ if (!testConnection()) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
QTemporaryFile tempFile(QString(QStringLiteral("%1/kioftp_XXXXXX.%2")).arg(QDir::tempPath(), urlFileName(url)));
|
||
tempFile.open();//Create the file
|
||
qCDebug(OBEXFTP) << tempFile.fileName();
|
||
@@ -180,6 +242,10 @@ void KioFtp::get(const QUrl& url)
|
||
finished();
|
||
}
|
||
|
||
+bool KioFtp::cancelTransfer(const QString &transfer)
|
||
+{
|
||
+ return m_kded->cancelTransfer(transfer);
|
||
+}
|
||
|
||
void KioFtp::setHost(const QString &host, quint16 port, const QString &user, const QString &pass)
|
||
{
|
||
@@ -187,35 +253,38 @@ void KioFtp::setHost(const QString &host, quint16 port, const QString &user, con
|
||
Q_UNUSED(user)
|
||
Q_UNUSED(pass)
|
||
|
||
- infoMessage(i18n("Connecting to the device"));
|
||
+ m_host = host;
|
||
+ m_host = m_host.replace(QLatin1Char('-'), QLatin1Char(':')).toUpper();
|
||
|
||
- qCDebug(OBEXFTP) << "setHost: " << host;
|
||
+ QDBusMessage call = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kded5"),
|
||
+ QStringLiteral("/modules/bluedevil"),
|
||
+ QStringLiteral("org.kde.BlueDevil"),
|
||
+ QStringLiteral("device"));
|
||
+ call << m_host;
|
||
+ QDBusReply<DeviceInfo> reply = QDBusConnection::sessionBus().call(call);
|
||
+ DeviceInfo info = reply.value();
|
||
|
||
- qCDebug(OBEXFTP) << "Waiting to stablish the connection 2";
|
||
- QDBusPendingReply <QString > reply = m_kded->session(host);
|
||
- reply.waitForFinished();
|
||
+ m_uuids = info[QStringLiteral("UUIDs")];
|
||
|
||
- qCDebug(OBEXFTP) << "AFTER" << reply.isError();
|
||
- if (reply.isError()) {
|
||
- qCDebug(OBEXFTP) << reply.error().message();
|
||
- qCDebug(OBEXFTP) << reply.error().name();
|
||
- }
|
||
-
|
||
- qCDebug(OBEXFTP) << "Got a path" << reply.value();
|
||
+ infoMessage(i18n("Connecting to the device"));
|
||
|
||
- m_address = host;
|
||
- m_sessionPath = reply.value();
|
||
- m_transfer = new org::bluez::obex::FileTransfer1("org.bluez.obex", m_sessionPath, QDBusConnection::sessionBus());
|
||
- m_statMap.clear();
|
||
+ connectToHost();
|
||
}
|
||
|
||
void KioFtp::del(const QUrl& url, bool isfile)
|
||
{
|
||
Q_UNUSED(isfile)
|
||
|
||
- qCDebug(OBEXFTP) << "Del: " << url.url();
|
||
- m_transfer->ChangeFolder(urlDirectory(url)).waitForFinished();
|
||
- m_transfer->Delete(urlFileName(url)).waitForFinished();
|
||
+ if (!testConnection()) {
|
||
+ return;
|
||
+ }
|
||
+ if (!changeFolder(urlDirectory(url))) {
|
||
+ return;
|
||
+ }
|
||
+ if (!deleteFile(urlFileName(url))) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
finished();
|
||
}
|
||
|
||
@@ -223,14 +292,28 @@ void KioFtp::mkdir(const QUrl& url, int permissions)
|
||
{
|
||
Q_UNUSED(permissions)
|
||
|
||
+ if (!testConnection()) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
qCDebug(OBEXFTP) << "MkDir: " << url.url();
|
||
- m_transfer->ChangeFolder(urlDirectory(url)).waitForFinished();
|
||
- m_transfer->CreateFolder(urlFileName(url)).waitForFinished();
|
||
+
|
||
+ if (!changeFolder(urlDirectory(url))) {
|
||
+ return;
|
||
+ }
|
||
+ if (!createFolder(urlFileName(url))) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
finished();
|
||
}
|
||
|
||
void KioFtp::stat(const QUrl &url)
|
||
{
|
||
+ if (!testConnection()) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
qCDebug(OBEXFTP) << "Stat: " << url.url();
|
||
qCDebug(OBEXFTP) << "Stat Dir: " << urlDirectory(url);
|
||
qCDebug(OBEXFTP) << "Stat File: " << urlFileName(url);
|
||
@@ -245,8 +328,7 @@ void KioFtp::stat(const QUrl &url)
|
||
void KioFtp::copyHelper(const QUrl& src, const QUrl& dest)
|
||
{
|
||
if (src.scheme() == QLatin1String("obexftp") && dest.scheme() == QLatin1String("obexftp")) {
|
||
- error(KIO::ERR_UNSUPPORTED_ACTION, src.toDisplayString());
|
||
- //TODO: with obexd this seems possible, we should at least try
|
||
+ copyWithinObexftp(src, dest);
|
||
return;
|
||
}
|
||
|
||
@@ -261,55 +343,49 @@ void KioFtp::copyHelper(const QUrl& src, const QUrl& dest)
|
||
}
|
||
|
||
qCDebug(OBEXFTP) << "This shouldn't happen...";
|
||
- finished();
|
||
}
|
||
|
||
-void KioFtp::copyFromObexftp(const QUrl& src, const QUrl& dest)
|
||
+void KioFtp::copyWithinObexftp(const QUrl &src, const QUrl &dest)
|
||
{
|
||
qCDebug(OBEXFTP) << "Source: " << src << "Dest:" << dest;
|
||
|
||
- //Just in case the url is not in the stat, some times happens...
|
||
- if (!m_statMap.contains(src.toDisplayString())) {
|
||
- qCDebug(OBEXFTP) << "The url is not in the cache, stating it";
|
||
- statHelper(src);
|
||
- }
|
||
+ copyFile(src.path(), dest.path());
|
||
+}
|
||
+
|
||
+void KioFtp::copyFromObexftp(const QUrl& src, const QUrl& dest)
|
||
+{
|
||
+ qCDebug(OBEXFTP) << "Source: " << src << "Dest:" << dest;
|
||
|
||
- if (m_statMap.value(src.toDisplayString()).isDir()) {
|
||
- qCDebug(OBEXFTP) << "Skipping to copy: " << src.toDisplayString();
|
||
- //TODO: Check if dir copying works with obexd
|
||
- error(KIO::ERR_IS_DIRECTORY, src.toDisplayString());
|
||
+ if (!changeFolder(urlDirectory(src))) {
|
||
return;
|
||
}
|
||
|
||
- qCDebug(OBEXFTP) << "Changing dir:" << urlDirectory(src);
|
||
- m_transfer->ChangeFolder(urlDirectory(src)).waitForFinished();
|
||
-
|
||
- QString dbusPath = m_transfer->GetFile(dest.path(), urlFileName(src)).value().path();
|
||
+ const QString &dbusPath = m_transfer->GetFile(dest.path(), urlFileName(src)).value().path();
|
||
qCDebug(OBEXFTP) << "Path from GetFile:" << dbusPath;
|
||
|
||
int size = m_statMap[src.toDisplayString()].numberValue(KIO::UDSEntry::UDS_SIZE);
|
||
+ totalSize(size);
|
||
+
|
||
TransferFileJob *getFile = new TransferFileJob(dbusPath, this);
|
||
- getFile->setSize(size);
|
||
getFile->exec();
|
||
-
|
||
- finished();
|
||
}
|
||
|
||
void KioFtp::copyToObexftp(const QUrl& src, const QUrl& dest)
|
||
{
|
||
qCDebug(OBEXFTP) << "Source:" << src << "Dest:" << dest;
|
||
|
||
- qCDebug(OBEXFTP) << "Changing folder: " << urlDirectory(dest);
|
||
- m_transfer->ChangeFolder(urlDirectory(dest));
|
||
- QString dbusPath = m_transfer->PutFile(src.path(), urlFileName(dest)).value().path();
|
||
+ if (!changeFolder(urlDirectory(dest))) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
+ const QString &dbusPath = m_transfer->PutFile(src.path(), urlFileName(dest)).value().path();
|
||
qCDebug(OBEXFTP) << "Path from PutFile: " << dbusPath;
|
||
|
||
- QFile file(src.path());
|
||
+ int size = QFile(src.path()).size();
|
||
+ totalSize(size);
|
||
+
|
||
TransferFileJob *putFile = new TransferFileJob(dbusPath, this);
|
||
- putFile->setSize(file.size());
|
||
putFile->exec();
|
||
-
|
||
- finished();
|
||
}
|
||
|
||
void KioFtp::statHelper(const QUrl& url)
|
||
@@ -322,10 +398,10 @@ void KioFtp::statHelper(const QUrl& url)
|
||
return;
|
||
}
|
||
|
||
- if ((urlDirectory(url) == QLatin1String("/") || urlDirectory(url).isEmpty()) && urlFileName(url).isEmpty()) {
|
||
+ if (urlIsRoot(url)) {
|
||
qCDebug(OBEXFTP) << "Url is root";
|
||
KIO::UDSEntry entry;
|
||
- entry.insert(KIO::UDSEntry::UDS_NAME, QString::fromLatin1("/"));
|
||
+ entry.insert(KIO::UDSEntry::UDS_NAME, QStringLiteral("/"));
|
||
entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
|
||
entry.insert(KIO::UDSEntry::UDS_ACCESS, 0700);
|
||
entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
|
||
@@ -333,53 +409,145 @@ void KioFtp::statHelper(const QUrl& url)
|
||
qCDebug(OBEXFTP) << "Adding stat cached: " << url.toDisplayString();
|
||
m_statMap[url.toDisplayString()] = entry;
|
||
statEntry(entry);
|
||
-
|
||
return;
|
||
}
|
||
|
||
qCDebug(OBEXFTP) << "statMap does NOT contains the url";
|
||
- //TODO: Check if changeFolder fails
|
||
- m_transfer->ChangeFolder(urlDirectory(url)).waitForFinished();
|
||
- QVariantMapList folderList = m_transfer->ListFolder().value();
|
||
- qCDebug(OBEXFTP) << urlDirectory(url) << folderList.count();
|
||
- Q_FOREACH(const QVariantMap folder, folderList) {
|
||
- KIO::UDSEntry entry = entryFromInfo(folder);
|
||
-
|
||
- QString fileName = folder[QStringLiteral("Name")].toString();
|
||
- if (urlFileName(url) == fileName) {
|
||
- statEntry(entry);
|
||
+
|
||
+ if (!changeFolder(urlDirectory(url))) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
+ bool ok;
|
||
+ const QList<KIO::UDSEntry> &list = listFolder(url, &ok);
|
||
+ if (!ok) {
|
||
+ return;
|
||
+ }
|
||
+
|
||
+ Q_FOREACH (const KIO::UDSEntry &entry, list) {
|
||
+ statEntry(entry);
|
||
+ }
|
||
+
|
||
+ qCDebug(OBEXFTP) << "Finished";
|
||
+}
|
||
+
|
||
+QList<KIO::UDSEntry> KioFtp::listFolder(const QUrl &url, bool *ok)
|
||
+{
|
||
+ QList<KIO::UDSEntry> list;
|
||
+
|
||
+ QDBusPendingReply<QVariantMapList> reply = m_transfer->ListFolder();
|
||
+ reply.waitForFinished();
|
||
+
|
||
+ if (reply.isError()) {
|
||
+ error(KIO::ERR_CANNOT_OPEN_FOR_READING, urlDirectory(url));
|
||
+ *ok = false;
|
||
+ return list;
|
||
+ }
|
||
+
|
||
+ Q_FOREACH (const QVariantMap &item, reply.value()) {
|
||
+ KIO::UDSEntry entry;
|
||
+ entry.insert(KIO::UDSEntry::UDS_NAME, item[QStringLiteral("Name")].toString());
|
||
+ entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, item[QStringLiteral("Label")].toString());
|
||
+ entry.insert(KIO::UDSEntry::UDS_ACCESS, 0700);
|
||
+ entry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, QDateTime::fromString(item[QStringLiteral("Modified")].toString(), "yyyyMMddThhmmssZ").toTime_t());
|
||
+ entry.insert(KIO::UDSEntry::UDS_SIZE, item[QStringLiteral("Size")].toLongLong());
|
||
+ if (item[QStringLiteral("Type")] == QLatin1String("folder")) {
|
||
+ entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
|
||
+ entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
|
||
+ } else {
|
||
+ entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
|
||
+ }
|
||
+ if (urlIsRoot(url)) {
|
||
+ updateRootEntryIcon(entry, item[QStringLiteral("Mem-type")].toString());
|
||
}
|
||
+ list.append(entry);
|
||
|
||
//Most probably the client of the kio will stat each file
|
||
//so since we are on it, let's cache all of them.
|
||
QUrl statUrl = url.adjusted(QUrl::RemoveFilename);
|
||
- statUrl.setPath(statUrl.path() + fileName);
|
||
+ statUrl.setPath(statUrl.path() + item[QStringLiteral("Name")].toString());
|
||
if (!m_statMap.contains(statUrl.toDisplayString())) {
|
||
qCDebug(OBEXFTP) << "Stat: " << statUrl.toDisplayString() << entry.stringValue(KIO::UDSEntry::UDS_NAME) << entry.numberValue(KIO::UDSEntry::UDS_SIZE);
|
||
m_statMap.insert(statUrl.toDisplayString(), entry);
|
||
}
|
||
}
|
||
|
||
- qCDebug(OBEXFTP) << "Finished";
|
||
+ *ok = true;
|
||
+ return list;
|
||
}
|
||
|
||
-KIO::UDSEntry KioFtp::entryFromInfo(const QVariantMap& info)
|
||
+bool KioFtp::changeFolder(const QString &folder)
|
||
{
|
||
- qCDebug(OBEXFTP) << info;
|
||
+ QDBusPendingReply<> reply = m_transfer->ChangeFolder(folder);
|
||
+ reply.waitForFinished();
|
||
+
|
||
+ if (reply.isError()) {
|
||
+ error(KIO::ERR_CANNOT_ENTER_DIRECTORY, folder);
|
||
+ return false;
|
||
+ }
|
||
+ return true;
|
||
+}
|
||
|
||
- KIO::UDSEntry entry;
|
||
- entry.insert(KIO::UDSEntry::UDS_NAME, info[QStringLiteral("Name")].toString());
|
||
- entry.insert(KIO::UDSEntry::UDS_CREATION_TIME, info[QStringLiteral("Created")].toString());
|
||
- entry.insert(KIO::UDSEntry::UDS_ACCESS, 0700);
|
||
- entry.insert(KIO::UDSEntry::UDS_MODIFICATION_TIME, info[QStringLiteral("Modified")].toString());
|
||
+bool KioFtp::createFolder(const QString &folder)
|
||
+{
|
||
+ QDBusPendingReply<> reply = m_transfer->CreateFolder(folder);
|
||
+ reply.waitForFinished();
|
||
|
||
- if (info[QStringLiteral("Type")].toString() == QLatin1String("folder")) {
|
||
- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
|
||
- entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, QStringLiteral("inode/directory"));
|
||
- } else {
|
||
- entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG);
|
||
- entry.insert(KIO::UDSEntry::UDS_SIZE, info[QStringLiteral("Size")].toLongLong());
|
||
+ if (reply.isError()) {
|
||
+ error(KIO::ERR_COULD_NOT_MKDIR, folder);
|
||
+ return false;
|
||
}
|
||
+ return true;
|
||
+}
|
||
|
||
- return entry;
|
||
+bool KioFtp::copyFile(const QString &src, const QString &dest)
|
||
+{
|
||
+ QDBusPendingReply<> reply = m_transfer->CopyFile(src, dest);
|
||
+ reply.waitForFinished();
|
||
+
|
||
+ if (reply.isError()) {
|
||
+ qCDebug(OBEXFTP) << reply.error().message();
|
||
+ // Copying files within obexftp is currently not implemented in obexd
|
||
+ if (reply.error().message() == QLatin1String("Not Implemented")) {
|
||
+ error(KIO::ERR_UNSUPPORTED_ACTION, src);
|
||
+ } else {
|
||
+ error(KIO::ERR_COULD_NOT_WRITE, src);
|
||
+ }
|
||
+ return false;
|
||
+ }
|
||
+ return true;
|
||
+}
|
||
+
|
||
+bool KioFtp::deleteFile(const QString &file)
|
||
+{
|
||
+ QDBusPendingReply<> reply = m_transfer->Delete(file);
|
||
+ reply.waitForFinished();
|
||
+
|
||
+ if (reply.isError()) {
|
||
+ error(KIO::ERR_CANNOT_DELETE, file);
|
||
+ return false;
|
||
+ }
|
||
+ return true;
|
||
+}
|
||
+
|
||
+void KioFtp::updateRootEntryIcon(KIO::UDSEntry &entry, const QString &memoryType)
|
||
+{
|
||
+ const QString &path = entry.stringValue(KIO::UDSEntry::UDS_NAME);
|
||
+
|
||
+ // Nokia (mount-points are C: D: E: ...)
|
||
+ if (path.size() == 2 && path.at(1) == QLatin1Char(':')) {
|
||
+ if (memoryType.startsWith(QLatin1String("DEV"))) {
|
||
+ entry.insert(KIO::UDSEntry::UDS_ICON_NAME, QStringLiteral("drive-removable-media"));
|
||
+ } else if (memoryType == QLatin1String("MMC")) {
|
||
+ entry.insert(KIO::UDSEntry::UDS_ICON_NAME, QStringLiteral("media-flash-sd-mmc"));
|
||
+ }
|
||
+ }
|
||
+ // Android
|
||
+ if (entry.stringValue(KIO::UDSEntry::UDS_NAME) == QLatin1String("PHONE_MEMORY")) {
|
||
+ entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, i18n("Phone memory"));
|
||
+ entry.insert(KIO::UDSEntry::UDS_ICON_NAME, QStringLiteral("smartphone"));
|
||
+ } else if (entry.stringValue(KIO::UDSEntry::UDS_NAME) == QLatin1String("EXTERNAL_MEMORY")) {
|
||
+ entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME, i18n("External memory"));
|
||
+ entry.insert(KIO::UDSEntry::UDS_ICON_NAME, QStringLiteral("media-flash-sd-mmc"));
|
||
+ }
|
||
}
|
||
diff --git a/src/kio/obexftp/kio_obexftp.h b/src/kio/obexftp/kio_obexftp.h
|
||
index 3215fda..eefda10 100644
|
||
--- a/src/kio/obexftp/kio_obexftp.h
|
||
+++ b/src/kio/obexftp/kio_obexftp.h
|
||
@@ -29,6 +29,8 @@
|
||
|
||
#include <kio/slavebase.h>
|
||
|
||
+typedef QMap<QString, QString> DeviceInfo;
|
||
+
|
||
class OrgBluezObexFileTransfer1Interface;
|
||
class KioFtp
|
||
: public QObject
|
||
@@ -49,26 +51,39 @@ public:
|
||
virtual void rename(const QUrl& src, const QUrl& dest, KIO::JobFlags flags);
|
||
virtual void get(const QUrl& url);
|
||
|
||
+ bool cancelTransfer(const QString &transfer);
|
||
+
|
||
private Q_SLOTS:
|
||
void updateProcess();
|
||
|
||
- KIO::UDSEntry entryFromInfo(const QVariantMap &info);
|
||
+private:
|
||
void copyHelper(const QUrl &src, const QUrl &dest);
|
||
+ void copyWithinObexftp(const QUrl &src, const QUrl &dest);
|
||
void copyFromObexftp(const QUrl &src, const QUrl &dest);
|
||
void copyToObexftp(const QUrl &src, const QUrl &dest);
|
||
void statHelper(const QUrl &url);
|
||
+
|
||
+ QList<KIO::UDSEntry> listFolder(const QUrl &url, bool *ok);
|
||
+ bool changeFolder(const QString &folder);
|
||
+ bool createFolder(const QString &folder);
|
||
+ bool copyFile(const QString &src, const QString &dest);
|
||
+ bool deleteFile(const QString &file);
|
||
+
|
||
+ void updateRootEntryIcon(KIO::UDSEntry &entry, const QString &memoryType);
|
||
void launchProgressBar();
|
||
+ void connectToHost();
|
||
+ bool testConnection();
|
||
+ bool createSession(const QString &target);
|
||
|
||
private:
|
||
- int m_counter;
|
||
- bool m_settingHost;
|
||
+ int m_counter;
|
||
QMap<QString, KIO::UDSEntry> m_statMap;
|
||
- QString m_address;
|
||
- QString m_sessionPath;
|
||
- QTimer *m_timer;
|
||
- org::kde::ObexFtp *m_kded;
|
||
+ QString m_host;
|
||
+ QString m_uuids;
|
||
+ QString m_sessionPath;
|
||
+ QTimer *m_timer;
|
||
+ org::kde::ObexFtp *m_kded;
|
||
OrgBluezObexFileTransfer1Interface *m_transfer;
|
||
-
|
||
};
|
||
|
||
#endif // KIO_OBEXFTP_H
|
||
diff --git a/src/kio/obexftp/transferfilejob.cpp b/src/kio/obexftp/transferfilejob.cpp
|
||
index b6267e3..9a06534 100644
|
||
--- a/src/kio/obexftp/transferfilejob.cpp
|
||
+++ b/src/kio/obexftp/transferfilejob.cpp
|
||
@@ -35,7 +35,6 @@ TransferFileJob::TransferFileJob(const QString& path, KioFtp* parent)
|
||
, m_speedBytes(0)
|
||
, m_parent(parent)
|
||
{
|
||
-
|
||
}
|
||
|
||
TransferFileJob::~TransferFileJob()
|
||
@@ -51,16 +50,7 @@ void TransferFileJob::start()
|
||
|
||
bool TransferFileJob::doKill()
|
||
{
|
||
- QDBusPendingReply <void > reply = m_transfer->Cancel();
|
||
- reply.waitForFinished();
|
||
-
|
||
- return !reply.isError();
|
||
-}
|
||
-
|
||
-void TransferFileJob::setSize(int size)
|
||
-{
|
||
- qCDebug(OBEXFTP) << size;
|
||
- m_parent->totalSize(size);
|
||
+ return m_parent->cancelTransfer(m_path);
|
||
}
|
||
|
||
void TransferFileJob::createObjects()
|
||
@@ -98,7 +88,6 @@ void TransferFileJob::statusChanged(const QVariant& value)
|
||
m_time = QTime::currentTime();
|
||
return;
|
||
} else if (status == QLatin1String("complete")) {
|
||
- m_parent->finished();
|
||
emitResult();
|
||
return;
|
||
} else if (status == QLatin1String("error")) {
|
||
@@ -115,7 +104,7 @@ void TransferFileJob::transferChanged(const QVariant& value)
|
||
qCDebug(OBEXFTP) << "Transferred: " << value;
|
||
if (m_parent->wasKilled()) {
|
||
qCDebug(OBEXFTP) << "Kio was killed, aborting task";
|
||
- m_transfer->Cancel().waitForFinished();
|
||
+ doKill();
|
||
emitResult();
|
||
return;
|
||
}
|
||
diff --git a/src/kio/obexftp/transferfilejob.h b/src/kio/obexftp/transferfilejob.h
|
||
index d82cd30..d594359 100644
|
||
--- a/src/kio/obexftp/transferfilejob.h
|
||
+++ b/src/kio/obexftp/transferfilejob.h
|
||
@@ -39,7 +39,6 @@ public:
|
||
|
||
virtual ~TransferFileJob();
|
||
|
||
- void setSize(int size);
|
||
private Q_SLOTS:
|
||
void createObjects();
|
||
void propertiesChanged(const QString &interface , const QVariantMap &properties , const QStringList &invalidProps);
|
||
@@ -56,4 +55,4 @@ private:
|
||
|
||
};
|
||
|
||
-#endif //KIO_GET_FILE_JOB_H
|
||
\ No newline at end of file
|
||
+#endif //KIO_GET_FILE_JOB_H
|
||
diff --git a/src/monolithic/CMakeLists.txt b/src/monolithic/CMakeLists.txt
|
||
index f39964e..685e30f 100644
|
||
--- a/src/monolithic/CMakeLists.txt
|
||
+++ b/src/monolithic/CMakeLists.txt
|
||
@@ -17,4 +17,4 @@ target_link_libraries(bluedevil-monolithic
|
||
${LibBlueDevil_LIBRARIES})
|
||
|
||
install(TARGETS bluedevil-monolithic ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||
-install(FILES bluedevil-monolithic.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
||
+install(FILES org.kde.bluedevilmonolithic.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
||
diff --git a/src/monolithic/bluedevil-monolithic.desktop b/src/monolithic/bluedevil-monolithic.desktop
|
||
deleted file mode 100644
|
||
index 3911e87..0000000
|
||
--- a/src/monolithic/bluedevil-monolithic.desktop
|
||
+++ /dev/null
|
||
@@ -1,79 +0,0 @@
|
||
-[Desktop Entry]
|
||
-Type=Application
|
||
-Version=1.0
|
||
-Name=BlueDevil
|
||
-Name[ca]=BlueDevil
|
||
-Name[cs]=BlueDevil
|
||
-Name[de]=BlueDevil
|
||
-Name[en_GB]=BlueDevil
|
||
-Name[es]=BlueDevil
|
||
-Name[fi]=BlueDevil
|
||
-Name[fr]=BlueDevil
|
||
-Name[it]=BlueDevil
|
||
-Name[nb]=BlueDevil
|
||
-Name[nl]=BlueDevil
|
||
-Name[pl]=BlueDevil
|
||
-Name[pt]=BlueDevil
|
||
-Name[pt_BR]=BlueDevil
|
||
-Name[sk]=BlueDevil
|
||
-Name[sl]=BlueDevil
|
||
-Name[sr]=Блудевил
|
||
-Name[sr@ijekavian]=Блудевил
|
||
-Name[sr@ijekavianlatin]=BlueDevil
|
||
-Name[sr@latin]=BlueDevil
|
||
-Name[sv]=Blådjävul
|
||
-Name[uk]=BlueDevil
|
||
-Name[x-test]=xxBlueDevilxx
|
||
-Name[zh_CN]=BlueDevil
|
||
-GenericName=BlueDevil
|
||
-GenericName[ca]=BlueDevil
|
||
-GenericName[cs]=BlueDevil
|
||
-GenericName[de]=BlueDevil
|
||
-GenericName[en_GB]=BlueDevil
|
||
-GenericName[es]=BlueDevil
|
||
-GenericName[fi]=BlueDevil
|
||
-GenericName[fr]=BlueDevil
|
||
-GenericName[it]=BlueDevil
|
||
-GenericName[nb]=BlueDevil
|
||
-GenericName[nl]=BlueDevil
|
||
-GenericName[pl]=BlueDevil
|
||
-GenericName[pt]=BlueDevil
|
||
-GenericName[pt_BR]=BlueDevil
|
||
-GenericName[sk]=BlueDevil
|
||
-GenericName[sl]=BlueDevil
|
||
-GenericName[sr]=Блудевил
|
||
-GenericName[sr@ijekavian]=Блудевил
|
||
-GenericName[sr@ijekavianlatin]=BlueDevil
|
||
-GenericName[sr@latin]=BlueDevil
|
||
-GenericName[sv]=Blådjävul
|
||
-GenericName[uk]=BlueDevil
|
||
-GenericName[x-test]=xxBlueDevilxx
|
||
-GenericName[zh_CN]=BlueDevil
|
||
-Exec=bluedevil-monolithic
|
||
-Comment=KDE Bluetooth support
|
||
-Comment[ca]=Implementació Bluetooth del KDE
|
||
-Comment[cs]=Podpora Bluetooth v KDE
|
||
-Comment[de]=KDE-Bluetooth-Unterstützung
|
||
-Comment[en_GB]=KDE Bluetooth support
|
||
-Comment[es]=Implementación Bluetooth para KDE
|
||
-Comment[fi]=KDE:n Bluetooth-tuki
|
||
-Comment[fr]=Prise en charge de Bluetooth pour KDE
|
||
-Comment[it]=Supporto Bluetooth per KDE
|
||
-Comment[nb]=KDE Blåtann-støtte
|
||
-Comment[nl]=KDE Bluetooth ondersteuning
|
||
-Comment[pl]=Obsługa Bluetooth w KDE
|
||
-Comment[pt]=Suporte para Bluetooth no KDE
|
||
-Comment[pt_BR]=Suporte para Bluetooth do KDE
|
||
-Comment[sk]=Podpora Bluetooth KDE
|
||
-Comment[sl]=KDE-jeva podpora za Bluetooth
|
||
-Comment[sr]=Подршка блутута у КДЕ‑у
|
||
-Comment[sr@ijekavian]=Подршка блутута у КДЕ‑у
|
||
-Comment[sr@ijekavianlatin]=Podrška Bluetootha u KDE‑u
|
||
-Comment[sr@latin]=Podrška Bluetootha u KDE‑u
|
||
-Comment[sv]=KDE:s Blåtandstöd
|
||
-Comment[uk]=Підтримка Bluetooth у KDE
|
||
-Comment[x-test]=xxKDE Bluetooth supportxx
|
||
-Comment[zh_CN]=KDE 蓝牙支持
|
||
-Icon=preferences-system-bluetooth
|
||
-Terminal=false
|
||
-Categories=Qt;KDE;X-Bluetooth;Network;
|
||
diff --git a/src/monolithic/main.cpp b/src/monolithic/main.cpp
|
||
index ae560a7..13ae42e 100644
|
||
--- a/src/monolithic/main.cpp
|
||
+++ b/src/monolithic/main.cpp
|
||
@@ -42,11 +42,11 @@ int main(int argc, char *argv[])
|
||
QStringLiteral("ereslibre@kde.org"), QStringLiteral("http://www.ereslibre.es/"));
|
||
|
||
QApplication app(argc, argv);
|
||
- app.setApplicationName(QStringLiteral("bluedevilmonolithic"));
|
||
- app.setApplicationVersion(bluedevil_version);
|
||
- app.setOrganizationDomain(QStringLiteral("kde.org"));
|
||
app.setQuitOnLastWindowClosed(false);
|
||
|
||
+ KAboutData::setApplicationData(aboutData);
|
||
+ KDBusService service(KDBusService::Unique);
|
||
+
|
||
QCommandLineParser parser;
|
||
parser.setApplicationDescription(i18n("Bluetooth"));
|
||
parser.addVersionOption();
|
||
@@ -54,7 +54,6 @@ int main(int argc, char *argv[])
|
||
|
||
parser.process(app);
|
||
|
||
- KDBusService service(KDBusService::Unique);
|
||
Monolithic monolithic;
|
||
|
||
return app.exec();
|
||
diff --git a/src/monolithic/monolithic.cpp b/src/monolithic/monolithic.cpp
|
||
index 5480752..fb6a23c 100644
|
||
--- a/src/monolithic/monolithic.cpp
|
||
+++ b/src/monolithic/monolithic.cpp
|
||
@@ -47,7 +47,7 @@ Monolithic::Monolithic(QObject* parent)
|
||
|
||
offlineMode();
|
||
|
||
- if (!Manager::self()->adapters().isEmpty()) {
|
||
+ if (Manager::self()->usableAdapter()) {
|
||
onlineMode();
|
||
}
|
||
|
||
@@ -58,7 +58,6 @@ Monolithic::Monolithic(QObject* parent)
|
||
setStandardActionsEnabled(false);
|
||
setAssociatedWidget(contextMenu());
|
||
|
||
- setStatus(KStatusNotifierItem::Active);
|
||
poweredChanged();
|
||
}
|
||
|
||
@@ -175,9 +174,11 @@ void Monolithic::regenerateDeviceEntries()
|
||
//Shortcut configuration actions, mainly checkables for discovering and powering
|
||
menu->addSeparator();
|
||
|
||
+ Adapter *usableAdapter = Manager::self()->usableAdapter();
|
||
+
|
||
QAction *discoverable = new QAction(i18n("Discoverable"), menu);
|
||
discoverable->setCheckable(true);
|
||
- discoverable->setChecked(Manager::self()->usableAdapter()->isDiscoverable());
|
||
+ discoverable->setChecked(usableAdapter && usableAdapter->isDiscoverable());
|
||
connect(discoverable, SIGNAL(toggled(bool)), this, SLOT(activeDiscoverable(bool)));
|
||
menu->addAction(discoverable);
|
||
|
||
@@ -219,6 +220,8 @@ void Monolithic::setupDevice(Device *device)
|
||
|
||
void Monolithic::onlineMode()
|
||
{
|
||
+ setStatus(Active);
|
||
+
|
||
QList<Adapter*> adapters = Manager::self()->adapters();
|
||
Q_FOREACH(Adapter *adapter, adapters) {
|
||
connect(adapter, SIGNAL(deviceFound(Device*)), SLOT(deviceCreated(Device*)));
|
||
@@ -350,6 +353,7 @@ void Monolithic::deviceCreated(Device *device)
|
||
|
||
void Monolithic::offlineMode()
|
||
{
|
||
+ setStatus(Passive);
|
||
setTooltipTitleStatus(false);
|
||
|
||
QMenu *const menu = contextMenu();
|
||
diff --git a/src/monolithic/monolithic.h b/src/monolithic/monolithic.h
|
||
index 00baf1b..cb13cad 100644
|
||
--- a/src/monolithic/monolithic.h
|
||
+++ b/src/monolithic/monolithic.h
|
||
@@ -22,7 +22,8 @@
|
||
|
||
#include <kstatusnotifieritem.h>
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Adapter;
|
||
class Device;
|
||
}
|
||
@@ -31,8 +32,7 @@ class QAction;
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-class Monolithic
|
||
- : public KStatusNotifierItem
|
||
+class Monolithic : public KStatusNotifierItem
|
||
{
|
||
|
||
Q_OBJECT
|
||
diff --git a/src/monolithic/org.kde.bluedevilmonolithic.desktop b/src/monolithic/org.kde.bluedevilmonolithic.desktop
|
||
new file mode 100644
|
||
index 0000000..f4572ef
|
||
--- /dev/null
|
||
+++ b/src/monolithic/org.kde.bluedevilmonolithic.desktop
|
||
@@ -0,0 +1,98 @@
|
||
+[Desktop Entry]
|
||
+Name=BlueDevil
|
||
+Name[bs]=BlueDevil
|
||
+Name[ca]=BlueDevil
|
||
+Name[cs]=BlueDevil
|
||
+Name[de]=BlueDevil
|
||
+Name[el]=BlueDevil
|
||
+Name[en_GB]=BlueDevil
|
||
+Name[es]=BlueDevil
|
||
+Name[fi]=BlueDevil
|
||
+Name[fr]=BlueDevil
|
||
+Name[it]=BlueDevil
|
||
+Name[ja]=BlueDevil
|
||
+Name[nb]=BlueDevil
|
||
+Name[nl]=BlueDevil
|
||
+Name[pl]=BlueDevil
|
||
+Name[pt]=BlueDevil
|
||
+Name[pt_BR]=BlueDevil
|
||
+Name[sk]=BlueDevil
|
||
+Name[sl]=BlueDevil
|
||
+Name[sr]=Блудевил
|
||
+Name[sr@ijekavian]=Блудевил
|
||
+Name[sr@ijekavianlatin]=BlueDevil
|
||
+Name[sr@latin]=BlueDevil
|
||
+Name[sv]=Blådjävul
|
||
+Name[tr]=BlueDevil
|
||
+Name[uk]=BlueDevil
|
||
+Name[x-test]=xxBlueDevilxx
|
||
+Name[zh_CN]=BlueDevil
|
||
+Name[zh_TW]=BlueDevil
|
||
+GenericName=BlueDevil
|
||
+GenericName[bs]=BlueDevil
|
||
+GenericName[ca]=BlueDevil
|
||
+GenericName[cs]=BlueDevil
|
||
+GenericName[de]=BlueDevil
|
||
+GenericName[el]=BlueDevil
|
||
+GenericName[en_GB]=BlueDevil
|
||
+GenericName[es]=BlueDevil
|
||
+GenericName[fi]=BlueDevil
|
||
+GenericName[fr]=BlueDevil
|
||
+GenericName[it]=BlueDevil
|
||
+GenericName[ja]=BlueDevil
|
||
+GenericName[nb]=BlueDevil
|
||
+GenericName[nl]=BlueDevil
|
||
+GenericName[pa]=BlueDevil
|
||
+GenericName[pl]=BlueDevil
|
||
+GenericName[pt]=BlueDevil
|
||
+GenericName[pt_BR]=BlueDevil
|
||
+GenericName[sk]=BlueDevil
|
||
+GenericName[sl]=BlueDevil
|
||
+GenericName[sr]=Блудевил
|
||
+GenericName[sr@ijekavian]=Блудевил
|
||
+GenericName[sr@ijekavianlatin]=BlueDevil
|
||
+GenericName[sr@latin]=BlueDevil
|
||
+GenericName[sv]=Blådjävul
|
||
+GenericName[tr]=BlueDevil
|
||
+GenericName[uk]=BlueDevil
|
||
+GenericName[x-test]=xxBlueDevilxx
|
||
+GenericName[zh_CN]=BlueDevil
|
||
+GenericName[zh_TW]=BlueDevil
|
||
+Comment=KDE Bluetooth support
|
||
+Comment[bs]=Podrška blututa u KDE‑u
|
||
+Comment[ca]=Implementació Bluetooth del KDE
|
||
+Comment[cs]=Podpora Bluetooth v KDE
|
||
+Comment[de]=KDE-Bluetooth-Unterstützung
|
||
+Comment[el]=Υποστήριξη Bluetooth στο KDE
|
||
+Comment[en_GB]=KDE Bluetooth support
|
||
+Comment[es]=Implementación Bluetooth para KDE
|
||
+Comment[fi]=KDE:n Bluetooth-tuki
|
||
+Comment[fr]=Prise en charge de Bluetooth pour KDE
|
||
+Comment[it]=Supporto Bluetooth per KDE
|
||
+Comment[ja]=KDE Bluetooth サポート
|
||
+Comment[nb]=KDE Blåtann-støtte
|
||
+Comment[nl]=KDE Bluetooth ondersteuning
|
||
+Comment[pa]=KDE ਬਲਿਊਟੁੱਥ ਸਹਿਯੋਗ
|
||
+Comment[pl]=Obsługa Bluetooth w KDE
|
||
+Comment[pt]=Suporte para Bluetooth no KDE
|
||
+Comment[pt_BR]=Suporte para Bluetooth do KDE
|
||
+Comment[sk]=Podpora Bluetooth KDE
|
||
+Comment[sl]=KDE-jeva podpora za Bluetooth
|
||
+Comment[sr]=Подршка блутута у КДЕ‑у
|
||
+Comment[sr@ijekavian]=Подршка блутута у КДЕ‑у
|
||
+Comment[sr@ijekavianlatin]=Podrška Bluetootha u KDE‑u
|
||
+Comment[sr@latin]=Podrška Bluetootha u KDE‑u
|
||
+Comment[sv]=KDE:s Blåtandstöd
|
||
+Comment[tr]=KDE Bluetooth desteği
|
||
+Comment[uk]=Підтримка Bluetooth у KDE
|
||
+Comment[x-test]=xxKDE Bluetooth supportxx
|
||
+Comment[zh_CN]=KDE 蓝牙支持
|
||
+Comment[zh_TW]=KDE 藍牙支援
|
||
+
|
||
+Type=Application
|
||
+Exec=bluedevil-monolithic
|
||
+Icon=preferences-system-bluetooth
|
||
+Terminal=false
|
||
+Categories=Qt;KDE;X-Bluetooth;Network;
|
||
+X-DBUS-StartupType=Unique
|
||
+X-DBUS-ServiceName=org.kde.bluedevilmonolithic
|
||
diff --git a/src/sendfile/CMakeLists.txt b/src/sendfile/CMakeLists.txt
|
||
index 9004cbe..c0ea4c7 100644
|
||
--- a/src/sendfile/CMakeLists.txt
|
||
+++ b/src/sendfile/CMakeLists.txt
|
||
@@ -32,10 +32,11 @@ target_link_libraries(bluedevil-sendfile
|
||
Qt5::DBus
|
||
KF5::I18n
|
||
KF5::CoreAddons
|
||
+ KF5::DBusAddons
|
||
KF5::IconThemes
|
||
KF5::KIOFileWidgets
|
||
${LibBlueDevil_LIBRARIES}
|
||
)
|
||
|
||
install(TARGETS bluedevil-sendfile DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||
-install(FILES bluedevil-sendfile.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
||
+install(FILES org.kde.bluedevilsendfile.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
||
diff --git a/src/sendfile/bluedevil-sendfile.desktop b/src/sendfile/bluedevil-sendfile.desktop
|
||
deleted file mode 100644
|
||
index 4e7169e..0000000
|
||
--- a/src/sendfile/bluedevil-sendfile.desktop
|
||
+++ /dev/null
|
||
@@ -1,81 +0,0 @@
|
||
-[Desktop Entry]
|
||
-Type=Application
|
||
-Version=1.0
|
||
-Name=BlueDevil Send File
|
||
-Name[ca]=Envia fitxer amb BlueDevil
|
||
-Name[cs]=Posílání souborů BlueDevil
|
||
-Name[de]=BlueDevil-Dateiversand
|
||
-Name[en_GB]=BlueDevil Send File
|
||
-Name[es]=Enviar archivo con BlueDevil
|
||
-Name[fi]=BlueDevil-tiedostonlähetys
|
||
-Name[fr]=Envoi de fichiers par BlueDevil
|
||
-Name[it]=Invio file di BlueDevil
|
||
-Name[nb]=BlueDevil send fil
|
||
-Name[nl]=BlueDevil bestand verzenden
|
||
-Name[pl]=Wysłanie pliku BlueDevil
|
||
-Name[pt]=Envio de Ficheiro do Bluetooth
|
||
-Name[pt_BR]=Envio de arquivo do BlueDevil
|
||
-Name[sk]=Posielanie súborov BlueDevil
|
||
-Name[sl]=BlueDevil – pošiljanje datotek
|
||
-Name[sr]=Блудевилово слање фајла
|
||
-Name[sr@ijekavian]=Блудевилово слање фајла
|
||
-Name[sr@ijekavianlatin]=BlueDevilovo slanje fajla
|
||
-Name[sr@latin]=BlueDevilovo slanje fajla
|
||
-Name[sv]=Blådjävul skicka fil
|
||
-Name[uk]=Надсилання файла BlueDevil
|
||
-Name[x-test]=xxBlueDevil Send Filexx
|
||
-Name[zh_CN]=BlueDevil 发送文件
|
||
-GenericName=BlueDevil Send File
|
||
-GenericName[ca]=Envia fitxers amb BlueDevil
|
||
-GenericName[cs]=Posílání souborů BlueDevil
|
||
-GenericName[de]=BlueDevil-Dateiversand
|
||
-GenericName[en_GB]=BlueDevil Send File
|
||
-GenericName[es]=Enviar archivo con BlueDevil
|
||
-GenericName[fi]=BlueDevil-tiedostonlähetys
|
||
-GenericName[fr]=Envoi de fichiers par BlueDevil
|
||
-GenericName[it]=Invio file di BlueDevil
|
||
-GenericName[nb]=BlueDevil send fil
|
||
-GenericName[nl]=BlueDevil bestand verzenden
|
||
-GenericName[pl]=Wysłanie pliku BlueDevil
|
||
-GenericName[pt]=Envio de Ficheiro do Bluetooth
|
||
-GenericName[pt_BR]=Envio de arquivo do BlueDevil
|
||
-GenericName[sk]=Posielanie súborov BlueDevil
|
||
-GenericName[sl]=BlueDevil – pošiljanje datotek
|
||
-GenericName[sr]=Блудевилово слање фајла
|
||
-GenericName[sr@ijekavian]=Блудевилово слање фајла
|
||
-GenericName[sr@ijekavianlatin]=BlueDevilovo slanje fajla
|
||
-GenericName[sr@latin]=BlueDevilovo slanje fajla
|
||
-GenericName[sv]=Blådjävul skicka fil
|
||
-GenericName[uk]=Надсилання файла BlueDevil
|
||
-GenericName[x-test]=xxBlueDevil Send Filexx
|
||
-GenericName[zh_CN]=BlueDevil 发送文件
|
||
-MimeType=application/vnd.kde.bluedevil-sendfile;
|
||
-Exec=bluedevil-sendfile -k%U
|
||
-Comment=BlueDevil Send File
|
||
-Comment[ca]=Envia fitxers amb BlueDevil
|
||
-Comment[cs]=Posílání souborů BlueDevil
|
||
-Comment[de]=BlueDevil-Dateiversand
|
||
-Comment[en_GB]=BlueDevil Send File
|
||
-Comment[es]=Enviar archivo con BlueDevil
|
||
-Comment[fi]=BlueDevil-tiedostonlähetys
|
||
-Comment[fr]=Envoi de fichiers par BlueDevil
|
||
-Comment[it]=Invio file di BlueDevil
|
||
-Comment[nb]=BlueDevil send fil
|
||
-Comment[nl]=BlueDevil bestand verzenden
|
||
-Comment[pl]=Wysłanie pliku BlueDevil
|
||
-Comment[pt]=Envio de Ficheiro do Bluetooth
|
||
-Comment[pt_BR]=Envio de arquivo do BlueDevil
|
||
-Comment[sk]=Posielanie súborov BlueDevil
|
||
-Comment[sl]=BlueDevil – pošiljanje datotek
|
||
-Comment[sr]=Блудевилово слање фајла
|
||
-Comment[sr@ijekavian]=Блудевилово слање фајла
|
||
-Comment[sr@ijekavianlatin]=BlueDevilovo slanje fajla
|
||
-Comment[sr@latin]=BlueDevilovo slanje fajla
|
||
-Comment[sv]=Blådjävul skicka fil
|
||
-Comment[uk]=Надсилання файла BlueDevil
|
||
-Comment[x-test]=xxBlueDevil Send Filexx
|
||
-Comment[zh_CN]=BlueDevil 发送文件
|
||
-Icon=preferences-system-bluetooth
|
||
-Terminal=false
|
||
-Categories=Qt;KDE;X-Bluetooth;Network;
|
||
-NoDisplay=true
|
||
diff --git a/src/sendfile/discoverwidget.cpp b/src/sendfile/discoverwidget.cpp
|
||
index 903da16..4cb5af9 100644
|
||
--- a/src/sendfile/discoverwidget.cpp
|
||
+++ b/src/sendfile/discoverwidget.cpp
|
||
@@ -20,9 +20,9 @@
|
||
* Boston, MA 02110-1301, USA. *
|
||
*****************************************************************************/
|
||
|
||
-
|
||
#include "discoverwidget.h"
|
||
#include "ui_discover.h"
|
||
+#include "debug_p.h"
|
||
|
||
#include <QListWidgetItem>
|
||
#include <QListView>
|
||
@@ -35,28 +35,23 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-DiscoverWidget::DiscoverWidget(QWidget* parent) : QWidget(parent)
|
||
+DiscoverWidget::DiscoverWidget(QWidget* parent)
|
||
+ : QWidget(parent)
|
||
{
|
||
setupUi(this);
|
||
|
||
- connect(deviceList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this,
|
||
- SLOT(itemSelected(QListWidgetItem*)));
|
||
- connect(Manager::self()->usableAdapter(), SIGNAL(deviceFound(Device*)), this,
|
||
- SLOT(deviceFound(Device*)));
|
||
+ connect(deviceList, &QListWidget::currentItemChanged, this, &DiscoverWidget::itemSelected);
|
||
+ connect(Manager::self()->usableAdapter(), &Adapter::deviceFound, this, &DiscoverWidget::deviceFound);
|
||
|
||
startScan();
|
||
}
|
||
|
||
-DiscoverWidget::~DiscoverWidget()
|
||
-{
|
||
-}
|
||
-
|
||
void DiscoverWidget::startScan()
|
||
{
|
||
deviceList->clear();
|
||
stopScan();
|
||
|
||
- QList <Device *> knownDevices = Manager::self()->usableAdapter()->devices();
|
||
+ QList<Device*> knownDevices = Manager::self()->usableAdapter()->devices();
|
||
Q_FOREACH(Device *device, knownDevices) {
|
||
if (device->UUIDs().contains(QLatin1String("00001105-0000-1000-8000-00805F9B34FB"), Qt::CaseInsensitive)) {
|
||
deviceFound(device);
|
||
@@ -72,27 +67,19 @@ void DiscoverWidget::stopScan()
|
||
}
|
||
}
|
||
|
||
-void DiscoverWidget::deviceFound(const QVariantMap& deviceInfo)
|
||
-{
|
||
- deviceFoundGeneric(deviceInfo[QStringLiteral("Address")].toString(),
|
||
- deviceInfo[QStringLiteral("Name")].toString(),
|
||
- deviceInfo[QStringLiteral("Icon")].toString(),
|
||
- deviceInfo[QStringLiteral("Alias")].toString());
|
||
-}
|
||
-
|
||
-void DiscoverWidget::deviceFound(Device* device)
|
||
+void DiscoverWidget::deviceFound(Device *device)
|
||
{
|
||
deviceFoundGeneric(device->address(), device->name(), device->icon(), device->alias());
|
||
}
|
||
|
||
void DiscoverWidget::deviceFoundGeneric(QString address, QString name, QString icon, QString alias)
|
||
{
|
||
- qDebug() << "========================";
|
||
- qDebug() << "Address: " << address;
|
||
- qDebug() << "Name: " << name;
|
||
- qDebug() << "Alias: " << alias;
|
||
- qDebug() << "Icon: " << icon;
|
||
- qDebug() << "\n";
|
||
+ qCDebug(SENDFILE) << "========================";
|
||
+ qCDebug(SENDFILE) << "Address: " << address;
|
||
+ qCDebug(SENDFILE) << "Name: " << name;
|
||
+ qCDebug(SENDFILE) << "Alias: " << alias;
|
||
+ qCDebug(SENDFILE) << "Icon: " << icon;
|
||
+ qCDebug(SENDFILE) << "\n";
|
||
|
||
|
||
bool origName = false;
|
||
@@ -101,7 +88,7 @@ void DiscoverWidget::deviceFoundGeneric(QString address, QString name, QString i
|
||
}
|
||
|
||
if (!alias.isEmpty() && alias != name && !name.isEmpty()) {
|
||
- name = QString("%1 (%2)").arg(alias).arg(name);
|
||
+ name = QString(QStringLiteral("%1 (%2)")).arg(alias).arg(name);
|
||
}
|
||
|
||
if (name.isEmpty()) {
|
||
@@ -131,7 +118,7 @@ void DiscoverWidget::deviceFoundGeneric(QString address, QString name, QString i
|
||
m_itemRelation.insert(address, item);
|
||
}
|
||
|
||
-void DiscoverWidget::itemSelected(QListWidgetItem* item)
|
||
+void DiscoverWidget::itemSelected(QListWidgetItem *item)
|
||
{
|
||
emit deviceSelected(Manager::self()->usableAdapter()->deviceForAddress(item->data(Qt::UserRole).toString()));
|
||
}
|
||
diff --git a/src/sendfile/discoverwidget.h b/src/sendfile/discoverwidget.h
|
||
index d1cc03b..3516c61 100644
|
||
--- a/src/sendfile/discoverwidget.h
|
||
+++ b/src/sendfile/discoverwidget.h
|
||
@@ -20,7 +20,6 @@
|
||
* Boston, MA 02110-1301, USA. *
|
||
*****************************************************************************/
|
||
|
||
-
|
||
#ifndef DISCOVERWIDGET_H
|
||
#define DISCOVERWIDGET_H
|
||
|
||
@@ -31,28 +30,26 @@
|
||
class QTimer;
|
||
class BlueWizard;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
}
|
||
-using namespace BlueDevil;
|
||
|
||
-class DiscoverWidget : public QWidget
|
||
-, public Ui::Discover
|
||
+class DiscoverWidget : public QWidget, public Ui::Discover
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- DiscoverWidget(QWidget* parent = 0);
|
||
- virtual ~DiscoverWidget();
|
||
+ explicit DiscoverWidget(QWidget *parent = 0);
|
||
+
|
||
void stopScan();
|
||
|
||
public Q_SLOTS:
|
||
void startScan();
|
||
|
||
private Q_SLOTS:
|
||
- void deviceFound(const QVariantMap &deviceInfo);
|
||
- void deviceFound(Device* device);
|
||
- void itemSelected(QListWidgetItem* item);
|
||
+ void deviceFound(BlueDevil::Device *device);
|
||
+ void itemSelected(QListWidgetItem *item);
|
||
|
||
private:
|
||
void deviceFoundGeneric(QString address, QString name, QString icon, QString alias);
|
||
@@ -62,7 +59,7 @@ private:
|
||
BlueWizard *m_wizard;
|
||
|
||
Q_SIGNALS:
|
||
- void deviceSelected(Device *device);
|
||
+ void deviceSelected(BlueDevil::Device *device);
|
||
};
|
||
|
||
#endif // DISCOVERWIDGET_H
|
||
diff --git a/src/sendfile/main.cpp b/src/sendfile/main.cpp
|
||
index 1b1bb8b..4f593d3 100644
|
||
--- a/src/sendfile/main.cpp
|
||
+++ b/src/sendfile/main.cpp
|
||
@@ -25,6 +25,7 @@
|
||
#include <QCommandLineOption>
|
||
|
||
#include <KAboutData>
|
||
+#include <KDBusService>
|
||
#include <KLocalizedString>
|
||
|
||
#include <bluedevil/bluedevil.h>
|
||
@@ -44,13 +45,12 @@ int main(int argc, char *argv[])
|
||
QStringLiteral("afiestas@kde.org"), QStringLiteral("http://www.afiestas.org/"));
|
||
|
||
QApplication app(argc, argv);
|
||
- app.setApplicationName(QStringLiteral("bluedevilsendfile"));
|
||
- app.setApplicationVersion(bluedevil_version);
|
||
- app.setApplicationDisplayName(i18n("Bluetooth Send File Helper"));
|
||
- app.setOrganizationDomain(QStringLiteral("kde.org"));
|
||
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")));
|
||
app.setQuitOnLastWindowClosed(false);
|
||
|
||
+ KAboutData::setApplicationData(aboutData);
|
||
+ KDBusService service;
|
||
+
|
||
QCommandLineOption kioOption({QLatin1String("kio"), QLatin1String("k")}, i18n("Device UUID where the files will be sent"));
|
||
kioOption.setValueName(QStringLiteral("bluetooth://mac"));
|
||
|
||
@@ -75,8 +75,12 @@ int main(int argc, char *argv[])
|
||
deviceInfo = parser.value(kioOption);
|
||
}
|
||
|
||
- SendFileWizard *sendFileWizard = new SendFileWizard(deviceInfo, parser.values(filesOption));
|
||
- sendFileWizard->show();
|
||
+ SendFileWizard *wizard = new SendFileWizard(deviceInfo, parser.values(filesOption));
|
||
+ wizard->show();
|
||
+
|
||
+ QObject::connect(&service, &KDBusService::activateRequested, wizard, [wizard]() {
|
||
+ wizard->setWindowState((wizard->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||
+ });
|
||
|
||
return app.exec();
|
||
}
|
||
diff --git a/src/sendfile/org.kde.bluedevilsendfile.desktop b/src/sendfile/org.kde.bluedevilsendfile.desktop
|
||
new file mode 100644
|
||
index 0000000..d976633
|
||
--- /dev/null
|
||
+++ b/src/sendfile/org.kde.bluedevilsendfile.desktop
|
||
@@ -0,0 +1,94 @@
|
||
+[Desktop Entry]
|
||
+Name=BlueDevil Send File
|
||
+Name[bs]=Bludevilovo slanje datoteke
|
||
+Name[ca]=Envia fitxer amb BlueDevil
|
||
+Name[cs]=Posílání souborů BlueDevil
|
||
+Name[de]=BlueDevil-Dateiversand
|
||
+Name[el]=Αποστολή αρχείου μέσω BlueDevil
|
||
+Name[en_GB]=BlueDevil Send File
|
||
+Name[es]=Enviar archivo con BlueDevil
|
||
+Name[fi]=BlueDevil-tiedostonlähetys
|
||
+Name[fr]=Envoi de fichiers par BlueDevil
|
||
+Name[it]=Invio file di BlueDevil
|
||
+Name[nb]=BlueDevil send fil
|
||
+Name[nl]=BlueDevil bestand verzenden
|
||
+Name[pl]=Wysłanie pliku BlueDevil
|
||
+Name[pt]=Envio de Ficheiro do Bluetooth
|
||
+Name[pt_BR]=Envio de arquivo do BlueDevil
|
||
+Name[sk]=Posielanie súborov BlueDevil
|
||
+Name[sl]=BlueDevil – pošiljanje datotek
|
||
+Name[sr]=Блудевилово слање фајла
|
||
+Name[sr@ijekavian]=Блудевилово слање фајла
|
||
+Name[sr@ijekavianlatin]=BlueDevilovo slanje fajla
|
||
+Name[sr@latin]=BlueDevilovo slanje fajla
|
||
+Name[sv]=Blådjävul skicka fil
|
||
+Name[tr]=BlueDevil Dosya Gönder
|
||
+Name[uk]=Надсилання файла BlueDevil
|
||
+Name[x-test]=xxBlueDevil Send Filexx
|
||
+Name[zh_CN]=BlueDevil 发送文件
|
||
+Name[zh_TW]=BlueDevil 傳送檔案
|
||
+GenericName=BlueDevil Send File
|
||
+GenericName[bs]=Bludevilovo slanje datoteke
|
||
+GenericName[ca]=Envia fitxers amb BlueDevil
|
||
+GenericName[cs]=Posílání souborů BlueDevil
|
||
+GenericName[de]=BlueDevil-Dateiversand
|
||
+GenericName[el]=Αποστολή αρχείου μέσω BlueDevil
|
||
+GenericName[en_GB]=BlueDevil Send File
|
||
+GenericName[es]=Enviar archivo con BlueDevil
|
||
+GenericName[fi]=BlueDevil-tiedostonlähetys
|
||
+GenericName[fr]=Envoi de fichiers par BlueDevil
|
||
+GenericName[it]=Invio file di BlueDevil
|
||
+GenericName[nb]=BlueDevil send fil
|
||
+GenericName[nl]=BlueDevil bestand verzenden
|
||
+GenericName[pl]=Wysłanie pliku BlueDevil
|
||
+GenericName[pt]=Envio de Ficheiro do Bluetooth
|
||
+GenericName[pt_BR]=Envio de arquivo do BlueDevil
|
||
+GenericName[sk]=Posielanie súborov BlueDevil
|
||
+GenericName[sl]=BlueDevil – pošiljanje datotek
|
||
+GenericName[sr]=Блудевилово слање фајла
|
||
+GenericName[sr@ijekavian]=Блудевилово слање фајла
|
||
+GenericName[sr@ijekavianlatin]=BlueDevilovo slanje fajla
|
||
+GenericName[sr@latin]=BlueDevilovo slanje fajla
|
||
+GenericName[sv]=Blådjävul skicka fil
|
||
+GenericName[tr]=BlueDevil Dosya Gönder
|
||
+GenericName[uk]=Надсилання файла BlueDevil
|
||
+GenericName[x-test]=xxBlueDevil Send Filexx
|
||
+GenericName[zh_CN]=BlueDevil 发送文件
|
||
+GenericName[zh_TW]=BlueDevil 傳送檔案
|
||
+Comment=BlueDevil Send File
|
||
+Comment[bs]=Bludevilovo slanje datoteke
|
||
+Comment[ca]=Envia fitxers amb BlueDevil
|
||
+Comment[cs]=Posílání souborů BlueDevil
|
||
+Comment[de]=BlueDevil-Dateiversand
|
||
+Comment[el]=Αποστολή αρχείου μέσω BlueDevil
|
||
+Comment[en_GB]=BlueDevil Send File
|
||
+Comment[es]=Enviar archivo con BlueDevil
|
||
+Comment[fi]=BlueDevil-tiedostonlähetys
|
||
+Comment[fr]=Envoi de fichiers par BlueDevil
|
||
+Comment[it]=Invio file di BlueDevil
|
||
+Comment[nb]=BlueDevil send fil
|
||
+Comment[nl]=BlueDevil bestand verzenden
|
||
+Comment[pl]=Wysłanie pliku BlueDevil
|
||
+Comment[pt]=Envio de Ficheiro do Bluetooth
|
||
+Comment[pt_BR]=Envio de arquivo do BlueDevil
|
||
+Comment[sk]=Posielanie súborov BlueDevil
|
||
+Comment[sl]=BlueDevil – pošiljanje datotek
|
||
+Comment[sr]=Блудевилово слање фајла
|
||
+Comment[sr@ijekavian]=Блудевилово слање фајла
|
||
+Comment[sr@ijekavianlatin]=BlueDevilovo slanje fajla
|
||
+Comment[sr@latin]=BlueDevilovo slanje fajla
|
||
+Comment[sv]=Blådjävul skicka fil
|
||
+Comment[tr]=BlueDevil Dosya Gönder
|
||
+Comment[uk]=Надсилання файла BlueDevil
|
||
+Comment[x-test]=xxBlueDevil Send Filexx
|
||
+Comment[zh_CN]=BlueDevil 发送文件
|
||
+Comment[zh_TW]=BlueDevil 傳送檔案
|
||
+
|
||
+Type=Application
|
||
+MimeType=application/vnd.kde.bluedevil-sendfile;
|
||
+Exec=bluedevil-sendfile -k%U
|
||
+Icon=preferences-system-bluetooth
|
||
+Terminal=false
|
||
+NoDisplay=true
|
||
+Categories=Qt;KDE;X-Bluetooth;Network;
|
||
+X-DBUS-ServiceName=org.kde.bluedevilsendfile
|
||
diff --git a/src/sendfile/pages/connecting.ui b/src/sendfile/pages/connecting.ui
|
||
index 10d9d7e..fc2bf06 100644
|
||
--- a/src/sendfile/pages/connecting.ui
|
||
+++ b/src/sendfile/pages/connecting.ui
|
||
@@ -12,11 +12,7 @@
|
||
</property>
|
||
<layout class="QVBoxLayout" name="verticalLayout">
|
||
<item>
|
||
- <widget class="QLabel" name="connLabel">
|
||
- <property name="text">
|
||
- <string>Connecting to: %1</string>
|
||
- </property>
|
||
- </widget>
|
||
+ <widget class="QLabel" name="connLabel"/>
|
||
</item>
|
||
<item>
|
||
<widget class="QProgressBar" name="progressBar">
|
||
diff --git a/src/sendfile/pages/connectingpage.cpp b/src/sendfile/pages/connectingpage.cpp
|
||
index 8d18c3d..1c34ed5 100644
|
||
--- a/src/sendfile/pages/connectingpage.cpp
|
||
+++ b/src/sendfile/pages/connectingpage.cpp
|
||
@@ -29,7 +29,8 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-ConnectingPage::ConnectingPage(QWidget* parent): QWizardPage(parent)
|
||
+ConnectingPage::ConnectingPage(QWidget *parent)
|
||
+ : QWizardPage(parent)
|
||
{
|
||
setupUi(this);
|
||
}
|
||
diff --git a/src/sendfile/pages/connectingpage.h b/src/sendfile/pages/connectingpage.h
|
||
index 935b394..2834cfa 100644
|
||
--- a/src/sendfile/pages/connectingpage.h
|
||
+++ b/src/sendfile/pages/connectingpage.h
|
||
@@ -27,15 +27,14 @@
|
||
|
||
#include <QWizardPage>
|
||
|
||
-class ConnectingPage : public QWizardPage,
|
||
-public Ui::Connecting
|
||
+class ConnectingPage : public QWizardPage, public Ui::Connecting
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
public:
|
||
- ConnectingPage(QWidget* parent = 0);
|
||
+ explicit ConnectingPage(QWidget *parent = 0);
|
||
|
||
- virtual void initializePage();
|
||
- virtual bool isComplete() const;
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
+ bool isComplete() const Q_DECL_OVERRIDE;
|
||
};
|
||
|
||
#endif // CONNECTINGPAGE_H
|
||
diff --git a/src/sendfile/pages/selectdeviceandfilespage.cpp b/src/sendfile/pages/selectdeviceandfilespage.cpp
|
||
index 0c8d079..b22d907 100644
|
||
--- a/src/sendfile/pages/selectdeviceandfilespage.cpp
|
||
+++ b/src/sendfile/pages/selectdeviceandfilespage.cpp
|
||
@@ -39,7 +39,10 @@
|
||
#include <bluedevil/bluedevil.h>
|
||
|
||
using namespace BlueDevil;
|
||
-SelectDeviceAndFilesPage::SelectDeviceAndFilesPage(QWidget* parent): QWizardPage(parent), m_dialog(0)
|
||
+
|
||
+SelectDeviceAndFilesPage::SelectDeviceAndFilesPage(QWidget *parent)
|
||
+ : QWizardPage(parent)
|
||
+ , m_dialog(0)
|
||
{
|
||
setupUi(this);
|
||
|
||
@@ -56,24 +59,22 @@ SelectDeviceAndFilesPage::SelectDeviceAndFilesPage(QWidget* parent): QWizardPage
|
||
selectBtn->setFixedSize(buttonSize, buttonSize);
|
||
selectBtn->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
|
||
|
||
- connect(widget, SIGNAL(deviceSelected(Device*)), this, SLOT(deviceSelected(Device*)));
|
||
- connect(selectBtn, SIGNAL(clicked(bool)), this, SLOT(openFileDialog()));
|
||
+ connect(widget, &DiscoverWidget::deviceSelected, this, &SelectDeviceAndFilesPage::deviceSelected);
|
||
+ connect(selectBtn, &QPushButton::clicked, this, &SelectDeviceAndFilesPage::openFileDialog);
|
||
}
|
||
|
||
-
|
||
-void SelectDeviceAndFilesPage::deviceSelected(Device* device)
|
||
+void SelectDeviceAndFilesPage::deviceSelected(Device *device)
|
||
{
|
||
if (!device->name().isEmpty()) {
|
||
- static_cast<SendFileWizard* >(wizard())->setDevice(device);
|
||
+ static_cast<SendFileWizard*>(wizard())->setDevice(device);
|
||
} else {
|
||
- static_cast<SendFileWizard* >(wizard())->setDevice(0);
|
||
+ static_cast<SendFileWizard*>(wizard())->setDevice(0);
|
||
}
|
||
emit completeChanged();
|
||
}
|
||
|
||
void SelectDeviceAndFilesPage::openFileDialog()
|
||
{
|
||
- //Don't worry MLaurent, I'm not going to check the pointer before delete it :)
|
||
delete m_dialog;
|
||
|
||
m_dialog = new QFileDialog(this, i18n("Open file..."),
|
||
@@ -99,7 +100,7 @@ void SelectDeviceAndFilesPage::selectionChanged()
|
||
|
||
bool SelectDeviceAndFilesPage::isComplete() const
|
||
{
|
||
- if (!static_cast<SendFileWizard* >(wizard())->device()) {
|
||
+ if (!static_cast<SendFileWizard*>(wizard())->device()) {
|
||
return false;
|
||
}
|
||
|
||
diff --git a/src/sendfile/pages/selectdeviceandfilespage.h b/src/sendfile/pages/selectdeviceandfilespage.h
|
||
index 19a718b..f5b50fc 100644
|
||
--- a/src/sendfile/pages/selectdeviceandfilespage.h
|
||
+++ b/src/sendfile/pages/selectdeviceandfilespage.h
|
||
@@ -31,22 +31,22 @@ class KUrl;
|
||
class QWizard;
|
||
class QFileDialog;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
}
|
||
-using namespace BlueDevil;
|
||
|
||
-class SelectDeviceAndFilesPage : public QWizardPage ,
|
||
- public Ui::SelectFileDiscover
|
||
+class SelectDeviceAndFilesPage : public QWizardPage, public Ui::SelectFileDiscover
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
+
|
||
public:
|
||
- SelectDeviceAndFilesPage(QWidget* parent = 0);
|
||
+ explicit SelectDeviceAndFilesPage(QWidget *parent = 0);
|
||
|
||
- virtual bool isComplete() const;
|
||
+ bool isComplete() const Q_DECL_OVERRIDE;
|
||
|
||
private Q_SLOTS:
|
||
- void deviceSelected(Device*);
|
||
+ void deviceSelected(BlueDevil::Device *device);
|
||
void openFileDialog();
|
||
void selectionChanged();
|
||
|
||
diff --git a/src/sendfile/pages/selectdevicepage.cpp b/src/sendfile/pages/selectdevicepage.cpp
|
||
index 01423dd..69a2c84 100644
|
||
--- a/src/sendfile/pages/selectdevicepage.cpp
|
||
+++ b/src/sendfile/pages/selectdevicepage.cpp
|
||
@@ -36,7 +36,10 @@
|
||
#include <bluedevil/bluedevil.h>
|
||
|
||
using namespace BlueDevil;
|
||
-SelectDevicePage::SelectDevicePage(QWidget* parent): QWizardPage(parent), m_dialog(0)
|
||
+
|
||
+SelectDevicePage::SelectDevicePage(QWidget *parent) :
|
||
+ QWizardPage(parent),
|
||
+ m_dialog(0)
|
||
{
|
||
setupUi(this);
|
||
|
||
@@ -51,22 +54,22 @@ SelectDevicePage::SelectDevicePage(QWidget* parent): QWizardPage(parent), m_dial
|
||
|
||
selectBtn->setHidden(true);
|
||
selectLbl->setHidden(true);
|
||
- connect(widget, SIGNAL(deviceSelected(Device*)), this, SLOT(deviceSelected(Device*)));
|
||
+ connect(widget, &DiscoverWidget::deviceSelected, this, &SelectDevicePage::deviceSelected);
|
||
}
|
||
|
||
-void SelectDevicePage::deviceSelected(Device* device)
|
||
+void SelectDevicePage::deviceSelected(Device *device)
|
||
{
|
||
if (!device->name().isEmpty()) {
|
||
- static_cast<SendFileWizard* >(wizard())->setDevice(device);
|
||
+ static_cast<SendFileWizard*>(wizard())->setDevice(device);
|
||
} else {
|
||
- static_cast<SendFileWizard* >(wizard())->setDevice(0);
|
||
+ static_cast<SendFileWizard*>(wizard())->setDevice(0);
|
||
}
|
||
emit completeChanged();
|
||
}
|
||
|
||
bool SelectDevicePage::isComplete() const
|
||
{
|
||
- if (!static_cast<SendFileWizard* >(wizard())->device()) {
|
||
+ if (!static_cast<SendFileWizard*>(wizard())->device()) {
|
||
return false;
|
||
}
|
||
|
||
diff --git a/src/sendfile/pages/selectdevicepage.h b/src/sendfile/pages/selectdevicepage.h
|
||
index 8c4b494..18d2cc7 100644
|
||
--- a/src/sendfile/pages/selectdevicepage.h
|
||
+++ b/src/sendfile/pages/selectdevicepage.h
|
||
@@ -30,22 +30,23 @@
|
||
class KUrl;
|
||
class QWizard;
|
||
class KFileDialog;
|
||
-namespace BlueDevil {
|
||
+
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
}
|
||
-using namespace BlueDevil;
|
||
|
||
-class SelectDevicePage : public QWizardPage ,
|
||
- public Ui::SelectFileDiscover
|
||
+class SelectDevicePage : public QWizardPage, public Ui::SelectFileDiscover
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
+
|
||
public:
|
||
- SelectDevicePage(QWidget* parent = 0);
|
||
+ explicit SelectDevicePage(QWidget *parent = 0);
|
||
|
||
- virtual bool isComplete() const;
|
||
+ bool isComplete() const Q_DECL_OVERRIDE;
|
||
|
||
private Q_SLOTS:
|
||
- void deviceSelected(Device*);
|
||
+ void deviceSelected(BlueDevil::Device *device);
|
||
|
||
private:
|
||
KFileDialog *m_dialog;
|
||
diff --git a/src/sendfile/pages/selectfilespage.cpp b/src/sendfile/pages/selectfilespage.cpp
|
||
index 7362eef..56ba9af 100644
|
||
--- a/src/sendfile/pages/selectfilespage.cpp
|
||
+++ b/src/sendfile/pages/selectfilespage.cpp
|
||
@@ -31,14 +31,15 @@
|
||
#include <QVBoxLayout>
|
||
#include <QLabel>
|
||
|
||
-SelectFilesPage::SelectFilesPage(QWidget* parent): QWizardPage(parent)
|
||
+SelectFilesPage::SelectFilesPage(QWidget *parent)
|
||
+ : QWizardPage(parent)
|
||
{
|
||
m_files = new KFileWidget(QUrl(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)), this);
|
||
m_files->setMode(KFile::Files);
|
||
m_files->setContentsMargins(0, 0, 0, 0);
|
||
setContentsMargins(0, 0, 0, 0);
|
||
|
||
- connect(m_files, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
|
||
+ connect(m_files, &KFileWidget::selectionChanged, this, &SelectFilesPage::selectionChanged);
|
||
|
||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||
layout->addWidget(m_files);
|
||
@@ -48,10 +49,12 @@ void SelectFilesPage::selectionChanged()
|
||
{
|
||
QStringList fileList;
|
||
KFileItemList itemList = m_files->dirOperator()->selectedItems();
|
||
- Q_FOREACH(const KFileItem &file, itemList) {
|
||
+
|
||
+ Q_FOREACH (const KFileItem &file, itemList) {
|
||
fileList << file.localPath();
|
||
}
|
||
- static_cast<SendFileWizard* >(wizard())->setFiles(fileList);
|
||
+
|
||
+ static_cast<SendFileWizard*>(wizard())->setFiles(fileList);
|
||
emit completeChanged();
|
||
}
|
||
|
||
diff --git a/src/sendfile/pages/selectfilespage.h b/src/sendfile/pages/selectfilespage.h
|
||
index a802270..623a216 100644
|
||
--- a/src/sendfile/pages/selectfilespage.h
|
||
+++ b/src/sendfile/pages/selectfilespage.h
|
||
@@ -30,11 +30,12 @@ class KFileWidget;
|
||
|
||
class SelectFilesPage : public QWizardPage
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
+
|
||
public:
|
||
- SelectFilesPage(QWidget* parent = 0);
|
||
+ explicit SelectFilesPage(QWidget *parent = 0);
|
||
|
||
- virtual bool isComplete() const;
|
||
+ bool isComplete() const Q_DECL_OVERRIDE;
|
||
|
||
private Q_SLOTS:
|
||
void selectionChanged();
|
||
diff --git a/src/sendfile/sendfilesjob.cpp b/src/sendfile/sendfilesjob.cpp
|
||
index 554616b..c943ef0 100644
|
||
--- a/src/sendfile/sendfilesjob.cpp
|
||
+++ b/src/sendfile/sendfilesjob.cpp
|
||
@@ -31,7 +31,8 @@
|
||
#include <bluedevil/bluedevil.h>
|
||
|
||
using namespace BlueDevil;
|
||
-SendFilesJob::SendFilesJob(const QStringList& files, Device* device, QObject* parent)
|
||
+
|
||
+SendFilesJob::SendFilesJob(const QStringList &files, Device *device, QObject *parent)
|
||
: KJob(parent)
|
||
, m_progress(0)
|
||
, m_totalSize(0)
|
||
@@ -41,6 +42,7 @@ SendFilesJob::SendFilesJob(const QStringList& files, Device* device, QObject* pa
|
||
, m_currentFileProgress(0)
|
||
{
|
||
qCDebug(SENDFILE) << files;
|
||
+
|
||
m_filesToSend = files;
|
||
|
||
Q_FOREACH(const QString &filePath, files) {
|
||
@@ -64,14 +66,15 @@ void SendFilesJob::start()
|
||
|
||
void SendFilesJob::doStart()
|
||
{
|
||
- qCDebug(SENDFILE);
|
||
QVariantMap map;
|
||
- map["Target"] = "opp";
|
||
+ map[QStringLiteral("Target")] = QStringLiteral("opp");
|
||
|
||
setTotalAmount(Bytes, m_totalSize);
|
||
setProcessedAmount(Bytes, 0);
|
||
|
||
- emit description(this, i18n("Sending file over Bluetooth"), QPair<QString, QString>(i18nc("File transfer origin", "From"), m_filesToSend.first()), QPair<QString, QString>(i18nc("File transfer destination", "To"), m_device->name()));
|
||
+ emit description(this, i18n("Sending file over Bluetooth"),
|
||
+ QPair<QString, QString>(i18nc("File transfer origin", "From"), m_filesToSend.first()),
|
||
+ QPair<QString, QString>(i18nc("File transfer destination", "To"), m_device->name()));
|
||
|
||
m_client = new OrgBluezObexClient1Interface(QStringLiteral("org.bluez.obex"),
|
||
QStringLiteral("/org/bluez/obex"),
|
||
@@ -80,7 +83,7 @@ void SendFilesJob::doStart()
|
||
|
||
QDBusPendingReply <QDBusObjectPath > reply = m_client->CreateSession(m_device->address(), map);
|
||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply);
|
||
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(createSessionSlot(QDBusPendingCallWatcher*)));
|
||
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, &SendFilesJob::createSessionSlot);
|
||
}
|
||
|
||
void SendFilesJob::createSessionSlot(QDBusPendingCallWatcher *call)
|
||
@@ -102,14 +105,14 @@ void SendFilesJob::createSessionSlot(QDBusPendingCallWatcher *call)
|
||
nextJob();
|
||
}
|
||
|
||
-void SendFilesJob::sendFileSlot(QDBusPendingCallWatcher* watcher)
|
||
+void SendFilesJob::sendFileSlot(QDBusPendingCallWatcher *watcher)
|
||
{
|
||
const QDBusPendingReply<QDBusObjectPath> reply = *watcher;
|
||
watcher->deleteLater();
|
||
QString path = reply.value().path();
|
||
|
||
m_props = new OrgFreedesktopDBusPropertiesInterface(QStringLiteral("org.bluez.obex"), path, QDBusConnection::sessionBus(), this);
|
||
- connect(m_props, SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)), SLOT(propertiesChangedSlot(QString,QVariantMap,QStringList)));
|
||
+ connect(m_props, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, this, &SendFilesJob::propertiesChangedSlot);
|
||
}
|
||
|
||
void SendFilesJob::propertiesChangedSlot(const QString& interface, const QVariantMap& props, const QStringList& invalidProps)
|
||
@@ -131,7 +134,8 @@ void SendFilesJob::propertiesChangedSlot(const QString& interface, const QVarian
|
||
void SendFilesJob::statusChanged(const QVariant& value)
|
||
{
|
||
qCDebug(SENDFILE) << value;
|
||
- QString status = value.toString();
|
||
+
|
||
+ const QString &status = value.toString();
|
||
|
||
if (status == QLatin1String("active")) {
|
||
m_time = QTime::currentTime();
|
||
@@ -151,6 +155,7 @@ void SendFilesJob::statusChanged(const QVariant& value)
|
||
void SendFilesJob::transferChanged(const QVariant& value)
|
||
{
|
||
qCDebug(SENDFILE) << value;
|
||
+
|
||
bool ok = false;
|
||
qulonglong bytes = value.toULongLong(&ok);
|
||
if (!ok) {
|
||
@@ -158,7 +163,7 @@ void SendFilesJob::transferChanged(const QVariant& value)
|
||
return;
|
||
}
|
||
|
||
- //If a least 1 second has passed since last update
|
||
+ // If a least 1 second has passed since last update
|
||
int secondsSinceLastTime = m_time.secsTo(QTime::currentTime());
|
||
if (secondsSinceLastTime > 0) {
|
||
float speed = (bytes - m_speedBytes) / secondsSinceLastTime;
|
||
@@ -177,17 +182,18 @@ void SendFilesJob::nextJob()
|
||
m_currentFile = m_filesToSend.takeFirst();
|
||
m_currentFileSize = m_filesToSendSize.takeFirst();
|
||
|
||
- emit description(this, i18n("Sending file over Bluetooth"), QPair<QString, QString>(i18nc("File transfer origin", "From"), m_currentFile), QPair<QString, QString>(i18nc("File transfer destination", "To"), m_device->name()));
|
||
+ emit description(this, i18n("Sending file over Bluetooth"),
|
||
+ QPair<QString, QString>(i18nc("File transfer origin", "From"), m_currentFile),
|
||
+ QPair<QString, QString>(i18nc("File transfer destination", "To"), m_device->name()));
|
||
|
||
QDBusPendingReply<QDBusObjectPath, QVariantMap> fileReply = m_push->SendFile(m_currentFile);
|
||
|
||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(fileReply);
|
||
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(sendFileSlot(QDBusPendingCallWatcher*)));
|
||
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, &SendFilesJob::sendFileSlot);
|
||
}
|
||
|
||
void SendFilesJob::jobDone()
|
||
{
|
||
- qCDebug(SENDFILE);
|
||
m_speedBytes = 0;
|
||
m_currentFileSize = 0;
|
||
m_currentFileProgress = 0;
|
||
@@ -202,8 +208,6 @@ void SendFilesJob::jobDone()
|
||
|
||
void SendFilesJob::progress(quint64 transferBytes)
|
||
{
|
||
- qCDebug(SENDFILE);
|
||
-
|
||
quint64 toAdd = transferBytes - m_currentFileProgress;
|
||
m_currentFileProgress = transferBytes;
|
||
m_progress += toAdd;
|
||
@@ -213,9 +217,10 @@ void SendFilesJob::progress(quint64 transferBytes)
|
||
void SendFilesJob::error(const QDBusObjectPath& transfer, const QString& error)
|
||
{
|
||
Q_UNUSED(transfer)
|
||
+
|
||
qCDebug(SENDFILE) << error;
|
||
|
||
- //if this is the last file, just emit error
|
||
+ // If this is the last file, just emit error
|
||
if (m_filesToSend.isEmpty()) {
|
||
setError(KJob::UserDefinedError);
|
||
return;
|
||
@@ -225,5 +230,4 @@ void SendFilesJob::error(const QDBusObjectPath& transfer, const QString& error)
|
||
m_progress += toAdd;
|
||
setProcessedAmount(Bytes, m_progress);
|
||
nextJob();
|
||
-
|
||
}
|
||
diff --git a/src/sendfile/sendfilesjob.h b/src/sendfile/sendfilesjob.h
|
||
index 28e8ac2..68580c0 100644
|
||
--- a/src/sendfile/sendfilesjob.h
|
||
+++ b/src/sendfile/sendfilesjob.h
|
||
@@ -40,15 +40,14 @@ class OrgBluezObexClient1Interface;
|
||
class OrgBluezObexObjectPush1Interface;
|
||
class OrgFreedesktopDBusPropertiesInterface;
|
||
|
||
-using namespace BlueDevil;
|
||
class SendFilesJob : public KJob
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
public:
|
||
- SendFilesJob(const QStringList &files, BlueDevil::Device* device, QObject* parent = 0);
|
||
+ explicit SendFilesJob(const QStringList &files, BlueDevil::Device *device, QObject *parent = 0);
|
||
|
||
- virtual void start();
|
||
- virtual bool doKill();
|
||
+ void start() Q_DECL_OVERRIDE;
|
||
+ bool doKill() Q_DECL_OVERRIDE;
|
||
|
||
private Q_SLOTS:
|
||
void doStart();
|
||
@@ -56,26 +55,25 @@ private Q_SLOTS:
|
||
void nextJob();
|
||
void jobDone();
|
||
void progress(quint64 transferBytes);
|
||
- void error(const QDBusObjectPath& transfer, const QString& error);
|
||
- void propertiesChangedSlot(const QString& interface, const QVariantMap &props, const QStringList &invalidProps);
|
||
- void sendFileSlot(QDBusPendingCallWatcher* watcher);
|
||
+ void error(const QDBusObjectPath &transfer, const QString &error);
|
||
+ void propertiesChangedSlot(const QString &interface, const QVariantMap &props, const QStringList &invalidProps);
|
||
+ void sendFileSlot(QDBusPendingCallWatcher *watcher);
|
||
|
||
private:
|
||
void transferChanged(const QVariant &value);
|
||
void statusChanged(const QVariant &value);
|
||
|
||
QTime m_time;
|
||
- QStringList m_filesToSend;
|
||
+ QStringList m_filesToSend;
|
||
QList <quint64> m_filesToSendSize;
|
||
- QString m_currentFile;
|
||
+ QString m_currentFile;
|
||
QDBusObjectPath m_currentFileDBusPath;
|
||
- quint64 m_progress;
|
||
- quint64 m_totalSize;
|
||
+ quint64 m_progress;
|
||
+ quint64 m_totalSize;
|
||
qulonglong m_speedBytes;
|
||
- Device *m_device;
|
||
- quint64 m_currentFileSize;
|
||
- quint64 m_currentFileProgress;
|
||
-
|
||
+ BlueDevil::Device *m_device;
|
||
+ quint64 m_currentFileSize;
|
||
+ quint64 m_currentFileProgress;
|
||
|
||
OrgBluezObexClient1Interface *m_client;
|
||
OrgBluezObexObjectPush1Interface *m_push;
|
||
diff --git a/src/sendfile/sendfilewizard.cpp b/src/sendfile/sendfilewizard.cpp
|
||
index 6557989..71b01ea 100644
|
||
--- a/src/sendfile/sendfilewizard.cpp
|
||
+++ b/src/sendfile/sendfilewizard.cpp
|
||
@@ -41,7 +41,7 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-SendFileWizard::SendFileWizard(const QString& deviceInfo, const QStringList& files)
|
||
+SendFileWizard::SendFileWizard(const QString &deviceInfo, const QStringList &files)
|
||
: QWizard()
|
||
, m_device(0)
|
||
, m_job(0)
|
||
@@ -52,7 +52,7 @@ SendFileWizard::SendFileWizard(const QString& deviceInfo, const QStringList& fil
|
||
return;
|
||
}
|
||
|
||
- qCDebug(SENDFILE) << "DeviceUbi: " << deviceInfo;
|
||
+ qCDebug(SENDFILE) << "DeviceUbi:" << deviceInfo;
|
||
qCDebug(SENDFILE) << "Files";
|
||
qCDebug(SENDFILE) << files;
|
||
|
||
@@ -106,13 +106,13 @@ void SendFileWizard::done(int result)
|
||
}
|
||
}
|
||
|
||
-void SendFileWizard::setFiles(const QStringList& files)
|
||
+void SendFileWizard::setFiles(const QStringList &files)
|
||
{
|
||
qCDebug(SENDFILE) << files;
|
||
m_files = files;
|
||
}
|
||
|
||
-void SendFileWizard::setDevice(Device* device)
|
||
+void SendFileWizard::setDevice(Device *device)
|
||
{
|
||
qCDebug(SENDFILE) << device;
|
||
m_device = device;
|
||
@@ -136,7 +136,7 @@ void SendFileWizard::setDevice(QString deviceUrl)
|
||
m_device = device;
|
||
}
|
||
|
||
-Device* SendFileWizard::device()
|
||
+Device *SendFileWizard::device()
|
||
{
|
||
return m_device;
|
||
}
|
||
@@ -157,11 +157,10 @@ void SendFileWizard::startTransfer()
|
||
}
|
||
|
||
m_job = new SendFilesJob(m_files, m_device);
|
||
- connect(m_job, SIGNAL(destroyed(QObject*)), qApp, SLOT(quit()));
|
||
+ connect(m_job, &SendFilesJob::destroyed, qApp, &QCoreApplication::quit);
|
||
|
||
KIO::getJobTracker()->registerJob(m_job);
|
||
m_job->start();
|
||
|
||
- QTimer::singleShot(2000, this, SLOT(wizardDone()));
|
||
+ QTimer::singleShot(2000, this, &SendFileWizard::wizardDone);
|
||
}
|
||
-
|
||
diff --git a/src/sendfile/sendfilewizard.h b/src/sendfile/sendfilewizard.h
|
||
index 9b425e2..1dae831 100644
|
||
--- a/src/sendfile/sendfilewizard.h
|
||
+++ b/src/sendfile/sendfilewizard.h
|
||
@@ -31,26 +31,27 @@
|
||
class WizardAgent;
|
||
class QStringList;
|
||
class SendFilesJob;
|
||
-namespace BlueDevil {
|
||
+
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
}
|
||
-using namespace BlueDevil;
|
||
|
||
class SendFileWizard : public QWizard
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- SendFileWizard(const QString &deviceUBI, const QStringList &files);
|
||
- virtual ~SendFileWizard();
|
||
+ explicit SendFileWizard(const QString &deviceUBI, const QStringList &files);
|
||
+ ~SendFileWizard();
|
||
|
||
- virtual void done(int result);
|
||
+ void done(int result) Q_DECL_OVERRIDE;
|
||
|
||
void setFiles(const QStringList &files);
|
||
|
||
- void setDevice(Device *device);
|
||
+ void setDevice(BlueDevil::Device *device);
|
||
void setDevice(QString deviceUrl);
|
||
- Device* device();
|
||
+ BlueDevil::Device *device();
|
||
|
||
void startTransfer();
|
||
|
||
@@ -58,9 +59,8 @@ private Q_SLOTS:
|
||
void wizardDone();
|
||
|
||
private:
|
||
- QStringList m_files;
|
||
-
|
||
- Device *m_device;
|
||
+ QStringList m_files;
|
||
+ BlueDevil::Device *m_device;
|
||
SendFilesJob *m_job;
|
||
};
|
||
|
||
diff --git a/src/settings/filereceiver.kcfg b/src/settings/filereceiver.kcfg
|
||
index 5740f9a..a2e6521 100644
|
||
--- a/src/settings/filereceiver.kcfg
|
||
+++ b/src/settings/filereceiver.kcfg
|
||
@@ -3,14 +3,9 @@
|
||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||
- <!-- Includes -->
|
||
<kcfgfile name="bluedevilreceiverrc"/>
|
||
- <include>QFile</include>
|
||
- <include>QDir</include>
|
||
- <include>QStandardPaths</include>
|
||
- <include>KIO/Global</include>
|
||
|
||
-<!-- File Receiving -->
|
||
+ <!-- File Receiving -->
|
||
<group name="General">
|
||
<entry name="enabled" type="bool" key="enabled">
|
||
<label>Enable or disable receiving files</label>
|
||
@@ -18,7 +13,7 @@ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||
</entry>
|
||
<entry name="saveUrl" type="Url" key="saveUrl">
|
||
<label>Save received files to:</label>
|
||
- <default code="true">QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))</default>
|
||
+ <default code="true">QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation))</default>
|
||
</entry>
|
||
<entry name="autoAccept" type="int" key="autoAccept">
|
||
<label>Whether allow to modify shared files</label>
|
||
diff --git a/src/wizard/CMakeLists.txt b/src/wizard/CMakeLists.txt
|
||
index d615f3d..e096ad1 100644
|
||
--- a/src/wizard/CMakeLists.txt
|
||
+++ b/src/wizard/CMakeLists.txt
|
||
@@ -11,6 +11,7 @@ set(wizard_SRCS
|
||
pages/keyboardpairing.cpp
|
||
pages/ssppairing.cpp
|
||
pages/fail.cpp
|
||
+ pages/success.cpp
|
||
)
|
||
|
||
ki18n_wrap_ui(wizard_SRCS
|
||
@@ -20,6 +21,7 @@ ki18n_wrap_ui(wizard_SRCS
|
||
pages/keyboardpairing.ui
|
||
pages/ssppairing.ui
|
||
pages/fail.ui
|
||
+ pages/success.ui
|
||
)
|
||
|
||
add_executable(bluedevil-wizard ${wizard_SRCS})
|
||
@@ -35,5 +37,5 @@ target_link_libraries(bluedevil-wizard
|
||
${LibBlueDevil_LIBRARIES})
|
||
|
||
install(TARGETS bluedevil-wizard ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||
-install(FILES bluedevil-wizard.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
||
+install(FILES org.kde.bluedevilwizard.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
||
install(FILES pin-code-database.xml DESTINATION ${DATA_INSTALL_DIR}/bluedevilwizard)
|
||
diff --git a/src/wizard/bluedevil-wizard.desktop b/src/wizard/bluedevil-wizard.desktop
|
||
deleted file mode 100644
|
||
index c349f89..0000000
|
||
--- a/src/wizard/bluedevil-wizard.desktop
|
||
+++ /dev/null
|
||
@@ -1,80 +0,0 @@
|
||
-[Desktop Entry]
|
||
-Type=Application
|
||
-Version=1.0
|
||
-Name=BlueDevil Wizard
|
||
-Name[ca]=Assistent del BlueDevil
|
||
-Name[cs]=Průvodce Bluedevil
|
||
-Name[de]=BlueDevil-Assistent
|
||
-Name[en_GB]=BlueDevil Wizard
|
||
-Name[es]=Asistente de BlueDevil
|
||
-Name[fi]=Opastettu BlueDevil-toiminto
|
||
-Name[fr]=Assistant pour BlueDevil
|
||
-Name[it]=Procedura guidata di BlueDevil
|
||
-Name[nb]=BlueDevil veiviser
|
||
-Name[nl]=BlueDevil assistent
|
||
-Name[pl]=Pomocnik BlueDevil
|
||
-Name[pt]=Assistente BlueDevil
|
||
-Name[pt_BR]=Assistente BlueDevil
|
||
-Name[sk]=Sprievodca BlueDevil
|
||
-Name[sl]=BlueDevil – čarovnik
|
||
-Name[sr]=Блудевилов чаробњак
|
||
-Name[sr@ijekavian]=Блудевилов чаробњак
|
||
-Name[sr@ijekavianlatin]=BlueDevilov čarobnjak
|
||
-Name[sr@latin]=BlueDevilov čarobnjak
|
||
-Name[sv]=Blådjävul guide
|
||
-Name[uk]=Майстер BlueDevil
|
||
-Name[x-test]=xxBlueDevil Wizardxx
|
||
-Name[zh_CN]=BlueDevil 向导
|
||
-GenericName=BlueDevil Wizard
|
||
-GenericName[ca]=Assistent del BlueDevil
|
||
-GenericName[cs]=Průvodce Bluedevil
|
||
-GenericName[de]=BlueDevil-Assistent
|
||
-GenericName[en_GB]=BlueDevil Wizard
|
||
-GenericName[es]=Asistente de BlueDevil
|
||
-GenericName[fi]=Opastettu BlueDevil-toiminto
|
||
-GenericName[fr]=Assistant pour BlueDevil
|
||
-GenericName[it]=Procedura guidata di BlueDevil
|
||
-GenericName[nb]=BlueDevil veiviser
|
||
-GenericName[nl]=BlueDevil assistent
|
||
-GenericName[pl]=Pomocnik BlueDevil
|
||
-GenericName[pt]=Assistente BlueDevil
|
||
-GenericName[pt_BR]=Assistente BlueDevil
|
||
-GenericName[sk]=Sprievodca BlueDevil
|
||
-GenericName[sl]=BlueDevil – čarovnik
|
||
-GenericName[sr]=Блудевилов чаробњак
|
||
-GenericName[sr@ijekavian]=Блудевилов чаробњак
|
||
-GenericName[sr@ijekavianlatin]=BlueDevilov čarobnjak
|
||
-GenericName[sr@latin]=BlueDevilov čarobnjak
|
||
-GenericName[sv]=Blådjävul guide
|
||
-GenericName[uk]=Майстер BlueDevil
|
||
-GenericName[x-test]=xxBlueDevil Wizardxx
|
||
-GenericName[zh_CN]=BlueDevil 向导
|
||
-Exec=bluedevil-wizard %U
|
||
-Comment=BlueDevil Wizard
|
||
-Comment[ca]=Assistent del BlueDevil
|
||
-Comment[cs]=BlueDevil
|
||
-Comment[de]=BlueDevil-Assistent
|
||
-Comment[en_GB]=BlueDevil Wizard
|
||
-Comment[es]=Asistente de BlueDevil
|
||
-Comment[fi]=Opastettu BlueDevil-toiminto
|
||
-Comment[fr]=Assistant pour BlueDevil
|
||
-Comment[it]=Procedura guidata di BlueDevil
|
||
-Comment[nb]=BlueDevil veiviser
|
||
-Comment[nl]=BlueDevil assistent
|
||
-Comment[pl]=Pomocnik BlueDevil
|
||
-Comment[pt]=Assistente BlueDevil
|
||
-Comment[pt_BR]=Assistente BlueDevil
|
||
-Comment[sk]=Sprievodca BlueDevil
|
||
-Comment[sl]=BlueDevil – čarovnik
|
||
-Comment[sr]=Блудевилов чаробњак
|
||
-Comment[sr@ijekavian]=Блудевилов чаробњак
|
||
-Comment[sr@ijekavianlatin]=BlueDevilov čarobnjak
|
||
-Comment[sr@latin]=BlueDevilov čarobnjak
|
||
-Comment[sv]=Blådjävul guide
|
||
-Comment[uk]=Майстер BlueDevil
|
||
-Comment[x-test]=xxBlueDevil Wizardxx
|
||
-Comment[zh_CN]=BlueDevil 向导
|
||
-Icon=preferences-system-bluetooth
|
||
-Terminal=false
|
||
-Categories=Qt;KDE;X-Bluetooth;Network;
|
||
-NoDisplay=true
|
||
diff --git a/src/wizard/bluewizard.cpp b/src/wizard/bluewizard.cpp
|
||
index 02f54b7..2f1e62a 100644
|
||
--- a/src/wizard/bluewizard.cpp
|
||
+++ b/src/wizard/bluewizard.cpp
|
||
@@ -23,6 +23,7 @@
|
||
#include "pages/legacypairingdatabase.h"
|
||
#include "pages/keyboardpairing.h"
|
||
#include "pages/ssppairing.h"
|
||
+#include "pages/success.h"
|
||
#include "pages/fail.h"
|
||
#include "debug_p.h"
|
||
|
||
@@ -47,11 +48,11 @@ BlueWizard::BlueWizard(const QUrl &url)
|
||
setOption(QWizard::IndependentPages, true);
|
||
|
||
if (url.host().length() == 17) {
|
||
- setPreselectedAddress(url.host().replace(QLatin1Char('-'), QLatin1Char(':')).toLatin1());
|
||
+ setPreselectedAddress(url.host().replace(QLatin1Char('-'), QLatin1Char(':')));
|
||
}
|
||
|
||
if (url.fileName().length() == 36) {
|
||
- setPreselectedUuid(url.fileName().toLatin1());
|
||
+ setPreselectedUuid(url.fileName());
|
||
}
|
||
|
||
setPage(Discover, new DiscoverPage(this));
|
||
@@ -61,6 +62,7 @@ BlueWizard::BlueWizard(const QUrl &url)
|
||
setPage(LegacyPairingDatabase, new LegacyPairingPageDatabase(this));
|
||
setPage(KeyboardPairing, new KeyboardPairingPage(this));
|
||
setPage(SSPPairing, new SSPPairingPage(this));
|
||
+ setPage(Success, new SuccessPage(this));
|
||
setPage(Fail, new FailPage(this));
|
||
|
||
QPushButton *backButton = new QPushButton(this);
|
||
@@ -94,10 +96,6 @@ BlueWizard::BlueWizard(const QUrl &url)
|
||
m_agent = new WizardAgent(qApp);
|
||
}
|
||
|
||
-BlueWizard::~BlueWizard()
|
||
-{
|
||
-}
|
||
-
|
||
void BlueWizard::done(int result)
|
||
{
|
||
qCDebug(WIZARD) << "Wizard done: " << result;
|
||
@@ -111,9 +109,10 @@ Device* BlueWizard::device() const
|
||
return m_device;
|
||
}
|
||
|
||
-void BlueWizard::setDeviceAddress(const QByteArray& address)
|
||
+void BlueWizard::setDeviceAddress(const QString &address)
|
||
{
|
||
qCDebug(WIZARD) << "Device Address: " << address;
|
||
+
|
||
if (!Manager::self()->usableAdapter()) {
|
||
qCDebug(WIZARD) << "No usable adapter available";
|
||
return;
|
||
@@ -123,7 +122,7 @@ void BlueWizard::setDeviceAddress(const QByteArray& address)
|
||
m_device = Manager::self()->usableAdapter()->deviceForAddress(m_deviceAddress);
|
||
}
|
||
|
||
-QByteArray BlueWizard::deviceAddress() const
|
||
+QString BlueWizard::deviceAddress() const
|
||
{
|
||
return m_deviceAddress;
|
||
}
|
||
@@ -137,45 +136,43 @@ void BlueWizard::restartWizard()
|
||
qApp->quit();
|
||
}
|
||
|
||
-void BlueWizard::setPin(const QByteArray& pinNum)
|
||
+void BlueWizard::setPin(const QString &pin)
|
||
{
|
||
- qCDebug(WIZARD) << "Setting pin: :" << pinNum;
|
||
- m_pin = pinNum;
|
||
-}
|
||
+ qCDebug(WIZARD) << "Setting pin:" << pin;
|
||
|
||
-void BlueWizard::setPin(const QString& pin)
|
||
-{
|
||
- setPin(pin.toUtf8());
|
||
+ m_pin = pin;
|
||
}
|
||
|
||
-QByteArray BlueWizard::pin() const
|
||
+QString BlueWizard::pin() const
|
||
{
|
||
return m_pin;
|
||
}
|
||
|
||
-void BlueWizard::setPreselectedUuid(const QByteArray& uuid)
|
||
+void BlueWizard::setPreselectedUuid(const QString &uuid)
|
||
{
|
||
qCDebug(WIZARD) << "Preselect UUID: " << uuid;
|
||
+
|
||
m_preselectedUuid = uuid;
|
||
}
|
||
|
||
-QByteArray BlueWizard::preselectedUuid() const
|
||
+QString BlueWizard::preselectedUuid() const
|
||
{
|
||
return m_preselectedUuid;
|
||
}
|
||
|
||
-void BlueWizard::setPreselectedAddress(const QByteArray& address)
|
||
+void BlueWizard::setPreselectedAddress(const QString &address)
|
||
{
|
||
qCDebug(WIZARD) << "Preselected Address: " << address;
|
||
+
|
||
m_preselectedAddress = address;
|
||
}
|
||
|
||
-QByteArray BlueWizard::preselectedAddress() const
|
||
+QString BlueWizard::preselectedAddress() const
|
||
{
|
||
return m_preselectedAddress;
|
||
}
|
||
|
||
-WizardAgent* BlueWizard::agent() const
|
||
+WizardAgent *BlueWizard::agent() const
|
||
{
|
||
return m_agent;
|
||
}
|
||
diff --git a/src/wizard/bluewizard.h b/src/wizard/bluewizard.h
|
||
index ce817d1..e930916 100644
|
||
--- a/src/wizard/bluewizard.h
|
||
+++ b/src/wizard/bluewizard.h
|
||
@@ -15,57 +15,66 @@
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
*/
|
||
|
||
-
|
||
#ifndef BLUEWIZARD_H
|
||
#define BLUEWIZARD_H
|
||
|
||
#include <QObject>
|
||
#include <QWizard>
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
}
|
||
|
||
class WizardAgent;
|
||
+
|
||
class BlueWizard : public QWizard
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- BlueWizard(const QUrl& url);
|
||
- virtual ~BlueWizard();
|
||
+ explicit BlueWizard(const QUrl &url);
|
||
|
||
- QByteArray deviceAddress() const;
|
||
- void setDeviceAddress(const QByteArray& address);
|
||
+ QString deviceAddress() const;
|
||
+ void setDeviceAddress(const QString &address);
|
||
|
||
BlueDevil::Device *device() const;
|
||
|
||
- QByteArray pin() const;
|
||
- void setPin(const QByteArray& pin);
|
||
+ QString pin() const;
|
||
+ void setPin(const QString &pin);
|
||
|
||
- QByteArray preselectedUuid() const;
|
||
- void setPreselectedUuid(const QByteArray &uuid);
|
||
+ QString preselectedUuid() const;
|
||
+ void setPreselectedUuid(const QString &uuid);
|
||
|
||
- QByteArray preselectedAddress() const;
|
||
- void setPreselectedAddress(const QByteArray &uuid);
|
||
+ QString preselectedAddress() const;
|
||
+ void setPreselectedAddress(const QString &uuid);
|
||
|
||
- WizardAgent* agent() const;
|
||
+ WizardAgent *agent() const;
|
||
|
||
- enum {Discover, NoPairing, LegacyPairing, LegacyPairingDatabase, KeyboardPairing, SSPPairing, Fail, Connect};
|
||
+ enum {
|
||
+ Discover,
|
||
+ NoPairing,
|
||
+ LegacyPairing,
|
||
+ LegacyPairingDatabase,
|
||
+ KeyboardPairing,
|
||
+ SSPPairing,
|
||
+ Success,
|
||
+ Fail,
|
||
+ Connect
|
||
+ };
|
||
|
||
public Q_SLOTS:
|
||
void restartWizard();
|
||
- void setPin(const QString& pin);
|
||
- virtual void done(int result);
|
||
+ void done(int result) Q_DECL_OVERRIDE;
|
||
|
||
private:
|
||
- QByteArray m_deviceAddress;
|
||
- BlueDevil::Device * m_device;
|
||
- QByteArray m_pin;
|
||
- QByteArray m_preselectedUuid;
|
||
- QByteArray m_preselectedAddress;
|
||
+ BlueDevil::Device *m_device;
|
||
WizardAgent *m_agent;
|
||
|
||
+ QString m_pin;
|
||
+ QString m_deviceAddress;
|
||
+ QString m_preselectedUuid;
|
||
+ QString m_preselectedAddress;
|
||
bool m_manualPin;
|
||
};
|
||
|
||
diff --git a/src/wizard/main.cpp b/src/wizard/main.cpp
|
||
index ee9edf8..80e260b 100644
|
||
--- a/src/wizard/main.cpp
|
||
+++ b/src/wizard/main.cpp
|
||
@@ -28,6 +28,7 @@
|
||
#include <QCommandLineOption>
|
||
|
||
#include <KAboutData>
|
||
+#include <KDBusService>
|
||
#include <KLocalizedString>
|
||
|
||
int main(int argc, char *argv[])
|
||
@@ -43,13 +44,12 @@ int main(int argc, char *argv[])
|
||
QStringLiteral("afiestas@kde.org"), QStringLiteral("http://www.afiestas.org/"));
|
||
|
||
QApplication app(argc, argv);
|
||
- app.setApplicationName(QStringLiteral("bluedevilwizard"));
|
||
- app.setApplicationVersion(bluedevil_version);
|
||
- app.setApplicationDisplayName(i18n("Bluetooth Wizard"));
|
||
- app.setOrganizationDomain(QStringLiteral("kde.org"));
|
||
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-system-bluetooth")));
|
||
app.setQuitOnLastWindowClosed(false);
|
||
|
||
+ KAboutData::setApplicationData(aboutData);
|
||
+ KDBusService service(KDBusService::Unique);
|
||
+
|
||
QCommandLineParser parser;
|
||
parser.setApplicationDescription(i18n("Bluetooth Wizard"));
|
||
parser.addVersionOption();
|
||
@@ -59,12 +59,13 @@ int main(int argc, char *argv[])
|
||
parser.process(app);
|
||
|
||
const QStringList &args = parser.positionalArguments();
|
||
- QUrl url;
|
||
- if (!args.isEmpty()) {
|
||
- url = args.first();
|
||
- }
|
||
+ const QUrl &url = !args.isEmpty() ? args.first() : QUrl();
|
||
+
|
||
+ BlueWizard *wizard = new BlueWizard(url);
|
||
|
||
- new BlueWizard(url);
|
||
+ QObject::connect(&service, &KDBusService::activateRequested, wizard, [wizard]() {
|
||
+ wizard->setWindowState((wizard->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||
+ });
|
||
|
||
return app.exec();
|
||
}
|
||
diff --git a/src/wizard/org.kde.bluedevilwizard.desktop b/src/wizard/org.kde.bluedevilwizard.desktop
|
||
new file mode 100644
|
||
index 0000000..8e89f30
|
||
--- /dev/null
|
||
+++ b/src/wizard/org.kde.bluedevilwizard.desktop
|
||
@@ -0,0 +1,99 @@
|
||
+[Desktop Entry]
|
||
+Name=BlueDevil Wizard
|
||
+Name[bs]=Bludevilov čarobnjak
|
||
+Name[ca]=Assistent del BlueDevil
|
||
+Name[cs]=Průvodce Bluedevil
|
||
+Name[de]=BlueDevil-Assistent
|
||
+Name[el]=Οδηγός BlueDevil
|
||
+Name[en_GB]=BlueDevil Wizard
|
||
+Name[es]=Asistente de BlueDevil
|
||
+Name[fi]=Opastettu BlueDevil-toiminto
|
||
+Name[fr]=Assistant pour BlueDevil
|
||
+Name[it]=Procedura guidata di BlueDevil
|
||
+Name[ja]=BlueDevil ウィザード
|
||
+Name[nb]=BlueDevil veiviser
|
||
+Name[nl]=BlueDevil assistent
|
||
+Name[pl]=Pomocnik BlueDevil
|
||
+Name[pt]=Assistente BlueDevil
|
||
+Name[pt_BR]=Assistente BlueDevil
|
||
+Name[sk]=Sprievodca BlueDevil
|
||
+Name[sl]=BlueDevil – čarovnik
|
||
+Name[sr]=Блудевилов чаробњак
|
||
+Name[sr@ijekavian]=Блудевилов чаробњак
|
||
+Name[sr@ijekavianlatin]=BlueDevilov čarobnjak
|
||
+Name[sr@latin]=BlueDevilov čarobnjak
|
||
+Name[sv]=Blådjävul guide
|
||
+Name[tr]=BlueDevil Sihirbazı
|
||
+Name[uk]=Майстер BlueDevil
|
||
+Name[x-test]=xxBlueDevil Wizardxx
|
||
+Name[zh_CN]=BlueDevil 向导
|
||
+Name[zh_TW]=BlueDevil 精靈
|
||
+GenericName=BlueDevil Wizard
|
||
+GenericName[bs]=Bludevilov čarobnjak
|
||
+GenericName[ca]=Assistent del BlueDevil
|
||
+GenericName[cs]=Průvodce Bluedevil
|
||
+GenericName[de]=BlueDevil-Assistent
|
||
+GenericName[el]=Οδηγός BlueDevil
|
||
+GenericName[en_GB]=BlueDevil Wizard
|
||
+GenericName[es]=Asistente de BlueDevil
|
||
+GenericName[fi]=Opastettu BlueDevil-toiminto
|
||
+GenericName[fr]=Assistant pour BlueDevil
|
||
+GenericName[it]=Procedura guidata di BlueDevil
|
||
+GenericName[ja]=BlueDevil ウィザード
|
||
+GenericName[nb]=BlueDevil veiviser
|
||
+GenericName[nl]=BlueDevil assistent
|
||
+GenericName[pa]=BlueDevil ਸਹਾਇਕ
|
||
+GenericName[pl]=Pomocnik BlueDevil
|
||
+GenericName[pt]=Assistente BlueDevil
|
||
+GenericName[pt_BR]=Assistente BlueDevil
|
||
+GenericName[sk]=Sprievodca BlueDevil
|
||
+GenericName[sl]=BlueDevil – čarovnik
|
||
+GenericName[sr]=Блудевилов чаробњак
|
||
+GenericName[sr@ijekavian]=Блудевилов чаробњак
|
||
+GenericName[sr@ijekavianlatin]=BlueDevilov čarobnjak
|
||
+GenericName[sr@latin]=BlueDevilov čarobnjak
|
||
+GenericName[sv]=Blådjävul guide
|
||
+GenericName[tr]=BlueDevil Sihirbazı
|
||
+GenericName[uk]=Майстер BlueDevil
|
||
+GenericName[x-test]=xxBlueDevil Wizardxx
|
||
+GenericName[zh_CN]=BlueDevil 向导
|
||
+GenericName[zh_TW]=BlueDevil 精靈
|
||
+Comment=BlueDevil Wizard
|
||
+Comment[bs]=Bludevilov čarobnjak
|
||
+Comment[ca]=Assistent del BlueDevil
|
||
+Comment[cs]=BlueDevil
|
||
+Comment[de]=BlueDevil-Assistent
|
||
+Comment[el]=Οδηγός BlueDevil
|
||
+Comment[en_GB]=BlueDevil Wizard
|
||
+Comment[es]=Asistente de BlueDevil
|
||
+Comment[fi]=Opastettu BlueDevil-toiminto
|
||
+Comment[fr]=Assistant pour BlueDevil
|
||
+Comment[it]=Procedura guidata di BlueDevil
|
||
+Comment[ja]=BlueDevil ウィザード
|
||
+Comment[nb]=BlueDevil veiviser
|
||
+Comment[nl]=BlueDevil assistent
|
||
+Comment[pa]=BlueDevil ਸਹਾਇਕ
|
||
+Comment[pl]=Pomocnik BlueDevil
|
||
+Comment[pt]=Assistente BlueDevil
|
||
+Comment[pt_BR]=Assistente BlueDevil
|
||
+Comment[sk]=Sprievodca BlueDevil
|
||
+Comment[sl]=BlueDevil – čarovnik
|
||
+Comment[sr]=Блудевилов чаробњак
|
||
+Comment[sr@ijekavian]=Блудевилов чаробњак
|
||
+Comment[sr@ijekavianlatin]=BlueDevilov čarobnjak
|
||
+Comment[sr@latin]=BlueDevilov čarobnjak
|
||
+Comment[sv]=Blådjävul guide
|
||
+Comment[tr]=BlueDevil Sihirbazı
|
||
+Comment[uk]=Майстер BlueDevil
|
||
+Comment[x-test]=xxBlueDevil Wizardxx
|
||
+Comment[zh_CN]=BlueDevil 向导
|
||
+Comment[zh_TW]=BlueDevil 精靈
|
||
+
|
||
+Type=Application
|
||
+Exec=bluedevil-wizard %U
|
||
+Icon=preferences-system-bluetooth
|
||
+Terminal=false
|
||
+NoDisplay=true
|
||
+Categories=Qt;KDE;X-Bluetooth;Network;
|
||
+X-DBUS-StartupType=Unique
|
||
+X-DBUS-ServiceName=org.kde.bluedevilwizard
|
||
diff --git a/src/wizard/pages/discover.ui b/src/wizard/pages/discover.ui
|
||
index c43f080..aec410d 100644
|
||
--- a/src/wizard/pages/discover.ui
|
||
+++ b/src/wizard/pages/discover.ui
|
||
@@ -114,9 +114,6 @@
|
||
<height>40</height>
|
||
</size>
|
||
</property>
|
||
- <property name="inputMask">
|
||
- <string>999999999; </string>
|
||
- </property>
|
||
<property name="readOnly">
|
||
<bool>false</bool>
|
||
</property>
|
||
diff --git a/src/wizard/pages/discoverpage.cpp b/src/wizard/pages/discoverpage.cpp
|
||
index de3f10e..e52c885 100644
|
||
--- a/src/wizard/pages/discoverpage.cpp
|
||
+++ b/src/wizard/pages/discoverpage.cpp
|
||
@@ -26,6 +26,7 @@
|
||
#include <QListView>
|
||
#include <QLabel>
|
||
#include <QTimer>
|
||
+#include <QRegExpValidator>
|
||
|
||
#include <KLocalizedString>
|
||
#include <kiconloader.h>
|
||
@@ -36,7 +37,9 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-DiscoverPage::DiscoverPage(BlueWizard* parent): QWizardPage(parent), m_wizard(parent)
|
||
+DiscoverPage::DiscoverPage(BlueWizard *parent)
|
||
+ : QWizardPage(parent)
|
||
+ , m_wizard(parent)
|
||
{
|
||
setTitle(i18n("Select a device"));
|
||
setupUi(this);
|
||
@@ -46,12 +49,7 @@ DiscoverPage::DiscoverPage(BlueWizard* parent): QWizardPage(parent), m_wizard(pa
|
||
workingPainter->setWidget(working);
|
||
workingPainter->start();
|
||
|
||
- connect(deviceList, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this,
|
||
- SLOT(itemSelected(QListWidgetItem*)));
|
||
-}
|
||
-
|
||
-DiscoverPage::~DiscoverPage()
|
||
-{
|
||
+ connect(deviceList, &QListWidget::currentItemChanged, this, &DiscoverPage::itemSelected);
|
||
}
|
||
|
||
void DiscoverPage::initializePage()
|
||
@@ -64,19 +62,22 @@ void DiscoverPage::initializePage()
|
||
list << QWizard::CancelButton;
|
||
m_wizard->setButtonLayout(list);
|
||
|
||
- connect(Manager::self()->usableAdapter(), SIGNAL(unpairedDeviceFound(Device*)), this,
|
||
- SLOT(deviceFound(Device*)));
|
||
- connect(manualPin, SIGNAL(toggled(bool)), pinText, SLOT(setEnabled(bool)));
|
||
- connect(manualPin, SIGNAL(toggled(bool)), this, SIGNAL(completeChanged()));
|
||
- connect(pinText, SIGNAL(textChanged(QString)), m_wizard, SLOT(setPin(QString)));
|
||
- connect(pinText, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
|
||
+ QRegExp rx(QStringLiteral("[0-9]{0,9}"));
|
||
+ QRegExpValidator *validator = new QRegExpValidator(rx);
|
||
+ pinText->setValidator(validator);
|
||
+
|
||
+ connect(Manager::self()->usableAdapter(), &Adapter::unpairedDeviceFound, this, &DiscoverPage::deviceFound);
|
||
+ connect(manualPin, &QCheckBox::toggled, pinText, &QLineEdit::setEnabled);
|
||
+ connect(manualPin, &QCheckBox::toggled, this, &DiscoverPage::completeChanged);
|
||
+ connect(pinText, &QLineEdit::textChanged, m_wizard, &BlueWizard::setPin);
|
||
+ connect(pinText, &QLineEdit::textChanged, this, &DiscoverPage::completeChanged);
|
||
|
||
QMetaObject::invokeMethod(this, "startScan", Qt::QueuedConnection);
|
||
}
|
||
|
||
bool DiscoverPage::isComplete() const
|
||
{
|
||
- if (m_wizard->deviceAddress().isEmpty()) {
|
||
+ if (m_wizard->deviceAddress().isEmpty() || !m_wizard->device()) {
|
||
return false;
|
||
}
|
||
if (manualPin->isChecked() && pinText->text().isEmpty()) {
|
||
@@ -106,7 +107,7 @@ void DiscoverPage::stopScan()
|
||
}
|
||
}
|
||
|
||
-void DiscoverPage::deviceFound(Device* device)
|
||
+void DiscoverPage::deviceFound(Device *device)
|
||
{
|
||
QString address = device->address();
|
||
QString name = device->name();
|
||
@@ -136,14 +137,14 @@ void DiscoverPage::deviceFound(Device* device)
|
||
m_itemRelation[address]->setIcon(QIcon::fromTheme(icon));
|
||
m_itemRelation[address]->setData(Qt::UserRole + 1, origName);
|
||
|
||
- //If the device was selected but it didn't had a name, select it again
|
||
+ // If the device was selected but it didn't had a name, select it again
|
||
if (deviceList->currentItem() == m_itemRelation[address]) {
|
||
itemSelected(m_itemRelation[address]);
|
||
}
|
||
return;
|
||
}
|
||
|
||
- connect(device, SIGNAL(propertyChanged(QString,QVariant)), SLOT(devicePropertyChanged()));
|
||
+ connect(device, &Device::propertyChanged, this, &DiscoverPage::devicePropertyChanged);
|
||
|
||
QListWidgetItem *item = new QListWidgetItem(QIcon::fromTheme(icon), name, deviceList);
|
||
|
||
@@ -156,20 +157,20 @@ void DiscoverPage::deviceFound(Device* device)
|
||
deviceList->setCurrentItem(m_itemRelation[address]);
|
||
}
|
||
|
||
- //If the device has been preselected via arguments, select it
|
||
+ // If the device has been preselected via arguments, select it
|
||
if (m_wizard->preselectedAddress() == address.toLower()) {
|
||
deviceList->setCurrentItem(m_itemRelation[address]);
|
||
}
|
||
}
|
||
|
||
-void DiscoverPage::itemSelected(QListWidgetItem* item)
|
||
+void DiscoverPage::itemSelected(QListWidgetItem *item)
|
||
{
|
||
bool origName = item->data(Qt::UserRole+1).toBool();
|
||
if (origName) {
|
||
QString address = item->data(Qt::UserRole).toString();
|
||
- m_wizard->setDeviceAddress(address.toUtf8());
|
||
+ m_wizard->setDeviceAddress(address);
|
||
} else {
|
||
- m_wizard->setDeviceAddress(QByteArray());
|
||
+ m_wizard->setDeviceAddress(QString());
|
||
}
|
||
emit completeChanged();
|
||
}
|
||
@@ -184,7 +185,6 @@ void DiscoverPage::devicePropertyChanged()
|
||
|
||
int DiscoverPage::nextId() const
|
||
{
|
||
- qCDebug(WIZARD);
|
||
if (!isComplete()) {
|
||
return BlueWizard::Discover;
|
||
}
|
||
@@ -193,7 +193,7 @@ int DiscoverPage::nextId() const
|
||
return BlueWizard::Discover;
|
||
}
|
||
|
||
- if (m_wizard->deviceAddress().isEmpty()) {
|
||
+ if (m_wizard->deviceAddress().isEmpty() || !m_wizard->device()) {
|
||
return BlueWizard::Discover;
|
||
}
|
||
|
||
@@ -223,20 +223,20 @@ int DiscoverPage::nextId() const
|
||
qCDebug(WIZARD) << "From DB: " << m_wizard->agent()->isFromDatabase();
|
||
qCDebug(WIZARD) << "PIN: " << m_wizard->agent()->pin();
|
||
|
||
- //If keyboard no matter what, we go to the keyboard page.
|
||
+ // If keyboard no matter what, we go to the keyboard page.
|
||
if (classToType(device->deviceClass()) == BLUETOOTH_TYPE_KEYBOARD) {
|
||
qCDebug(WIZARD) << "Keyboard Pairing";
|
||
return BlueWizard::KeyboardPairing;
|
||
}
|
||
|
||
- //If pin == NULL means that not pairing is required
|
||
+ // If pin == NULL means that not pairing is required
|
||
if (!device->hasLegacyPairing() && !m_wizard->agent()->isFromDatabase()) {
|
||
qCDebug(WIZARD) << "Secure Pairing";
|
||
return BlueWizard::SSPPairing;
|
||
}
|
||
|
||
if (pin == QLatin1String("NULL")) {
|
||
- qCDebug(WIZARD) << "NO Pairing";
|
||
+ qCDebug(WIZARD) << "No Pairing";
|
||
return BlueWizard::NoPairing;
|
||
}
|
||
|
||
diff --git a/src/wizard/pages/discoverpage.h b/src/wizard/pages/discoverpage.h
|
||
index 86afbea..5d310e7 100644
|
||
--- a/src/wizard/pages/discoverpage.h
|
||
+++ b/src/wizard/pages/discoverpage.h
|
||
@@ -23,33 +23,34 @@
|
||
|
||
class BlueWizard;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
}
|
||
-using namespace BlueDevil;
|
||
|
||
class DiscoverPage : public QWizardPage, public Ui::Discover
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- DiscoverPage(BlueWizard* parent = 0);
|
||
- virtual ~DiscoverPage();
|
||
+ explicit DiscoverPage(BlueWizard *parent = 0);
|
||
+
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
+ bool isComplete() const Q_DECL_OVERRIDE;
|
||
+ int nextId() const Q_DECL_OVERRIDE;
|
||
|
||
- virtual void initializePage();
|
||
- virtual bool isComplete() const;
|
||
- virtual int nextId() const;
|
||
private Q_SLOTS:
|
||
void startScan();
|
||
- void deviceFound(Device * device);
|
||
- void itemSelected(QListWidgetItem* item);
|
||
+ void deviceFound(BlueDevil::Device *device);
|
||
+ void itemSelected(QListWidgetItem *item);
|
||
void devicePropertyChanged();
|
||
+
|
||
private:
|
||
void stopScan();
|
||
|
||
private:
|
||
QMap<QString, QListWidgetItem*> m_itemRelation;
|
||
- Device *m_selectedDevice;
|
||
+ BlueDevil::Device *m_selectedDevice;
|
||
BlueWizard *m_wizard;
|
||
};
|
||
|
||
diff --git a/src/wizard/pages/fail.cpp b/src/wizard/pages/fail.cpp
|
||
index 422920f..6abbeeb 100644
|
||
--- a/src/wizard/pages/fail.cpp
|
||
+++ b/src/wizard/pages/fail.cpp
|
||
@@ -35,20 +35,21 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-FailPage::FailPage(BlueWizard* parent)
|
||
+FailPage::FailPage(BlueWizard *parent)
|
||
: QWizardPage(parent)
|
||
, m_wizard(parent)
|
||
{
|
||
setupUi(this);
|
||
+
|
||
+ failIcon->setPixmap(QIcon::fromTheme(QStringLiteral("task-reject")).pixmap(48));
|
||
}
|
||
|
||
void FailPage::initializePage()
|
||
{
|
||
- qCDebug(WIZARD);
|
||
QPushButton *reset = new QPushButton(this);
|
||
KGuiItem::assign(reset, KStandardGuiItem::reset());
|
||
reset->setText(i18nc("Button offered when the wizard fail. This button will restart the wizard", "Restart the wizard"));
|
||
- connect(reset, SIGNAL(clicked(bool)), m_wizard, SLOT(restartWizard()));
|
||
+ connect(reset, &QPushButton::clicked, m_wizard, &BlueWizard::restartWizard);
|
||
|
||
m_wizard->setButton(QWizard::CustomButton3, reset);
|
||
m_wizard->setButtonText(QWizard::CancelButton, i18nc("Button that closes the wizard", "Close"));
|
||
@@ -60,11 +61,10 @@ void FailPage::initializePage()
|
||
|
||
m_wizard->setButtonLayout(list);
|
||
|
||
- QString deviceName = m_wizard->device()->name();
|
||
+ const QString &deviceName = m_wizard->device()->name();
|
||
if (deviceName.isEmpty()) {
|
||
failLbl->setText(i18nc("This string is shown when the wizard fail","The setup of the device has failed"));
|
||
} else {
|
||
failLbl->setText(i18n("The setup of %1 has failed", deviceName));
|
||
}
|
||
-
|
||
}
|
||
diff --git a/src/wizard/pages/fail.h b/src/wizard/pages/fail.h
|
||
index 4b734c4..fa6378f 100644
|
||
--- a/src/wizard/pages/fail.h
|
||
+++ b/src/wizard/pages/fail.h
|
||
@@ -29,7 +29,8 @@
|
||
class BlueWizard;
|
||
class KPixmapSequenceOverlayPainter;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
class Adapter;
|
||
}
|
||
@@ -38,12 +39,12 @@ using namespace BlueDevil;
|
||
|
||
class FailPage : public QWizardPage, Ui::Fail
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- FailPage(BlueWizard* parent = 0);
|
||
+ explicit FailPage(BlueWizard *parent = 0);
|
||
|
||
- virtual void initializePage();
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
|
||
private:
|
||
BlueWizard *m_wizard;
|
||
diff --git a/src/wizard/pages/fail.ui b/src/wizard/pages/fail.ui
|
||
index 0470e8f..375a4fb 100644
|
||
--- a/src/wizard/pages/fail.ui
|
||
+++ b/src/wizard/pages/fail.ui
|
||
@@ -30,6 +30,16 @@
|
||
</spacer>
|
||
</item>
|
||
<item>
|
||
+ <widget class="QLabel" name="failIcon">
|
||
+ <property name="maximumSize">
|
||
+ <size>
|
||
+ <width>48</width>
|
||
+ <height>48</height>
|
||
+ </size>
|
||
+ </property>
|
||
+ </widget>
|
||
+ </item>
|
||
+ <item>
|
||
<widget class="QLabel" name="failLbl">
|
||
<property name="text">
|
||
<string/>
|
||
diff --git a/src/wizard/pages/keyboardpairing.cpp b/src/wizard/pages/keyboardpairing.cpp
|
||
index 67c7f27..4b552ba 100644
|
||
--- a/src/wizard/pages/keyboardpairing.cpp
|
||
+++ b/src/wizard/pages/keyboardpairing.cpp
|
||
@@ -35,11 +35,12 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-KeyboardPairingPage::KeyboardPairingPage(BlueWizard* parent)
|
||
+KeyboardPairingPage::KeyboardPairingPage(BlueWizard *parent)
|
||
: QWizardPage(parent)
|
||
, m_wizard(parent)
|
||
{
|
||
setupUi(this);
|
||
+
|
||
m_working = new KPixmapSequenceOverlayPainter(this);
|
||
m_working->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), 22));
|
||
m_working->setWidget(pinNumber);
|
||
@@ -53,13 +54,12 @@ KeyboardPairingPage::KeyboardPairingPage(BlueWizard* parent)
|
||
|
||
void KeyboardPairingPage::initializePage()
|
||
{
|
||
- qCDebug(WIZARD);
|
||
m_wizard->setButtonLayout(wizardButtonsLayout());
|
||
|
||
- connect(m_wizard->agent(), SIGNAL(pinRequested(QString)), this, SLOT(pinRequested(QString)));
|
||
+ connect(m_wizard->agent(), &WizardAgent::pinRequested, this, &KeyboardPairingPage::pinRequested);
|
||
|
||
Device *device = m_wizard->device();
|
||
- connect(device, SIGNAL(pairedChanged(bool)), this, SLOT(pairedChanged(bool)));
|
||
+ connect(device, &Device::pairedChanged, this, &KeyboardPairingPage::pairedChanged);
|
||
device->pair();
|
||
}
|
||
|
||
@@ -72,6 +72,7 @@ void KeyboardPairingPage::pinRequested(const QString& pin)
|
||
void KeyboardPairingPage::pairedChanged(bool paired)
|
||
{
|
||
qCDebug(WIZARD) << paired;
|
||
+
|
||
m_wizard->next();
|
||
}
|
||
|
||
@@ -90,6 +91,5 @@ QList<QWizard::WizardButton> KeyboardPairingPage::wizardButtonsLayout() const
|
||
QList <QWizard::WizardButton> list;
|
||
list << QWizard::Stretch;
|
||
list << QWizard::CancelButton;
|
||
-
|
||
return list;
|
||
}
|
||
diff --git a/src/wizard/pages/keyboardpairing.h b/src/wizard/pages/keyboardpairing.h
|
||
index 14818f6..871295b 100644
|
||
--- a/src/wizard/pages/keyboardpairing.h
|
||
+++ b/src/wizard/pages/keyboardpairing.h
|
||
@@ -29,7 +29,8 @@
|
||
class BlueWizard;
|
||
class KPixmapSequenceOverlayPainter;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
class Adapter;
|
||
}
|
||
@@ -38,24 +39,24 @@ using namespace BlueDevil;
|
||
|
||
class KeyboardPairingPage : public QWizardPage, Ui::KeyboardPairing
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- KeyboardPairingPage(BlueWizard* parent = 0);
|
||
+ explicit KeyboardPairingPage(BlueWizard *parent = 0);
|
||
|
||
- virtual void initializePage();
|
||
- virtual bool validatePage();
|
||
- virtual int nextId() const;
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
+ bool validatePage() Q_DECL_OVERRIDE;
|
||
+ int nextId() const Q_DECL_OVERRIDE;
|
||
|
||
public Q_SLOTS:
|
||
void pinRequested(const QString &pin);
|
||
void pairedChanged(bool paired);
|
||
|
||
protected:
|
||
- QList <QWizard::WizardButton> wizardButtonsLayout() const;
|
||
+ QList<QWizard::WizardButton> wizardButtonsLayout() const;
|
||
|
||
private:
|
||
- BlueWizard *m_wizard;
|
||
+ BlueWizard *m_wizard;
|
||
KPixmapSequenceOverlayPainter *m_working;
|
||
};
|
||
|
||
diff --git a/src/wizard/pages/legacypairing.cpp b/src/wizard/pages/legacypairing.cpp
|
||
index 898c699..943a107 100644
|
||
--- a/src/wizard/pages/legacypairing.cpp
|
||
+++ b/src/wizard/pages/legacypairing.cpp
|
||
@@ -35,11 +35,12 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-LegacyPairingPage::LegacyPairingPage(BlueWizard* parent)
|
||
+LegacyPairingPage::LegacyPairingPage(BlueWizard *parent)
|
||
: QWizardPage(parent)
|
||
, m_wizard(parent)
|
||
{
|
||
setupUi(this);
|
||
+
|
||
m_working = new KPixmapSequenceOverlayPainter(this);
|
||
m_working->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), 22));
|
||
m_working->setWidget(pinNumber);
|
||
@@ -53,17 +54,16 @@ LegacyPairingPage::LegacyPairingPage(BlueWizard* parent)
|
||
|
||
void LegacyPairingPage::initializePage()
|
||
{
|
||
- qCDebug(WIZARD);
|
||
m_wizard->setButtonLayout(wizardButtonsLayout());
|
||
|
||
Device *device = m_wizard->device();
|
||
- connect(m_wizard->agent(), SIGNAL(pinRequested(QString)), this, SLOT(pinRequested(QString)));
|
||
- connect(device, SIGNAL(pairedChanged(bool)), this, SLOT(pairedChanged(bool)));
|
||
+ connect(m_wizard->agent(), &WizardAgent::pinRequested, this, &LegacyPairingPage::pinRequested);
|
||
+ connect(device, &Device::pairedChanged, this, &LegacyPairingPage::pairedChanged);
|
||
|
||
device->pair();
|
||
}
|
||
|
||
-void LegacyPairingPage::pinRequested(const QString& pin)
|
||
+void LegacyPairingPage::pinRequested(const QString &pin)
|
||
{
|
||
m_working->stop();
|
||
pinNumber->setText(pin);
|
||
@@ -72,6 +72,7 @@ void LegacyPairingPage::pinRequested(const QString& pin)
|
||
void LegacyPairingPage::pairedChanged(bool paired)
|
||
{
|
||
qCDebug(WIZARD) << paired;
|
||
+
|
||
m_wizard->next();
|
||
}
|
||
|
||
@@ -90,6 +91,5 @@ QList<QWizard::WizardButton> LegacyPairingPage::wizardButtonsLayout() const
|
||
QList <QWizard::WizardButton> list;
|
||
list << QWizard::Stretch;
|
||
list << QWizard::CancelButton;
|
||
-
|
||
return list;
|
||
}
|
||
diff --git a/src/wizard/pages/legacypairing.h b/src/wizard/pages/legacypairing.h
|
||
index f9ec3d4..671743b 100644
|
||
--- a/src/wizard/pages/legacypairing.h
|
||
+++ b/src/wizard/pages/legacypairing.h
|
||
@@ -29,23 +29,22 @@
|
||
class BlueWizard;
|
||
class KPixmapSequenceOverlayPainter;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
class Adapter;
|
||
}
|
||
|
||
-using namespace BlueDevil;
|
||
-
|
||
class LegacyPairingPage : public QWizardPage, Ui::LegacyPairing
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- LegacyPairingPage(BlueWizard* parent = 0);
|
||
+ explicit LegacyPairingPage(BlueWizard *parent = 0);
|
||
|
||
- virtual void initializePage();
|
||
- virtual bool validatePage();
|
||
- virtual int nextId() const;
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
+ bool validatePage() Q_DECL_OVERRIDE;
|
||
+ int nextId() const Q_DECL_OVERRIDE;
|
||
|
||
public Q_SLOTS:
|
||
void pinRequested(const QString &pin);
|
||
@@ -55,7 +54,7 @@ protected:
|
||
QList <QWizard::WizardButton> wizardButtonsLayout() const;
|
||
|
||
private:
|
||
- BlueWizard *m_wizard;
|
||
+ BlueWizard *m_wizard;
|
||
KPixmapSequenceOverlayPainter *m_working;
|
||
};
|
||
|
||
diff --git a/src/wizard/pages/legacypairingdatabase.cpp b/src/wizard/pages/legacypairingdatabase.cpp
|
||
index a31657c..61dcde0 100644
|
||
--- a/src/wizard/pages/legacypairingdatabase.cpp
|
||
+++ b/src/wizard/pages/legacypairingdatabase.cpp
|
||
@@ -36,11 +36,12 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-LegacyPairingPageDatabase::LegacyPairingPageDatabase(BlueWizard* parent)
|
||
+LegacyPairingPageDatabase::LegacyPairingPageDatabase(BlueWizard *parent)
|
||
: QWizardPage(parent)
|
||
, m_wizard(parent)
|
||
{
|
||
setupUi(this);
|
||
+
|
||
m_working = new KPixmapSequenceOverlayPainter(this);
|
||
m_working->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), 22));
|
||
m_working->setWidget(working);
|
||
@@ -54,13 +55,14 @@ void LegacyPairingPageDatabase::initializePage()
|
||
Device *device = m_wizard->device();
|
||
connecting->setText(i18n("Connecting to %1...", device->name()));
|
||
|
||
- connect(device, SIGNAL(pairedChanged(bool)), this, SLOT(pairedChanged(bool)));
|
||
+ connect(device, &Device::pairedChanged, this, &LegacyPairingPageDatabase::pairedChanged);
|
||
device->pair();
|
||
}
|
||
|
||
void LegacyPairingPageDatabase::pairedChanged(bool paired)
|
||
{
|
||
qCDebug(WIZARD) << paired;
|
||
+
|
||
m_wizard->next();
|
||
}
|
||
|
||
@@ -79,6 +81,5 @@ QList< QWizard::WizardButton > LegacyPairingPageDatabase::wizardButtonsLayout()
|
||
QList <QWizard::WizardButton> list;
|
||
list << QWizard::Stretch;
|
||
list << QWizard::CancelButton;
|
||
-
|
||
return list;
|
||
}
|
||
diff --git a/src/wizard/pages/legacypairingdatabase.h b/src/wizard/pages/legacypairingdatabase.h
|
||
index 00c9d16..637c82e 100644
|
||
--- a/src/wizard/pages/legacypairingdatabase.h
|
||
+++ b/src/wizard/pages/legacypairingdatabase.h
|
||
@@ -29,32 +29,31 @@
|
||
class BlueWizard;
|
||
class KPixmapSequenceOverlayPainter;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
class Adapter;
|
||
}
|
||
|
||
-using namespace BlueDevil;
|
||
-
|
||
class LegacyPairingPageDatabase : public QWizardPage, Ui::NoPairing
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- LegacyPairingPageDatabase(BlueWizard* parent = 0);
|
||
+ explicit LegacyPairingPageDatabase(BlueWizard *parent = 0);
|
||
|
||
- virtual void initializePage();
|
||
- virtual bool validatePage();
|
||
- virtual int nextId() const;
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
+ bool validatePage() Q_DECL_OVERRIDE;
|
||
+ int nextId() const Q_DECL_OVERRIDE;
|
||
|
||
public Q_SLOTS:
|
||
void pairedChanged(bool paired);
|
||
|
||
protected:
|
||
- QList <QWizard::WizardButton> wizardButtonsLayout() const;
|
||
+ QList<QWizard::WizardButton> wizardButtonsLayout() const;
|
||
|
||
private:
|
||
- BlueWizard *m_wizard;
|
||
+ BlueWizard *m_wizard;
|
||
KPixmapSequenceOverlayPainter *m_working;
|
||
};
|
||
|
||
diff --git a/src/wizard/pages/nopairing.cpp b/src/wizard/pages/nopairing.cpp
|
||
index c0410e1..d4f1e45 100644
|
||
--- a/src/wizard/pages/nopairing.cpp
|
||
+++ b/src/wizard/pages/nopairing.cpp
|
||
@@ -35,59 +35,52 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-NoPairingPage::NoPairingPage(BlueWizard* parent) : QWizardPage(parent)
|
||
-, m_validPage(false)
|
||
-, m_wizard(parent)
|
||
+NoPairingPage::NoPairingPage(BlueWizard *parent)
|
||
+ : QWizardPage(parent)
|
||
+ , m_success(false)
|
||
+ , m_wizard(parent)
|
||
{
|
||
setupUi(this);
|
||
+
|
||
m_working = new KPixmapSequenceOverlayPainter(this);
|
||
m_working->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), 22));
|
||
m_working->setWidget(working);
|
||
m_working->start();
|
||
}
|
||
|
||
+int NoPairingPage::nextId() const
|
||
+{
|
||
+ if (m_success) {
|
||
+ return BlueWizard::Success;
|
||
+ }
|
||
+ return BlueWizard::Fail;
|
||
+}
|
||
+
|
||
void NoPairingPage::initializePage()
|
||
{
|
||
- qCDebug(WIZARD);
|
||
m_wizard->setButtonLayout(wizardButtonsLayout());
|
||
|
||
connecting->setText(connecting->text().append(m_wizard->device()->name()));
|
||
|
||
- //It can happen that the device is technically connected and trusted but we are not connected
|
||
- //to the profile. We have no way to know if the profile was activated or not so we have to relay
|
||
- //on a timeout (10s)
|
||
- QTimer::singleShot(10000, this, SLOT(timeout()));
|
||
- connect(m_wizard->device(), SIGNAL(connectedChanged(bool)), SLOT(connectedChanged(bool)));
|
||
- connect(m_wizard->device(), SIGNAL(trustedChanged(bool)), SLOT(connectedChanged(bool)));
|
||
+ connect(m_wizard->device(), &Device::connectedChanged, this, &NoPairingPage::connectedChanged);
|
||
+ connect(m_wizard->device(), &Device::trustedChanged, this, &NoPairingPage::connectedChanged);
|
||
|
||
m_wizard->device()->connectDevice();
|
||
m_wizard->device()->setTrusted(true);
|
||
-}
|
||
|
||
-void NoPairingPage::timeout()
|
||
-{
|
||
- connectedChanged(true);
|
||
+ QTimer::singleShot(10 * 1000, this, [this]() {
|
||
+ connectedChanged(true);
|
||
+ });
|
||
}
|
||
|
||
void NoPairingPage::connectedChanged(bool connected)
|
||
{
|
||
- qCDebug(WIZARD);
|
||
+ qCDebug(WIZARD) << "Connect finished" << connected;
|
||
|
||
- m_validPage = connected;
|
||
- if (m_validPage) {
|
||
- qCDebug(WIZARD) << "Done";
|
||
- m_wizard->done(0);
|
||
- }
|
||
-}
|
||
-
|
||
-bool NoPairingPage::validatePage()
|
||
-{
|
||
- return m_validPage;
|
||
-}
|
||
-
|
||
-int NoPairingPage::nextId() const
|
||
-{
|
||
- return -1;
|
||
+ // Connect may fail but that doesn't really mean the device was setup incorrectly
|
||
+ // Device::connectDevice will fail eg. when A2DP profile could not be connected due to missing pulseaudio plugin
|
||
+ m_success = true;
|
||
+ QTimer::singleShot(500, m_wizard, &BlueWizard::next);
|
||
}
|
||
|
||
QList<QWizard::WizardButton> NoPairingPage::wizardButtonsLayout() const
|
||
@@ -95,6 +88,5 @@ QList<QWizard::WizardButton> NoPairingPage::wizardButtonsLayout() const
|
||
QList <QWizard::WizardButton> list;
|
||
list << QWizard::Stretch;
|
||
list << QWizard::CancelButton;
|
||
-
|
||
return list;
|
||
}
|
||
diff --git a/src/wizard/pages/nopairing.h b/src/wizard/pages/nopairing.h
|
||
index 26f1441..1f0a8ab 100644
|
||
--- a/src/wizard/pages/nopairing.h
|
||
+++ b/src/wizard/pages/nopairing.h
|
||
@@ -30,34 +30,31 @@
|
||
class BlueWizard;
|
||
class KPixmapSequenceOverlayPainter;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
class Adapter;
|
||
}
|
||
|
||
-using namespace BlueDevil;
|
||
-
|
||
class NoPairingPage : public QWizardPage, Ui::NoPairing
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- NoPairingPage(BlueWizard* parent = 0);
|
||
+ explicit NoPairingPage(BlueWizard *parent = 0);
|
||
|
||
- virtual void initializePage();
|
||
- virtual bool validatePage();
|
||
- virtual int nextId() const;
|
||
+ int nextId() const Q_DECL_OVERRIDE;
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
|
||
protected:
|
||
- QList <QWizard::WizardButton> wizardButtonsLayout() const;
|
||
+ QList<QWizard::WizardButton> wizardButtonsLayout() const;
|
||
|
||
private Q_SLOTS:
|
||
- void timeout();
|
||
void connectedChanged(bool connected);
|
||
|
||
private:
|
||
- bool m_validPage;
|
||
- BlueWizard *m_wizard;
|
||
+ bool m_success;
|
||
+ BlueWizard *m_wizard;
|
||
KPixmapSequenceOverlayPainter *m_working;
|
||
};
|
||
|
||
diff --git a/src/wizard/pages/ssppairing.cpp b/src/wizard/pages/ssppairing.cpp
|
||
index 963bdaa..d9e2b0a 100644
|
||
--- a/src/wizard/pages/ssppairing.cpp
|
||
+++ b/src/wizard/pages/ssppairing.cpp
|
||
@@ -38,12 +38,13 @@
|
||
|
||
using namespace BlueDevil;
|
||
|
||
-SSPPairingPage::SSPPairingPage(BlueWizard* parent)
|
||
+SSPPairingPage::SSPPairingPage(BlueWizard *parent)
|
||
: QWizardPage(parent)
|
||
, m_buttonClicked(QWizard::NoButton)
|
||
, m_wizard(parent)
|
||
{
|
||
setupUi(this);
|
||
+
|
||
m_working = new KPixmapSequenceOverlayPainter(this);
|
||
m_working->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), 22));
|
||
m_working->setWidget(pinNumber);
|
||
@@ -57,7 +58,6 @@ SSPPairingPage::SSPPairingPage(BlueWizard* parent)
|
||
|
||
void SSPPairingPage::initializePage()
|
||
{
|
||
- qCDebug(WIZARD);
|
||
QList <QWizard::WizardButton> list;
|
||
list << QWizard::Stretch;
|
||
list << QWizard::CancelButton;
|
||
@@ -66,17 +66,17 @@ void SSPPairingPage::initializePage()
|
||
Device *device = m_wizard->device();
|
||
confirmLbl->setText(i18n("Connecting to %1...", device->name()));
|
||
|
||
- connect(device, SIGNAL(pairedChanged(bool)), this, SLOT(pairedChanged(bool)));
|
||
- connect(m_wizard->agent(), SIGNAL(confirmationRequested(quint32,QDBusMessage)),
|
||
- this, SLOT(confirmationRequested(quint32,QDBusMessage)));
|
||
- connect(m_wizard->agent(), SIGNAL(pinRequested(QString)), SLOT(pinRequested(QString)));
|
||
+ connect(device, &Device::pairedChanged, this, &SSPPairingPage::pairedChanged);
|
||
+ connect(m_wizard->agent(), &WizardAgent::confirmationRequested, this, &SSPPairingPage::confirmationRequested);
|
||
+ connect(m_wizard->agent(), &WizardAgent::pinRequested, this, &SSPPairingPage::pinRequested);
|
||
|
||
device->pair();
|
||
}
|
||
|
||
-void SSPPairingPage::confirmationRequested(quint32 passkey, const QDBusMessage& msg)
|
||
+void SSPPairingPage::confirmationRequested(quint32 passkey, const QDBusMessage &msg)
|
||
{
|
||
m_msg = msg;
|
||
+ m_msg.setDelayedReply(true);
|
||
|
||
QPushButton *matches = new QPushButton(this);
|
||
KGuiItem::assign(matches, KStandardGuiItem::apply());
|
||
@@ -86,8 +86,8 @@ void SSPPairingPage::confirmationRequested(quint32 passkey, const QDBusMessage&
|
||
KGuiItem::assign(notMatch, KStandardGuiItem::cancel());
|
||
notMatch->setText(i18n("Does not match"));
|
||
|
||
- connect(matches, SIGNAL(clicked(bool)), this, SLOT(matchesClicked()));
|
||
- connect(notMatch, SIGNAL(clicked(bool)), this, SLOT(notMatchClicked()));
|
||
+ connect(matches, &QPushButton::clicked, this, &SSPPairingPage::matchesClicked);
|
||
+ connect(notMatch, &QPushButton::clicked, this, &SSPPairingPage::notMatchClicked);
|
||
|
||
wizard()->setButton(QWizard::CustomButton1, matches);
|
||
wizard()->setButton(QWizard::CustomButton2, notMatch);
|
||
@@ -101,7 +101,7 @@ void SSPPairingPage::confirmationRequested(quint32 passkey, const QDBusMessage&
|
||
|
||
}
|
||
|
||
-void SSPPairingPage::pinRequested(const QString& pin)
|
||
+void SSPPairingPage::pinRequested(const QString &pin)
|
||
{
|
||
m_working->stop();
|
||
pinNumber->setText(pin);
|
||
@@ -129,6 +129,7 @@ void SSPPairingPage::matchesClicked()
|
||
void SSPPairingPage::notMatchClicked()
|
||
{
|
||
m_buttonClicked = QWizard::CustomButton2;
|
||
+ QDBusConnection::systemBus().send(m_msg.createErrorReply(QStringLiteral("org.bluez.Rejected"), QStringLiteral("Rejected")));
|
||
|
||
wizard()->next();
|
||
}
|
||
@@ -163,6 +164,5 @@ QList<QWizard::WizardButton> SSPPairingPage::wizardButtonsLayout() const
|
||
list << QWizard::Stretch;
|
||
list << QWizard::CustomButton2;
|
||
list << QWizard::CustomButton1;
|
||
-
|
||
return list;
|
||
}
|
||
diff --git a/src/wizard/pages/ssppairing.h b/src/wizard/pages/ssppairing.h
|
||
index 9b7066d..1cd2aa8 100644
|
||
--- a/src/wizard/pages/ssppairing.h
|
||
+++ b/src/wizard/pages/ssppairing.h
|
||
@@ -30,23 +30,22 @@
|
||
class BlueWizard;
|
||
class KPixmapSequenceOverlayPainter;
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
class Adapter;
|
||
}
|
||
|
||
-using namespace BlueDevil;
|
||
-
|
||
class SSPPairingPage : public QWizardPage, Ui::SSPPairing
|
||
{
|
||
-Q_OBJECT
|
||
+ Q_OBJECT
|
||
|
||
public:
|
||
- SSPPairingPage(BlueWizard* parent = 0);
|
||
+ explicit SSPPairingPage(BlueWizard *parent = 0);
|
||
|
||
- virtual void initializePage();
|
||
- virtual int nextId() const;
|
||
- virtual bool validatePage();
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
+ int nextId() const Q_DECL_OVERRIDE;
|
||
+ bool validatePage() Q_DECL_OVERRIDE;
|
||
|
||
public Q_SLOTS:
|
||
void confirmationRequested(quint32 passkey, const QDBusMessage &msg);
|
||
@@ -56,12 +55,12 @@ public Q_SLOTS:
|
||
void pinRequested(const QString &pin);
|
||
|
||
protected:
|
||
- QList <QWizard::WizardButton> wizardButtonsLayout() const;
|
||
+ QList<QWizard::WizardButton> wizardButtonsLayout() const;
|
||
|
||
private:
|
||
- QDBusMessage m_msg;
|
||
- QWizard::WizardButton m_buttonClicked;
|
||
- BlueWizard *m_wizard;
|
||
+ QDBusMessage m_msg;
|
||
+ QWizard::WizardButton m_buttonClicked;
|
||
+ BlueWizard *m_wizard;
|
||
KPixmapSequenceOverlayPainter *m_working;
|
||
};
|
||
|
||
diff --git a/src/wizard/pages/success.cpp b/src/wizard/pages/success.cpp
|
||
new file mode 100644
|
||
index 0000000..f49bb7f
|
||
--- /dev/null
|
||
+++ b/src/wizard/pages/success.cpp
|
||
@@ -0,0 +1,66 @@
|
||
+/*****************************************************************************
|
||
+ * This file is part of the KDE project *
|
||
+ * *
|
||
+ * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org> *
|
||
+ * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com> *
|
||
+ * Copyright (C) 2014 David Rosca <nowrep@gmail.com> *
|
||
+ * *
|
||
+ * This library is free software; you can redistribute it and/or *
|
||
+ * modify it under the terms of the GNU Library General Public *
|
||
+ * License as published by the Free Software Foundation; either *
|
||
+ * version 2 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 *
|
||
+ * Library 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 "success.h"
|
||
+#include "bluewizard.h"
|
||
+#include "debug_p.h"
|
||
+
|
||
+#include <QIcon>
|
||
+
|
||
+#include <KLocalizedString>
|
||
+
|
||
+#include <bluedevil/bluedevildevice.h>
|
||
+
|
||
+SuccessPage::SuccessPage(BlueWizard *parent)
|
||
+ : QWizardPage(parent)
|
||
+ , m_wizard(parent)
|
||
+{
|
||
+ setupUi(this);
|
||
+
|
||
+ successIcon->setPixmap(QIcon::fromTheme(QStringLiteral("task-complete")).pixmap(48));
|
||
+}
|
||
+
|
||
+void SuccessPage::initializePage()
|
||
+{
|
||
+ qCDebug(WIZARD) << "Initialize Success Page";
|
||
+
|
||
+ QList<QWizard::WizardButton> list;
|
||
+ list << QWizard::Stretch;
|
||
+ list << QWizard::FinishButton;
|
||
+
|
||
+ m_wizard->setButtonLayout(list);
|
||
+
|
||
+ setFinalPage(true);
|
||
+
|
||
+ QString deviceName = m_wizard->device()->name();
|
||
+ if (deviceName.isEmpty()) {
|
||
+ successLbl->setText(i18nc("This string is shown when the wizard succeeds", "The setup of the device has succeeded"));
|
||
+ } else {
|
||
+ successLbl->setText(i18n("The setup of %1 has succeeded", deviceName));
|
||
+ }
|
||
+}
|
||
+
|
||
+int SuccessPage::nextId() const
|
||
+{
|
||
+ return -1;
|
||
+}
|
||
diff --git a/src/wizard/pages/success.h b/src/wizard/pages/success.h
|
||
new file mode 100644
|
||
index 0000000..ba0d73c
|
||
--- /dev/null
|
||
+++ b/src/wizard/pages/success.h
|
||
@@ -0,0 +1,46 @@
|
||
+/*****************************************************************************
|
||
+ * This file is part of the KDE project *
|
||
+ * *
|
||
+ * Copyright (C) 2010 Alejandro Fiestas Olivares <afiestas@kde.org> *
|
||
+ * Copyright (C) 2010-2011 UFO Coders <info@ufocoders.com> *
|
||
+ * Copyright (C) 2014 David Rosca <nowrep@gmail.com> *
|
||
+ * *
|
||
+ * This library is free software; you can redistribute it and/or *
|
||
+ * modify it under the terms of the GNU Library General Public *
|
||
+ * License as published by the Free Software Foundation; either *
|
||
+ * version 2 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 *
|
||
+ * Library 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 SUCCESS_H
|
||
+#define SUCCESS_H
|
||
+
|
||
+#include "ui_success.h"
|
||
+#include <QWizardPage>
|
||
+
|
||
+class BlueWizard;
|
||
+
|
||
+class SuccessPage : public QWizardPage, Ui::Success
|
||
+{
|
||
+ Q_OBJECT
|
||
+
|
||
+public:
|
||
+ explicit SuccessPage(BlueWizard *parent = 0);
|
||
+
|
||
+ void initializePage() Q_DECL_OVERRIDE;
|
||
+ int nextId() const Q_DECL_OVERRIDE;
|
||
+
|
||
+private:
|
||
+ BlueWizard *m_wizard;
|
||
+};
|
||
+
|
||
+#endif // SUCCESS_H
|
||
diff --git a/src/wizard/pages/success.ui b/src/wizard/pages/success.ui
|
||
new file mode 100644
|
||
index 0000000..3630db3
|
||
--- /dev/null
|
||
+++ b/src/wizard/pages/success.ui
|
||
@@ -0,0 +1,68 @@
|
||
+<?xml version="1.0" encoding="UTF-8"?>
|
||
+<ui version="4.0">
|
||
+ <class>Success</class>
|
||
+ <widget class="QWidget" name="Success">
|
||
+ <property name="geometry">
|
||
+ <rect>
|
||
+ <x>0</x>
|
||
+ <y>0</y>
|
||
+ <width>400</width>
|
||
+ <height>300</height>
|
||
+ </rect>
|
||
+ </property>
|
||
+ <layout class="QVBoxLayout" name="verticalLayout">
|
||
+ <item>
|
||
+ <layout class="QHBoxLayout" name="horizontalLayout">
|
||
+ <item>
|
||
+ <spacer name="horizontalSpacer">
|
||
+ <property name="orientation">
|
||
+ <enum>Qt::Horizontal</enum>
|
||
+ </property>
|
||
+ <property name="sizeType">
|
||
+ <enum>QSizePolicy::Fixed</enum>
|
||
+ </property>
|
||
+ <property name="sizeHint" stdset="0">
|
||
+ <size>
|
||
+ <width>10</width>
|
||
+ <height>20</height>
|
||
+ </size>
|
||
+ </property>
|
||
+ </spacer>
|
||
+ </item>
|
||
+ <item>
|
||
+ <widget class="QLabel" name="successIcon">
|
||
+ <property name="maximumSize">
|
||
+ <size>
|
||
+ <width>48</width>
|
||
+ <height>48</height>
|
||
+ </size>
|
||
+ </property>
|
||
+ </widget>
|
||
+ </item>
|
||
+ <item>
|
||
+ <widget class="QLabel" name="successLbl">
|
||
+ <property name="text">
|
||
+ <string/>
|
||
+ </property>
|
||
+ </widget>
|
||
+ </item>
|
||
+ </layout>
|
||
+ </item>
|
||
+ <item>
|
||
+ <spacer name="verticalSpacer">
|
||
+ <property name="orientation">
|
||
+ <enum>Qt::Vertical</enum>
|
||
+ </property>
|
||
+ <property name="sizeHint" stdset="0">
|
||
+ <size>
|
||
+ <width>20</width>
|
||
+ <height>40</height>
|
||
+ </size>
|
||
+ </property>
|
||
+ </spacer>
|
||
+ </item>
|
||
+ </layout>
|
||
+ </widget>
|
||
+ <resources/>
|
||
+ <connections/>
|
||
+</ui>
|
||
diff --git a/src/wizard/pin-code-database.xml b/src/wizard/pin-code-database.xml
|
||
index 8239aa9..5e99392 100644
|
||
--- a/src/wizard/pin-code-database.xml
|
||
+++ b/src/wizard/pin-code-database.xml
|
||
@@ -52,9 +52,9 @@
|
||
<device type="keyboard" oui="00:13:6C:" name="TomTom Remote" pin="0000"/>
|
||
|
||
<!-- Sony PlayStation 3 Remote Control -->
|
||
- <device oui="00:19:C1:" name="BD Remote Control" pin="NULL"/>
|
||
- <device oui="00:1E:3D:" name="BD Remote Control" pin="NULL"/>
|
||
- <device oui="00:06:F5:" name="BD Remote Control" pin="NULL"/>
|
||
+ <device oui="00:19:C1:" name="PLAYSTATION(R)3 Controller" pin="NULL"/>
|
||
+ <device oui="00:1E:3D:" name="PLAYSTATION(R)3 Controller" pin="NULL"/>
|
||
+ <device oui="00:06:F5:" name="PLAYSTATION(R)3 Controller" pin="NULL"/>
|
||
|
||
<!-- Apple Wireless and Mighty Mouse
|
||
Note: Apple doesn't follow the specs, and requires their mice
|
||
diff --git a/src/wizard/wizardagent.h b/src/wizard/wizardagent.h
|
||
index 5a9ea2c..3321397 100644
|
||
--- a/src/wizard/wizardagent.h
|
||
+++ b/src/wizard/wizardagent.h
|
||
@@ -26,7 +26,8 @@
|
||
#include <QApplication>
|
||
#include <QXmlStreamReader>
|
||
|
||
-namespace BlueDevil {
|
||
+namespace BlueDevil
|
||
+{
|
||
class Device;
|
||
}
|
||
|