summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/composemail.cpp26
-rw-r--r--noncore/net/opietooth/manager/hciconfwrapper.cpp18
-rw-r--r--noncore/net/opietooth/manager/rfcommconfhandler.cpp12
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp17
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp9
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,39 +1,43 @@
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
17using namespace Opie::Core; 21using namespace Opie::Core;
18using namespace Opie::Ui; 22using namespace Opie::Ui;
19ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 23ComposeMail::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) {
@@ -163,54 +167,54 @@ void ComposeMail::slotAdjustColumns()
163 167
164void ComposeMail::addAttachment() 168void 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
173void ComposeMail::removeAttachment() 177void 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
184void ComposeMail::accept() 188void 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();
@@ -236,68 +240,68 @@ void ComposeMail::reject()
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
277ComposeMail::~ComposeMail() 281ComposeMail::~ComposeMail()
278{ 282{
279} 283}
280 284
281void ComposeMail::reEditMail(const RecMailP&current) 285void ComposeMail::reEditMail(const RecMailP&current)
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
292AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 296AttachViewItem::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
@@ -2,49 +2,49 @@
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>
8using namespace Opie::Core; 8using namespace Opie::Core;
9 9
10namespace OpieTooth { 10namespace 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
@@ -56,87 +56,87 @@ namespace OpieTooth {
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
@@ -73,44 +73,44 @@ void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) {
73QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() { 73QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() {
74 return m_foundEntries; 74 return m_foundEntries;
75} 75}
76 76
77void RfCommConfHandler::load() { 77void 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
@@ -108,50 +108,51 @@ void MScanListView::serializeTo( QDataStream& s) const
108 odebug << "serializing MScanListView" << oendl; 108 odebug << "serializing MScanListView" << oendl;
109 OListView::serializeTo( s ); 109 OListView::serializeTo( s );
110} 110}
111 111
112 112
113void MScanListView::serializeFrom( QDataStream& s) 113void 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
120void MScanListView::addNewItem( const QString& type, 120void 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
@@ -373,50 +374,50 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr,
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
391void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) 392void 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
416MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, 417MScanListItem::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
@@ -468,53 +469,51 @@ void MScanListItem::serializeTo( QDataStream& s ) const
468 469
469void MScanListItem::serializeFrom( QDataStream& s ) 470void 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
489void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) 490void 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
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
@@ -721,49 +721,46 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa
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
730void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) 730void 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