author | ar <ar> | 2004-05-12 21:05:31 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-12 21:05:31 (UTC) |
commit | 0a35373310b1e8dc1967db71b6bf5673d832bb13 (patch) (unidiff) | |
tree | a50e61a142f213e678f0077894c7435ddd1a0776 | |
parent | 4b9dcabe79d0d3e73d638981ea045c4969bf21fc (diff) | |
download | opie-0a35373310b1e8dc1967db71b6bf5673d832bb13.zip opie-0a35373310b1e8dc1967db71b6bf5673d832bb13.tar.gz opie-0a35373310b1e8dc1967db71b6bf5673d832bb13.tar.bz2 |
- convert qDebug to odebug
-rw-r--r-- | noncore/net/mail/composemail.cpp | 26 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/hciconfwrapper.cpp | 18 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/rfcommconfhandler.cpp | 12 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 17 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 9 |
5 files changed, 41 insertions, 41 deletions
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index b15e692..449fdf1 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -1,303 +1,307 @@ | |||
1 | #include <qt.h> | ||
2 | 1 | ||
2 | #include "composemail.h" | ||
3 | |||
4 | #include <libmailwrapper/smtpwrapper.h> | ||
5 | #include <libmailwrapper/storemail.h> | ||
6 | #include <libmailwrapper/abstractmail.h> | ||
7 | #include <libmailwrapper/mailtypes.h> | ||
8 | |||
9 | /* OPIE */ | ||
3 | #include <opie2/ofiledialog.h> | 10 | #include <opie2/ofiledialog.h> |
4 | #include <opie2/odebug.h> | 11 | #include <opie2/odebug.h> |
5 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
6 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
7 | #include <qpe/global.h> | 14 | #include <qpe/global.h> |
8 | #include <qpe/contact.h> | 15 | #include <qpe/contact.h> |
9 | 16 | ||
10 | #include "composemail.h" | 17 | /* QT */ |
18 | #include <qt.h> | ||
11 | 19 | ||
12 | #include <libmailwrapper/smtpwrapper.h> | ||
13 | #include <libmailwrapper/storemail.h> | ||
14 | #include <libmailwrapper/abstractmail.h> | ||
15 | #include <libmailwrapper/mailtypes.h> | ||
16 | 20 | ||
17 | using namespace Opie::Core; | 21 | using namespace Opie::Core; |
18 | using namespace Opie::Ui; | 22 | using namespace Opie::Ui; |
19 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 23 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
20 | : ComposeMailUI( parent, name, modal, flags ) | 24 | : ComposeMailUI( parent, name, modal, flags ) |
21 | { | 25 | { |
22 | settings = s; | 26 | settings = s; |
23 | m_replyid = ""; | 27 | m_replyid = ""; |
24 | 28 | ||
25 | QString vfilename = Global::applicationFileName("addressbook", | 29 | QString vfilename = Global::applicationFileName("addressbook", |
26 | "businesscard.vcf"); | 30 | "businesscard.vcf"); |
27 | Contact c; | 31 | Contact c; |
28 | if (QFile::exists(vfilename)) { | 32 | if (QFile::exists(vfilename)) { |
29 | c = Contact::readVCard( vfilename )[0]; | 33 | c = Contact::readVCard( vfilename )[0]; |
30 | } | 34 | } |
31 | 35 | ||
32 | QStringList mails = c.emailList(); | 36 | QStringList mails = c.emailList(); |
33 | QString defmail = c.defaultEmail(); | 37 | QString defmail = c.defaultEmail(); |
34 | 38 | ||
35 | if (defmail.length()!=0) { | 39 | if (defmail.length()!=0) { |
36 | fromBox->insertItem(defmail); | 40 | fromBox->insertItem(defmail); |
37 | } | 41 | } |
38 | QStringList::ConstIterator sit = mails.begin(); | 42 | QStringList::ConstIterator sit = mails.begin(); |
39 | for (;sit!=mails.end();++sit) { | 43 | for (;sit!=mails.end();++sit) { |
40 | if ( (*sit)==defmail) | 44 | if ( (*sit)==defmail) |
41 | continue; | 45 | continue; |
42 | fromBox->insertItem((*sit)); | 46 | fromBox->insertItem((*sit)); |
43 | } | 47 | } |
44 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); | 48 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); |
45 | Config cfg( "mail" ); | 49 | Config cfg( "mail" ); |
46 | cfg.setGroup( "Compose" ); | 50 | cfg.setGroup( "Compose" ); |
47 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 51 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
48 | 52 | ||
49 | attList->addColumn( tr( "Name" ) ); | 53 | attList->addColumn( tr( "Name" ) ); |
50 | attList->addColumn( tr( "Size" ) ); | 54 | attList->addColumn( tr( "Size" ) ); |
51 | 55 | ||
52 | QList<Account> accounts = settings->getAccounts(); | 56 | QList<Account> accounts = settings->getAccounts(); |
53 | 57 | ||
54 | Account *it; | 58 | Account *it; |
55 | for ( it = accounts.first(); it; it = accounts.next() ) { | 59 | for ( it = accounts.first(); it; it = accounts.next() ) { |
56 | if ( it->getType()==MAILLIB::A_SMTP ) { | 60 | if ( it->getType()==MAILLIB::A_SMTP ) { |
57 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 61 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
58 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 62 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
59 | smtpAccounts.append( smtp ); | 63 | smtpAccounts.append( smtp ); |
60 | } | 64 | } |
61 | } | 65 | } |
62 | 66 | ||
63 | if ( smtpAccounts.count() > 0 ) { | 67 | if ( smtpAccounts.count() > 0 ) { |
64 | fillValues( smtpAccountBox->currentItem() ); | 68 | fillValues( smtpAccountBox->currentItem() ); |
65 | } else { | 69 | } else { |
66 | QMessageBox::information( this, tr( "Problem" ), | 70 | QMessageBox::information( this, tr( "Problem" ), |
67 | tr( "<p>Please create an SMTP account first.</p>" ), | 71 | tr( "<p>Please create an SMTP account first.</p>" ), |
68 | tr( "Ok" ) ); | 72 | tr( "Ok" ) ); |
69 | return; | 73 | return; |
70 | } | 74 | } |
71 | 75 | ||
72 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 76 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
73 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 77 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
74 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 78 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
75 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 79 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
76 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 80 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
77 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 81 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
78 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 82 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
79 | } | 83 | } |
80 | 84 | ||
81 | void ComposeMail::pickAddress( QLineEdit *line ) | 85 | void ComposeMail::pickAddress( QLineEdit *line ) |
82 | { | 86 | { |
83 | QString names = AddressPicker::getNames(); | 87 | QString names = AddressPicker::getNames(); |
84 | if ( line->text().isEmpty() ) { | 88 | if ( line->text().isEmpty() ) { |
85 | line->setText( names ); | 89 | line->setText( names ); |
86 | } else if ( !names.isEmpty() ) { | 90 | } else if ( !names.isEmpty() ) { |
87 | line->setText( line->text() + ", " + names ); | 91 | line->setText( line->text() + ", " + names ); |
88 | } | 92 | } |
89 | } | 93 | } |
90 | 94 | ||
91 | 95 | ||
92 | void ComposeMail::setTo( const QString & to ) | 96 | void ComposeMail::setTo( const QString & to ) |
93 | { | 97 | { |
94 | toLine->setText( to ); | 98 | toLine->setText( to ); |
95 | } | 99 | } |
96 | 100 | ||
97 | void ComposeMail::setSubject( const QString & subject ) | 101 | void ComposeMail::setSubject( const QString & subject ) |
98 | { | 102 | { |
99 | subjectLine->setText( subject ); | 103 | subjectLine->setText( subject ); |
100 | } | 104 | } |
101 | 105 | ||
102 | void ComposeMail::setInReplyTo( const QString & messageId ) | 106 | void ComposeMail::setInReplyTo( const QString & messageId ) |
103 | { | 107 | { |
104 | m_replyid = messageId; | 108 | m_replyid = messageId; |
105 | } | 109 | } |
106 | 110 | ||
107 | void ComposeMail::setMessage( const QString & text ) | 111 | void ComposeMail::setMessage( const QString & text ) |
108 | { | 112 | { |
109 | message->setText( text ); | 113 | message->setText( text ); |
110 | } | 114 | } |
111 | 115 | ||
112 | 116 | ||
113 | void ComposeMail::pickAddressTo() | 117 | void ComposeMail::pickAddressTo() |
114 | { | 118 | { |
115 | pickAddress( toLine ); | 119 | pickAddress( toLine ); |
116 | } | 120 | } |
117 | 121 | ||
118 | void ComposeMail::pickAddressCC() | 122 | void ComposeMail::pickAddressCC() |
119 | { | 123 | { |
120 | pickAddress( ccLine ); | 124 | pickAddress( ccLine ); |
121 | } | 125 | } |
122 | 126 | ||
123 | void ComposeMail::pickAddressBCC() | 127 | void ComposeMail::pickAddressBCC() |
124 | { | 128 | { |
125 | pickAddress( bccLine ); | 129 | pickAddress( bccLine ); |
126 | } | 130 | } |
127 | 131 | ||
128 | void ComposeMail::pickAddressReply() | 132 | void ComposeMail::pickAddressReply() |
129 | { | 133 | { |
130 | pickAddress( replyLine ); | 134 | pickAddress( replyLine ); |
131 | } | 135 | } |
132 | 136 | ||
133 | void ComposeMail::fillValues( int ) | 137 | void ComposeMail::fillValues( int ) |
134 | { | 138 | { |
135 | #if 0 | 139 | #if 0 |
136 | SMTPaccount *smtp = smtpAccounts.at( current ); | 140 | SMTPaccount *smtp = smtpAccounts.at( current ); |
137 | ccLine->clear(); | 141 | ccLine->clear(); |
138 | if ( smtp->getUseCC() ) { | 142 | if ( smtp->getUseCC() ) { |
139 | ccLine->setText( smtp->getCC() ); | 143 | ccLine->setText( smtp->getCC() ); |
140 | } | 144 | } |
141 | bccLine->clear(); | 145 | bccLine->clear(); |
142 | if ( smtp->getUseBCC() ) { | 146 | if ( smtp->getUseBCC() ) { |
143 | bccLine->setText( smtp->getBCC() ); | 147 | bccLine->setText( smtp->getBCC() ); |
144 | } | 148 | } |
145 | replyLine->clear(); | 149 | replyLine->clear(); |
146 | if ( smtp->getUseReply() ) { | 150 | if ( smtp->getUseReply() ) { |
147 | replyLine->setText( smtp->getReply() ); | 151 | replyLine->setText( smtp->getReply() ); |
148 | } | 152 | } |
149 | sigMultiLine->setText( smtp->getSignature() ); | 153 | sigMultiLine->setText( smtp->getSignature() ); |
150 | #endif | 154 | #endif |
151 | } | 155 | } |
152 | 156 | ||
153 | void ComposeMail::slotAdjustColumns() | 157 | void ComposeMail::slotAdjustColumns() |
154 | { | 158 | { |
155 | int currPage = tabWidget->currentPageIndex(); | 159 | int currPage = tabWidget->currentPageIndex(); |
156 | 160 | ||
157 | tabWidget->showPage( attachTab ); | 161 | tabWidget->showPage( attachTab ); |
158 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 162 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
159 | attList->setColumnWidth( 1, 80 ); | 163 | attList->setColumnWidth( 1, 80 ); |
160 | 164 | ||
161 | tabWidget->setCurrentPage( currPage ); | 165 | tabWidget->setCurrentPage( currPage ); |
162 | } | 166 | } |
163 | 167 | ||
164 | void ComposeMail::addAttachment() | 168 | void ComposeMail::addAttachment() |
165 | { | 169 | { |
166 | DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" ); | 170 | DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" ); |
167 | if ( !lnk.name().isEmpty() ) { | 171 | if ( !lnk.name().isEmpty() ) { |
168 | Attachment *att = new Attachment( lnk ); | 172 | Attachment *att = new Attachment( lnk ); |
169 | (void) new AttachViewItem( attList, att ); | 173 | (void) new AttachViewItem( attList, att ); |
170 | } | 174 | } |
171 | } | 175 | } |
172 | 176 | ||
173 | void ComposeMail::removeAttachment() | 177 | void ComposeMail::removeAttachment() |
174 | { | 178 | { |
175 | if ( !attList->currentItem() ) { | 179 | if ( !attList->currentItem() ) { |
176 | QMessageBox::information( this, tr( "Error" ), | 180 | QMessageBox::information( this, tr( "Error" ), |
177 | tr( "<p>Please select a File.</p>" ), | 181 | tr( "<p>Please select a File.</p>" ), |
178 | tr( "Ok" ) ); | 182 | tr( "Ok" ) ); |
179 | } else { | 183 | } else { |
180 | attList->takeItem( attList->currentItem() ); | 184 | attList->takeItem( attList->currentItem() ); |
181 | } | 185 | } |
182 | } | 186 | } |
183 | 187 | ||
184 | void ComposeMail::accept() | 188 | void ComposeMail::accept() |
185 | { | 189 | { |
186 | if ( checkBoxLater->isChecked() ) { | 190 | if ( checkBoxLater->isChecked() ) { |
187 | odebug << "Send later" << oendl; | 191 | odebug << "Send later" << oendl; |
188 | } | 192 | } |
189 | 193 | ||
190 | #if 0 | 194 | #if 0 |
191 | qDebug( "Sending Mail with " + | 195 | odebug << "Sending Mail with " |
192 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); | 196 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
193 | #endif | 197 | #endif |
194 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 198 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
195 | 199 | ||
196 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 200 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
197 | mail->setMail(fromBox->currentText()); | 201 | mail->setMail(fromBox->currentText()); |
198 | 202 | ||
199 | if ( !toLine->text().isEmpty() ) { | 203 | if ( !toLine->text().isEmpty() ) { |
200 | mail->setTo( toLine->text() ); | 204 | mail->setTo( toLine->text() ); |
201 | } else { | 205 | } else { |
202 | QMessageBox::warning(0,tr("Sending mail"), | 206 | QMessageBox::warning(0,tr("Sending mail"), |
203 | tr("No Receiver spezified" ) ); | 207 | tr("No Receiver spezified" ) ); |
204 | return; | 208 | return; |
205 | } | 209 | } |
206 | mail->setName(senderNameEdit->text()); | 210 | mail->setName(senderNameEdit->text()); |
207 | mail->setCC( ccLine->text() ); | 211 | mail->setCC( ccLine->text() ); |
208 | mail->setBCC( bccLine->text() ); | 212 | mail->setBCC( bccLine->text() ); |
209 | mail->setReply( replyLine->text() ); | 213 | mail->setReply( replyLine->text() ); |
210 | mail->setSubject( subjectLine->text() ); | 214 | mail->setSubject( subjectLine->text() ); |
211 | if (!m_replyid.isEmpty()) { | 215 | if (!m_replyid.isEmpty()) { |
212 | QStringList ids; | 216 | QStringList ids; |
213 | ids.append(m_replyid); | 217 | ids.append(m_replyid); |
214 | mail->setInreply(ids); | 218 | mail->setInreply(ids); |
215 | } | 219 | } |
216 | QString txt = message->text(); | 220 | QString txt = message->text(); |
217 | if ( !sigMultiLine->text().isEmpty() ) { | 221 | if ( !sigMultiLine->text().isEmpty() ) { |
218 | txt.append( "\n--\n" ); | 222 | txt.append( "\n--\n" ); |
219 | txt.append( sigMultiLine->text() ); | 223 | txt.append( sigMultiLine->text() ); |
220 | } | 224 | } |
221 | mail->setMessage( txt ); | 225 | mail->setMessage( txt ); |
222 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 226 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
223 | while ( it != NULL ) { | 227 | while ( it != NULL ) { |
224 | mail->addAttachment( it->getAttachment() ); | 228 | mail->addAttachment( it->getAttachment() ); |
225 | it = (AttachViewItem *) it->nextSibling(); | 229 | it = (AttachViewItem *) it->nextSibling(); |
226 | } | 230 | } |
227 | 231 | ||
228 | SMTPwrapper wrapper( smtp ); | 232 | SMTPwrapper wrapper( smtp ); |
229 | wrapper.sendMail( mail,checkBoxLater->isChecked() ); | 233 | wrapper.sendMail( mail,checkBoxLater->isChecked() ); |
230 | 234 | ||
231 | QDialog::accept(); | 235 | QDialog::accept(); |
232 | } | 236 | } |
233 | 237 | ||
234 | void ComposeMail::reject() | 238 | void ComposeMail::reject() |
235 | { | 239 | { |
236 | int yesno = QMessageBox::warning(0,tr("Store message"), | 240 | int yesno = QMessageBox::warning(0,tr("Store message"), |
237 | tr("Store message into drafts?"), | 241 | tr("Store message into drafts?"), |
238 | tr("Yes"), | 242 | tr("Yes"), |
239 | tr("No"),QString::null,0,1); | 243 | tr("No"),QString::null,0,1); |
240 | 244 | ||
241 | if (yesno == 0) { | 245 | if (yesno == 0) { |
242 | Opie::Core::OSmartPointer<Mail> mail=new Mail(); | 246 | Opie::Core::OSmartPointer<Mail> mail=new Mail(); |
243 | mail->setMail(fromBox->currentText()); | 247 | mail->setMail(fromBox->currentText()); |
244 | mail->setTo( toLine->text() ); | 248 | mail->setTo( toLine->text() ); |
245 | mail->setName(senderNameEdit->text()); | 249 | mail->setName(senderNameEdit->text()); |
246 | mail->setCC( ccLine->text() ); | 250 | mail->setCC( ccLine->text() ); |
247 | mail->setBCC( bccLine->text() ); | 251 | mail->setBCC( bccLine->text() ); |
248 | mail->setReply( replyLine->text() ); | 252 | mail->setReply( replyLine->text() ); |
249 | mail->setSubject( subjectLine->text() ); | 253 | mail->setSubject( subjectLine->text() ); |
250 | if (!m_replyid.isEmpty()) { | 254 | if (!m_replyid.isEmpty()) { |
251 | QStringList ids; | 255 | QStringList ids; |
252 | ids.append(m_replyid); | 256 | ids.append(m_replyid); |
253 | mail->setInreply(ids); | 257 | mail->setInreply(ids); |
254 | } | 258 | } |
255 | QString txt = message->text(); | 259 | QString txt = message->text(); |
256 | if ( !sigMultiLine->text().isEmpty() ) { | 260 | if ( !sigMultiLine->text().isEmpty() ) { |
257 | txt.append( "\n--\n" ); | 261 | txt.append( "\n--\n" ); |
258 | txt.append( sigMultiLine->text() ); | 262 | txt.append( sigMultiLine->text() ); |
259 | } | 263 | } |
260 | odebug << txt << oendl; | 264 | odebug << txt << oendl; |
261 | mail->setMessage( txt ); | 265 | mail->setMessage( txt ); |
262 | 266 | ||
263 | /* only use the default drafts folder name! */ | 267 | /* only use the default drafts folder name! */ |
264 | Storemail wrapper(AbstractMail::draftFolder()); | 268 | Storemail wrapper(AbstractMail::draftFolder()); |
265 | wrapper.storeMail(mail); | 269 | wrapper.storeMail(mail); |
266 | 270 | ||
267 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 271 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
268 | /* attachments we will ignore! */ | 272 | /* attachments we will ignore! */ |
269 | if ( it != NULL ) { | 273 | if ( it != NULL ) { |
270 | QMessageBox::warning(0,tr("Store message"), | 274 | QMessageBox::warning(0,tr("Store message"), |
271 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 275 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
272 | } | 276 | } |
273 | } | 277 | } |
274 | QDialog::reject(); | 278 | QDialog::reject(); |
275 | } | 279 | } |
276 | 280 | ||
277 | ComposeMail::~ComposeMail() | 281 | ComposeMail::~ComposeMail() |
278 | { | 282 | { |
279 | } | 283 | } |
280 | 284 | ||
281 | void ComposeMail::reEditMail(const RecMailP¤t) | 285 | void ComposeMail::reEditMail(const RecMailP¤t) |
282 | { | 286 | { |
283 | RecMailP data = current; | 287 | RecMailP data = current; |
284 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 288 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
285 | subjectLine->setText( data->getSubject()); | 289 | subjectLine->setText( data->getSubject()); |
286 | toLine->setText(data->To().join(",")); | 290 | toLine->setText(data->To().join(",")); |
287 | ccLine->setText(data->CC().join(",")); | 291 | ccLine->setText(data->CC().join(",")); |
288 | bccLine->setText(data->Bcc().join(",")); | 292 | bccLine->setText(data->Bcc().join(",")); |
289 | replyLine->setText(data->Replyto()); | 293 | replyLine->setText(data->Replyto()); |
290 | } | 294 | } |
291 | 295 | ||
292 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 296 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
293 | : QListViewItem( parent ) | 297 | : QListViewItem( parent ) |
294 | { | 298 | { |
295 | attachment = att; | 299 | attachment = att; |
296 | odebug << att->getMimeType() << oendl; | 300 | odebug << att->getMimeType() << oendl; |
297 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? | 301 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? |
298 | Resource::loadPixmap( "UnknownDocument-14" ) : | 302 | Resource::loadPixmap( "UnknownDocument-14" ) : |
299 | attachment->getDocLnk().pixmap() ); | 303 | attachment->getDocLnk().pixmap() ); |
300 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 304 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
301 | setText( 1, QString::number( att->getSize() ) ); | 305 | setText( 1, QString::number( att->getSize() ) ); |
302 | } | 306 | } |
303 | 307 | ||
diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index ca2e7bd..47e170e 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp | |||
@@ -1,142 +1,142 @@ | |||
1 | #include "hciconfwrapper.h" | 1 | #include "hciconfwrapper.h" |
2 | 2 | ||
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
5 | #include <qregexp.h> | 5 | #include <qregexp.h> |
6 | 6 | ||
7 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
8 | using namespace Opie::Core; | 8 | using namespace Opie::Core; |
9 | 9 | ||
10 | namespace OpieTooth { | 10 | namespace OpieTooth { |
11 | 11 | ||
12 | 12 | ||
13 | HciConfWrapper::HciConfWrapper( const QString &fileName) { | 13 | HciConfWrapper::HciConfWrapper( const QString &fileName) { |
14 | m_fileName = fileName; | 14 | m_fileName = fileName; |
15 | } | 15 | } |
16 | 16 | ||
17 | HciConfWrapper::~HciConfWrapper() { | 17 | HciConfWrapper::~HciConfWrapper() { |
18 | } | 18 | } |
19 | 19 | ||
20 | 20 | ||
21 | void HciConfWrapper::setPinHelper( const QString& app ) { | 21 | void HciConfWrapper::setPinHelper( const QString& app ) { |
22 | setValue( "pin_helper" , app ); | 22 | setValue( "pin_helper" , app ); |
23 | } | 23 | } |
24 | 24 | ||
25 | void HciConfWrapper::setName( const QString &name ) { | 25 | void HciConfWrapper::setName( const QString &name ) { |
26 | qDebug ("NAME : " + name); | 26 | odebug << "NAME : " << name << oendl; |
27 | setValue( "name" , "\"" + name + "\"" ); | 27 | setValue( "name" , "\"" + name + "\"" ); |
28 | } | 28 | } |
29 | 29 | ||
30 | void HciConfWrapper::setIscan( bool enable) { | 30 | void HciConfWrapper::setIscan( bool enable) { |
31 | 31 | ||
32 | if ( enable ) { | 32 | if ( enable ) { |
33 | setValue( "iscan" , "enable" ); | 33 | setValue( "iscan" , "enable" ); |
34 | } else { | 34 | } else { |
35 | setValue( "iscan" , "disable" ); | 35 | setValue( "iscan" , "disable" ); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | void HciConfWrapper::setPscan( bool enable) { | 39 | void HciConfWrapper::setPscan( bool enable) { |
40 | 40 | ||
41 | if ( enable ) { | 41 | if ( enable ) { |
42 | setValue( "pscan" , "enable" ); | 42 | setValue( "pscan" , "enable" ); |
43 | } else { | 43 | } else { |
44 | setValue( "pscan" , "disable" ); | 44 | setValue( "pscan" , "disable" ); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | 48 | ||
49 | void HciConfWrapper::setAuth( bool enable) { | 49 | void HciConfWrapper::setAuth( bool enable) { |
50 | 50 | ||
51 | if ( enable ) { | 51 | if ( enable ) { |
52 | setValue( "auth" , "enable" ); | 52 | setValue( "auth" , "enable" ); |
53 | } else { | 53 | } else { |
54 | setValue( "auth" , "disable" ); | 54 | setValue( "auth" , "disable" ); |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | void HciConfWrapper::setEncrypt( bool enable) { | 59 | void HciConfWrapper::setEncrypt( bool enable) { |
60 | 60 | ||
61 | if ( enable ) { | 61 | if ( enable ) { |
62 | setValue( "encrypt" , "enable" ); | 62 | setValue( "encrypt" , "enable" ); |
63 | } else { | 63 | } else { |
64 | setValue( "encrypt" , "disable" ); | 64 | setValue( "encrypt" , "disable" ); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | 68 | ||
69 | void HciConfWrapper::setValue(const QString &key, const QString &value ) { | 69 | void HciConfWrapper::setValue(const QString &key, const QString &value ) { |
70 | 70 | ||
71 | if (m_file.isEmpty() ) // load first | 71 | if (m_file.isEmpty() ) // load first |
72 | return; | 72 | return; |
73 | 73 | ||
74 | QStringList::Iterator it; | 74 | QStringList::Iterator it; |
75 | 75 | ||
76 | QString str; | 76 | QString str; |
77 | for (it = m_file.begin(); it != m_file.end(); ++it ) { | 77 | for (it = m_file.begin(); it != m_file.end(); ++it ) { |
78 | str = (*it); | 78 | str = (*it); |
79 | if( (str.contains(key)) > 0 ) { | 79 | if( (str.contains(key)) > 0 ) { |
80 | odebug << "Found" << oendl; | 80 | odebug << "Found" << oendl; |
81 | // still need to look if its commented out!!! | 81 | // still need to look if its commented out!!! |
82 | str.simplifyWhiteSpace(); | 82 | str.simplifyWhiteSpace(); |
83 | odebug << key << oendl; | 83 | odebug << key << oendl; |
84 | if (str.startsWith("#")) { | 84 | if (str.startsWith("#")) { |
85 | str = (key + " " + value + ";"); | 85 | str = (key + " " + value + ";"); |
86 | } else { | 86 | } else { |
87 | str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); | 87 | str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); |
88 | } | 88 | } |
89 | odebug << str << oendl; | 89 | odebug << str << oendl; |
90 | it = m_file.remove( it ); | 90 | it = m_file.remove( it ); |
91 | it = m_file.insert( it, str ); | 91 | it = m_file.insert( it, str ); |
92 | //return; the regexp is too wide -zecke // all set | 92 | //return; the regexp is too wide -zecke // all set |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
97 | } | 97 | } |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * This loads the config file and stores it inside | 100 | * This loads the config file and stores it inside |
101 | * the m_file | 101 | * the m_file |
102 | */ | 102 | */ |
103 | void HciConfWrapper::load() { | 103 | void HciConfWrapper::load() { |
104 | owarn << "loaded" << oendl; | 104 | owarn << "loaded" << oendl; |
105 | m_file.clear(); | 105 | m_file.clear(); |
106 | QFile file( m_fileName ); | 106 | QFile file( m_fileName ); |
107 | if (!file.open( IO_ReadOnly ) ) { | 107 | if (!file.open( IO_ReadOnly ) ) { |
108 | odebug << "Could not open" << oendl; | 108 | odebug << "Could not open" << oendl; |
109 | return; | 109 | return; |
110 | } | 110 | } |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * readAll() into a QByteArray | 113 | * readAll() into a QByteArray |
114 | * QStringList::split('\n', array ) | 114 | * QStringList::split('\n', array ) |
115 | * would this be faster? -zecke | 115 | * would this be faster? -zecke |
116 | */ | 116 | */ |
117 | QTextStream stream(&file ); | 117 | QTextStream stream(&file ); |
118 | QString tmp; | 118 | QString tmp; |
119 | while ( !stream.atEnd() ) { | 119 | while ( !stream.atEnd() ) { |
120 | tmp = stream.readLine(); | 120 | tmp = stream.readLine(); |
121 | m_file.append( tmp ); | 121 | m_file.append( tmp ); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | void HciConfWrapper::save() { | 124 | void HciConfWrapper::save() { |
125 | owarn << "save" << oendl; | 125 | owarn << "save" << oendl; |
126 | if (m_file.isEmpty() ) // load first | 126 | if (m_file.isEmpty() ) // load first |
127 | return; | 127 | return; |
128 | 128 | ||
129 | QFile file( m_fileName ); | 129 | QFile file( m_fileName ); |
130 | if ( !file.open(IO_WriteOnly ) ) { | 130 | if ( !file.open(IO_WriteOnly ) ) { |
131 | owarn << "could not open " << m_fileName.latin1() << "" << oendl; | 131 | owarn << "could not open " << m_fileName.latin1() << "" << oendl; |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | 134 | ||
135 | QTextStream stream(&file ); | 135 | QTextStream stream(&file ); |
136 | QStringList::Iterator it; | 136 | QStringList::Iterator it; |
137 | for ( it = m_file.begin(); it != m_file.end(); ++it ) { | 137 | for ( it = m_file.begin(); it != m_file.end(); ++it ) { |
138 | stream << (*it) << endl; | 138 | stream << (*it) << endl; |
139 | } | 139 | } |
140 | owarn << "saved" << oendl; | 140 | owarn << "saved" << oendl; |
141 | }; | 141 | }; |
142 | } | 142 | } |
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp index 1f7ba65..f82d2c8 100644 --- a/noncore/net/opietooth/manager/rfcommconfhandler.cpp +++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp | |||
@@ -1,116 +1,116 @@ | |||
1 | 1 | ||
2 | #include <qtextstream.h> | 2 | #include <qtextstream.h> |
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | using namespace Opie::Core; | 4 | using namespace Opie::Core; |
5 | 5 | ||
6 | #include "rfcommconfhandler.h" | 6 | #include "rfcommconfhandler.h" |
7 | 7 | ||
8 | 8 | ||
9 | using namespace OpieTooth; | 9 | using namespace OpieTooth; |
10 | 10 | ||
11 | // move to lib | 11 | // move to lib |
12 | 12 | ||
13 | 13 | ||
14 | RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) { | 14 | RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) { |
15 | m_number = number; | 15 | m_number = number; |
16 | m_mac = mac; | 16 | m_mac = mac; |
17 | m_channel = channel; | 17 | m_channel = channel; |
18 | m_comment = comment; | 18 | m_comment = comment; |
19 | // m_foundEntries = 0; | 19 | // m_foundEntries = 0; |
20 | } | 20 | } |
21 | 21 | ||
22 | void RfCommConfObject::setNumber( int number ) { | 22 | void RfCommConfObject::setNumber( int number ) { |
23 | m_number = number; | 23 | m_number = number; |
24 | } | 24 | } |
25 | 25 | ||
26 | void RfCommConfObject::setMac( QString mac ) { | 26 | void RfCommConfObject::setMac( QString mac ) { |
27 | m_mac = mac; | 27 | m_mac = mac; |
28 | } | 28 | } |
29 | 29 | ||
30 | void RfCommConfObject::setChannel( int channel ) { | 30 | void RfCommConfObject::setChannel( int channel ) { |
31 | m_channel = channel; | 31 | m_channel = channel; |
32 | } | 32 | } |
33 | 33 | ||
34 | void RfCommConfObject::setComment( QString comment ) { | 34 | void RfCommConfObject::setComment( QString comment ) { |
35 | m_comment = comment; | 35 | m_comment = comment; |
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | RfCommConfObject::~RfCommConfObject() { | 39 | RfCommConfObject::~RfCommConfObject() { |
40 | } | 40 | } |
41 | 41 | ||
42 | 42 | ||
43 | RfCommConfHandler::RfCommConfHandler( const QString & filename ) { | 43 | RfCommConfHandler::RfCommConfHandler( const QString & filename ) { |
44 | 44 | ||
45 | m_filename = filename; | 45 | m_filename = filename; |
46 | load(); | 46 | load(); |
47 | } | 47 | } |
48 | 48 | ||
49 | RfCommConfHandler::~RfCommConfHandler() { | 49 | RfCommConfHandler::~RfCommConfHandler() { |
50 | 50 | ||
51 | } | 51 | } |
52 | 52 | ||
53 | void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) { | 53 | void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) { |
54 | 54 | ||
55 | QFile rfCommConf( "/tmp/test" ); | 55 | QFile rfCommConf( "/tmp/test" ); |
56 | QTextStream outStream( &rfCommConf ); | 56 | QTextStream outStream( &rfCommConf ); |
57 | if ( rfCommConf.open( IO_WriteOnly ) ) { | 57 | if ( rfCommConf.open( IO_WriteOnly ) ) { |
58 | 58 | ||
59 | QMap<QString, RfCommConfObject*>::Iterator it; | 59 | QMap<QString, RfCommConfObject*>::Iterator it; |
60 | for( it = devices.begin(); it != devices.end(); ++it ) { | 60 | for( it = devices.begin(); it != devices.end(); ++it ) { |
61 | outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n"; | 61 | outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n"; |
62 | outStream << " device " + it.data()->mac() + ";\n"; | 62 | outStream << " device " + it.data()->mac() + ";\n"; |
63 | outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n"; | 63 | outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n"; |
64 | outStream << " comment \"" + it.data()->comment() + "\";\n"; | 64 | outStream << " comment \"" + it.data()->comment() + "\";\n"; |
65 | outStream << "}\n\n"; | 65 | outStream << "}\n\n"; |
66 | } | 66 | } |
67 | 67 | ||
68 | rfCommConf.close(); | 68 | rfCommConf.close(); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | 72 | ||
73 | QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() { | 73 | QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() { |
74 | return m_foundEntries; | 74 | return m_foundEntries; |
75 | } | 75 | } |
76 | 76 | ||
77 | void RfCommConfHandler::load() { | 77 | void RfCommConfHandler::load() { |
78 | 78 | ||
79 | QFile rfCommConf( m_filename ); | 79 | QFile rfCommConf( m_filename ); |
80 | if ( rfCommConf.open( IO_ReadOnly ) ) { | 80 | if ( rfCommConf.open( IO_ReadOnly ) ) { |
81 | 81 | ||
82 | QStringList list; | 82 | QStringList list; |
83 | QTextStream inStream( &rfCommConf ); | 83 | QTextStream inStream( &rfCommConf ); |
84 | list = QStringList::split( "\n", inStream.read() ); | 84 | list = QStringList::split( "\n", inStream.read() ); |
85 | 85 | ||
86 | QString number; | 86 | QString number; |
87 | QString mac; | 87 | QString mac; |
88 | QString channel; | 88 | QString channel; |
89 | QString comment; | 89 | QString comment; |
90 | 90 | ||
91 | for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { | 91 | for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { |
92 | 92 | ||
93 | QString tmpLine = ( *line ).stripWhiteSpace(); | 93 | QString tmpLine = ( *line ).stripWhiteSpace(); |
94 | 94 | ||
95 | if ( tmpLine.startsWith("rfcomm") ) { | 95 | if ( tmpLine.startsWith("rfcomm") ) { |
96 | QString number = tmpLine.mid( 6,1 ); | 96 | QString number = tmpLine.mid( 6,1 ); |
97 | odebug << tmpLine << oendl; | 97 | odebug << tmpLine << oendl; |
98 | odebug << "TEST " + number << oendl; | 98 | odebug << "TEST " + number << oendl; |
99 | } else if ( tmpLine.startsWith( "}" ) ) { | 99 | } else if ( tmpLine.startsWith( "}" ) ) { |
100 | m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); | 100 | m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); |
101 | } else if ( tmpLine.startsWith( "device" ) ) { | 101 | } else if ( tmpLine.startsWith( "device" ) ) { |
102 | mac = tmpLine.mid( 7, 17 ); | 102 | mac = tmpLine.mid( 7, 17 ); |
103 | odebug << "mac" + mac << oendl; | 103 | odebug << "mac" + mac << oendl; |
104 | } else if ( tmpLine.startsWith( "channel" ) ) { | 104 | } else if ( tmpLine.startsWith( "channel" ) ) { |
105 | channel = tmpLine.mid( 8, 1 ); | 105 | channel = tmpLine.mid( 8, 1 ); |
106 | qDebug ( "Channel :" + channel ); | 106 | odebug << "Channel :" << channel << oendl; |
107 | } else if ( tmpLine.startsWith( "comment" ) ) { | 107 | } else if ( tmpLine.startsWith( "comment" ) ) { |
108 | comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); | 108 | comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); |
109 | odebug << "Comment: " + comment << oendl; | 109 | odebug << "Comment: " + comment << oendl; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | rfCommConf.close(); | 112 | rfCommConf.close(); |
113 | } | 113 | } |
114 | save( m_foundEntries ); | 114 | save( m_foundEntries ); |
115 | odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl; | 115 | odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl; |
116 | } | 116 | } |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index c605111..9e8aa72 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -4,258 +4,259 @@ | |||
4 | ** This file is part of Wellenreiter II. | 4 | ** This file is part of Wellenreiter II. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "scanlist.h" | 16 | #include "scanlist.h" |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "logwindow.h" | 18 | #include "logwindow.h" |
19 | 19 | ||
20 | /* OPIE */ | 20 | /* OPIE */ |
21 | #ifdef QWS | 21 | #ifdef QWS |
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
25 | #else | 25 | #else |
26 | #include "resource.h" | 26 | #include "resource.h" |
27 | #endif | 27 | #endif |
28 | using namespace Opie::Core; | 28 | using namespace Opie::Core; |
29 | using namespace Opie::Ui; | 29 | using namespace Opie::Ui; |
30 | using namespace Opie::Net; | 30 | using namespace Opie::Net; |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qcursor.h> | 33 | #include <qcursor.h> |
34 | #include <qdatetime.h> | 34 | #include <qdatetime.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
37 | 37 | ||
38 | /* STD */ | 38 | /* STD */ |
39 | #include <assert.h> | 39 | #include <assert.h> |
40 | 40 | ||
41 | const int col_type = 0; | 41 | const int col_type = 0; |
42 | const int col_essid = 0; | 42 | const int col_essid = 0; |
43 | const int col_sig = 1; | 43 | const int col_sig = 1; |
44 | const int col_ap = 2; | 44 | const int col_ap = 2; |
45 | const int col_channel = 3; | 45 | const int col_channel = 3; |
46 | const int col_wep = 4; | 46 | const int col_wep = 4; |
47 | const int col_traffic = 5; | 47 | const int col_traffic = 5; |
48 | const int col_ip = 6; | 48 | const int col_ip = 6; |
49 | const int col_manuf = 7; | 49 | const int col_manuf = 7; |
50 | const int col_firstseen = 8; | 50 | const int col_firstseen = 8; |
51 | const int col_lastseen = 9; | 51 | const int col_lastseen = 9; |
52 | const int col_location = 10; | 52 | const int col_location = 10; |
53 | 53 | ||
54 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 54 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
55 | :OListView( parent, name ) | 55 | :OListView( parent, name ) |
56 | { | 56 | { |
57 | setFrameShape( QListView::StyledPanel ); | 57 | setFrameShape( QListView::StyledPanel ); |
58 | setFrameShadow( QListView::Sunken ); | 58 | setFrameShadow( QListView::Sunken ); |
59 | 59 | ||
60 | addColumn( tr( "Net/Station" ) ); | 60 | addColumn( tr( "Net/Station" ) ); |
61 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); | 61 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); |
62 | addColumn( tr( "#" ) ); | 62 | addColumn( tr( "#" ) ); |
63 | setColumnAlignment( col_sig, AlignCenter ); | 63 | setColumnAlignment( col_sig, AlignCenter ); |
64 | addColumn( tr( "MAC" ) ); | 64 | addColumn( tr( "MAC" ) ); |
65 | setColumnAlignment( col_ap, AlignCenter ); | 65 | setColumnAlignment( col_ap, AlignCenter ); |
66 | addColumn( tr( "Chn" ) ); | 66 | addColumn( tr( "Chn" ) ); |
67 | setColumnAlignment( col_channel, AlignCenter ); | 67 | setColumnAlignment( col_channel, AlignCenter ); |
68 | addColumn( tr( "W" ) ); | 68 | addColumn( tr( "W" ) ); |
69 | setColumnAlignment( col_wep, AlignCenter ); | 69 | setColumnAlignment( col_wep, AlignCenter ); |
70 | addColumn( tr( "T" ) ); | 70 | addColumn( tr( "T" ) ); |
71 | setColumnAlignment( col_traffic, AlignCenter ); | 71 | setColumnAlignment( col_traffic, AlignCenter ); |
72 | addColumn( tr( "IP" ) ); | 72 | addColumn( tr( "IP" ) ); |
73 | setColumnAlignment( col_ip, AlignCenter ); | 73 | setColumnAlignment( col_ip, AlignCenter ); |
74 | addColumn( tr( "Manufacturer" ) ); | 74 | addColumn( tr( "Manufacturer" ) ); |
75 | setColumnAlignment( col_manuf, AlignCenter ); | 75 | setColumnAlignment( col_manuf, AlignCenter ); |
76 | addColumn( tr( "First Seen" ) ); | 76 | addColumn( tr( "First Seen" ) ); |
77 | setColumnAlignment( col_firstseen, AlignCenter ); | 77 | setColumnAlignment( col_firstseen, AlignCenter ); |
78 | addColumn( tr( "Last Seen" ) ); | 78 | addColumn( tr( "Last Seen" ) ); |
79 | setColumnAlignment( col_lastseen, AlignCenter ); | 79 | setColumnAlignment( col_lastseen, AlignCenter ); |
80 | addColumn( tr( "Location" ) ); | 80 | addColumn( tr( "Location" ) ); |
81 | setColumnAlignment( col_location, AlignCenter ); | 81 | setColumnAlignment( col_location, AlignCenter ); |
82 | setRootIsDecorated( true ); | 82 | setRootIsDecorated( true ); |
83 | setAllColumnsShowFocus( true ); | 83 | setAllColumnsShowFocus( true ); |
84 | 84 | ||
85 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), | 85 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), |
86 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); | 86 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
87 | 87 | ||
88 | #ifdef QWS | 88 | #ifdef QWS |
89 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 89 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | }; | 92 | }; |
93 | 93 | ||
94 | 94 | ||
95 | MScanListView::~MScanListView() | 95 | MScanListView::~MScanListView() |
96 | { | 96 | { |
97 | }; | 97 | }; |
98 | 98 | ||
99 | 99 | ||
100 | OListViewItem* MScanListView::childFactory() | 100 | OListViewItem* MScanListView::childFactory() |
101 | { | 101 | { |
102 | return new MScanListItem( this ); | 102 | return new MScanListItem( this ); |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | void MScanListView::serializeTo( QDataStream& s) const | 106 | void MScanListView::serializeTo( QDataStream& s) const |
107 | { | 107 | { |
108 | odebug << "serializing MScanListView" << oendl; | 108 | odebug << "serializing MScanListView" << oendl; |
109 | OListView::serializeTo( s ); | 109 | OListView::serializeTo( s ); |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | void MScanListView::serializeFrom( QDataStream& s) | 113 | void MScanListView::serializeFrom( QDataStream& s) |
114 | { | 114 | { |
115 | odebug << "serializing MScanListView" << oendl; | 115 | odebug << "serializing MScanListView" << oendl; |
116 | OListView::serializeFrom( s ); | 116 | OListView::serializeFrom( s ); |
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | void MScanListView::addNewItem( const QString& type, | 120 | void MScanListView::addNewItem( const QString& type, |
121 | const QString& essid, | 121 | const QString& essid, |
122 | const OMacAddress& mac, | 122 | const OMacAddress& mac, |
123 | bool wep, | 123 | bool wep, |
124 | int channel, | 124 | int channel, |
125 | int signal, | 125 | int signal, |
126 | const GpsLocation& loc, | 126 | const GpsLocation& loc, |
127 | bool probe ) | 127 | bool probe ) |
128 | { | 128 | { |
129 | QString macaddr = mac.toString(true); | 129 | QString macaddr = mac.toString(true); |
130 | 130 | ||
131 | #ifdef DEBUG | 131 | #ifdef DEBUG |
132 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, | 132 | odebug << "MScanList::addNewItem( " << (const char*) type << " / " |
133 | (const char*) essid, (const char*) macaddr, channel ); | 133 | << (const char*) essid << " / " << (const char*) macaddr |
134 | << " [" << channel << "]" << oendl; | ||
134 | #endif | 135 | #endif |
135 | 136 | ||
136 | // search, if we already have seen this net | 137 | // search, if we already have seen this net |
137 | 138 | ||
138 | QString s; | 139 | QString s; |
139 | MScanListItem* network; | 140 | MScanListItem* network; |
140 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 141 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
141 | 142 | ||
142 | while ( item && ( item->text( col_essid ) != essid ) ) | 143 | while ( item && ( item->text( col_essid ) != essid ) ) |
143 | { | 144 | { |
144 | #ifdef DEBUG | 145 | #ifdef DEBUG |
145 | odebug << "itemtext: " << item->text( col_essid ) << "" << oendl; | 146 | odebug << "itemtext: " << item->text( col_essid ) << "" << oendl; |
146 | #endif | 147 | #endif |
147 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 148 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
148 | } | 149 | } |
149 | if ( item ) | 150 | if ( item ) |
150 | { | 151 | { |
151 | // we have already seen this net, check all childs if MAC exists | 152 | // we have already seen this net, check all childs if MAC exists |
152 | 153 | ||
153 | network = item; | 154 | network = item; |
154 | 155 | ||
155 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 156 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
156 | assert( item ); // this shouldn't fail | 157 | assert( item ); // this shouldn't fail |
157 | 158 | ||
158 | while ( item && ( item->text( col_ap ) != macaddr ) ) | 159 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
159 | { | 160 | { |
160 | #ifdef DEBUG | 161 | #ifdef DEBUG |
161 | odebug << "subitemtext: " << item->text( col_ap ) << "" << oendl; | 162 | odebug << "subitemtext: " << item->text( col_ap ) << "" << oendl; |
162 | #endif | 163 | #endif |
163 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 164 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
164 | } | 165 | } |
165 | 166 | ||
166 | if ( item ) | 167 | if ( item ) |
167 | { | 168 | { |
168 | // we have already seen this item, it's a dupe | 169 | // we have already seen this item, it's a dupe |
169 | #ifdef DEBUG | 170 | #ifdef DEBUG |
170 | odebug << "" << macaddr << " is a dupe - ignoring..." << oendl; | 171 | odebug << "" << macaddr << " is a dupe - ignoring..." << oendl; |
171 | #endif | 172 | #endif |
172 | item->receivedBeacon(); | 173 | item->receivedBeacon(); |
173 | return; | 174 | return; |
174 | } | 175 | } |
175 | } | 176 | } |
176 | else | 177 | else |
177 | { | 178 | { |
178 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); | 179 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); |
179 | MLogWindow::logwindow()->log( s ); | 180 | MLogWindow::logwindow()->log( s ); |
180 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); | 181 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); |
181 | } | 182 | } |
182 | 183 | ||
183 | 184 | ||
184 | // insert new station as child from network | 185 | // insert new station as child from network |
185 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 186 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
186 | 187 | ||
187 | #ifdef DEBUG | 188 | #ifdef DEBUG |
188 | odebug << "inserting new station " << macaddr << "" << oendl; | 189 | odebug << "inserting new station " << macaddr << "" << oendl; |
189 | #endif | 190 | #endif |
190 | 191 | ||
191 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 192 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
192 | station->setManufacturer( mac.manufacturer() ); | 193 | station->setManufacturer( mac.manufacturer() ); |
193 | station->setLocation( loc.dmsPosition() ); | 194 | station->setLocation( loc.dmsPosition() ); |
194 | 195 | ||
195 | if ( type == "managed" ) | 196 | if ( type == "managed" ) |
196 | { | 197 | { |
197 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); | 198 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); |
198 | } | 199 | } |
199 | else | 200 | else |
200 | { | 201 | { |
201 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); | 202 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); |
202 | } | 203 | } |
203 | MLogWindow::logwindow()->log( s ); | 204 | MLogWindow::logwindow()->log( s ); |
204 | } | 205 | } |
205 | 206 | ||
206 | 207 | ||
207 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) | 208 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) |
208 | { | 209 | { |
209 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 210 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
210 | 211 | ||
211 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) | 212 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) |
212 | { | 213 | { |
213 | #ifdef DEBUG | 214 | #ifdef DEBUG |
214 | odebug << "subitemtext: " << subitem->text( col_ap ) << "" << oendl; | 215 | odebug << "subitemtext: " << subitem->text( col_ap ) << "" << oendl; |
215 | #endif | 216 | #endif |
216 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 217 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
217 | } | 218 | } |
218 | 219 | ||
219 | if ( subitem ) | 220 | if ( subitem ) |
220 | { | 221 | { |
221 | // we have already seen this item, it's a dupe | 222 | // we have already seen this item, it's a dupe |
222 | #ifdef DEBUG | 223 | #ifdef DEBUG |
223 | odebug << "" << addr.toString(true) << " is a dupe - ignoring..." << oendl; | 224 | odebug << "" << addr.toString(true) << " is a dupe - ignoring..." << oendl; |
224 | #endif | 225 | #endif |
225 | subitem->receivedBeacon(); //FIXME: sent data bit | 226 | subitem->receivedBeacon(); //FIXME: sent data bit |
226 | return; | 227 | return; |
227 | } | 228 | } |
228 | 229 | ||
229 | // Hey, it seems to be a new item :-D | 230 | // Hey, it seems to be a new item :-D |
230 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); | 231 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); |
231 | station->setManufacturer( addr.manufacturer() ); | 232 | station->setManufacturer( addr.manufacturer() ); |
232 | 233 | ||
233 | QString s; | 234 | QString s; |
234 | if ( type == "station" ) | 235 | if ( type == "station" ) |
235 | { | 236 | { |
236 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 237 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
237 | } | 238 | } |
238 | else | 239 | else |
239 | { | 240 | { |
240 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 241 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
241 | } | 242 | } |
242 | MLogWindow::logwindow()->log( s ); | 243 | MLogWindow::logwindow()->log( s ); |
243 | } | 244 | } |
244 | 245 | ||
245 | 246 | ||
246 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) | 247 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) |
247 | { | 248 | { |
248 | odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; | 249 | odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; |
249 | QString s; | 250 | QString s; |
250 | MScanListItem* network; | 251 | MScanListItem* network; |
251 | 252 | ||
252 | QListViewItemIterator it( this ); | 253 | QListViewItemIterator it( this ); |
253 | while ( it.current() && | 254 | while ( it.current() && |
254 | it.current()->text( col_ap ) != viaFrom.toString(true) && | 255 | it.current()->text( col_ap ) != viaFrom.toString(true) && |
255 | it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; | 256 | it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; |
256 | 257 | ||
257 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 258 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
258 | 259 | ||
259 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations | 260 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations |
260 | { | 261 | { |
261 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | 262 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
@@ -269,299 +270,297 @@ void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, | |||
269 | } | 270 | } |
270 | 271 | ||
271 | 272 | ||
272 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 273 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
273 | { | 274 | { |
274 | QString s; | 275 | QString s; |
275 | MScanListItem* network; | 276 | MScanListItem* network; |
276 | 277 | ||
277 | QListViewItemIterator it( this ); | 278 | QListViewItemIterator it( this ); |
278 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; | 279 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; |
279 | 280 | ||
280 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 281 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
281 | 282 | ||
282 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 283 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
283 | { | 284 | { |
284 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); | 285 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); |
285 | } | 286 | } |
286 | else | 287 | else |
287 | { | 288 | { |
288 | odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; | 289 | odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; |
289 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); | 290 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); |
290 | 291 | ||
291 | } | 292 | } |
292 | } | 293 | } |
293 | 294 | ||
294 | 295 | ||
295 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 296 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
296 | { | 297 | { |
297 | QString s; | 298 | QString s; |
298 | MScanListItem* network; | 299 | MScanListItem* network; |
299 | 300 | ||
300 | QListViewItemIterator it( this ); | 301 | QListViewItemIterator it( this ); |
301 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; | 302 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; |
302 | 303 | ||
303 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 304 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
304 | 305 | ||
305 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 306 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
306 | { | 307 | { |
307 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); | 308 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); |
308 | } | 309 | } |
309 | else | 310 | else |
310 | { | 311 | { |
311 | odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; | 312 | odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; |
312 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); | 313 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); |
313 | } | 314 | } |
314 | } | 315 | } |
315 | 316 | ||
316 | 317 | ||
317 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 318 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
318 | { | 319 | { |
319 | owarn << "D'oh! Not yet implemented..." << oendl; | 320 | owarn << "D'oh! Not yet implemented..." << oendl; |
320 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); | 321 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); |
321 | } | 322 | } |
322 | 323 | ||
323 | 324 | ||
324 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | 325 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) |
325 | { | 326 | { |
326 | odebug << "identify " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; | 327 | odebug << "identify " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; |
327 | 328 | ||
328 | QListViewItemIterator it( this ); | 329 | QListViewItemIterator it( this ); |
329 | for ( ; it.current(); ++it ) | 330 | for ( ; it.current(); ++it ) |
330 | { | 331 | { |
331 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | 332 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) |
332 | { | 333 | { |
333 | it.current()->setText( col_ip, ip ); | 334 | it.current()->setText( col_ip, ip ); |
334 | return; | 335 | return; |
335 | } | 336 | } |
336 | } | 337 | } |
337 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; | 338 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; |
338 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", | 339 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", |
339 | (const char*) macaddr.toString(), (const char*) ip ) ); | 340 | (const char*) macaddr.toString(), (const char*) ip ) ); |
340 | } | 341 | } |
341 | 342 | ||
342 | 343 | ||
343 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) | 344 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) |
344 | { | 345 | { |
345 | odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; | 346 | odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; |
346 | 347 | ||
347 | //TODO: Refactor that out, we need it all over the place. | 348 | //TODO: Refactor that out, we need it all over the place. |
348 | // Best to do it in a more comfortable abstraction in OListView | 349 | // Best to do it in a more comfortable abstraction in OListView |
349 | // (Hmm, didn't I already start something in this direction?) | 350 | // (Hmm, didn't I already start something in this direction?) |
350 | 351 | ||
351 | QListViewItemIterator it( this ); | 352 | QListViewItemIterator it( this ); |
352 | for ( ; it.current(); ++it ) | 353 | for ( ; it.current(); ++it ) |
353 | { | 354 | { |
354 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | 355 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) |
355 | { | 356 | { |
356 | 357 | ||
357 | MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); | 358 | MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); |
358 | 359 | ||
359 | while ( subitem && ( subitem->text( col_essid ) != name ) ) | 360 | while ( subitem && ( subitem->text( col_essid ) != name ) ) |
360 | { | 361 | { |
361 | #ifdef DEBUG | 362 | #ifdef DEBUG |
362 | odebug << "subitemtext: " << subitem->text( col_essid ) << "" << oendl; | 363 | odebug << "subitemtext: " << subitem->text( col_essid ) << "" << oendl; |
363 | #endif | 364 | #endif |
364 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 365 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
365 | } | 366 | } |
366 | 367 | ||
367 | if ( subitem ) | 368 | if ( subitem ) |
368 | { | 369 | { |
369 | // we have already seen this item, it's a dupe | 370 | // we have already seen this item, it's a dupe |
370 | #ifdef DEBUG | 371 | #ifdef DEBUG |
371 | odebug << "" << name << " is a dupe - ignoring..." << oendl; | 372 | odebug << "" << name << " is a dupe - ignoring..." << oendl; |
372 | #endif | 373 | #endif |
373 | subitem->receivedBeacon(); //FIXME: sent data bit | 374 | subitem->receivedBeacon(); //FIXME: sent data bit |
374 | return; | 375 | return; |
375 | } | 376 | } |
376 | 377 | ||
377 | // never seen that - add new item | 378 | // never seen that - add new item |
378 | 379 | ||
379 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); | 380 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); |
380 | item->setText( col_essid, name ); | 381 | item->setText( col_essid, name ); |
381 | 382 | ||
382 | return; | 383 | return; |
383 | } | 384 | } |
384 | } | 385 | } |
385 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; | 386 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; |
386 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", | 387 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", |
387 | (const char*) macaddr.toString(), (const char*) ip ) ); | 388 | (const char*) macaddr.toString(), (const char*) ip ) ); |
388 | } | 389 | } |
389 | 390 | ||
390 | 391 | ||
391 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 392 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
392 | { | 393 | { |
393 | if ( !item ) return; | 394 | if ( !item ) return; |
394 | 395 | ||
395 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 396 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
396 | 397 | ||
397 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | 398 | odebug << "contextMenuRequested on item '" << (const char*) itm->text(0) << "' (" |
398 | (const char*) itm->text(0), (const char*) itm->type, col ); | 399 | << (const char*) itm->type << ") in column: '" << col << "'" << oendl; |
399 | 400 | ||
400 | if ( itm->type == "adhoc" || itm->type == "managed" ) | 401 | if ( itm->type == "adhoc" || itm->type == "managed" ) |
401 | { | 402 | { |
402 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | 403 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); |
403 | 404 | ||
404 | QPopupMenu m( this ); | 405 | QPopupMenu m( this ); |
405 | m.insertItem( entry, 37773, 0 ); | 406 | m.insertItem( entry, 37773, 0 ); |
406 | int result = m.exec( QCursor::pos() ); | 407 | int result = m.exec( QCursor::pos() ); |
407 | if ( result == 37773 ) | 408 | if ( result == 37773 ) |
408 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); | 409 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); |
409 | } | 410 | } |
410 | } | 411 | } |
411 | 412 | ||
412 | //============================================================ | 413 | //============================================================ |
413 | // MScanListItem | 414 | // MScanListItem |
414 | //============================================================ | 415 | //============================================================ |
415 | 416 | ||
416 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, | 417 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, |
417 | bool wep, int channel, int signal, bool probed ) | 418 | bool wep, int channel, int signal, bool probed ) |
418 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 419 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
419 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 420 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
420 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 421 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
421 | { | 422 | { |
422 | #ifdef DEBUG | 423 | #ifdef DEBUG |
423 | odebug << "creating scanlist item" << oendl; | 424 | odebug << "creating scanlist item" << oendl; |
424 | #endif | 425 | #endif |
425 | 426 | ||
426 | if ( WellenreiterConfigWindow::instance() ) | 427 | if ( WellenreiterConfigWindow::instance() ) |
427 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here | 428 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here |
428 | 429 | ||
429 | decorateItem( type, essid, macaddr, wep, channel, signal, probed ); | 430 | decorateItem( type, essid, macaddr, wep, channel, signal, probed ); |
430 | } | 431 | } |
431 | 432 | ||
432 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, | 433 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, |
433 | bool wep, int channel, int signal ) | 434 | bool wep, int channel, int signal ) |
434 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 435 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
435 | { | 436 | { |
436 | #ifdef DEBUG | 437 | #ifdef DEBUG |
437 | odebug << "creating scanlist item" << oendl; | 438 | odebug << "creating scanlist item" << oendl; |
438 | #endif | 439 | #endif |
439 | if ( WellenreiterConfigWindow::instance() ) | 440 | if ( WellenreiterConfigWindow::instance() ) |
440 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here | 441 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here |
441 | 442 | ||
442 | decorateItem( type, essid, macaddr, wep, channel, signal, false ); | 443 | decorateItem( type, essid, macaddr, wep, channel, signal, false ); |
443 | } | 444 | } |
444 | 445 | ||
445 | const QString& MScanListItem::essid() const | 446 | const QString& MScanListItem::essid() const |
446 | { | 447 | { |
447 | if ( type == "network" ) | 448 | if ( type == "network" ) |
448 | return _essid; | 449 | return _essid; |
449 | else | 450 | else |
450 | return ( (MScanListItem*) parent() )->essid(); | 451 | return ( (MScanListItem*) parent() )->essid(); |
451 | } | 452 | } |
452 | 453 | ||
453 | OListViewItem* MScanListItem::childFactory() | 454 | OListViewItem* MScanListItem::childFactory() |
454 | { | 455 | { |
455 | return new MScanListItem( this ); | 456 | return new MScanListItem( this ); |
456 | } | 457 | } |
457 | 458 | ||
458 | void MScanListItem::serializeTo( QDataStream& s ) const | 459 | void MScanListItem::serializeTo( QDataStream& s ) const |
459 | { | 460 | { |
460 | #ifdef DEBUG | 461 | #ifdef DEBUG |
461 | odebug << "serializing MScanListItem" << oendl; | 462 | odebug << "serializing MScanListItem" << oendl; |
462 | #endif | 463 | #endif |
463 | OListViewItem::serializeTo( s ); | 464 | OListViewItem::serializeTo( s ); |
464 | 465 | ||
465 | s << _type; | 466 | s << _type; |
466 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); | 467 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); |
467 | } | 468 | } |
468 | 469 | ||
469 | void MScanListItem::serializeFrom( QDataStream& s ) | 470 | void MScanListItem::serializeFrom( QDataStream& s ) |
470 | { | 471 | { |
471 | #ifdef DEBUG | 472 | #ifdef DEBUG |
472 | odebug << "serializing MScanListItem" << oendl; | 473 | odebug << "serializing MScanListItem" << oendl; |
473 | #endif | 474 | #endif |
474 | OListViewItem::serializeFrom( s ); | 475 | OListViewItem::serializeFrom( s ); |
475 | 476 | ||
476 | Q_UINT8 wep; | 477 | Q_UINT8 wep; |
477 | s >> _type; | 478 | s >> _type; |
478 | s >> wep; | 479 | s >> wep; |
479 | _wep = (wep == 'y'); | 480 | _wep = (wep == 'y'); |
480 | 481 | ||
481 | QString name; | 482 | QString name; |
482 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | 483 | name.sprintf( "wellenreiter/%s", (const char*) _type ); |
483 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 484 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
484 | if ( _wep ) | 485 | if ( _wep ) |
485 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 486 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
486 | listView()->triggerUpdate(); | 487 | listView()->triggerUpdate(); |
487 | } | 488 | } |
488 | 489 | ||
489 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) | 490 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) |
490 | { | 491 | { |
491 | #ifdef DEBUG | 492 | #ifdef DEBUG |
492 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 493 | odebug << "decorating scanlist item " << (const char*) type << " / " |
493 | (const char*) type, | 494 | << (const char*) essid << " / " << (const char*) macaddr |
494 | (const char*) essid, | 495 | << "[" << channel << "]" << oendl; |
495 | (const char*) macaddr, | ||
496 | channel ); | ||
497 | #endif | 496 | #endif |
498 | 497 | ||
499 | // set icon for managed or adhoc mode | 498 | // set icon for managed or adhoc mode |
500 | QString name; | 499 | QString name; |
501 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 500 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
502 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 501 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
503 | 502 | ||
504 | // special case for probed networks FIXME: This is ugly at present | 503 | // special case for probed networks FIXME: This is ugly at present |
505 | if ( type == "network" && probed ) | 504 | if ( type == "network" && probed ) |
506 | { | 505 | { |
507 | setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); | 506 | setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); |
508 | } | 507 | } |
509 | 508 | ||
510 | // set icon for wep (wireless encryption protocol) | 509 | // set icon for wep (wireless encryption protocol) |
511 | if ( wep ) | 510 | if ( wep ) |
512 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 511 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
513 | 512 | ||
514 | // set channel and signal text | 513 | // set channel and signal text |
515 | 514 | ||
516 | if ( signal != -1 ) | 515 | if ( signal != -1 ) |
517 | setText( col_sig, QString::number( signal ) ); | 516 | setText( col_sig, QString::number( signal ) ); |
518 | if ( channel != -1 ) | 517 | if ( channel != -1 ) |
519 | setText( col_channel, QString::number( channel ) ); | 518 | setText( col_channel, QString::number( channel ) ); |
520 | 519 | ||
521 | setText( col_firstseen, QTime::currentTime().toString() ); | 520 | setText( col_firstseen, QTime::currentTime().toString() ); |
522 | //setText( col_lastseen, QTime::currentTime().toString() ); | 521 | //setText( col_lastseen, QTime::currentTime().toString() ); |
523 | 522 | ||
524 | listView()->triggerUpdate(); | 523 | listView()->triggerUpdate(); |
525 | 524 | ||
526 | this->type = type; | 525 | this->type = type; |
527 | _type = type; | 526 | _type = type; |
528 | _essid = essid; | 527 | _essid = essid; |
529 | _macaddr = macaddr; | 528 | _macaddr = macaddr; |
530 | _channel = channel; | 529 | _channel = channel; |
531 | _beacons = 1; | 530 | _beacons = 1; |
532 | _signal = 0; | 531 | _signal = 0; |
533 | 532 | ||
534 | if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) | 533 | if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) |
535 | { | 534 | { |
536 | listView()->ensureItemVisible( this ); | 535 | listView()->ensureItemVisible( this ); |
537 | } | 536 | } |
538 | 537 | ||
539 | } | 538 | } |
540 | 539 | ||
541 | 540 | ||
542 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 541 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
543 | { | 542 | { |
544 | setText( col_manuf, manufacturer ); | 543 | setText( col_manuf, manufacturer ); |
545 | } | 544 | } |
546 | 545 | ||
547 | 546 | ||
548 | void MScanListItem::setLocation( const QString& location ) | 547 | void MScanListItem::setLocation( const QString& location ) |
549 | { | 548 | { |
550 | setText( col_location, location ); | 549 | setText( col_location, location ); |
551 | } | 550 | } |
552 | 551 | ||
553 | 552 | ||
554 | void MScanListItem::receivedBeacon() | 553 | void MScanListItem::receivedBeacon() |
555 | { | 554 | { |
556 | _beacons++; | 555 | _beacons++; |
557 | #ifdef DEBUG | 556 | #ifdef DEBUG |
558 | odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl; | 557 | odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl; |
559 | #endif | 558 | #endif |
560 | setText( col_sig, QString::number( _beacons ) ); | 559 | setText( col_sig, QString::number( _beacons ) ); |
561 | setText( col_lastseen, QTime::currentTime().toString() ); | 560 | setText( col_lastseen, QTime::currentTime().toString() ); |
562 | 561 | ||
563 | MScanListItem* p = (MScanListItem*) parent(); | 562 | MScanListItem* p = (MScanListItem*) parent(); |
564 | if ( p ) p->receivedBeacon(); | 563 | if ( p ) p->receivedBeacon(); |
565 | 564 | ||
566 | } | 565 | } |
567 | 566 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 2f85790..e801ce7 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -617,153 +617,150 @@ void Wellenreiter::startClicked() | |||
617 | 617 | ||
618 | if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? | 618 | if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? |
619 | { | 619 | { |
620 | dumpname = configwindow->captureFileName->text(); | 620 | dumpname = configwindow->captureFileName->text(); |
621 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; | 621 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; |
622 | dumpname.append( '-' ); | 622 | dumpname.append( '-' ); |
623 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 623 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
624 | dumpname.append( ".wellenreiter" ); | 624 | dumpname.append( ".wellenreiter" ); |
625 | } | 625 | } |
626 | 626 | ||
627 | if ( cardtype != DEVTYPE_FILE ) | 627 | if ( cardtype != DEVTYPE_FILE ) |
628 | pcap->open( interface ); | 628 | pcap->open( interface ); |
629 | else | 629 | else |
630 | pcap->openCaptureFile( interface ); | 630 | pcap->openCaptureFile( interface ); |
631 | 631 | ||
632 | if ( configwindow->writeCaptureFile->isChecked() ) | 632 | if ( configwindow->writeCaptureFile->isChecked() ) |
633 | { | 633 | { |
634 | odebug << "Wellenreiter:: dumping to " << dumpname << oendl; | 634 | odebug << "Wellenreiter:: dumping to " << dumpname << oendl; |
635 | pcap->openDumpFile( dumpname ); | 635 | pcap->openDumpFile( dumpname ); |
636 | } | 636 | } |
637 | 637 | ||
638 | if ( !pcap->isOpen() ) | 638 | if ( !pcap->isOpen() ) |
639 | { | 639 | { |
640 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( | 640 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( |
641 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); | 641 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); |
642 | return; | 642 | return; |
643 | } | 643 | } |
644 | 644 | ||
645 | // set capturer to non-blocking mode | 645 | // set capturer to non-blocking mode |
646 | pcap->setBlocking( false ); | 646 | pcap->setBlocking( false ); |
647 | 647 | ||
648 | // start channel hopper | 648 | // start channel hopper |
649 | if ( cardtype != DEVTYPE_FILE ) | 649 | if ( cardtype != DEVTYPE_FILE ) |
650 | { | 650 | { |
651 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); | 651 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); |
652 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window | 652 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window |
653 | } | 653 | } |
654 | 654 | ||
655 | if ( cardtype != DEVTYPE_FILE ) | 655 | if ( cardtype != DEVTYPE_FILE ) |
656 | { | 656 | { |
657 | // connect socket notifier and start channel hopper | 657 | // connect socket notifier and start channel hopper |
658 | connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); | 658 | connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) ); |
659 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 659 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
660 | } | 660 | } |
661 | else | 661 | else |
662 | { | 662 | { |
663 | // start timer for reading packets | 663 | // start timer for reading packets |
664 | startTimer( 100 ); | 664 | startTimer( 100 ); |
665 | } | 665 | } |
666 | 666 | ||
667 | logwindow->log( "(i) Started Scanning." ); | 667 | logwindow->log( "(i) Started Scanning." ); |
668 | sniffing = true; | 668 | sniffing = true; |
669 | 669 | ||
670 | #ifdef QWS | 670 | #ifdef QWS |
671 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) | 671 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) |
672 | { | 672 | { |
673 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; | 673 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; |
674 | } | 674 | } |
675 | #else | 675 | #else |
676 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 676 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
677 | #endif | 677 | #endif |
678 | 678 | ||
679 | emit( startedSniffing() ); | 679 | emit( startedSniffing() ); |
680 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 680 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
681 | else | 681 | else |
682 | { | 682 | { |
683 | assert( parent() ); | 683 | assert( parent() ); |
684 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 684 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
685 | } | 685 | } |
686 | } | 686 | } |
687 | 687 | ||
688 | 688 | ||
689 | void Wellenreiter::timerEvent( QTimerEvent* ) | 689 | void Wellenreiter::timerEvent( QTimerEvent* ) |
690 | { | 690 | { |
691 | odebug << "Wellenreiter::timerEvent()" << oendl; | 691 | odebug << "Wellenreiter::timerEvent()" << oendl; |
692 | OPacket* p = pcap->next(); | 692 | OPacket* p = pcap->next(); |
693 | if ( !p ) // no more packets available | 693 | if ( !p ) // no more packets available |
694 | { | 694 | { |
695 | stopClicked(); | 695 | stopClicked(); |
696 | } | 696 | } |
697 | else | 697 | else |
698 | { | 698 | { |
699 | receivePacket( p ); | 699 | receivePacket( p ); |
700 | // We no longer delete packets here. Ownership of the packets is | 700 | // We no longer delete packets here. Ownership of the packets is |
701 | // transferred to the PacketView. | 701 | // transferred to the PacketView. |
702 | //delete p; | 702 | //delete p; |
703 | } | 703 | } |
704 | } | 704 | } |
705 | 705 | ||
706 | 706 | ||
707 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) | 707 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) |
708 | { | 708 | { |
709 | #ifdef QWS | 709 | #ifdef QWS |
710 | if ( action == "TouchSound" ) | 710 | if ( action == "TouchSound" ) |
711 | ODevice::inst()->playTouchSound(); | 711 | ODevice::inst()->playTouchSound(); |
712 | else if ( action == "AlarmSound" ) | 712 | else if ( action == "AlarmSound" ) |
713 | ODevice::inst()->playAlarmSound(); | 713 | ODevice::inst()->playAlarmSound(); |
714 | else if ( action == "KeySound" ) | 714 | else if ( action == "KeySound" ) |
715 | ODevice::inst()->playKeySound(); | 715 | ODevice::inst()->playKeySound(); |
716 | else if ( action == "LedOn" ) | 716 | else if ( action == "LedOn" ) |
717 | ODevice::inst()->setLedState( Led_Mail, Led_On ); | 717 | ODevice::inst()->setLedState( Led_Mail, Led_On ); |
718 | else if ( action == "LedOff" ) | 718 | else if ( action == "LedOff" ) |
719 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); | 719 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); |
720 | else if ( action == "LogMessage" ) | 720 | else if ( action == "LogMessage" ) |
721 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 721 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
722 | else if ( action == "MessageBox" ) | 722 | else if ( action == "MessageBox" ) |
723 | QMessageBox::information( this, "Notification!", | 723 | QMessageBox::information( this, "Notification!", |
724 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 724 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
725 | #else | 725 | #else |
726 | #warning Actions do not work with Qt/X11 yet | 726 | #warning Actions do not work with Qt/X11 yet |
727 | #endif | 727 | #endif |
728 | } | 728 | } |
729 | 729 | ||
730 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) | 730 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) |
731 | { | 731 | { |
732 | #ifdef QWS | 732 | #ifdef QWS |
733 | if ( !iface ) | 733 | if ( !iface ) |
734 | { | 734 | { |
735 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); | 735 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); |
736 | return; | 736 | return; |
737 | } | 737 | } |
738 | 738 | ||
739 | if ( sniffing ) | 739 | if ( sniffing ) |
740 | { | 740 | { |
741 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); | 741 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); |
742 | return; | 742 | return; |
743 | } | 743 | } |
744 | 744 | ||
745 | qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", | 745 | odebug << "joinNetwork() with Interface " << (const char*) iface->name() |
746 | (const char*) iface->name(), | 746 | << ": " << (const char*) type << ", " << (const char*) essid |
747 | (const char*) type, | 747 | << ", " << channel << ", " << (const char*) macaddr << oendl; |
748 | (const char*) essid, | ||
749 | channel, | ||
750 | (const char*) macaddr ); | ||
751 | 748 | ||
752 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); | 749 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); |
753 | int count = 3; | 750 | int count = 3; |
754 | odebug << "sending " << count << " messages" << oendl; | 751 | odebug << "sending " << count << " messages" << oendl; |
755 | msg << QString("count") << QString::number(count); | 752 | msg << QString("count") << QString::number(count); |
756 | odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; | 753 | odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; |
757 | msg << QString(iface->name()) << QString("Mode") << type; | 754 | msg << QString(iface->name()) << QString("Mode") << type; |
758 | odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; | 755 | odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; |
759 | msg << QString(iface->name()) << QString("ESSID") << essid; | 756 | msg << QString(iface->name()) << QString("ESSID") << essid; |
760 | odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; | 757 | odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; |
761 | msg << QString(iface->name()) << QString("Channel") << channel; | 758 | msg << QString(iface->name()) << QString("Channel") << channel; |
762 | // odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; | 759 | // odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; |
763 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; | 760 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; |
764 | #else | 761 | #else |
765 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); | 762 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); |
766 | #endif | 763 | #endif |
767 | 764 | ||
768 | } | 765 | } |
769 | 766 | ||