summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanoil Kotsev <deloptes@gmail.com>2023-05-21 00:21:55 +0000
committerTDE Gitea <gitea@mirror.git.trinitydesktop.org>2023-05-22 01:08:49 +0000
commitbf0db26c6cb8094dee5c0234ab95503090b76881 (patch)
treeee2f880909ca04f52540dc616dcf4e161cb82c99
parente0a77280fd3a0a53671d8e7f669daa29f7fe4713 (diff)
downloadtdebluez-bf0db26c6cb8094dee5c0234ab95503090b76881.tar.gz
tdebluez-bf0db26c6cb8094dee5c0234ab95503090b76881.zip
Fix issue when multiple devices with the same name are present. This resolves issue #24.
Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
-rw-r--r--src/tdebluez/devicewizard.cpp11
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)
{