From bf0db26c6cb8094dee5c0234ab95503090b76881 Mon Sep 17 00:00:00 2001 From: Emanoil Kotsev Date: Sun, 21 May 2023 00:21:55 +0000 Subject: Fix issue when multiple devices with the same name are present. This resolves issue #24. Signed-off-by: Emanoil Kotsev --- src/tdebluez/devicewizard.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') 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) { -- cgit v1.2.1