diff options
author | Emanoil Kotsev <deloptes@gmail.com> | 2023-05-21 00:21:55 +0000 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-05-23 10:46:29 +0900 |
commit | 5d198d9d46e8a6f22c15bd017f456456ed8f48f4 (patch) | |
tree | 1ebe9381afffff21d0e07278df2c392c8da23478 | |
parent | 83438b8e102d19834037e5dc9f8217e46f54f38a (diff) | |
download | tdebluez-5d198d9d46e8a6f22c15bd017f456456ed8f48f4.tar.gz tdebluez-5d198d9d46e8a6f22c15bd017f456456ed8f48f4.zip |
Fix issue when multiple devices with the same name are present. This resolves issue #24.
Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
(cherry picked from commit bf0db26c6cb8094dee5c0234ab95503090b76881)
-rw-r--r-- | src/tdebluez/devicewizard.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tdebluez/devicewizard.cpp b/src/tdebluez/devicewizard.cpp index f7f44db..ee4c04b 100644 --- a/src/tdebluez/devicewizard.cpp +++ b/src/tdebluez/devicewizard.cpp @@ -626,6 +626,17 @@ void DeviceWizard::slotInsertDevice(const TQString& path) TQListViewItem *devItem = deviceBox->findItem(addr, 2, TQt::ExactMatch); + int nitems=0; + TQListViewItem * devItem2 = deviceBox->firstChild(); + while( devItem2 ) { + TQString iname = devItem2->text(1); + if ( iname.startsWith(name) ) + nitems++; + devItem2 = devItem2->nextSibling(); + } + // device with same name already exists + if (nitems>0) + name = name.append("#%1").arg(nitems); //device was already setup but is not in the deviceBox if (paired && !devItem) { |