Build for buster

tdeio_obex now working without issues

Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
pull/1/head
Emanoil Kotsev 5 years ago
parent f936b902f0
commit 64c6f3a575

6
debian/changelog vendored

@ -1,3 +1,9 @@
tdebluez (4:14.1.0-0debian10.1.1+eko1) unstable; urgency=low
* Build for buster.
-- Emanoil Kotsev <deloptes@gmail.com> Sat, 02 Nov 2019 22:00:00 +0100
tdebluez (4:14.1.0-0debian9.0.5+eko1) unstable; urgency=low
* Rework of Dbus interface to Bluez5 for TDE 14.1.

@ -188,6 +188,7 @@ void TDEioBluetooth::listDir(const KURL &url)
}
if(list.count()>0) {
kdDebug() << __func__ << "(" << path << ")" << endl ;
totalSize(list.count()+1);
TDEIO::UDSEntryListIterator it = list.begin();
@ -237,6 +238,7 @@ void TDEioBluetooth::createTopLevelEntry(TDEIO::UDSEntry &entry)
bool TDEioBluetooth::listDevice(TDEIO::UDSEntry &entry, const TQString &path, const KURL &url)
{
kdDebug() << __func__ << "(" << url << ")" << endl;
TQT_DBusError error;
TDEBluetooth::DeviceImpl *dev = new TDEBluetooth::DeviceImpl("org.bluez", path);
@ -260,6 +262,7 @@ bool TDEioBluetooth::listDevice(TDEIO::UDSEntry &entry, const TQString &path, co
createDirEntry(entry, name, TQString("bluetooth:/%1/[%2]").arg(aname).arg(addr),
DeviceMimeConverter::classToMimeType(devClass));
return true;
}
bool TDEioBluetooth::listDevices(TQValueList<TDEIO::UDSEntry> &list, const KURL &url)

@ -38,378 +38,406 @@
#include "tdeio_obex.h"
static const TDECmdLineOptions options[] = { { "+protocol", I18N_NOOP(
"Protocol name"), 0 }, { "+pool", I18N_NOOP("Socket name"), 0 }, {
"+app", I18N_NOOP("Socket name"), 0 }, TDECmdLineLastOption };
"Protocol name"), 0 }, { "+pool", I18N_NOOP("Socket name"), 0 }, {
"+app", I18N_NOOP("Socket name"), 0 }, TDECmdLineLastOption };
extern "C" {
int KDE_EXPORT kdemain( int argc, char **argv )
{
// TDEApplication is necessary to use other ioslaves
putenv(strdup("SESSION_MANAGER="));
TDECmdLineArgs::init(argc, argv, "tdeio_obex", 0, 0, 0, 0);
TDECmdLineArgs::addCmdLineOptions( options );
TDEApplication app( false, false, false );
// We want to be anonymous even if we use DCOP
app.dcopClient()->attach();
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
ObexProtocol slave( args->arg(0), args->arg(1), args->arg(2) );
slave.dispatchLoop();
return 0;
}
int KDE_EXPORT kdemain( int argc, char **argv )
{
// TDEApplication is necessary to use other ioslaves
putenv(strdup("SESSION_MANAGER="));
TDECmdLineArgs::init(argc, argv, "tdeio_obex", 0, 0, 0, 0);
TDECmdLineArgs::addCmdLineOptions( options );
TDEApplication app( false, false, false );
// We want to be anonymous even if we use DCOP
app.dcopClient()->attach();
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
ObexProtocol slave( args->arg(0), args->arg(1), args->arg(2) );
slave.dispatchLoop();
return 0;
}
}
ObexProtocol::ObexProtocol(const TQCString &protocol,
const TQCString &pool_socket, const TQCString &app_socket)
: SlaveBase(protocol, pool_socket, app_socket)
const TQCString &pool_socket, const TQCString &app_socket)
: SlaveBase(protocol, pool_socket, app_socket)
{
kdDebug() << k_funcinfo << endl;
// mChannel = 0;
mAddress = TQString::null;
mSessionPath = TQString();
mFileTransfer = 0;
mSessionProperties = 0;
mSession = 0;
mClient = 0;
mProtocol = protocol;
mHost = TQString::null;
mConnected = false;
if (mProtocol == "obexftp" || mProtocol == "obexopp")
obex = new Obex(mProtocol);
kdDebug() << k_funcinfo << endl;
// mChannel = 0;
mAddress = TQString::null;
mSessionPath = TQString();
mFileTransfer = 0;
mSessionProperties = 0;
mSession = 0;
mClient = 0;
mProtocol = protocol;
mHost = TQString::null;
mConnected = false;
mManager = new TDEObex::ObexObjectManagerImpl("org.bluez.obex", "/");
if (!mManager->isConnectedToDBUS()) {
tqDebug("ObexObjectManager is not connected to DBus");
infoMessage(i18n("Error"));
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT,
"ObexObjectManager is not connected to DBus");
closeConnection();
TQString err = "ObexObjectManager is not connected to DBus";
tqDebug(err);
// infoMessage(i18n("Error"));
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT, err);
closeObex();
}
kdDebug() << "ObexProtocol::ObexProtocol DBus connection: "
<< (*(mManager->getConnection())).uniqueName() << endl;
if (mProtocol == "obexftp" || mProtocol == "obexopp") {
obex = new Obex(mProtocol);
// mConnected = connectObex();
}
else
closeObex();
}
ObexProtocol::~ObexProtocol() {
kdDebug() << k_funcinfo << endl;
kdDebug() << k_funcinfo << endl;
if (mConnected)
closeConnection();
if (obex)
delete obex;
if (mFileTransfer)
delete mFileTransfer;
if (mSessionProperties)
delete mSessionProperties;
if (mSession)
delete mSession;
if (mClient)
delete mClient;
if (mManager)
delete mManager;
closeObex();
if (obex)
delete obex;
}
void ObexProtocol::closeConnection() {
kdDebug() << k_funcinfo << endl;
kdDebug() << k_funcinfo << endl;
closeObex();
}
void ObexProtocol::closeObex() {
kdDebug() << k_funcinfo << endl;
TQT_DBusError dbuserror;
if (mConnected) {
// infoMessage(i18n("Disconnecting"));
mConnected = ! mClient->RemoveSession(mSessionPath, dbuserror);
mManager->close();
// infoMessage(i18n("Disconnected"));
}
exit();
if (mConnected && !mSessionPath.isEmpty()) {
// infoMessage(i18n("Disconnecting"));
if(!mClient->RemoveSession(mSessionPath, dbuserror)) {
if (dbuserror.isValid())
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT, dbuserror.message());
}
// infoMessage(i18n("Disconnected"));
}
if (mFileTransfer)
delete mFileTransfer;
if (mSessionProperties)
delete mSessionProperties;
if (mSession)
delete mSession;
if (mClient)
delete mClient;
mConnected = false;
exit();
}
void ObexProtocol::openConnection() {
kdDebug() << k_funcinfo << endl;
if (!mConnected)
if (!connectObex())
kdDebug() << k_funcinfo << endl;
if (!mConnected) {
mConnected = connectObex();
if (!mConnected) {
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT, "ObexClient connection failed");
// infoMessage(i18n("Error"));
// closeObex();
}
}
}
bool ObexProtocol::connectObex() {
kdDebug() << k_funcinfo << endl;
kdDebug() << k_funcinfo << endl;
// if (mClient && mConnected && ! mSessionPath.isEmpty())
// return true;
TQT_DBusError dbuserror;
mClient = mManager->getClient();
if (!mClient) {
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT, "ObexClient was not created");
return false;
}
TQT_DBusVariant obexprot;
if (mProtocol == "obexftp")
obexprot.value = TQT_DBusData::fromString(
"00001106-0000-1000-8000-00805f9b34fb");
else if (mProtocol == "obexopp")
obexprot.value = TQT_DBusData::fromString(
"00001105-0000-1000-8000-00805f9b34fb");
else if (mProtocol == "obexmap")
obexprot.value = TQT_DBusData::fromString(
"00001134-0000-1000-8000-00805f9b34fb");
else if (mProtocol == "obexpbap")
obexprot.value = TQT_DBusData::fromString(
"00001130-0000-1000-8000-00805f9b34fb");
else if (mProtocol == "obexsync")
obexprot.value = TQT_DBusData::fromString(
"00001104-0000-1000-8000-00805f9b34fb");
obexprot.signature = obexprot.value.buildDBusSignature();
TQMap<TQString, TQT_DBusVariant> args;
args.insert(TQString("Target"), obexprot);
if (mSessionPath.isEmpty()) {
kdDebug() << "ObexProtocol::connectObex : trying to create session" << endl;
mConnected = mClient->CreateSession(mAddress, args, mSessionPath, dbuserror);
}
if (!mConnected) {
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT,
i18n("Could not create session for %1.").arg(mAddress));
if (!mClient)
mClient = mManager->getClient();
if (!mClient) {
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT, "ObexClient was not created");
return false;
}
}
TQT_DBusVariant obexprot;
if (mProtocol == "obexftp")
obexprot.value = TQT_DBusData::fromString(
"00001106-0000-1000-8000-00805f9b34fb");
else if (mProtocol == "obexopp")
obexprot.value = TQT_DBusData::fromString(
"00001105-0000-1000-8000-00805f9b34fb");
else if (mProtocol == "obexmap")
obexprot.value = TQT_DBusData::fromString(
"00001134-0000-1000-8000-00805f9b34fb");
else if (mProtocol == "obexpbap")
obexprot.value = TQT_DBusData::fromString(
"00001130-0000-1000-8000-00805f9b34fb");
else if (mProtocol == "obexsync")
obexprot.value = TQT_DBusData::fromString(
"00001104-0000-1000-8000-00805f9b34fb");
obexprot.signature = obexprot.value.buildDBusSignature();
TQMap<TQString, TQT_DBusVariant> args;
args.insert(TQString("Target"), obexprot);
if (mSessionPath.isEmpty()) {
kdDebug() << "ObexProtocol::connectObex : trying to create session" << endl;
if (!mClient->CreateSession(mAddress, args, mSessionPath, dbuserror)) {
TDEIO::SlaveBase::error(TDEIO::ERR_COULD_NOT_CONNECT,
i18n("Could not create session for %1.").arg(mAddress));
return false;
}
}
kdDebug() << "ObexProtocol::connectObex mSessionPath: " << mSessionPath << endl;
mSession = new org::bluez::obex::Session1Proxy("org.bluez.obex", mSessionPath);
mSession->setConnection((*(mManager->getConnection())));
kdDebug() << "ObexProtocol::connectObex mSessionPath: " << mSessionPath << endl;
if (!mSession) {
mSession = new org::bluez::obex::Session1Proxy("org.bluez.obex", mSessionPath);
mSession->setConnection((*(mManager->getConnection())));
mSessionProperties = new org::freedesktop::DBus::PropertiesProxy("org.bluez",
mSessionPath);
mSessionProperties->setConnection((*(mManager->getConnection())));
mSessionProperties = new org::freedesktop::DBus::PropertiesProxy("org.bluez",
mSessionPath);
mSessionProperties->setConnection((*(mManager->getConnection())));
connect ( mSessionProperties,
SIGNAL ( PropertiesChanged ( const TQString&, const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& ) ),
this,
SLOT ( slotPropertiesChanged ( const TQString& , const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& ) ) );
connect ( mSessionProperties,
SIGNAL ( PropertiesChanged ( const TQString&, const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& ) ),
this,
SLOT ( slotPropertiesChanged ( const TQString& , const TQMap< TQString, TQT_DBusVariant >&, const TQStringList& ) ) );
mFileTransfer = new org::bluez::obex::FileTransfer1Proxy("org.bluez.obex",
mSessionPath);
mFileTransfer->setConnection((*(mManager->getConnection())));
mFileTransfer = new org::bluez::obex::FileTransfer1Proxy("org.bluez.obex",
mSessionPath);
mFileTransfer->setConnection((*(mManager->getConnection())));
return true;
}
return mSession != 0;
}
void ObexProtocol::listDir(const KURL &url) {
kdDebug() << k_funcinfo << endl;
kdDebug() << "utl: " << url.url() << endl;
kdDebug() << "path: " << url.path() << endl;
if (url.path().length() <= 1) {
TDEIO::SlaveBase::error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
return;
}
TQString address, name, path;
bool ok = obex->parseURL(url, address, name, path);
if (!ok || address.isEmpty()) {
TDEIO::SlaveBase::error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
return;
}
mAddress = address;
kdDebug() << k_funcinfo << " address " << mAddress << endl;
kdDebug() << k_funcinfo << " name " << name << endl;
kdDebug() << k_funcinfo << " path " << path << endl;
kdDebug() << k_funcinfo << " at line " << __LINE__ << endl;
if (!mConnected)
mConnected = connectObex();
if (!mConnected)
kdDebug() << k_funcinfo << endl;
kdDebug() << "utl: " << url.url() << endl;
kdDebug() << "path: " << url.path() << endl;
if (url.path().length() <= 1) {
TDEIO::SlaveBase::error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
finished();
return;
}
if (!path.isEmpty()) {
if (!changeWorkingDirectory(path)) {
TDEIO::SlaveBase::error(TDEIO::ERR_CANNOT_OPEN_FOR_READING, path);
return;
}
}
kdDebug() << k_funcinfo << " at line " << __LINE__ << endl;
TQT_DBusDataList folderinfo;
TQT_DBusError dbuserror;
if (!mFileTransfer->ListFolder(folderinfo, dbuserror)) {
TDEIO::SlaveBase::error(TDEIO::ERR_CANNOT_OPEN_FOR_READING, url.prettyURL());
return;
}
if (dbuserror.isValid()) {
TDEIO::SlaveBase::error(TDEIO::ERR_CANNOT_OPEN_FOR_READING,
i18n("%1.\n%2").arg(url.prettyURL()).arg(dbuserror.message()));
return;
}
TDEIO::UDSEntryList entries;
entries.clear();
TQValueList < TQT_DBusData > vl = folderinfo.toTQValueList();
TQValueList<TQT_DBusData>::Iterator dit = vl.begin();
for (dit; dit != vl.end(); ++dit) {
bool ok = false;
TQMap<TQString, TQT_DBusData> map = (*dit).toStringKeyMap(&ok).toTQMap();
if (!ok) {
kdDebug() << k_funcinfo << " failed " << endl;
continue;
}
TDEIO::UDSEntry entry = obex->createUDSEntry(map);
entries.append(entry);
kdDebug() << k_funcinfo << " at line " << __LINE__ << endl;
}
listEntries(entries);
listEntry(UDSEntry(), true); // ready
finished();
closeConnection();
return;
TQString address, name, path;
bool ok = obex->parseURL(url, address, name, path);
if (!ok || address.isEmpty()) {
TDEIO::SlaveBase::error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
finished();
return;
}
mAddress = address;
kdDebug() << k_funcinfo << " address " << mAddress << endl;
kdDebug() << k_funcinfo << " name " << name << endl;
kdDebug() << k_funcinfo << " path " << path << endl;
kdDebug() << k_funcinfo << " at line " << __LINE__ << endl;
if (!mConnected) {
mConnected = connectObex();
if (!mConnected) {
finished();
return;
}
}
if (!path.isEmpty()) {
if (!changeWorkingDirectory(path)) {
TDEIO::SlaveBase::error(TDEIO::ERR_CANNOT_OPEN_FOR_READING, path);
finished();
return;
}
}
kdDebug() << k_funcinfo << " at line " << __LINE__ << endl;
TQT_DBusDataList folderinfo;
TQT_DBusError dbuserror;
if (!mFileTransfer->ListFolder(folderinfo, dbuserror)) {
if (dbuserror.isValid()) {
TDEIO::SlaveBase::error(TDEIO::ERR_CANNOT_OPEN_FOR_READING,
i18n("%1.\n%2").arg(url.prettyURL()).arg(dbuserror.message()));
} else {
TDEIO::SlaveBase::error(TDEIO::ERR_CANNOT_OPEN_FOR_READING, url.prettyURL());
}
finished();
return;
}
TDEIO::UDSEntryList entries;
entries.clear();
TQValueList < TQT_DBusData > vl = folderinfo.toTQValueList();
TQValueList<TQT_DBusData>::Iterator dit = vl.begin();
for (dit; dit != vl.end(); ++dit) {
bool ok = false;
TQMap<TQString, TQT_DBusData> map = (*dit).toStringKeyMap(&ok).toTQMap();
if (!ok) {
kdDebug() << k_funcinfo << " failed " << endl;
continue;
}
TDEIO::UDSEntry entry = obex->createUDSEntry(map);
entries.append(entry);
kdDebug() << k_funcinfo << " at line " << __LINE__ << endl;
}
listEntries(entries);
listEntry(UDSEntry(), true); // ready
finished();
closeObex();
}
void ObexProtocol::stat(const KURL &url) {
kdDebug() << k_funcinfo << " url: " << url << endl;
TQString address, name, path;
bool ok = obex->parseURL(url, address, name, path);
kdDebug() << k_funcinfo << " addr: " << address << endl;
kdDebug() << k_funcinfo << " name: " << name << endl;
kdDebug() << k_funcinfo << " path: " << path << endl;
if (!ok || address.isEmpty()) {
error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
return;
}
TDEIO::UDSEntry entry;
if (path.isEmpty() || path == "/") {
// The root is "virtual" - it's not a single physical directory
obex->createTopLevelEntry(entry);
} else {
obex->createDirEntry(entry, url.url());
}
statEntry(entry);
finished();
return;
kdDebug() << k_funcinfo << " url: " << url << endl;
TQString address, name, path;
bool ok = obex->parseURL(url, address, name, path);
kdDebug() << k_funcinfo << " addr: " << address << endl;
kdDebug() << k_funcinfo << " name: " << name << endl;
kdDebug() << k_funcinfo << " path: " << path << endl;
if (!ok || address.isEmpty()) {
error(TDEIO::ERR_MALFORMED_URL, url.prettyURL());
return;
}
TDEIO::UDSEntry entry;
if (path.isEmpty() || path == "/") {
// The root is "virtual" - it's not a single physical directory
obex->createTopLevelEntry(entry);
} else {
obex->createDirEntry(entry, url.url());
}
statEntry(entry);
finished();
}
void ObexProtocol::get(const KURL& url) {
kdDebug() << k_funcinfo << endl;
// obex->get(url);
kdDebug() << k_funcinfo << endl;
// obex->get(url);
}
void ObexProtocol::copy(const KURL &src, const KURL &dest, int permissions, bool overwrite) {
kdDebug() << k_funcinfo << endl;
// obex->copy(src, dest, permissions, overwrite);
kdDebug() << k_funcinfo << endl;
// obex->copy(src, dest, permissions, overwrite);
}
void ObexProtocol::put(const KURL& url, int permissions, bool overwrite,
bool resume) {
kdDebug() << k_funcinfo << endl;
// obex->put(url, permissions, overwrite, resume);
bool resume) {
kdDebug() << k_funcinfo << endl;
// obex->put(url, permissions, overwrite, resume);
}
void ObexProtocol::del(const KURL &url, bool isfile) {
kdDebug() << k_funcinfo << endl;
// obex->del(url, isfile);
kdDebug() << k_funcinfo << endl;
// obex->del(url, isfile);
}
void ObexProtocol::rename(const KURL& src, const KURL& dest, bool overwrite) {
kdDebug() << k_funcinfo << endl;
// obex->rename(src, dest, overwrite);
kdDebug() << k_funcinfo << endl;
// obex->rename(src, dest, overwrite);
}
void ObexProtocol::mkdir(const KURL&url, int permissions) {
kdDebug() << k_funcinfo << endl;
// obex->mkdir(url, permissions);
kdDebug() << k_funcinfo << endl;
// obex->mkdir(url, permissions);
}
bool ObexProtocol::changeWorkingDirectory(const TQString& dir) {
kdDebug() << "ObexProtocol::changeWorkingDirectory( " << dir << " )" << endl;
if (!dir.startsWith("/")) {
TDEIO::SlaveBase::error(TDEIO::ERR_MALFORMED_URL,
i18n("Could not change directory: %1. Directory should start with \"/\"").arg(dir));
return false;
}
if (!mFileTransfer) {
TDEIO::SlaveBase::error(TDEIO::ERR_INTERNAL,
i18n("Could not change directory: %1. No file transport").arg(dir));
return false;
}
TQT_DBusError dbuserror;
if (!mFileTransfer->ChangeFolder(dir, dbuserror)) {
TDEIO::SlaveBase::error(TDEIO::ERR_INTERNAL, i18n("Could not change directory: %1.").arg(dbuserror.message()));
return false;
}
return true;
kdDebug() << "ObexProtocol::changeWorkingDirectory( " << dir << " )" << endl;
if (!dir.startsWith("/")) {
TDEIO::SlaveBase::error(TDEIO::ERR_MALFORMED_URL,
i18n("Could not change directory: %1. Directory should start with \"/\"").arg(dir));
return false;
}
if (!mFileTransfer) {
TDEIO::SlaveBase::error(TDEIO::ERR_INTERNAL,
i18n("Could not change directory: %1. No file transport").arg(dir));
return false;
}
TQT_DBusError dbuserror;
if (!mFileTransfer->ChangeFolder(dir, dbuserror)) {
TDEIO::SlaveBase::error(TDEIO::ERR_INTERNAL, i18n("Could not change directory: %1.").arg(dbuserror.message()));
return false;
}
return true;
}
void ObexProtocol::slotPropertiesChanged(const TQString& interface,
const TQMap<TQString, TQT_DBusVariant>& changed_properties,
const TQStringList& invalidated_properties) {
kdDebug() << k_funcinfo << endl;
kdDebug() << interface << endl;
if (interface == "org.bluez.obex.Session1") {
TQMap<TQString, TQT_DBusVariant>::const_iterator it;
for (it = changed_properties.begin(); it != changed_properties.end();
++it) {
bool ok = false;
if (it.key() == "Source")
emit sessionSourceChanged(mSessionPath,
it.data().value.toBool(&ok));
else if (it.key() == "Destination")
emit sessionDestinationChanged(mSessionPath,
it.data().value.toString(&ok));
else if (it.key() == "Channel")
emit sessionChannelChanged(mSessionPath,
it.data().value.toByte(&ok));
else if (it.key() == "Target")
emit sessionTargetChanged(mSessionPath,
it.data().value.toString(&ok));
else if (it.key() == "Root")
emit sessionRootChanged(mSessionPath,
it.data().value.toString(&ok));
else
continue;
if (!ok)
tqDebug(
"ObjectManagerImpl::slotPropertiesChanged conversion failed");
}
}
if (interface == "org.bluez.obex.FileTransfer1"
|| interface == "org.bluez.obex.Transfer1") {
TQMap<TQString, TQT_DBusVariant>::const_iterator it;
for (it = changed_properties.begin(); it != changed_properties.end();
++it) {
bool ok = false;
if (it.key() == "Size")
emit transferSizeChanged(mSessionPath,
it.data().value.toUInt64(&ok));
else if (it.key() == "Status")
emit transferStatusChanged(mSessionPath,
it.data().value.toString(&ok));
else if (it.key() == "Transferred")
emit transferTransferredChanged(mSessionPath,
it.data().value.toUInt64(&ok));
else if (it.key() == "Time")
emit transferTimeChanged(mSessionPath,
it.data().value.toUInt64(&ok));
else if (it.key() == "Filename")
emit transferFilenameChanged(mSessionPath,
it.data().value.toString(&ok));
else
continue;
if (!ok)
tqDebug(
"ObjectManagerImpl::slotPropertiesChanged conversion failed");
}
}
const TQMap<TQString, TQT_DBusVariant>& changed_properties,
const TQStringList& invalidated_properties) {
kdDebug() << k_funcinfo << endl;
kdDebug() << interface << endl;
if (interface == "org.bluez.obex.Session1") {
TQMap<TQString, TQT_DBusVariant>::const_iterator it;
for (it = changed_properties.begin(); it != changed_properties.end();
++it) {
bool ok = false;
if (it.key() == "Source")
emit sessionSourceChanged(mSessionPath,
it.data().value.toBool(&ok));
else if (it.key() == "Destination")
emit sessionDestinationChanged(mSessionPath,
it.data().value.toString(&ok));
else if (it.key() == "Channel")
emit sessionChannelChanged(mSessionPath,
it.data().value.toByte(&ok));
else if (it.key() == "Target")
emit sessionTargetChanged(mSessionPath,
it.data().value.toString(&ok));
else if (it.key() == "Root")
emit sessionRootChanged(mSessionPath,
it.data().value.toString(&ok));
else
continue;
if (!ok)
tqDebug(
"ObjectManagerImpl::slotPropertiesChanged conversion failed");
}
}
if (interface == "org.bluez.obex.FileTransfer1"
|| interface == "org.bluez.obex.Transfer1") {
TQMap<TQString, TQT_DBusVariant>::const_iterator it;
for (it = changed_properties.begin(); it != changed_properties.end();
++it) {
bool ok = false;
if (it.key() == "Size")
emit transferSizeChanged(mSessionPath,
it.data().value.toUInt64(&ok));
else if (it.key() == "Status")
emit transferStatusChanged(mSessionPath,
it.data().value.toString(&ok));
else if (it.key() == "Transferred")
emit transferTransferredChanged(mSessionPath,
it.data().value.toUInt64(&ok));
else if (it.key() == "Time")
emit transferTimeChanged(mSessionPath,
it.data().value.toUInt64(&ok));
else if (it.key() == "Filename")
emit transferFilenameChanged(mSessionPath,
it.data().value.toString(&ok));
else
continue;
if (!ok)
tqDebug(
"ObjectManagerImpl::slotPropertiesChanged conversion failed");
}
}
}
#include "tdeio_obex.moc"

@ -37,98 +37,99 @@
class ObexProtocol: public TQObject, public TDEIO::SlaveBase {
Q_OBJECT
Q_OBJECT
public:
ObexProtocol(const TQCString &protcol, const TQCString &pool_socket,
const TQCString &app_socket);
virtual ~ObexProtocol();
virtual void openConnection();
virtual void closeConnection();
virtual void stat(const KURL& url);
virtual void listDir(const KURL& url);
virtual void get(const KURL& url);
virtual void copy(const KURL &src, const KURL &dest, int permissions,
bool overwrite);
virtual void put(const KURL& url, int permissions, bool overwrite,
bool resume);
virtual void del(const KURL &url, bool isfile);
// virtual void chmod(const KURL& url, int permissions);
virtual void rename(const KURL& src, const KURL& dest, bool overwrite);
virtual void mkdir(const KURL&url, int permissions);
ObexProtocol(const TQCString &protcol, const TQCString &pool_socket,
const TQCString &app_socket);
virtual ~ObexProtocol();
virtual void openConnection();
virtual void closeConnection();
virtual void stat(const KURL& url);
virtual void listDir(const KURL& url);
virtual void get(const KURL& url);
virtual void copy(const KURL &src, const KURL &dest, int permissions,
bool overwrite);
virtual void put(const KURL& url, int permissions, bool overwrite,
bool resume);
virtual void del(const KURL &url, bool isfile);
// virtual void chmod(const KURL& url, int permissions);
virtual void rename(const KURL& src, const KURL& dest, bool overwrite);
virtual void mkdir(const KURL&url, int permissions);
private:
// Private variables
/** True if ioslave is connected to server. */
bool mConnected;
// Private variables
/** True if ioslave is connected to server. */
bool mConnected;
/** Host we are connected to. */
TQString mHost;
/** Host we are connected to. */
TQString mHost;
/**
/**
The protocol to be used.
*/
TQString mProtocol;
*/
TQString mProtocol;
/**
/**
Pointer to the obex obejct.
*/
Obex *obex;
*/
Obex *obex;
/**
/**
Pointer to the obex client class.
*/
org::bluez::obex::Client1Proxy* mClient;
*/
org::bluez::obex::Client1Proxy* mClient;
/**
/**
Pointer to the obex session class.
*/
org::bluez::obex::Session1Proxy* mSession;
org::freedesktop::DBus::PropertiesProxy* mSessionProperties;
org::bluez::obex::FileTransfer1Proxy* mFileTransfer;
TQT_DBusObjectPath mSessionPath;
TQString mAddress;
/**
*/
org::bluez::obex::Session1Proxy* mSession;
org::freedesktop::DBus::PropertiesProxy* mSessionProperties;
org::bluez::obex::FileTransfer1Proxy* mFileTransfer;
TQT_DBusObjectPath mSessionPath;
TQString mAddress;
/**
Pointer to the obex agent manager class.
*/
TDEObex::ObexObjectManagerImpl* mManager;
*/
TDEObex::ObexObjectManagerImpl* mManager;
/** Channel we are connected to. */
int mChannel;
/** Channel we are connected to. */
int mChannel;
struct Status {
int code;
TDEIO::filesize_t size;
TQString text;
};
struct Status {
int code;
TDEIO::filesize_t size;
TQString text;
};
private:
// private methods
// private methods
/**
/**
Helper functions.
*/
bool connectObex();
bool changeWorkingDirectory(const TQString& to);
*/
bool connectObex();
void closeObex();
bool changeWorkingDirectory(const TQString& to);
private slots:
void slotPropertiesChanged(const TQString& interface,
const TQMap<TQString, TQT_DBusVariant>& changed_properties,
const TQStringList& invalidated_properties);
private slots:
void slotPropertiesChanged(const TQString& interface,
const TQMap<TQString, TQT_DBusVariant>& changed_properties,
const TQStringList& invalidated_properties);
signals:
void sessionSourceChanged(TQT_DBusObjectPath &path,bool ok);
void sessionDestinationChanged(TQT_DBusObjectPath &path, TQString value);
void sessionChannelChanged(TQT_DBusObjectPath &path, TQ_UINT8 value);
void sessionTargetChanged(TQT_DBusObjectPath &path, TQString value);
void sessionRootChanged(TQT_DBusObjectPath &path, TQString value);
void transferSizeChanged(TQT_DBusObjectPath &path, TQ_UINT64 value);
void transferStatusChanged(TQT_DBusObjectPath &path, TQString value);
void transferTransferredChanged(TQT_DBusObjectPath &path, TQ_UINT64 value);
void transferTimeChanged(TQT_DBusObjectPath &path, TQ_UINT64 value);
void transferFilenameChanged(TQT_DBusObjectPath &path, TQString value);
void sessionSourceChanged(TQT_DBusObjectPath &path,bool ok);
void sessionDestinationChanged(TQT_DBusObjectPath &path, TQString value);
void sessionChannelChanged(TQT_DBusObjectPath &path, TQ_UINT8 value);
void sessionTargetChanged(TQT_DBusObjectPath &path, TQString value);
void sessionRootChanged(TQT_DBusObjectPath &path, TQString value);
void transferSizeChanged(TQT_DBusObjectPath &path, TQ_UINT64 value);
void transferStatusChanged(TQT_DBusObjectPath &path, TQString value);
void transferTransferredChanged(TQT_DBusObjectPath &path, TQ_UINT64 value);
void transferTimeChanged(TQT_DBusObjectPath &path, TQ_UINT64 value);
void transferFilenameChanged(TQT_DBusObjectPath &path, TQString value);
};
#endif

Loading…
Cancel
Save