Merge branch 'master' into frameworks
Conflicts: cli/kdeconnect-cli.cpp core/device.cpp core/filetransferjob.cpp core/filetransferjob.h core/networkpackage.h kded/CMakeLists.txt plugins/share/shareplugin.cpp plugins/telephony/telephonyplugin.cpp
This commit is contained in:
commit
a58fab4fb3
11 changed files with 69 additions and 80 deletions
|
@ -21,12 +21,12 @@
|
|||
#include <interfaces/devicesmodel.h>
|
||||
#include <interfaces/notificationsmodel.h>
|
||||
#include <interfaces/dbusinterfaces.h>
|
||||
#include <iostream>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusConnection>
|
||||
#include <QGuiApplication>
|
||||
#include <KAboutData>
|
||||
#include <KLocalizedString>
|
||||
#include <QTextStream>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -36,15 +36,17 @@ int main(int argc, char** argv)
|
|||
KAboutData::setApplicationData(about);
|
||||
|
||||
about.addAuthor( i18n("Aleix Pol Gonzalez"), QString(), "aleixpol@kde.org" );
|
||||
about.addAuthor( i18n("Albert Vaca Cintora"), QString(), "albertvaka@gmail.com" );
|
||||
QCommandLineParser parser;
|
||||
parser.addOption(QCommandLineOption(QStringList("l") << "list-devices", i18n("List all devices")));
|
||||
parser.addOption(QCommandLineOption("share", i18n("Share a file to a said device"), "path"));
|
||||
parser.addOption(QCommandLineOption("refresh", i18n("Search for devices in the network and re-establishe connections")));
|
||||
parser.addOption(QCommandLineOption("pair", i18n("Request pairing to a said device")));
|
||||
parser.addOption(QCommandLineOption("unpair", i18n("Stop pairing to a said device")));
|
||||
parser.addOption(QCommandLineOption("ping", i18n("Sends a ping to said device")));
|
||||
parser.addOption(QCommandLineOption("ping-msg", i18n("Same as ping but you can set the message to display"), i18n("message")));
|
||||
parser.addOption(QCommandLineOption("share", i18n("Share a file to a said device"), "path"));
|
||||
parser.addOption(QCommandLineOption("list-notifications", i18n("Display the notifications on a said device")));
|
||||
parser.addOption(QCommandLineOption("ping-msg <message>", i18n("Same as ping but you can customize the shown message."), i18n("message")));
|
||||
parser.addOption(QCommandLineOption("device", i18n("Device ID"), "dev"));
|
||||
parser.addOption(QCommandLineOption(QstringList("device") << "d", i18n("Device ID"), "dev"));
|
||||
about.setupCommandLine(&parser);
|
||||
|
||||
parser.addHelpOption();
|
||||
|
@ -67,11 +69,11 @@ int main(int argc, char** argv)
|
|||
statusInfo = "(paired and reachable)";
|
||||
break;
|
||||
}
|
||||
std::cout << "- " << idx.data(Qt::DisplayRole).toString().toStdString()
|
||||
<< ": " << idx.data(DevicesModel::IdModelRole).toString().toStdString() << ' ' << statusInfo.toStdString() << std::endl;
|
||||
QTextStream(stdout) << "- " << idx.data(Qt::DisplayRole).toString()
|
||||
<< ": " << idx.data(DevicesModel::IdModelRole).toString() << ' ' << statusInfo << endl;
|
||||
}
|
||||
std::cout << devices.rowCount() << " devices found" << std::endl;
|
||||
} else if(parser.isSet("refresh")) {
|
||||
QTextStream(stdout) << devices.rowCount() << " devices found" << endl;
|
||||
} else if(args->isSet("refresh")) {
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect", "org.kde.kdeconnect.daemon", "forceOnNetworkChange");
|
||||
QDBusConnection::sessionBus().call(msg);
|
||||
} else {
|
||||
|
@ -93,7 +95,7 @@ int main(int argc, char** argv)
|
|||
} else if(parser.isSet("pair")) {
|
||||
DeviceDbusInterface dev(device);
|
||||
if(dev.isPaired())
|
||||
std::cout << "Already paired" << std::endl;
|
||||
QTextStream(stdout) << "Already paired" << endl;
|
||||
else {
|
||||
QDBusPendingReply<void> req = dev.requestPair();
|
||||
req.waitForFinished();
|
||||
|
@ -101,7 +103,7 @@ int main(int argc, char** argv)
|
|||
} else if(parser.isSet("unpair")) {
|
||||
DeviceDbusInterface dev(device);
|
||||
if(!dev.isPaired())
|
||||
std::cout << "Already not paired" << std::endl;
|
||||
QTextStream(stdout) << "Already not paired" << endl;
|
||||
else {
|
||||
QDBusPendingReply<void> req = dev.unpair();
|
||||
req.waitForFinished();
|
||||
|
@ -118,8 +120,8 @@ int main(int argc, char** argv)
|
|||
notifications.setDeviceId(device);
|
||||
for(int i=0, rows=notifications.rowCount(); i<rows; ++i) {
|
||||
QModelIndex idx = notifications.index(i);
|
||||
std::cout << "- " << idx.data(NotificationsModel::AppNameModelRole).toString().toStdString()
|
||||
<< ": " << idx.data(NotificationsModel::NameModelRole).toString().toStdString() << std::endl;
|
||||
QTextStream(stdout) << "- " << idx.data(NotificationsModel::AppNameModelRole).toString()
|
||||
<< ": " << idx.data(NotificationsModel::NameModelRole).toString() << endl;
|
||||
}
|
||||
} else {
|
||||
qCritical() << i18n("Nothing to be done with the device");
|
||||
|
|
|
@ -65,17 +65,27 @@ void UploadJob::readyRead()
|
|||
{
|
||||
//TODO: Implement payload encryption
|
||||
|
||||
qint64 bytes = qMax(mInput->bytesAvailable(), (qint64)4096);
|
||||
int w = mSocket->write(mInput->read(bytes));
|
||||
if (w<0) {
|
||||
qWarning() << "error when writing data to upload" << bytes << mInput->bytesAvailable();
|
||||
while ( mInput->bytesAvailable() > 0 )
|
||||
{
|
||||
qint64 bytes = qMin(mInput->bytesAvailable(), (qint64)4096);
|
||||
int w = mSocket->write(mInput->read(bytes));
|
||||
if (w<0) {
|
||||
qWarning() << "error when writing data to upload" << bytes << mInput->bytesAvailable();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( mSocket->flush() );
|
||||
}
|
||||
}
|
||||
|
||||
mInput->close();
|
||||
}
|
||||
|
||||
void UploadJob::aboutToClose()
|
||||
{
|
||||
mSocket->close();
|
||||
mSocket->disconnectFromHost();
|
||||
mSocket->close();
|
||||
emitResult();
|
||||
}
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
|
|||
|
||||
qCDebug(KDECONNECT_CORE) << "Pair request";
|
||||
|
||||
KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent
|
||||
KNotification* notification = new KNotification("pairingRequest");
|
||||
notification->setPixmap(QIcon::fromTheme("dialog-information").pixmap(48, 48));
|
||||
notification->setComponentName("kdeconnect");
|
||||
notification->setTitle("KDE Connect");
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <KIO/RenameDialog>
|
||||
#include <KLocalizedString>
|
||||
|
||||
FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const QUrl &destination): KJob()
|
||||
FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 size, const QUrl &destination): KJob()
|
||||
{
|
||||
Q_ASSERT(destination.isLocalFile());
|
||||
//TODO: Make a precondition before calling this function that destination file exists
|
||||
|
|
|
@ -37,7 +37,7 @@ class FileTransferJob
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const QUrl &destination);
|
||||
FileTransferJob(const QSharedPointer<QIODevice>& origin, qint64 size, const QUrl &destination);
|
||||
virtual void start();
|
||||
QUrl destination() const { return mDestination; }
|
||||
void setDeviceName(const QString &deviceName) {mDeviceName = deviceName;};
|
||||
|
@ -61,8 +61,8 @@ private:
|
|||
QUrl mDestination;
|
||||
QTime m_time;
|
||||
qulonglong m_speedBytes;
|
||||
int mSize;
|
||||
int mWritten;
|
||||
qint64 mSize;
|
||||
qint64 mWritten;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ public:
|
|||
bool has(const QString& key) const { return mBody.contains(key); }
|
||||
|
||||
QSharedPointer<QIODevice> payload() const { return mPayload; }
|
||||
void setPayload(const QSharedPointer<QIODevice>& device, int payloadSize) { mPayload = device; mPayloadSize = payloadSize; Q_ASSERT(mPayloadSize >= -1); }
|
||||
void setPayload(const QSharedPointer<QIODevice>& device, qint64 payloadSize) { mPayload = device; mPayloadSize = payloadSize; Q_ASSERT(mPayloadSize >= -1); }
|
||||
bool hasPayload() const { return (mPayloadSize != 0); }
|
||||
int payloadSize() const { return mPayloadSize; } //-1 means it is an endless stream
|
||||
qint64 payloadSize() const { return mPayloadSize; } //-1 means it is an endless stream
|
||||
FileTransferJob* createPayloadTransferJob(const QUrl &destination) const;
|
||||
|
||||
//To be called by a particular DeviceLink
|
||||
|
@ -88,14 +88,14 @@ private:
|
|||
void setId(const QString& id) { mId = id; }
|
||||
void setType(const QString& t) { mType = t; }
|
||||
void setBody(const QVariantMap& b) { mBody = b; }
|
||||
void setPayloadSize(int s) { mPayloadSize = s; }
|
||||
void setPayloadSize(qint64 s) { mPayloadSize = s; }
|
||||
|
||||
QString mId;
|
||||
QString mType;
|
||||
QVariantMap mBody;
|
||||
|
||||
QSharedPointer<QIODevice> mPayload;
|
||||
int mPayloadSize;
|
||||
qint64 mPayloadSize;
|
||||
QVariantMap mPayloadTransferInfo;
|
||||
|
||||
};
|
||||
|
|
|
@ -13,6 +13,3 @@ target_link_libraries(kded_kdeconnect KF5::Service KF5::DBusAddons)
|
|||
install(TARGETS kdeconnectd DESTINATION ${LIBEXEC_INSTALL_DIR})
|
||||
install(TARGETS kded_kdeconnect DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
install(FILES kdeconnect.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
|
||||
|
||||
#TODO: Split this into several files for core and for each plugin
|
||||
install(FILES kdeconnect.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
|
|
|
@ -13,3 +13,5 @@ add_subdirectory(share)
|
|||
add_subdirectory(notifications)
|
||||
add_subdirectory(sftp)
|
||||
|
||||
#FIXME: If we split notifications in several files, they won't appear in the same group in the Notifications KCM
|
||||
install(FILES kdeconnect.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
|
|
|
@ -49,6 +49,19 @@ Comment[tr]=Cihazınızdan bildirimler
|
|||
Comment[uk]=Сповіщення з вашого пристрою
|
||||
Comment[x-test]=xxNotifications from your devicesxx
|
||||
|
||||
[Event/pairingRequest]
|
||||
Name=Pairing Request
|
||||
Name[nl]=Verzoek om een paar te maken
|
||||
Name[pt_BR]=Solicitação de emparelhamento
|
||||
Name[uk]=Запит щодо пов’язування
|
||||
Name[x-test]=xxPairing Requestxx
|
||||
Comment=Pairing request received from a devices
|
||||
Comment[nl]=Verzoek om een paar te maken ontvangen van een apparaat
|
||||
Comment[pt_BR]=Solicitação de emparelhamento recebida de um dispositivo
|
||||
Comment[uk]=Від пристрою отримано запит щодо пов’язування
|
||||
Comment[x-test]=xxPairing request received from a devicesxx
|
||||
Action=Popup
|
||||
|
||||
[Event/callReceived]
|
||||
Name=Calling
|
||||
Name[bg]=Позвъняване
|
||||
|
@ -355,53 +368,18 @@ Comment[uk]=Отримано сповіщення
|
|||
Comment[x-test]=xxNotification receivedxx
|
||||
Action=Popup
|
||||
|
||||
[Event/unknownEvent]
|
||||
Name=Unknown
|
||||
Name[bg]=Неизвестно
|
||||
Name[bs]=Nepoznato
|
||||
Name[ca]=Desconeguda
|
||||
Name[cs]=Neznámý
|
||||
Name[da]=Ukendt
|
||||
Name[de]=Unbekannt
|
||||
Name[es]=Desconocido
|
||||
Name[fi]=Tuntematon
|
||||
Name[fr]=Inconnu
|
||||
Name[hu]=Ismeretlen
|
||||
Name[it]=Sconsciuto
|
||||
Name[ko]=알 수 없음
|
||||
Name[nl]=Onbekend
|
||||
Name[pl]=Nieznana
|
||||
Name[pt]=Desconhecido
|
||||
Name[pt_BR]=Desconhecido
|
||||
Name[ro]=Necunoscut
|
||||
Name[ru]=Неизвестно
|
||||
Name[sk]=Neznáme
|
||||
Name[sv]=Okänt
|
||||
Name[tr]=Bilinmeyen
|
||||
Name[uk]=Невідомо
|
||||
Name[x-test]=xxUnknownxx
|
||||
Comment=Something unknown happened
|
||||
Comment[bg]=Случи се нещо неизвестно
|
||||
Comment[bs]=Nešto se nepoznato dogodilo
|
||||
Comment[ca]=Ha succeït quelcom desconegut
|
||||
Comment[cs]=Stalo se něco neznámého
|
||||
Comment[da]=Der skete noget ukendt
|
||||
Comment[de]=Etwas unbekanntes ist aufgetreten
|
||||
Comment[es]=Ha ocurrido algo desconocido
|
||||
Comment[fi]=Jotakin outoa sattui
|
||||
Comment[fr]=Un évènement inconnu est survenu
|
||||
Comment[hu]=Valami ismeretlen történt
|
||||
Comment[it]=Errore imprevisto
|
||||
Comment[ko]=알 수 없는 일이 일어남
|
||||
Comment[nl]=Er is iets onbekends gebeurd
|
||||
Comment[pl]=Stało się coś nieznanego
|
||||
Comment[pt]=Algo de inesperado aconteceu
|
||||
Comment[pt_BR]=Ocorreu algo inesperado
|
||||
Comment[ro]=S-a întîmplat ceva necunoscut
|
||||
Comment[ru]=Произошло неизвестное событие
|
||||
Comment[sk]=Stalo sa niečo neznáme
|
||||
Comment[sv]=Någonting okänt inträffade
|
||||
Comment[tr]=Bilinmeyen bir durum oluştu
|
||||
Comment[uk]=Сталося щось невідоме програмі
|
||||
Comment[x-test]=xxSomething unknown happenedxx
|
||||
[Event/transferReceived]
|
||||
Name=Pairing Request
|
||||
Name[nl]=Verzoek om een paar te maken
|
||||
Name[pt_BR]=Solicitação de emparelhamento
|
||||
Name[uk]=Запит щодо пов’язування
|
||||
Name[x-test]=xxPairing Requestxx
|
||||
Comment=Pairing request received from a devices
|
||||
Comment[nl]=Verzoek om een paar te maken ontvangen van een apparaat
|
||||
Comment[pt_BR]=Solicitação de emparelhamento recebida de um dispositivo
|
||||
Comment[uk]=Від пристрою отримано запит щодо пов’язування
|
||||
Comment[x-test]=xxPairing request received from a devicesxx
|
||||
Action=Popup
|
||||
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ void SharePlugin::finished(KJob* job)
|
|||
bool error = (job->error() != 0);
|
||||
|
||||
FileTransferJob* transferJob = (FileTransferJob*)job;
|
||||
KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent
|
||||
KNotification* notification = new KNotification("transferReceived");
|
||||
notification->setPixmap(QIcon::fromTheme(error? "edit-delete" : "dialog-ok").pixmap(48, 48));
|
||||
notification->setComponentName("kdeconnect");
|
||||
notification->setTitle(i18n("Transfer finished"));
|
||||
|
|
|
@ -68,7 +68,7 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np)
|
|||
#ifndef NDEBUG
|
||||
return NULL;
|
||||
#else
|
||||
type = "unknownEvent";
|
||||
type = "callReceived";
|
||||
icon = "phone";
|
||||
content = i18n("Unknown telephony event: %1", event);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue