Diffstat (limited to 'noncore/net/opietooth/manager/scandialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index bccc6c2..160e8dd 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp | |||
@@ -47,31 +47,31 @@ namespace OpieTooth { | |||
47 | setCaption( tr( "Scan for devices" ) ); | 47 | setCaption( tr( "Scan for devices" ) ); |
48 | 48 | ||
49 | Layout11 = new QVBoxLayout( this ); | 49 | Layout11 = new QVBoxLayout( this ); |
50 | Layout11->setSpacing( 6 ); | 50 | Layout11->setSpacing( 6 ); |
51 | Layout11->setMargin( 0 ); | 51 | Layout11->setMargin( 0 ); |
52 | 52 | ||
53 | progress = new QProgressBar( this, "progbar"); | 53 | progress = new QProgressBar( this, "progbar"); |
54 | progress->setTotalSteps(20); | 54 | progress->setTotalSteps(20); |
55 | 55 | ||
56 | StartStopButton = new QPushButton( this, "StartButton" ); | 56 | StartStopButton = new QPushButton( this, "StartButton" ); |
57 | StartStopButton->setText( tr( "Start scan" ) ); | 57 | StartStopButton->setText( tr( "Start scan" ) ); |
58 | 58 | ||
59 | ListView1 = new QListView( this, "ListView1" ); | 59 | serviceView = new QListView( this, "serviceView" ); |
60 | 60 | ||
61 | //ListView1->addColumn( tr( "Add" ) ); | 61 | //serviceView->addColumn( tr( "Add" ) ); |
62 | ListView1->addColumn( tr( "Add Device" ) ); | 62 | serviceView->addColumn( tr( "Add Device" ) ); |
63 | //ListView1->addColumn( tr( "Type" ) ); | 63 | //serviceView->addColumn( tr( "Type" ) ); |
64 | 64 | ||
65 | Layout11->addWidget( ListView1 ); | 65 | Layout11->addWidget( serviceView ); |
66 | Layout11->addWidget( progress ); | 66 | Layout11->addWidget( progress ); |
67 | Layout11->addWidget( StartStopButton ); | 67 | Layout11->addWidget( StartStopButton ); |
68 | 68 | ||
69 | localDevice = new Manager( "hci0" ); | 69 | localDevice = new Manager( "hci0" ); |
70 | 70 | ||
71 | connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); | 71 | connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); |
72 | connect( localDevice, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ), | 72 | connect( localDevice, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ), |
73 | this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ; | 73 | this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ; |
74 | 74 | ||
75 | progressStat = 0; | 75 | progressStat = 0; |
76 | m_search = false; | 76 | m_search = false; |
77 | } | 77 | } |
@@ -93,67 +93,67 @@ namespace OpieTooth { | |||
93 | 93 | ||
94 | 94 | ||
95 | void ScanDialog::startSearch() { | 95 | void ScanDialog::startSearch() { |
96 | if ( m_search ) { | 96 | if ( m_search ) { |
97 | stopSearch(); | 97 | stopSearch(); |
98 | return; | 98 | return; |
99 | } | 99 | } |
100 | m_search = true; | 100 | m_search = true; |
101 | progress->setProgress(0); | 101 | progress->setProgress(0); |
102 | progressStat = 0; | 102 | progressStat = 0; |
103 | 103 | ||
104 | // empty list before a new scan | 104 | // empty list before a new scan |
105 | ListView1->clear(); | 105 | serviceView->clear(); |
106 | 106 | ||
107 | progressTimer(); | 107 | progressTimer(); |
108 | // when finished, it emmite foundDevices() | 108 | // when finished, it emmite foundDevices() |
109 | // checken ob initialisiert , qcop ans applet. | 109 | // checken ob initialisiert , qcop ans applet. |
110 | StartStopButton->setText( tr( "Stop scan" ) ); | 110 | StartStopButton->setText( tr( "Stop scan" ) ); |
111 | 111 | ||
112 | localDevice->searchDevices(); | 112 | localDevice->searchDevices(); |
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
116 | void ScanDialog::stopSearch() { | 116 | void ScanDialog::stopSearch() { |
117 | m_search = true; | 117 | m_search = true; |
118 | } | 118 | } |
119 | 119 | ||
120 | void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { | 120 | void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { |
121 | progress->setProgress(0); | 121 | progress->setProgress(0); |
122 | progressStat = 0; | 122 | progressStat = 0; |
123 | QCheckListItem * deviceItem; | 123 | QCheckListItem * deviceItem; |
124 | 124 | ||
125 | RemoteDevice::ValueList::Iterator it; | 125 | RemoteDevice::ValueList::Iterator it; |
126 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | 126 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { |
127 | 127 | ||
128 | deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); | 128 | deviceItem = new QCheckListItem( serviceView, (*it).name(), QCheckListItem::CheckBox ); |
129 | deviceItem->setText( 1, (*it).mac() ); | 129 | deviceItem->setText( 1, (*it).mac() ); |
130 | } | 130 | } |
131 | m_search = false; | 131 | m_search = false; |
132 | StartStopButton->setText( tr( "Start scan" ) ); | 132 | StartStopButton->setText( tr( "Start scan" ) ); |
133 | } | 133 | } |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Iterates trough the items, and collects the checked items. | 136 | * Iterates trough the items, and collects the checked items. |
137 | * Then it emits it, so the manager can connect to the signal to fill the listing. | 137 | * Then it emits it, so the manager can connect to the signal to fill the listing. |
138 | */ | 138 | */ |
139 | void ScanDialog::emitToManager() { | 139 | void ScanDialog::emitToManager() { |
140 | 140 | ||
141 | if (!ListView1) { | 141 | if (!serviceView) { |
142 | return; | 142 | return; |
143 | } | 143 | } |
144 | 144 | ||
145 | QValueList<RemoteDevice> deviceList; | 145 | QValueList<RemoteDevice> deviceList; |
146 | 146 | ||
147 | QListViewItemIterator it( ListView1 ); | 147 | QListViewItemIterator it( serviceView ); |
148 | for ( ; it.current(); ++it ) { | 148 | for ( ; it.current(); ++it ) { |
149 | if ( ( (QCheckListItem*)it.current() )->isOn() ) { | 149 | if ( ( (QCheckListItem*)it.current() )->isOn() ) { |
150 | RemoteDevice device( it.current()->text(1), it.current()->text(0) ); | 150 | RemoteDevice device( it.current()->text(1), it.current()->text(0) ); |
151 | deviceList.append( device ); | 151 | deviceList.append( device ); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | emit selectedDevices( deviceList ); | 154 | emit selectedDevices( deviceList ); |
155 | } | 155 | } |
156 | 156 | ||
157 | /** | 157 | /** |
158 | * Cleanup | 158 | * Cleanup |
159 | */ | 159 | */ |