~kubuntu-members/kamera/4.11

« back to all changes in this revision

Viewing changes to kioslave/kamera.cpp

  • Committer: Marcus Meissner
  • Date: 2012-06-20 22:11:02 UTC
  • Revision ID: git-v1:306c0274d6d30e54a80e255f302ea57c18802e54
autodetect usb cameras

do not show autodetectable cameras if they are not detected
BUG 301563

Show diffs side-by-side

added added

removed removed

Lines of Context:
610
610
                        /* Save them, even though we can autodetect them for
611
611
                         * offline listing.
612
612
                         */
 
613
#if 0
613
614
                        KConfigGroup cg(m_config, model);
614
615
                        cg.writeEntry("Model", model);
615
616
                        cg.writeEntry("Path", value);
 
617
#endif
616
618
                        modelcnt[model]++;
617
619
                }
618
620
                gp_list_free (list);
629
631
                        KConfigGroup cg(m_config, *it);
630
632
                        m_cfgPath = cg.readEntry("Path");
631
633
 
632
 
                        /* If autodetect by USB autodetect ... skip it here.
633
 
                         * We leave unattached USB cameras in here, because the user
634
 
                         * might plug them in later and does not want to press reload.
635
 
                         * We add them with port "usb:".
636
 
                         */
637
 
                        if (modelcnt[*it] > 0)
 
634
                        // we autodetected those ...
 
635
                        if (m_cfgPath.contains(QString("usb:"))) {
 
636
                                cg.deleteGroup();
638
637
                                continue;
 
638
                        }
639
639
 
640
640
                        QString xname;
641
641
 
642
642
                        entry.clear();
643
643
                        entry.insert(KIO::UDSEntry::UDS_FILE_TYPE,S_IFDIR);
644
644
                        entry.insert(KIO::UDSEntry::UDS_ACCESS,(S_IRUSR | S_IRGRP | S_IROTH |S_IWUSR | S_IWGRP | S_IWOTH));
645
 
                        /* Avoid setting usb:xxx,yyy. */
646
 
                        if (m_cfgPath.contains("usb:")>0) {
647
 
                                xname = (*it)+"@"+"usb:";
648
 
                                names[*it] = "usb:";
649
 
                        } else {
650
 
                                xname = (*it)+"@"+m_cfgPath;
651
 
                        }
 
645
                        xname = (*it)+"@"+m_cfgPath;
652
646
                        entry.insert(KIO::UDSEntry::UDS_NAME,path_quote(xname));
653
647
                        // do not confuse regular users with the @usb... 
654
648
                        entry.insert(KIO::UDSEntry::UDS_DISPLAY_NAME,*it);