Commit eb45144d authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Merge branch 'master' into stable

parents 2e173046 78efe751
......@@ -37,6 +37,7 @@ GenericName[pt]=Ligue os 'smartphones' à sua Área de Trabalho do KDE
GenericName[pt_BR]=Conecte os smartphones ao Espaço de Trabalho Plasma do KDE
GenericName[sk]=Pripojiť smartfóny k vašej pracovnej ploche KDE Plasma
GenericName[sv]=Anslut smartphone till KDE Plasma arbetsyta
GenericName[tr]=Akıllı telefonları KDE Plasma Çalışma Alanı'nıza bağlayın
GenericName[uk]=З’єднання смартфонів з вашим робочим простором Плазми KDE
GenericName[x-test]=xxConnect smartphones to your KDE Plasma Workspacexx
Categories=Qt;KDE;Settings;HardwareSettings;
......
......@@ -26,6 +26,9 @@ DeviceLink::DeviceLink(const QString& deviceId, LinkProvider* parent)
, mDeviceId(deviceId)
, mLinkProvider(parent)
{
Q_ASSERT(!deviceId.isEmpty());
setProperty("deviceId", deviceId);
//gcc complains if we don't add something to compile on a class with virtual functions
}
......@@ -34,7 +34,6 @@ LanDeviceLink::LanDeviceLink(const QString& d, LinkProvider* a, QTcpSocket* sock
: DeviceLink(d, a)
, mSocketLineReader(new SocketLineReader(socket, a))
{
connect(mSocketLineReader, SIGNAL(disconnected()),
this, SLOT(deleteLater()));
connect(mSocketLineReader, SIGNAL(readyRead()),
......@@ -79,14 +78,13 @@ void LanDeviceLink::dataReceived()
if (mSocketLineReader->bytesAvailable() == 0) return;
QByteArray package = mSocketLineReader->readLine();
const QByteArray package = mSocketLineReader->readLine();
//kDebug(kdeconnect_kded()) << "LanDeviceLink dataReceived" << package;
NetworkPackage unserialized(QString::null);
NetworkPackage::unserialize(package, &unserialized);
if (unserialized.isEncrypted()) {
//mPrivateKey should always be set when device link is added to device, no null-checking done here
NetworkPackage decrypted(QString::null);
unserialized.decrypt(mPrivateKey, &decrypted);
......@@ -101,7 +99,6 @@ void LanDeviceLink::dataReceived()
Q_EMIT receivedPackage(decrypted);
} else {
if (unserialized.hasPayloadTransferInfo()) {
qWarning() << "Ignoring unencrypted payload";
}
......
This diff is collapsed.
......@@ -51,17 +51,18 @@ private Q_SLOTS:
void newUdpConnection();
void newConnection();
void dataReceived();
void deviceLinkDestroyed(QObject*);
void deviceLinkDestroyed(QObject* destroyedDeviceLink);
private:
static void configureSocket(QTcpSocket* socket);
QTcpServer* mTcpServer;
QUdpSocket* mUdpServer;
QUdpSocket mUdpSocket;
const static quint16 port = 1714;
quint16 tcpPort;
quint16 mTcpPort;
QMap<QString, DeviceLink*> links;
QMap<QString, DeviceLink*> mLinks;
struct PendingConnect {
NetworkPackage* np;
......
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
* Copyright 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -20,8 +21,6 @@
#include "socketlinereader.h"
#include "../../kdebugnamespace.h"
SocketLineReader::SocketLineReader(QTcpSocket* socket, QObject* parent)
: QObject(parent)
, mSocket(socket)
......@@ -37,36 +36,24 @@ SocketLineReader::SocketLineReader(QTcpSocket* socket, QObject* parent)
void SocketLineReader::dataReceived()
{
QByteArray data = lastChunk + mSocket->readAll();
int parsedLength = 0;
int packageLength = 0;
Q_FOREACH(char c, data) {
packageLength++;
if (c == '\n') {
QByteArray package = data.mid(parsedLength,packageLength);
parsedLength += packageLength;
packageLength = 0;
if(package.length() > 1) { //Ignore single newlines
mPackages.enqueue(package);
}
int packages = mPackages.size();
while(mSocket->canReadLine()) {
const QByteArray line = mSocket->readLine();
if (line.length() > 1) {
mPackages.enqueue(line);//we don't want single \n
}
}
lastChunk = data.mid(parsedLength);
//If we still have things to read from the socket, call dataReceived again
//We do this manually because we do not trust readyRead to be emitted again
//So we call this method again just in case.
if (mSocket->bytesAvailable() > 0) {
QMetaObject::invokeMethod(this, "dataReceived", Qt::QueuedConnection);
return;
}
} else {
if (mPackages.length() > 0) {
Q_EMIT readyRead();
} else {
kDebug(kdeconnect_kded()) << "Received incomplete chunk of data, waiting for more";
}
//If we have any packages, tell it to the world.
if (!mPackages.isEmpty()) {
Q_EMIT readyRead();
}
}
......@@ -164,9 +164,9 @@ void Device::requestPair()
return;
}
pairingTimer.setSingleShot(true);
pairingTimer.start(30 * 1000);
connect(&pairingTimer, SIGNAL(timeout()),
m_pairingTimeut.setSingleShot(true);
m_pairingTimeut.start(30 * 1000); //30 seconds of timeout
connect(&m_pairingTimeut, SIGNAL(timeout()),
this, SLOT(pairingTimeout()));
}
......@@ -294,7 +294,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
kDebug(kdeconnect_kded()) << "Already" << (wantsPair? "paired":"unpaired");
if (m_pairStatus == Device::Requested) {
m_pairStatus = Device::NotPaired;
pairingTimer.stop();
m_pairingTimeut.stop();
Q_EMIT pairingFailed(i18n("Canceled by other peer"));
}
return;
......@@ -309,7 +309,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
kDebug(kdeconnect_kded()) << "ERROR decoding key";
if (m_pairStatus == Device::Requested) {
m_pairStatus = Device::NotPaired;
pairingTimer.stop();
m_pairingTimeut.stop();
}
Q_EMIT pairingFailed(i18n("Received incorrect key"));
return;
......@@ -346,7 +346,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
m_pairStatus = Device::NotPaired;
if (prevPairStatus == Device::Requested) {
pairingTimer.stop();
m_pairingTimeut.stop();
Q_EMIT pairingFailed(i18n("Canceled by other peer"));
} else if (prevPairStatus == Device::Paired) {
KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc");
......@@ -414,7 +414,7 @@ void Device::setAsPaired()
m_pairStatus = Device::Paired;
pairingTimer.stop(); //Just in case it was started
m_pairingTimeut.stop(); //Just in case it was started
storeAsTrusted(); //Save to the config as trusted
......
......@@ -132,7 +132,7 @@ private:
QMap<QString, KdeConnectPlugin*> m_plugins;
QMultiMap<QString, KdeConnectPlugin*> m_pluginsByinterface;
QTimer pairingTimer;
QTimer m_pairingTimeut;
void setAsPaired();
void storeAsTrusted();
......
......@@ -373,6 +373,7 @@ Name[pt_BR]=Montado
Name[ro]=Montat
Name[sk]=Pripojené
Name[sv]=Monterat
Name[tr]=Bağlı
Name[uk]=Змонтовано
Name[x-test]=xxMountedxx
Comment=Filesystem mounted
......@@ -389,6 +390,7 @@ Comment[pt_BR]=Sistema de arquivos montado
Comment[ro]=Sistem de fișiere montat
Comment[sk]=Súborový systém pripojený
Comment[sv]=Filsystem monterat
Comment[tr]=Dosya sistemi bağlandı
Comment[uk]=Файлову систему змонтовано
Comment[x-test]=xxFilesystem mountedxx
Action=None
......@@ -408,6 +410,7 @@ Name[pt_BR]=Desmontado
Name[ro]=Nemontat
Name[sk]=Nepripojený
Name[sv]=Avmonterat
Name[tr]=Ayrıldı
Name[uk]=Демонтовано
Name[x-test]=xxUnmountedxx
Comment=Filesystem unmounted
......@@ -424,6 +427,7 @@ Comment[pt_BR]=Sistema de arquivos desmontado
Comment[ro]=Sistem de fișiere nemontat
Comment[sk]=Súborový systém odpojený
Comment[sv]=Filsystem avmonterat
Comment[tr]=Dosya sistemi ayrıldı
Comment[uk]=Файлову систему демонтовано
Comment[x-test]=xxFilesystem unmountedxx
Action=None
......
......@@ -18,6 +18,7 @@ Name[pt]=Configuração do 'plugin' de Pausa da Música
Name[pt_BR]=Pausar as configurações do plugin Músicas
Name[sk]=Nastavenia pluginu pozastavenia hudby
Name[sv]=Inställningar av insticksprogram för paus i musik
Name[tr]=Müziği Duraklat eklenti ayarları
Name[uk]=Параметри додатка призупинення відтворення музики
Name[x-test]=xxPause Music plugin settingsxx
......
......@@ -24,6 +24,7 @@ Name[pt]=Navegador do sistema de ficheiros remoto
Name[pt_BR]=Navegador do sistema de arquivos remoto
Name[sk]=Prehliadač vzdialeného súborového systému
Name[sv]=Fjärrfilsystembläddrare
Name[tr]=Uzak dosya sistemi tarayıcı
Name[uk]=Перегляд віддалених файлових систем
Name[x-test]=xxRemote filesystem browserxx
Comment=Browse the remote device filesystem using SFTP
......@@ -39,6 +40,7 @@ Comment[pt]=Navegue pelo sistema de ficheiros do dispositivo por SFTP
Comment[pt_BR]=Navegue pelo sistema de arquivos do dispositivo usando SFTP
Comment[sk]=Prehliadať súborový systém vzdialeného zariadenia pomocou SFTP
Comment[sv]=Bläddra i fjärrenhetens filsystem med SFTP
Comment[tr]=SFTP kullanarak uzak aygıt dosya sisteminde gezin
Comment[uk]=Перегляд файлових систем на сторонніх пристроях за допомогою SFTP
Comment[x-test]=xxBrowse the remote device filesystem using SFTPxx
......
......@@ -18,6 +18,7 @@ Name[pt]=Configuração do 'plugin' de navegação de ficheiros por SFTP
Name[pt_BR]=Configurações do plugin de navegação de arquivos por SFTP
Name[sk]=Nastavenia pluginu prehliadača súborov SFTP
Name[sv]=Inställningar av insticksprogram för SFTP-filbläddrare
Name[tr]=SFTP dosya tarayıcı eklenti ayarları
Name[uk]=Параметри додатка перегляду файлів за допомогою SFTP
Name[x-test]=xxSFTP filebrowser plugin settingsxx
......
......@@ -25,6 +25,7 @@ Name[pt_BR]=Compartilhar e receber
Name[ro]=Partajează și primește
Name[sk]=Zdieľať a prijať
Name[sv]=Dela och ta emot
Name[tr]=Paylaş ve al
Name[uk]=Оприлюднення і отримання
Name[x-test]=xxShare and receivexx
Comment=Receive and send files, URLs or plain text easily
......@@ -40,6 +41,7 @@ Comment[pt]=Receber e enviar ficheiros, URL's ou texto de forma simples
Comment[pt_BR]=Recebe e envia facilmente arquivos, URLs ou texto simples
Comment[sk]=Prijať a poslať súbory, URL alebo čisté texty jednoducho
Comment[sv]=Ta emot och skicka filer, webbadresser eller vanlig text enkelt
Comment[tr]=Kolaylıkla dosya, adres veya düz metin alıp gönderin
Comment[uk]=Спрощене отримання і надсилання файлів, адрес або текстових фрагментів
Comment[x-test]=xxReceive and send files, URLs or plain text easilyxx
......
......@@ -18,6 +18,7 @@ Name[pt]=Configuração do 'plugin' de partilha
Name[pt_BR]=Compartilhar as configurações do plugin
Name[sk]=Nastavenia pluginu zdieľania
Name[sv]=Inställningar av delningsinsticksprogram
Name[tr]=Paylaşma eklentisi ayarları
Name[uk]=Параметри додатка оприлюднення даних
Name[x-test]=xxShare plugin settingsxx
......
......@@ -38,7 +38,7 @@ Comment[cs]=Zobrazit upozornění na volání a SMS (odpovídání bude brzy k d
Comment[da]=Vis bekendtgørelser af opkald og SMS (at svare kommer snart)
Comment[de]=Zeigt Benachrichtigungen für Anrufe und SMS
Comment[es]=Mostrar notificaciones de llamadas y SMS (en breve se podrá responder)
Comment[fr]=Affichez les notifications pour les appelles et les SMS (la réponse arrive bientôt)
Comment[fr]=Affichez les notifications pour les appels et les SMS (la réponse arrive bientôt)
Comment[hu]=Értesítések megjelenítése hívásokhoz és SMS-ekhez (a fogadásuk hamarosan)
Comment[it]=Mostra le notifiche di chiamate ed SMS (a breve anche per rispondere)
Comment[ko]=전화 통화 및 문자 메시지 알림 표시(응답 구현 예정)
......
......@@ -50,6 +50,15 @@ Item {
}
*/
function shouldPlasmoidBeShown()
{
if (devicesView.count > 0) {
plasmoid.status = ActiveStatus;
} else {
plasmoid.status = PassiveStatus;
}
}
PlasmaExtras.ScrollArea {
id: dialogItem
anchors.fill: parent
......@@ -58,9 +67,12 @@ Item {
id: devicesView
anchors.fill: parent
model: KdeConnect.DevicesModel {
id: connectDeviceModel
displayFilter: 0x11
}
delegate: DeviceDelegate { }
onCountChanged: shouldPlasmoidBeShown()
Component.onCompleted: shouldPlasmoidBeShown();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment