# ChangeLog for net-wireless/kdebluetooth
# Copyright 2000-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-wireless/kdebluetooth/ChangeLog,v 1.56 2007/02/02 17:48:14 gustavoz Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/kdebluetooth/ChangeLog,v 1.57 2007/04/08 11:02:24 genstef Exp $
+
+*kdebluetooth-1.0_beta2-r2 (08 Apr 2007)
+
+ 08 Apr 2007; Stefan Schweizer <genstef@gentoo.org>
+ +files/better-menu-names.diff, +files/kcm-btpaired-fix.diff,
+ +files/kcm-no-dcop-error.diff, +files/kdebluetooth.diff,
+ +files/kdebluetooth-dbuspasskeyagent.diff,
+ +files/kdebluetooth-sdp-bitop.diff, +kdebluetooth-1.0_beta2-r2.ebuild:
+ Add SuSe patches works with bluez-utils-3.7 thanks to Sergey Temerkhanov
+ <temerkhanov@mail.ru> in bug 172832
02 Feb 2007; Gustavo Zacarias <gustavoz@gentoo.org>
kdebluetooth-1.0_beta2-r1.ebuild:
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
+AUX better-menu-names.diff 2062 RMD160 c3db60fa907a7907fd1a402df8dad13fca7763c8 SHA1 2fa8f9ecc78b212e8391c7add84f17eda94fc72f SHA256 58ddc9c33c6dc66fa85ce74ec7d60f181bb909ea7026f8d7af82091e0723d3e2
+MD5 aa678f91c59172ae6bb8a53280dd31d1 files/better-menu-names.diff 2062
+RMD160 c3db60fa907a7907fd1a402df8dad13fca7763c8 files/better-menu-names.diff 2062
+SHA256 58ddc9c33c6dc66fa85ce74ec7d60f181bb909ea7026f8d7af82091e0723d3e2 files/better-menu-names.diff 2062
+AUX kcm-btpaired-fix.diff 15910 RMD160 e70bad64cdc8a909327427f477dd94a9282e0732 SHA1 b27f7acc10c60708681f3de648803c08191a40ba SHA256 673d2f9a2f1f92b4595d12bcc1d8bc375fed237741a48b52b0a84dffe59fb782
+MD5 c5e619c447b364a587bfbeb443097ad7 files/kcm-btpaired-fix.diff 15910
+RMD160 e70bad64cdc8a909327427f477dd94a9282e0732 files/kcm-btpaired-fix.diff 15910
+SHA256 673d2f9a2f1f92b4595d12bcc1d8bc375fed237741a48b52b0a84dffe59fb782 files/kcm-btpaired-fix.diff 15910
+AUX kcm-no-dcop-error.diff 1156 RMD160 81840a6069f8c188e2e57934c1d8d96fcee8e18f SHA1 c80b89c451f8fcb340163ba9b41ac534d09ed07d SHA256 85f082726200d7208cbda1fccdd8d5cdd27d6a6bad8ad65d768217c9139bb785
+MD5 f561fec357703b020230f653f6c49aac files/kcm-no-dcop-error.diff 1156
+RMD160 81840a6069f8c188e2e57934c1d8d96fcee8e18f files/kcm-no-dcop-error.diff 1156
+SHA256 85f082726200d7208cbda1fccdd8d5cdd27d6a6bad8ad65d768217c9139bb785 files/kcm-no-dcop-error.diff 1156
AUX kdebluetooth-1.0_beta1-gcc41.patch 666 RMD160 e14ece6e5bd0ee91a4990431cfce0119bc815a5b SHA1 3770a41ecf35ad01a98f2e14298522b35f8486d7 SHA256 a3df51b15e79b0993928fc44eac6eedef6c5dadcaa6b832140452cb559fdee29
MD5 36c3dda5a9a5d63617f729d76e999035 files/kdebluetooth-1.0_beta1-gcc41.patch 666
RMD160 e14ece6e5bd0ee91a4990431cfce0119bc815a5b files/kdebluetooth-1.0_beta1-gcc41.patch 666
MD5 6fe386a584d7b93a65fa8d3553977dca files/kdebluetooth-1.0_beta1-openobex-1.1.patch 7315
RMD160 c73ca92bcc511e91442ac27d9b362fa069c03db7 files/kdebluetooth-1.0_beta1-openobex-1.1.patch 7315
SHA256 8b5dc80f455f9967dd1e0b94f3d32e9c270444063fa70eac5c387de1a8b5e848 files/kdebluetooth-1.0_beta1-openobex-1.1.patch 7315
+AUX kdebluetooth-dbuspasskeyagent.diff 17790 RMD160 7c6b73ec8ca1aa375f6a472b966af3941dbb05eb SHA1 658d34372afb071e94c9c8555d80fcc673460141 SHA256 598d8a810c82fe2ce8aececc2649585908eced90c9fbe846fd8769452af9c5f9
+MD5 8d122f087a652847911071b00db5fe79 files/kdebluetooth-dbuspasskeyagent.diff 17790
+RMD160 7c6b73ec8ca1aa375f6a472b966af3941dbb05eb files/kdebluetooth-dbuspasskeyagent.diff 17790
+SHA256 598d8a810c82fe2ce8aececc2649585908eced90c9fbe846fd8769452af9c5f9 files/kdebluetooth-dbuspasskeyagent.diff 17790
+AUX kdebluetooth-sdp-bitop.diff 2012 RMD160 208ae7d61b7ee84dc77cacee22be1dbc78036abf SHA1 e7358af0bff9a1eeb2921c3c4177a0796f215b19 SHA256 ca489f6aed43d47316897c0bf303ad02877645586b70b859f38ba7450a94b736
+MD5 6892e3f21bd7dcd2610a9397db7bc38c files/kdebluetooth-sdp-bitop.diff 2012
+RMD160 208ae7d61b7ee84dc77cacee22be1dbc78036abf files/kdebluetooth-sdp-bitop.diff 2012
+SHA256 ca489f6aed43d47316897c0bf303ad02877645586b70b859f38ba7450a94b736 files/kdebluetooth-sdp-bitop.diff 2012
+AUX kdebluetooth.diff 804 RMD160 b02d9c579c7b480de77b95db263188553f2421ab SHA1 a430eef27e8a6395bce594bd5f0bc661adbca81b SHA256 6fd029e1a2e85ae34ae94c99b5b8b362f43d4f6a91618fd01137b4987d6fbfef
+MD5 9fdd2e18bb774527183f57882d47239d files/kdebluetooth.diff 804
+RMD160 b02d9c579c7b480de77b95db263188553f2421ab files/kdebluetooth.diff 804
+SHA256 6fd029e1a2e85ae34ae94c99b5b8b362f43d4f6a91618fd01137b4987d6fbfef files/kdebluetooth.diff 804
DIST kdebluetooth-1.0_beta1.tar.bz2 819384 RMD160 a6de390d5cecb840fb8b0fd87bc875fb743369a5 SHA1 58787b1d11ec98b1de52ebbe1f236218a78f5c13 SHA256 eac5da0f809b39f3df890543851cfa9a46193e21d0a13089658ad4c0e91ca784
DIST kdebluetooth-1.0_beta2.tar.bz2 1228026 RMD160 52d54f49a1eb5c89b2a5ad9550dc6b85d50b62e9 SHA1 0cfc61f4597b599cd3ef668a534c854c55921108 SHA256 9d2637a1e9bb220f048ce62014516418163d2bf92c29835a941eb962154e41b7
EBUILD kdebluetooth-1.0_beta1-r2.ebuild 1715 RMD160 2857c2cb589a23483c3dde0add4e02ddf6350fc1 SHA1 c112cf274a0734069c98e611ca6663be68838a10 SHA256 9dd4fbe9944732f7abae71e08c3467730f40a06d64746a57c0af729292c70ea3
MD5 7a2bbefabba6d35ebbebde32b8c6b3a1 kdebluetooth-1.0_beta2-r1.ebuild 1913
RMD160 e72bfcba68abf524c0de2d8f217f88beed72c3af kdebluetooth-1.0_beta2-r1.ebuild 1913
SHA256 dabf35ad0ba60b031c9b5cd63bd1e4d0903ad92018c33736d73597bb6338666c kdebluetooth-1.0_beta2-r1.ebuild 1913
+EBUILD kdebluetooth-1.0_beta2-r2.ebuild 2186 RMD160 e5f04ebda896961121d7098127dc437008b1f6b6 SHA1 d3f30f25db71b0c0dc5e65e24d73f75fd23588c5 SHA256 7ce0d571cbbbf2ac00fc2bcd35bae4ae3248ce61d7a58a7ad636d4a90b265dae
+MD5 d621bcb5cca6d7e6e08024e1c9650f10 kdebluetooth-1.0_beta2-r2.ebuild 2186
+RMD160 e5f04ebda896961121d7098127dc437008b1f6b6 kdebluetooth-1.0_beta2-r2.ebuild 2186
+SHA256 7ce0d571cbbbf2ac00fc2bcd35bae4ae3248ce61d7a58a7ad636d4a90b265dae kdebluetooth-1.0_beta2-r2.ebuild 2186
EBUILD kdebluetooth-1.0_beta2.ebuild 1598 RMD160 a80f471b929c86bf8a3d37bb741ba198a2998439 SHA1 0ff73a5149decc3df6213a5288e90da3f8e16476 SHA256 fd8e7f9c29c9f2b425a148a02cc3bee3ae5e30c610060974efc99fe6e853e86c
MD5 0b7d306e99295974afca766840bfb3e2 kdebluetooth-1.0_beta2.ebuild 1598
RMD160 a80f471b929c86bf8a3d37bb741ba198a2998439 kdebluetooth-1.0_beta2.ebuild 1598
SHA256 fd8e7f9c29c9f2b425a148a02cc3bee3ae5e30c610060974efc99fe6e853e86c kdebluetooth-1.0_beta2.ebuild 1598
-MISC ChangeLog 9355 RMD160 13d3e0d1dc049aedc013d7721fa087ab96b77d3a SHA1 c9b8771ffe9bc2ad6a79f20cd01dee77940aa4aa SHA256 d08f48f366305df743c9165ad77097fd9ad1017c1361862887596d829e2dd965
-MD5 a0f94b888489652e612c8afe211d018d ChangeLog 9355
-RMD160 13d3e0d1dc049aedc013d7721fa087ab96b77d3a ChangeLog 9355
-SHA256 d08f48f366305df743c9165ad77097fd9ad1017c1361862887596d829e2dd965 ChangeLog 9355
+MISC ChangeLog 9803 RMD160 577dcb4cc83854b728bd46006fa6f42c1e25cbd9 SHA1 a6fdfc5024a11442824986dd9779b1df572ded97 SHA256 bbe59b953ed58c93c3491b8a1b7239ac50745afc22619460bcf7eddbcd0d6ed2
+MD5 c776d618561ccf09f329c598277f86a0 ChangeLog 9803
+RMD160 577dcb4cc83854b728bd46006fa6f42c1e25cbd9 ChangeLog 9803
+SHA256 bbe59b953ed58c93c3491b8a1b7239ac50745afc22619460bcf7eddbcd0d6ed2 ChangeLog 9803
MISC metadata.xml 157 RMD160 9258d9691830e58ee00ca89f0a6df9ce077f2439 SHA1 b2ca0d856f38a09bf6d2e58ee77b344552585862 SHA256 e0e268ca18fef286617fcfe97773d5df5b8fbdb5fbcb9a29adc5e8b0baea4292
MD5 02039d51ca4a42817775fd436dfaa956 metadata.xml 157
RMD160 9258d9691830e58ee00ca89f0a6df9ce077f2439 metadata.xml 157
MD5 65006a5fdf6a8b2fea5b585b8a8d969c files/digest-kdebluetooth-1.0_beta2-r1 274
RMD160 4c7fdf249fdb4e6ecf3756b13adfdadf29ae2acc files/digest-kdebluetooth-1.0_beta2-r1 274
SHA256 6dfbb263832e3bfc84a30f93ef962d701fc328f35566774e6d2beb9d3b6e281a files/digest-kdebluetooth-1.0_beta2-r1 274
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6-ecc01.6 (GNU/Linux)
-
-iD8DBQFFw3lyKRy60XGEcJIRAmfnAJwPcHDrd5fS9MqLWbGE6UUdS9oqAQCbBOXr
-+LizctrNTvSety2ZoZdYuKk=
-=m98v
------END PGP SIGNATURE-----
+MD5 65006a5fdf6a8b2fea5b585b8a8d969c files/digest-kdebluetooth-1.0_beta2-r2 274
+RMD160 4c7fdf249fdb4e6ecf3756b13adfdadf29ae2acc files/digest-kdebluetooth-1.0_beta2-r2 274
+SHA256 6dfbb263832e3bfc84a30f93ef962d701fc328f35566774e6d2beb9d3b6e281a files/digest-kdebluetooth-1.0_beta2-r2 274
--- /dev/null
+Index: kdebluetooth/kdebluetooth-common/Makefile.am
+================================================================================
+--- kdebluetooth/kbtobexclient/kbtobexclient.desktop
++++ kdebluetooth/kbtobexclient/kbtobexclient.desktop
+@@ -4,10 +4,7 @@
+ Icon=kdebluetooth
+ Type=Application
+ MimeType=bluetooth/obex-object-push-profile
+-Name=kbtobexclient
+-Name[ta]=kbtobex கிளைஞ்சன்
+-Name[tr]=kbtobexistemcisi
+-Name[xx]=xxkbtobexclientxx
++Name=Send File via Bluetooth
+ GenericName=Bluetooth OBEX Client
+ GenericName[bg]=OBEX клиент за Bluetooth
+ GenericName[br]=Arlun OBEX Bluetooth
+--- kdebluetooth/kbtserialchat/kbtserialchat.desktop
++++ kdebluetooth/kbtserialchat/kbtserialchat.desktop
+@@ -5,9 +5,7 @@
+ Type=Application
+ MimeType=bluetooth/serial-port-profile
+ Name=kbtserialchat
+-Name[sv]=Kbtserialchat
+-Name[tr]=kbtserisohbet
+-Name[xx]=xxkbtserialchatxx
++Name=Bluetooth Terminal
+ GenericName=Bluetooth Chat
+ GenericName[bg]=Разговор с Bluetooth
+ GenericName[br]=Flapañ gant Bluetooth
+@@ -57,3 +55,4 @@
+ Comment[ta]=புலுடுத்துக்கான சிறிய முடிவு பயன்பாடு.
+ Comment[tr]=Bluetooth için küçük seri terminal uygulaması
+ Comment[xx]=xxSmall serial terminal application for Bluetoothxx
++X-SuSE-Unimportant=true
+--- kdebluetooth/kdebluetooth-common/Makefile.am
++++ kdebluetooth/kdebluetooth-common/Makefile.am
+@@ -7,18 +7,6 @@
+
+ EXTRA_DIST = $(kde_servicetypes_DATA)
+
+-# Bluetooth directory entry in the control center
+-xdg_directory_DATA = kde-settings-network-bluetooth.directory
+-
+-# from kdebase/applnk/Makefile.am
+-install-data-local:
+- $(mkinstalldirs) $(DESTDIR)$(kde_appsdir)/Settings/Network/Bluetooth
+- $(INSTALL_DATA) $(srcdir)/kde-settings-network-bluetooth.directory \
+- $(DESTDIR)$(kde_appsdir)/Settings/Network/Bluetooth/.directory
+-
+-uninstall-local:
+- -rm -f $(DESTDIR)$(kde_appsdir)/Settings/Network/Bluetooth/.directory
+-
+ # Update scripts
+ #update_DATA = kdebluetooth.upd kdebluetooth.sh
+ #updatedir = $(kde_datadir)/kconf_update
--- /dev/null
+MD5 3c9b2c4800d8ef0b92dcc481fd9c62c9 kdebluetooth-1.0_beta2.tar.bz2 1228026
+RMD160 52d54f49a1eb5c89b2a5ad9550dc6b85d50b62e9 kdebluetooth-1.0_beta2.tar.bz2 1228026
+SHA256 9d2637a1e9bb220f048ce62014516418163d2bf92c29835a941eb962154e41b7 kdebluetooth-1.0_beta2.tar.bz2 1228026
--- /dev/null
+--- kdebluetooth/kbluetoothd/kcm_btpaired/filesettingsbase.ui
++++ kdebluetooth/kbluetoothd/kcm_btpaired/filesettingsbase.ui
+@@ -1,4 +1,4 @@
+-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
++<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+ <class>FileSettingsBase</class>
+ <widget class="QWidget">
+ <property name="name">
+@@ -24,7 +24,7 @@
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+- <string>Here you have to specify the correct start/stop commands for BlueZ's <i>hcid</i> and the location of BlueZ's <i>link_key</i> file for the distribution you are using.</string>
++ <string>Here you have to specify the correct start/stop commands for BlueZ's <i>hcid</i> and the directory of the BlueZ's <i>link_key</i> files for the distribution you are using.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+@@ -123,7 +123,7 @@
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+- <string>Link key file:</string>
++ <string>Link key directory:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="1">
+@@ -138,6 +138,9 @@
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
++ <property name="mode">
++ <number>26</number>
++ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+--- kdebluetooth/kbluetoothd/kcm_btpaired/pairedtab.cpp
++++ kdebluetooth/kbluetoothd/kcm_btpaired/pairedtab.cpp
+@@ -44,6 +44,7 @@
+ using namespace std;
+ using namespace KBluetooth;
+
++/* linkkey file is now ASCII format
+ struct HcidLinkKeyStruct {
+ bdaddr_t sba;
+ bdaddr_t dba;
+@@ -54,19 +55,17 @@
+ uint8_t type;
+ time_t time;
+ };
++*/
+
+ PairedTab::PairedTab(QWidget *parent, const char* name) :
+ PairedTabBase(parent, name)
+ {
+ KConfig* config = KApplication::kApplication()->config();
+- linkKeyFilename = config->readEntry("linkKeyFile", "/etc/bluetooth/link_key");
+- config->writeEntry("linkKeyFile", linkKeyFilename);
+- hcidStartCommand = config->readEntry("hcidStartCommand", "/etc/init.d/bluez-utils start");
+- hcidStopCommand = config->readEntry("hcidStopCommand", "/etc/init.d/bluez-utils stop");
++ linkKeyPath = config->readEntry("linkKeyPath", "/var/lib/bluetooth/");
++ config->writeEntry("linkKeyPath", linkKeyPath);
++ hcidStartCommand = config->readEntry("hcidStartCommand", "/etc/init.d/bluetooth start");
++ hcidStopCommand = config->readEntry("hcidStopCommand", "/etc/init.d/bluetooth stop");
+ bDirty = false;
+- linkKeyFileValid = false;
+- reloadList();
+- updateGUI();
+ linkKeyFileWatch = new KDirWatch(this);
+ connect(linkKeyFileWatch, SIGNAL(dirty(const QString&)),
+ this, SLOT(slotKeyFileChanged()));
+@@ -84,13 +83,51 @@
+ baseDialog->hide();
+ connect(baseDialog, SIGNAL(applyClicked()), this, SLOT(slotApplyFileSettings()));
+ connect(baseDialog, SIGNAL(okClicked()), this, SLOT(slotApplyFileSettings()));
++
++ watchKeys();
+
+- linkKeyFileWatch->addFile(linkKeyFilename);
+ linkKeyFileWatch->startScan(true, true);
++
++ reloadList();
++ updateGUI();
++}
++
++void PairedTab::watchKeys() {
++
++ kdDebug() << "watchKeys()" << endl;
++
++ QDir keyDir(linkKeyPath);
++ keyDir.setFilter( QDir::Dirs );
++ keyDir.setNameFilter("*:*:*:*:*");
++
++ QFileInfo *fi;
++ const QFileInfoList *list = keyDir.entryInfoList();
++ QFileInfoListIterator it(*list);
++
++ linkKeyFilename.clear();
++
++ while ((fi = it.current()) != 0) {
++
++ QString btDeviceDir = fi->fileName();
++ QString filename = keyDir.absPath();
++ filename.append("/").append(btDeviceDir).append("/").append("linkkeys");
++
++ QFile keyFile(filename);
++
++ if (keyFile.exists()) {
++ linkKeyFileWatch->addFile(filename);
++ linkKeyFilename.append(filename);
++ }
++
++ ++it;
++ }
+ }
+
+ void PairedTab::reloadList()
+ {
++
++ kdDebug() << "relodList()" << endl;
++
+ if (bDirty) {
+ if (KMessageBox::warningContinueCancel(this, i18n(
+ "The link key file has changed on disk. Do you want to reload the table and \
+@@ -98,82 +135,96 @@
+ return;
+ }
+ }
+-
+- QFile file(linkKeyFilename);
+-
+- kdDebug() << "reloadList()" << endl;
+ pairingList.clear();
+- linkKeyFileValid = false;
+- if (file.open(IO_ReadOnly)) {
+- linkKeyFileValid = true;
+- bool readSizeMismatch = false;
+- while (true) {
+- PairingInfo newInfo;
+- HcidLinkKeyStruct linkKeyStruct;
+- int rSize = 0;
+- if ((rSize = file.readBlock((char*)&linkKeyStruct, sizeof(HcidLinkKeyStruct)))
+- == sizeof(HcidLinkKeyStruct))
+- {
+- newInfo.localAddr = DeviceAddress(linkKeyStruct.sba);
+- newInfo.remoteAddr = DeviceAddress(linkKeyStruct.dba);
+- newInfo.time.setTime_t(linkKeyStruct.time);
+- newInfo.type = linkKeyStruct.type;
+- for (int n=0; n<16; ++n) {
+- newInfo.linkKey[n] = linkKeyStruct.key[n];
+- }
+- newInfo.remoteName = QString(newInfo.remoteAddr);
+- NameCache::getCachedName(newInfo.remoteAddr, newInfo.remoteName);
+- newInfo.remoteClass = 0;
+- NameCache::getCachedClass(newInfo.remoteAddr, newInfo.remoteClass);
+- pairingList.push_back(newInfo);
+- }
+- else {
+- if (rSize != 0) {
+- readSizeMismatch = true;
+- }
+- break;
+- }
+- kdDebug() << "localAddr read:" << QString(newInfo.localAddr) << endl;
+- }
+-
+- linkKeyFileValid = !readSizeMismatch;
+- file.close();
++
++ QStringList::iterator it;
++ for (it = linkKeyFilename.begin(); it != linkKeyFilename.end(); ++it) {
++
++ QFile file((*it));
++
++ if (file.open(IO_ReadOnly)) {
++
++ QTextStream stream(&file);
++ QString line, localAddr, remoteAddr, symLink, remoteClass;
++
++ while (!stream.atEnd()) {
++ PairingInfo newInfo;
++
++ line = stream.readLine();
++
++ QFileInfo fi(file);
++ QDir dir(fi.dir());
++ localAddr = dir.dirName();
++
++ remoteAddr = line.left(17);
++
++ newInfo.localAddr = DeviceAddress(localAddr);
++ newInfo.remoteAddr = DeviceAddress(remoteAddr);
++
++ // XXX: not provided by linkkey file at the moment
++ // newInfo.time.setTime_t(linkKeyStruct.time);
++
++ newInfo.linkKey = line.mid(18, 32);
++
++ newInfo.remoteName = QString(newInfo.remoteAddr);
++ NameCache::getCachedName(newInfo.remoteAddr, newInfo.remoteName);
++
++ newInfo.remoteClass = 0; // not provided by linkkey file at the moment(?) FIXME
++
++ NameCache::getCachedClass(newInfo.remoteAddr, newInfo.remoteClass);
++ pairingList.push_back(newInfo);
++ }
++
++ file.close();
++ }
+ }
+ }
+
+ bool PairedTab::saveList()
+ {
++ kdDebug() << "saveList()" << endl;
++
+ if (bDirty == false) return true;
+
+- kdDebug() << "saveList()" << endl;
+-
+ if (!stopDaemon()) return false;
+-
+- QFile file(linkKeyFilename);
+- if (file.open(IO_WriteOnly)) {
+- for (unsigned int n=0; n<pairingList.size(); ++n) {
+- HcidLinkKeyStruct info;
+- info.dba = pairingList[n].remoteAddr.getBdaddr(false);
+- for (int p=0; p<16; ++p) {
+- info.key[p] = pairingList[n].linkKey[p];
+- }
+- info.sba = pairingList[n].localAddr.getBdaddr(false);
+- info.time = pairingList[n].time.toTime_t();
+- info.type = pairingList[n].type;
+- file.writeBlock(reinterpret_cast<char*>(&info), sizeof(info));
+- }
+- file.close();
+-
+- if (!startDaemon()) return false;
+
+- bDirty = false;
+- return true;
++ QStringList::iterator it;
++ for (it = linkKeyFilename.begin(); it != linkKeyFilename.end(); ++it) {
++
++ QFile file((*it));
++ QFileInfo fi(file);
++ QDir deviceDir(fi.dir());
++
++ // clear linkkey file
++ file.remove();
++
++ if (file.open(IO_WriteOnly)) {
++ QTextStream stream(&file);
++ for (unsigned int n=0; n<pairingList.size(); ++n) {
++
++ if (pairingList[n].localAddr == deviceDir.dirName())
++ continue;
++
++ stream << pairingList[n].remoteAddr << " ";
++ stream << pairingList[n].linkKey << " ";
++ stream << pairingList[n].remoteClass << '\n';
++ }
++ file.close();
++
++ bDirty = false;
++ }
+ }
+- else {
+- KMessageBox::error(this, i18n("Could not write \
+-link key file. Your changes cannot be saved."), i18n("Error"));
+- return false;
++
++ if (bDirty) {
++ KMessageBox::error(this, i18n("Could not write "
++ "all link key files. Your complete changes cannot be saved."), i18n("Error")); // XXX String update
++
++ return false;
+ }
++
++ if (!startDaemon()) return false;
++
++ return true;
+ }
+
+ bool PairedTab::stopDaemon()
+@@ -192,34 +243,53 @@
+
+ void PairedTab::updateGUI()
+ {
+- vector<PairingInfo>::iterator pairIt;
++ kdDebug() << "updateGUI()" << endl;
++ vector<PairingInfo>::iterator pairIt, remoteIt;
++ KBluetooth::DeviceAddress prevLocalAddr;
++ QListViewItem *viewItem = NULL;
+ pairingListView->clear();
+ for (pairIt = pairingList.begin(); pairIt != pairingList.end(); ++pairIt) {
+- QListViewItem *viewItem = new QListViewItem(pairingListView);
+- pairIt->listViewItem = viewItem;
+-
+- viewItem->setText(0, QString(pairIt->remoteName));
+- QListViewItem *remoteAddrItem = new QListViewItem(viewItem);
+- remoteAddrItem->setPixmap(0, KGlobal::iconLoader()->loadIcon(
+- "pda_blue", KIcon::Small, 16));
+- remoteAddrItem->setSelectable(false);
+- remoteAddrItem->setText(0, QString(pairIt->remoteAddr));
+-
+- QListViewItem *localAddrItem = new QListViewItem(viewItem);
+- localAddrItem->setPixmap(0, KGlobal::iconLoader()->loadIcon(
+- "usbpendrive_unmount", KIcon::Small, 16));
+- localAddrItem->setSelectable(false);
+- localAddrItem->setText(0, QString(pairIt->localAddr));
+-
++
++ if (prevLocalAddr != pairIt->localAddr) {
++ kdDebug() << ">> " << pairIt->localAddr << endl;
++ viewItem = new QListViewItem(pairingListView);
++ viewItem->setSelectable(false);
++ viewItem->setText(0, QString(pairIt->localAddr));
++ viewItem->setOpen(true);
++ viewItem->setPixmap(0, KGlobal::iconLoader()->loadIcon(
++ "usbpendrive_unmount", KIcon::Small, 16));
++ }
++
++
++ remoteIt = pairIt;
++ if (remoteIt->localAddr == pairIt->localAddr) {
++ kdDebug() << "\t>> " << remoteIt->remoteAddr << endl;
++ QListViewItem *remoteAddrItem = new QListViewItem(viewItem);
++ remoteIt->listViewItem = remoteAddrItem;
++ QString iconName = DeviceClassMimeConverter::classToIconName(remoteIt->remoteClass);
++ remoteAddrItem->setPixmap(0, KGlobal::iconLoader()->loadIcon(
++ iconName, KIcon::Small, 16));
++
++ remoteAddrItem->setSelectable(true);
++
++ kdDebug() << "remoteName: " << remoteIt->remoteName << endl;
++ if (remoteIt->remoteName == remoteIt->remoteAddr)
++ remoteAddrItem->setText(0, QString(remoteIt->remoteAddr));
++ else
++ remoteAddrItem->setText(0, QString(remoteIt->remoteAddr).append(" / ").append(remoteIt->remoteName));
++ }
++
++
++ /* not provided by the linkkey file at the moment
++
+ QListViewItem *timeItem = new QListViewItem(viewItem);
+ timeItem->setPixmap(0, KGlobal::iconLoader()->loadIcon(
+ "clock", KIcon::Small, 16));
+ timeItem->setSelectable(false);
+ timeItem->setText(0, pairIt->time.toString());
++ */
++ prevLocalAddr = pairIt->localAddr;
+
+- QString iconName = DeviceClassMimeConverter::classToIconName(pairIt->remoteClass);
+- viewItem->setPixmap(0, KGlobal::iconLoader()->loadIcon(
+- iconName, KIcon::Small, 16));
+ }
+ }
+
+@@ -232,9 +302,14 @@
+
+ void PairedTab::slotRemovePairing()
+ {
++ kdDebug() << "slotRemovePairing()" << endl;
+ bool bDirty = false;
++ kdDebug() << "list size: " << pairingList.size() << endl;
+ for (int n=pairingList.size()-1; n>=0; --n) {
++ kdDebug() << n << " remote: " << pairingList[n].remoteAddr << pairingList[n].listViewItem->text(0) << pairingList[n].listViewItem->isSelected() << endl;
+ if (pairingList[n].listViewItem->isSelected()) {
++ kdDebug() << "erase pair: " << n << endl;
++
+ pairingList.erase(pairingList.begin()+n);
+ bDirty = true;
+ }
+@@ -248,20 +323,22 @@
+
+ void PairedTab::slotSelectionChanged()
+ {
+- for (QListViewItem* i=pairingListView->firstChild(); i != NULL;
+- i = i->nextSibling())
+- {
+- if (i->isSelected()) {
+- removePairingButton->setEnabled(true);
+- return;
+- }
++ for (QListViewItem* i=pairingListView->firstChild(); i != NULL; i = i->nextSibling()) {
++ for (QListViewItem *child=i->firstChild(); child != NULL; child = child->nextSibling())
++ {
++ if (child->isSelected()) {
++ removePairingButton->setEnabled(true);
++ return;
++ }
++ }
+ }
++
+ removePairingButton->setEnabled(false);
+ }
+
+ void PairedTab::slotFileSettings()
+ {
+- fileSettingsDialog->linkKeyFileEdit->setURL(linkKeyFilename);
++ fileSettingsDialog->linkKeyFileEdit->setURL(linkKeyPath);
+ fileSettingsDialog->startCommandEdit->setURL(hcidStartCommand);
+ fileSettingsDialog->stopCommandEdit->setURL(hcidStopCommand);
+
+@@ -270,20 +347,26 @@
+
+ void PairedTab::slotApplyFileSettings()
+ {
+- linkKeyFileWatch->removeFile(linkKeyFilename);
++ QStringList::iterator it;
++ for (it = linkKeyFilename.begin(); it != linkKeyFilename.end(); ++it) {
++ linkKeyFileWatch->removeFile((*it));
++ }
+
+- linkKeyFilename = fileSettingsDialog->linkKeyFileEdit->url();
++ linkKeyPath = fileSettingsDialog->linkKeyFileEdit->url();
+ hcidStartCommand = fileSettingsDialog->startCommandEdit->url();
+ hcidStopCommand = fileSettingsDialog->stopCommandEdit->url();
++
++ kdDebug() << "keypath: " << fileSettingsDialog->linkKeyFileEdit->url() << endl;
+
+ KConfig* config = KApplication::kApplication()->config();
+- config->writeEntry("linkKeyFile", linkKeyFilename);
++ config->writeEntry("linkKeyPath", linkKeyPath);
+ config->writeEntry("hcidStartCommand", hcidStartCommand);
+ config->writeEntry("hcidStopCommand", hcidStopCommand);
++
++ watchKeys();
++
+ reloadList();
+ updateGUI();
+-
+- linkKeyFileWatch->addFile(linkKeyFilename);
+ }
+
+
+--- kdebluetooth/kbluetoothd/kcm_btpaired/pairedtab.h
++++ kdebluetooth/kbluetoothd/kcm_btpaired/pairedtab.h
+@@ -43,7 +43,7 @@
+ KBluetooth::DeviceAddress remoteAddr;
+ QString remoteName;
+ int remoteClass;
+- uint8_t linkKey[16];
++ QString linkKey;
+ uint8_t type;
+ QDateTime time;
+ QListViewItem *listViewItem;
+@@ -52,12 +52,14 @@
+ bool linkKeyFileValid;
+ bool bDirty;
+
+- QString linkKeyFilename;
++ QValueList <QString> linkKeyFilename;
++ QString linkKeyPath;
+ QString hcidStartCommand;
+ QString hcidStopCommand;
+ KDirWatch *linkKeyFileWatch;
+ FileSettingsBase *fileSettingsDialog;
+
++ void watchKeys();
+ void reloadList();
+ bool saveList();
+ bool startDaemon();
--- /dev/null
+Index: kbluetoothd/kcm/servicetab.cpp
+================================================================================
+--- kdebluetooth/kbluetoothd/kcm/servicetab.cpp
++++ kdebluetooth/kbluetoothd/kcm/servicetab.cpp
+@@ -389,7 +389,7 @@
+ {
+ DCOPCall dcop(client, "kbluetoothd", "MetaServer");
+ if (dcop.call("services()")!="QStringList") {
+- disableInterface(i18n("DCOP error when calling services()"));
++ disableInterface(i18n("No Bluetooth device found, disabling interface."));
+ return QStringList();
+ }
+ else {
+--- kdebluetooth/kbluetoothd/libkbluetoothd/checkdaemon.cpp
++++ kdebluetooth/kbluetoothd/libkbluetoothd/checkdaemon.cpp
+@@ -36,8 +36,8 @@
+ KMessageBox::information(mainWidget,
+ i18n("<p>The KDE Bluetooth Daemon (<i>kbluetoothd</i>) is \
+ needed and was started.</p>"),
+- i18n("KDE Bluetooth Framework"),
+- "kbluetoothd_autostart_msgbox");
++ i18n("KDE Bluetooth Framework")/*,
++ "kbluetoothd_autostart_msgbox"*/);
+ }
+ return true;
+ }
--- /dev/null
+--- kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/Makefile.am
++++ kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/Makefile.am
+@@ -4,10 +4,10 @@
+ # Code
+ bin_PROGRAMS = kbluetoothd
+
+-kbluetoothd_SOURCES = rfcommportlistener.cpp sdprecord.cpp confirmationdlgbase.ui confirmation.cpp devicenamecache.cpp devicenamecache.skel metaserver.skel hcidevmonitor.cpp trayicon.cpp main.cpp application.cpp conmainwidget.ui condetailswidget.ui metaserver.cpp connectiondlg.cpp devicescanner.skel devicescanner.cpp pinserver.cpp pinserver.skel pingendialog.ui pindefdialog.ui pindialog.cpp procinheritsock.cpp mostrecentlyused.skel mostrecentlyused.cpp hcilistener.cpp neighbourmonitor.cpp portlistener.cpp
++kbluetoothd_SOURCES = rfcommportlistener.cpp sdprecord.cpp confirmationdlgbase.ui confirmation.cpp devicenamecache.cpp devicenamecache.skel metaserver.skel hcidevmonitor.cpp trayicon.cpp main.cpp application.cpp conmainwidget.ui condetailswidget.ui metaserver.cpp connectiondlg.cpp devicescanner.skel devicescanner.cpp pinserver.cpp pinserver.skel pingendialog.ui pindefdialog.ui pindialog.cpp procinheritsock.cpp mostrecentlyused.skel mostrecentlyused.cpp hcilistener.cpp neighbourmonitor.cpp portlistener.cpp dbuspasskeyagent.cpp
+
+ kbluetoothd_LDFLAGS = $(KDE_RPATH) $(all_libraries)
+-kbluetoothd_LDADD = ../../libkbluetooth/libkbluetooth.la ../libkbluetoothd/libkbluetoothd.la $(LIB_KIO) $(LIB_KDEUI)
++kbluetoothd_LDADD = ../../libkbluetooth/libkbluetooth.la ../libkbluetoothd/libkbluetoothd.la $(LIB_KIO) $(LIB_KDEUI) $(DBUS_LIBS) -ldbus-qt-1
+
+ # Services
+ kde_servicetypes_DATA = kbluetoothdmodule.desktop
+@@ -31,6 +31,6 @@
+ $(INSTALL_DATA) $(srcdir)/eventsrc $(DESTDIR)$(kde_datadir)/kbluetoothd/eventsrc
+
+ # set the include path for X, qt and KDE
+-INCLUDES = -I$(top_srcdir)/kdebluetooth $(all_includes) $(BLUETOOTH_CFLAGS)
++INCLUDES = -I$(top_srcdir)/kdebluetooth $(all_includes) $(BLUETOOTH_CFLAGS) $(DBUS_CFLAGS)
+
+-noinst_HEADERS = procinheritsock.h mostrecentlyused.h hcilistener.h neighbourmonitor.h
++noinst_HEADERS = procinheritsock.h mostrecentlyused.h hcilistener.h neighbourmonitor.h dbuspasskeyagent.h
+--- ./kdebluetooth/kbluetoothd/kbluetoothd/application.cpp.orig 2006-10-16 14:23:56.000000000 +0400
++++ ./kdebluetooth/kbluetoothd/kbluetoothd/application.cpp 2007-03-30 23:34:21.792836593 +0400
+@@ -26,6 +26,8 @@
+ #include <libkbluetooth/configinfo.h>
+ #include <bluetooth/hci.h>
+
++#include "dbuspasskeyagent.h"
++
+ using namespace KBluetooth;
+ using namespace std;
+
+@@ -57,6 +59,8 @@
+ hciListener->start();
+ bFirstNewInstance = true;
+ trayIcon->slotMruMenuUpdate();
++
++ agent = new DBusPasskeyAgent(this);
+
+ // Warn the user if the location of kbluepin has changed
+ // Don't show if bluez-libs is 3.x
+@@ -74,6 +78,7 @@
+ mru->writeConfig();
+ delete m_config;
+ delete trayIcon;
++ delete agent;
+ }
+
+ int KBluetoothdApp::newInstance()
+
+--- kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/application.h
++++ kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/application.h
+@@ -29,6 +29,7 @@
+ class MostRecentlyUsed;
+ class HciListener;
+ class HciDevMonitor;
++class DBusPasskeyAgent;
+
+ class KBluetoothdApp: public KUniqueApplication
+ {
+@@ -52,6 +53,7 @@
+ void slotHciDeviceLost();
+ void configUpdate();
+ private:
++ DBusPasskeyAgent *agent;
+ void startServices();
+ void endServices();
+ KConfig* m_config;
+--- kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/configure.in.in
++++ kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/configure.in.in
+@@ -7,3 +7,18 @@
+ KDE_EXPAND_MAKEVAR(KBLUETOOTHDJOBTEMPLATEDIR, KBLUETOOTHDJOBTEMPLATEDIR)
+ AC_SUBST(KBLUETOOTHDJOBTEMPLATEDIR)
+ AC_DEFINE_UNQUOTED(KBLUETOOTHDJOBTEMPLATEDIR, "$KBLUETOOTHDJOBTEMPLATEDIR", [job templates for kbluetoothd])
++
++# DBUS
++PKG_CHECK_MODULES(DBUS, "dbus-1")
++
++AC_SUBST(DBUS_CFLAGS)
++AC_SUBST(DBUS_LIBS)
++
++# DBUS QT BINDING ### stolen from kpowersave and knetworkmanager ;) #
++CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS $all_includes -DDBUS_API_SUBJECT_TO_CHANGE"
++AC_LANG_SAVE
++AC_LANG_CPLUSPLUS
++AC_CHECK_HEADER([dbus/connection.h],,[AC_MSG_ERROR([You need D-BUS/Qt3 bindings])])
++AC_CHECK_HEADER([dbus/message.h],,[AC_MSG_ERROR([You need D-BUS/Qt3 bindings])])
++#CPPFLAGS=$safe_CPPFLAGS
++AC_LANG_RESTORE
+--- kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/dbuspasskeyagent.cpp
++++ kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/dbuspasskeyagent.cpp
+@@ -0,0 +1,296 @@
++/*
++ *
++ * BlueZ Passkey Agent Interface for kbluetoothd
++ *
++ * Copyright (C) 2006 Daniel Gollub <dgollub@suse.de>
++ *
++ *
++ * This file is part of kbluetoothd.
++ *
++ * kbluetooth is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * libkbluetooth is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with libkbluetooth; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++#include <kdebug.h>
++#include <unistd.h>
++#include "dbuspasskeyagent.h"
++
++#define KBLUETOOTH_DBUS_PATH "/org/bluez/kbluetoothd_"
++
++DBusMessage* DBusPasskeyAgent::_msg = NULL;
++KBluetoothdApp *DBusPasskeyAgent::_app = NULL;
++PinDialog* DBusPasskeyAgent::_pinDialog = NULL;
++DBusPasskeyAgent *DBusPasskeyAgent::_ctx = NULL;
++
++DBusPasskeyAgent::DBusPasskeyAgent(KBluetoothdApp *app) : QObject()
++{
++ this->_app = app;
++ this->_ctx = this;
++ this->agentpath = QString(KBLUETOOTH_DBUS_PATH "%1").arg(getpid());
++ dbusInit();
++ addHandler();
++ registerDefaultPasskeyAgent();
++}
++
++DBusPasskeyAgent::~DBusPasskeyAgent()
++{
++ kdDebug() << __func__ << endl;
++ unregisterDefaultPasskeyAgent();
++}
++
++bool DBusPasskeyAgent::dbusInit()
++{
++ kdDebug() << "<<<<< " << __func__ << endl;
++
++ kdDebug() << __func__ << "()" << endl;
++
++ DBusError error;
++ dbus_error_init(&error);
++ conn = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
++
++ if (!conn) {
++ kdDebug() << "dbus_bus_get() failed...." << endl;
++ if (dbus_error_is_set(&error)) {
++ kdDebug() << error.message << endl;
++ dbus_error_free(&error);
++ return false;
++ }
++ }
++
++ _dbusConnection = new DBusQt::Connection(this);
++ if (!_dbusConnection) {
++ kdDebug() << __func__ << " DBusQt::Connection() failed." << endl;
++ return false;
++ }
++
++ _dbusConnection->dbus_connection_setup_with_qt_main(conn);
++
++ return true;
++}
++
++bool DBusPasskeyAgent::registerDefaultPasskeyAgent()
++{
++ kdDebug() << "<<<<< " << __func__ << endl;
++
++ kdDebug() << __func__ << "()" << endl;
++
++ DBusMessage *reply = NULL;
++ DBusError error;
++
++ dbus_error_init(&error);
++
++ DBusMessage *msg = NULL;
++ msg = dbus_message_new_method_call(INTERFACE_BLUEZ, BLUEZ_PATH, INTERFACE_SECURITY, "RegisterDefaultPasskeyAgent");
++ if (!msg) {
++ kdDebug() << "kbluetoothd (Default Passkey Agent): Can't allocate new method call" << endl;
++ return false;
++ }
++
++ const char *path = agentpath.latin1();
++ dbus_message_append_args(msg, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID);
++ reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &error);
++ if (!reply) {
++ if (dbus_error_is_set(&error)) {
++ kdDebug() << "kbluetoothd (Default Passkey Agent): " << __func__ << "(): " << error.message << endl;
++ dbus_error_free(&error);
++ return false;
++ }
++ }
++
++ return true;
++}
++
++bool DBusPasskeyAgent::unregisterDefaultPasskeyAgent()
++{
++ kdDebug() << "<<<<< " << __func__ << endl;
++
++ DBusMessage *reply = NULL;
++ DBusError error;
++
++ dbus_error_init(&error);
++
++ DBusMessage *msg = NULL;
++ msg = dbus_message_new_method_call(INTERFACE_BLUEZ, BLUEZ_PATH, INTERFACE_SECURITY, "UnregisterDefaultPasskeyAgent");
++ if (!msg) {
++ kdDebug() << "kbluetoothd (Unregister Default Passkey Agent): Can't allocate new method call" << endl;
++ return false;
++ }
++
++ const char *path = agentpath.latin1();
++ dbus_message_append_args(msg, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID);
++ reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &error);
++ if (!reply) {
++ if (dbus_error_is_set(&error)) {
++ kdDebug() << "kbluetoothd (Default Passkey Agent): " << __func__ << "(): " << error.message << endl;
++ dbus_error_free(&error);
++ return false;
++ }
++ }
++
++ return true;
++}
++
++bool DBusPasskeyAgent::addHandler()
++{
++ kdDebug() << "<<<<< " << __func__ << endl;
++
++ DBusError error;
++ DBusHandleMessageFunction filter = filterFunction;
++
++ dbus_error_init(&error);
++
++ if (!dbus_connection_add_filter(conn, filter, NULL, NULL)) {
++ return false;
++ }
++
++ // TODO ... error handler
++ dbus_bus_add_match(conn, "interface=" DBUS_INTERFACE_DBUS ","
++ "member=NameOwnerChanged, arg0=" INTERFACE_BLUEZ, &error);
++ dbus_bus_add_match(conn, "type='signal',interface='" INTERFACE_SECURITY "',"
++ "path='" BLUEZ_PATH "',sender='" INTERFACE_BLUEZ "'", &error);
++ dbus_bus_add_match(conn, "type='signal',interface='" INTERFACE_MANAGER "',"
++ "path='" BLUEZ_PATH "',sender='" INTERFACE_BLUEZ "'", &error);
++
++
++ return true;
++}
++
++DBusHandlerResult DBusPasskeyAgent::filterFunction(DBusConnection * /*conn*/, DBusMessage *msg, void * /*data*/)
++{
++ kdDebug() << __func__ << "()....................." << endl;
++ const char *member = dbus_message_get_member(msg);
++
++ if (!member)
++ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++
++ kdDebug() << __func__ << "(): " << member << endl;
++
++ if (!strcmp("Request", member)) {
++ return _ctx->requestMessage(msg);
++ } else if (!strcmp("NameOwnerChanged", member)) {
++ return _ctx->ownerChanged(msg);
++ } else if (!strcmp("AdapterAdded", member)) {
++ _ctx->registerDefaultPasskeyAgent();
++ return DBUS_HANDLER_RESULT_HANDLED;
++ }
++
++ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++}
++
++QString DBusPasskeyAgent::getRemoteName(const char *path, const char *address)
++{
++
++ const char *remotename;
++ DBusError error;
++ dbus_error_init(&error);
++
++ DBusMessage *msg = NULL;
++ msg = dbus_message_new_method_call(INTERFACE_BLUEZ, path, "org.bluez.Adapter", "GetRemoteName");
++ if (!msg) {
++ kdDebug() << "kbluetoothd (Default Passkey Agent) " << __func__ << "(): Can't allocate new method call" << endl;
++ return false;
++ }
++
++ dbus_message_append_args(msg, DBUS_TYPE_STRING, &address, DBUS_TYPE_INVALID);
++ DBusMessage *reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &error);
++ if (!reply) {
++ if (dbus_error_is_set(&error)) {
++ kdDebug() << "kbluetoothd (Default Passkey Agent): " << __func__ << "(): " << error.message << endl;
++ dbus_error_free(&error);
++ return QString::null;
++ }
++ }
++
++ dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &remotename, DBUS_TYPE_INVALID);
++ dbus_message_unref(reply);
++
++ return QString::fromUtf8(remotename);
++}
++
++DBusHandlerResult DBusPasskeyAgent::requestMessage(DBusMessage *msg) {
++
++ const char *path, *address;
++ QString remotename = QString::null;
++
++ _msg = msg;
++
++ dbus_message_ref(_msg);
++
++ if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path,
++ DBUS_TYPE_STRING, &address, DBUS_TYPE_INVALID)) {
++ kdDebug() << "DBusPasskeyAgent: Invalid argumentes for Passkey Request method." << endl;
++ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
++ }
++
++ /* get address and remote name */
++
++ remotename = _ctx->getRemoteName(path, address);
++
++
++ if (remotename == QString::null)
++ remotename = QString("n/a");
++
++ _pinDialog = new PinDialog(NULL, true, false, QString(address), remotename, _ctx);
++ _pinDialog->show();
++
++ return DBUS_HANDLER_RESULT_HANDLED;
++}
++
++DBusHandlerResult DBusPasskeyAgent::ownerChanged(DBusMessage *msg) {
++ kdDebug() << __func__ << "()" << endl;
++
++ char *service, *old_owner, *new_owner;
++
++ if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &service,
++ DBUS_TYPE_STRING, &old_owner,
++ DBUS_TYPE_STRING, &new_owner,
++ DBUS_TYPE_INVALID)) {
++
++ if (!strcmp(service, INTERFACE_BLUEZ)) {
++ if (new_owner && (strlen(new_owner) > 0)) {
++ kdDebug() << __func__ << "(): rerun default passkey agent." << endl;
++ _ctx->registerDefaultPasskeyAgent();
++ }
++ }
++ }
++
++
++ return DBUS_HANDLER_RESULT_HANDLED;
++}
++
++void DBusPasskeyAgent::sendPin() {
++ kdDebug() << __func__ << "()" << endl;
++
++ QString qpasskey = _pinDialog->getPin();
++ const char *passkey = qpasskey.ascii();
++
++ DBusMessage *reply = dbus_message_new_method_return(_msg);
++ if (!reply) {
++ kdDebug() << __func__ <<" (): Reply failed." << endl;
++ goto error_free;
++ }
++
++ dbus_message_append_args(reply, DBUS_TYPE_STRING, &passkey, DBUS_TYPE_INVALID);
++
++ dbus_connection_send(conn, reply, NULL);
++ dbus_message_unref(reply);
++
++ kdDebug() << __func__ << "(): send." << endl;
++
++error_free:
++ dbus_message_unref(_msg);
++}
++
++#include "dbuspasskeyagent.moc"
+--- kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/dbuspasskeyagent.h
++++ kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/dbuspasskeyagent.h
+@@ -0,0 +1,91 @@
++/*
++ *
++ * BlueZ Passkey Agent Interface for kbluetoothd
++ *
++ * Copyright (C) 2006 Daniel Gollub <dgollub@suse.de>
++ *
++ *
++ * This file is part of kbluetoothd.
++ *
++ * kbluetooth is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * libkbluetooth is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with libkbluetooth; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ */
++
++
++#ifndef DBUSPASSKEYAGENT_H
++#define DBUSPASSKEYAGENT_H
++
++#ifndef DBUS_API_SUBJECT_TO_CHANGE
++#define DBUS_API_SUBJECT_TO_CHANGE
++#endif
++
++#include <qobject.h>
++
++#include <dbus/dbus.h>
++#include <dbus/connection.h>
++
++#include "application.h"
++#include "pindialog.h"
++
++#define BLUEZ_PATH "/org/bluez"
++#define INTERFACE_BLUEZ "org.bluez"
++#define INTERFACE_MANAGER "org.bluez.Manager"
++#define INTERFACE_SECURITY "org.bluez.Security"
++#define INTERFACE_PASSKEYAGENT "org.bluez.PasskeyAgent"
++
++class PinDialog;
++
++class DBusPasskeyAgent : public QObject
++{
++
++ Q_OBJECT
++
++ public:
++ DBusPasskeyAgent(KBluetoothdApp *app);
++ ~DBusPasskeyAgent();
++
++ public slots:
++ void sendPin();
++
++ private:
++
++ bool dbusInit();
++
++ bool registerDefaultPasskeyAgent();
++ bool unregisterDefaultPasskeyAgent();
++
++ bool addHandler();
++
++ QString getRemoteName(const char *path, const char *address);
++
++ static DBusHandlerResult filterFunction(DBusConnection *conn, DBusMessage *msg, void *data);
++ static DBusHandlerResult requestMessage(DBusMessage *msg);
++ static DBusHandlerResult ownerChanged(DBusMessage *msg);
++
++
++
++ static KBluetoothdApp *_app;
++ static DBusPasskeyAgent *_ctx;
++ static DBusMessage *_msg;
++ static PinDialog *_pinDialog;
++
++
++ QString agentpath;
++ DBusConnection *conn;
++ DBusQt::Connection *_dbusConnection;
++
++};
++
++#endif // DBUSPASSKEYAGENT_H
+--- kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/pindialog.cpp
++++ kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/pindialog.cpp
+@@ -30,7 +30,7 @@
+ #include <klocale.h>
+
+ PinDialog::PinDialog(QWidget* owner, bool /*bIncoming*/,
+- bool ownAuth, QString addr, QString devName) :
++ bool ownAuth, QString addr, QString devName, DBusPasskeyAgent *agent) :
+ KDialogBase(owner, "pinrequest", ownAuth, "Pin Request",
+ ownAuth?(Close):(Ok|Cancel))
+ {
+@@ -63,6 +63,8 @@
+ pinDlg->pinEdit->setFocus();
+ }
+
++ connect(this, SIGNAL (okClicked()), agent, SLOT (sendPin()));
++
+ if (ownAuth) {
+ setMainWidget(pinGenDlg);
+ pinGenDlg->goButton->setFocus();
+@@ -76,9 +78,14 @@
+ {
+ }
+
++QString PinDialog::getPin()
++{
++ return pinDlg->pinEdit->text();
++}
++
+ QString PinDialog::getPin(bool bIn, bool ownAuth, QString addr, QString name)
+ {
+- QGuardedPtr<PinDialog> dlg = new PinDialog(NULL, bIn, ownAuth, addr, name);
++ QGuardedPtr<PinDialog> dlg = new PinDialog(NULL, bIn, ownAuth, addr, name, NULL);
+ if (ownAuth == true) {
+ if (!dlg->pinGenDlg) return QString::null;
+ dlg->show();
+--- kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/pindialog.h
++++ kdebluetooth/kdebluetooth/kbluetoothd/kbluetoothd/pindialog.h
+@@ -15,8 +15,11 @@
+ #include <kdialogbase.h>
+ #include <qguardedptr.h>
+
++#include "dbuspasskeyagent.h"
++#include "pindefdialog.h"
++
+ class PinGenerateDialog;
+-class PinDefaultDialog;
++//class PinDefaultDialog;
+ class QWidget;
+ namespace KBluetooth {
+ class HciSocket;
+@@ -29,11 +32,13 @@
+ {
+ Q_OBJECT
+ public:
+- PinDialog(QWidget* owner, bool bIn, bool ownAuth, QString addr, QString name);
++ PinDialog(QWidget* owner, bool bIn, bool ownAuth, QString addr, QString name, DBusPasskeyAgent *agent);
+ ~PinDialog();
++ QString getPin();
+ static QString getPin(bool bIn, bool ownAuth, QString addr, QString name);
++ PinDefaultDialog *pinDlg;
+ protected:
+- QGuardedPtr<PinDefaultDialog> pinDlg;
++// QGuardedPtr<PinDefaultDialog> pinDlg;
+ QGuardedPtr<PinGenerateDialog> pinGenDlg;
+ QString addr;
+ KBluetooth::HciSocket *hciSocket;
--- /dev/null
+--- kdebluetooth/libkbluetooth/sdpattribute.cpp
++++ kdebluetooth/libkbluetooth/sdpattribute.cpp
+@@ -121,23 +121,23 @@
+ }
+ }
+ else {
+- ret.value.uuid128.data[0] = (lo >> 0) && 0xFF;
+- ret.value.uuid128.data[1] = (lo >> 8) && 0xFF;
+- ret.value.uuid128.data[2] = (lo >> 16) && 0xFF;
+- ret.value.uuid128.data[3] = (lo >> 24) && 0xFF;
+- ret.value.uuid128.data[4] = (lo >> 32) && 0xFF;
+- ret.value.uuid128.data[5] = (lo >> 40) && 0xFF;
+- ret.value.uuid128.data[6] = (lo >> 48) && 0xFF;
+- ret.value.uuid128.data[7] = (lo >> 56) && 0xFF;
++ ret.value.uuid128.data[0] = (lo >> 0) & 0xFF;
++ ret.value.uuid128.data[1] = (lo >> 8) & 0xFF;
++ ret.value.uuid128.data[2] = (lo >> 16) & 0xFF;
++ ret.value.uuid128.data[3] = (lo >> 24) & 0xFF;
++ ret.value.uuid128.data[4] = (lo >> 32) & 0xFF;
++ ret.value.uuid128.data[5] = (lo >> 40) & 0xFF;
++ ret.value.uuid128.data[6] = (lo >> 48) & 0xFF;
++ ret.value.uuid128.data[7] = (lo >> 56) & 0xFF;
+
+- ret.value.uuid128.data[8] = (hi >> 0) && 0xFF;
+- ret.value.uuid128.data[9] = (hi >> 8) && 0xFF;
+- ret.value.uuid128.data[10] = (hi >> 16) && 0xFF;
+- ret.value.uuid128.data[11] = (hi >> 24) && 0xFF;
+- ret.value.uuid128.data[12] = (hi >> 32) && 0xFF;
+- ret.value.uuid128.data[13] = (hi >> 40) && 0xFF;
+- ret.value.uuid128.data[14] = (hi >> 48) && 0xFF;
+- ret.value.uuid128.data[15] = (hi >> 56) && 0xFF;
++ ret.value.uuid128.data[8] = (hi >> 0) & 0xFF;
++ ret.value.uuid128.data[9] = (hi >> 8) & 0xFF;
++ ret.value.uuid128.data[10] = (hi >> 16) & 0xFF;
++ ret.value.uuid128.data[11] = (hi >> 24) & 0xFF;
++ ret.value.uuid128.data[12] = (hi >> 32) & 0xFF;
++ ret.value.uuid128.data[13] = (hi >> 40) & 0xFF;
++ ret.value.uuid128.data[14] = (hi >> 48) & 0xFF;
++ ret.value.uuid128.data[15] = (hi >> 56) & 0xFF;
+
+ ret.type = SDP_UUID128;
+ }
--- /dev/null
+--- kdebluetooth/kbluetoothd/kbluetoothd/kbluetoothd.autostart.desktop
++++ kdebluetooth/kbluetoothd/kbluetoothd/kbluetoothd.autostart.desktop
+@@ -40,4 +40,4 @@
+ X-DCOP-ServiceType=Unique
+ #X-KDE-Library=klipper_panelapplet
+ #X-KDE-UniqueApplet=true
+-X-KDE-autostart-condition=kbluetoothdrc:General:AutoStart:true
++X-KDE-autostart-condition=kbluetoothdrc:General:AutoStart:false
+--- kdebluetooth/libkbluetooth/hcisocket.cpp
++++ kdebluetooth/libkbluetooth/hcisocket.cpp
+@@ -56,7 +56,7 @@
+ s = ::socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ if (s < 0)
+ {
+- kdWarning() << "HciSocket::open(): Error creating socket" << endl;
++ kdDebug() << "HciSocket::open(): Error creating socket" << endl;
+ emit error(errno, i18n("Error creating socket"));
+ return false;
+ }
--- /dev/null
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/kdebluetooth/kdebluetooth-1.0_beta2-r2.ebuild,v 1.1 2007/04/08 11:02:24 genstef Exp $
+
+inherit kde autotools
+
+MY_PV=${PV}
+MY_P=${PN}-${MY_PV}
+S=${WORKDIR}/${MY_P}
+
+DESCRIPTION="KDE Bluetooth Framework"
+HOMEPAGE="http://bluetooth.kmobiletools.org/"
+SRC_URI="mirror://sourceforge/kde-bluetooth/${MY_P}.tar.bz2"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~hppa ~ppc sparc ~x86"
+IUSE="irmc"
+
+DEPEND=">=dev-libs/openobex-1.1
+ >=net-wireless/bluez-libs-2.15
+ >=media-libs/libvorbis-1.0
+ >=dev-libs/dbus-qt3-old-0.70
+ irmc? ( || ( >=kde-base/kitchensync-3.4_beta1 >=kde-base/kdepim-3.4_beta1 ) )"
+
+RDEPEND="${DEPEND}
+ || ( ( kde-base/kdialog kde-base/konqueror ) kde-base/kdebase )
+ net-wireless/bluez-utils"
+
+PATCHES="${FILESDIR}/better-menu-names.diff
+ ${FILESDIR}/kcm-btpaired-fix.diff
+ ${FILESDIR}/kcm-no-dcop-error.diff
+ ${FILESDIR}/kdebluetooth-dbuspasskeyagent.diff
+ ${FILESDIR}/kdebluetooth-sdp-bitop.diff
+ ${FILESDIR}/kdebluetooth.diff"
+
+
+LANGS="bg br ca cs cy da de el en_GB es et fi fr ga gl hu is it ja ka lt
+mt nb nl nn pa pl pt pt_BR ro ru rw sk sr sr@Latn sv ta tr uk zh_CN"
+
+for X in ${LANGS} ; do
+ IUSE="${IUSE} linguas_${X}"
+done
+
+need-kde 3
+
+src_unpack() {
+ kde_src_unpack
+ cd "${WORKDIR}/${P}/po"
+ for X in ${LANGS} ; do
+ use linguas_${X} || rm -rf "${X}"
+ done
+ rm -f "${S}/configure"
+ #eaclocal && eautoconf || die "autotools failed"
+}
+
+src_compile() {
+ # Change defaults to match our bluez-utils setup
+ sed -i -e 's,/etc/init\.d/bluez-utils,/etc/init\.d/bluetooth,' \
+ "${S}/kdebluetooth/kbluetoothd/kcm_btpaired/pairedtab.cpp" || die
+ local myconf="--without-xmms $(use_enable irmc irmcsynckonnector)"
+ kde_src_compile
+}
+
+pkg_postinst() {
+ einfo 'This version of kde-bluetooth provides a replacement for the'
+ einfo 'standard bluepin program "kbluepin". If you want to use this version,'
+ einfo 'you have to edit "/etc/bluetooth/hcid.conf" and change the line'
+ einfo '"pin_helper oldbluepin;" to "pin_helper /usr/lib/kdebluetooth/kbluepin;".'
+ einfo 'Then restart hcid to make the change take effect.'
+}