56 files changed, 430 insertions, 425 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 54d2da2..ae28313 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -69,25 +69,25 @@ void POP3viewItem::refresh() | |||
69 | QValueList<FolderP>::ConstIterator it; | 69 | QValueList<FolderP>::ConstIterator it; |
70 | QListViewItem*item = 0; | 70 | QListViewItem*item = 0; |
71 | for ( it = folders->begin(); it!=folders->end(); ++it) | 71 | for ( it = folders->begin(); it!=folders->end(); ++it) |
72 | { | 72 | { |
73 | item = new POP3folderItem( (*it), this , item ); | 73 | item = new POP3folderItem( (*it), this , item ); |
74 | item->setSelectable( (*it)->may_select()); | 74 | item->setSelectable( (*it)->may_select()); |
75 | } | 75 | } |
76 | delete folders; | 76 | delete folders; |
77 | } | 77 | } |
78 | 78 | ||
79 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 79 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
80 | { | 80 | { |
81 | qDebug( "POP3 fetchBody" ); | 81 | odebug << "POP3 fetchBody" << oendl; |
82 | return wrapper->fetchBody( mail ); | 82 | return wrapper->fetchBody( mail ); |
83 | } | 83 | } |
84 | 84 | ||
85 | QPopupMenu * POP3viewItem::getContextMenu() | 85 | QPopupMenu * POP3viewItem::getContextMenu() |
86 | { | 86 | { |
87 | QPopupMenu *m = new QPopupMenu(0); | 87 | QPopupMenu *m = new QPopupMenu(0); |
88 | if (m) | 88 | if (m) |
89 | { | 89 | { |
90 | if (!account->getOffline()) | 90 | if (!account->getOffline()) |
91 | { | 91 | { |
92 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 92 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
93 | m->insertItem(QObject::tr("Set offline",contextName),1); | 93 | m->insertItem(QObject::tr("Set offline",contextName),1); |
@@ -260,25 +260,25 @@ void NNTPviewItem::refresh() | |||
260 | QValueList<FolderP>::ConstIterator it; | 260 | QValueList<FolderP>::ConstIterator it; |
261 | QListViewItem*item = 0; | 261 | QListViewItem*item = 0; |
262 | for ( it = folders->begin(); it!=folders->end(); ++it) | 262 | for ( it = folders->begin(); it!=folders->end(); ++it) |
263 | { | 263 | { |
264 | item = new NNTPfolderItem( (*it), this , item ); | 264 | item = new NNTPfolderItem( (*it), this , item ); |
265 | item->setSelectable( (*it)->may_select()); | 265 | item->setSelectable( (*it)->may_select()); |
266 | } | 266 | } |
267 | delete folders; | 267 | delete folders; |
268 | } | 268 | } |
269 | 269 | ||
270 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 270 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
271 | { | 271 | { |
272 | qDebug( "NNTP fetchBody" ); | 272 | odebug << "NNTP fetchBody" << oendl; |
273 | return wrapper->fetchBody( mail ); | 273 | return wrapper->fetchBody( mail ); |
274 | } | 274 | } |
275 | 275 | ||
276 | QPopupMenu * NNTPviewItem::getContextMenu() | 276 | QPopupMenu * NNTPviewItem::getContextMenu() |
277 | { | 277 | { |
278 | QPopupMenu *m = new QPopupMenu(0); | 278 | QPopupMenu *m = new QPopupMenu(0); |
279 | if (m) | 279 | if (m) |
280 | { | 280 | { |
281 | if (!account->getOffline()) | 281 | if (!account->getOffline()) |
282 | { | 282 | { |
283 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 283 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
284 | m->insertItem(QObject::tr("Set offline",contextName),1); | 284 | m->insertItem(QObject::tr("Set offline",contextName),1); |
@@ -451,25 +451,25 @@ void IMAPviewItem::refreshFolders(bool force) | |||
451 | QValueList<FolderP>::Iterator it; | 451 | QValueList<FolderP>::Iterator it; |
452 | QListViewItem*item = 0; | 452 | QListViewItem*item = 0; |
453 | QListViewItem*titem = 0; | 453 | QListViewItem*titem = 0; |
454 | QString fname,del,search; | 454 | QString fname,del,search; |
455 | int pos; | 455 | int pos; |
456 | 456 | ||
457 | for ( it = folders->begin(); it!=folders->end(); ++it) | 457 | for ( it = folders->begin(); it!=folders->end(); ++it) |
458 | { | 458 | { |
459 | if ((*it)->getDisplayName().lower()=="inbox") | 459 | if ((*it)->getDisplayName().lower()=="inbox") |
460 | { | 460 | { |
461 | item = new IMAPfolderItem( (*it), this , item ); | 461 | item = new IMAPfolderItem( (*it), this , item ); |
462 | folders->remove(it); | 462 | folders->remove(it); |
463 | qDebug("inbox found"); | 463 | odebug << "inbox found" << oendl; |
464 | break; | 464 | break; |
465 | } | 465 | } |
466 | } | 466 | } |
467 | for ( it = folders->begin(); it!=folders->end(); ++it) | 467 | for ( it = folders->begin(); it!=folders->end(); ++it) |
468 | { | 468 | { |
469 | fname = (*it)->getDisplayName(); | 469 | fname = (*it)->getDisplayName(); |
470 | currentFolders.append((*it)->getName()); | 470 | currentFolders.append((*it)->getName()); |
471 | pos = fname.findRev((*it)->Separator()); | 471 | pos = fname.findRev((*it)->Separator()); |
472 | if (pos != -1) | 472 | if (pos != -1) |
473 | { | 473 | { |
474 | fname = fname.left(pos); | 474 | fname = fname.left(pos); |
475 | } | 475 | } |
@@ -524,25 +524,25 @@ void IMAPviewItem::createNewFolder() | |||
524 | { | 524 | { |
525 | delemiter = item->Delemiter(); | 525 | delemiter = item->Delemiter(); |
526 | } | 526 | } |
527 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 527 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
528 | { | 528 | { |
529 | refreshFolders(true); | 529 | refreshFolders(true); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | } | 532 | } |
533 | 533 | ||
534 | void IMAPviewItem::contextMenuSelected(int id) | 534 | void IMAPviewItem::contextMenuSelected(int id) |
535 | { | 535 | { |
536 | qDebug("Id selected: %i",id); | 536 | odebug << "Id selected: " << id << "" << oendl; |
537 | switch (id) | 537 | switch (id) |
538 | { | 538 | { |
539 | case 0: | 539 | case 0: |
540 | refreshFolders(true); | 540 | refreshFolders(true); |
541 | break; | 541 | break; |
542 | case 1: | 542 | case 1: |
543 | createNewFolder(); | 543 | createNewFolder(); |
544 | break; | 544 | break; |
545 | case 2: | 545 | case 2: |
546 | removeChilds(); | 546 | removeChilds(); |
547 | wrapper->logout(); | 547 | wrapper->logout(); |
548 | break; | 548 | break; |
@@ -662,25 +662,25 @@ void IMAPfolderItem::createNewFolder() | |||
662 | { | 662 | { |
663 | imap->refreshFolders(true); | 663 | imap->refreshFolders(true); |
664 | } | 664 | } |
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | void IMAPfolderItem::deleteFolder() | 668 | void IMAPfolderItem::deleteFolder() |
669 | { | 669 | { |
670 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 670 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
671 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 671 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
672 | QObject::tr("Yes",contextName), | 672 | QObject::tr("Yes",contextName), |
673 | QObject::tr("No",contextName),QString::null,1,1); | 673 | QObject::tr("No",contextName),QString::null,1,1); |
674 | qDebug("Auswahl: %i",yesno); | 674 | odebug << "Auswahl: " << yesno << "" << oendl; |
675 | if (yesno == 0) | 675 | if (yesno == 0) |
676 | { | 676 | { |
677 | if (imap->getWrapper()->deleteMbox(folder)) | 677 | if (imap->getWrapper()->deleteMbox(folder)) |
678 | { | 678 | { |
679 | QListView*v=listView(); | 679 | QListView*v=listView(); |
680 | IMAPviewItem * box = imap; | 680 | IMAPviewItem * box = imap; |
681 | /* be carefull - after that this object is destroyd so don't use | 681 | /* be carefull - after that this object is destroyd so don't use |
682 | * any member of it after that call!!*/ | 682 | * any member of it after that call!!*/ |
683 | imap->refreshFolders(true); | 683 | imap->refreshFolders(true); |
684 | if (v) | 684 | if (v) |
685 | { | 685 | { |
686 | v->setSelected(box,true); | 686 | v->setSelected(box,true); |
@@ -689,25 +689,25 @@ void IMAPfolderItem::deleteFolder() | |||
689 | } | 689 | } |
690 | } | 690 | } |
691 | 691 | ||
692 | void IMAPfolderItem::downloadMails() | 692 | void IMAPfolderItem::downloadMails() |
693 | { | 693 | { |
694 | AccountView*bl = imap->accountView(); | 694 | AccountView*bl = imap->accountView(); |
695 | if (!bl) return; | 695 | if (!bl) return; |
696 | bl->downloadMails(folder,imap->getWrapper()); | 696 | bl->downloadMails(folder,imap->getWrapper()); |
697 | } | 697 | } |
698 | 698 | ||
699 | void IMAPfolderItem::contextMenuSelected(int id) | 699 | void IMAPfolderItem::contextMenuSelected(int id) |
700 | { | 700 | { |
701 | qDebug("Selected id: %i",id); | 701 | odebug << "Selected id: " << id << "" << oendl; |
702 | AccountView * view = (AccountView*)listView(); | 702 | AccountView * view = (AccountView*)listView(); |
703 | switch(id) | 703 | switch(id) |
704 | { | 704 | { |
705 | case 0: | 705 | case 0: |
706 | view->refreshCurrent(); | 706 | view->refreshCurrent(); |
707 | break; | 707 | break; |
708 | case 1: | 708 | case 1: |
709 | deleteAllMail(imap->getWrapper(),folder); | 709 | deleteAllMail(imap->getWrapper(),folder); |
710 | break; | 710 | break; |
711 | case 2: | 711 | case 2: |
712 | createNewFolder(); | 712 | createNewFolder(); |
713 | break; | 713 | break; |
@@ -793,25 +793,25 @@ void MHviewItem::refresh(bool force) | |||
793 | } | 793 | } |
794 | else | 794 | else |
795 | { | 795 | { |
796 | item = new MHfolderItem( (*it), this , item ); | 796 | item = new MHfolderItem( (*it), this , item ); |
797 | } | 797 | } |
798 | item->setSelectable((*it)->may_select()); | 798 | item->setSelectable((*it)->may_select()); |
799 | } | 799 | } |
800 | delete folders; | 800 | delete folders; |
801 | } | 801 | } |
802 | 802 | ||
803 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 803 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
804 | { | 804 | { |
805 | qDebug( "MH fetchBody" ); | 805 | odebug << "MH fetchBody" << oendl; |
806 | return wrapper->fetchBody( mail ); | 806 | return wrapper->fetchBody( mail ); |
807 | } | 807 | } |
808 | 808 | ||
809 | QPopupMenu * MHviewItem::getContextMenu() | 809 | QPopupMenu * MHviewItem::getContextMenu() |
810 | { | 810 | { |
811 | QPopupMenu *m = new QPopupMenu(0); | 811 | QPopupMenu *m = new QPopupMenu(0); |
812 | if (m) | 812 | if (m) |
813 | { | 813 | { |
814 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 814 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
815 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 815 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
816 | m->insertItem(QObject::tr("Delete all mails",contextName),2); | 816 | m->insertItem(QObject::tr("Delete all mails",contextName),2); |
817 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); | 817 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); |
@@ -923,25 +923,25 @@ void MHfolderItem::refresh(QValueList<RecMailP>&target) | |||
923 | 923 | ||
924 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) | 924 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) |
925 | { | 925 | { |
926 | return mbox->getWrapper()->fetchBody(aMail); | 926 | return mbox->getWrapper()->fetchBody(aMail); |
927 | } | 927 | } |
928 | 928 | ||
929 | void MHfolderItem::deleteFolder() | 929 | void MHfolderItem::deleteFolder() |
930 | { | 930 | { |
931 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 931 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
932 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 932 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
933 | QObject::tr("Yes",contextName), | 933 | QObject::tr("Yes",contextName), |
934 | QObject::tr("No",contextName),QString::null,1,1); | 934 | QObject::tr("No",contextName),QString::null,1,1); |
935 | qDebug("Auswahl: %i",yesno); | 935 | odebug << "Auswahl: " << yesno << "" << oendl; |
936 | if (yesno == 0) | 936 | if (yesno == 0) |
937 | { | 937 | { |
938 | if (mbox->getWrapper()->deleteMbox(folder)) | 938 | if (mbox->getWrapper()->deleteMbox(folder)) |
939 | { | 939 | { |
940 | QListView*v=listView(); | 940 | QListView*v=listView(); |
941 | MHviewItem * box = mbox; | 941 | MHviewItem * box = mbox; |
942 | /* be carefull - after that this object is destroyd so don't use | 942 | /* be carefull - after that this object is destroyd so don't use |
943 | * any member of it after that call!!*/ | 943 | * any member of it after that call!!*/ |
944 | mbox->refresh(true); | 944 | mbox->refresh(true); |
945 | if (v) | 945 | if (v) |
946 | { | 946 | { |
947 | v->setSelected(box,true); | 947 | v->setSelected(box,true); |
@@ -1065,25 +1065,25 @@ AccountView*AccountViewItem::accountView() | |||
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) | 1067 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) |
1068 | { | 1068 | { |
1069 | if (!wrapper) return; | 1069 | if (!wrapper) return; |
1070 | QString fname=""; | 1070 | QString fname=""; |
1071 | if (folder) fname = folder->getDisplayName(); | 1071 | if (folder) fname = folder->getDisplayName(); |
1072 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 1072 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
1073 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 1073 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
1074 | arg(fname), | 1074 | arg(fname), |
1075 | QObject::tr("Yes",contextName), | 1075 | QObject::tr("Yes",contextName), |
1076 | QObject::tr("No",contextName),QString::null,1,1); | 1076 | QObject::tr("No",contextName),QString::null,1,1); |
1077 | qDebug("Auswahl: %i",yesno); | 1077 | odebug << "Auswahl: " << yesno << "" << oendl; |
1078 | if (yesno == 0) | 1078 | if (yesno == 0) |
1079 | { | 1079 | { |
1080 | if (wrapper->deleteAllMail(folder)) | 1080 | if (wrapper->deleteAllMail(folder)) |
1081 | { | 1081 | { |
1082 | AccountView * view = (AccountView*)listView(); | 1082 | AccountView * view = (AccountView*)listView(); |
1083 | if (view) view->refreshCurrent(); | 1083 | if (view) view->refreshCurrent(); |
1084 | } | 1084 | } |
1085 | } | 1085 | } |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | void AccountViewItem::removeChilds() | 1088 | void AccountViewItem::removeChilds() |
1089 | { | 1089 | { |
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index f0a163e..0052061 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -57,48 +57,48 @@ void AccountView::populate( QList<Account> list ) | |||
57 | 57 | ||
58 | imapAccounts.clear(); | 58 | imapAccounts.clear(); |
59 | mhAccounts.clear(); | 59 | mhAccounts.clear(); |
60 | 60 | ||
61 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 61 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
62 | 62 | ||
63 | Account *it; | 63 | Account *it; |
64 | for ( it = list.first(); it; it = list.next() ) | 64 | for ( it = list.first(); it; it = list.next() ) |
65 | { | 65 | { |
66 | if ( it->getType() == MAILLIB::A_IMAP ) | 66 | if ( it->getType() == MAILLIB::A_IMAP ) |
67 | { | 67 | { |
68 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 68 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
69 | qDebug( "added IMAP " + imap->getAccountName() ); | 69 | odebug << "added IMAP " + imap->getAccountName() << oendl; |
70 | imapAccounts.append(new IMAPviewItem( imap, this )); | 70 | imapAccounts.append(new IMAPviewItem( imap, this )); |
71 | } | 71 | } |
72 | else if ( it->getType() == MAILLIB::A_POP3 ) | 72 | else if ( it->getType() == MAILLIB::A_POP3 ) |
73 | { | 73 | { |
74 | POP3account *pop3 = static_cast<POP3account *>(it); | 74 | POP3account *pop3 = static_cast<POP3account *>(it); |
75 | qDebug( "added POP3 " + pop3->getAccountName() ); | 75 | odebug << "added POP3 " + pop3->getAccountName() << oendl; |
76 | /* must not be hold 'cause it isn't required */ | 76 | /* must not be hold 'cause it isn't required */ |
77 | (void) new POP3viewItem( pop3, this ); | 77 | (void) new POP3viewItem( pop3, this ); |
78 | } | 78 | } |
79 | else if ( it->getType() == MAILLIB::A_NNTP ) | 79 | else if ( it->getType() == MAILLIB::A_NNTP ) |
80 | { | 80 | { |
81 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 81 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
82 | qDebug( "added NNTP " + nntp->getAccountName() ); | 82 | odebug << "added NNTP " + nntp->getAccountName() << oendl; |
83 | /* must not be hold 'cause it isn't required */ | 83 | /* must not be hold 'cause it isn't required */ |
84 | (void) new NNTPviewItem( nntp, this ); | 84 | (void) new NNTPviewItem( nntp, this ); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void AccountView::refresh(QListViewItem *item) | 89 | void AccountView::refresh(QListViewItem *item) |
90 | { | 90 | { |
91 | 91 | ||
92 | qDebug("AccountView refresh..."); | 92 | odebug << "AccountView refresh..." << oendl; |
93 | if ( item ) | 93 | if ( item ) |
94 | { | 94 | { |
95 | m_currentItem = item; | 95 | m_currentItem = item; |
96 | QValueList<RecMailP> headerlist; | 96 | QValueList<RecMailP> headerlist; |
97 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 97 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
98 | view->refresh(headerlist); | 98 | view->refresh(headerlist); |
99 | emit refreshMailview(headerlist); | 99 | emit refreshMailview(headerlist); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | void AccountView::refreshCurrent() | 103 | void AccountView::refreshCurrent() |
104 | { | 104 | { |
@@ -153,24 +153,24 @@ void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrappe | |||
153 | targetFolder = sels.currentFolder(); | 153 | targetFolder = sels.currentFolder(); |
154 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 154 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
155 | targetFolder.isEmpty()) | 155 | targetFolder.isEmpty()) |
156 | { | 156 | { |
157 | return; | 157 | return; |
158 | } | 158 | } |
159 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 159 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
160 | { | 160 | { |
161 | QMessageBox::critical(0,tr("Error creating new Folder"), | 161 | QMessageBox::critical(0,tr("Error creating new Folder"), |
162 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 162 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
163 | return; | 163 | return; |
164 | } | 164 | } |
165 | qDebug("Targetfolder: %s",targetFolder.latin1()); | 165 | odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl; |
166 | qDebug("Fromfolder: %s",fromFolder->getName().latin1()); | 166 | odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl; |
167 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); | 167 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); |
168 | refreshCurrent(); | 168 | refreshCurrent(); |
169 | } | 169 | } |
170 | 170 | ||
171 | bool AccountView::currentisDraft() | 171 | bool AccountView::currentisDraft() |
172 | { | 172 | { |
173 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 173 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
174 | if (!view) return false; | 174 | if (!view) return false; |
175 | return view->isDraftfolder(); | 175 | return view->isDraftfolder(); |
176 | } | 176 | } |
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index 988a1d9..fa703c4 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -174,25 +174,25 @@ void ComposeMail::removeAttachment() | |||
174 | if ( !attList->currentItem() ) { | 174 | if ( !attList->currentItem() ) { |
175 | QMessageBox::information( this, tr( "Error" ), | 175 | QMessageBox::information( this, tr( "Error" ), |
176 | tr( "<p>Please select a File.</p>" ), | 176 | tr( "<p>Please select a File.</p>" ), |
177 | tr( "Ok" ) ); | 177 | tr( "Ok" ) ); |
178 | } else { | 178 | } else { |
179 | attList->takeItem( attList->currentItem() ); | 179 | attList->takeItem( attList->currentItem() ); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | void ComposeMail::accept() | 183 | void ComposeMail::accept() |
184 | { | 184 | { |
185 | if ( checkBoxLater->isChecked() ) { | 185 | if ( checkBoxLater->isChecked() ) { |
186 | qDebug( "Send later" ); | 186 | odebug << "Send later" << oendl; |
187 | } | 187 | } |
188 | 188 | ||
189 | #if 0 | 189 | #if 0 |
190 | qDebug( "Sending Mail with " + | 190 | qDebug( "Sending Mail with " + |
191 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); | 191 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); |
192 | #endif | 192 | #endif |
193 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 193 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
194 | 194 | ||
195 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 195 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
196 | mail->setMail(fromBox->currentText()); | 196 | mail->setMail(fromBox->currentText()); |
197 | 197 | ||
198 | if ( !toLine->text().isEmpty() ) { | 198 | if ( !toLine->text().isEmpty() ) { |
@@ -247,25 +247,25 @@ void ComposeMail::reject() | |||
247 | mail->setReply( replyLine->text() ); | 247 | mail->setReply( replyLine->text() ); |
248 | mail->setSubject( subjectLine->text() ); | 248 | mail->setSubject( subjectLine->text() ); |
249 | if (!m_replyid.isEmpty()) { | 249 | if (!m_replyid.isEmpty()) { |
250 | QStringList ids; | 250 | QStringList ids; |
251 | ids.append(m_replyid); | 251 | ids.append(m_replyid); |
252 | mail->setInreply(ids); | 252 | mail->setInreply(ids); |
253 | } | 253 | } |
254 | QString txt = message->text(); | 254 | QString txt = message->text(); |
255 | if ( !sigMultiLine->text().isEmpty() ) { | 255 | if ( !sigMultiLine->text().isEmpty() ) { |
256 | txt.append( "\n--\n" ); | 256 | txt.append( "\n--\n" ); |
257 | txt.append( sigMultiLine->text() ); | 257 | txt.append( sigMultiLine->text() ); |
258 | } | 258 | } |
259 | qDebug(txt); | 259 | odebug << txt << oendl; |
260 | mail->setMessage( txt ); | 260 | mail->setMessage( txt ); |
261 | 261 | ||
262 | /* only use the default drafts folder name! */ | 262 | /* only use the default drafts folder name! */ |
263 | Storemail wrapper(AbstractMail::draftFolder()); | 263 | Storemail wrapper(AbstractMail::draftFolder()); |
264 | wrapper.storeMail(mail); | 264 | wrapper.storeMail(mail); |
265 | 265 | ||
266 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 266 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
267 | /* attachments we will ignore! */ | 267 | /* attachments we will ignore! */ |
268 | if ( it != NULL ) { | 268 | if ( it != NULL ) { |
269 | QMessageBox::warning(0,tr("Store message"), | 269 | QMessageBox::warning(0,tr("Store message"), |
270 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 270 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
271 | } | 271 | } |
@@ -283,20 +283,20 @@ void ComposeMail::reEditMail(const RecMailP¤t) | |||
283 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 283 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
284 | subjectLine->setText( data->getSubject()); | 284 | subjectLine->setText( data->getSubject()); |
285 | toLine->setText(data->To().join(",")); | 285 | toLine->setText(data->To().join(",")); |
286 | ccLine->setText(data->CC().join(",")); | 286 | ccLine->setText(data->CC().join(",")); |
287 | bccLine->setText(data->Bcc().join(",")); | 287 | bccLine->setText(data->Bcc().join(",")); |
288 | replyLine->setText(data->Replyto()); | 288 | replyLine->setText(data->Replyto()); |
289 | } | 289 | } |
290 | 290 | ||
291 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 291 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
292 | : QListViewItem( parent ) | 292 | : QListViewItem( parent ) |
293 | { | 293 | { |
294 | attachment = att; | 294 | attachment = att; |
295 | qDebug( att->getMimeType() ); | 295 | odebug << att->getMimeType() << oendl; |
296 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? | 296 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? |
297 | Resource::loadPixmap( "UnknownDocument-14" ) : | 297 | Resource::loadPixmap( "UnknownDocument-14" ) : |
298 | attachment->getDocLnk().pixmap() ); | 298 | attachment->getDocLnk().pixmap() ); |
299 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 299 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
300 | setText( 1, QString::number( att->getSize() ) ); | 300 | setText( 1, QString::number( att->getSize() ) ); |
301 | } | 301 | } |
302 | 302 | ||
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp index 5c4bdf7..de064ca 100644 --- a/noncore/net/mail/editaccounts.cpp +++ b/noncore/net/mail/editaccounts.cpp | |||
@@ -31,25 +31,25 @@ AccountListItem::AccountListItem( QListView *parent, Account *a) | |||
31 | ttext = "SMTP"; | 31 | ttext = "SMTP"; |
32 | break; | 32 | break; |
33 | default: | 33 | default: |
34 | ttext = "UNKNOWN"; | 34 | ttext = "UNKNOWN"; |
35 | break; | 35 | break; |
36 | } | 36 | } |
37 | setText( 1, ttext); | 37 | setText( 1, ttext); |
38 | } | 38 | } |
39 | 39 | ||
40 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 40 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
41 | : EditAccountsUI( parent, name, modal, flags ) | 41 | : EditAccountsUI( parent, name, modal, flags ) |
42 | { | 42 | { |
43 | qDebug( "New Account Configuration Widget" ); | 43 | odebug << "New Account Configuration Widget" << oendl; |
44 | settings = s; | 44 | settings = s; |
45 | 45 | ||
46 | mailList->addColumn( tr( "Account" ) ); | 46 | mailList->addColumn( tr( "Account" ) ); |
47 | mailList->addColumn( tr( "Type" ) ); | 47 | mailList->addColumn( tr( "Type" ) ); |
48 | 48 | ||
49 | newsList->addColumn( tr( "Account" ) ); | 49 | newsList->addColumn( tr( "Account" ) ); |
50 | 50 | ||
51 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 51 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
52 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 52 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
53 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 53 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
54 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 54 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
55 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 55 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
@@ -71,88 +71,88 @@ void EditAccounts::slotFillLists() | |||
71 | { | 71 | { |
72 | (void) new AccountListItem( newsList, it ); | 72 | (void) new AccountListItem( newsList, it ); |
73 | } | 73 | } |
74 | else | 74 | else |
75 | { | 75 | { |
76 | (void) new AccountListItem( mailList, it ); | 76 | (void) new AccountListItem( mailList, it ); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | void EditAccounts::slotNewMail() | 81 | void EditAccounts::slotNewMail() |
82 | { | 82 | { |
83 | qDebug( "New Mail Account" ); | 83 | odebug << "New Mail Account" << oendl; |
84 | QString *selection = new QString(); | 84 | QString *selection = new QString(); |
85 | SelectMailType selType( selection, this, 0, true ); | 85 | SelectMailType selType( selection, this, 0, true ); |
86 | selType.show(); | 86 | selType.show(); |
87 | if ( QDialog::Accepted == selType.exec() ) | 87 | if ( QDialog::Accepted == selType.exec() ) |
88 | { | 88 | { |
89 | slotNewAccount( *selection ); | 89 | slotNewAccount( *selection ); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | void EditAccounts::slotNewAccount( const QString &type ) | 93 | void EditAccounts::slotNewAccount( const QString &type ) |
94 | { | 94 | { |
95 | if ( type.compare( "IMAP" ) == 0 ) | 95 | if ( type.compare( "IMAP" ) == 0 ) |
96 | { | 96 | { |
97 | qDebug( "-> config IMAP" ); | 97 | odebug << "-> config IMAP" << oendl; |
98 | IMAPaccount *account = new IMAPaccount(); | 98 | IMAPaccount *account = new IMAPaccount(); |
99 | IMAPconfig imap( account, this, 0, true ); | 99 | IMAPconfig imap( account, this, 0, true ); |
100 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) | 100 | if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) ) |
101 | { | 101 | { |
102 | settings->addAccount( account ); | 102 | settings->addAccount( account ); |
103 | account->save(); | 103 | account->save(); |
104 | slotFillLists(); | 104 | slotFillLists(); |
105 | } | 105 | } |
106 | else | 106 | else |
107 | { | 107 | { |
108 | account->remove(); | 108 | account->remove(); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | else if ( type.compare( "POP3" ) == 0 ) | 111 | else if ( type.compare( "POP3" ) == 0 ) |
112 | { | 112 | { |
113 | qDebug( "-> config POP3" ); | 113 | odebug << "-> config POP3" << oendl; |
114 | POP3account *account = new POP3account(); | 114 | POP3account *account = new POP3account(); |
115 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); | 115 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); |
116 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) | 116 | if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) ) |
117 | { | 117 | { |
118 | settings->addAccount( account ); | 118 | settings->addAccount( account ); |
119 | account->save(); | 119 | account->save(); |
120 | slotFillLists(); | 120 | slotFillLists(); |
121 | } | 121 | } |
122 | else | 122 | else |
123 | { | 123 | { |
124 | account->remove(); | 124 | account->remove(); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | else if ( type.compare( "SMTP" ) == 0 ) | 127 | else if ( type.compare( "SMTP" ) == 0 ) |
128 | { | 128 | { |
129 | qDebug( "-> config SMTP" ); | 129 | odebug << "-> config SMTP" << oendl; |
130 | SMTPaccount *account = new SMTPaccount(); | 130 | SMTPaccount *account = new SMTPaccount(); |
131 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); | 131 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); |
132 | if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) | 132 | if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) ) |
133 | { | 133 | { |
134 | settings->addAccount( account ); | 134 | settings->addAccount( account ); |
135 | account->save(); | 135 | account->save(); |
136 | slotFillLists(); | 136 | slotFillLists(); |
137 | 137 | ||
138 | } | 138 | } |
139 | else | 139 | else |
140 | { | 140 | { |
141 | account->remove(); | 141 | account->remove(); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | else if ( type.compare( "NNTP" ) == 0 ) | 144 | else if ( type.compare( "NNTP" ) == 0 ) |
145 | { | 145 | { |
146 | qDebug( "-> config NNTP" ); | 146 | odebug << "-> config NNTP" << oendl; |
147 | NNTPaccount *account = new NNTPaccount(); | 147 | NNTPaccount *account = new NNTPaccount(); |
148 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); | 148 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); |
149 | if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) | 149 | if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) ) |
150 | { | 150 | { |
151 | settings->addAccount( account ); | 151 | settings->addAccount( account ); |
152 | account->save(); | 152 | account->save(); |
153 | slotFillLists(); | 153 | slotFillLists(); |
154 | } | 154 | } |
155 | else | 155 | else |
156 | { | 156 | { |
157 | account->remove(); | 157 | account->remove(); |
158 | } | 158 | } |
@@ -203,25 +203,25 @@ void EditAccounts::slotDeleteAccount( Account *account ) | |||
203 | { | 203 | { |
204 | if ( QMessageBox::information( this, tr( "Question" ), | 204 | if ( QMessageBox::information( this, tr( "Question" ), |
205 | tr( "<p>Do you really want to delete the selected Account?</p>" ), | 205 | tr( "<p>Do you really want to delete the selected Account?</p>" ), |
206 | tr( "Yes" ), tr( "No" ) ) == 0 ) | 206 | tr( "Yes" ), tr( "No" ) ) == 0 ) |
207 | { | 207 | { |
208 | settings->delAccount( account ); | 208 | settings->delAccount( account ); |
209 | slotFillLists(); | 209 | slotFillLists(); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | void EditAccounts::slotEditMail() | 213 | void EditAccounts::slotEditMail() |
214 | { | 214 | { |
215 | qDebug( "Edit Mail Account" ); | 215 | odebug << "Edit Mail Account" << oendl; |
216 | if ( !mailList->currentItem() ) | 216 | if ( !mailList->currentItem() ) |
217 | { | 217 | { |
218 | QMessageBox::information( this, tr( "Error" ), | 218 | QMessageBox::information( this, tr( "Error" ), |
219 | tr( "<p>Please select an account.</p>" ), | 219 | tr( "<p>Please select an account.</p>" ), |
220 | tr( "Ok" ) ); | 220 | tr( "Ok" ) ); |
221 | return; | 221 | return; |
222 | } | 222 | } |
223 | 223 | ||
224 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 224 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
225 | slotEditAccount( a ); | 225 | slotEditAccount( a ); |
226 | } | 226 | } |
227 | 227 | ||
@@ -232,46 +232,46 @@ void EditAccounts::slotDeleteMail() | |||
232 | QMessageBox::information( this, tr( "Error" ), | 232 | QMessageBox::information( this, tr( "Error" ), |
233 | tr( "<p>Please select an account.</p>" ), | 233 | tr( "<p>Please select an account.</p>" ), |
234 | tr( "Ok" ) ); | 234 | tr( "Ok" ) ); |
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | 237 | ||
238 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 238 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
239 | slotDeleteAccount( a ); | 239 | slotDeleteAccount( a ); |
240 | } | 240 | } |
241 | 241 | ||
242 | void EditAccounts::slotNewNews() | 242 | void EditAccounts::slotNewNews() |
243 | { | 243 | { |
244 | qDebug( "New News Account" ); | 244 | odebug << "New News Account" << oendl; |
245 | slotNewAccount( "NNTP" ); | 245 | slotNewAccount( "NNTP" ); |
246 | } | 246 | } |
247 | 247 | ||
248 | void EditAccounts::slotEditNews() | 248 | void EditAccounts::slotEditNews() |
249 | { | 249 | { |
250 | qDebug( "Edit News Account" ); | 250 | odebug << "Edit News Account" << oendl; |
251 | if ( !newsList->currentItem() ) | 251 | if ( !newsList->currentItem() ) |
252 | { | 252 | { |
253 | QMessageBox::information( this, tr( "Error" ), | 253 | QMessageBox::information( this, tr( "Error" ), |
254 | tr( "<p>Please select an account.</p>" ), | 254 | tr( "<p>Please select an account.</p>" ), |
255 | tr( "Ok" ) ); | 255 | tr( "Ok" ) ); |
256 | return; | 256 | return; |
257 | } | 257 | } |
258 | 258 | ||
259 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 259 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
260 | slotEditAccount( a ); | 260 | slotEditAccount( a ); |
261 | } | 261 | } |
262 | 262 | ||
263 | void EditAccounts::slotDeleteNews() | 263 | void EditAccounts::slotDeleteNews() |
264 | { | 264 | { |
265 | qDebug( "Delete News Account" ); | 265 | odebug << "Delete News Account" << oendl; |
266 | if ( !newsList->currentItem() ) | 266 | if ( !newsList->currentItem() ) |
267 | { | 267 | { |
268 | QMessageBox::information( this, tr( "Error" ), | 268 | QMessageBox::information( this, tr( "Error" ), |
269 | tr( "<p>Please select an account.</p>" ), | 269 | tr( "<p>Please select an account.</p>" ), |
270 | tr( "Ok" ) ); | 270 | tr( "Ok" ) ); |
271 | return; | 271 | return; |
272 | } | 272 | } |
273 | 273 | ||
274 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); | 274 | Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); |
275 | slotDeleteAccount( a ); | 275 | slotDeleteAccount( a ); |
276 | } | 276 | } |
277 | 277 | ||
@@ -569,25 +569,25 @@ void NNTPconfig::save() | |||
569 | data->setPort( portLine->text() ); | 569 | data->setPort( portLine->text() ); |
570 | data->setSSL( sslBox->isChecked() ); | 570 | data->setSSL( sslBox->isChecked() ); |
571 | data->setLogin( loginBox->isChecked() ); | 571 | data->setLogin( loginBox->isChecked() ); |
572 | data->setUser( userLine->text() ); | 572 | data->setUser( userLine->text() ); |
573 | data->setPassword( passLine->text() ); | 573 | data->setPassword( passLine->text() ); |
574 | 574 | ||
575 | QListViewItemIterator list_it( ListViewGroups ); | 575 | QListViewItemIterator list_it( ListViewGroups ); |
576 | 576 | ||
577 | QStringList groupList; | 577 | QStringList groupList; |
578 | for ( ; list_it.current(); ++list_it ) { | 578 | for ( ; list_it.current(); ++list_it ) { |
579 | 579 | ||
580 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { | 580 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { |
581 | qDebug(list_it.current()->text(0) ); | 581 | odebug << list_it.current()->text(0) << oendl; |
582 | groupList.append( list_it.current()->text(0) ); | 582 | groupList.append( list_it.current()->text(0) ); |
583 | } | 583 | } |
584 | 584 | ||
585 | } | 585 | } |
586 | data->setGroups( groupList ); | 586 | data->setGroups( groupList ); |
587 | } | 587 | } |
588 | 588 | ||
589 | void NNTPconfig::accept() | 589 | void NNTPconfig::accept() |
590 | { | 590 | { |
591 | save(); | 591 | save(); |
592 | QDialog::accept(); | 592 | QDialog::accept(); |
593 | } | 593 | } |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 6bebb7b..1a26351 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -43,67 +43,67 @@ AbstractMail* AbstractMail::getWrapper(Account*a) | |||
43 | return new POP3wrapper((POP3account*)a); | 43 | return new POP3wrapper((POP3account*)a); |
44 | break; | 44 | break; |
45 | case MAILLIB::A_NNTP: | 45 | case MAILLIB::A_NNTP: |
46 | return new NNTPwrapper((NNTPaccount*)a); | 46 | return new NNTPwrapper((NNTPaccount*)a); |
47 | break; | 47 | break; |
48 | default: | 48 | default: |
49 | return 0; | 49 | return 0; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | 53 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) |
54 | { | 54 | { |
55 | qDebug("Decode string start"); | 55 | odebug << "Decode string start" << oendl; |
56 | char*result_text; | 56 | char*result_text; |
57 | size_t index = 0; | 57 | size_t index = 0; |
58 | /* reset for recursive use! */ | 58 | /* reset for recursive use! */ |
59 | size_t target_length = 0; | 59 | size_t target_length = 0; |
60 | result_text = 0; | 60 | result_text = 0; |
61 | int mimetype = MAILMIME_MECHANISM_7BIT; | 61 | int mimetype = MAILMIME_MECHANISM_7BIT; |
62 | if (enc.lower()=="quoted-printable") { | 62 | if (enc.lower()=="quoted-printable") { |
63 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | 63 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; |
64 | } else if (enc.lower()=="base64") { | 64 | } else if (enc.lower()=="base64") { |
65 | mimetype = MAILMIME_MECHANISM_BASE64; | 65 | mimetype = MAILMIME_MECHANISM_BASE64; |
66 | } else if (enc.lower()=="8bit") { | 66 | } else if (enc.lower()=="8bit") { |
67 | mimetype = MAILMIME_MECHANISM_8BIT; | 67 | mimetype = MAILMIME_MECHANISM_8BIT; |
68 | } else if (enc.lower()=="binary") { | 68 | } else if (enc.lower()=="binary") { |
69 | mimetype = MAILMIME_MECHANISM_BINARY; | 69 | mimetype = MAILMIME_MECHANISM_BINARY; |
70 | } | 70 | } |
71 | 71 | ||
72 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, | 72 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, |
73 | &result_text,&target_length); | 73 | &result_text,&target_length); |
74 | 74 | ||
75 | encodedString* result = new encodedString(); | 75 | encodedString* result = new encodedString(); |
76 | if (err == MAILIMF_NO_ERROR) { | 76 | if (err == MAILIMF_NO_ERROR) { |
77 | result->setContent(result_text,target_length); | 77 | result->setContent(result_text,target_length); |
78 | } | 78 | } |
79 | qDebug("Decode string finished"); | 79 | odebug << "Decode string finished" << oendl; |
80 | return result; | 80 | return result; |
81 | } | 81 | } |
82 | 82 | ||
83 | QString AbstractMail::convert_String(const char*text) | 83 | QString AbstractMail::convert_String(const char*text) |
84 | { | 84 | { |
85 | //size_t index = 0; | 85 | //size_t index = 0; |
86 | char*res = 0; | 86 | char*res = 0; |
87 | int err = MAILIMF_NO_ERROR; | 87 | int err = MAILIMF_NO_ERROR; |
88 | 88 | ||
89 | QString result(text); | 89 | QString result(text); |
90 | 90 | ||
91 | /* due a bug in libetpan it isn't usable this moment */ | 91 | /* due a bug in libetpan it isn't usable this moment */ |
92 | /* int err = mailmime_encoded_phrase_parse("iso-8859-1", | 92 | /* int err = mailmime_encoded_phrase_parse("iso-8859-1", |
93 | text, strlen(text),&index, "iso-8859-1",&res);*/ | 93 | text, strlen(text),&index, "iso-8859-1",&res);*/ |
94 | //qDebug("Input: %s",text); | 94 | //odebug << "Input: " << text << "" << oendl; |
95 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | 95 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { |
96 | // result = QString(res); | 96 | // result = QString(res); |
97 | // qDebug("Res: %s, length: %i",res,strlen(res)); | 97 | // odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl; |
98 | } | 98 | } |
99 | if (res) free(res); | 99 | if (res) free(res); |
100 | return result; | 100 | return result; |
101 | } | 101 | } |
102 | 102 | ||
103 | /* cp & paste from launcher */ | 103 | /* cp & paste from launcher */ |
104 | QString AbstractMail::gen_attachment_id() | 104 | QString AbstractMail::gen_attachment_id() |
105 | { | 105 | { |
106 | QFile file( "/proc/sys/kernel/random/uuid" ); | 106 | QFile file( "/proc/sys/kernel/random/uuid" ); |
107 | if (!file.open(IO_ReadOnly ) ) | 107 | if (!file.open(IO_ReadOnly ) ) |
108 | return QString::null; | 108 | return QString::null; |
109 | 109 | ||
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp index cb58d82..36ec232 100644 --- a/noncore/net/mail/libmailwrapper/generatemail.cpp +++ b/noncore/net/mail/libmailwrapper/generatemail.cpp | |||
@@ -88,47 +88,47 @@ mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) { | |||
88 | QString s; | 88 | QString s; |
89 | unsigned int i = 0; | 89 | unsigned int i = 0; |
90 | for (; i < addr.length();++i) { | 90 | for (; i < addr.length();++i) { |
91 | switch (addr[i]) { | 91 | switch (addr[i]) { |
92 | case '\"': | 92 | case '\"': |
93 | literal_open = !literal_open; | 93 | literal_open = !literal_open; |
94 | break; | 94 | break; |
95 | case ',': | 95 | case ',': |
96 | if (!literal_open) { | 96 | if (!literal_open) { |
97 | s = addr.mid(startpos,i-startpos); | 97 | s = addr.mid(startpos,i-startpos); |
98 | if (!s.isEmpty()) { | 98 | if (!s.isEmpty()) { |
99 | list.append(s); | 99 | list.append(s); |
100 | qDebug("Appended %s",s.latin1()); | 100 | odebug << "Appended " << s.latin1() << "" << oendl; |
101 | } | 101 | } |
102 | // !!!! this is a MUST BE! | 102 | // !!!! this is a MUST BE! |
103 | startpos = ++i; | 103 | startpos = ++i; |
104 | } | 104 | } |
105 | break; | 105 | break; |
106 | default: | 106 | default: |
107 | break; | 107 | break; |
108 | } | 108 | } |
109 | } | 109 | } |
110 | s = addr.mid(startpos,i-startpos); | 110 | s = addr.mid(startpos,i-startpos); |
111 | if (!s.isEmpty()) { | 111 | if (!s.isEmpty()) { |
112 | list.append(s); | 112 | list.append(s); |
113 | qDebug("Appended %s",s.latin1()); | 113 | odebug << "Appended " << s.latin1() << "" << oendl; |
114 | } | 114 | } |
115 | QStringList::Iterator it; | 115 | QStringList::Iterator it; |
116 | for ( it = list.begin(); it != list.end(); it++ ) { | 116 | for ( it = list.begin(); it != list.end(); it++ ) { |
117 | int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); | 117 | int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() ); |
118 | if ( err != MAILIMF_NO_ERROR ) { | 118 | if ( err != MAILIMF_NO_ERROR ) { |
119 | qDebug( "Error parsing" ); | 119 | odebug << "Error parsing" << oendl; |
120 | qDebug( *it ); | 120 | odebug << *it << oendl; |
121 | } else { | 121 | } else { |
122 | qDebug( "Parse success! %s",(*it).latin1()); | 122 | odebug << "Parse success! " << (*it).latin1() << "" << oendl; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | return addresses; | 125 | return addresses; |
126 | } | 126 | } |
127 | 127 | ||
128 | mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { | 128 | mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) { |
129 | mailmime * filePart = 0; | 129 | mailmime * filePart = 0; |
130 | mailmime_fields * fields = 0; | 130 | mailmime_fields * fields = 0; |
131 | mailmime_content * content = 0; | 131 | mailmime_content * content = 0; |
132 | mailmime_parameter * param = 0; | 132 | mailmime_parameter * param = 0; |
133 | char*name = 0; | 133 | char*name = 0; |
134 | char*file = 0; | 134 | char*file = 0; |
@@ -166,25 +166,25 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet | |||
166 | clist_append(content->ct_parameters,param); | 166 | clist_append(content->ct_parameters,param); |
167 | param = 0; | 167 | param = 0; |
168 | } | 168 | } |
169 | filePart = mailmime_new_empty( content, fields ); | 169 | filePart = mailmime_new_empty( content, fields ); |
170 | } | 170 | } |
171 | if (filePart) { | 171 | if (filePart) { |
172 | if (filename.length()>0) { | 172 | if (filename.length()>0) { |
173 | err = mailmime_set_body_file( filePart, file ); | 173 | err = mailmime_set_body_file( filePart, file ); |
174 | } else { | 174 | } else { |
175 | err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); | 175 | err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length()); |
176 | } | 176 | } |
177 | if (err != MAILIMF_NO_ERROR) { | 177 | if (err != MAILIMF_NO_ERROR) { |
178 | qDebug("Error setting body with file %s",file); | 178 | odebug << "Error setting body with file " << file << "" << oendl; |
179 | mailmime_free( filePart ); | 179 | mailmime_free( filePart ); |
180 | filePart = 0; | 180 | filePart = 0; |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | if (!filePart) { | 184 | if (!filePart) { |
185 | if ( param != NULL ) { | 185 | if ( param != NULL ) { |
186 | mailmime_parameter_free( param ); | 186 | mailmime_parameter_free( param ); |
187 | } | 187 | } |
188 | if (content) { | 188 | if (content) { |
189 | mailmime_content_free( content ); | 189 | mailmime_content_free( content ); |
190 | } | 190 | } |
@@ -197,41 +197,41 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet | |||
197 | if (file) { | 197 | if (file) { |
198 | free( file ); | 198 | free( file ); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | } | 201 | } |
202 | return filePart; // Success :) | 202 | return filePart; // Success :) |
203 | 203 | ||
204 | } | 204 | } |
205 | 205 | ||
206 | void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { | 206 | void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) { |
207 | const Attachment *it; | 207 | const Attachment *it; |
208 | unsigned int count = files.count(); | 208 | unsigned int count = files.count(); |
209 | qDebug("List contains %i values",count); | 209 | odebug << "List contains " << count << " values" << oendl; |
210 | for ( unsigned int i = 0; i < count; ++i ) { | 210 | for ( unsigned int i = 0; i < count; ++i ) { |
211 | qDebug( "Adding file" ); | 211 | odebug << "Adding file" << oendl; |
212 | mailmime *filePart; | 212 | mailmime *filePart; |
213 | int err; | 213 | int err; |
214 | it = ((QList<Attachment>)files).at(i); | 214 | it = ((QList<Attachment>)files).at(i); |
215 | 215 | ||
216 | filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); | 216 | filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" ); |
217 | if ( filePart == NULL ) { | 217 | if ( filePart == NULL ) { |
218 | qDebug( "addFileParts: error adding file:" ); | 218 | odebug << "addFileParts: error adding file:" << oendl; |
219 | qDebug( it->getFileName() ); | 219 | odebug << it->getFileName() << oendl; |
220 | continue; | 220 | continue; |
221 | } | 221 | } |
222 | err = mailmime_smart_add_part( message, filePart ); | 222 | err = mailmime_smart_add_part( message, filePart ); |
223 | if ( err != MAILIMF_NO_ERROR ) { | 223 | if ( err != MAILIMF_NO_ERROR ) { |
224 | mailmime_free( filePart ); | 224 | mailmime_free( filePart ); |
225 | qDebug("error smart add"); | 225 | odebug << "error smart add" << oendl; |
226 | } | 226 | } |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
230 | mailmime *Generatemail::buildTxtPart(const QString&str ) { | 230 | mailmime *Generatemail::buildTxtPart(const QString&str ) { |
231 | mailmime *txtPart; | 231 | mailmime *txtPart; |
232 | mailmime_fields *fields; | 232 | mailmime_fields *fields; |
233 | mailmime_content *content; | 233 | mailmime_content *content; |
234 | mailmime_parameter *param; | 234 | mailmime_parameter *param; |
235 | int err; | 235 | int err; |
236 | 236 | ||
237 | param = mailmime_parameter_new( strdup( "charset" ), | 237 | param = mailmime_parameter_new( strdup( "charset" ), |
@@ -261,25 +261,25 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { | |||
261 | 261 | ||
262 | return txtPart; // Success :) | 262 | return txtPart; // Success :) |
263 | 263 | ||
264 | err_free_txtPart: | 264 | err_free_txtPart: |
265 | mailmime_free( txtPart ); | 265 | mailmime_free( txtPart ); |
266 | err_free_fields: | 266 | err_free_fields: |
267 | mailmime_fields_free( fields ); | 267 | mailmime_fields_free( fields ); |
268 | err_free_content: | 268 | err_free_content: |
269 | mailmime_content_free( content ); | 269 | mailmime_content_free( content ); |
270 | err_free_param: | 270 | err_free_param: |
271 | mailmime_parameter_free( param ); | 271 | mailmime_parameter_free( param ); |
272 | err_free: | 272 | err_free: |
273 | qDebug( "buildTxtPart - error" ); | 273 | odebug << "buildTxtPart - error" << oendl; |
274 | 274 | ||
275 | return NULL; // Error :( | 275 | return NULL; // Error :( |
276 | } | 276 | } |
277 | 277 | ||
278 | mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { | 278 | mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { |
279 | return mailimf_mailbox_new( strdup( name.latin1() ), | 279 | return mailimf_mailbox_new( strdup( name.latin1() ), |
280 | strdup( mail.latin1() ) ); | 280 | strdup( mail.latin1() ) ); |
281 | } | 281 | } |
282 | 282 | ||
283 | mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) | 283 | mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail ) |
284 | { | 284 | { |
285 | mailimf_fields *fields = NULL; | 285 | mailimf_fields *fields = NULL; |
@@ -336,33 +336,33 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma | |||
336 | h.remove(0,1); | 336 | h.remove(0,1); |
337 | } | 337 | } |
338 | while (h.length()>0 && h[h.length()-1]=='>') { | 338 | while (h.length()>0 && h[h.length()-1]=='>') { |
339 | h.remove(h.length()-1,1); | 339 | h.remove(h.length()-1,1); |
340 | } | 340 | } |
341 | if (h.isEmpty()) continue; | 341 | if (h.isEmpty()) continue; |
342 | nsize = strlen(h.latin1()); | 342 | nsize = strlen(h.latin1()); |
343 | /* yes! must be malloc! */ | 343 | /* yes! must be malloc! */ |
344 | c_reply = (char*)malloc( (nsize+1)*sizeof(char)); | 344 | c_reply = (char*)malloc( (nsize+1)*sizeof(char)); |
345 | memset(c_reply,0,nsize+1); | 345 | memset(c_reply,0,nsize+1); |
346 | memcpy(c_reply,h.latin1(),nsize); | 346 | memcpy(c_reply,h.latin1(),nsize); |
347 | clist_append(in_reply_to,c_reply); | 347 | clist_append(in_reply_to,c_reply); |
348 | qDebug("In reply to: %s",c_reply); | 348 | odebug << "In reply to: " << c_reply << "" << oendl; |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | if (res) { | 352 | if (res) { |
353 | fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, | 353 | fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc, |
354 | in_reply_to, NULL, subject ); | 354 | in_reply_to, NULL, subject ); |
355 | if ( fields == NULL ) { | 355 | if ( fields == NULL ) { |
356 | qDebug("Error creating mailimf fields"); | 356 | odebug << "Error creating mailimf fields" << oendl; |
357 | res = 0; | 357 | res = 0; |
358 | } | 358 | } |
359 | } | 359 | } |
360 | if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), | 360 | if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ), |
361 | strdup( USER_AGENT ) ); | 361 | strdup( USER_AGENT ) ); |
362 | if ( xmailer == NULL ) { | 362 | if ( xmailer == NULL ) { |
363 | res = 0; | 363 | res = 0; |
364 | } else { | 364 | } else { |
365 | err = mailimf_fields_add( fields, xmailer ); | 365 | err = mailimf_fields_add( fields, xmailer ); |
366 | if ( err != MAILIMF_NO_ERROR ) { | 366 | if ( err != MAILIMF_NO_ERROR ) { |
367 | res = 0; | 367 | res = 0; |
368 | } | 368 | } |
@@ -426,25 +426,25 @@ mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &ma | |||
426 | 426 | ||
427 | addFileParts( message, mail->getAttachments() ); | 427 | addFileParts( message, mail->getAttachments() ); |
428 | 428 | ||
429 | return message; // Success :) | 429 | return message; // Success :) |
430 | 430 | ||
431 | err_free_txtPart: | 431 | err_free_txtPart: |
432 | mailmime_free( txtPart ); | 432 | mailmime_free( txtPart ); |
433 | err_free_message: | 433 | err_free_message: |
434 | mailmime_free( message ); | 434 | mailmime_free( message ); |
435 | err_free_fields: | 435 | err_free_fields: |
436 | mailimf_fields_free( fields ); | 436 | mailimf_fields_free( fields ); |
437 | err_free: | 437 | err_free: |
438 | qDebug( "createMimeMail: error" ); | 438 | odebug << "createMimeMail: error" << oendl; |
439 | 439 | ||
440 | return NULL; // Error :( | 440 | return NULL; // Error :( |
441 | } | 441 | } |
442 | 442 | ||
443 | clist *Generatemail::createRcptList( mailimf_fields *fields ) { | 443 | clist *Generatemail::createRcptList( mailimf_fields *fields ) { |
444 | clist *rcptList; | 444 | clist *rcptList; |
445 | mailimf_field *field; | 445 | mailimf_field *field; |
446 | 446 | ||
447 | rcptList = esmtp_address_list_new(); | 447 | rcptList = esmtp_address_list_new(); |
448 | 448 | ||
449 | field = getField( fields, MAILIMF_FIELD_TO ); | 449 | field = getField( fields, MAILIMF_FIELD_TO ); |
450 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) | 450 | if ( field && (field->fld_type == MAILIMF_FIELD_TO) |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 0c68280..fae4c99 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -126,25 +126,25 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) | |||
126 | default: | 126 | default: |
127 | if (aEnc->enc_token) { | 127 | if (aEnc->enc_token) { |
128 | enc = QString(aEnc->enc_token); | 128 | enc = QString(aEnc->enc_token); |
129 | } | 129 | } |
130 | break; | 130 | break; |
131 | } | 131 | } |
132 | return enc; | 132 | return enc; |
133 | } | 133 | } |
134 | 134 | ||
135 | void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) | 135 | void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) |
136 | { | 136 | { |
137 | if (current_rec >= 10) { | 137 | if (current_rec >= 10) { |
138 | qDebug("too deep recursion!"); | 138 | odebug << "too deep recursion!" << oendl; |
139 | } | 139 | } |
140 | if (!message || !mime) { | 140 | if (!message || !mime) { |
141 | return; | 141 | return; |
142 | } | 142 | } |
143 | int r; | 143 | int r; |
144 | char*data = 0; | 144 | char*data = 0; |
145 | size_t len; | 145 | size_t len; |
146 | clistiter * cur = 0; | 146 | clistiter * cur = 0; |
147 | QString b; | 147 | QString b; |
148 | RecPartP part = new RecPart(); | 148 | RecPartP part = new RecPart(); |
149 | 149 | ||
150 | switch (mime->mm_type) { | 150 | switch (mime->mm_type) { |
@@ -263,25 +263,25 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | |||
263 | } else { | 263 | } else { |
264 | first = false; | 264 | first = false; |
265 | } | 265 | } |
266 | 266 | ||
267 | switch ( addr->ad_type ) { | 267 | switch ( addr->ad_type ) { |
268 | case MAILIMF_ADDRESS_MAILBOX: | 268 | case MAILIMF_ADDRESS_MAILBOX: |
269 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); | 269 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); |
270 | break; | 270 | break; |
271 | case MAILIMF_ADDRESS_GROUP: | 271 | case MAILIMF_ADDRESS_GROUP: |
272 | result.append( parseGroup( addr->ad_data.ad_group ) ); | 272 | result.append( parseGroup( addr->ad_data.ad_group ) ); |
273 | break; | 273 | break; |
274 | default: | 274 | default: |
275 | qDebug( "Generic: unkown mailimf address type" ); | 275 | odebug << "Generic: unkown mailimf address type" << oendl; |
276 | break; | 276 | break; |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | return result; | 280 | return result; |
281 | } | 281 | } |
282 | 282 | ||
283 | QString Genericwrapper::parseGroup( mailimf_group *group ) | 283 | QString Genericwrapper::parseGroup( mailimf_group *group ) |
284 | { | 284 | { |
285 | QString result( "" ); | 285 | QString result( "" ); |
286 | 286 | ||
287 | result.append( group->grp_display_name ); | 287 | result.append( group->grp_display_name ); |
@@ -356,25 +356,25 @@ QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) | |||
356 | return text; | 356 | return text; |
357 | } | 357 | } |
358 | 358 | ||
359 | void Genericwrapper::cleanMimeCache() | 359 | void Genericwrapper::cleanMimeCache() |
360 | { | 360 | { |
361 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | 361 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); |
362 | for (;it!=bodyCache.end();++it) { | 362 | for (;it!=bodyCache.end();++it) { |
363 | encodedString*t = it.data(); | 363 | encodedString*t = it.data(); |
364 | //it.setValue(0); | 364 | //it.setValue(0); |
365 | if (t) delete t; | 365 | if (t) delete t; |
366 | } | 366 | } |
367 | bodyCache.clear(); | 367 | bodyCache.clear(); |
368 | qDebug("Genericwrapper: cache cleaned"); | 368 | odebug << "Genericwrapper: cache cleaned" << oendl; |
369 | } | 369 | } |
370 | 370 | ||
371 | QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | 371 | QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) |
372 | { | 372 | { |
373 | QStringList res; | 373 | QStringList res; |
374 | if (!in_replies || !in_replies->mid_list) return res; | 374 | if (!in_replies || !in_replies->mid_list) return res; |
375 | clistiter * current = 0; | 375 | clistiter * current = 0; |
376 | for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { | 376 | for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { |
377 | QString h((char*)current->data); | 377 | QString h((char*)current->data); |
378 | while (h.length()>0 && h[0]=='<') { | 378 | while (h.length()>0 && h[0]=='<') { |
379 | h.remove(0,1); | 379 | h.remove(0,1); |
380 | } | 380 | } |
@@ -385,44 +385,44 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | |||
385 | res.append(h); | 385 | res.append(h); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | return res; | 388 | return res; |
389 | } | 389 | } |
390 | 390 | ||
391 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) | 391 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) |
392 | { | 392 | { |
393 | int r; | 393 | int r; |
394 | mailmessage_list * env_list = 0; | 394 | mailmessage_list * env_list = 0; |
395 | r = mailsession_get_messages_list(session,&env_list); | 395 | r = mailsession_get_messages_list(session,&env_list); |
396 | if (r != MAIL_NO_ERROR) { | 396 | if (r != MAIL_NO_ERROR) { |
397 | qDebug("Error message list"); | 397 | odebug << "Error message list" << oendl; |
398 | return; | 398 | return; |
399 | } | 399 | } |
400 | r = mailsession_get_envelopes_list(session, env_list); | 400 | r = mailsession_get_envelopes_list(session, env_list); |
401 | if (r != MAIL_NO_ERROR) { | 401 | if (r != MAIL_NO_ERROR) { |
402 | qDebug("Error filling message list"); | 402 | odebug << "Error filling message list" << oendl; |
403 | if (env_list) { | 403 | if (env_list) { |
404 | mailmessage_list_free(env_list); | 404 | mailmessage_list_free(env_list); |
405 | } | 405 | } |
406 | return; | 406 | return; |
407 | } | 407 | } |
408 | mailimf_references * refs = 0; | 408 | mailimf_references * refs = 0; |
409 | mailimf_in_reply_to * in_replies = 0; | 409 | mailimf_in_reply_to * in_replies = 0; |
410 | uint32_t i = 0; | 410 | uint32_t i = 0; |
411 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 411 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
412 | mailmessage * msg; | 412 | mailmessage * msg; |
413 | QBitArray mFlags(7); | 413 | QBitArray mFlags(7); |
414 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 414 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
415 | if (msg->msg_fields == NULL) { | 415 | if (msg->msg_fields == NULL) { |
416 | //qDebug("could not fetch envelope of message %i", i); | 416 | //odebug << "could not fetch envelope of message " << i << "" << oendl; |
417 | continue; | 417 | continue; |
418 | } | 418 | } |
419 | RecMailP mail = new RecMail(); | 419 | RecMailP mail = new RecMail(); |
420 | mail->setWrapper(this); | 420 | mail->setWrapper(this); |
421 | mail_flags * flag_result = 0; | 421 | mail_flags * flag_result = 0; |
422 | r = mailmessage_get_flags(msg,&flag_result); | 422 | r = mailmessage_get_flags(msg,&flag_result); |
423 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 423 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
424 | mFlags.setBit(FLAG_SEEN); | 424 | mFlags.setBit(FLAG_SEEN); |
425 | } | 425 | } |
426 | mailimf_single_fields single_fields; | 426 | mailimf_single_fields single_fields; |
427 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 427 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
428 | mail->setMsgsize(msg->msg_size); | 428 | mail->setMsgsize(msg->msg_size); |
@@ -439,25 +439,25 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & | |||
439 | } else { | 439 | } else { |
440 | mail->setTo(mailbox); | 440 | mail->setTo(mailbox); |
441 | } | 441 | } |
442 | if (single_fields.fld_cc) | 442 | if (single_fields.fld_cc) |
443 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 443 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
444 | if (single_fields.fld_bcc) | 444 | if (single_fields.fld_bcc) |
445 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 445 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
446 | if (single_fields.fld_orig_date) | 446 | if (single_fields.fld_orig_date) |
447 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 447 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
448 | // crashes when accessing pop3 account? | 448 | // crashes when accessing pop3 account? |
449 | if (single_fields.fld_message_id->mid_value) { | 449 | if (single_fields.fld_message_id->mid_value) { |
450 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 450 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
451 | qDebug("Msgid == %s",mail->Msgid().latin1()); | 451 | odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl; |
452 | } | 452 | } |
453 | 453 | ||
454 | if (single_fields.fld_reply_to) { | 454 | if (single_fields.fld_reply_to) { |
455 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); | 455 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); |
456 | if (t.count()>0) { | 456 | if (t.count()>0) { |
457 | mail->setReplyto(t[0]); | 457 | mail->setReplyto(t[0]); |
458 | } | 458 | } |
459 | } | 459 | } |
460 | #if 0 | 460 | #if 0 |
461 | refs = single_fields.fld_references; | 461 | refs = single_fields.fld_references; |
462 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 462 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
463 | char * text = (char*)refs->mid_list->first->data; | 463 | char * text = (char*)refs->mid_list->first->data; |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 657c2ba..35468fe 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -21,69 +21,69 @@ IMAPwrapper::~IMAPwrapper() | |||
21 | logout(); | 21 | logout(); |
22 | } | 22 | } |
23 | 23 | ||
24 | /* to avoid to often select statements in loops etc. | 24 | /* to avoid to often select statements in loops etc. |
25 | we trust that we are logged in and connection is established!*/ | 25 | we trust that we are logged in and connection is established!*/ |
26 | int IMAPwrapper::selectMbox(const QString&mbox) | 26 | int IMAPwrapper::selectMbox(const QString&mbox) |
27 | { | 27 | { |
28 | if (mbox == m_Lastmbox) { | 28 | if (mbox == m_Lastmbox) { |
29 | return MAILIMAP_NO_ERROR; | 29 | return MAILIMAP_NO_ERROR; |
30 | } | 30 | } |
31 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); | 31 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); |
32 | if ( err != MAILIMAP_NO_ERROR ) { | 32 | if ( err != MAILIMAP_NO_ERROR ) { |
33 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 33 | odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl; |
34 | m_Lastmbox = ""; | 34 | m_Lastmbox = ""; |
35 | return err; | 35 | return err; |
36 | } | 36 | } |
37 | m_Lastmbox = mbox; | 37 | m_Lastmbox = mbox; |
38 | return err; | 38 | return err; |
39 | } | 39 | } |
40 | 40 | ||
41 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | 41 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) |
42 | { | 42 | { |
43 | qApp->processEvents(); | 43 | qApp->processEvents(); |
44 | qDebug( "IMAP: %i of %i", current, maximum ); | 44 | odebug << "IMAP: " << current << " of " << maximum << "" << oendl; |
45 | } | 45 | } |
46 | 46 | ||
47 | bool IMAPwrapper::start_tls(bool force_tls) | 47 | bool IMAPwrapper::start_tls(bool force_tls) |
48 | { | 48 | { |
49 | int err; | 49 | int err; |
50 | bool try_tls; | 50 | bool try_tls; |
51 | mailimap_capability_data * cap_data = 0; | 51 | mailimap_capability_data * cap_data = 0; |
52 | 52 | ||
53 | err = mailimap_capability(m_imap,&cap_data); | 53 | err = mailimap_capability(m_imap,&cap_data); |
54 | if (err != MAILIMAP_NO_ERROR) { | 54 | if (err != MAILIMAP_NO_ERROR) { |
55 | Global::statusMessage("error getting capabilities!"); | 55 | Global::statusMessage("error getting capabilities!"); |
56 | qDebug("error getting capabilities!"); | 56 | odebug << "error getting capabilities!" << oendl; |
57 | return false; | 57 | return false; |
58 | } | 58 | } |
59 | clistiter * cur; | 59 | clistiter * cur; |
60 | for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { | 60 | for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { |
61 | struct mailimap_capability * cap; | 61 | struct mailimap_capability * cap; |
62 | cap = (struct mailimap_capability *)clist_content(cur); | 62 | cap = (struct mailimap_capability *)clist_content(cur); |
63 | if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { | 63 | if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { |
64 | if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { | 64 | if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { |
65 | try_tls = true; | 65 | try_tls = true; |
66 | break; | 66 | break; |
67 | } | 67 | } |
68 | } | 68 | } |
69 | } | 69 | } |
70 | if (cap_data) { | 70 | if (cap_data) { |
71 | mailimap_capability_data_free(cap_data); | 71 | mailimap_capability_data_free(cap_data); |
72 | } | 72 | } |
73 | if (try_tls) { | 73 | if (try_tls) { |
74 | err = mailimap_starttls(m_imap); | 74 | err = mailimap_starttls(m_imap); |
75 | if (err != MAILIMAP_NO_ERROR && force_tls) { | 75 | if (err != MAILIMAP_NO_ERROR && force_tls) { |
76 | Global::statusMessage(tr("Server has no TLS support!")); | 76 | Global::statusMessage(tr("Server has no TLS support!")); |
77 | qDebug("Server has no TLS support!"); | 77 | odebug << "Server has no TLS support!" << oendl; |
78 | try_tls = false; | 78 | try_tls = false; |
79 | } else { | 79 | } else { |
80 | mailstream_low * low; | 80 | mailstream_low * low; |
81 | mailstream_low * new_low; | 81 | mailstream_low * new_low; |
82 | low = mailstream_get_low(m_imap->imap_stream); | 82 | low = mailstream_get_low(m_imap->imap_stream); |
83 | if (!low) { | 83 | if (!low) { |
84 | try_tls = false; | 84 | try_tls = false; |
85 | } else { | 85 | } else { |
86 | int fd = mailstream_low_get_fd(low); | 86 | int fd = mailstream_low_get_fd(low); |
87 | if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { | 87 | if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { |
88 | mailstream_low_free(low); | 88 | mailstream_low_free(low); |
89 | mailstream_set_low(m_imap->imap_stream, new_low); | 89 | mailstream_set_low(m_imap->imap_stream, new_low); |
@@ -116,48 +116,48 @@ void IMAPwrapper::login() | |||
116 | } | 116 | } |
117 | server = account->getServer().latin1(); | 117 | server = account->getServer().latin1(); |
118 | port = account->getPort().toUInt(); | 118 | port = account->getPort().toUInt(); |
119 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 119 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
120 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 120 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
121 | login.show(); | 121 | login.show(); |
122 | if ( QDialog::Accepted == login.exec() ) { | 122 | if ( QDialog::Accepted == login.exec() ) { |
123 | // ok | 123 | // ok |
124 | user = login.getUser().latin1(); | 124 | user = login.getUser().latin1(); |
125 | pass = login.getPassword().latin1(); | 125 | pass = login.getPassword().latin1(); |
126 | } else { | 126 | } else { |
127 | // cancel | 127 | // cancel |
128 | qDebug( "IMAP: Login canceled" ); | 128 | odebug << "IMAP: Login canceled" << oendl; |
129 | return; | 129 | return; |
130 | } | 130 | } |
131 | } else { | 131 | } else { |
132 | user = account->getUser().latin1(); | 132 | user = account->getUser().latin1(); |
133 | pass = account->getPassword().latin1(); | 133 | pass = account->getPassword().latin1(); |
134 | } | 134 | } |
135 | 135 | ||
136 | m_imap = mailimap_new( 20, &imap_progress ); | 136 | m_imap = mailimap_new( 20, &imap_progress ); |
137 | 137 | ||
138 | /* connect */ | 138 | /* connect */ |
139 | bool ssl = false; | 139 | bool ssl = false; |
140 | bool try_tls = false; | 140 | bool try_tls = false; |
141 | bool force_tls = false; | 141 | bool force_tls = false; |
142 | 142 | ||
143 | if ( account->ConnectionType() == 2 ) { | 143 | if ( account->ConnectionType() == 2 ) { |
144 | ssl = true; | 144 | ssl = true; |
145 | } | 145 | } |
146 | if (account->ConnectionType()==1) { | 146 | if (account->ConnectionType()==1) { |
147 | force_tls = true; | 147 | force_tls = true; |
148 | } | 148 | } |
149 | 149 | ||
150 | if ( ssl ) { | 150 | if ( ssl ) { |
151 | qDebug( "using ssl" ); | 151 | odebug << "using ssl" << oendl; |
152 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); | 152 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); |
153 | } else { | 153 | } else { |
154 | err = mailimap_socket_connect( m_imap, (char*)server, port ); | 154 | err = mailimap_socket_connect( m_imap, (char*)server, port ); |
155 | } | 155 | } |
156 | 156 | ||
157 | if ( err != MAILIMAP_NO_ERROR && | 157 | if ( err != MAILIMAP_NO_ERROR && |
158 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && | 158 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && |
159 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { | 159 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { |
160 | QString failure = ""; | 160 | QString failure = ""; |
161 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { | 161 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { |
162 | failure="Connection refused"; | 162 | failure="Connection refused"; |
163 | } else { | 163 | } else { |
@@ -167,25 +167,25 @@ void IMAPwrapper::login() | |||
167 | mailimap_free( m_imap ); | 167 | mailimap_free( m_imap ); |
168 | m_imap = 0; | 168 | m_imap = 0; |
169 | return; | 169 | return; |
170 | } | 170 | } |
171 | 171 | ||
172 | if (!ssl) { | 172 | if (!ssl) { |
173 | try_tls = start_tls(force_tls); | 173 | try_tls = start_tls(force_tls); |
174 | } | 174 | } |
175 | 175 | ||
176 | bool ok = true; | 176 | bool ok = true; |
177 | if (force_tls && !try_tls) { | 177 | if (force_tls && !try_tls) { |
178 | Global::statusMessage(tr("Server has no TLS support!")); | 178 | Global::statusMessage(tr("Server has no TLS support!")); |
179 | qDebug("Server has no TLS support!"); | 179 | odebug << "Server has no TLS support!" << oendl; |
180 | ok = false; | 180 | ok = false; |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | /* login */ | 184 | /* login */ |
185 | 185 | ||
186 | if (ok) { | 186 | if (ok) { |
187 | err = mailimap_login_simple( m_imap, (char*)user, (char*)pass ); | 187 | err = mailimap_login_simple( m_imap, (char*)user, (char*)pass ); |
188 | if ( err != MAILIMAP_NO_ERROR ) { | 188 | if ( err != MAILIMAP_NO_ERROR ) { |
189 | Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); | 189 | Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); |
190 | ok = false; | 190 | ok = false; |
191 | } | 191 | } |
@@ -308,35 +308,35 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
308 | if ( (bflags = list->mb_flag) ) { | 308 | if ( (bflags = list->mb_flag) ) { |
309 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 309 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
310 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 310 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
311 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { | 311 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { |
312 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { | 312 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { |
313 | no_inferiors = true; | 313 | no_inferiors = true; |
314 | } | 314 | } |
315 | } | 315 | } |
316 | } | 316 | } |
317 | folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); | 317 | folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); |
318 | } | 318 | } |
319 | } else { | 319 | } else { |
320 | qDebug("error fetching folders: %s",m_imap->imap_response); | 320 | odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl; |
321 | } | 321 | } |
322 | mailimap_list_result_free( result ); | 322 | mailimap_list_result_free( result ); |
323 | 323 | ||
324 | /* | 324 | /* |
325 | * second stage - get the other then inbox folders | 325 | * second stage - get the other then inbox folders |
326 | */ | 326 | */ |
327 | mask = "*" ; | 327 | mask = "*" ; |
328 | path = account->getPrefix().latin1(); | 328 | path = account->getPrefix().latin1(); |
329 | if (!path) path = ""; | 329 | if (!path) path = ""; |
330 | qDebug(path); | 330 | odebug << path << oendl; |
331 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); | 331 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); |
332 | if ( err == MAILIMAP_NO_ERROR ) { | 332 | if ( err == MAILIMAP_NO_ERROR ) { |
333 | current = result->first; | 333 | current = result->first; |
334 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { | 334 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { |
335 | no_inferiors = false; | 335 | no_inferiors = false; |
336 | list = (mailimap_mailbox_list *) current->data; | 336 | list = (mailimap_mailbox_list *) current->data; |
337 | // it is better use the deep copy mechanism of qt itself | 337 | // it is better use the deep copy mechanism of qt itself |
338 | // instead of using strdup! | 338 | // instead of using strdup! |
339 | temp = list->mb_name; | 339 | temp = list->mb_name; |
340 | if (temp.lower()=="inbox") | 340 | if (temp.lower()=="inbox") |
341 | continue; | 341 | continue; |
342 | if (temp.lower()==account->getPrefix().lower()) | 342 | if (temp.lower()==account->getPrefix().lower()) |
@@ -345,25 +345,25 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
345 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 345 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
346 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 346 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
347 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { | 347 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { |
348 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { | 348 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { |
349 | no_inferiors = true; | 349 | no_inferiors = true; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | } | 352 | } |
353 | del = list->mb_delimiter; | 353 | del = list->mb_delimiter; |
354 | folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); | 354 | folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); |
355 | } | 355 | } |
356 | } else { | 356 | } else { |
357 | qDebug("error fetching folders %s",m_imap->imap_response); | 357 | odebug << "error fetching folders " << m_imap->imap_response << "" << oendl; |
358 | } | 358 | } |
359 | if (result) mailimap_list_result_free( result ); | 359 | if (result) mailimap_list_result_free( result ); |
360 | return folders; | 360 | return folders; |
361 | } | 361 | } |
362 | 362 | ||
363 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 363 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
364 | { | 364 | { |
365 | RecMail * m = 0; | 365 | RecMail * m = 0; |
366 | mailimap_msg_att_item *item=0; | 366 | mailimap_msg_att_item *item=0; |
367 | clistcell *current,*c,*cf; | 367 | clistcell *current,*c,*cf; |
368 | mailimap_msg_att_dynamic*flist; | 368 | mailimap_msg_att_dynamic*flist; |
369 | mailimap_flag_fetch*cflag; | 369 | mailimap_flag_fetch*cflag; |
@@ -457,26 +457,26 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
457 | } | 457 | } |
458 | if (h.length()>0) { | 458 | if (h.length()>0) { |
459 | m->setInreply(QStringList(h)); | 459 | m->setInreply(QStringList(h)); |
460 | } | 460 | } |
461 | } | 461 | } |
462 | if (head->env_message_id) { | 462 | if (head->env_message_id) { |
463 | m->setMsgid(QString(head->env_message_id)); | 463 | m->setMsgid(QString(head->env_message_id)); |
464 | } | 464 | } |
465 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 465 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
466 | #if 0 | 466 | #if 0 |
467 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 467 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; |
468 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 468 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
469 | qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); | 469 | odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl; |
470 | qDebug(da.toString()); | 470 | odebug << da.toString() << oendl; |
471 | #endif | 471 | #endif |
472 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 472 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
473 | size = item->att_data.att_static->att_data.att_rfc822_size; | 473 | size = item->att_data.att_static->att_data.att_rfc822_size; |
474 | } | 474 | } |
475 | } | 475 | } |
476 | /* msg is already deleted */ | 476 | /* msg is already deleted */ |
477 | if (mFlags.testBit(FLAG_DELETED) && m) { | 477 | if (mFlags.testBit(FLAG_DELETED) && m) { |
478 | delete m; | 478 | delete m; |
479 | m = 0; | 479 | m = 0; |
480 | } | 480 | } |
481 | if (m) { | 481 | if (m) { |
482 | m->setFlags(mFlags); | 482 | m->setFlags(mFlags); |
@@ -515,25 +515,25 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) | |||
515 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 515 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
516 | mailimap_set_free( set ); | 516 | mailimap_set_free( set ); |
517 | mailimap_fetch_type_free( fetchType ); | 517 | mailimap_fetch_type_free( fetchType ); |
518 | 518 | ||
519 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 519 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
520 | mailimap_msg_att * msg_att; | 520 | mailimap_msg_att * msg_att; |
521 | msg_att = (mailimap_msg_att*)current->data; | 521 | msg_att = (mailimap_msg_att*)current->data; |
522 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 522 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
523 | QValueList<int> path; | 523 | QValueList<int> path; |
524 | body_desc = item->att_data.att_static->att_data.att_body; | 524 | body_desc = item->att_data.att_static->att_data.att_body; |
525 | traverseBody(mail,body_desc,body,0,path); | 525 | traverseBody(mail,body_desc,body,0,path); |
526 | } else { | 526 | } else { |
527 | qDebug("error fetching body: %s",m_imap->imap_response); | 527 | odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; |
528 | } | 528 | } |
529 | if (result) mailimap_fetch_list_free(result); | 529 | if (result) mailimap_fetch_list_free(result); |
530 | return body; | 530 | return body; |
531 | } | 531 | } |
532 | 532 | ||
533 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 533 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
534 | { | 534 | { |
535 | QStringList l; | 535 | QStringList l; |
536 | QString from; | 536 | QString from; |
537 | bool named_from; | 537 | bool named_from; |
538 | clistcell *current = NULL; | 538 | clistcell *current = NULL; |
539 | mailimap_address * current_address=NULL; | 539 | mailimap_address * current_address=NULL; |
@@ -627,25 +627,25 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int | |||
627 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | 627 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { |
628 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 628 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
629 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 629 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
630 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 630 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
631 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 631 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
632 | /* detach - we take over the content */ | 632 | /* detach - we take over the content */ |
633 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 633 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
634 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); | 634 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); |
635 | } | 635 | } |
636 | } | 636 | } |
637 | } | 637 | } |
638 | } else { | 638 | } else { |
639 | qDebug("error fetching text: %s",m_imap->imap_response); | 639 | odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; |
640 | } | 640 | } |
641 | if (result) mailimap_fetch_list_free(result); | 641 | if (result) mailimap_fetch_list_free(result); |
642 | return res; | 642 | return res; |
643 | } | 643 | } |
644 | 644 | ||
645 | /* current_recursion is for recursive calls. | 645 | /* current_recursion is for recursive calls. |
646 | current_count means the position inside the internal loop! */ | 646 | current_count means the position inside the internal loop! */ |
647 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, | 647 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, |
648 | int current_recursion,QValueList<int>recList,int current_count) | 648 | int current_recursion,QValueList<int>recList,int current_count) |
649 | { | 649 | { |
650 | if (!body || current_recursion>=10) { | 650 | if (!body || current_recursion>=10) { |
651 | return; | 651 | return; |
@@ -654,25 +654,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
654 | case MAILIMAP_BODY_1PART: | 654 | case MAILIMAP_BODY_1PART: |
655 | { | 655 | { |
656 | QValueList<int>countlist = recList; | 656 | QValueList<int>countlist = recList; |
657 | countlist.append(current_count); | 657 | countlist.append(current_count); |
658 | RecPartP currentPart = new RecPart(); | 658 | RecPartP currentPart = new RecPart(); |
659 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; | 659 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; |
660 | QString id(""); | 660 | QString id(""); |
661 | currentPart->setPositionlist(countlist); | 661 | currentPart->setPositionlist(countlist); |
662 | for (unsigned int j = 0; j < countlist.count();++j) { | 662 | for (unsigned int j = 0; j < countlist.count();++j) { |
663 | id+=(j>0?" ":""); | 663 | id+=(j>0?" ":""); |
664 | id+=QString("%1").arg(countlist[j]); | 664 | id+=QString("%1").arg(countlist[j]); |
665 | } | 665 | } |
666 | qDebug("ID = %s",id.latin1()); | 666 | odebug << "ID = " << id.latin1() << "" << oendl; |
667 | currentPart->setIdentifier(id); | 667 | currentPart->setIdentifier(id); |
668 | fillSinglePart(currentPart,part1); | 668 | fillSinglePart(currentPart,part1); |
669 | /* important: Check for is NULL 'cause a body can be empty! | 669 | /* important: Check for is NULL 'cause a body can be empty! |
670 | And we put it only into the mail if it is the FIRST part */ | 670 | And we put it only into the mail if it is the FIRST part */ |
671 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { | 671 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { |
672 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); | 672 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); |
673 | target_body->setDescription(currentPart); | 673 | target_body->setDescription(currentPart); |
674 | target_body->setBodytext(body_text); | 674 | target_body->setBodytext(body_text); |
675 | if (countlist.count()>1) { | 675 | if (countlist.count()>1) { |
676 | target_body->addPart(currentPart); | 676 | target_body->addPart(currentPart); |
677 | } | 677 | } |
678 | } else { | 678 | } else { |
@@ -695,25 +695,25 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t | |||
695 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 695 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
696 | RecPartP targetPart = new RecPart(); | 696 | RecPartP targetPart = new RecPart(); |
697 | targetPart->setType("multipart"); | 697 | targetPart->setType("multipart"); |
698 | fillMultiPart(targetPart,mailDescription); | 698 | fillMultiPart(targetPart,mailDescription); |
699 | countlist.append(current_count); | 699 | countlist.append(current_count); |
700 | targetPart->setPositionlist(countlist); | 700 | targetPart->setPositionlist(countlist); |
701 | target_body->addPart(targetPart); | 701 | target_body->addPart(targetPart); |
702 | QString id(""); | 702 | QString id(""); |
703 | for (unsigned int j = 0; j < countlist.count();++j) { | 703 | for (unsigned int j = 0; j < countlist.count();++j) { |
704 | id+=(j>0?" ":""); | 704 | id+=(j>0?" ":""); |
705 | id+=QString("%1").arg(countlist[j]); | 705 | id+=QString("%1").arg(countlist[j]); |
706 | } | 706 | } |
707 | qDebug("ID(mpart) = %s",id.latin1()); | 707 | odebug << "ID(mpart) = " << id.latin1() << "" << oendl; |
708 | } | 708 | } |
709 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); | 709 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); |
710 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 710 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
711 | countlist = recList; | 711 | countlist = recList; |
712 | } | 712 | } |
713 | ++ccount; | 713 | ++ccount; |
714 | } | 714 | } |
715 | } | 715 | } |
716 | break; | 716 | break; |
717 | default: | 717 | default: |
718 | break; | 718 | break; |
719 | } | 719 | } |
@@ -739,37 +739,37 @@ void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*D | |||
739 | default: | 739 | default: |
740 | break; | 740 | break; |
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) | 744 | void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) |
745 | { | 745 | { |
746 | if (!which) { | 746 | if (!which) { |
747 | return; | 747 | return; |
748 | } | 748 | } |
749 | QString sub; | 749 | QString sub; |
750 | sub = which->bd_media_text; | 750 | sub = which->bd_media_text; |
751 | qDebug("Type= text/%s",which->bd_media_text); | 751 | odebug << "Type= text/" << which->bd_media_text << "" << oendl; |
752 | target_part->setSubtype(sub.lower()); | 752 | target_part->setSubtype(sub.lower()); |
753 | target_part->setLines(which->bd_lines); | 753 | target_part->setLines(which->bd_lines); |
754 | fillBodyFields(target_part,which->bd_fields); | 754 | fillBodyFields(target_part,which->bd_fields); |
755 | } | 755 | } |
756 | 756 | ||
757 | void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) | 757 | void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) |
758 | { | 758 | { |
759 | if (!which) { | 759 | if (!which) { |
760 | return; | 760 | return; |
761 | } | 761 | } |
762 | target_part->setSubtype("rfc822"); | 762 | target_part->setSubtype("rfc822"); |
763 | qDebug("Message part"); | 763 | odebug << "Message part" << oendl; |
764 | /* we set this type to text/plain */ | 764 | /* we set this type to text/plain */ |
765 | target_part->setLines(which->bd_lines); | 765 | target_part->setLines(which->bd_lines); |
766 | fillBodyFields(target_part,which->bd_fields); | 766 | fillBodyFields(target_part,which->bd_fields); |
767 | } | 767 | } |
768 | 768 | ||
769 | void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) | 769 | void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) |
770 | { | 770 | { |
771 | if (!which) return; | 771 | if (!which) return; |
772 | QString sub = which->bd_media_subtype; | 772 | QString sub = which->bd_media_subtype; |
773 | target_part->setSubtype(sub.lower()); | 773 | target_part->setSubtype(sub.lower()); |
774 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { | 774 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { |
775 | clistcell*cur = 0; | 775 | clistcell*cur = 0; |
@@ -810,25 +810,25 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba | |||
810 | if (which->bd_media_basic->med_basic_type) { | 810 | if (which->bd_media_basic->med_basic_type) { |
811 | type = which->bd_media_basic->med_basic_type; | 811 | type = which->bd_media_basic->med_basic_type; |
812 | } else { | 812 | } else { |
813 | type = ""; | 813 | type = ""; |
814 | } | 814 | } |
815 | break; | 815 | break; |
816 | } | 816 | } |
817 | if (which->bd_media_basic->med_subtype) { | 817 | if (which->bd_media_basic->med_subtype) { |
818 | sub = which->bd_media_basic->med_subtype; | 818 | sub = which->bd_media_basic->med_subtype; |
819 | } else { | 819 | } else { |
820 | sub = ""; | 820 | sub = ""; |
821 | } | 821 | } |
822 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | 822 | odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; |
823 | target_part->setType(type.lower()); | 823 | target_part->setType(type.lower()); |
824 | target_part->setSubtype(sub.lower()); | 824 | target_part->setSubtype(sub.lower()); |
825 | fillBodyFields(target_part,which->bd_fields); | 825 | fillBodyFields(target_part,which->bd_fields); |
826 | } | 826 | } |
827 | 827 | ||
828 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) | 828 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) |
829 | { | 829 | { |
830 | if (!which) return; | 830 | if (!which) return; |
831 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { | 831 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
832 | clistcell*cur; | 832 | clistcell*cur; |
833 | mailimap_single_body_fld_param*param=0; | 833 | mailimap_single_body_fld_param*param=0; |
834 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 834 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
@@ -886,34 +886,34 @@ void IMAPwrapper::deleteMail(const RecMailP&mail) | |||
886 | if ( err != MAILIMAP_NO_ERROR ) { | 886 | if ( err != MAILIMAP_NO_ERROR ) { |
887 | return; | 887 | return; |
888 | } | 888 | } |
889 | flist = mailimap_flag_list_new_empty(); | 889 | flist = mailimap_flag_list_new_empty(); |
890 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 890 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
891 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 891 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
892 | set = mailimap_set_new_single(mail->getNumber()); | 892 | set = mailimap_set_new_single(mail->getNumber()); |
893 | err = mailimap_store(m_imap,set,store_flags); | 893 | err = mailimap_store(m_imap,set,store_flags); |
894 | mailimap_set_free( set ); | 894 | mailimap_set_free( set ); |
895 | mailimap_store_att_flags_free(store_flags); | 895 | mailimap_store_att_flags_free(store_flags); |
896 | 896 | ||
897 | if (err != MAILIMAP_NO_ERROR) { | 897 | if (err != MAILIMAP_NO_ERROR) { |
898 | qDebug("error deleting mail: %s",m_imap->imap_response); | 898 | odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
899 | return; | 899 | return; |
900 | } | 900 | } |
901 | qDebug("deleting mail: %s",m_imap->imap_response); | 901 | odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
902 | /* should we realy do that at this moment? */ | 902 | /* should we realy do that at this moment? */ |
903 | err = mailimap_expunge(m_imap); | 903 | err = mailimap_expunge(m_imap); |
904 | if (err != MAILIMAP_NO_ERROR) { | 904 | if (err != MAILIMAP_NO_ERROR) { |
905 | qDebug("error deleting mail: %s",m_imap->imap_response); | 905 | odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
906 | } | 906 | } |
907 | qDebug("Delete successfull %s",m_imap->imap_response); | 907 | odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; |
908 | } | 908 | } |
909 | 909 | ||
910 | void IMAPwrapper::answeredMail(const RecMailP&mail) | 910 | void IMAPwrapper::answeredMail(const RecMailP&mail) |
911 | { | 911 | { |
912 | mailimap_flag_list*flist; | 912 | mailimap_flag_list*flist; |
913 | mailimap_set *set; | 913 | mailimap_set *set; |
914 | mailimap_store_att_flags * store_flags; | 914 | mailimap_store_att_flags * store_flags; |
915 | int err; | 915 | int err; |
916 | login(); | 916 | login(); |
917 | if (!m_imap) { | 917 | if (!m_imap) { |
918 | return; | 918 | return; |
919 | } | 919 | } |
@@ -921,25 +921,25 @@ void IMAPwrapper::answeredMail(const RecMailP&mail) | |||
921 | if ( err != MAILIMAP_NO_ERROR ) { | 921 | if ( err != MAILIMAP_NO_ERROR ) { |
922 | return; | 922 | return; |
923 | } | 923 | } |
924 | flist = mailimap_flag_list_new_empty(); | 924 | flist = mailimap_flag_list_new_empty(); |
925 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); | 925 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); |
926 | store_flags = mailimap_store_att_flags_new_add_flags(flist); | 926 | store_flags = mailimap_store_att_flags_new_add_flags(flist); |
927 | set = mailimap_set_new_single(mail->getNumber()); | 927 | set = mailimap_set_new_single(mail->getNumber()); |
928 | err = mailimap_store(m_imap,set,store_flags); | 928 | err = mailimap_store(m_imap,set,store_flags); |
929 | mailimap_set_free( set ); | 929 | mailimap_set_free( set ); |
930 | mailimap_store_att_flags_free(store_flags); | 930 | mailimap_store_att_flags_free(store_flags); |
931 | 931 | ||
932 | if (err != MAILIMAP_NO_ERROR) { | 932 | if (err != MAILIMAP_NO_ERROR) { |
933 | qDebug("error marking mail: %s",m_imap->imap_response); | 933 | odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; |
934 | return; | 934 | return; |
935 | } | 935 | } |
936 | } | 936 | } |
937 | 937 | ||
938 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) | 938 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) |
939 | { | 939 | { |
940 | QString body(""); | 940 | QString body(""); |
941 | encodedString*res = fetchRawPart(mail,path,internal_call); | 941 | encodedString*res = fetchRawPart(mail,path,internal_call); |
942 | encodedString*r = decode_String(res,enc); | 942 | encodedString*r = decode_String(res,enc); |
943 | delete res; | 943 | delete res; |
944 | if (r) { | 944 | if (r) { |
945 | if (r->Length()>0) { | 945 | if (r->Length()>0) { |
@@ -989,57 +989,57 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder) | |||
989 | } | 989 | } |
990 | flist = mailimap_flag_list_new_empty(); | 990 | flist = mailimap_flag_list_new_empty(); |
991 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 991 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
992 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 992 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
993 | set = mailimap_set_new_interval( 1, last ); | 993 | set = mailimap_set_new_interval( 1, last ); |
994 | err = mailimap_store(m_imap,set,store_flags); | 994 | err = mailimap_store(m_imap,set,store_flags); |
995 | mailimap_set_free( set ); | 995 | mailimap_set_free( set ); |
996 | mailimap_store_att_flags_free(store_flags); | 996 | mailimap_store_att_flags_free(store_flags); |
997 | if (err != MAILIMAP_NO_ERROR) { | 997 | if (err != MAILIMAP_NO_ERROR) { |
998 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | 998 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); |
999 | return 0; | 999 | return 0; |
1000 | } | 1000 | } |
1001 | qDebug("deleting mail: %s",m_imap->imap_response); | 1001 | odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
1002 | /* should we realy do that at this moment? */ | 1002 | /* should we realy do that at this moment? */ |
1003 | err = mailimap_expunge(m_imap); | 1003 | err = mailimap_expunge(m_imap); |
1004 | if (err != MAILIMAP_NO_ERROR) { | 1004 | if (err != MAILIMAP_NO_ERROR) { |
1005 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | 1005 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); |
1006 | return 0; | 1006 | return 0; |
1007 | } | 1007 | } |
1008 | qDebug("Delete successfull %s",m_imap->imap_response); | 1008 | odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; |
1009 | return 1; | 1009 | return 1; |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) | 1012 | int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) |
1013 | { | 1013 | { |
1014 | if (folder.length()==0) return 0; | 1014 | if (folder.length()==0) return 0; |
1015 | login(); | 1015 | login(); |
1016 | if (!m_imap) {return 0;} | 1016 | if (!m_imap) {return 0;} |
1017 | QString pre = account->getPrefix(); | 1017 | QString pre = account->getPrefix(); |
1018 | if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { | 1018 | if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { |
1019 | pre+=delemiter; | 1019 | pre+=delemiter; |
1020 | } | 1020 | } |
1021 | if (parentfolder) { | 1021 | if (parentfolder) { |
1022 | pre += parentfolder->getDisplayName()+delemiter; | 1022 | pre += parentfolder->getDisplayName()+delemiter; |
1023 | } | 1023 | } |
1024 | pre+=folder; | 1024 | pre+=folder; |
1025 | if (getsubfolder) { | 1025 | if (getsubfolder) { |
1026 | if (delemiter.length()>0) { | 1026 | if (delemiter.length()>0) { |
1027 | pre+=delemiter; | 1027 | pre+=delemiter; |
1028 | } else { | 1028 | } else { |
1029 | Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); | 1029 | Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); |
1030 | return 0; | 1030 | return 0; |
1031 | } | 1031 | } |
1032 | } | 1032 | } |
1033 | qDebug("Creating %s",pre.latin1()); | 1033 | odebug << "Creating " << pre.latin1() << "" << oendl; |
1034 | int res = mailimap_create(m_imap,pre.latin1()); | 1034 | int res = mailimap_create(m_imap,pre.latin1()); |
1035 | if (res != MAILIMAP_NO_ERROR) { | 1035 | if (res != MAILIMAP_NO_ERROR) { |
1036 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); | 1036 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); |
1037 | return 0; | 1037 | return 0; |
1038 | } | 1038 | } |
1039 | return 1; | 1039 | return 1; |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | int IMAPwrapper::deleteMbox(const FolderP&folder) | 1042 | int IMAPwrapper::deleteMbox(const FolderP&folder) |
1043 | { | 1043 | { |
1044 | if (!folder) return 0; | 1044 | if (!folder) return 0; |
1045 | login(); | 1045 | login(); |
@@ -1080,108 +1080,108 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | |||
1080 | case MAILIMAP_STATUS_ATT_MESSAGES: | 1080 | case MAILIMAP_STATUS_ATT_MESSAGES: |
1081 | target_stat.message_count = status_info->st_value; | 1081 | target_stat.message_count = status_info->st_value; |
1082 | break; | 1082 | break; |
1083 | case MAILIMAP_STATUS_ATT_RECENT: | 1083 | case MAILIMAP_STATUS_ATT_RECENT: |
1084 | target_stat.message_recent = status_info->st_value; | 1084 | target_stat.message_recent = status_info->st_value; |
1085 | break; | 1085 | break; |
1086 | case MAILIMAP_STATUS_ATT_UNSEEN: | 1086 | case MAILIMAP_STATUS_ATT_UNSEEN: |
1087 | target_stat.message_unseen = status_info->st_value; | 1087 | target_stat.message_unseen = status_info->st_value; |
1088 | break; | 1088 | break; |
1089 | } | 1089 | } |
1090 | } | 1090 | } |
1091 | } else { | 1091 | } else { |
1092 | qDebug("Error retrieving status"); | 1092 | odebug << "Error retrieving status" << oendl; |
1093 | } | 1093 | } |
1094 | if (status) mailimap_mailbox_data_status_free(status); | 1094 | if (status) mailimap_mailbox_data_status_free(status); |
1095 | if (att_list) mailimap_status_att_list_free(att_list); | 1095 | if (att_list) mailimap_status_att_list_free(att_list); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 1098 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
1099 | { | 1099 | { |
1100 | login(); | 1100 | login(); |
1101 | if (!m_imap) return; | 1101 | if (!m_imap) return; |
1102 | if (!msg) return; | 1102 | if (!msg) return; |
1103 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); | 1103 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); |
1104 | if (r != MAILIMAP_NO_ERROR) { | 1104 | if (r != MAILIMAP_NO_ERROR) { |
1105 | Global::statusMessage("Error storing mail!"); | 1105 | Global::statusMessage("Error storing mail!"); |
1106 | } | 1106 | } |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | MAILLIB::ATYPE IMAPwrapper::getType()const | 1109 | MAILLIB::ATYPE IMAPwrapper::getType()const |
1110 | { | 1110 | { |
1111 | return account->getType(); | 1111 | return account->getType(); |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | const QString&IMAPwrapper::getName()const | 1114 | const QString&IMAPwrapper::getName()const |
1115 | { | 1115 | { |
1116 | qDebug("Get name: %s",account->getAccountName().latin1()); | 1116 | odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; |
1117 | return account->getAccountName(); | 1117 | return account->getAccountName(); |
1118 | } | 1118 | } |
1119 | 1119 | ||
1120 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) | 1120 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) |
1121 | { | 1121 | { |
1122 | // dummy | 1122 | // dummy |
1123 | QValueList<int> path; | 1123 | QValueList<int> path; |
1124 | return fetchRawPart(mail,path,false); | 1124 | return fetchRawPart(mail,path,false); |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | 1127 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, |
1128 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 1128 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
1129 | { | 1129 | { |
1130 | if (targetWrapper != this) { | 1130 | if (targetWrapper != this) { |
1131 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); | 1131 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); |
1132 | qDebug("Using generic"); | 1132 | odebug << "Using generic" << oendl; |
1133 | return; | 1133 | return; |
1134 | } | 1134 | } |
1135 | mailimap_set *set = 0; | 1135 | mailimap_set *set = 0; |
1136 | login(); | 1136 | login(); |
1137 | if (!m_imap) { | 1137 | if (!m_imap) { |
1138 | return; | 1138 | return; |
1139 | } | 1139 | } |
1140 | int err = selectMbox(fromFolder->getName()); | 1140 | int err = selectMbox(fromFolder->getName()); |
1141 | if ( err != MAILIMAP_NO_ERROR ) { | 1141 | if ( err != MAILIMAP_NO_ERROR ) { |
1142 | return; | 1142 | return; |
1143 | } | 1143 | } |
1144 | int last = m_imap->imap_selection_info->sel_exists; | 1144 | int last = m_imap->imap_selection_info->sel_exists; |
1145 | set = mailimap_set_new_interval( 1, last ); | 1145 | set = mailimap_set_new_interval( 1, last ); |
1146 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); | 1146 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); |
1147 | mailimap_set_free( set ); | 1147 | mailimap_set_free( set ); |
1148 | if ( err != MAILIMAP_NO_ERROR ) { | 1148 | if ( err != MAILIMAP_NO_ERROR ) { |
1149 | QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); | 1149 | QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response); |
1150 | Global::statusMessage(error_msg); | 1150 | Global::statusMessage(error_msg); |
1151 | qDebug(error_msg); | 1151 | odebug << error_msg << oendl; |
1152 | return; | 1152 | return; |
1153 | } | 1153 | } |
1154 | if (moveit) { | 1154 | if (moveit) { |
1155 | deleteAllMail(fromFolder); | 1155 | deleteAllMail(fromFolder); |
1156 | } | 1156 | } |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 1159 | void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
1160 | { | 1160 | { |
1161 | if (targetWrapper != this) { | 1161 | if (targetWrapper != this) { |
1162 | qDebug("Using generic"); | 1162 | odebug << "Using generic" << oendl; |
1163 | AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 1163 | AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
1164 | return; | 1164 | return; |
1165 | } | 1165 | } |
1166 | mailimap_set *set = 0; | 1166 | mailimap_set *set = 0; |
1167 | login(); | 1167 | login(); |
1168 | if (!m_imap) { | 1168 | if (!m_imap) { |
1169 | return; | 1169 | return; |
1170 | } | 1170 | } |
1171 | int err = selectMbox(mail->getMbox()); | 1171 | int err = selectMbox(mail->getMbox()); |
1172 | if ( err != MAILIMAP_NO_ERROR ) { | 1172 | if ( err != MAILIMAP_NO_ERROR ) { |
1173 | return; | 1173 | return; |
1174 | } | 1174 | } |
1175 | set = mailimap_set_new_single(mail->getNumber()); | 1175 | set = mailimap_set_new_single(mail->getNumber()); |
1176 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); | 1176 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); |
1177 | mailimap_set_free( set ); | 1177 | mailimap_set_free( set ); |
1178 | if ( err != MAILIMAP_NO_ERROR ) { | 1178 | if ( err != MAILIMAP_NO_ERROR ) { |
1179 | QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); | 1179 | QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); |
1180 | Global::statusMessage(error_msg); | 1180 | Global::statusMessage(error_msg); |
1181 | qDebug(error_msg); | 1181 | odebug << error_msg << oendl; |
1182 | return; | 1182 | return; |
1183 | } | 1183 | } |
1184 | if (moveit) { | 1184 | if (moveit) { |
1185 | deleteMail(mail); | 1185 | deleteMail(mail); |
1186 | } | 1186 | } |
1187 | } | 1187 | } |
diff --git a/noncore/net/mail/libmailwrapper/logindialog.cpp b/noncore/net/mail/libmailwrapper/logindialog.cpp index 01d177e..c9ae190 100644 --- a/noncore/net/mail/libmailwrapper/logindialog.cpp +++ b/noncore/net/mail/libmailwrapper/logindialog.cpp | |||
@@ -15,15 +15,15 @@ LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, | |||
15 | } else { | 15 | } else { |
16 | passLine->setFocus(); | 16 | passLine->setFocus(); |
17 | } | 17 | } |
18 | } | 18 | } |
19 | 19 | ||
20 | void LoginDialog::accept() | 20 | void LoginDialog::accept() |
21 | { | 21 | { |
22 | //_user.replace( 0, _user.length(), userLine->text() ); | 22 | //_user.replace( 0, _user.length(), userLine->text() ); |
23 | //_pass.replace( 0, _pass.length(), passLine->text() ); | 23 | //_pass.replace( 0, _pass.length(), passLine->text() ); |
24 | _user = userLine->text(); | 24 | _user = userLine->text(); |
25 | _pass = passLine->text(); | 25 | _pass = passLine->text(); |
26 | 26 | ||
27 | qDebug("User im accept: |%s|",_user.latin1()); | 27 | odebug << "User im accept: |" << _user.latin1() << "|" << oendl; |
28 | QDialog::accept(); | 28 | QDialog::accept(); |
29 | } | 29 | } |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index 90b8865..6d44db4 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -4,25 +4,25 @@ | |||
4 | using namespace Opie::Core; | 4 | using namespace Opie::Core; |
5 | RecMail::RecMail() | 5 | RecMail::RecMail() |
6 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 6 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
7 | { | 7 | { |
8 | init(); | 8 | init(); |
9 | } | 9 | } |
10 | 10 | ||
11 | RecMail::RecMail(const RecMail&old) | 11 | RecMail::RecMail(const RecMail&old) |
12 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 12 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) |
13 | { | 13 | { |
14 | init(); | 14 | init(); |
15 | copy_old(old); | 15 | copy_old(old); |
16 | qDebug("Copy constructor RecMail"); | 16 | odebug << "Copy constructor RecMail" << oendl; |
17 | } | 17 | } |
18 | 18 | ||
19 | RecMail::~RecMail() | 19 | RecMail::~RecMail() |
20 | { | 20 | { |
21 | wrapper = 0; | 21 | wrapper = 0; |
22 | } | 22 | } |
23 | 23 | ||
24 | void RecMail::copy_old(const RecMail&old) | 24 | void RecMail::copy_old(const RecMail&old) |
25 | { | 25 | { |
26 | subject = old.subject; | 26 | subject = old.subject; |
27 | date = old.date; | 27 | date = old.date; |
28 | mbox = old.mbox; | 28 | mbox = old.mbox; |
@@ -122,25 +122,25 @@ RecPart::RecPart(const RecPart&old) | |||
122 | : Opie::Core::ORefCount(), | 122 | : Opie::Core::ORefCount(), |
123 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | 123 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) |
124 | { | 124 | { |
125 | m_type = old.m_type; | 125 | m_type = old.m_type; |
126 | m_subtype = old.m_subtype; | 126 | m_subtype = old.m_subtype; |
127 | m_identifier = old.m_identifier; | 127 | m_identifier = old.m_identifier; |
128 | m_encoding = old.m_encoding; | 128 | m_encoding = old.m_encoding; |
129 | m_description = old.m_description; | 129 | m_description = old.m_description; |
130 | m_lines = old.m_lines; | 130 | m_lines = old.m_lines; |
131 | m_size = old.m_size; | 131 | m_size = old.m_size; |
132 | m_Parameters = old.m_Parameters; | 132 | m_Parameters = old.m_Parameters; |
133 | m_poslist = old.m_poslist; | 133 | m_poslist = old.m_poslist; |
134 | qDebug("RecPart copy constructor"); | 134 | odebug << "RecPart copy constructor" << oendl; |
135 | } | 135 | } |
136 | 136 | ||
137 | RecPart::~RecPart() | 137 | RecPart::~RecPart() |
138 | { | 138 | { |
139 | } | 139 | } |
140 | 140 | ||
141 | void RecPart::setSize(unsigned int size) | 141 | void RecPart::setSize(unsigned int size) |
142 | { | 142 | { |
143 | m_size = size; | 143 | m_size = size; |
144 | } | 144 | } |
145 | 145 | ||
146 | const unsigned int RecPart::Size()const | 146 | const unsigned int RecPart::Size()const |
@@ -246,25 +246,25 @@ const QValueList<int>& RecPart::Positionlist()const | |||
246 | RecBody::RecBody() | 246 | RecBody::RecBody() |
247 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) | 247 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) |
248 | { | 248 | { |
249 | m_PartsList.clear(); | 249 | m_PartsList.clear(); |
250 | } | 250 | } |
251 | 251 | ||
252 | RecBody::RecBody(const RecBody&old) | 252 | RecBody::RecBody(const RecBody&old) |
253 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | 253 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) |
254 | { | 254 | { |
255 | m_BodyText = old.m_BodyText; | 255 | m_BodyText = old.m_BodyText; |
256 | m_PartsList = old.m_PartsList; | 256 | m_PartsList = old.m_PartsList; |
257 | m_description = old.m_description; | 257 | m_description = old.m_description; |
258 | qDebug("Recbody copy constructor"); | 258 | odebug << "Recbody copy constructor" << oendl; |
259 | } | 259 | } |
260 | 260 | ||
261 | RecBody::~RecBody() | 261 | RecBody::~RecBody() |
262 | { | 262 | { |
263 | } | 263 | } |
264 | 264 | ||
265 | void RecBody::setBodytext(const QString&bodyText) | 265 | void RecBody::setBodytext(const QString&bodyText) |
266 | { | 266 | { |
267 | m_BodyText = bodyText; | 267 | m_BodyText = bodyText; |
268 | } | 268 | } |
269 | 269 | ||
270 | const QString& RecBody::Bodytext()const | 270 | const QString& RecBody::Bodytext()const |
@@ -311,32 +311,32 @@ encodedString::encodedString(const char*nContent,unsigned int nSize) | |||
311 | } | 311 | } |
312 | 312 | ||
313 | encodedString::encodedString(char*nContent,unsigned int nSize) | 313 | encodedString::encodedString(char*nContent,unsigned int nSize) |
314 | { | 314 | { |
315 | init(); | 315 | init(); |
316 | setContent(nContent,nSize); | 316 | setContent(nContent,nSize); |
317 | } | 317 | } |
318 | 318 | ||
319 | encodedString::encodedString(const encodedString&old) | 319 | encodedString::encodedString(const encodedString&old) |
320 | { | 320 | { |
321 | init(); | 321 | init(); |
322 | copy_old(old); | 322 | copy_old(old); |
323 | qDebug("encodedeString: copy constructor!"); | 323 | odebug << "encodedeString: copy constructor!" << oendl; |
324 | } | 324 | } |
325 | 325 | ||
326 | encodedString& encodedString::operator=(const encodedString&old) | 326 | encodedString& encodedString::operator=(const encodedString&old) |
327 | { | 327 | { |
328 | init(); | 328 | init(); |
329 | copy_old(old); | 329 | copy_old(old); |
330 | qDebug("encodedString: assign operator!"); | 330 | odebug << "encodedString: assign operator!" << oendl; |
331 | return *this; | 331 | return *this; |
332 | } | 332 | } |
333 | 333 | ||
334 | encodedString::~encodedString() | 334 | encodedString::~encodedString() |
335 | { | 335 | { |
336 | clean(); | 336 | clean(); |
337 | } | 337 | } |
338 | 338 | ||
339 | void encodedString::init() | 339 | void encodedString::init() |
340 | { | 340 | { |
341 | content = 0; | 341 | content = 0; |
342 | size = 0; | 342 | size = 0; |
diff --git a/noncore/net/mail/libmailwrapper/mailwrapper.cpp b/noncore/net/mail/libmailwrapper/mailwrapper.cpp index eddc0b9..2b0d112 100644 --- a/noncore/net/mail/libmailwrapper/mailwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mailwrapper.cpp | |||
@@ -42,25 +42,25 @@ Folder::~Folder() | |||
42 | 42 | ||
43 | const QString& Folder::Separator()const | 43 | const QString& Folder::Separator()const |
44 | { | 44 | { |
45 | return separator; | 45 | return separator; |
46 | } | 46 | } |
47 | 47 | ||
48 | IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) | 48 | IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) |
49 | : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) | 49 | : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) |
50 | { | 50 | { |
51 | // Decode IMAP foldername | 51 | // Decode IMAP foldername |
52 | nameDisplay = IMAPFolder::decodeFolderName( name ); | 52 | nameDisplay = IMAPFolder::decodeFolderName( name ); |
53 | /* | 53 | /* |
54 | qDebug( "folder " + name + " - displayed as " + nameDisplay ); | 54 | odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; |
55 | */ | 55 | */ |
56 | prefix = aprefix; | 56 | prefix = aprefix; |
57 | 57 | ||
58 | if (prefix.length()>0) { | 58 | if (prefix.length()>0) { |
59 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | 59 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { |
60 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | 60 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | IMAPFolder::~IMAPFolder() | 65 | IMAPFolder::~IMAPFolder() |
66 | { | 66 | { |
diff --git a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp index e3c75f3..df2112f 100644 --- a/noncore/net/mail/libmailwrapper/mboxwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mboxwrapper.cpp | |||
@@ -22,25 +22,25 @@ MBOXwrapper::~MBOXwrapper() | |||
22 | 22 | ||
23 | void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target ) | 23 | void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target ) |
24 | { | 24 | { |
25 | mailstorage*storage = mailstorage_new(NULL); | 25 | mailstorage*storage = mailstorage_new(NULL); |
26 | QString p = MBOXPath+"/"; | 26 | QString p = MBOXPath+"/"; |
27 | p+=mailbox; | 27 | p+=mailbox; |
28 | 28 | ||
29 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 29 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
30 | mailfolder*folder; | 30 | mailfolder*folder; |
31 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 31 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
32 | r = mailfolder_connect(folder); | 32 | r = mailfolder_connect(folder); |
33 | if (r != MAIL_NO_ERROR) { | 33 | if (r != MAIL_NO_ERROR) { |
34 | qDebug("Error initializing mbox"); | 34 | odebug << "Error initializing mbox" << oendl; |
35 | mailfolder_free(folder); | 35 | mailfolder_free(folder); |
36 | mailstorage_free(storage); | 36 | mailstorage_free(storage); |
37 | return; | 37 | return; |
38 | } | 38 | } |
39 | 39 | ||
40 | parseList(target,folder->fld_session,mailbox); | 40 | parseList(target,folder->fld_session,mailbox); |
41 | 41 | ||
42 | mailfolder_disconnect(folder); | 42 | mailfolder_disconnect(folder); |
43 | mailfolder_free(folder); | 43 | mailfolder_free(folder); |
44 | mailstorage_free(storage); | 44 | mailstorage_free(storage); |
45 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 45 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
46 | } | 46 | } |
@@ -61,87 +61,87 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders() | |||
61 | } | 61 | } |
62 | 62 | ||
63 | void MBOXwrapper::deleteMail(const RecMailP & mail) | 63 | void MBOXwrapper::deleteMail(const RecMailP & mail) |
64 | { | 64 | { |
65 | mailstorage*storage = mailstorage_new(NULL); | 65 | mailstorage*storage = mailstorage_new(NULL); |
66 | QString p = MBOXPath+"/"; | 66 | QString p = MBOXPath+"/"; |
67 | p+=mail->getMbox(); | 67 | p+=mail->getMbox(); |
68 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 68 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
69 | mailfolder*folder; | 69 | mailfolder*folder; |
70 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 70 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
71 | r = mailfolder_connect(folder); | 71 | r = mailfolder_connect(folder); |
72 | if (r != MAIL_NO_ERROR) { | 72 | if (r != MAIL_NO_ERROR) { |
73 | qDebug("Error initializing mbox"); | 73 | odebug << "Error initializing mbox" << oendl; |
74 | mailfolder_free(folder); | 74 | mailfolder_free(folder); |
75 | mailstorage_free(storage); | 75 | mailstorage_free(storage); |
76 | return; | 76 | return; |
77 | } | 77 | } |
78 | r = mailsession_remove_message(folder->fld_session,mail->getNumber()); | 78 | r = mailsession_remove_message(folder->fld_session,mail->getNumber()); |
79 | if (r != MAIL_NO_ERROR) { | 79 | if (r != MAIL_NO_ERROR) { |
80 | qDebug("error deleting mail"); | 80 | odebug << "error deleting mail" << oendl; |
81 | } | 81 | } |
82 | mailfolder_free(folder); | 82 | mailfolder_free(folder); |
83 | mailstorage_free(storage); | 83 | mailstorage_free(storage); |
84 | } | 84 | } |
85 | 85 | ||
86 | void MBOXwrapper::answeredMail(const RecMailP&) | 86 | void MBOXwrapper::answeredMail(const RecMailP&) |
87 | { | 87 | { |
88 | } | 88 | } |
89 | 89 | ||
90 | RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) | 90 | RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) |
91 | { | 91 | { |
92 | RecBodyP body = new RecBody(); | 92 | RecBodyP body = new RecBody(); |
93 | mailstorage*storage = mailstorage_new(NULL); | 93 | mailstorage*storage = mailstorage_new(NULL); |
94 | QString p = MBOXPath+"/"; | 94 | QString p = MBOXPath+"/"; |
95 | p+=mail->getMbox(); | 95 | p+=mail->getMbox(); |
96 | mailmessage * msg; | 96 | mailmessage * msg; |
97 | char*data=0; | 97 | char*data=0; |
98 | size_t size; | 98 | size_t size; |
99 | 99 | ||
100 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); | 100 | int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0); |
101 | mailfolder*folder; | 101 | mailfolder*folder; |
102 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 102 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
103 | r = mailfolder_connect(folder); | 103 | r = mailfolder_connect(folder); |
104 | if (r != MAIL_NO_ERROR) { | 104 | if (r != MAIL_NO_ERROR) { |
105 | qDebug("Error initializing mbox"); | 105 | odebug << "Error initializing mbox" << oendl; |
106 | mailfolder_free(folder); | 106 | mailfolder_free(folder); |
107 | mailstorage_free(storage); | 107 | mailstorage_free(storage); |
108 | return body; | 108 | return body; |
109 | } | 109 | } |
110 | r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); | 110 | r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg); |
111 | if (r != MAIL_NO_ERROR) { | 111 | if (r != MAIL_NO_ERROR) { |
112 | qDebug("Error fetching mail %i",mail->getNumber()); | 112 | odebug << "Error fetching mail " << mail->getNumber() << "" << oendl; |
113 | mailfolder_free(folder); | 113 | mailfolder_free(folder); |
114 | mailstorage_free(storage); | 114 | mailstorage_free(storage); |
115 | return body; | 115 | return body; |
116 | } | 116 | } |
117 | r = mailmessage_fetch(msg,&data,&size); | 117 | r = mailmessage_fetch(msg,&data,&size); |
118 | if (r != MAIL_NO_ERROR) { | 118 | if (r != MAIL_NO_ERROR) { |
119 | qDebug("Error fetching mail %i",mail->getNumber()); | 119 | odebug << "Error fetching mail " << mail->getNumber() << "" << oendl; |
120 | mailfolder_free(folder); | 120 | mailfolder_free(folder); |
121 | mailstorage_free(storage); | 121 | mailstorage_free(storage); |
122 | mailmessage_free(msg); | 122 | mailmessage_free(msg); |
123 | return body; | 123 | return body; |
124 | } | 124 | } |
125 | body = parseMail(msg); | 125 | body = parseMail(msg); |
126 | mailmessage_fetch_result_free(msg,data); | 126 | mailmessage_fetch_result_free(msg,data); |
127 | mailfolder_free(folder); | 127 | mailfolder_free(folder); |
128 | mailstorage_free(storage); | 128 | mailstorage_free(storage); |
129 | 129 | ||
130 | return body; | 130 | return body; |
131 | } | 131 | } |
132 | 132 | ||
133 | void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) | 133 | void MBOXwrapper::mbox_progress( size_t current, size_t maximum ) |
134 | { | 134 | { |
135 | qDebug("MBOX %i von %i",current,maximum); | 135 | odebug << "MBOX " << current << " von " << maximum << "" << oendl; |
136 | } | 136 | } |
137 | 137 | ||
138 | int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) | 138 | int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool ) |
139 | { | 139 | { |
140 | QString p = MBOXPath+"/"; | 140 | QString p = MBOXPath+"/"; |
141 | p+=folder; | 141 | p+=folder; |
142 | QFileInfo fi(p); | 142 | QFileInfo fi(p); |
143 | if (fi.exists()) { | 143 | if (fi.exists()) { |
144 | Global::statusMessage(tr("Mailbox exists.")); | 144 | Global::statusMessage(tr("Mailbox exists.")); |
145 | return 0; | 145 | return 0; |
146 | } | 146 | } |
147 | mailmbox_folder*f = 0; | 147 | mailmbox_folder*f = 0; |
@@ -211,45 +211,45 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail) | |||
211 | mailstorage_free(storage); | 211 | mailstorage_free(storage); |
212 | mailmessage_free(msg); | 212 | mailmessage_free(msg); |
213 | return result; | 213 | return result; |
214 | } | 214 | } |
215 | 215 | ||
216 | void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) | 216 | void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) |
217 | { | 217 | { |
218 | QString p = MBOXPath+"/"; | 218 | QString p = MBOXPath+"/"; |
219 | p+=mailbox; | 219 | p+=mailbox; |
220 | mailmbox_folder*f = 0; | 220 | mailmbox_folder*f = 0; |
221 | int r = mailmbox_init(p.latin1(),0,1,0,&f); | 221 | int r = mailmbox_init(p.latin1(),0,1,0,&f); |
222 | if (r != MAIL_NO_ERROR) { | 222 | if (r != MAIL_NO_ERROR) { |
223 | qDebug("Error init folder"); | 223 | odebug << "Error init folder" << oendl; |
224 | return; | 224 | return; |
225 | } | 225 | } |
226 | deleteMails(f,target); | 226 | deleteMails(f,target); |
227 | mailmbox_done(f); | 227 | mailmbox_done(f); |
228 | } | 228 | } |
229 | 229 | ||
230 | void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target) | 230 | void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target) |
231 | { | 231 | { |
232 | if (!f) return; | 232 | if (!f) return; |
233 | int r; | 233 | int r; |
234 | QValueList<RecMailP>::ConstIterator it; | 234 | QValueList<RecMailP>::ConstIterator it; |
235 | for (it=target.begin(); it != target.end();++it) { | 235 | for (it=target.begin(); it != target.end();++it) { |
236 | r = mailmbox_delete_msg(f,(*it)->getNumber()); | 236 | r = mailmbox_delete_msg(f,(*it)->getNumber()); |
237 | if (r!=MAILMBOX_NO_ERROR) { | 237 | if (r!=MAILMBOX_NO_ERROR) { |
238 | qDebug("error delete mail"); | 238 | odebug << "error delete mail" << oendl; |
239 | } | 239 | } |
240 | } | 240 | } |
241 | r = mailmbox_expunge(f); | 241 | r = mailmbox_expunge(f); |
242 | if (r != MAILMBOX_NO_ERROR) { | 242 | if (r != MAILMBOX_NO_ERROR) { |
243 | qDebug("error expunge mailbox"); | 243 | odebug << "error expunge mailbox" << oendl; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | int MBOXwrapper::deleteAllMail(const FolderP&tfolder) | 247 | int MBOXwrapper::deleteAllMail(const FolderP&tfolder) |
248 | { | 248 | { |
249 | if (!tfolder) return 0; | 249 | if (!tfolder) return 0; |
250 | QString p = MBOXPath+"/"+tfolder->getDisplayName(); | 250 | QString p = MBOXPath+"/"+tfolder->getDisplayName(); |
251 | int res = 1; | 251 | int res = 1; |
252 | 252 | ||
253 | mailfolder*folder = 0; | 253 | mailfolder*folder = 0; |
254 | mailmessage_list*l=0; | 254 | mailmessage_list*l=0; |
255 | mailstorage*storage = mailstorage_new(NULL); | 255 | mailstorage*storage = mailstorage_new(NULL); |
@@ -260,25 +260,25 @@ int MBOXwrapper::deleteAllMail(const FolderP&tfolder) | |||
260 | } | 260 | } |
261 | if (res) { | 261 | if (res) { |
262 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); | 262 | folder = mailfolder_new( storage,(char*)p.latin1(),NULL); |
263 | r = mailfolder_connect(folder); | 263 | r = mailfolder_connect(folder); |
264 | if (r != MAIL_NO_ERROR) { | 264 | if (r != MAIL_NO_ERROR) { |
265 | Global::statusMessage(tr("Error initializing mbox")); | 265 | Global::statusMessage(tr("Error initializing mbox")); |
266 | res = 0; | 266 | res = 0; |
267 | } | 267 | } |
268 | } | 268 | } |
269 | if (res) { | 269 | if (res) { |
270 | r = mailsession_get_messages_list(folder->fld_session,&l); | 270 | r = mailsession_get_messages_list(folder->fld_session,&l); |
271 | if (r != MAIL_NO_ERROR) { | 271 | if (r != MAIL_NO_ERROR) { |
272 | qDebug("Error message list"); | 272 | odebug << "Error message list" << oendl; |
273 | res=0; | 273 | res=0; |
274 | } | 274 | } |
275 | } | 275 | } |
276 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { | 276 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { |
277 | r = mailsession_remove_message(folder->fld_session,i+1); | 277 | r = mailsession_remove_message(folder->fld_session,i+1); |
278 | if (r != MAIL_NO_ERROR) { | 278 | if (r != MAIL_NO_ERROR) { |
279 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 279 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
280 | res = 0; | 280 | res = 0; |
281 | break; | 281 | break; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | if (l) mailmessage_list_free(l); | 284 | if (l) mailmessage_list_free(l); |
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp index 12472e9..cd7cecb 100644 --- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp | |||
@@ -7,50 +7,50 @@ | |||
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <qpe/global.h> | 8 | #include <qpe/global.h> |
9 | #include <opie2/oprocess.h> | 9 | #include <opie2/oprocess.h> |
10 | 10 | ||
11 | using namespace Opie::Core; | 11 | using namespace Opie::Core; |
12 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) | 12 | MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) |
13 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) | 13 | : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) |
14 | { | 14 | { |
15 | if (MHPath.length()>0) { | 15 | if (MHPath.length()>0) { |
16 | if (MHPath[MHPath.length()-1]=='/') { | 16 | if (MHPath[MHPath.length()-1]=='/') { |
17 | MHPath=MHPath.left(MHPath.length()-1); | 17 | MHPath=MHPath.left(MHPath.length()-1); |
18 | } | 18 | } |
19 | qDebug(MHPath); | 19 | odebug << MHPath << oendl; |
20 | QDir dir(MHPath); | 20 | QDir dir(MHPath); |
21 | if (!dir.exists()) { | 21 | if (!dir.exists()) { |
22 | dir.mkdir(MHPath); | 22 | dir.mkdir(MHPath); |
23 | } | 23 | } |
24 | init_storage(); | 24 | init_storage(); |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | void MHwrapper::init_storage() | 28 | void MHwrapper::init_storage() |
29 | { | 29 | { |
30 | int r; | 30 | int r; |
31 | QString pre = MHPath; | 31 | QString pre = MHPath; |
32 | if (!m_storage) { | 32 | if (!m_storage) { |
33 | m_storage = mailstorage_new(NULL); | 33 | m_storage = mailstorage_new(NULL); |
34 | r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); | 34 | r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0); |
35 | if (r != MAIL_NO_ERROR) { | 35 | if (r != MAIL_NO_ERROR) { |
36 | qDebug("error initializing storage"); | 36 | odebug << "error initializing storage" << oendl; |
37 | mailstorage_free(m_storage); | 37 | mailstorage_free(m_storage); |
38 | m_storage = 0; | 38 | m_storage = 0; |
39 | return; | 39 | return; |
40 | } | 40 | } |
41 | } | 41 | } |
42 | r = mailstorage_connect(m_storage); | 42 | r = mailstorage_connect(m_storage); |
43 | if (r!=MAIL_NO_ERROR) { | 43 | if (r!=MAIL_NO_ERROR) { |
44 | qDebug("error connecting storage"); | 44 | odebug << "error connecting storage" << oendl; |
45 | mailstorage_free(m_storage); | 45 | mailstorage_free(m_storage); |
46 | m_storage = 0; | 46 | m_storage = 0; |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | void MHwrapper::clean_storage() | 50 | void MHwrapper::clean_storage() |
51 | { | 51 | { |
52 | if (m_storage) { | 52 | if (m_storage) { |
53 | mailstorage_disconnect(m_storage); | 53 | mailstorage_disconnect(m_storage); |
54 | mailstorage_free(m_storage); | 54 | mailstorage_free(m_storage); |
55 | m_storage = 0; | 55 | m_storage = 0; |
56 | } | 56 | } |
@@ -61,105 +61,105 @@ MHwrapper::~MHwrapper() | |||
61 | clean_storage(); | 61 | clean_storage(); |
62 | } | 62 | } |
63 | 63 | ||
64 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) | 64 | void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target ) |
65 | { | 65 | { |
66 | init_storage(); | 66 | init_storage(); |
67 | if (!m_storage) { | 67 | if (!m_storage) { |
68 | return; | 68 | return; |
69 | } | 69 | } |
70 | QString f = buildPath(mailbox); | 70 | QString f = buildPath(mailbox); |
71 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 71 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
72 | if (r!=MAIL_NO_ERROR) { | 72 | if (r!=MAIL_NO_ERROR) { |
73 | qDebug("listMessages: error selecting folder!"); | 73 | odebug << "listMessages: error selecting folder!" << oendl; |
74 | return; | 74 | return; |
75 | } | 75 | } |
76 | parseList(target,m_storage->sto_session,f); | 76 | parseList(target,m_storage->sto_session,f); |
77 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); | 77 | Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count())); |
78 | } | 78 | } |
79 | 79 | ||
80 | QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() | 80 | QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders() |
81 | { | 81 | { |
82 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); | 82 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >(); |
83 | /* this is needed! */ | 83 | /* this is needed! */ |
84 | if (m_storage) mailstorage_disconnect(m_storage); | 84 | if (m_storage) mailstorage_disconnect(m_storage); |
85 | init_storage(); | 85 | init_storage(); |
86 | if (!m_storage) { | 86 | if (!m_storage) { |
87 | return folders; | 87 | return folders; |
88 | } | 88 | } |
89 | mail_list*flist = 0; | 89 | mail_list*flist = 0; |
90 | clistcell*current=0; | 90 | clistcell*current=0; |
91 | int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); | 91 | int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist); |
92 | if (r != MAIL_NO_ERROR || !flist) { | 92 | if (r != MAIL_NO_ERROR || !flist) { |
93 | qDebug("error getting folder list"); | 93 | odebug << "error getting folder list" << oendl; |
94 | return folders; | 94 | return folders; |
95 | } | 95 | } |
96 | for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { | 96 | for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) { |
97 | QString t = (char*)current->data; | 97 | QString t = (char*)current->data; |
98 | t.replace(0,MHPath.length(),""); | 98 | t.replace(0,MHPath.length(),""); |
99 | folders->append(new MHFolder(t,MHPath)); | 99 | folders->append(new MHFolder(t,MHPath)); |
100 | } | 100 | } |
101 | mail_list_free(flist); | 101 | mail_list_free(flist); |
102 | return folders; | 102 | return folders; |
103 | } | 103 | } |
104 | 104 | ||
105 | void MHwrapper::deleteMail(const RecMailP&mail) | 105 | void MHwrapper::deleteMail(const RecMailP&mail) |
106 | { | 106 | { |
107 | init_storage(); | 107 | init_storage(); |
108 | if (!m_storage) { | 108 | if (!m_storage) { |
109 | return; | 109 | return; |
110 | } | 110 | } |
111 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); | 111 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); |
112 | if (r!=MAIL_NO_ERROR) { | 112 | if (r!=MAIL_NO_ERROR) { |
113 | qDebug("error selecting folder!"); | 113 | odebug << "error selecting folder!" << oendl; |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | r = mailsession_remove_message(m_storage->sto_session,mail->getNumber()); | 116 | r = mailsession_remove_message(m_storage->sto_session,mail->getNumber()); |
117 | if (r != MAIL_NO_ERROR) { | 117 | if (r != MAIL_NO_ERROR) { |
118 | qDebug("error deleting mail"); | 118 | odebug << "error deleting mail" << oendl; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | void MHwrapper::answeredMail(const RecMailP&) | 122 | void MHwrapper::answeredMail(const RecMailP&) |
123 | { | 123 | { |
124 | } | 124 | } |
125 | 125 | ||
126 | RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) | 126 | RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) |
127 | { | 127 | { |
128 | RecBodyP body = new RecBody(); | 128 | RecBodyP body = new RecBody(); |
129 | init_storage(); | 129 | init_storage(); |
130 | if (!m_storage) { | 130 | if (!m_storage) { |
131 | return body; | 131 | return body; |
132 | } | 132 | } |
133 | mailmessage * msg; | 133 | mailmessage * msg; |
134 | char*data=0; | 134 | char*data=0; |
135 | 135 | ||
136 | /* mail should hold the complete path! */ | 136 | /* mail should hold the complete path! */ |
137 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); | 137 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); |
138 | if (r != MAIL_NO_ERROR) { | 138 | if (r != MAIL_NO_ERROR) { |
139 | return body; | 139 | return body; |
140 | } | 140 | } |
141 | r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); | 141 | r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); |
142 | if (r != MAIL_NO_ERROR) { | 142 | if (r != MAIL_NO_ERROR) { |
143 | qDebug("Error fetching mail %i",mail->getNumber()); | 143 | odebug << "Error fetching mail " << mail->getNumber() << "" << oendl; |
144 | return body; | 144 | return body; |
145 | } | 145 | } |
146 | body = parseMail(msg); | 146 | body = parseMail(msg); |
147 | mailmessage_fetch_result_free(msg,data); | 147 | mailmessage_fetch_result_free(msg,data); |
148 | return body; | 148 | return body; |
149 | } | 149 | } |
150 | 150 | ||
151 | void MHwrapper::mbox_progress( size_t current, size_t maximum ) | 151 | void MHwrapper::mbox_progress( size_t current, size_t maximum ) |
152 | { | 152 | { |
153 | qDebug("MH %i von %i",current,maximum); | 153 | odebug << "MH " << current << " von " << maximum << "" << oendl; |
154 | } | 154 | } |
155 | 155 | ||
156 | QString MHwrapper::buildPath(const QString&p) | 156 | QString MHwrapper::buildPath(const QString&p) |
157 | { | 157 | { |
158 | QString f=""; | 158 | QString f=""; |
159 | if (p.length()==0||p=="/") | 159 | if (p.length()==0||p=="/") |
160 | return MHPath; | 160 | return MHPath; |
161 | if (!p.startsWith(MHPath)) { | 161 | if (!p.startsWith(MHPath)) { |
162 | f+=MHPath; | 162 | f+=MHPath; |
163 | } | 163 | } |
164 | if (!p.startsWith("/")) { | 164 | if (!p.startsWith("/")) { |
165 | f+="/"; | 165 | f+="/"; |
@@ -174,119 +174,119 @@ int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QStri | |||
174 | if (!m_storage) { | 174 | if (!m_storage) { |
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | QString f; | 177 | QString f; |
178 | if (!pfolder) { | 178 | if (!pfolder) { |
179 | // toplevel folder | 179 | // toplevel folder |
180 | f = buildPath(folder); | 180 | f = buildPath(folder); |
181 | } else { | 181 | } else { |
182 | f = pfolder->getName(); | 182 | f = pfolder->getName(); |
183 | f+="/"; | 183 | f+="/"; |
184 | f+=folder; | 184 | f+=folder; |
185 | } | 185 | } |
186 | qDebug(f); | 186 | odebug << f << oendl; |
187 | int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); | 187 | int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1()); |
188 | if (r != MAIL_NO_ERROR) { | 188 | if (r != MAIL_NO_ERROR) { |
189 | qDebug("error creating folder %i",r); | 189 | odebug << "error creating folder " << r << "" << oendl; |
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
192 | qDebug("Folder created"); | 192 | odebug << "Folder created" << oendl; |
193 | return 1; | 193 | return 1; |
194 | } | 194 | } |
195 | 195 | ||
196 | void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) | 196 | void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder) |
197 | { | 197 | { |
198 | init_storage(); | 198 | init_storage(); |
199 | if (!m_storage) { | 199 | if (!m_storage) { |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | QString f = buildPath(Folder); | 202 | QString f = buildPath(Folder); |
203 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 203 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
204 | if (r!=MAIL_NO_ERROR) { | 204 | if (r!=MAIL_NO_ERROR) { |
205 | qDebug("error selecting folder!"); | 205 | odebug << "error selecting folder!" << oendl; |
206 | return; | 206 | return; |
207 | } | 207 | } |
208 | r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); | 208 | r = mailsession_append_message(m_storage->sto_session,(char*)msg,length); |
209 | if (r!=MAIL_NO_ERROR) { | 209 | if (r!=MAIL_NO_ERROR) { |
210 | qDebug("error storing mail"); | 210 | odebug << "error storing mail" << oendl; |
211 | } | 211 | } |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | 214 | ||
215 | encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) | 215 | encodedString* MHwrapper::fetchRawBody(const RecMailP&mail) |
216 | { | 216 | { |
217 | encodedString*result = 0; | 217 | encodedString*result = 0; |
218 | init_storage(); | 218 | init_storage(); |
219 | if (!m_storage) { | 219 | if (!m_storage) { |
220 | return result; | 220 | return result; |
221 | } | 221 | } |
222 | mailmessage * msg = 0; | 222 | mailmessage * msg = 0; |
223 | char*data=0; | 223 | char*data=0; |
224 | size_t size; | 224 | size_t size; |
225 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); | 225 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); |
226 | if (r!=MAIL_NO_ERROR) { | 226 | if (r!=MAIL_NO_ERROR) { |
227 | qDebug("error selecting folder!"); | 227 | odebug << "error selecting folder!" << oendl; |
228 | return result; | 228 | return result; |
229 | } | 229 | } |
230 | r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); | 230 | r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg); |
231 | if (r != MAIL_NO_ERROR) { | 231 | if (r != MAIL_NO_ERROR) { |
232 | Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); | 232 | Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); |
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
235 | r = mailmessage_fetch(msg,&data,&size); | 235 | r = mailmessage_fetch(msg,&data,&size); |
236 | if (r != MAIL_NO_ERROR) { | 236 | if (r != MAIL_NO_ERROR) { |
237 | Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); | 237 | Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber())); |
238 | if (msg) mailmessage_free(msg); | 238 | if (msg) mailmessage_free(msg); |
239 | return 0; | 239 | return 0; |
240 | } | 240 | } |
241 | result = new encodedString(data,size); | 241 | result = new encodedString(data,size); |
242 | if (msg) mailmessage_free(msg); | 242 | if (msg) mailmessage_free(msg); |
243 | return result; | 243 | return result; |
244 | } | 244 | } |
245 | 245 | ||
246 | void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) | 246 | void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target) |
247 | { | 247 | { |
248 | QString f = buildPath(mailbox); | 248 | QString f = buildPath(mailbox); |
249 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); | 249 | int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1()); |
250 | if (r!=MAIL_NO_ERROR) { | 250 | if (r!=MAIL_NO_ERROR) { |
251 | qDebug("deleteMails: error selecting folder!"); | 251 | odebug << "deleteMails: error selecting folder!" << oendl; |
252 | return; | 252 | return; |
253 | } | 253 | } |
254 | QValueList<RecMailP>::ConstIterator it; | 254 | QValueList<RecMailP>::ConstIterator it; |
255 | for (it=target.begin(); it!=target.end();++it) { | 255 | for (it=target.begin(); it!=target.end();++it) { |
256 | r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); | 256 | r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber()); |
257 | if (r != MAIL_NO_ERROR) { | 257 | if (r != MAIL_NO_ERROR) { |
258 | qDebug("error deleting mail"); | 258 | odebug << "error deleting mail" << oendl; |
259 | break; | 259 | break; |
260 | } | 260 | } |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | int MHwrapper::deleteAllMail(const FolderP&tfolder) | 264 | int MHwrapper::deleteAllMail(const FolderP&tfolder) |
265 | { | 265 | { |
266 | init_storage(); | 266 | init_storage(); |
267 | if (!m_storage) { | 267 | if (!m_storage) { |
268 | return 0; | 268 | return 0; |
269 | } | 269 | } |
270 | int res = 1; | 270 | int res = 1; |
271 | if (!tfolder) return 0; | 271 | if (!tfolder) return 0; |
272 | int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); | 272 | int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); |
273 | if (r!=MAIL_NO_ERROR) { | 273 | if (r!=MAIL_NO_ERROR) { |
274 | qDebug("error selecting folder!"); | 274 | odebug << "error selecting folder!" << oendl; |
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |
277 | mailmessage_list*l=0; | 277 | mailmessage_list*l=0; |
278 | r = mailsession_get_messages_list(m_storage->sto_session,&l); | 278 | r = mailsession_get_messages_list(m_storage->sto_session,&l); |
279 | if (r != MAIL_NO_ERROR) { | 279 | if (r != MAIL_NO_ERROR) { |
280 | qDebug("Error message list"); | 280 | odebug << "Error message list" << oendl; |
281 | res = 0; | 281 | res = 0; |
282 | } | 282 | } |
283 | unsigned j = 0; | 283 | unsigned j = 0; |
284 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { | 284 | for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) { |
285 | mailmessage * msg; | 285 | mailmessage * msg; |
286 | msg = (mailmessage*)carray_get(l->msg_tab, i); | 286 | msg = (mailmessage*)carray_get(l->msg_tab, i); |
287 | j = msg->msg_index; | 287 | j = msg->msg_index; |
288 | r = mailsession_remove_message(m_storage->sto_session,j); | 288 | r = mailsession_remove_message(m_storage->sto_session,j); |
289 | if (r != MAIL_NO_ERROR) { | 289 | if (r != MAIL_NO_ERROR) { |
290 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 290 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
291 | res = 0; | 291 | res = 0; |
292 | break; | 292 | break; |
@@ -299,46 +299,46 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder) | |||
299 | int MHwrapper::deleteMbox(const FolderP&tfolder) | 299 | int MHwrapper::deleteMbox(const FolderP&tfolder) |
300 | { | 300 | { |
301 | init_storage(); | 301 | init_storage(); |
302 | if (!m_storage) { | 302 | if (!m_storage) { |
303 | return 0; | 303 | return 0; |
304 | } | 304 | } |
305 | if (!tfolder) return 0; | 305 | if (!tfolder) return 0; |
306 | if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; | 306 | if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; |
307 | 307 | ||
308 | int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); | 308 | int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); |
309 | 309 | ||
310 | if (r != MAIL_NO_ERROR) { | 310 | if (r != MAIL_NO_ERROR) { |
311 | qDebug("error deleting mail box"); | 311 | odebug << "error deleting mail box" << oendl; |
312 | return 0; | 312 | return 0; |
313 | } | 313 | } |
314 | QString cmd = "rm -rf "+tfolder->getName(); | 314 | QString cmd = "rm -rf "+tfolder->getName(); |
315 | QStringList command; | 315 | QStringList command; |
316 | command << "/bin/sh"; | 316 | command << "/bin/sh"; |
317 | command << "-c"; | 317 | command << "-c"; |
318 | command << cmd.latin1(); | 318 | command << cmd.latin1(); |
319 | OProcess *process = new OProcess(); | 319 | OProcess *process = new OProcess(); |
320 | 320 | ||
321 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), | 321 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), |
322 | this, SLOT( processEnded(Opie::Core::OProcess*))); | 322 | this, SLOT( processEnded(Opie::Core::OProcess*))); |
323 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), | 323 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), |
324 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); | 324 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); |
325 | 325 | ||
326 | *process << command; | 326 | *process << command; |
327 | removeMboxfailed = false; | 327 | removeMboxfailed = false; |
328 | if(!process->start(OProcess::Block, OProcess::All) ) { | 328 | if(!process->start(OProcess::Block, OProcess::All) ) { |
329 | qDebug("could not start process"); | 329 | odebug << "could not start process" << oendl; |
330 | return 0; | 330 | return 0; |
331 | } | 331 | } |
332 | qDebug("mail box deleted"); | 332 | odebug << "mail box deleted" << oendl; |
333 | return 1; | 333 | return 1; |
334 | } | 334 | } |
335 | 335 | ||
336 | void MHwrapper::processEnded(OProcess *p) | 336 | void MHwrapper::processEnded(OProcess *p) |
337 | { | 337 | { |
338 | if (p) delete p; | 338 | if (p) delete p; |
339 | } | 339 | } |
340 | 340 | ||
341 | void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) | 341 | void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) |
342 | { | 342 | { |
343 | QString lineStr = buffer; | 343 | QString lineStr = buffer; |
344 | QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); | 344 | QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") ); |
@@ -369,74 +369,74 @@ MAILLIB::ATYPE MHwrapper::getType()const | |||
369 | 369 | ||
370 | const QString&MHwrapper::getName()const | 370 | const QString&MHwrapper::getName()const |
371 | { | 371 | { |
372 | return MHName; | 372 | return MHName; |
373 | } | 373 | } |
374 | void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 374 | void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
375 | { | 375 | { |
376 | init_storage(); | 376 | init_storage(); |
377 | if (!m_storage) { | 377 | if (!m_storage) { |
378 | return; | 378 | return; |
379 | } | 379 | } |
380 | if (targetWrapper != this) { | 380 | if (targetWrapper != this) { |
381 | qDebug("Using generic"); | 381 | odebug << "Using generic" << oendl; |
382 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 382 | Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
383 | return; | 383 | return; |
384 | } | 384 | } |
385 | qDebug("Using internal routines for move/copy"); | 385 | odebug << "Using internal routines for move/copy" << oendl; |
386 | QString tf = buildPath(targetFolder); | 386 | QString tf = buildPath(targetFolder); |
387 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); | 387 | int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1()); |
388 | if (r != MAIL_NO_ERROR) { | 388 | if (r != MAIL_NO_ERROR) { |
389 | qDebug("Error selecting source mailbox"); | 389 | odebug << "Error selecting source mailbox" << oendl; |
390 | return; | 390 | return; |
391 | } | 391 | } |
392 | if (moveit) { | 392 | if (moveit) { |
393 | r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); | 393 | r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); |
394 | } else { | 394 | } else { |
395 | r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); | 395 | r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1()); |
396 | } | 396 | } |
397 | if (r != MAIL_NO_ERROR) { | 397 | if (r != MAIL_NO_ERROR) { |
398 | qDebug("Error copy/moving mail internal (%i)",r); | 398 | odebug << "Error copy/moving mail internal (" << r << ")" << oendl; |
399 | } | 399 | } |
400 | } | 400 | } |
401 | 401 | ||
402 | void MHwrapper::mvcpAllMails(const FolderP&fromFolder, | 402 | void MHwrapper::mvcpAllMails(const FolderP&fromFolder, |
403 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 403 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
404 | { | 404 | { |
405 | init_storage(); | 405 | init_storage(); |
406 | if (!m_storage) { | 406 | if (!m_storage) { |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | if (targetWrapper != this) { | 409 | if (targetWrapper != this) { |
410 | qDebug("Using generic"); | 410 | odebug << "Using generic" << oendl; |
411 | Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); | 411 | Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit); |
412 | return; | 412 | return; |
413 | } | 413 | } |
414 | if (!fromFolder) return; | 414 | if (!fromFolder) return; |
415 | int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); | 415 | int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1()); |
416 | if (r!=MAIL_NO_ERROR) { | 416 | if (r!=MAIL_NO_ERROR) { |
417 | qDebug("error selecting source folder!"); | 417 | odebug << "error selecting source folder!" << oendl; |
418 | return; | 418 | return; |
419 | } | 419 | } |
420 | QString tf = buildPath(targetFolder); | 420 | QString tf = buildPath(targetFolder); |
421 | mailmessage_list*l=0; | 421 | mailmessage_list*l=0; |
422 | r = mailsession_get_messages_list(m_storage->sto_session,&l); | 422 | r = mailsession_get_messages_list(m_storage->sto_session,&l); |
423 | if (r != MAIL_NO_ERROR) { | 423 | if (r != MAIL_NO_ERROR) { |
424 | qDebug("Error message list"); | 424 | odebug << "Error message list" << oendl; |
425 | } | 425 | } |
426 | unsigned j = 0; | 426 | unsigned j = 0; |
427 | for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) { | 427 | for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) { |
428 | mailmessage * msg; | 428 | mailmessage * msg; |
429 | msg = (mailmessage*)carray_get(l->msg_tab, i); | 429 | msg = (mailmessage*)carray_get(l->msg_tab, i); |
430 | j = msg->msg_index; | 430 | j = msg->msg_index; |
431 | if (moveit) { | 431 | if (moveit) { |
432 | r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1()); | 432 | r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1()); |
433 | } else { | 433 | } else { |
434 | r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1()); | 434 | r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1()); |
435 | } | 435 | } |
436 | if (r != MAIL_NO_ERROR) { | 436 | if (r != MAIL_NO_ERROR) { |
437 | qDebug("Error copy/moving mail internal (%i)",r); | 437 | odebug << "Error copy/moving mail internal (" << r << ")" << oendl; |
438 | break; | 438 | break; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | if (l) mailmessage_list_free(l); | 441 | if (l) mailmessage_list_free(l); |
442 | } | 442 | } |
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index cfded43..5d5011a 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp | |||
@@ -20,42 +20,42 @@ NNTPwrapper::NNTPwrapper( NNTPaccount *a ) | |||
20 | last_msg_id = 0; | 20 | last_msg_id = 0; |
21 | } | 21 | } |
22 | 22 | ||
23 | NNTPwrapper::~NNTPwrapper() { | 23 | NNTPwrapper::~NNTPwrapper() { |
24 | logout(); | 24 | logout(); |
25 | QFile msg_cache(msgTempName); | 25 | QFile msg_cache(msgTempName); |
26 | if (msg_cache.exists()) { | 26 | if (msg_cache.exists()) { |
27 | msg_cache.remove(); | 27 | msg_cache.remove(); |
28 | } | 28 | } |
29 | } | 29 | } |
30 | 30 | ||
31 | void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { | 31 | void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) { |
32 | qDebug( "NNTP: %i of %i", current, maximum ); | 32 | odebug << "NNTP: " << current << " of " << maximum << "" << oendl; |
33 | } | 33 | } |
34 | 34 | ||
35 | 35 | ||
36 | RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { | 36 | RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { |
37 | int err = NEWSNNTP_NO_ERROR; | 37 | int err = NEWSNNTP_NO_ERROR; |
38 | char *message = 0; | 38 | char *message = 0; |
39 | size_t length = 0; | 39 | size_t length = 0; |
40 | 40 | ||
41 | RecBodyP body = new RecBody(); | 41 | RecBodyP body = new RecBody(); |
42 | login(); | 42 | login(); |
43 | if ( !m_nntp ) { | 43 | if ( !m_nntp ) { |
44 | return body; | 44 | return body; |
45 | } | 45 | } |
46 | 46 | ||
47 | mailmessage * mailmsg; | 47 | mailmessage * mailmsg; |
48 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { | 48 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { |
49 | qDebug("Message to large: %i",mail->Msgsize()); | 49 | odebug << "Message to large: " << mail->Msgsize() << "" << oendl; |
50 | return body; | 50 | return body; |
51 | } | 51 | } |
52 | 52 | ||
53 | QFile msg_cache(msgTempName); | 53 | QFile msg_cache(msgTempName); |
54 | 54 | ||
55 | cleanMimeCache(); | 55 | cleanMimeCache(); |
56 | 56 | ||
57 | if (mail->getNumber()!=last_msg_id) { | 57 | if (mail->getNumber()!=last_msg_id) { |
58 | if (msg_cache.exists()) { | 58 | if (msg_cache.exists()) { |
59 | msg_cache.remove(); | 59 | msg_cache.remove(); |
60 | } | 60 | } |
61 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 61 | msg_cache.open(IO_ReadWrite|IO_Truncate); |
@@ -125,25 +125,25 @@ void NNTPwrapper::login() | |||
125 | 125 | ||
126 | user = pass = 0; | 126 | user = pass = 0; |
127 | 127 | ||
128 | if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) { | 128 | if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) { |
129 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 129 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
130 | login.show(); | 130 | login.show(); |
131 | if ( QDialog::Accepted == login.exec() ) { | 131 | if ( QDialog::Accepted == login.exec() ) { |
132 | // ok | 132 | // ok |
133 | User = login.getUser().latin1(); | 133 | User = login.getUser().latin1(); |
134 | Pass = login.getPassword().latin1(); | 134 | Pass = login.getPassword().latin1(); |
135 | } else { | 135 | } else { |
136 | // cancel | 136 | // cancel |
137 | qDebug( "NNTP: Login canceled" ); | 137 | odebug << "NNTP: Login canceled" << oendl; |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | } else { | 140 | } else { |
141 | User = account->getUser().latin1(); | 141 | User = account->getUser().latin1(); |
142 | Pass = account->getPassword().latin1(); | 142 | Pass = account->getPassword().latin1(); |
143 | } | 143 | } |
144 | 144 | ||
145 | if (User.isEmpty()) { | 145 | if (User.isEmpty()) { |
146 | user=0; | 146 | user=0; |
147 | pass = 0; | 147 | pass = 0; |
148 | } else { | 148 | } else { |
149 | user=User.latin1(); | 149 | user=User.latin1(); |
@@ -162,25 +162,25 @@ void NNTPwrapper::login() | |||
162 | } else if ( conntypeset == 1 ) { | 162 | } else if ( conntypeset == 1 ) { |
163 | conntype = CONNECTION_TYPE_STARTTLS; | 163 | conntype = CONNECTION_TYPE_STARTTLS; |
164 | } else if ( conntypeset == 0 ) { | 164 | } else if ( conntypeset == 0 ) { |
165 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 165 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
166 | } | 166 | } |
167 | 167 | ||
168 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, | 168 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, |
169 | (char*)user,(char*)pass,0,0,0); | 169 | (char*)user,(char*)pass,0,0,0); |
170 | 170 | ||
171 | err = mailstorage_connect( m_nntp ); | 171 | err = mailstorage_connect( m_nntp ); |
172 | 172 | ||
173 | if (err != NEWSNNTP_NO_ERROR) { | 173 | if (err != NEWSNNTP_NO_ERROR) { |
174 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); | 174 | odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; |
175 | // Global::statusMessage(tr("Error initializing folder")); | 175 | // Global::statusMessage(tr("Error initializing folder")); |
176 | mailstorage_free(m_nntp); | 176 | mailstorage_free(m_nntp); |
177 | m_nntp = 0; | 177 | m_nntp = 0; |
178 | 178 | ||
179 | } else { | 179 | } else { |
180 | mailsession * session = m_nntp->sto_session; | 180 | mailsession * session = m_nntp->sto_session; |
181 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; | 181 | newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; |
182 | news->nntp_progr_fun = &nntp_progress; | 182 | news->nntp_progr_fun = &nntp_progress; |
183 | } | 183 | } |
184 | 184 | ||
185 | } | 185 | } |
186 | 186 | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 5467547..c586c29 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -19,42 +19,42 @@ POP3wrapper::POP3wrapper( POP3account *a ) | |||
19 | last_msg_id = 0; | 19 | last_msg_id = 0; |
20 | } | 20 | } |
21 | 21 | ||
22 | POP3wrapper::~POP3wrapper() { | 22 | POP3wrapper::~POP3wrapper() { |
23 | logout(); | 23 | logout(); |
24 | QFile msg_cache(msgTempName); | 24 | QFile msg_cache(msgTempName); |
25 | if (msg_cache.exists()) { | 25 | if (msg_cache.exists()) { |
26 | msg_cache.remove(); | 26 | msg_cache.remove(); |
27 | } | 27 | } |
28 | } | 28 | } |
29 | 29 | ||
30 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { | 30 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { |
31 | qDebug( "POP3: %i of %i", current, maximum ); | 31 | odebug << "POP3: " << current << " of " << maximum << "" << oendl; |
32 | } | 32 | } |
33 | 33 | ||
34 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { | 34 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { |
35 | int err = MAILPOP3_NO_ERROR; | 35 | int err = MAILPOP3_NO_ERROR; |
36 | char *message = 0; | 36 | char *message = 0; |
37 | size_t length = 0; | 37 | size_t length = 0; |
38 | 38 | ||
39 | RecBodyP body = new RecBody(); | 39 | RecBodyP body = new RecBody(); |
40 | 40 | ||
41 | login(); | 41 | login(); |
42 | if ( !m_pop3 ) { | 42 | if ( !m_pop3 ) { |
43 | return body; | 43 | return body; |
44 | } | 44 | } |
45 | 45 | ||
46 | mailmessage * mailmsg; | 46 | mailmessage * mailmsg; |
47 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { | 47 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { |
48 | qDebug("Message to large: %i",mail->Msgsize()); | 48 | odebug << "Message to large: " << mail->Msgsize() << "" << oendl; |
49 | return body; | 49 | return body; |
50 | } | 50 | } |
51 | 51 | ||
52 | QFile msg_cache(msgTempName); | 52 | QFile msg_cache(msgTempName); |
53 | 53 | ||
54 | cleanMimeCache(); | 54 | cleanMimeCache(); |
55 | 55 | ||
56 | if (mail->getNumber()!=last_msg_id) { | 56 | if (mail->getNumber()!=last_msg_id) { |
57 | if (msg_cache.exists()) { | 57 | if (msg_cache.exists()) { |
58 | msg_cache.remove(); | 58 | msg_cache.remove(); |
59 | } | 59 | } |
60 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 60 | msg_cache.open(IO_ReadWrite|IO_Truncate); |
@@ -121,25 +121,25 @@ void POP3wrapper::login() | |||
121 | server = account->getServer().latin1(); | 121 | server = account->getServer().latin1(); |
122 | port = account->getPort().toUInt(); | 122 | port = account->getPort().toUInt(); |
123 | 123 | ||
124 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 124 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
125 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 125 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
126 | login.show(); | 126 | login.show(); |
127 | if ( QDialog::Accepted == login.exec() ) { | 127 | if ( QDialog::Accepted == login.exec() ) { |
128 | // ok | 128 | // ok |
129 | user = login.getUser().latin1(); | 129 | user = login.getUser().latin1(); |
130 | pass = login.getPassword().latin1(); | 130 | pass = login.getPassword().latin1(); |
131 | } else { | 131 | } else { |
132 | // cancel | 132 | // cancel |
133 | qDebug( "POP3: Login canceled" ); | 133 | odebug << "POP3: Login canceled" << oendl; |
134 | return; | 134 | return; |
135 | } | 135 | } |
136 | } else { | 136 | } else { |
137 | user = account->getUser().latin1(); | 137 | user = account->getUser().latin1(); |
138 | pass = account->getPassword().latin1(); | 138 | pass = account->getPassword().latin1(); |
139 | } | 139 | } |
140 | 140 | ||
141 | // bool ssl = account->getSSL(); | 141 | // bool ssl = account->getSSL(); |
142 | 142 | ||
143 | m_pop3=mailstorage_new(NULL); | 143 | m_pop3=mailstorage_new(NULL); |
144 | 144 | ||
145 | int conntypeset = account->ConnectionType(); | 145 | int conntypeset = account->ConnectionType(); |
@@ -153,25 +153,25 @@ void POP3wrapper::login() | |||
153 | } else if ( conntypeset == 0 ) { | 153 | } else if ( conntypeset == 0 ) { |
154 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 154 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
155 | } | 155 | } |
156 | 156 | ||
157 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); | 157 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); |
158 | 158 | ||
159 | pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, | 159 | pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, |
160 | (char*)user,(char*)pass,0,0,0); | 160 | (char*)user,(char*)pass,0,0,0); |
161 | 161 | ||
162 | 162 | ||
163 | err = mailstorage_connect(m_pop3); | 163 | err = mailstorage_connect(m_pop3); |
164 | if (err != MAIL_NO_ERROR) { | 164 | if (err != MAIL_NO_ERROR) { |
165 | qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) ); | 165 | odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; |
166 | Global::statusMessage(tr("Error initializing folder")); | 166 | Global::statusMessage(tr("Error initializing folder")); |
167 | mailstorage_free(m_pop3); | 167 | mailstorage_free(m_pop3); |
168 | m_pop3 = 0; | 168 | m_pop3 = 0; |
169 | } else { | 169 | } else { |
170 | mailsession * session = m_pop3->sto_session; | 170 | mailsession * session = m_pop3->sto_session; |
171 | mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; | 171 | mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; |
172 | if (mail) { | 172 | if (mail) { |
173 | mail->pop3_progr_fun = &pop3_progress; | 173 | mail->pop3_progr_fun = &pop3_progress; |
174 | } | 174 | } |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
@@ -227,25 +227,25 @@ int POP3wrapper::deleteAllMail(const FolderP&) { | |||
227 | } | 227 | } |
228 | 228 | ||
229 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { | 229 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { |
230 | login(); | 230 | login(); |
231 | target_stat.message_count = 0; | 231 | target_stat.message_count = 0; |
232 | target_stat.message_unseen = 0; | 232 | target_stat.message_unseen = 0; |
233 | target_stat.message_recent = 0; | 233 | target_stat.message_recent = 0; |
234 | if (!m_pop3) | 234 | if (!m_pop3) |
235 | return; | 235 | return; |
236 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, | 236 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, |
237 | &target_stat.message_recent,&target_stat.message_unseen); | 237 | &target_stat.message_recent,&target_stat.message_unseen); |
238 | if (r != MAIL_NO_ERROR) { | 238 | if (r != MAIL_NO_ERROR) { |
239 | qDebug("error getting folter status."); | 239 | odebug << "error getting folter status." << oendl; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { | 243 | encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { |
244 | char*target=0; | 244 | char*target=0; |
245 | size_t length=0; | 245 | size_t length=0; |
246 | encodedString*res = 0; | 246 | encodedString*res = 0; |
247 | mailmessage * mailmsg = 0; | 247 | mailmessage * mailmsg = 0; |
248 | int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); | 248 | int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); |
249 | err = mailmessage_fetch(mailmsg,&target,&length); | 249 | err = mailmessage_fetch(mailmsg,&target,&length); |
250 | if (mailmsg) | 250 | if (mailmsg) |
251 | mailmessage_free(mailmsg); | 251 | mailmessage_free(mailmsg); |
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 2c81963..de36eeb 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -17,25 +17,25 @@ | |||
17 | 17 | ||
18 | 18 | ||
19 | Settings::Settings() | 19 | Settings::Settings() |
20 | : QObject() | 20 | : QObject() |
21 | { | 21 | { |
22 | updateAccounts(); | 22 | updateAccounts(); |
23 | } | 23 | } |
24 | 24 | ||
25 | void Settings::checkDirectory() | 25 | void Settings::checkDirectory() |
26 | { | 26 | { |
27 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { | 27 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { |
28 | system( "mkdir -p $HOME/Applications/opiemail" ); | 28 | system( "mkdir -p $HOME/Applications/opiemail" ); |
29 | qDebug( "$HOME/Applications/opiemail created" ); | 29 | odebug << "$HOME/Applications/opiemail created" << oendl; |
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
33 | QList<Account> Settings::getAccounts() | 33 | QList<Account> Settings::getAccounts() |
34 | { | 34 | { |
35 | return accounts; | 35 | return accounts; |
36 | } | 36 | } |
37 | 37 | ||
38 | void Settings::addAccount( Account *account ) | 38 | void Settings::addAccount( Account *account ) |
39 | { | 39 | { |
40 | accounts.append( account ); | 40 | accounts.append( account ); |
41 | } | 41 | } |
@@ -45,46 +45,46 @@ void Settings::delAccount( Account *account ) | |||
45 | accounts.remove( account ); | 45 | accounts.remove( account ); |
46 | account->remove(); | 46 | account->remove(); |
47 | } | 47 | } |
48 | 48 | ||
49 | void Settings::updateAccounts() | 49 | void Settings::updateAccounts() |
50 | { | 50 | { |
51 | accounts.clear(); | 51 | accounts.clear(); |
52 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); | 52 | QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); |
53 | QStringList::Iterator it; | 53 | QStringList::Iterator it; |
54 | 54 | ||
55 | QStringList imap = dir.entryList( "imap-*" ); | 55 | QStringList imap = dir.entryList( "imap-*" ); |
56 | for ( it = imap.begin(); it != imap.end(); it++ ) { | 56 | for ( it = imap.begin(); it != imap.end(); it++ ) { |
57 | qDebug( "Added IMAP account" ); | 57 | odebug << "Added IMAP account" << oendl; |
58 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); | 58 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); |
59 | accounts.append( account ); | 59 | accounts.append( account ); |
60 | } | 60 | } |
61 | 61 | ||
62 | QStringList pop3 = dir.entryList( "pop3-*" ); | 62 | QStringList pop3 = dir.entryList( "pop3-*" ); |
63 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { | 63 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { |
64 | qDebug( "Added POP account" ); | 64 | odebug << "Added POP account" << oendl; |
65 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); | 65 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); |
66 | accounts.append( account ); | 66 | accounts.append( account ); |
67 | } | 67 | } |
68 | 68 | ||
69 | QStringList smtp = dir.entryList( "smtp-*" ); | 69 | QStringList smtp = dir.entryList( "smtp-*" ); |
70 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { | 70 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { |
71 | qDebug( "Added SMTP account" ); | 71 | odebug << "Added SMTP account" << oendl; |
72 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); | 72 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); |
73 | accounts.append( account ); | 73 | accounts.append( account ); |
74 | } | 74 | } |
75 | 75 | ||
76 | QStringList nntp = dir.entryList( "nntp-*" ); | 76 | QStringList nntp = dir.entryList( "nntp-*" ); |
77 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { | 77 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { |
78 | qDebug( "Added NNTP account" ); | 78 | odebug << "Added NNTP account" << oendl; |
79 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); | 79 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); |
80 | accounts.append( account ); | 80 | accounts.append( account ); |
81 | } | 81 | } |
82 | 82 | ||
83 | readAccounts(); | 83 | readAccounts(); |
84 | } | 84 | } |
85 | 85 | ||
86 | void Settings::saveAccounts() | 86 | void Settings::saveAccounts() |
87 | { | 87 | { |
88 | checkDirectory(); | 88 | checkDirectory(); |
89 | Account *it; | 89 | Account *it; |
90 | 90 | ||
@@ -170,25 +170,25 @@ void IMAPaccount::read() | |||
170 | user = conf->readEntry( "User","" ); | 170 | user = conf->readEntry( "User","" ); |
171 | if (user.isNull()) user = ""; | 171 | if (user.isNull()) user = ""; |
172 | password = conf->readEntryCrypt( "Password","" ); | 172 | password = conf->readEntryCrypt( "Password","" ); |
173 | if (password.isNull()) password = ""; | 173 | if (password.isNull()) password = ""; |
174 | prefix = conf->readEntry("MailPrefix",""); | 174 | prefix = conf->readEntry("MailPrefix",""); |
175 | if (prefix.isNull()) prefix = ""; | 175 | if (prefix.isNull()) prefix = ""; |
176 | offline = conf->readBoolEntry("Offline",false); | 176 | offline = conf->readBoolEntry("Offline",false); |
177 | delete conf; | 177 | delete conf; |
178 | } | 178 | } |
179 | 179 | ||
180 | void IMAPaccount::save() | 180 | void IMAPaccount::save() |
181 | { | 181 | { |
182 | qDebug( "saving " + getFileName() ); | 182 | odebug << "saving " + getFileName() << oendl; |
183 | Settings::checkDirectory(); | 183 | Settings::checkDirectory(); |
184 | 184 | ||
185 | Config *conf = new Config( getFileName(), Config::File ); | 185 | Config *conf = new Config( getFileName(), Config::File ); |
186 | conf->setGroup( "IMAP Account" ); | 186 | conf->setGroup( "IMAP Account" ); |
187 | conf->writeEntry( "Account", accountName ); | 187 | conf->writeEntry( "Account", accountName ); |
188 | conf->writeEntry( "Server", server ); | 188 | conf->writeEntry( "Server", server ); |
189 | conf->writeEntry( "Port", port ); | 189 | conf->writeEntry( "Port", port ); |
190 | conf->writeEntry( "SSL", ssl ); | 190 | conf->writeEntry( "SSL", ssl ); |
191 | conf->writeEntry( "ConnectionType", connectionType ); | 191 | conf->writeEntry( "ConnectionType", connectionType ); |
192 | conf->writeEntry( "User", user ); | 192 | conf->writeEntry( "User", user ); |
193 | conf->writeEntryCrypt( "Password", password ); | 193 | conf->writeEntryCrypt( "Password", password ); |
194 | conf->writeEntry( "MailPrefix",prefix); | 194 | conf->writeEntry( "MailPrefix",prefix); |
@@ -248,25 +248,25 @@ void POP3account::read() | |||
248 | server = conf->readEntry( "Server" ); | 248 | server = conf->readEntry( "Server" ); |
249 | port = conf->readEntry( "Port" ); | 249 | port = conf->readEntry( "Port" ); |
250 | ssl = conf->readBoolEntry( "SSL" ); | 250 | ssl = conf->readBoolEntry( "SSL" ); |
251 | connectionType = conf->readNumEntry( "ConnectionType" ); | 251 | connectionType = conf->readNumEntry( "ConnectionType" ); |
252 | user = conf->readEntry( "User" ); | 252 | user = conf->readEntry( "User" ); |
253 | password = conf->readEntryCrypt( "Password" ); | 253 | password = conf->readEntryCrypt( "Password" ); |
254 | offline = conf->readBoolEntry("Offline",false); | 254 | offline = conf->readBoolEntry("Offline",false); |
255 | delete conf; | 255 | delete conf; |
256 | } | 256 | } |
257 | 257 | ||
258 | void POP3account::save() | 258 | void POP3account::save() |
259 | { | 259 | { |
260 | qDebug( "saving " + getFileName() ); | 260 | odebug << "saving " + getFileName() << oendl; |
261 | Settings::checkDirectory(); | 261 | Settings::checkDirectory(); |
262 | 262 | ||
263 | Config *conf = new Config( getFileName(), Config::File ); | 263 | Config *conf = new Config( getFileName(), Config::File ); |
264 | conf->setGroup( "POP3 Account" ); | 264 | conf->setGroup( "POP3 Account" ); |
265 | conf->writeEntry( "Account", accountName ); | 265 | conf->writeEntry( "Account", accountName ); |
266 | conf->writeEntry( "Server", server ); | 266 | conf->writeEntry( "Server", server ); |
267 | conf->writeEntry( "Port", port ); | 267 | conf->writeEntry( "Port", port ); |
268 | conf->writeEntry( "SSL", ssl ); | 268 | conf->writeEntry( "SSL", ssl ); |
269 | conf->writeEntry( "ConnectionType", connectionType ); | 269 | conf->writeEntry( "ConnectionType", connectionType ); |
270 | conf->writeEntry( "User", user ); | 270 | conf->writeEntry( "User", user ); |
271 | conf->writeEntryCrypt( "Password", password ); | 271 | conf->writeEntryCrypt( "Password", password ); |
272 | conf->writeEntry( "Offline",offline); | 272 | conf->writeEntry( "Offline",offline); |
@@ -330,25 +330,25 @@ void SMTPaccount::read() | |||
330 | server = conf->readEntry( "Server" ); | 330 | server = conf->readEntry( "Server" ); |
331 | port = conf->readEntry( "Port" ); | 331 | port = conf->readEntry( "Port" ); |
332 | ssl = conf->readBoolEntry( "SSL" ); | 332 | ssl = conf->readBoolEntry( "SSL" ); |
333 | connectionType = conf->readNumEntry( "ConnectionType" ); | 333 | connectionType = conf->readNumEntry( "ConnectionType" ); |
334 | login = conf->readBoolEntry( "Login" ); | 334 | login = conf->readBoolEntry( "Login" ); |
335 | user = conf->readEntry( "User" ); | 335 | user = conf->readEntry( "User" ); |
336 | password = conf->readEntryCrypt( "Password" ); | 336 | password = conf->readEntryCrypt( "Password" ); |
337 | delete conf; | 337 | delete conf; |
338 | } | 338 | } |
339 | 339 | ||
340 | void SMTPaccount::save() | 340 | void SMTPaccount::save() |
341 | { | 341 | { |
342 | qDebug( "saving " + getFileName() ); | 342 | odebug << "saving " + getFileName() << oendl; |
343 | Settings::checkDirectory(); | 343 | Settings::checkDirectory(); |
344 | 344 | ||
345 | Config *conf = new Config( getFileName(), Config::File ); | 345 | Config *conf = new Config( getFileName(), Config::File ); |
346 | conf->setGroup( "SMTP Account" ); | 346 | conf->setGroup( "SMTP Account" ); |
347 | conf->writeEntry( "Account", accountName ); | 347 | conf->writeEntry( "Account", accountName ); |
348 | conf->writeEntry( "Server", server ); | 348 | conf->writeEntry( "Server", server ); |
349 | conf->writeEntry( "Port", port ); | 349 | conf->writeEntry( "Port", port ); |
350 | conf->writeEntry( "SSL", ssl ); | 350 | conf->writeEntry( "SSL", ssl ); |
351 | conf->writeEntry( "ConnectionType", connectionType ); | 351 | conf->writeEntry( "ConnectionType", connectionType ); |
352 | conf->writeEntry( "Login", login ); | 352 | conf->writeEntry( "Login", login ); |
353 | conf->writeEntry( "User", user ); | 353 | conf->writeEntry( "User", user ); |
354 | conf->writeEntryCrypt( "Password", password ); | 354 | conf->writeEntryCrypt( "Password", password ); |
@@ -407,25 +407,25 @@ void NNTPaccount::read() | |||
407 | server = conf->readEntry( "Server" ); | 407 | server = conf->readEntry( "Server" ); |
408 | port = conf->readEntry( "Port" ); | 408 | port = conf->readEntry( "Port" ); |
409 | ssl = conf->readBoolEntry( "SSL" ); | 409 | ssl = conf->readBoolEntry( "SSL" ); |
410 | login = conf->readBoolEntry( "Login" ); | 410 | login = conf->readBoolEntry( "Login" ); |
411 | user = conf->readEntry( "User" ); | 411 | user = conf->readEntry( "User" ); |
412 | password = conf->readEntryCrypt( "Password" ); | 412 | password = conf->readEntryCrypt( "Password" ); |
413 | subscribedGroups = conf->readListEntry( "Subscribed", ',' ); | 413 | subscribedGroups = conf->readListEntry( "Subscribed", ',' ); |
414 | delete conf; | 414 | delete conf; |
415 | } | 415 | } |
416 | 416 | ||
417 | void NNTPaccount::save() | 417 | void NNTPaccount::save() |
418 | { | 418 | { |
419 | qDebug( "saving " + getFileName() ); | 419 | odebug << "saving " + getFileName() << oendl; |
420 | Settings::checkDirectory(); | 420 | Settings::checkDirectory(); |
421 | 421 | ||
422 | Config *conf = new Config( getFileName(), Config::File ); | 422 | Config *conf = new Config( getFileName(), Config::File ); |
423 | conf->setGroup( "NNTP Account" ); | 423 | conf->setGroup( "NNTP Account" ); |
424 | conf->writeEntry( "Account", accountName ); | 424 | conf->writeEntry( "Account", accountName ); |
425 | conf->writeEntry( "Server", server ); | 425 | conf->writeEntry( "Server", server ); |
426 | conf->writeEntry( "Port", port ); | 426 | conf->writeEntry( "Port", port ); |
427 | conf->writeEntry( "SSL", ssl ); | 427 | conf->writeEntry( "SSL", ssl ); |
428 | conf->writeEntry( "Login", login ); | 428 | conf->writeEntry( "Login", login ); |
429 | conf->writeEntry( "User", user ); | 429 | conf->writeEntry( "User", user ); |
430 | conf->writeEntryCrypt( "Password", password ); | 430 | conf->writeEntryCrypt( "Password", password ); |
431 | conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); | 431 | conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); |
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index e2cea7a..ba78c3b 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp | |||
@@ -106,25 +106,25 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { | |||
106 | 106 | ||
107 | from = data = 0; | 107 | from = data = 0; |
108 | 108 | ||
109 | mailmessage * msg = 0; | 109 | mailmessage * msg = 0; |
110 | msg = mime_message_init(mail); | 110 | msg = mime_message_init(mail); |
111 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 111 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
112 | int r = mailmessage_fetch(msg,&data,&size); | 112 | int r = mailmessage_fetch(msg,&data,&size); |
113 | mime_message_detach_mime(msg); | 113 | mime_message_detach_mime(msg); |
114 | mailmessage_free(msg); | 114 | mailmessage_free(msg); |
115 | if (r != MAIL_NO_ERROR || !data) { | 115 | if (r != MAIL_NO_ERROR || !data) { |
116 | if (data) | 116 | if (data) |
117 | free(data); | 117 | free(data); |
118 | qDebug("Error fetching mime..."); | 118 | odebug << "Error fetching mime..." << oendl; |
119 | return; | 119 | return; |
120 | } | 120 | } |
121 | msg = 0; | 121 | msg = 0; |
122 | if (later) { | 122 | if (later) { |
123 | storeMail(data,size,"Outgoing"); | 123 | storeMail(data,size,"Outgoing"); |
124 | if (data) | 124 | if (data) |
125 | free( data ); | 125 | free( data ); |
126 | Config cfg( "mail" ); | 126 | Config cfg( "mail" ); |
127 | cfg.setGroup( "Status" ); | 127 | cfg.setGroup( "Status" ); |
128 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | 128 | cfg.writeEntry( "outgoing", ++m_queuedMail ); |
129 | emit queuedMails( m_queuedMail ); | 129 | emit queuedMails( m_queuedMail ); |
130 | return; | 130 | return; |
@@ -199,34 +199,34 @@ void SMTPwrapper::connect_server() | |||
199 | } | 199 | } |
200 | int result = 1; | 200 | int result = 1; |
201 | port = m_SmtpAccount->getPort().toUInt(); | 201 | port = m_SmtpAccount->getPort().toUInt(); |
202 | 202 | ||
203 | m_smtp = mailsmtp_new( 20, &progress ); | 203 | m_smtp = mailsmtp_new( 20, &progress ); |
204 | if ( m_smtp == NULL ) { | 204 | if ( m_smtp == NULL ) { |
205 | /* no failure message cause this happens when problems with memory - than we | 205 | /* no failure message cause this happens when problems with memory - than we |
206 | we can not display any messagebox */ | 206 | we can not display any messagebox */ |
207 | return; | 207 | return; |
208 | } | 208 | } |
209 | 209 | ||
210 | int err = MAILSMTP_NO_ERROR; | 210 | int err = MAILSMTP_NO_ERROR; |
211 | qDebug( "Servername %s at port %i", server, port ); | 211 | odebug << "Servername " << server << " at port " << port << "" << oendl; |
212 | if ( ssl ) { | 212 | if ( ssl ) { |
213 | qDebug( "SSL session" ); | 213 | odebug << "SSL session" << oendl; |
214 | err = mailsmtp_ssl_connect( m_smtp, server, port ); | 214 | err = mailsmtp_ssl_connect( m_smtp, server, port ); |
215 | } else { | 215 | } else { |
216 | qDebug( "No SSL session" ); | 216 | odebug << "No SSL session" << oendl; |
217 | err = mailsmtp_socket_connect( m_smtp, server, port ); | 217 | err = mailsmtp_socket_connect( m_smtp, server, port ); |
218 | } | 218 | } |
219 | if ( err != MAILSMTP_NO_ERROR ) { | 219 | if ( err != MAILSMTP_NO_ERROR ) { |
220 | qDebug("Error init connection"); | 220 | odebug << "Error init connection" << oendl; |
221 | failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); | 221 | failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); |
222 | result = 0; | 222 | result = 0; |
223 | } | 223 | } |
224 | 224 | ||
225 | /* switch to tls after init 'cause there it will send the ehlo */ | 225 | /* switch to tls after init 'cause there it will send the ehlo */ |
226 | if (result) { | 226 | if (result) { |
227 | err = mailsmtp_init( m_smtp ); | 227 | err = mailsmtp_init( m_smtp ); |
228 | if (err != MAILSMTP_NO_ERROR) { | 228 | if (err != MAILSMTP_NO_ERROR) { |
229 | result = 0; | 229 | result = 0; |
230 | failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); | 230 | failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err)); |
231 | } | 231 | } |
232 | } | 232 | } |
@@ -237,47 +237,47 @@ void SMTPwrapper::connect_server() | |||
237 | try_tls = false; | 237 | try_tls = false; |
238 | } else { | 238 | } else { |
239 | err = mailesmtp_ehlo(m_smtp); | 239 | err = mailesmtp_ehlo(m_smtp); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | if (!try_tls && force_tls) { | 243 | if (!try_tls && force_tls) { |
244 | result = 0; | 244 | result = 0; |
245 | failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); | 245 | failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err)); |
246 | } | 246 | } |
247 | 247 | ||
248 | if (result==1 && m_SmtpAccount->getLogin() ) { | 248 | if (result==1 && m_SmtpAccount->getLogin() ) { |
249 | qDebug("smtp with auth"); | 249 | odebug << "smtp with auth" << oendl; |
250 | if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { | 250 | if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { |
251 | // get'em | 251 | // get'em |
252 | LoginDialog login( m_SmtpAccount->getUser(), | 252 | LoginDialog login( m_SmtpAccount->getUser(), |
253 | m_SmtpAccount->getPassword(), NULL, 0, true ); | 253 | m_SmtpAccount->getPassword(), NULL, 0, true ); |
254 | login.show(); | 254 | login.show(); |
255 | if ( QDialog::Accepted == login.exec() ) { | 255 | if ( QDialog::Accepted == login.exec() ) { |
256 | // ok | 256 | // ok |
257 | user = login.getUser().latin1(); | 257 | user = login.getUser().latin1(); |
258 | pass = login.getPassword().latin1(); | 258 | pass = login.getPassword().latin1(); |
259 | } else { | 259 | } else { |
260 | result = 0; | 260 | result = 0; |
261 | failuretext=tr("Login aborted - storing mail to localfolder"); | 261 | failuretext=tr("Login aborted - storing mail to localfolder"); |
262 | } | 262 | } |
263 | } else { | 263 | } else { |
264 | user = m_SmtpAccount->getUser().latin1(); | 264 | user = m_SmtpAccount->getUser().latin1(); |
265 | pass = m_SmtpAccount->getPassword().latin1(); | 265 | pass = m_SmtpAccount->getPassword().latin1(); |
266 | } | 266 | } |
267 | qDebug( "session->auth: %i", m_smtp->auth); | 267 | odebug << "session->auth: " << m_smtp->auth << "" << oendl; |
268 | if (result) { | 268 | if (result) { |
269 | err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass ); | 269 | err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass ); |
270 | if ( err == MAILSMTP_NO_ERROR ) { | 270 | if ( err == MAILSMTP_NO_ERROR ) { |
271 | qDebug("auth ok"); | 271 | odebug << "auth ok" << oendl; |
272 | } else { | 272 | } else { |
273 | failuretext = tr("Authentification failed"); | 273 | failuretext = tr("Authentification failed"); |
274 | result = 0; | 274 | result = 0; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | void SMTPwrapper::disc_server() | 280 | void SMTPwrapper::disc_server() |
281 | { | 281 | { |
282 | if (m_smtp) { | 282 | if (m_smtp) { |
283 | mailsmtp_quit( m_smtp ); | 283 | mailsmtp_quit( m_smtp ); |
@@ -298,43 +298,43 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) | |||
298 | err = mailsmtp_send( m_smtp, from, rcpts, data, size ); | 298 | err = mailsmtp_send( m_smtp, from, rcpts, data, size ); |
299 | if ( err != MAILSMTP_NO_ERROR ) { | 299 | if ( err != MAILSMTP_NO_ERROR ) { |
300 | failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); | 300 | failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err)); |
301 | result = 0; | 301 | result = 0; |
302 | } | 302 | } |
303 | } else { | 303 | } else { |
304 | result = 0; | 304 | result = 0; |
305 | } | 305 | } |
306 | 306 | ||
307 | if (!result) { | 307 | if (!result) { |
308 | storeFailedMail(data,size,failuretext); | 308 | storeFailedMail(data,size,failuretext); |
309 | } else { | 309 | } else { |
310 | qDebug( "Mail sent." ); | 310 | odebug << "Mail sent." << oendl; |
311 | storeMail(data,size,"Sent"); | 311 | storeMail(data,size,"Sent"); |
312 | } | 312 | } |
313 | return result; | 313 | return result; |
314 | } | 314 | } |
315 | 315 | ||
316 | void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) | 316 | void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) |
317 | { | 317 | { |
318 | mailmime * mimeMail; | 318 | mailmime * mimeMail; |
319 | 319 | ||
320 | mimeMail = createMimeMail(mail ); | 320 | mimeMail = createMimeMail(mail ); |
321 | if ( mimeMail == NULL ) { | 321 | if ( mimeMail == NULL ) { |
322 | qDebug( "sendMail: error creating mime mail" ); | 322 | odebug << "sendMail: error creating mime mail" << oendl; |
323 | } else { | 323 | } else { |
324 | sendProgress = new progressMailSend(); | 324 | sendProgress = new progressMailSend(); |
325 | sendProgress->show(); | 325 | sendProgress->show(); |
326 | sendProgress->setMaxMails(1); | 326 | sendProgress->setMaxMails(1); |
327 | smtpSend( mimeMail,later); | 327 | smtpSend( mimeMail,later); |
328 | qDebug("Clean up done"); | 328 | odebug << "Clean up done" << oendl; |
329 | sendProgress->hide(); | 329 | sendProgress->hide(); |
330 | delete sendProgress; | 330 | delete sendProgress; |
331 | sendProgress = 0; | 331 | sendProgress = 0; |
332 | mailmime_free( mimeMail ); | 332 | mailmime_free( mimeMail ); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | ||
336 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { | 336 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { |
337 | size_t curTok = 0; | 337 | size_t curTok = 0; |
338 | mailimf_fields *fields = 0; | 338 | mailimf_fields *fields = 0; |
339 | mailimf_field*ffrom = 0; | 339 | mailimf_field*ffrom = 0; |
340 | clist *rcpts = 0; | 340 | clist *rcpts = 0; |
@@ -369,45 +369,45 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { | |||
369 | free(from); | 369 | free(from); |
370 | } | 370 | } |
371 | if (rcpts) { | 371 | if (rcpts) { |
372 | smtp_address_list_free( rcpts ); | 372 | smtp_address_list_free( rcpts ); |
373 | } | 373 | } |
374 | return res; | 374 | return res; |
375 | } | 375 | } |
376 | 376 | ||
377 | /* this is a special fun */ | 377 | /* this is a special fun */ |
378 | bool SMTPwrapper::flushOutbox() { | 378 | bool SMTPwrapper::flushOutbox() { |
379 | bool returnValue = true; | 379 | bool returnValue = true; |
380 | 380 | ||
381 | qDebug("Sending the queue"); | 381 | odebug << "Sending the queue" << oendl; |
382 | if (!m_SmtpAccount) { | 382 | if (!m_SmtpAccount) { |
383 | qDebug("No smtp account given"); | 383 | odebug << "No smtp account given" << oendl; |
384 | return false; | 384 | return false; |
385 | } | 385 | } |
386 | 386 | ||
387 | bool reset_user_value = false; | 387 | bool reset_user_value = false; |
388 | QString localfolders = AbstractMail::defaultLocalfolder(); | 388 | QString localfolders = AbstractMail::defaultLocalfolder(); |
389 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 389 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
390 | if (!wrap) { | 390 | if (!wrap) { |
391 | qDebug("memory error"); | 391 | odebug << "memory error" << oendl; |
392 | return false; | 392 | return false; |
393 | } | 393 | } |
394 | QString oldPw, oldUser; | 394 | QString oldPw, oldUser; |
395 | QValueList<RecMailP> mailsToSend; | 395 | QValueList<RecMailP> mailsToSend; |
396 | QValueList<RecMailP> mailsToRemove; | 396 | QValueList<RecMailP> mailsToRemove; |
397 | QString mbox("Outgoing"); | 397 | QString mbox("Outgoing"); |
398 | wrap->listMessages(mbox,mailsToSend); | 398 | wrap->listMessages(mbox,mailsToSend); |
399 | if (mailsToSend.count()==0) { | 399 | if (mailsToSend.count()==0) { |
400 | delete wrap; | 400 | delete wrap; |
401 | qDebug("No mails to send"); | 401 | odebug << "No mails to send" << oendl; |
402 | return false; | 402 | return false; |
403 | } | 403 | } |
404 | 404 | ||
405 | oldPw = m_SmtpAccount->getPassword(); | 405 | oldPw = m_SmtpAccount->getPassword(); |
406 | oldUser = m_SmtpAccount->getUser(); | 406 | oldUser = m_SmtpAccount->getUser(); |
407 | if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { | 407 | if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { |
408 | // get'em | 408 | // get'em |
409 | QString user,pass; | 409 | QString user,pass; |
410 | LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); | 410 | LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); |
411 | login.show(); | 411 | login.show(); |
412 | if ( QDialog::Accepted == login.exec() ) { | 412 | if ( QDialog::Accepted == login.exec() ) { |
413 | // ok | 413 | // ok |
diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp index b78244d..51383f6 100644 --- a/noncore/net/mail/libmailwrapper/statusmail.cpp +++ b/noncore/net/mail/libmailwrapper/statusmail.cpp | |||
@@ -34,25 +34,25 @@ void StatusMail::initAccounts(QList<Account>&accounts) | |||
34 | currentImapStat.message_count+=currentStat.message_unseen; | 34 | currentImapStat.message_count+=currentStat.message_unseen; |
35 | currentImapStat.message_count+=currentStat.message_recent; | 35 | currentImapStat.message_count+=currentStat.message_recent; |
36 | currentImapStat.message_count+=currentStat.message_count; | 36 | currentImapStat.message_count+=currentStat.message_count; |
37 | } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) { | 37 | } else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) { |
38 | POP3account *pop3 = static_cast<POP3account *>(it); | 38 | POP3account *pop3 = static_cast<POP3account *>(it); |
39 | current = AbstractMail::getWrapper(pop3); | 39 | current = AbstractMail::getWrapper(pop3); |
40 | connectionList.append(current); | 40 | connectionList.append(current); |
41 | current->statusFolder(currentStat); | 41 | current->statusFolder(currentStat); |
42 | currentPop3Stat.message_count+=currentStat.message_count; | 42 | currentPop3Stat.message_count+=currentStat.message_count; |
43 | } | 43 | } |
44 | current->logout(); | 44 | current->logout(); |
45 | } | 45 | } |
46 | qDebug("Pop3 init count: %i",currentPop3Stat.message_count); | 46 | odebug << "Pop3 init count: " << currentPop3Stat.message_count << "" << oendl; |
47 | currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; | 47 | currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; |
48 | lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; | 48 | lastPop3Stat.message_unseen = currentPop3Stat.message_unseen; |
49 | lastPop3Stat.message_recent = currentPop3Stat.message_recent; | 49 | lastPop3Stat.message_recent = currentPop3Stat.message_recent; |
50 | lastPop3Stat.message_count = currentPop3Stat.message_count; | 50 | lastPop3Stat.message_count = currentPop3Stat.message_count; |
51 | } | 51 | } |
52 | 52 | ||
53 | void StatusMail::reset_status() | 53 | void StatusMail::reset_status() |
54 | { | 54 | { |
55 | lastPop3Stat = currentPop3Stat; | 55 | lastPop3Stat = currentPop3Stat; |
56 | } | 56 | } |
57 | 57 | ||
58 | void StatusMail::check_current_stat(folderStat&targetStat) | 58 | void StatusMail::check_current_stat(folderStat&targetStat) |
@@ -63,28 +63,28 @@ void StatusMail::check_current_stat(folderStat&targetStat) | |||
63 | currentPop3Stat.message_count = 0; | 63 | currentPop3Stat.message_count = 0; |
64 | currentPop3Stat.message_unseen = 0; | 64 | currentPop3Stat.message_unseen = 0; |
65 | currentImapStat = currentPop3Stat; | 65 | currentImapStat = currentPop3Stat; |
66 | for ( it = connectionList.first(); it; it = connectionList.next() ) { | 66 | for ( it = connectionList.first(); it; it = connectionList.next() ) { |
67 | it->statusFolder(currentStat); | 67 | it->statusFolder(currentStat); |
68 | it->logout(); | 68 | it->logout(); |
69 | if (it->getType() == MAILLIB::A_IMAP) { | 69 | if (it->getType() == MAILLIB::A_IMAP) { |
70 | currentImapStat.message_unseen+=currentStat.message_unseen; | 70 | currentImapStat.message_unseen+=currentStat.message_unseen; |
71 | currentImapStat.message_recent+=currentStat.message_recent; | 71 | currentImapStat.message_recent+=currentStat.message_recent; |
72 | currentImapStat.message_count+=currentStat.message_count; | 72 | currentImapStat.message_count+=currentStat.message_count; |
73 | } else if (it->getType() == MAILLIB::A_POP3) { | 73 | } else if (it->getType() == MAILLIB::A_POP3) { |
74 | currentPop3Stat.message_count+=currentStat.message_count; | 74 | currentPop3Stat.message_count+=currentStat.message_count; |
75 | qDebug("Pop3 count: %i",currentPop3Stat.message_count); | 75 | odebug << "Pop3 count: " << currentPop3Stat.message_count << "" << oendl; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | qDebug("Pop3 last: %i",lastPop3Stat.message_count); | 78 | odebug << "Pop3 last: " << lastPop3Stat.message_count << "" << oendl; |
79 | if (currentPop3Stat.message_count > lastPop3Stat.message_count) { | 79 | if (currentPop3Stat.message_count > lastPop3Stat.message_count) { |
80 | currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; | 80 | currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count; |
81 | currentPop3Stat.message_unseen = currentPop3Stat.message_recent; | 81 | currentPop3Stat.message_unseen = currentPop3Stat.message_recent; |
82 | } else { | 82 | } else { |
83 | lastPop3Stat.message_count = currentPop3Stat.message_count; | 83 | lastPop3Stat.message_count = currentPop3Stat.message_count; |
84 | currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; | 84 | currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0; |
85 | } | 85 | } |
86 | targetStat = currentImapStat; | 86 | targetStat = currentImapStat; |
87 | targetStat.message_unseen+=currentPop3Stat.message_unseen; | 87 | targetStat.message_unseen+=currentPop3Stat.message_unseen; |
88 | targetStat.message_recent+=currentPop3Stat.message_recent; | 88 | targetStat.message_recent+=currentPop3Stat.message_recent; |
89 | targetStat.message_count+=currentPop3Stat.message_count; | 89 | targetStat.message_count+=currentPop3Stat.message_count; |
90 | } | 90 | } |
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp index 914a11d..546d756 100644 --- a/noncore/net/mail/libmailwrapper/storemail.cpp +++ b/noncore/net/mail/libmailwrapper/storemail.cpp | |||
@@ -49,40 +49,40 @@ Storemail::Storemail(const QString&aFolder) | |||
49 | Storemail::~Storemail() | 49 | Storemail::~Storemail() |
50 | { | 50 | { |
51 | } | 51 | } |
52 | 52 | ||
53 | int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) | 53 | int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail) |
54 | { | 54 | { |
55 | if (!wrapper) return 0; | 55 | if (!wrapper) return 0; |
56 | int ret = 1; | 56 | int ret = 1; |
57 | 57 | ||
58 | mailmime * mimeMail = 0; | 58 | mailmime * mimeMail = 0; |
59 | mimeMail = createMimeMail(mail ); | 59 | mimeMail = createMimeMail(mail ); |
60 | if ( mimeMail == NULL ) { | 60 | if ( mimeMail == NULL ) { |
61 | qDebug( "storeMail: error creating mime mail" ); | 61 | odebug << "storeMail: error creating mime mail" << oendl; |
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
64 | char *data; | 64 | char *data; |
65 | size_t size; | 65 | size_t size; |
66 | data = 0; | 66 | data = 0; |
67 | 67 | ||
68 | mailmessage * msg = 0; | 68 | mailmessage * msg = 0; |
69 | msg = mime_message_init(mimeMail); | 69 | msg = mime_message_init(mimeMail); |
70 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 70 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
71 | int r = mailmessage_fetch(msg,&data,&size); | 71 | int r = mailmessage_fetch(msg,&data,&size); |
72 | mime_message_detach_mime(msg); | 72 | mime_message_detach_mime(msg); |
73 | mailmessage_free(msg); | 73 | mailmessage_free(msg); |
74 | msg = 0; | 74 | msg = 0; |
75 | if (r != MAIL_NO_ERROR || !data) { | 75 | if (r != MAIL_NO_ERROR || !data) { |
76 | qDebug("Error fetching mime..."); | 76 | odebug << "Error fetching mime..." << oendl; |
77 | ret = 0; | 77 | ret = 0; |
78 | } | 78 | } |
79 | 79 | ||
80 | if (ret) { | 80 | if (ret) { |
81 | wrapper->storeMessage(data,size,m_tfolder); | 81 | wrapper->storeMessage(data,size,m_tfolder); |
82 | } | 82 | } |
83 | 83 | ||
84 | if (data) { | 84 | if (data) { |
85 | free(data); | 85 | free(data); |
86 | } | 86 | } |
87 | if (mimeMail) { | 87 | if (mimeMail) { |
88 | mailmime_free( mimeMail ); | 88 | mailmime_free( mimeMail ); |
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index c23ad3f..4c87d64 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -132,25 +132,25 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
132 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); | 132 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 135 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
136 | } | 136 | } |
137 | 137 | ||
138 | MainWindow::~MainWindow() | 138 | MainWindow::~MainWindow() |
139 | { | 139 | { |
140 | } | 140 | } |
141 | 141 | ||
142 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 142 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
143 | { | 143 | { |
144 | qDebug("appMessage not reached"); | 144 | odebug << "appMessage not reached" << oendl; |
145 | } | 145 | } |
146 | 146 | ||
147 | void MainWindow::slotAdjustLayout() { | 147 | void MainWindow::slotAdjustLayout() { |
148 | 148 | ||
149 | QWidget *d = QApplication::desktop(); | 149 | QWidget *d = QApplication::desktop(); |
150 | 150 | ||
151 | if ( d->width() < d->height() ) { | 151 | if ( d->width() < d->height() ) { |
152 | layout->setDirection( QBoxLayout::TopToBottom ); | 152 | layout->setDirection( QBoxLayout::TopToBottom ); |
153 | } else { | 153 | } else { |
154 | layout->setDirection( QBoxLayout::LeftToRight ); | 154 | layout->setDirection( QBoxLayout::LeftToRight ); |
155 | } | 155 | } |
156 | } | 156 | } |
@@ -166,50 +166,50 @@ void MainWindow::slotAdjustColumns() | |||
166 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 166 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); |
167 | mailView->setColumnWidth( 2, 80 ); | 167 | mailView->setColumnWidth( 2, 80 ); |
168 | mailView->setColumnWidth( 3, 50 ); | 168 | mailView->setColumnWidth( 3, 50 ); |
169 | mailView->setColumnWidth( 4, 50 ); | 169 | mailView->setColumnWidth( 4, 50 ); |
170 | } | 170 | } |
171 | 171 | ||
172 | void MainWindow::slotEditSettings() | 172 | void MainWindow::slotEditSettings() |
173 | { | 173 | { |
174 | } | 174 | } |
175 | 175 | ||
176 | void MainWindow::slotShowFolders( bool ) | 176 | void MainWindow::slotShowFolders( bool ) |
177 | { | 177 | { |
178 | qDebug( "slotShowFolders not reached" ); | 178 | odebug << "slotShowFolders not reached" << oendl; |
179 | } | 179 | } |
180 | 180 | ||
181 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 181 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
182 | { | 182 | { |
183 | qDebug( "refreshMailView not reached" ); | 183 | odebug << "refreshMailView not reached" << oendl; |
184 | } | 184 | } |
185 | 185 | ||
186 | void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) | 186 | void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) |
187 | { | 187 | { |
188 | qDebug( "mailLeftClicked not reached" ); | 188 | odebug << "mailLeftClicked not reached" << oendl; |
189 | } | 189 | } |
190 | 190 | ||
191 | void MainWindow::displayMail() | 191 | void MainWindow::displayMail() |
192 | { | 192 | { |
193 | qDebug("displayMail not reached"); | 193 | odebug << "displayMail not reached" << oendl; |
194 | } | 194 | } |
195 | 195 | ||
196 | void MainWindow::slotDeleteMail() | 196 | void MainWindow::slotDeleteMail() |
197 | { | 197 | { |
198 | qDebug("deleteMail not reached"); | 198 | odebug << "deleteMail not reached" << oendl; |
199 | } | 199 | } |
200 | 200 | ||
201 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 201 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
202 | { | 202 | { |
203 | qDebug("mailHold not reached"); | 203 | odebug << "mailHold not reached" << oendl; |
204 | } | 204 | } |
205 | 205 | ||
206 | void MainWindow::slotSendQueued() | 206 | void MainWindow::slotSendQueued() |
207 | { | 207 | { |
208 | } | 208 | } |
209 | 209 | ||
210 | void MainWindow::slotEditAccounts() | 210 | void MainWindow::slotEditAccounts() |
211 | { | 211 | { |
212 | } | 212 | } |
213 | 213 | ||
214 | void MainWindow::slotComposeMail() | 214 | void MainWindow::slotComposeMail() |
215 | { | 215 | { |
diff --git a/noncore/net/mail/nntpgroups.cpp b/noncore/net/mail/nntpgroups.cpp index 8741c4b..3243ee3 100644 --- a/noncore/net/mail/nntpgroups.cpp +++ b/noncore/net/mail/nntpgroups.cpp | |||
@@ -44,19 +44,19 @@ void NNTPGroups::fillGroups() | |||
44 | item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); | 44 | item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox ); |
45 | item->setOn( true ); | 45 | item->setOn( true ); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | void NNTPGroups::storeValues() | 49 | void NNTPGroups::storeValues() |
50 | { | 50 | { |
51 | if (!m_Account) return; | 51 | if (!m_Account) return; |
52 | QListViewItemIterator list_it( GroupListView ); | 52 | QListViewItemIterator list_it( GroupListView ); |
53 | subscribedGroups.clear(); | 53 | subscribedGroups.clear(); |
54 | for ( ; list_it.current(); ++list_it ) { | 54 | for ( ; list_it.current(); ++list_it ) { |
55 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { | 55 | if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { |
56 | qDebug(list_it.current()->text(0) ); | 56 | odebug << list_it.current()->text(0) << oendl; |
57 | subscribedGroups.append( list_it.current()->text(0) ); | 57 | subscribedGroups.append( list_it.current()->text(0) ); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | subscribedGroups+=subscribedGroupsNotListed; | 60 | subscribedGroups+=subscribedGroupsNotListed; |
61 | m_Account->setGroups( subscribedGroups ); | 61 | m_Account->setGroups( subscribedGroups ); |
62 | } | 62 | } |
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 5da2161..0669b5a 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -58,31 +58,31 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) | |||
58 | } | 58 | } |
59 | else | 59 | else |
60 | { | 60 | { |
61 | compose.setTo(email); | 61 | compose.setTo(email); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | compose.slotAdjustColumns(); | 64 | compose.slotAdjustColumns(); |
65 | QPEApplication::execDialog( &compose ); | 65 | QPEApplication::execDialog( &compose ); |
66 | } | 66 | } |
67 | 67 | ||
68 | void OpieMail::slotComposeMail() | 68 | void OpieMail::slotComposeMail() |
69 | { | 69 | { |
70 | qDebug( "Compose Mail" ); | 70 | odebug << "Compose Mail" << oendl; |
71 | slotwriteMail(0l,0l); | 71 | slotwriteMail(0l,0l); |
72 | } | 72 | } |
73 | 73 | ||
74 | void OpieMail::slotSendQueued() | 74 | void OpieMail::slotSendQueued() |
75 | { | 75 | { |
76 | qDebug( "Send Queued" ); | 76 | odebug << "Send Queued" << oendl; |
77 | SMTPaccount *smtp = 0; | 77 | SMTPaccount *smtp = 0; |
78 | 78 | ||
79 | QList<Account> list = settings->getAccounts(); | 79 | QList<Account> list = settings->getAccounts(); |
80 | QList<SMTPaccount> smtpList; | 80 | QList<SMTPaccount> smtpList; |
81 | smtpList.setAutoDelete(false); | 81 | smtpList.setAutoDelete(false); |
82 | Account *it; | 82 | Account *it; |
83 | for ( it = list.first(); it; it = list.next() ) | 83 | for ( it = list.first(); it; it = list.next() ) |
84 | { | 84 | { |
85 | if ( it->getType() == MAILLIB::A_SMTP ) | 85 | if ( it->getType() == MAILLIB::A_SMTP ) |
86 | { | 86 | { |
87 | smtp = static_cast<SMTPaccount *>(it); | 87 | smtp = static_cast<SMTPaccount *>(it); |
88 | smtpList.append(smtp); | 88 | smtpList.append(smtp); |
@@ -111,36 +111,36 @@ void OpieMail::slotSendQueued() | |||
111 | { | 111 | { |
112 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 112 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
113 | if ( wrap->flushOutbox() ) | 113 | if ( wrap->flushOutbox() ) |
114 | { | 114 | { |
115 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 115 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
116 | } | 116 | } |
117 | delete wrap; | 117 | delete wrap; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | void OpieMail::slotSearchMails() | 121 | void OpieMail::slotSearchMails() |
122 | { | 122 | { |
123 | qDebug( "Search Mails" ); | 123 | odebug << "Search Mails" << oendl; |
124 | } | 124 | } |
125 | 125 | ||
126 | void OpieMail::slotEditSettings() | 126 | void OpieMail::slotEditSettings() |
127 | { | 127 | { |
128 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 128 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
129 | QPEApplication::execDialog( &settingsDialog ); | 129 | QPEApplication::execDialog( &settingsDialog ); |
130 | } | 130 | } |
131 | 131 | ||
132 | void OpieMail::slotEditAccounts() | 132 | void OpieMail::slotEditAccounts() |
133 | { | 133 | { |
134 | qDebug( "Edit Accounts" ); | 134 | odebug << "Edit Accounts" << oendl; |
135 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 135 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
136 | eaDialog.slotAdjustColumns(); | 136 | eaDialog.slotAdjustColumns(); |
137 | QPEApplication::execDialog( &eaDialog ); | 137 | QPEApplication::execDialog( &eaDialog ); |
138 | if ( settings ) delete settings; | 138 | if ( settings ) delete settings; |
139 | settings = new Settings(); | 139 | settings = new Settings(); |
140 | 140 | ||
141 | folderView->populate( settings->getAccounts() ); | 141 | folderView->populate( settings->getAccounts() ); |
142 | } | 142 | } |
143 | 143 | ||
144 | void OpieMail::displayMail() | 144 | void OpieMail::displayMail() |
145 | { | 145 | { |
146 | QListViewItem*item = mailView->currentItem(); | 146 | QListViewItem*item = mailView->currentItem(); |
@@ -171,57 +171,57 @@ void OpieMail::slotDeleteMail() | |||
171 | { | 171 | { |
172 | mail->Wrapper()->deleteMail( mail ); | 172 | mail->Wrapper()->deleteMail( mail ); |
173 | folderView->refreshCurrent(); | 173 | folderView->refreshCurrent(); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 177 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
178 | { | 178 | { |
179 | if (!mailView->currentItem()) return; | 179 | if (!mailView->currentItem()) return; |
180 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 180 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
181 | /* just the RIGHT button - or hold on pda */ | 181 | /* just the RIGHT button - or hold on pda */ |
182 | if (button!=2) {return;} | 182 | if (button!=2) {return;} |
183 | qDebug("Event right/hold"); | 183 | odebug << "Event right/hold" << oendl; |
184 | if (!item) return; | 184 | if (!item) return; |
185 | QPopupMenu *m = new QPopupMenu(0); | 185 | QPopupMenu *m = new QPopupMenu(0); |
186 | if (m) | 186 | if (m) |
187 | { | 187 | { |
188 | if (mailtype==MAILLIB::A_NNTP) { | 188 | if (mailtype==MAILLIB::A_NNTP) { |
189 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 189 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
190 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 190 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
191 | } else { | 191 | } else { |
192 | if (folderView->currentisDraft()) { | 192 | if (folderView->currentisDraft()) { |
193 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 193 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
194 | } | 194 | } |
195 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 195 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
196 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 196 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
197 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 197 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
198 | } | 198 | } |
199 | m->setFocus(); | 199 | m->setFocus(); |
200 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 200 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
201 | delete m; | 201 | delete m; |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | void OpieMail::slotShowFolders( bool show ) | 205 | void OpieMail::slotShowFolders( bool show ) |
206 | { | 206 | { |
207 | qDebug( "Show Folders" ); | 207 | odebug << "Show Folders" << oendl; |
208 | if ( show && folderView->isHidden() ) | 208 | if ( show && folderView->isHidden() ) |
209 | { | 209 | { |
210 | qDebug( "-> showing" ); | 210 | odebug << "-> showing" << oendl; |
211 | folderView->show(); | 211 | folderView->show(); |
212 | } | 212 | } |
213 | else if ( !show && !folderView->isHidden() ) | 213 | else if ( !show && !folderView->isHidden() ) |
214 | { | 214 | { |
215 | qDebug( "-> hiding" ); | 215 | odebug << "-> hiding" << oendl; |
216 | folderView->hide(); | 216 | folderView->hide(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 220 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
221 | { | 221 | { |
222 | MailListViewItem*item = 0; | 222 | MailListViewItem*item = 0; |
223 | mailView->clear(); | 223 | mailView->clear(); |
224 | 224 | ||
225 | QValueList<RecMailP>::ConstIterator it; | 225 | QValueList<RecMailP>::ConstIterator it; |
226 | for (it = list.begin(); it != list.end();++it) | 226 | for (it = list.begin(); it != list.end();++it) |
227 | { | 227 | { |
diff --git a/noncore/net/mail/taskbarapplet/mailapplet.cpp b/noncore/net/mail/taskbarapplet/mailapplet.cpp index f672a36..cac9048 100644 --- a/noncore/net/mail/taskbarapplet/mailapplet.cpp +++ b/noncore/net/mail/taskbarapplet/mailapplet.cpp | |||
@@ -95,25 +95,25 @@ void MailApplet::slotCheck() { | |||
95 | m_intervalTimer->changeInterval( newIntervalMs ); | 95 | m_intervalTimer->changeInterval( newIntervalMs ); |
96 | m_intervalMs = newIntervalMs; | 96 | m_intervalMs = newIntervalMs; |
97 | } | 97 | } |
98 | 98 | ||
99 | if (m_statusMail == 0) { | 99 | if (m_statusMail == 0) { |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | 102 | ||
103 | folderStat stat; | 103 | folderStat stat; |
104 | m_statusMail->check_current_stat( stat ); | 104 | m_statusMail->check_current_stat( stat ); |
105 | int newMailsOld = m_newMails; | 105 | int newMailsOld = m_newMails; |
106 | m_newMails = stat.message_unseen; | 106 | m_newMails = stat.message_unseen; |
107 | qDebug( QString( "test %1" ).arg( m_newMails ) ); | 107 | odebug << QString( "test %1" ).arg( m_newMails ) << oendl; |
108 | if ( m_newMails > 0 && newMailsOld != m_newMails ) { | 108 | if ( m_newMails > 0 && newMailsOld != m_newMails ) { |
109 | ODevice *device = ODevice::inst(); | 109 | ODevice *device = ODevice::inst(); |
110 | if ( isHidden() ) | 110 | if ( isHidden() ) |
111 | show(); | 111 | show(); |
112 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { | 112 | if ( m_config->readBoolEntry( "BlinkLed", true ) ) { |
113 | if ( !device->ledList().isEmpty() ) { | 113 | if ( !device->ledList().isEmpty() ) { |
114 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; | 114 | OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0]; |
115 | device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); | 115 | device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On ); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | if ( m_config->readBoolEntry( "PlaySound", false ) ) | 118 | if ( m_config->readBoolEntry( "PlaySound", false ) ) |
119 | device->playAlarmSound(); | 119 | device->playAlarmSound(); |
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 156e11d..a574ea1 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -130,25 +130,25 @@ void ViewMail::setBody(const RecBodyP&body ) | |||
130 | } | 130 | } |
131 | 131 | ||
132 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 132 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
133 | QString filename = ""; | 133 | QString filename = ""; |
134 | 134 | ||
135 | for (unsigned int i = 0; i < body->Parts().count();++i) | 135 | for (unsigned int i = 0; i < body->Parts().count();++i) |
136 | { | 136 | { |
137 | filename = ""; | 137 | filename = ""; |
138 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 138 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
139 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 139 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
140 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 140 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
141 | { | 141 | { |
142 | qDebug(it.key()); | 142 | odebug << it.key() << oendl; |
143 | if (it.key().lower()=="name") | 143 | if (it.key().lower()=="name") |
144 | { | 144 | { |
145 | filename=it.data(); | 145 | filename=it.data(); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | s = body->Parts()[i]->Size(); | 148 | s = body->Parts()[i]->Size(); |
149 | w = 0; | 149 | w = 0; |
150 | while (s>1024) | 150 | while (s>1024) |
151 | { | 151 | { |
152 | s/=1024; | 152 | s/=1024; |
153 | ++w; | 153 | ++w; |
154 | if (w>=2) break; | 154 | if (w>=2) break; |
diff --git a/noncore/net/opieftp/config.in b/noncore/net/opieftp/config.in index 96e8b27..95cf73c 100644 --- a/noncore/net/opieftp/config.in +++ b/noncore/net/opieftp/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config OPIEFTP | 1 | config OPIEFTP |
2 | boolean "opie-ftp (ftp client for Opie)" | 2 | boolean "opie-ftp (ftp client for Opie)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && FTPLIB |
diff --git a/noncore/net/opieftp/filePermissions.cpp b/noncore/net/opieftp/filePermissions.cpp index f545c1f..991fcd5 100644 --- a/noncore/net/opieftp/filePermissions.cpp +++ b/noncore/net/opieftp/filePermissions.cpp | |||
@@ -23,25 +23,25 @@ | |||
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <sys/types.h> | 26 | #include <sys/types.h> |
27 | #include <pwd.h> | 27 | #include <pwd.h> |
28 | #include <grp.h> | 28 | #include <grp.h> |
29 | 29 | ||
30 | filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote ) | 30 | filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote ) |
31 | : QDialog( parent, name, modal, fl ) | 31 | : QDialog( parent, name, modal, fl ) |
32 | { | 32 | { |
33 | if ( !name ) | 33 | if ( !name ) |
34 | setName( tr("filePermissions") ); | 34 | setName( tr("filePermissions") ); |
35 | // qDebug("FilePermissions "+fileName); | 35 | // odebug << "FilePermissions "+fileName << oendl; |
36 | resize( 236, 210 ); | 36 | resize( 236, 210 ); |
37 | isRemote=useRemote; | 37 | isRemote=useRemote; |
38 | setMaximumSize( QSize( 236, 210 ) ); | 38 | setMaximumSize( QSize( 236, 210 ) ); |
39 | setCaption( tr( "Set File Permissions" ) ); | 39 | setCaption( tr( "Set File Permissions" ) ); |
40 | 40 | ||
41 | TextLabel1 = new QLabel( this, "TextLabel1" ); | 41 | TextLabel1 = new QLabel( this, "TextLabel1" ); |
42 | TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); | 42 | TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); |
43 | TextLabel1->setText( tr( "Set file permissions for:" ) ); | 43 | TextLabel1->setText( tr( "Set file permissions for:" ) ); |
44 | 44 | ||
45 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 45 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
46 | LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); | 46 | LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); |
47 | LineEdit1->setReadOnly(true); | 47 | LineEdit1->setReadOnly(true); |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4c39569..fe96103 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -10,67 +10,70 @@ | |||
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | //#define DEVELOPERS_VERSION | 12 | //#define DEVELOPERS_VERSION |
13 | 13 | ||
14 | #include "opieftp.h" | 14 | #include "opieftp.h" |
15 | 15 | ||
16 | extern "C" { | 16 | extern "C" { |
17 | #include "../ftplib/ftplib.h" | 17 | #include "../ftplib/ftplib.h" |
18 | } | 18 | } |
19 | 19 | ||
20 | #include "inputDialog.h" | 20 | #include "inputDialog.h" |
21 | 21 | ||
22 | #include <qmenubar.h> | 22 | /* OPIE */ |
23 | #include <opie2/odebug.h> | ||
23 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
25 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
26 | #include <qpe/mimetype.h> | 27 | #include <qpe/mimetype.h> |
28 | using namespace Opie::Core; | ||
27 | 29 | ||
28 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
29 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
30 | #include <qtoolbutton.h> | 32 | #include <qtoolbutton.h> |
31 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
32 | #include <qlistview.h> | 34 | #include <qlistview.h> |
33 | #include <qlabel.h> | 35 | #include <qlabel.h> |
34 | #include <qprogressbar.h> | 36 | #include <qprogressbar.h> |
35 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
36 | #include <qtabwidget.h> | 38 | #include <qtabwidget.h> |
37 | #include <qlayout.h> | 39 | #include <qlayout.h> |
38 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
41 | #include <qmenubar.h> | ||
39 | #include <qlineedit.h> | 42 | #include <qlineedit.h> |
40 | #include <qlistbox.h> | 43 | #include <qlistbox.h> |
41 | #include <qvbox.h> | 44 | #include <qvbox.h> |
42 | 45 | ||
46 | /* STD */ | ||
43 | #include <unistd.h> | 47 | #include <unistd.h> |
44 | #include <stdlib.h> | 48 | #include <stdlib.h> |
45 | 49 | ||
46 | |||
47 | QProgressBar *ProgressBar; | 50 | QProgressBar *ProgressBar; |
48 | static netbuf *conn=NULL; | 51 | static netbuf *conn=NULL; |
49 | 52 | ||
50 | static int log_progress(netbuf *, int xfered, void *) | 53 | static int log_progress(netbuf *, int xfered, void *) |
51 | { | 54 | { |
52 | // int fsz = *(int *)arg; | 55 | // int fsz = *(int *)arg; |
53 | // int pct = (xfered * 100) / fsz; | 56 | // int pct = (xfered * 100) / fsz; |
54 | // printf("%3d%%\r", pct); | 57 | // printf("%3d%%\r", pct); |
55 | // fflush(stdout); | 58 | // fflush(stdout); |
56 | ProgressBar->setProgress(xfered); | 59 | ProgressBar->setProgress(xfered); |
57 | qApp->processEvents(); | 60 | qApp->processEvents(); |
58 | return 1; | 61 | return 1; |
59 | } | 62 | } |
60 | 63 | ||
61 | OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | 64 | OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) |
62 | : QMainWindow( parent, name, fl ) | 65 | : QMainWindow( parent, name, fl ) |
63 | { | 66 | { |
64 | qDebug("OpieFtp constructor"); | 67 | odebug << "OpieFtp constructor" << oendl; |
65 | setCaption( tr( "OpieFtp" ) ); | 68 | setCaption( tr( "OpieFtp" ) ); |
66 | fuckeduphack=FALSE; | 69 | fuckeduphack=FALSE; |
67 | 70 | ||
68 | QVBox* wrapperBox = new QVBox( this ); | 71 | QVBox* wrapperBox = new QVBox( this ); |
69 | setCentralWidget( wrapperBox ); | 72 | setCentralWidget( wrapperBox ); |
70 | 73 | ||
71 | QWidget *view = new QWidget( wrapperBox ); | 74 | QWidget *view = new QWidget( wrapperBox ); |
72 | 75 | ||
73 | QGridLayout *layout = new QGridLayout( view ); | 76 | QGridLayout *layout = new QGridLayout( view ); |
74 | layout->setSpacing( 2); | 77 | layout->setSpacing( 2); |
75 | layout->setMargin( 2); | 78 | layout->setMargin( 2); |
76 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 79 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
@@ -325,25 +328,25 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
325 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 328 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
326 | ProgressBar->setMaximumHeight(10); | 329 | ProgressBar->setMaximumHeight(10); |
327 | filterStr="*"; | 330 | filterStr="*"; |
328 | b=FALSE; | 331 | b=FALSE; |
329 | #if 0 | 332 | #if 0 |
330 | populateLocalView(); | 333 | populateLocalView(); |
331 | #endif | 334 | #endif |
332 | readConfig(); | 335 | readConfig(); |
333 | 336 | ||
334 | // ServerComboBox->setCurrentItem(currentServerConfig); | 337 | // ServerComboBox->setCurrentItem(currentServerConfig); |
335 | 338 | ||
336 | TabWidget->setCurrentPage(2); | 339 | TabWidget->setCurrentPage(2); |
337 | qDebug("Constructor done"); | 340 | odebug << "Constructor done" << oendl; |
338 | } | 341 | } |
339 | 342 | ||
340 | OpieFtp::~OpieFtp() | 343 | OpieFtp::~OpieFtp() |
341 | { | 344 | { |
342 | } | 345 | } |
343 | 346 | ||
344 | void OpieFtp::cleanUp() | 347 | void OpieFtp::cleanUp() |
345 | { | 348 | { |
346 | if(conn) | 349 | if(conn) |
347 | FtpQuit(conn); | 350 | FtpQuit(conn); |
348 | QString sfile=QDir::homeDirPath(); | 351 | QString sfile=QDir::homeDirPath(); |
349 | if(sfile.right(1) != "/") | 352 | if(sfile.right(1) != "/") |
@@ -396,25 +399,25 @@ void OpieFtp::newConnection() | |||
396 | { | 399 | { |
397 | UsernameComboBox->lineEdit()->setText(""); | 400 | UsernameComboBox->lineEdit()->setText(""); |
398 | PasswordEdit->setText( "" ); | 401 | PasswordEdit->setText( "" ); |
399 | ServerComboBox->lineEdit()->setText( ""); | 402 | ServerComboBox->lineEdit()->setText( ""); |
400 | remotePath->setText( currentRemoteDir = "/"); | 403 | remotePath->setText( currentRemoteDir = "/"); |
401 | PortSpinBox->setValue( 21); | 404 | PortSpinBox->setValue( 21); |
402 | TabWidget->setCurrentPage(2); | 405 | TabWidget->setCurrentPage(2); |
403 | } | 406 | } |
404 | 407 | ||
405 | void OpieFtp::serverComboEdited(const QString & ) | 408 | void OpieFtp::serverComboEdited(const QString & ) |
406 | { | 409 | { |
407 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 410 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
408 | // qDebug("ServerComboEdited"); | 411 | // odebug << "ServerComboEdited" << oendl; |
409 | // // currentServerConfig = -1; | 412 | // // currentServerConfig = -1; |
410 | // } | 413 | // } |
411 | } | 414 | } |
412 | 415 | ||
413 | void OpieFtp::UsernameComboBoxEdited(const QString &) { | 416 | void OpieFtp::UsernameComboBoxEdited(const QString &) { |
414 | // currentServerConfig = -1; | 417 | // currentServerConfig = -1; |
415 | } | 418 | } |
416 | 419 | ||
417 | void OpieFtp::PasswordEditEdited(const QString & ) { | 420 | void OpieFtp::PasswordEditEdited(const QString & ) { |
418 | // currentServerConfig = -1; | 421 | // currentServerConfig = -1; |
419 | } | 422 | } |
420 | 423 | ||
@@ -521,25 +524,25 @@ void OpieFtp::localUpload() | |||
521 | QString strItem = it.current()->text(0); | 524 | QString strItem = it.current()->text(0); |
522 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 525 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
523 | QString remoteFile= currentRemoteDir+strItem; | 526 | QString remoteFile= currentRemoteDir+strItem; |
524 | QFileInfo fi(localFile); | 527 | QFileInfo fi(localFile); |
525 | if( !fi.isDir()) { | 528 | if( !fi.isDir()) { |
526 | fsz=fi.size(); | 529 | fsz=fi.size(); |
527 | ProgressBar->setTotalSteps(fsz); | 530 | ProgressBar->setTotalSteps(fsz); |
528 | 531 | ||
529 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 532 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
530 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 533 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
531 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 534 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
532 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 535 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
533 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 536 | odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; |
534 | 537 | ||
535 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 538 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
536 | QString msg; | 539 | QString msg; |
537 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 540 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
538 | msg.replace(QRegExp(":"),"\n"); | 541 | msg.replace(QRegExp(":"),"\n"); |
539 | QMessageBox::message(tr("Note"),msg); | 542 | QMessageBox::message(tr("Note"),msg); |
540 | } | 543 | } |
541 | } else { | 544 | } else { |
542 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 545 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
543 | } | 546 | } |
544 | ProgressBar->reset(); | 547 | ProgressBar->reset(); |
545 | nullifyCallBack(); | 548 | nullifyCallBack(); |
@@ -582,25 +585,25 @@ void OpieFtp::remoteDownload() | |||
582 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 585 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
583 | QString remoteFile= currentRemoteDir+strItem; | 586 | QString remoteFile= currentRemoteDir+strItem; |
584 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 587 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
585 | fsz = 0; | 588 | fsz = 0; |
586 | QString temp; | 589 | QString temp; |
587 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 590 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
588 | 591 | ||
589 | ProgressBar->setTotalSteps(fsz); | 592 | ProgressBar->setTotalSteps(fsz); |
590 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 593 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
591 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 594 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
592 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 595 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
593 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 596 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
594 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 597 | odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; |
595 | 598 | ||
596 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 599 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
597 | QString msg; | 600 | QString msg; |
598 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 601 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
599 | msg.replace(QRegExp(":"),"\n"); | 602 | msg.replace(QRegExp(":"),"\n"); |
600 | QMessageBox::message(tr("Note"),msg); | 603 | QMessageBox::message(tr("Note"),msg); |
601 | } | 604 | } |
602 | ProgressBar->reset(); | 605 | ProgressBar->reset(); |
603 | nullifyCallBack(); | 606 | nullifyCallBack(); |
604 | it.current()->setSelected(FALSE); | 607 | it.current()->setSelected(FALSE); |
605 | } | 608 | } |
606 | } | 609 | } |
@@ -611,82 +614,82 @@ void OpieFtp::remoteDownload() | |||
611 | TabWidget->setCurrentPage(0); | 614 | TabWidget->setCurrentPage(0); |
612 | populateLocalView(); | 615 | populateLocalView(); |
613 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 616 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
614 | } | 617 | } |
615 | 618 | ||
616 | bool OpieFtp::remoteDirList(const QString &dir) | 619 | bool OpieFtp::remoteDirList(const QString &dir) |
617 | { | 620 | { |
618 | QString tmp = QDir::homeDirPath(); | 621 | QString tmp = QDir::homeDirPath(); |
619 | if(tmp.right(1) != "/") | 622 | if(tmp.right(1) != "/") |
620 | tmp+="/._temp"; | 623 | tmp+="/._temp"; |
621 | else | 624 | else |
622 | tmp+="._temp"; | 625 | tmp+="._temp"; |
623 | // qDebug("Listing remote dir "+tmp); | 626 | // odebug << "Listing remote dir "+tmp << oendl; |
624 | // QCopEnvelope ( "QPE/System", "busy()" ); | 627 | // QCopEnvelope ( "QPE/System", "busy()" ); |
625 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 628 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
626 | QString msg; | 629 | QString msg; |
627 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 630 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
628 | msg.replace(QRegExp(":"),"\n"); | 631 | msg.replace(QRegExp(":"),"\n"); |
629 | QMessageBox::message(tr("Note"),msg); | 632 | QMessageBox::message(tr("Note"),msg); |
630 | return false; | 633 | return false; |
631 | } | 634 | } |
632 | populateRemoteView() ; | 635 | populateRemoteView() ; |
633 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 636 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
634 | return true; | 637 | return true; |
635 | } | 638 | } |
636 | 639 | ||
637 | bool OpieFtp::remoteChDir(const QString &dir) | 640 | bool OpieFtp::remoteChDir(const QString &dir) |
638 | { | 641 | { |
639 | // QCopEnvelope ( "QPE/System", "busy()" ); | 642 | // QCopEnvelope ( "QPE/System", "busy()" ); |
640 | if (!FtpChdir( dir.latin1(), conn )) { | 643 | if (!FtpChdir( dir.latin1(), conn )) { |
641 | QString msg; | 644 | QString msg; |
642 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 645 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
643 | msg.replace(QRegExp(":"),"\n"); | 646 | msg.replace(QRegExp(":"),"\n"); |
644 | QMessageBox::message(tr("Note"),msg); | 647 | QMessageBox::message(tr("Note"),msg); |
645 | // qDebug(msg); | 648 | // odebug << msg << oendl; |
646 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 649 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
647 | return FALSE; | 650 | return FALSE; |
648 | } | 651 | } |
649 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 652 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
650 | return TRUE; | 653 | return TRUE; |
651 | } | 654 | } |
652 | 655 | ||
653 | void OpieFtp::populateLocalView() | 656 | void OpieFtp::populateLocalView() |
654 | { | 657 | { |
655 | Local_View->clear(); | 658 | Local_View->clear(); |
656 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 659 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
657 | currentDir.setMatchAllDirs(TRUE); | 660 | currentDir.setMatchAllDirs(TRUE); |
658 | currentDir.setNameFilter(filterStr); | 661 | currentDir.setNameFilter(filterStr); |
659 | QString fileL, fileS, fileDate; | 662 | QString fileL, fileS, fileDate; |
660 | bool isDir=FALSE; | 663 | bool isDir=FALSE; |
661 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 664 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
662 | QFileInfoListIterator it(*list); | 665 | QFileInfoListIterator it(*list); |
663 | QFileInfo *fi; | 666 | QFileInfo *fi; |
664 | while ( (fi=it.current()) ) { | 667 | while ( (fi=it.current()) ) { |
665 | if (fi->isSymLink() ){ | 668 | if (fi->isSymLink() ){ |
666 | QString symLink=fi->readLink(); | 669 | QString symLink=fi->readLink(); |
667 | qDebug("Symlink detected "+symLink); | 670 | odebug << "Symlink detected "+symLink << oendl; |
668 | QFileInfo sym( symLink); | 671 | QFileInfo sym( symLink); |
669 | fileS.sprintf( "%10i", sym.size() ); | 672 | fileS.sprintf( "%10i", sym.size() ); |
670 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); | 673 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
671 | fileDate = sym.lastModified().toString(); | 674 | fileDate = sym.lastModified().toString(); |
672 | } else { | 675 | } else { |
673 | qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 676 | odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; |
674 | fileS.sprintf( "%10i", fi->size() ); | 677 | fileS.sprintf( "%10i", fi->size() ); |
675 | fileL.sprintf( "%s",fi->fileName().data() ); | 678 | fileL.sprintf( "%s",fi->fileName().data() ); |
676 | fileDate= fi->lastModified().toString(); | 679 | fileDate= fi->lastModified().toString(); |
677 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 680 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
678 | fileL+="/"; | 681 | fileL+="/"; |
679 | isDir=TRUE; | 682 | isDir=TRUE; |
680 | qDebug( fileL); | 683 | odebug << fileL << oendl; |
681 | } | 684 | } |
682 | } | 685 | } |
683 | if(fileL !="./" && fi->exists()) { | 686 | if(fileL !="./" && fi->exists()) { |
684 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); | 687 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); |
685 | QPixmap pm; | 688 | QPixmap pm; |
686 | 689 | ||
687 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 690 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
688 | if( !QDir( fi->filePath() ).isReadable()) | 691 | if( !QDir( fi->filePath() ).isReadable()) |
689 | pm = Resource::loadPixmap( "lockedfolder" ); | 692 | pm = Resource::loadPixmap( "lockedfolder" ); |
690 | else | 693 | else |
691 | pm= Resource::loadPixmap( "folder" ); | 694 | pm= Resource::loadPixmap( "folder" ); |
692 | item->setPixmap( 0,pm ); | 695 | item->setPixmap( 0,pm ); |
@@ -711,25 +714,25 @@ void OpieFtp::populateLocalView() | |||
711 | item->setPixmap( 0,pm); | 714 | item->setPixmap( 0,pm); |
712 | } | 715 | } |
713 | isDir=FALSE; | 716 | isDir=FALSE; |
714 | ++it; | 717 | ++it; |
715 | } | 718 | } |
716 | Local_View->setSorting( 3,FALSE); | 719 | Local_View->setSorting( 3,FALSE); |
717 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 720 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
718 | fillCombo( (const QString &)currentDir); | 721 | fillCombo( (const QString &)currentDir); |
719 | } | 722 | } |
720 | 723 | ||
721 | bool OpieFtp::populateRemoteView( ) | 724 | bool OpieFtp::populateRemoteView( ) |
722 | { | 725 | { |
723 | // qDebug("populate remoteview"); | 726 | // odebug << "populate remoteview" << oendl; |
724 | QString sfile=QDir::homeDirPath(); | 727 | QString sfile=QDir::homeDirPath(); |
725 | if(sfile.right(1) != "/") | 728 | if(sfile.right(1) != "/") |
726 | sfile+="/._temp"; | 729 | sfile+="/._temp"; |
727 | else | 730 | else |
728 | sfile+="._temp"; | 731 | sfile+="._temp"; |
729 | QFile file( sfile); | 732 | QFile file( sfile); |
730 | Remote_View->clear(); | 733 | Remote_View->clear(); |
731 | QString s, File_Name; | 734 | QString s, File_Name; |
732 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 735 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
733 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); | 736 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); |
734 | QString fileL, fileS, fileDate; | 737 | QString fileL, fileS, fileDate; |
735 | if ( file.open(IO_ReadOnly)) { | 738 | if ( file.open(IO_ReadOnly)) { |
@@ -760,69 +763,69 @@ bool OpieFtp::populateRemoteView( ) | |||
760 | // if(itemFile) | 763 | // if(itemFile) |
761 | item->moveItem(itemDir); | 764 | item->moveItem(itemDir); |
762 | item->moveItem(itemFile); | 765 | item->moveItem(itemFile); |
763 | itemFile=item; | 766 | itemFile=item; |
764 | } | 767 | } |
765 | } | 768 | } |
766 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 769 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
767 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 770 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
768 | file.close(); | 771 | file.close(); |
769 | if( file.exists()) | 772 | if( file.exists()) |
770 | file. remove(); | 773 | file. remove(); |
771 | } else | 774 | } else |
772 | qDebug("temp file not opened successfully "+sfile); | 775 | odebug << "temp file not opened successfully "+sfile << oendl; |
773 | Remote_View->setSorting( 4,TRUE); | 776 | Remote_View->setSorting( 4,TRUE); |
774 | return true; | 777 | return true; |
775 | } | 778 | } |
776 | 779 | ||
777 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 780 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
778 | { | 781 | { |
779 | if( selectedItem) { | 782 | if( selectedItem) { |
780 | // if(selectedItem!= NULL) { | 783 | // if(selectedItem!= NULL) { |
781 | // QCopEnvelope ( "QPE/System", "busy()" ); | 784 | // QCopEnvelope ( "QPE/System", "busy()" ); |
782 | QString oldRemoteCurrentDir = currentRemoteDir; | 785 | QString oldRemoteCurrentDir = currentRemoteDir; |
783 | QString strItem=selectedItem->text(0); | 786 | QString strItem=selectedItem->text(0); |
784 | strItem=strItem.simplifyWhiteSpace(); | 787 | strItem=strItem.simplifyWhiteSpace(); |
785 | if(strItem == "../") { // the user wants to go ^ | 788 | if(strItem == "../") { // the user wants to go ^ |
786 | if( FtpCDUp( conn) == 0) { | 789 | if( FtpCDUp( conn) == 0) { |
787 | QString msg; | 790 | QString msg; |
788 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 791 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
789 | msg.replace(QRegExp(":"),"\n"); | 792 | msg.replace(QRegExp(":"),"\n"); |
790 | QMessageBox::message(tr("Note"),msg); | 793 | QMessageBox::message(tr("Note"),msg); |
791 | // qDebug(msg); | 794 | // odebug << msg << oendl; |
792 | } | 795 | } |
793 | char path[256]; | 796 | char path[256]; |
794 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 797 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
795 | QString msg; | 798 | QString msg; |
796 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 799 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
797 | msg.replace(QRegExp(":"),"\n"); | 800 | msg.replace(QRegExp(":"),"\n"); |
798 | QMessageBox::message(tr("Note"),msg); | 801 | QMessageBox::message(tr("Note"),msg); |
799 | // qDebug(msg); | 802 | // odebug << msg << oendl; |
800 | } | 803 | } |
801 | currentRemoteDir=path; | 804 | currentRemoteDir=path; |
802 | } else { | 805 | } else { |
803 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 806 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
804 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 807 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
805 | strItem = strItem.stripWhiteSpace(); | 808 | strItem = strItem.stripWhiteSpace(); |
806 | currentRemoteDir = strItem; | 809 | currentRemoteDir = strItem; |
807 | if( !remoteChDir( (const QString &)strItem)) { | 810 | if( !remoteChDir( (const QString &)strItem)) { |
808 | currentRemoteDir = oldRemoteCurrentDir; | 811 | currentRemoteDir = oldRemoteCurrentDir; |
809 | strItem=""; | 812 | strItem=""; |
810 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 813 | // odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; |
811 | } | 814 | } |
812 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 815 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
813 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 816 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
814 | currentRemoteDir = oldRemoteCurrentDir; | 817 | currentRemoteDir = oldRemoteCurrentDir; |
815 | strItem=""; | 818 | strItem=""; |
816 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 819 | // odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl; |
817 | 820 | ||
818 | } else { | 821 | } else { |
819 | currentRemoteDir = currentRemoteDir+strItem; | 822 | currentRemoteDir = currentRemoteDir+strItem; |
820 | } | 823 | } |
821 | } else { | 824 | } else { |
822 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 825 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
823 | return; | 826 | return; |
824 | } | 827 | } |
825 | } | 828 | } |
826 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 829 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
827 | if(currentRemoteDir.right(1) !="/") | 830 | if(currentRemoteDir.right(1) !="/") |
828 | currentRemoteDir +="/"; | 831 | currentRemoteDir +="/"; |
@@ -857,25 +860,25 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) | |||
857 | populateLocalView(); | 860 | populateLocalView(); |
858 | } else { | 861 | } else { |
859 | currentDir.cdUp(); | 862 | currentDir.cdUp(); |
860 | populateLocalView(); | 863 | populateLocalView(); |
861 | } | 864 | } |
862 | if(QDir(strItem).exists()){ | 865 | if(QDir(strItem).exists()){ |
863 | currentDir.cd(strItem, TRUE); | 866 | currentDir.cd(strItem, TRUE); |
864 | populateLocalView(); | 867 | populateLocalView(); |
865 | } | 868 | } |
866 | } else { | 869 | } else { |
867 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 870 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
868 | if( QFile::exists(strItem ) ) { | 871 | if( QFile::exists(strItem ) ) { |
869 | // qDebug("upload "+strItem); | 872 | // odebug << "upload "+strItem << oendl; |
870 | return; | 873 | return; |
871 | } | 874 | } |
872 | } //end not symlink | 875 | } //end not symlink |
873 | chdir(strItem.latin1()); | 876 | chdir(strItem.latin1()); |
874 | } | 877 | } |
875 | Local_View->ensureItemVisible(Local_View->firstChild()); | 878 | Local_View->ensureItemVisible(Local_View->firstChild()); |
876 | } | 879 | } |
877 | } | 880 | } |
878 | 881 | ||
879 | void OpieFtp::doLocalCd() | 882 | void OpieFtp::doLocalCd() |
880 | { | 883 | { |
881 | localListClicked( Local_View->currentItem()); | 884 | localListClicked( Local_View->currentItem()); |
@@ -1161,25 +1164,25 @@ void OpieFtp::fillRemoteCombo(const QString ¤tPath) { | |||
1161 | 1164 | ||
1162 | currentPathCombo->lineEdit()->setText(currentPath); | 1165 | currentPathCombo->lineEdit()->setText(currentPath); |
1163 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1166 | if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
1164 | currentPathCombo->clear(); | 1167 | currentPathCombo->clear(); |
1165 | remoteDirPathStringList.prepend(currentPath ); | 1168 | remoteDirPathStringList.prepend(currentPath ); |
1166 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 1169 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1167 | } | 1170 | } |
1168 | } | 1171 | } |
1169 | 1172 | ||
1170 | void OpieFtp::currentPathComboChanged() | 1173 | void OpieFtp::currentPathComboChanged() |
1171 | { | 1174 | { |
1172 | QString oldRemoteCurrentDir = currentRemoteDir; | 1175 | QString oldRemoteCurrentDir = currentRemoteDir; |
1173 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); | 1176 | // odebug << "oldRemoteCurrentDir "+oldRemoteCurrentDir << oendl; |
1174 | if (TabWidget->currentPageIndex() == 0) { | 1177 | if (TabWidget->currentPageIndex() == 0) { |
1175 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 1178 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
1176 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 1179 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
1177 | populateLocalView(); | 1180 | populateLocalView(); |
1178 | } else { | 1181 | } else { |
1179 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 1182 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
1180 | } | 1183 | } |
1181 | } | 1184 | } |
1182 | if (TabWidget->currentPageIndex() == 1) { | 1185 | if (TabWidget->currentPageIndex() == 1) { |
1183 | currentRemoteDir = currentPathCombo->lineEdit()->text(); | 1186 | currentRemoteDir = currentPathCombo->lineEdit()->text(); |
1184 | if(currentRemoteDir.right(1) !="/") { | 1187 | if(currentRemoteDir.right(1) !="/") { |
1185 | currentRemoteDir = currentRemoteDir +"/"; | 1188 | currentRemoteDir = currentRemoteDir +"/"; |
@@ -1207,32 +1210,32 @@ void OpieFtp::switchToRemoteTab() | |||
1207 | void OpieFtp::switchToConfigTab() | 1210 | void OpieFtp::switchToConfigTab() |
1208 | { | 1211 | { |
1209 | TabWidget->setCurrentPage(2); | 1212 | TabWidget->setCurrentPage(2); |
1210 | } | 1213 | } |
1211 | 1214 | ||
1212 | void OpieFtp::readConfig() | 1215 | void OpieFtp::readConfig() |
1213 | { | 1216 | { |
1214 | fillCombos(); | 1217 | fillCombos(); |
1215 | Config cfg("opieftp"); | 1218 | Config cfg("opieftp"); |
1216 | cfg.setGroup("Server"); | 1219 | cfg.setGroup("Server"); |
1217 | currentServerConfig = cfg.readNumEntry("currentServer", -1); | 1220 | currentServerConfig = cfg.readNumEntry("currentServer", -1); |
1218 | 1221 | ||
1219 | // qDebug("Reading %d", currentServerConfig); | 1222 | // odebug << "Reading " << currentServerConfig << "" << oendl; |
1220 | serverComboSelected( currentServerConfig-1); | 1223 | serverComboSelected( currentServerConfig-1); |
1221 | 1224 | ||
1222 | } | 1225 | } |
1223 | 1226 | ||
1224 | void OpieFtp::writeConfig() | 1227 | void OpieFtp::writeConfig() |
1225 | { | 1228 | { |
1226 | qDebug("write config"); | 1229 | odebug << "write config" << oendl; |
1227 | Config cfg("opieftp"); | 1230 | Config cfg("opieftp"); |
1228 | cfg.setGroup("Server"); | 1231 | cfg.setGroup("Server"); |
1229 | 1232 | ||
1230 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1233 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1231 | 1234 | ||
1232 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1235 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1233 | 1236 | ||
1234 | if( currentServerConfig == -1) { | 1237 | if( currentServerConfig == -1) { |
1235 | 1238 | ||
1236 | for (int i = 1; i <= numberOfEntries; i++) { | 1239 | for (int i = 1; i <= numberOfEntries; i++) { |
1237 | temp.setNum(i); | 1240 | temp.setNum(i); |
1238 | cfg.setGroup("Server"); | 1241 | cfg.setGroup("Server"); |
@@ -1245,133 +1248,133 @@ void OpieFtp::writeConfig() | |||
1245 | remoteServerStr = cfg.readEntry( temp,""); | 1248 | remoteServerStr = cfg.readEntry( temp,""); |
1246 | 1249 | ||
1247 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1250 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1248 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1251 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1249 | 1252 | ||
1250 | temp.setNum(numberOfEntries+1); | 1253 | temp.setNum(numberOfEntries+1); |
1251 | cfg.setGroup("Server"); | 1254 | cfg.setGroup("Server"); |
1252 | 1255 | ||
1253 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); | 1256 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); |
1254 | cfg.writeEntry("currentServer", numberOfEntries+1); | 1257 | cfg.writeEntry("currentServer", numberOfEntries+1); |
1255 | 1258 | ||
1256 | currentServerConfig = numberOfEntries+1; | 1259 | currentServerConfig = numberOfEntries+1; |
1257 | qDebug("setting currentserverconfig to %d", currentServerConfig); | 1260 | odebug << "setting currentserverconfig to " << currentServerConfig << "" << oendl; |
1258 | 1261 | ||
1259 | cfg.setGroup(temp); | 1262 | cfg.setGroup(temp); |
1260 | if(!newServerName.isEmpty()) | 1263 | if(!newServerName.isEmpty()) |
1261 | cfg.writeEntry("ServerName", newServerName); | 1264 | cfg.writeEntry("ServerName", newServerName); |
1262 | 1265 | ||
1263 | cfg.writeEntry("RemotePath", remotePath->text()); | 1266 | cfg.writeEntry("RemotePath", remotePath->text()); |
1264 | 1267 | ||
1265 | cfg.writeEntry("Username", UsernameComboBox->currentText()); | 1268 | cfg.writeEntry("Username", UsernameComboBox->currentText()); |
1266 | 1269 | ||
1267 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); | 1270 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); |
1268 | cfg.setGroup("Server"); | 1271 | cfg.setGroup("Server"); |
1269 | 1272 | ||
1270 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); | 1273 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); |
1271 | 1274 | ||
1272 | } | 1275 | } |
1273 | } | 1276 | } |
1274 | 1277 | ||
1275 | void OpieFtp::clearCombos() { | 1278 | void OpieFtp::clearCombos() { |
1276 | qDebug("clearing"); | 1279 | odebug << "clearing" << oendl; |
1277 | ServerComboBox->clear(); | 1280 | ServerComboBox->clear(); |
1278 | UsernameComboBox->clear(); | 1281 | UsernameComboBox->clear(); |
1279 | PasswordEdit->clear(); | 1282 | PasswordEdit->clear(); |
1280 | serverListView->clear(); | 1283 | serverListView->clear(); |
1281 | } | 1284 | } |
1282 | 1285 | ||
1283 | 1286 | ||
1284 | void OpieFtp::fillCombos() | 1287 | void OpieFtp::fillCombos() |
1285 | { | 1288 | { |
1286 | clearCombos(); | 1289 | clearCombos(); |
1287 | 1290 | ||
1288 | Config cfg("opieftp"); | 1291 | Config cfg("opieftp"); |
1289 | cfg.setGroup("Server"); | 1292 | cfg.setGroup("Server"); |
1290 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1293 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1291 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1294 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1292 | 1295 | ||
1293 | for (int i = 1; i <= numberOfEntries; i++) { | 1296 | for (int i = 1; i <= numberOfEntries; i++) { |
1294 | temp.setNum(i); | 1297 | temp.setNum(i); |
1295 | qDebug(temp); | 1298 | odebug << temp << oendl; |
1296 | cfg.setGroup("Server"); | 1299 | cfg.setGroup("Server"); |
1297 | remoteServerStr = cfg.readEntry( temp,""); | 1300 | remoteServerStr = cfg.readEntry( temp,""); |
1298 | qDebug( remoteServerStr); | 1301 | odebug << remoteServerStr << oendl; |
1299 | 1302 | ||
1300 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1303 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1301 | port = remoteServerStr.right( divider - 1); | 1304 | port = remoteServerStr.right( divider - 1); |
1302 | bool ok; | 1305 | bool ok; |
1303 | PortSpinBox->setValue( port.toInt(&ok,10)); | 1306 | PortSpinBox->setValue( port.toInt(&ok,10)); |
1304 | 1307 | ||
1305 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1308 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1306 | qDebug( "remote server string "+remoteServerStr); | 1309 | odebug << "remote server string "+remoteServerStr << oendl; |
1307 | ServerComboBox->insertItem( remoteServerStr ); | 1310 | ServerComboBox->insertItem( remoteServerStr ); |
1308 | 1311 | ||
1309 | cfg.setGroup(temp); | 1312 | cfg.setGroup(temp); |
1310 | 1313 | ||
1311 | username = cfg.readEntry(temp); | 1314 | username = cfg.readEntry(temp); |
1312 | UsernameComboBox->insertItem(username); | 1315 | UsernameComboBox->insertItem(username); |
1313 | password = cfg.readEntryCrypt(username,""); | 1316 | password = cfg.readEntryCrypt(username,""); |
1314 | PasswordEdit->setText(password); | 1317 | PasswordEdit->setText(password); |
1315 | 1318 | ||
1316 | serverListView->insertItem( cfg.readEntry("ServerName")); | 1319 | serverListView->insertItem( cfg.readEntry("ServerName")); |
1317 | } | 1320 | } |
1318 | } | 1321 | } |
1319 | 1322 | ||
1320 | 1323 | ||
1321 | void OpieFtp::serverComboSelected(int index) | 1324 | void OpieFtp::serverComboSelected(int index) |
1322 | { | 1325 | { |
1323 | currentServerConfig = index+1; | 1326 | currentServerConfig = index+1; |
1324 | qDebug("server combo selected %d", index+1); | 1327 | odebug << "server combo selected " << index+1 << "" << oendl; |
1325 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1328 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1326 | // remoteServerStr = ServerComboBox->text(index); | 1329 | // remoteServerStr = ServerComboBox->text(index); |
1327 | 1330 | ||
1328 | Config cfg("opieftp"); | 1331 | Config cfg("opieftp"); |
1329 | cfg.setGroup("Server"); | 1332 | cfg.setGroup("Server"); |
1330 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1333 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1331 | 1334 | ||
1332 | temp.setNum(index+1); | 1335 | temp.setNum(index+1); |
1333 | remoteServerStr = cfg.readEntry( temp,""); | 1336 | remoteServerStr = cfg.readEntry( temp,""); |
1334 | 1337 | ||
1335 | qDebug("Group" +temp); | 1338 | odebug << "Group" +temp << oendl; |
1336 | cfg.setGroup(temp); | 1339 | cfg.setGroup(temp); |
1337 | // qDebug(temp); | 1340 | // odebug << temp << oendl; |
1338 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1341 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1339 | port = remoteServerStr.right( divider - 1); | 1342 | port = remoteServerStr.right( divider - 1); |
1340 | bool ok; | 1343 | bool ok; |
1341 | int portInt = port.toInt(&ok,10); | 1344 | int portInt = port.toInt(&ok,10); |
1342 | if( portInt == 0) portInt = 21; | 1345 | if( portInt == 0) portInt = 21; |
1343 | 1346 | ||
1344 | ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); | 1347 | ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); |
1345 | 1348 | ||
1346 | PortSpinBox->setValue( portInt); | 1349 | PortSpinBox->setValue( portInt); |
1347 | 1350 | ||
1348 | remotePath->setText(cfg.readEntry("RemotePath", "/")); | 1351 | remotePath->setText(cfg.readEntry("RemotePath", "/")); |
1349 | 1352 | ||
1350 | username = cfg.readEntry("Username", "anonymous"); | 1353 | username = cfg.readEntry("Username", "anonymous"); |
1351 | UsernameComboBox->lineEdit()->setText(username); | 1354 | UsernameComboBox->lineEdit()->setText(username); |
1352 | qDebug(username); | 1355 | odebug << username << oendl; |
1353 | // qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); | 1356 | // odebug << "Password is "+cfg.readEntryCrypt(username << oendl; |
1354 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); | 1357 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); |
1355 | // UsernameComboBox | 1358 | // UsernameComboBox |
1356 | // PasswordEdit | 1359 | // PasswordEdit |
1357 | 1360 | ||
1358 | cfg.setGroup("Server"); | 1361 | cfg.setGroup("Server"); |
1359 | temp.sprintf("%d",currentServerConfig); | 1362 | temp.sprintf("%d",currentServerConfig); |
1360 | cfg.writeEntry("currentServer", temp); | 1363 | cfg.writeEntry("currentServer", temp); |
1361 | 1364 | ||
1362 | fuckeduphack = TRUE; | 1365 | fuckeduphack = TRUE; |
1363 | serverListView->setCurrentItem( index); | 1366 | serverListView->setCurrentItem( index); |
1364 | fuckeduphack=FALSE; | 1367 | fuckeduphack=FALSE; |
1365 | qDebug("server list set selected %d",index); | 1368 | odebug << "server list set selected " << index << "" << oendl; |
1366 | update(); | 1369 | update(); |
1367 | } | 1370 | } |
1368 | 1371 | ||
1369 | void OpieFtp::deleteServer() | 1372 | void OpieFtp::deleteServer() |
1370 | { | 1373 | { |
1371 | QString username, remoteServerStr, remotePathStr, password, port, temp, servername; | 1374 | QString username, remoteServerStr, remotePathStr, password, port, temp, servername; |
1372 | remoteServerStr = ServerComboBox->currentText( ); | 1375 | remoteServerStr = ServerComboBox->currentText( ); |
1373 | username = UsernameComboBox->currentText(); | 1376 | username = UsernameComboBox->currentText(); |
1374 | servername=serverListView->currentText(); | 1377 | servername=serverListView->currentText(); |
1375 | 1378 | ||
1376 | Config cfg("opieftp"); | 1379 | Config cfg("opieftp"); |
1377 | cfg.setGroup("Server"); | 1380 | cfg.setGroup("Server"); |
@@ -1382,25 +1385,25 @@ void OpieFtp::deleteServer() | |||
1382 | temp.setNum(i); | 1385 | temp.setNum(i); |
1383 | // cfg.setGroup("Server"); | 1386 | // cfg.setGroup("Server"); |
1384 | cfg.setGroup(QString::number(i)); | 1387 | cfg.setGroup(QString::number(i)); |
1385 | tempname=cfg.readEntry( "ServerName",""); | 1388 | tempname=cfg.readEntry( "ServerName",""); |
1386 | 1389 | ||
1387 | if( tempname.find( servername,0,TRUE) != -1 ) { | 1390 | if( tempname.find( servername,0,TRUE) != -1 ) { |
1388 | // servername.find( cfg.readEntry("ServerName")) != -1 && | 1391 | // servername.find( cfg.readEntry("ServerName")) != -1 && |
1389 | // remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && | 1392 | // remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && |
1390 | // username.find( cfg.readEntry("Username")) != -1) { | 1393 | // username.find( cfg.readEntry("Username")) != -1) { |
1391 | 1394 | ||
1392 | serverListView->removeItem(i); | 1395 | serverListView->removeItem(i); |
1393 | 1396 | ||
1394 | qDebug("OK DELETE "+tempname); | 1397 | odebug << "OK DELETE "+tempname << oendl; |
1395 | cfg.removeEntry(QString::number(i)); | 1398 | cfg.removeEntry(QString::number(i)); |
1396 | for ( ; i <= numberOfEntries; i++) { | 1399 | for ( ; i <= numberOfEntries; i++) { |
1397 | cfg.setGroup("Server"); | 1400 | cfg.setGroup("Server"); |
1398 | cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); | 1401 | cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); |
1399 | 1402 | ||
1400 | cfg.setGroup(QString::number(i+1)); //get next server config | 1403 | cfg.setGroup(QString::number(i+1)); //get next server config |
1401 | servername=cfg.readEntry("ServerName"); | 1404 | servername=cfg.readEntry("ServerName"); |
1402 | remoteServerStr=cfg.readEntry("RemotePath"); | 1405 | remoteServerStr=cfg.readEntry("RemotePath"); |
1403 | username=cfg.readEntry("Username"); | 1406 | username=cfg.readEntry("Username"); |
1404 | password=cfg.readEntryCrypt( username); | 1407 | password=cfg.readEntryCrypt( username); |
1405 | 1408 | ||
1406 | cfg.setGroup(QString::number(i)); | 1409 | cfg.setGroup(QString::number(i)); |
@@ -1437,33 +1440,33 @@ void OpieFtp::upDir() | |||
1437 | dir.cdUp(); | 1440 | dir.cdUp(); |
1438 | current = dir.canonicalPath(); | 1441 | current = dir.canonicalPath(); |
1439 | chdir( current.latin1() ); | 1442 | chdir( current.latin1() ); |
1440 | currentDir.cd( current, TRUE); | 1443 | currentDir.cd( current, TRUE); |
1441 | populateLocalView(); | 1444 | populateLocalView(); |
1442 | update(); | 1445 | update(); |
1443 | } else { | 1446 | } else { |
1444 | if( FtpCDUp( conn) == 0) { | 1447 | if( FtpCDUp( conn) == 0) { |
1445 | QString msg; | 1448 | QString msg; |
1446 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 1449 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
1447 | msg.replace(QRegExp(":"),"\n"); | 1450 | msg.replace(QRegExp(":"),"\n"); |
1448 | QMessageBox::message(tr("Note"),msg); | 1451 | QMessageBox::message(tr("Note"),msg); |
1449 | // qDebug(msg); | 1452 | // odebug << msg << oendl; |
1450 | } | 1453 | } |
1451 | char path[256]; | 1454 | char path[256]; |
1452 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 1455 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
1453 | QString msg; | 1456 | QString msg; |
1454 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 1457 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
1455 | msg.replace(QRegExp(":"),"\n"); | 1458 | msg.replace(QRegExp(":"),"\n"); |
1456 | QMessageBox::message(tr("Note"),msg); | 1459 | QMessageBox::message(tr("Note"),msg); |
1457 | // qDebug(msg); | 1460 | // odebug << msg << oendl; |
1458 | } | 1461 | } |
1459 | currentRemoteDir=path; | 1462 | currentRemoteDir=path; |
1460 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1463 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
1461 | if(currentRemoteDir.right(1) !="/") | 1464 | if(currentRemoteDir.right(1) !="/") |
1462 | currentRemoteDir +="/"; | 1465 | currentRemoteDir +="/"; |
1463 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 1466 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
1464 | fillRemoteCombo( (const QString &)currentRemoteDir); | 1467 | fillRemoteCombo( (const QString &)currentRemoteDir); |
1465 | 1468 | ||
1466 | } | 1469 | } |
1467 | } | 1470 | } |
1468 | 1471 | ||
1469 | void OpieFtp::docButtonPushed() { | 1472 | void OpieFtp::docButtonPushed() { |
@@ -1506,24 +1509,24 @@ void OpieFtp::NewServer() { | |||
1506 | } | 1509 | } |
1507 | } | 1510 | } |
1508 | currentServerConfig =-1; | 1511 | currentServerConfig =-1; |
1509 | writeConfig(); | 1512 | writeConfig(); |
1510 | serverListView->insertItem( newServerName ); | 1513 | serverListView->insertItem( newServerName ); |
1511 | serverListView->setCurrentItem( serverListView->count()); | 1514 | serverListView->setCurrentItem( serverListView->count()); |
1512 | } | 1515 | } |
1513 | } | 1516 | } |
1514 | 1517 | ||
1515 | void OpieFtp::serverListClicked( const QString &item) { | 1518 | void OpieFtp::serverListClicked( const QString &item) { |
1516 | if(item.isEmpty()) return; | 1519 | if(item.isEmpty()) return; |
1517 | Config cfg("opieftp"); | 1520 | Config cfg("opieftp"); |
1518 | qDebug("highltined "+item); | 1521 | odebug << "highltined "+item << oendl; |
1519 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1522 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1520 | for (int i = 1; i <= numberOfEntries; i++) { | 1523 | for (int i = 1; i <= numberOfEntries; i++) { |
1521 | cfg.setGroup(QString::number(i)); | 1524 | cfg.setGroup(QString::number(i)); |
1522 | if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) | 1525 | if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) |
1523 | serverComboSelected(i-1); | 1526 | serverComboSelected(i-1); |
1524 | } | 1527 | } |
1525 | } | 1528 | } |
1526 | 1529 | ||
1527 | void OpieFtp::timerOut() { | 1530 | void OpieFtp::timerOut() { |
1528 | 1531 | ||
1529 | } | 1532 | } |
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro index 2f97dc2..003b166 100644 --- a/noncore/net/opieftp/opieftp.pro +++ b/noncore/net/opieftp/opieftp.pro | |||
@@ -1,11 +1,10 @@ | |||
1 | #CONFIG += qt warn_on quick-app | ||
2 | CONFIG += qt warn_on | 1 | CONFIG += qt warn_on |
3 | HEADERS = opieftp.h inputDialog.h | 2 | HEADERS = opieftp.h inputDialog.h |
4 | SOURCES = opieftp.cpp inputDialog.cpp main.cpp | 3 | SOURCES = opieftp.cpp inputDialog.cpp main.cpp |
5 | TARGET = opieftp | 4 | TARGET = opieftp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lqpe -lftplib | 7 | LIBS += -lqpe -lopiecore2 -lftplib |
9 | DESTDIR = $(OPIEDIR)/bin | 8 | DESTDIR = $(OPIEDIR)/bin |
10 | 9 | ||
11 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/opieirc/config.in b/noncore/net/opieirc/config.in index a61cf70..2c56523 100644 --- a/noncore/net/opieirc/config.in +++ b/noncore/net/opieirc/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config OPIEIRC | 1 | config OPIEIRC |
2 | boolean "opie-irc (chat via your favorite IRC server)" | 2 | boolean "opie-irc (chat via your favorite IRC server)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LIBQTAUX | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBQTAUX |
diff --git a/noncore/net/opieirc/ircmisc.cpp b/noncore/net/opieirc/ircmisc.cpp index 22387b3..6d93a34 100644 --- a/noncore/net/opieirc/ircmisc.cpp +++ b/noncore/net/opieirc/ircmisc.cpp | |||
@@ -1,15 +1,18 @@ | |||
1 | #include <stdio.h> | ||
2 | #include "ircmisc.h" | 1 | #include "ircmisc.h" |
3 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | using namespace Opie::Core; | ||
6 | |||
4 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { | 7 | IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) { |
5 | } | 8 | } |
6 | 9 | ||
7 | int IRCTabBar::insertTab(QTab *tab, int index) { | 10 | int IRCTabBar::insertTab(QTab *tab, int index) { |
8 | /* FIXME: find some nicer way to do this */ | 11 | /* FIXME: find some nicer way to do this */ |
9 | QExtTab *ext = new QExtTab(); | 12 | QExtTab *ext = new QExtTab(); |
10 | ext->color = black; | 13 | ext->color = black; |
11 | ext->label = tab->text(); | 14 | ext->label = tab->text(); |
12 | ext->r = tab->rect(); | 15 | ext->r = tab->rect(); |
13 | ext->enabled = tab->isEnabled(); | 16 | ext->enabled = tab->isEnabled(); |
14 | ext->iconset = tab->iconSet(); | 17 | ext->iconset = tab->iconSet(); |
15 | delete tab; | 18 | delete tab; |
@@ -55,29 +58,29 @@ void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) { | |||
55 | if (m_history.count() > 0 && m_index > 0) { | 58 | if (m_history.count() > 0 && m_index > 0) { |
56 | m_index--; | 59 | m_index--; |
57 | setText(m_history[m_index]); | 60 | setText(m_history[m_index]); |
58 | } | 61 | } |
59 | if (m_index == 0) { | 62 | if (m_index == 0) { |
60 | m_index = -1; | 63 | m_index = -1; |
61 | setText(""); | 64 | setText(""); |
62 | } | 65 | } |
63 | } else if (key == Key_Return) { | 66 | } else if (key == Key_Return) { |
64 | m_history.prepend(text()); | 67 | m_history.prepend(text()); |
65 | m_index = -1; | 68 | m_index = -1; |
66 | } else if (key == Key_Tab) { | 69 | } else if (key == Key_Tab) { |
67 | printf("got tab\n"); | 70 | odebug << "got tab" << oendl; |
68 | return; | 71 | return; |
69 | } | 72 | } |
70 | QLineEdit::keyPressEvent(event); | 73 | QLineEdit::keyPressEvent(event); |
71 | } | 74 | } |
72 | 75 | ||
73 | bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { | 76 | bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) { |
74 | if (event->type() == QEvent::KeyPress) { | 77 | if (event->type() == QEvent::KeyPress) { |
75 | QKeyEvent *k = (QKeyEvent *) event; | 78 | QKeyEvent *k = (QKeyEvent *) event; |
76 | /* Catch tab characters */ | 79 | /* Catch tab characters */ |
77 | if (k->key() == Key_Tab) { | 80 | if (k->key() == Key_Tab) { |
78 | qDebug("tab!"); | 81 | odebug << "tab!" << oendl; |
79 | return TRUE; | 82 | return TRUE; |
80 | } | 83 | } |
81 | } | 84 | } |
82 | return QLineEdit::eventFilter(object, event); | 85 | return QLineEdit::eventFilter(object, event); |
83 | } | 86 | } |
diff --git a/noncore/net/opieirc/opieirc.pro b/noncore/net/opieirc/opieirc.pro index 4f9092f..2455ec4 100644 --- a/noncore/net/opieirc/opieirc.pro +++ b/noncore/net/opieirc/opieirc.pro | |||
@@ -9,17 +9,16 @@ HEADERS = ircchannel.h ircconnection.h \ | |||
9 | ircquerytab.h ircsettings.h ircmisc.h | 9 | ircquerytab.h ircsettings.h ircmisc.h |
10 | SOURCES = ircchannel.cpp ircconnection.cpp \ | 10 | SOURCES = ircchannel.cpp ircconnection.cpp \ |
11 | ircmessage.cpp \ | 11 | ircmessage.cpp \ |
12 | ircmessageparser.cpp ircoutput.cpp \ | 12 | ircmessageparser.cpp ircoutput.cpp \ |
13 | ircperson.cpp ircserver.cpp \ | 13 | ircperson.cpp ircserver.cpp \ |
14 | ircsession.cpp main.cpp mainwindow.cpp \ | 14 | ircsession.cpp main.cpp mainwindow.cpp \ |
15 | irctab.cpp ircservertab.cpp \ | 15 | irctab.cpp ircservertab.cpp \ |
16 | ircchanneltab.cpp ircchannellist.cpp \ | 16 | ircchanneltab.cpp ircchannellist.cpp \ |
17 | ircserverlist.cpp ircservereditor.cpp \ | 17 | ircserverlist.cpp ircservereditor.cpp \ |
18 | ircquerytab.cpp ircsettings.cpp ircmisc.cpp | 18 | ircquerytab.cpp ircsettings.cpp ircmisc.cpp |
19 | INCLUDEPATH += $(OPIEDIR)/include | 19 | INCLUDEPATH += $(OPIEDIR)/include |
20 | DEPENDPATH+= $(OPIEDIR)/include | 20 | DEPENDPATH+= $(OPIEDIR)/include |
21 | LIBS += -lqpe -lopieui2 -lqtaux2 | 21 | LIBS += -lqpe -lopiecore2 -lopieui2 -lqtaux2 |
22 | |||
23 | TARGET= opieirc | 22 | TARGET= opieirc |
24 | 23 | ||
25 | include ( $(OPIEDIR)/include.pro ) | 24 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 8a7f0bc..1d93f5c 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -197,25 +197,25 @@ namespace OpieTooth { | |||
197 | 197 | ||
198 | if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { | 198 | if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { |
199 | update(); | 199 | update(); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * Implementation of the paint event | 204 | * Implementation of the paint event |
205 | * @param the QPaintEvent | 205 | * @param the QPaintEvent |
206 | */ | 206 | */ |
207 | void BluezApplet::paintEvent( QPaintEvent* ) { | 207 | void BluezApplet::paintEvent( QPaintEvent* ) { |
208 | QPainter p(this); | 208 | QPainter p(this); |
209 | qDebug("paint bluetooth pixmap"); | 209 | odebug << "paint bluetooth pixmap" << oendl; |
210 | 210 | ||
211 | if (bluezactive > 0) { | 211 | if (bluezactive > 0) { |
212 | p.drawPixmap( 0, 1, bluezOnPixmap ); | 212 | p.drawPixmap( 0, 1, bluezOnPixmap ); |
213 | } else { | 213 | } else { |
214 | p.drawPixmap( 0, 1, bluezOffPixmap ); | 214 | p.drawPixmap( 0, 1, bluezOffPixmap ); |
215 | } | 215 | } |
216 | 216 | ||
217 | if (bluezDiscoveryActive > 0) { | 217 | if (bluezDiscoveryActive > 0) { |
218 | p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); | 218 | p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); |
219 | } | 219 | } |
220 | } | 220 | } |
221 | }; | 221 | }; |
diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp index 09b19d2..37f2ae7 100644 --- a/noncore/net/opietooth/lib/startdunconnection.cpp +++ b/noncore/net/opietooth/lib/startdunconnection.cpp | |||
@@ -36,25 +36,25 @@ StartConnection::ConnectionType StartDunConnection::type() { | |||
36 | return m_connectionType; | 36 | return m_connectionType; |
37 | } | 37 | } |
38 | 38 | ||
39 | void StartDunConnection::start() { | 39 | void StartDunConnection::start() { |
40 | m_dunConnect = new OProcess(); | 40 | m_dunConnect = new OProcess(); |
41 | *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; | 41 | *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; |
42 | 42 | ||
43 | connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , | 43 | connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , |
44 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); | 44 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); |
45 | connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), | 45 | connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), |
46 | this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); | 46 | this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); |
47 | if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 47 | if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
48 | qWarning( "could not start" ); | 48 | owarn << "could not start" << oendl; |
49 | delete m_dunConnect; | 49 | delete m_dunConnect; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void StartDunConnection::slotExited( OProcess* proc ) { | 54 | void StartDunConnection::slotExited( OProcess* proc ) { |
55 | delete m_dunConnect; | 55 | delete m_dunConnect; |
56 | } | 56 | } |
57 | 57 | ||
58 | void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) | 58 | void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) |
59 | {} | 59 | {} |
60 | 60 | ||
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp index 24ac530..50afc9f 100644 --- a/noncore/net/opietooth/lib/startpanconnection.cpp +++ b/noncore/net/opietooth/lib/startpanconnection.cpp | |||
@@ -30,55 +30,55 @@ QString StartPanConnection::name() { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | void StartPanConnection::setConnectionType() { | 32 | void StartPanConnection::setConnectionType() { |
33 | m_connectionType = Pan; | 33 | m_connectionType = Pan; |
34 | } | 34 | } |
35 | 35 | ||
36 | StartConnection::ConnectionType StartPanConnection::type() { | 36 | StartConnection::ConnectionType StartPanConnection::type() { |
37 | return m_connectionType; | 37 | return m_connectionType; |
38 | } | 38 | } |
39 | 39 | ||
40 | void StartPanConnection::start() { | 40 | void StartPanConnection::start() { |
41 | m_panConnect = new OProcess(); | 41 | m_panConnect = new OProcess(); |
42 | qDebug( "IM START " + m_mac ); | 42 | odebug << "IM START " + m_mac << oendl; |
43 | *m_panConnect << "pand" << "--connect" << m_mac; | 43 | *m_panConnect << "pand" << "--connect" << m_mac; |
44 | 44 | ||
45 | connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , | 45 | connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , |
46 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); | 46 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); |
47 | connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), | 47 | connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), |
48 | this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); | 48 | this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); |
49 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 49 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
50 | qWarning( "could not start" ); | 50 | owarn << "could not start" << oendl; |
51 | delete m_panConnect; | 51 | delete m_panConnect; |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | void StartPanConnection::slotExited( OProcess* proc ) { | 56 | void StartPanConnection::slotExited( OProcess* proc ) { |
57 | delete m_panConnect; | 57 | delete m_panConnect; |
58 | m_panConnect = 0l; | 58 | m_panConnect = 0l; |
59 | } | 59 | } |
60 | 60 | ||
61 | void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) | 61 | void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) |
62 | {} | 62 | {} |
63 | 63 | ||
64 | 64 | ||
65 | void StartPanConnection::stop() { | 65 | void StartPanConnection::stop() { |
66 | if ( m_panConnect ) { | 66 | if ( m_panConnect ) { |
67 | delete m_panConnect; | 67 | delete m_panConnect; |
68 | m_panConnect = 0l; | 68 | m_panConnect = 0l; |
69 | } | 69 | } |
70 | m_panConnect = new OProcess(); | 70 | m_panConnect = new OProcess(); |
71 | qDebug("IM STOP " + m_mac); | 71 | odebug << "IM STOP " + m_mac << oendl; |
72 | 72 | ||
73 | *m_panConnect << "pand" << "--kill" << m_mac; | 73 | *m_panConnect << "pand" << "--kill" << m_mac; |
74 | 74 | ||
75 | connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , | 75 | connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , |
76 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); | 76 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); |
77 | connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), | 77 | connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), |
78 | this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); | 78 | this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); |
79 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 79 | if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
80 | qWarning( "could not stop" ); | 80 | owarn << "could not stop" << oendl; |
81 | delete m_panConnect; | 81 | delete m_panConnect; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 29030ab..b1cddd2 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -146,25 +146,25 @@ void BlueBase::writeConfig() | |||
146 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); | 146 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); |
147 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); | 147 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); |
148 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); | 148 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); |
149 | 149 | ||
150 | writeToHciConfig(); | 150 | writeToHciConfig(); |
151 | } | 151 | } |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Modify the hcid.conf file to our needs | 154 | * Modify the hcid.conf file to our needs |
155 | */ | 155 | */ |
156 | void BlueBase::writeToHciConfig() | 156 | void BlueBase::writeToHciConfig() |
157 | { | 157 | { |
158 | qWarning("writeToHciConfig"); | 158 | owarn << "writeToHciConfig" << oendl; |
159 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | 159 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); |
160 | hciconf.load(); | 160 | hciconf.load(); |
161 | hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); | 161 | hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); |
162 | hciconf.setName( m_deviceName ); | 162 | hciconf.setName( m_deviceName ); |
163 | hciconf.setEncrypt( m_useEncryption ); | 163 | hciconf.setEncrypt( m_useEncryption ); |
164 | hciconf.setAuth( m_enableAuthentification ); | 164 | hciconf.setAuth( m_enableAuthentification ); |
165 | hciconf.setPscan( m_enablePagescan ); | 165 | hciconf.setPscan( m_enablePagescan ); |
166 | hciconf.setIscan( m_enableInquiryscan ); | 166 | hciconf.setIscan( m_enableInquiryscan ); |
167 | hciconf.save(); | 167 | hciconf.save(); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
@@ -358,81 +358,81 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin | |||
358 | * delete the PopupMenu otherwise it's the responsibility of | 358 | * delete the PopupMenu otherwise it's the responsibility of |
359 | * the PopupMenu to delete itself | 359 | * the PopupMenu to delete itself |
360 | * | 360 | * |
361 | */ | 361 | */ |
362 | else if ( ((BTListItem*)item)->type() == "service") | 362 | else if ( ((BTListItem*)item)->type() == "service") |
363 | { | 363 | { |
364 | BTServiceItem* service = (BTServiceItem*)item; | 364 | BTServiceItem* service = (BTServiceItem*)item; |
365 | QMap<int, QString> list = service->services().classIdList(); | 365 | QMap<int, QString> list = service->services().classIdList(); |
366 | QMap<int, QString>::Iterator it = list.begin(); | 366 | QMap<int, QString>::Iterator it = list.begin(); |
367 | QPopupMenu *popup =0l; | 367 | QPopupMenu *popup =0l; |
368 | if ( it != list.end() ) | 368 | if ( it != list.end() ) |
369 | { | 369 | { |
370 | qWarning("Searching id %d %s", it.key(), it.data().latin1() ); | 370 | owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl; |
371 | popup = m_popHelper.find( it.key(), | 371 | popup = m_popHelper.find( it.key(), |
372 | service->services(), | 372 | service->services(), |
373 | (BTDeviceItem*)service->parent() ); | 373 | (BTDeviceItem*)service->parent() ); |
374 | } | 374 | } |
375 | else | 375 | else |
376 | { | 376 | { |
377 | qWarning("Empty"); | 377 | owarn << "Empty" << oendl; |
378 | } | 378 | } |
379 | 379 | ||
380 | if ( popup == 0l ) | 380 | if ( popup == 0l ) |
381 | { | 381 | { |
382 | qWarning("factory returned 0l"); | 382 | owarn << "factory returned 0l" << oendl; |
383 | popup = new QPopupMenu(); | 383 | popup = new QPopupMenu(); |
384 | } | 384 | } |
385 | int test1 = popup->insertItem( tr("Test1:"), 2); | 385 | int test1 = popup->insertItem( tr("Test1:"), 2); |
386 | 386 | ||
387 | ret = popup->exec( point ); | 387 | ret = popup->exec( point ); |
388 | qWarning("returned from exec() "); | 388 | owarn << "returned from exec() " << oendl; |
389 | if ( ret == -1 ) | 389 | if ( ret == -1 ) |
390 | { | 390 | { |
391 | ; | 391 | ; |
392 | } | 392 | } |
393 | else if ( ret == test1 ) | 393 | else if ( ret == test1 ) |
394 | { | 394 | { |
395 | ; | 395 | ; |
396 | } | 396 | } |
397 | delete popup; | 397 | delete popup; |
398 | } | 398 | } |
399 | delete menu; | 399 | delete menu; |
400 | } | 400 | } |
401 | 401 | ||
402 | 402 | ||
403 | /** | 403 | /** |
404 | * Search and display avail. services for a device (on expand from device listing) | 404 | * Search and display avail. services for a device (on expand from device listing) |
405 | * @param item the service item returned | 405 | * @param item the service item returned |
406 | */ | 406 | */ |
407 | void BlueBase::addServicesToDevice( BTDeviceItem * item ) | 407 | void BlueBase::addServicesToDevice( BTDeviceItem * item ) |
408 | { | 408 | { |
409 | qDebug("addServicesToDevice"); | 409 | odebug << "addServicesToDevice" << oendl; |
410 | // row of mac adress text(3) | 410 | // row of mac adress text(3) |
411 | RemoteDevice device = item->remoteDevice(); | 411 | RemoteDevice device = item->remoteDevice(); |
412 | m_deviceList.insert( item->mac() , item ); | 412 | m_deviceList.insert( item->mac() , item ); |
413 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back | 413 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back |
414 | m_localDevice->searchServices( device ); | 414 | m_localDevice->searchServices( device ); |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | /** | 418 | /** |
419 | * Overloaded. This one it the one that is | 419 | * Overloaded. This one it the one that is |
420 | ted to the foundServices signal | 420 | ted to the foundServices signal |
421 | * @param device the mac address of the remote device | 421 | * @param device the mac address of the remote device |
422 | * @param servicesList the list with the service the device has. | 422 | * @param servicesList the list with the service the device has. |
423 | */ | 423 | */ |
424 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) | 424 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) |
425 | { | 425 | { |
426 | qDebug("fill services list"); | 426 | odebug << "fill services list" << oendl; |
427 | 427 | ||
428 | QMap<QString,BTDeviceItem*>::Iterator it; | 428 | QMap<QString,BTDeviceItem*>::Iterator it; |
429 | BTDeviceItem* deviceItem = 0; | 429 | BTDeviceItem* deviceItem = 0; |
430 | 430 | ||
431 | // get the right devices which requested the search | 431 | // get the right devices which requested the search |
432 | it = m_deviceList.find( device ); | 432 | it = m_deviceList.find( device ); |
433 | if( it == m_deviceList.end() ) | 433 | if( it == m_deviceList.end() ) |
434 | return; | 434 | return; |
435 | deviceItem = it.data(); | 435 | deviceItem = it.data(); |
436 | 436 | ||
437 | // remove previous entries | 437 | // remove previous entries |
438 | QList<QListViewItem> tempList; | 438 | QList<QListViewItem> tempList; |
@@ -598,25 +598,25 @@ void BlueBase::deviceActive( const RemoteDevice &device ) | |||
598 | // We should have a BTDeviceItem there or where does it get added to the map -zecke | 598 | // We should have a BTDeviceItem there or where does it get added to the map -zecke |
599 | m_localDevice->isAvailable( device.mac() ); | 599 | m_localDevice->isAvailable( device.mac() ); |
600 | } | 600 | } |
601 | 601 | ||
602 | 602 | ||
603 | /** | 603 | /** |
604 | * The signal catcher. Set the avail. status on device. | 604 | * The signal catcher. Set the avail. status on device. |
605 | * @param device - the mac address | 605 | * @param device - the mac address |
606 | * @param connected - if it is avail. or not | 606 | * @param connected - if it is avail. or not |
607 | */ | 607 | */ |
608 | void BlueBase::deviceActive( const QString& device, bool connected ) | 608 | void BlueBase::deviceActive( const QString& device, bool connected ) |
609 | { | 609 | { |
610 | qDebug("deviceActive slot"); | 610 | odebug << "deviceActive slot" << oendl; |
611 | 611 | ||
612 | QMap<QString,BTDeviceItem*>::Iterator it; | 612 | QMap<QString,BTDeviceItem*>::Iterator it; |
613 | 613 | ||
614 | it = m_deviceList.find( device ); | 614 | it = m_deviceList.find( device ); |
615 | if( it == m_deviceList.end() ) | 615 | if( it == m_deviceList.end() ) |
616 | return; | 616 | return; |
617 | 617 | ||
618 | BTDeviceItem* deviceItem = it.data(); | 618 | BTDeviceItem* deviceItem = it.data(); |
619 | 619 | ||
620 | 620 | ||
621 | if ( connected ) | 621 | if ( connected ) |
622 | { | 622 | { |
diff --git a/noncore/net/opietooth/manager/devicehandler.cpp b/noncore/net/opietooth/manager/devicehandler.cpp index 9c5b817..bd34351 100644 --- a/noncore/net/opietooth/manager/devicehandler.cpp +++ b/noncore/net/opietooth/manager/devicehandler.cpp | |||
@@ -24,31 +24,31 @@ QString path = QDir::homeDirPath() + "/Settings/bluetooth"; | |||
24 | QStringList devicesFileList = deviceListSave.entryList(); | 24 | QStringList devicesFileList = deviceListSave.entryList(); |
25 | 25 | ||
26 | 26 | ||
27 | // cut .conf of to get the mac and also read the name entry in it. | 27 | // cut .conf of to get the mac and also read the name entry in it. |
28 | if (!devicesFileList.isEmpty() ) { | 28 | if (!devicesFileList.isEmpty() ) { |
29 | QString name; | 29 | QString name; |
30 | QString mac; | 30 | QString mac; |
31 | QStringList::Iterator it; | 31 | QStringList::Iterator it; |
32 | for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { | 32 | for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { |
33 | if ( (*it) == "." || (*it) == ".." ) | 33 | if ( (*it) == "." || (*it) == ".." ) |
34 | continue; | 34 | continue; |
35 | 35 | ||
36 | qDebug((*it).latin1() ); | 36 | odebug << (*it).latin1() << oendl; |
37 | Config conf(path + "/"+(*it), Config::File); | 37 | Config conf(path + "/"+(*it), Config::File); |
38 | conf.setGroup("Info"); | 38 | conf.setGroup("Info"); |
39 | name = conf.readEntry("name", "Error"); | 39 | name = conf.readEntry("name", "Error"); |
40 | mac = conf.readEntry("mac", QString::null); | 40 | mac = conf.readEntry("mac", QString::null); |
41 | qDebug("MAC: " + mac); | 41 | odebug << "MAC: " + mac << oendl; |
42 | qDebug("NAME: " + name); | 42 | odebug << "NAME: " + name << oendl; |
43 | if (mac.isEmpty() ) | 43 | if (mac.isEmpty() ) |
44 | continue; | 44 | continue; |
45 | RemoteDevice currentDevice( mac , name ); | 45 | RemoteDevice currentDevice( mac , name ); |
46 | list.append( currentDevice ); | 46 | list.append( currentDevice ); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | return list; | 49 | return list; |
50 | }; | 50 | }; |
51 | /* | 51 | /* |
52 | * This is some how rude but make sure all old devices | 52 | * This is some how rude but make sure all old devices |
53 | * are getting deleted | 53 | * are getting deleted |
54 | */ | 54 | */ |
@@ -57,31 +57,31 @@ void DeviceHandler::save( const RemoteDevice::ValueList& list) { | |||
57 | rm += "rm -rf "; | 57 | rm += "rm -rf "; |
58 | rm += QDir::homeDirPath() + "/Settings/bluetooth"; | 58 | rm += QDir::homeDirPath() + "/Settings/bluetooth"; |
59 | system ( rm.data() ); | 59 | system ( rm.data() ); |
60 | 60 | ||
61 | if (list.isEmpty() ) // no need to create the dir | 61 | if (list.isEmpty() ) // no need to create the dir |
62 | return; | 62 | return; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Create a new dir | 65 | * Create a new dir |
66 | */ | 66 | */ |
67 | rm = "mkdir "; | 67 | rm = "mkdir "; |
68 | rm += QDir::homeDirPath() + "/Settings/bluetooth"; | 68 | rm += QDir::homeDirPath() + "/Settings/bluetooth"; |
69 | qWarning("out %s", rm.data() ); | 69 | owarn << "out " << rm.data() << "" << oendl; |
70 | system( rm.data() ); | 70 | system( rm.data() ); |
71 | 71 | ||
72 | RemoteDevice::ValueList::ConstIterator it; | 72 | RemoteDevice::ValueList::ConstIterator it; |
73 | // write the config | 73 | // write the config |
74 | 74 | ||
75 | for ( it = list.begin(); it != list.end(); ++it ) { | 75 | for ( it = list.begin(); it != list.end(); ++it ) { |
76 | qDebug( "/Settings/bluetooth/" + (*it).mac() + ".conf"); | 76 | odebug << "/Settings/bluetooth/" + (*it).mac() + ".conf" << oendl; |
77 | 77 | ||
78 | Config conf( QDir::homeDirPath() + | 78 | Config conf( QDir::homeDirPath() + |
79 | "/Settings/bluetooth/" + | 79 | "/Settings/bluetooth/" + |
80 | (*it).mac() + ".conf", Config::File ); | 80 | (*it).mac() + ".conf", Config::File ); |
81 | 81 | ||
82 | conf.setGroup( "Info" ); | 82 | conf.setGroup( "Info" ); |
83 | conf.writeEntry( "name", (*it).name() ); | 83 | conf.writeEntry( "name", (*it).name() ); |
84 | conf.writeEntry( "mac", (*it).mac() ); | 84 | conf.writeEntry( "mac", (*it).mac() ); |
85 | } | 85 | } |
86 | 86 | ||
87 | } | 87 | } |
diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp index 3043f71..5b01d2f 100644 --- a/noncore/net/opietooth/manager/dunpopup.cpp +++ b/noncore/net/opietooth/manager/dunpopup.cpp | |||
@@ -2,25 +2,25 @@ | |||
2 | 2 | ||
3 | #include <qtimer.h> | 3 | #include <qtimer.h> |
4 | 4 | ||
5 | #include "dunpopup.h" | 5 | #include "dunpopup.h" |
6 | 6 | ||
7 | using namespace OpieTooth; | 7 | using namespace OpieTooth; |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * c'tor init the QAction | 10 | * c'tor init the QAction |
11 | */ | 11 | */ |
12 | DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { | 12 | DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { |
13 | 13 | ||
14 | qWarning("DunPopup c'tor"); | 14 | owarn << "DunPopup c'tor" << oendl; |
15 | 15 | ||
16 | m_item = item; | 16 | m_item = item; |
17 | QAction *a, *b, *c; | 17 | QAction *a, *b, *c; |
18 | 18 | ||
19 | m_dunconnection = 0l; | 19 | m_dunconnection = 0l; |
20 | /* connect action */ | 20 | /* connect action */ |
21 | 21 | ||
22 | 22 | ||
23 | a = new QAction(); // so it's get deleted | 23 | a = new QAction(); // so it's get deleted |
24 | a->setText( tr("connect") ); | 24 | a->setText( tr("connect") ); |
25 | a->addTo( this ); | 25 | a->addTo( this ); |
26 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); | 26 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); |
diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index 35e9cd9..71c935c 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp | |||
@@ -65,75 +65,75 @@ namespace OpieTooth { | |||
65 | 65 | ||
66 | void HciConfWrapper::setValue(const QString &key, const QString &value ) { | 66 | void HciConfWrapper::setValue(const QString &key, const QString &value ) { |
67 | 67 | ||
68 | if (m_file.isEmpty() ) // load first | 68 | if (m_file.isEmpty() ) // load first |
69 | return; | 69 | return; |
70 | 70 | ||
71 | QStringList::Iterator it; | 71 | QStringList::Iterator it; |
72 | 72 | ||
73 | QString str; | 73 | QString str; |
74 | for (it = m_file.begin(); it != m_file.end(); ++it ) { | 74 | for (it = m_file.begin(); it != m_file.end(); ++it ) { |
75 | str = (*it); | 75 | str = (*it); |
76 | if( (str.contains(key)) > 0 ) { | 76 | if( (str.contains(key)) > 0 ) { |
77 | qDebug("Found"); | 77 | odebug << "Found" << oendl; |
78 | // still need to look if its commented out!!! | 78 | // still need to look if its commented out!!! |
79 | str.simplifyWhiteSpace(); | 79 | str.simplifyWhiteSpace(); |
80 | qDebug( key ); | 80 | odebug << key << oendl; |
81 | if (str.startsWith("#")) { | 81 | if (str.startsWith("#")) { |
82 | str = (key + " " + value + ";"); | 82 | str = (key + " " + value + ";"); |
83 | } else { | 83 | } else { |
84 | str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); | 84 | str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); |
85 | } | 85 | } |
86 | qDebug( str ); | 86 | odebug << str << oendl; |
87 | it = m_file.remove( it ); | 87 | it = m_file.remove( it ); |
88 | it = m_file.insert( it, str ); | 88 | it = m_file.insert( it, str ); |
89 | //return; the regexp is too wide -zecke // all set | 89 | //return; the regexp is too wide -zecke // all set |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | } | 94 | } |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * This loads the config file and stores it inside | 97 | * This loads the config file and stores it inside |
98 | * the m_file | 98 | * the m_file |
99 | */ | 99 | */ |
100 | void HciConfWrapper::load() { | 100 | void HciConfWrapper::load() { |
101 | qWarning("loaded"); | 101 | owarn << "loaded" << oendl; |
102 | m_file.clear(); | 102 | m_file.clear(); |
103 | QFile file( m_fileName ); | 103 | QFile file( m_fileName ); |
104 | if (!file.open( IO_ReadOnly ) ) { | 104 | if (!file.open( IO_ReadOnly ) ) { |
105 | qDebug("Could not open"); | 105 | odebug << "Could not open" << oendl; |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * readAll() into a QByteArray | 110 | * readAll() into a QByteArray |
111 | * QStringList::split('\n', array ) | 111 | * QStringList::split('\n', array ) |
112 | * would this be faster? -zecke | 112 | * would this be faster? -zecke |
113 | */ | 113 | */ |
114 | QTextStream stream(&file ); | 114 | QTextStream stream(&file ); |
115 | QString tmp; | 115 | QString tmp; |
116 | while ( !stream.atEnd() ) { | 116 | while ( !stream.atEnd() ) { |
117 | tmp = stream.readLine(); | 117 | tmp = stream.readLine(); |
118 | m_file.append( tmp ); | 118 | m_file.append( tmp ); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | void HciConfWrapper::save() { | 121 | void HciConfWrapper::save() { |
122 | qWarning("save"); | 122 | owarn << "save" << oendl; |
123 | if (m_file.isEmpty() ) // load first | 123 | if (m_file.isEmpty() ) // load first |
124 | return; | 124 | return; |
125 | 125 | ||
126 | QFile file( m_fileName ); | 126 | QFile file( m_fileName ); |
127 | if ( !file.open(IO_WriteOnly ) ) { | 127 | if ( !file.open(IO_WriteOnly ) ) { |
128 | qWarning("could not open %s", m_fileName.latin1() ); | 128 | owarn << "could not open " << m_fileName.latin1() << "" << oendl; |
129 | return; | 129 | return; |
130 | } | 130 | } |
131 | 131 | ||
132 | QTextStream stream(&file ); | 132 | QTextStream stream(&file ); |
133 | QStringList::Iterator it; | 133 | QStringList::Iterator it; |
134 | for ( it = m_file.begin(); it != m_file.end(); ++it ) { | 134 | for ( it = m_file.begin(); it != m_file.end(); ++it ) { |
135 | stream << (*it) << endl; | 135 | stream << (*it) << endl; |
136 | } | 136 | } |
137 | qWarning("saved"); | 137 | owarn << "saved" << oendl; |
138 | }; | 138 | }; |
139 | } | 139 | } |
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index 1ef862a..3a3dbb0 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp | |||
@@ -71,19 +71,19 @@ void ObexDialog::sendData() { | |||
71 | QString fileURL = cmdLine->text(); | 71 | QString fileURL = cmdLine->text(); |
72 | QString file = QFileInfo( fileURL ).fileName(); | 72 | QString file = QFileInfo( fileURL ).fileName(); |
73 | QString modifiedName = chNameLine->text(); | 73 | QString modifiedName = chNameLine->text(); |
74 | 74 | ||
75 | // vom popupmenu beziehen | 75 | // vom popupmenu beziehen |
76 | OProcess* obexSend = new OProcess(); | 76 | OProcess* obexSend = new OProcess(); |
77 | if ( !modifiedName.isEmpty() ) { | 77 | if ( !modifiedName.isEmpty() ) { |
78 | *obexSend << "ussp-push" << m_device << fileURL << modifiedName; | 78 | *obexSend << "ussp-push" << m_device << fileURL << modifiedName; |
79 | } else { | 79 | } else { |
80 | *obexSend << "ussp-push" << m_device << fileURL << file; | 80 | *obexSend << "ussp-push" << m_device << fileURL << file; |
81 | } | 81 | } |
82 | if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { | 82 | if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { |
83 | qWarning("could not start"); | 83 | owarn << "could not start" << oendl; |
84 | delete obexSend; | 84 | delete obexSend; |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | } | 89 | } |
diff --git a/noncore/net/opietooth/manager/obexpopup.cpp b/noncore/net/opietooth/manager/obexpopup.cpp index d147d52..9a50199 100644 --- a/noncore/net/opietooth/manager/obexpopup.cpp +++ b/noncore/net/opietooth/manager/obexpopup.cpp | |||
@@ -7,39 +7,39 @@ | |||
7 | 7 | ||
8 | /* QT */ | 8 | /* QT */ |
9 | #include <qtimer.h> | 9 | #include <qtimer.h> |
10 | 10 | ||
11 | using namespace OpieTooth; | 11 | using namespace OpieTooth; |
12 | 12 | ||
13 | /* | 13 | /* |
14 | * c'tor init the QAction | 14 | * c'tor init the QAction |
15 | */ | 15 | */ |
16 | ObexPopup::ObexPopup() | 16 | ObexPopup::ObexPopup() |
17 | : QPopupMenu() | 17 | : QPopupMenu() |
18 | { | 18 | { |
19 | qWarning("RfcCommPopup c'tor"); | 19 | owarn << "RfcCommPopup c'tor" << oendl; |
20 | 20 | ||
21 | QAction* a; | 21 | QAction* a; |
22 | 22 | ||
23 | /* connect action */ | 23 | /* connect action */ |
24 | a = new QAction( ); // so it's get deleted | 24 | a = new QAction( ); // so it's get deleted |
25 | a->setText("Push file"); | 25 | a->setText("Push file"); |
26 | a->addTo( this ); | 26 | a->addTo( this ); |
27 | connect( a, SIGNAL( activated() ), | 27 | connect( a, SIGNAL( activated() ), |
28 | this, SLOT( slotPush() ) ); | 28 | this, SLOT( slotPush() ) ); |
29 | }; | 29 | }; |
30 | 30 | ||
31 | 31 | ||
32 | ObexPopup::~ObexPopup() | 32 | ObexPopup::~ObexPopup() |
33 | {} | 33 | {} |
34 | 34 | ||
35 | 35 | ||
36 | void ObexPopup::slotPush() | 36 | void ObexPopup::slotPush() |
37 | { | 37 | { |
38 | 38 | ||
39 | qWarning("push something"); | 39 | owarn << "push something" << oendl; |
40 | 40 | ||
41 | ObexDialog obexDialog; | 41 | ObexDialog obexDialog; |
42 | QPEApplication::execDialog( &obexDialog ); | 42 | QPEApplication::execDialog( &obexDialog ); |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp index 8b05964..43c2777 100644 --- a/noncore/net/opietooth/manager/panpopup.cpp +++ b/noncore/net/opietooth/manager/panpopup.cpp | |||
@@ -2,25 +2,25 @@ | |||
2 | 2 | ||
3 | #include <qtimer.h> | 3 | #include <qtimer.h> |
4 | 4 | ||
5 | #include "panpopup.h" | 5 | #include "panpopup.h" |
6 | 6 | ||
7 | using namespace OpieTooth; | 7 | using namespace OpieTooth; |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * c'tor init the QAction | 10 | * c'tor init the QAction |
11 | */ | 11 | */ |
12 | PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { | 12 | PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { |
13 | 13 | ||
14 | qWarning("PanPopup c'tor"); | 14 | owarn << "PanPopup c'tor" << oendl; |
15 | 15 | ||
16 | m_item = item; | 16 | m_item = item; |
17 | QAction *a, *b, *c; | 17 | QAction *a, *b, *c; |
18 | 18 | ||
19 | m_panconnection = 0l; | 19 | m_panconnection = 0l; |
20 | /* connect action */ | 20 | /* connect action */ |
21 | 21 | ||
22 | 22 | ||
23 | a = new QAction(); // so it's get deleted | 23 | a = new QAction(); // so it's get deleted |
24 | a->setText( tr("connect") ); | 24 | a->setText( tr("connect") ); |
25 | a->addTo( this ); | 25 | a->addTo( this ); |
26 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); | 26 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); |
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp index ab22fea..19deb19 100644 --- a/noncore/net/opietooth/manager/popuphelper.cpp +++ b/noncore/net/opietooth/manager/popuphelper.cpp | |||
@@ -7,28 +7,28 @@ using namespace OpieTooth; | |||
7 | PopupHelper::PopupHelper() { | 7 | PopupHelper::PopupHelper() { |
8 | init(); | 8 | init(); |
9 | } | 9 | } |
10 | 10 | ||
11 | PopupHelper::~PopupHelper() { | 11 | PopupHelper::~PopupHelper() { |
12 | } | 12 | } |
13 | 13 | ||
14 | void PopupHelper::insert( int id, popupFactory fact ) { | 14 | void PopupHelper::insert( int id, popupFactory fact ) { |
15 | m_map.insert(id, fact ); | 15 | m_map.insert(id, fact ); |
16 | } | 16 | } |
17 | 17 | ||
18 | QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) { | 18 | QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) { |
19 | //qWarning("find"); | 19 | //owarn << "find" << oendl; |
20 | FactoryMap::Iterator it = m_map.find(id ); | 20 | FactoryMap::Iterator it = m_map.find(id ); |
21 | if ( it != m_map.end() ) { | 21 | if ( it != m_map.end() ) { |
22 | //qWarning("found"); | 22 | //owarn << "found" << oendl; |
23 | popupFactory fact = it.data(); | 23 | popupFactory fact = it.data(); |
24 | return (*fact)(ser, item); | 24 | return (*fact)(ser, item); |
25 | } | 25 | } |
26 | return 0l; | 26 | return 0l; |
27 | } | 27 | } |
28 | 28 | ||
29 | void PopupHelper::init() { | 29 | void PopupHelper::init() { |
30 | insert( 4355, newRfcComPopup ); | 30 | insert( 4355, newRfcComPopup ); |
31 | insert( 4354, newDunPopup ); | 31 | insert( 4354, newDunPopup ); |
32 | insert( 4353, newRfcComPopup ); | 32 | insert( 4353, newRfcComPopup ); |
33 | insert( 4357, newObexPushPopup ); | 33 | insert( 4357, newObexPushPopup ); |
34 | insert( 4358, newObexPushPopup ); | 34 | insert( 4358, newObexPushPopup ); |
diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp index 78c1501..989bf45 100644 --- a/noncore/net/opietooth/manager/pppdialog.cpp +++ b/noncore/net/opietooth/manager/pppdialog.cpp | |||
@@ -47,23 +47,23 @@ PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, | |||
47 | PPPDialog::~PPPDialog() { | 47 | PPPDialog::~PPPDialog() { |
48 | } | 48 | } |
49 | 49 | ||
50 | void PPPDialog::connectToDevice() { | 50 | void PPPDialog::connectToDevice() { |
51 | outPut->clear(); | 51 | outPut->clear(); |
52 | // vom popupmenu beziehen | 52 | // vom popupmenu beziehen |
53 | QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); | 53 | QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); |
54 | OProcess* pppDial = new OProcess(); | 54 | OProcess* pppDial = new OProcess(); |
55 | *pppDial << "pppd" << m_device << "call" << connectScript; | 55 | *pppDial << "pppd" << m_device << "call" << connectScript; |
56 | connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), | 56 | connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), |
57 | this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) ); | 57 | this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) ); |
58 | if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { | 58 | if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { |
59 | qWarning("could not start"); | 59 | owarn << "could not start" << oendl; |
60 | delete pppDial; | 60 | delete pppDial; |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { | 64 | void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { |
65 | QCString str(cha, len ); | 65 | QCString str(cha, len ); |
66 | outPut->insertLine( str ); | 66 | outPut->insertLine( str ); |
67 | delete pppDial; | 67 | delete pppDial; |
68 | } | 68 | } |
69 | 69 | ||
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp index fc76301..4469129 100644 --- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp | |||
@@ -62,46 +62,46 @@ void RfcommAssignDialog::newDevice( const QString & mac ) | |||
62 | RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); | 62 | RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); |
63 | newDev->setIdent( i ); | 63 | newDev->setIdent( i ); |
64 | newDev->setMac( mac ); | 64 | newDev->setMac( mac ); |
65 | 65 | ||
66 | if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) | 66 | if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) |
67 | { | 67 | { |
68 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); | 68 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); |
69 | m_itemList.insert( i , rfcomm ); | 69 | m_itemList.insert( i , rfcomm ); |
70 | rfcomm->setIdent( i ); | 70 | rfcomm->setIdent( i ); |
71 | rfcomm->setMac( mac ); | 71 | rfcomm->setMac( mac ); |
72 | rfcomm->setChannel( newDev->channel() ); | 72 | rfcomm->setChannel( newDev->channel() ); |
73 | rfcomm->setComment( newDev->comment() ); | 73 | rfcomm->setComment( newDev->comment() ); |
74 | qDebug( "New device set up" ); | 74 | odebug << "New device set up" << oendl; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | void RfcommAssignDialog::loadConfig() | 80 | void RfcommAssignDialog::loadConfig() |
81 | { | 81 | { |
82 | 82 | ||
83 | //Config cfg( "bluetoothmanager-rfcommbind" ); | 83 | //Config cfg( "bluetoothmanager-rfcommbind" ); |
84 | 84 | ||
85 | for ( int i = 0 ; i < m_range; i++ ) | 85 | for ( int i = 0 ; i < m_range; i++ ) |
86 | { | 86 | { |
87 | // cfg.setGroup( QString("%1").arg( i ) ); | 87 | // cfg.setGroup( QString("%1").arg( i ) ); |
88 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); | 88 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); |
89 | m_itemList.insert( i , rfcomm ); | 89 | m_itemList.insert( i , rfcomm ); |
90 | rfcomm->setIdent( i ); | 90 | rfcomm->setIdent( i ); |
91 | QMap<QString, RfCommConfObject*>::Iterator it; | 91 | QMap<QString, RfCommConfObject*>::Iterator it; |
92 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); | 92 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); |
93 | if ( it != confHandler->foundEntries().end() ) | 93 | if ( it != confHandler->foundEntries().end() ) |
94 | { | 94 | { |
95 | qDebug( "Found key in foundEntries() " ); | 95 | odebug << "Found key in foundEntries() " << oendl; |
96 | rfcomm->setMac( it.data()->mac() ); | 96 | rfcomm->setMac( it.data()->mac() ); |
97 | rfcomm->setChannel( it.data()->channel() ); | 97 | rfcomm->setChannel( it.data()->channel() ); |
98 | rfcomm->setComment( it.data()->comment() ); | 98 | rfcomm->setComment( it.data()->comment() ); |
99 | } | 99 | } |
100 | /* Use rfcomm.conf directly for now | 100 | /* Use rfcomm.conf directly for now |
101 | * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); | 101 | * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); |
102 | * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); | 102 | * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); |
103 | * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); | 103 | * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); |
104 | */ | 104 | */ |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp index 20453e8..2ef95ff 100644 --- a/noncore/net/opietooth/manager/rfcommconfhandler.cpp +++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp | |||
@@ -83,32 +83,32 @@ void RfCommConfHandler::load() { | |||
83 | 83 | ||
84 | QString number; | 84 | QString number; |
85 | QString mac; | 85 | QString mac; |
86 | QString channel; | 86 | QString channel; |
87 | QString comment; | 87 | QString comment; |
88 | 88 | ||
89 | for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { | 89 | for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { |
90 | 90 | ||
91 | QString tmpLine = ( *line ).stripWhiteSpace(); | 91 | QString tmpLine = ( *line ).stripWhiteSpace(); |
92 | 92 | ||
93 | if ( tmpLine.startsWith("rfcomm") ) { | 93 | if ( tmpLine.startsWith("rfcomm") ) { |
94 | QString number = tmpLine.mid( 6,1 ); | 94 | QString number = tmpLine.mid( 6,1 ); |
95 | qDebug( tmpLine ); | 95 | odebug << tmpLine << oendl; |
96 | qDebug( "TEST " + number ); | 96 | odebug << "TEST " + number << oendl; |
97 | } else if ( tmpLine.startsWith( "}" ) ) { | 97 | } else if ( tmpLine.startsWith( "}" ) ) { |
98 | m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); | 98 | m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); |
99 | } else if ( tmpLine.startsWith( "device" ) ) { | 99 | } else if ( tmpLine.startsWith( "device" ) ) { |
100 | mac = tmpLine.mid( 7, 17 ); | 100 | mac = tmpLine.mid( 7, 17 ); |
101 | qDebug( "mac" + mac ); | 101 | odebug << "mac" + mac << oendl; |
102 | } else if ( tmpLine.startsWith( "channel" ) ) { | 102 | } else if ( tmpLine.startsWith( "channel" ) ) { |
103 | channel = tmpLine.mid( 8, 1 ); | 103 | channel = tmpLine.mid( 8, 1 ); |
104 | qDebug ( "Channel :" + channel ); | 104 | qDebug ( "Channel :" + channel ); |
105 | } else if ( tmpLine.startsWith( "comment" ) ) { | 105 | } else if ( tmpLine.startsWith( "comment" ) ) { |
106 | comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); | 106 | comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); |
107 | qDebug( "Comment: " + comment ); | 107 | odebug << "Comment: " + comment << oendl; |
108 | } | 108 | } |
109 | } | 109 | } |
110 | rfCommConf.close(); | 110 | rfCommConf.close(); |
111 | } | 111 | } |
112 | save( m_foundEntries ); | 112 | save( m_foundEntries ); |
113 | qDebug( QString( "ENTries: %1").arg( m_foundEntries.count() ) ); | 113 | odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl; |
114 | } | 114 | } |
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp index 04bfe48..01ad616 100644 --- a/noncore/net/opietooth/manager/rfcpopup.cpp +++ b/noncore/net/opietooth/manager/rfcpopup.cpp | |||
@@ -8,25 +8,25 @@ | |||
8 | 8 | ||
9 | /* QT */ | 9 | /* QT */ |
10 | #include <qtimer.h> | 10 | #include <qtimer.h> |
11 | 11 | ||
12 | using namespace OpieTooth; | 12 | using namespace OpieTooth; |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * c'tor init the QAction | 15 | * c'tor init the QAction |
16 | */ | 16 | */ |
17 | RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) | 17 | RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) |
18 | : QPopupMenu() | 18 | : QPopupMenu() |
19 | { | 19 | { |
20 | qWarning("RfcCommPopup c'tor"); | 20 | owarn << "RfcCommPopup c'tor" << oendl; |
21 | 21 | ||
22 | QAction* a; | 22 | QAction* a; |
23 | 23 | ||
24 | 24 | ||
25 | m_item = item; | 25 | m_item = item; |
26 | 26 | ||
27 | /* connect action */ | 27 | /* connect action */ |
28 | a = new QAction( ); // so it's get deleted | 28 | a = new QAction( ); // so it's get deleted |
29 | a->setText("Connect"); | 29 | a->setText("Connect"); |
30 | a->addTo( this ); | 30 | a->addTo( this ); |
31 | connect( a, SIGNAL( activated() ), | 31 | connect( a, SIGNAL( activated() ), |
32 | this, SLOT( slotConnect() ) ); | 32 | this, SLOT( slotConnect() ) ); |
@@ -61,43 +61,43 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) | |||
61 | RfcCommPopup::~RfcCommPopup() | 61 | RfcCommPopup::~RfcCommPopup() |
62 | { | 62 | { |
63 | /* delete m_con; | 63 | /* delete m_con; |
64 | delete m_dis; | 64 | delete m_dis; |
65 | delete m_foo; | 65 | delete m_foo; |
66 | delete m_bar; */ | 66 | delete m_bar; */ |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
70 | void RfcCommPopup::slotConnect() | 70 | void RfcCommPopup::slotConnect() |
71 | { | 71 | { |
72 | 72 | ||
73 | qWarning("connect"); | 73 | owarn << "connect" << oendl; |
74 | 74 | ||
75 | PPPDialog pppDialog; | 75 | PPPDialog pppDialog; |
76 | QPEApplication::execDialog( &pppDialog ); | 76 | QPEApplication::execDialog( &pppDialog ); |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | void RfcCommPopup::slotDisconnect() | 80 | void RfcCommPopup::slotDisconnect() |
81 | { | 81 | { |
82 | qWarning("slot disconnected"); | 82 | owarn << "slot disconnected" << oendl; |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | void RfcCommPopup::slotBind() | 86 | void RfcCommPopup::slotBind() |
87 | { | 87 | { |
88 | RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); | 88 | RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); |
89 | 89 | ||
90 | rfcommAssign.newDevice( m_item->mac() ); | 90 | rfcommAssign.newDevice( m_item->mac() ); |
91 | 91 | ||
92 | if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) | 92 | if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) |
93 | { | 93 | { |
94 | rfcommAssign.saveConfig(); | 94 | rfcommAssign.saveConfig(); |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
99 | void RfcCommPopup::slotBar() | 99 | void RfcCommPopup::slotBar() |
100 | { | 100 | { |
101 | qWarning("slotBar"); | 101 | owarn << "slotBar" << oendl; |
102 | }; | 102 | }; |
103 | 103 | ||
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index c8ea3e3..3b005c4 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp | |||
@@ -146,16 +146,16 @@ namespace OpieTooth { | |||
146 | if ( ( (QCheckListItem*)it.current() )->isOn() ) { | 146 | if ( ( (QCheckListItem*)it.current() )->isOn() ) { |
147 | RemoteDevice device( it.current()->text(1), it.current()->text(0) ); | 147 | RemoteDevice device( it.current()->text(1), it.current()->text(0) ); |
148 | deviceList.append( device ); | 148 | deviceList.append( device ); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | emit selectedDevices( deviceList ); | 151 | emit selectedDevices( deviceList ); |
152 | } | 152 | } |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Cleanup | 155 | * Cleanup |
156 | */ | 156 | */ |
157 | ScanDialog::~ScanDialog() { | 157 | ScanDialog::~ScanDialog() { |
158 | qWarning("delete scan dialog"); | 158 | owarn << "delete scan dialog" << oendl; |
159 | delete localDevice; | 159 | delete localDevice; |
160 | } | 160 | } |
161 | } | 161 | } |
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index da39113..bfdb20a 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -14,50 +14,46 @@ | |||
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | /* LOCAL */ | 16 | /* LOCAL */ |
17 | #include "configwindow.h" | 17 | #include "configwindow.h" |
18 | #include "mainwindow.h" | 18 | #include "mainwindow.h" |
19 | 19 | ||
20 | /* OPIE */ | 20 | /* OPIE */ |
21 | #include <opie2/onetwork.h> | 21 | #include <opie2/onetwork.h> |
22 | #ifdef QWS | 22 | #ifdef QWS |
23 | #include <opie2/oapplication.h> | 23 | #include <opie2/oapplication.h> |
24 | #include <opie2/oconfig.h> | 24 | #include <opie2/oconfig.h> |
25 | #include <opie2/odevice.h> | 25 | #include <opie2/odevice.h> |
26 | using namespace Opie; | 26 | #include <opie2/odebug.h> |
27 | using namespace Opie::Core; | ||
28 | using namespace Opie::Net; | ||
27 | #endif | 29 | #endif |
28 | 30 | ||
29 | /* QT */ | 31 | /* QT */ |
30 | #include <qapplication.h> | 32 | #include <qapplication.h> |
31 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
32 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
33 | #include <qfile.h> | 35 | #include <qfile.h> |
34 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
35 | #include <qlayout.h> | 37 | #include <qlayout.h> |
36 | #include <qmap.h> | 38 | #include <qmap.h> |
37 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
38 | #include <qtabwidget.h> | 40 | #include <qtabwidget.h> |
39 | #include <qtoolbutton.h> | 41 | #include <qtoolbutton.h> |
40 | #include <qspinbox.h> | 42 | #include <qspinbox.h> |
41 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
42 | 44 | ||
43 | /* POSIX */ | 45 | /* STD */ |
44 | #include <assert.h> | 46 | #include <assert.h> |
45 | 47 | ||
46 | using namespace Opie::Core; | ||
47 | using namespace Opie::Net; | ||
48 | using namespace Opie::Core; | ||
49 | using namespace Opie::Net; | ||
50 | using namespace Opie::Core; | ||
51 | using namespace Opie::Net; | ||
52 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | 48 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; |
53 | 49 | ||
54 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 50 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) |
55 | :WellenreiterConfigBase( parent, name, true, f ) | 51 | :WellenreiterConfigBase( parent, name, true, f ) |
56 | { | 52 | { |
57 | _devicetype[ "cisco" ] = DEVTYPE_CISCO; | 53 | _devicetype[ "cisco" ] = DEVTYPE_CISCO; |
58 | _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; | 54 | _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; |
59 | _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; | 55 | _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; |
60 | _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; | 56 | _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; |
61 | _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; | 57 | _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; |
62 | _devicetype[ "<file>" ] = DEVTYPE_FILE; | 58 | _devicetype[ "<file>" ] = DEVTYPE_FILE; |
63 | 59 | ||
@@ -107,46 +103,46 @@ void WellenreiterConfigWindow::accept() | |||
107 | 103 | ||
108 | WellenreiterConfigWindow::~WellenreiterConfigWindow() | 104 | WellenreiterConfigWindow::~WellenreiterConfigWindow() |
109 | { | 105 | { |
110 | } | 106 | } |
111 | 107 | ||
112 | 108 | ||
113 | void WellenreiterConfigWindow::performAutodetection() | 109 | void WellenreiterConfigWindow::performAutodetection() |
114 | { | 110 | { |
115 | //TODO: insert modal splash screen here | 111 | //TODO: insert modal splash screen here |
116 | // and sleep a second, so that it looks | 112 | // and sleep a second, so that it looks |
117 | // like we're actually doing something fancy... ;-) | 113 | // like we're actually doing something fancy... ;-) |
118 | 114 | ||
119 | qDebug( "WellenreiterConfigWindow::performAutodetection()" ); | 115 | odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl; |
120 | 116 | ||
121 | // try to guess device type | 117 | // try to guess device type |
122 | QFile m( "/proc/modules" ); | 118 | QFile m( "/proc/modules" ); |
123 | if ( m.open( IO_ReadOnly ) ) | 119 | if ( m.open( IO_ReadOnly ) ) |
124 | { | 120 | { |
125 | int devicetype(0); | 121 | int devicetype(0); |
126 | QString line; | 122 | QString line; |
127 | QTextStream modules( &m ); | 123 | QTextStream modules( &m ); |
128 | while( !modules.atEnd() && !devicetype ) | 124 | while( !modules.atEnd() && !devicetype ) |
129 | { | 125 | { |
130 | modules >> line; | 126 | modules >> line; |
131 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; | 127 | if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; |
132 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; | 128 | else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; |
133 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; | 129 | else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; |
134 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; | 130 | else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; |
135 | } | 131 | } |
136 | if ( devicetype ) | 132 | if ( devicetype ) |
137 | { | 133 | { |
138 | deviceType->setCurrentItem( devicetype ); | 134 | deviceType->setCurrentItem( devicetype ); |
139 | _guess = devicetype; | 135 | _guess = devicetype; |
140 | qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); | 136 | odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl; |
141 | } | 137 | } |
142 | } | 138 | } |
143 | } | 139 | } |
144 | 140 | ||
145 | 141 | ||
146 | int WellenreiterConfigWindow::driverType() const | 142 | int WellenreiterConfigWindow::driverType() const |
147 | { | 143 | { |
148 | QString name = deviceType->currentText(); | 144 | QString name = deviceType->currentText(); |
149 | if ( _devicetype.contains( name ) ) | 145 | if ( _devicetype.contains( name ) ) |
150 | { | 146 | { |
151 | return _devicetype[name]; | 147 | return _devicetype[name]; |
152 | } | 148 | } |
@@ -232,25 +228,25 @@ void WellenreiterConfigWindow::changedClientAction(int t) | |||
232 | } | 228 | } |
233 | 229 | ||
234 | 230 | ||
235 | void WellenreiterConfigWindow::changedStationAction(int t) | 231 | void WellenreiterConfigWindow::changedStationAction(int t) |
236 | { | 232 | { |
237 | synchronizeActionsAndScripts(); | 233 | synchronizeActionsAndScripts(); |
238 | } | 234 | } |
239 | 235 | ||
240 | 236 | ||
241 | void WellenreiterConfigWindow::getCaptureFileNameClicked() | 237 | void WellenreiterConfigWindow::getCaptureFileNameClicked() |
242 | { | 238 | { |
243 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); | 239 | QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); |
244 | qDebug( "name = %s", (const char*) name ); | 240 | odebug << "name = " << (const char*) name << "" << oendl; |
245 | if ( !name.isEmpty() ) | 241 | if ( !name.isEmpty() ) |
246 | { | 242 | { |
247 | captureFileName->setText( name ); | 243 | captureFileName->setText( name ); |
248 | } | 244 | } |
249 | } | 245 | } |
250 | 246 | ||
251 | 247 | ||
252 | void WellenreiterConfigWindow::channelAllClicked(int state) | 248 | void WellenreiterConfigWindow::channelAllClicked(int state) |
253 | { | 249 | { |
254 | bool b = state; | 250 | bool b = state; |
255 | channel1->setChecked( b ); | 251 | channel1->setChecked( b ); |
256 | channel2->setChecked( b ); | 252 | channel2->setChecked( b ); |
@@ -307,70 +303,70 @@ void WellenreiterConfigWindow::performAction( const QString& type, | |||
307 | else if ( type == "managed" || type == "adhoc" ) | 303 | else if ( type == "managed" || type == "adhoc" ) |
308 | { | 304 | { |
309 | action = newClientAction->currentItem(); | 305 | action = newClientAction->currentItem(); |
310 | script = newClientScript->text(); | 306 | script = newClientScript->text(); |
311 | } | 307 | } |
312 | else if ( type == "station" ) | 308 | else if ( type == "station" ) |
313 | { | 309 | { |
314 | action = newStationAction->currentItem(); | 310 | action = newStationAction->currentItem(); |
315 | script = newStationScript->text(); | 311 | script = newStationScript->text(); |
316 | } | 312 | } |
317 | else | 313 | else |
318 | { | 314 | { |
319 | qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); | 315 | owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << (const char*) type << "'" << oendl; |
320 | return; | 316 | return; |
321 | } | 317 | } |
322 | 318 | ||
323 | qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script ); | 319 | odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << (const char*) script << "')" << oendl; |
324 | 320 | ||
325 | switch( action ) | 321 | switch( action ) |
326 | { | 322 | { |
327 | case 0: /* Ignore */ return; | 323 | case 0: /* Ignore */ return; |
328 | case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; | 324 | case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; |
329 | case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; | 325 | case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; |
330 | case 3: /* Blink LED */ break; //FIXME: Implement this | 326 | case 3: /* Blink LED */ break; //FIXME: Implement this |
331 | case 4: /* Run Script */ | 327 | case 4: /* Run Script */ |
332 | { | 328 | { |
333 | /** | 329 | /** |
334 | * | 330 | * |
335 | * Script Substitution Information: | 331 | * Script Substitution Information: |
336 | * | 332 | * |
337 | * $SSID = SSID | 333 | * $SSID = SSID |
338 | * $MAC = MAC | 334 | * $MAC = MAC |
339 | * $WEP = Wep | 335 | * $WEP = Wep |
340 | * $CHAN = Channel | 336 | * $CHAN = Channel |
341 | * | 337 | * |
342 | **/ | 338 | **/ |
343 | script = script.replace( QRegExp( "$SSID" ), essid ); | 339 | script = script.replace( QRegExp( "$SSID" ), essid ); |
344 | script = script.replace( QRegExp( "$MAC" ), mac ); | 340 | script = script.replace( QRegExp( "$MAC" ), mac ); |
345 | script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); | 341 | script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); |
346 | script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); | 342 | script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); |
347 | 343 | ||
348 | qDebug( "going to call script '%s'", (const char*) script ); | 344 | odebug << "going to call script '" << (const char*) script << "'" << oendl; |
349 | ::system( script ); | 345 | ::system( script ); |
350 | qDebug( "script returned." ); | 346 | odebug << "script returned." << oendl; |
351 | return; | 347 | return; |
352 | } | 348 | } |
353 | default: assert( false ); | 349 | default: assert( false ); |
354 | } | 350 | } |
355 | } | 351 | } |
356 | 352 | ||
357 | 353 | ||
358 | void WellenreiterConfigWindow::load() | 354 | void WellenreiterConfigWindow::load() |
359 | { | 355 | { |
360 | #ifdef Q_WS_X11 | 356 | #ifdef Q_WS_X11 |
361 | #warning Persistent Configuration not yet implemented for standalone X11 build | 357 | #warning Persistent Configuration not yet implemented for standalone X11 build |
362 | performAutodetection(); | 358 | performAutodetection(); |
363 | #else | 359 | #else |
364 | qDebug( "loading configuration settings..." ); | 360 | odebug << "loading configuration settings..." << oendl; |
365 | 361 | ||
366 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ | 362 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ |
367 | 363 | ||
368 | OConfig* c = oApp->config(); | 364 | OConfig* c = oApp->config(); |
369 | 365 | ||
370 | c->setGroup( "Interface" ); | 366 | c->setGroup( "Interface" ); |
371 | 367 | ||
372 | QString interface = c->readEntry( "name", "<none>" ); | 368 | QString interface = c->readEntry( "name", "<none>" ); |
373 | if ( interface != "<none>" ) | 369 | if ( interface != "<none>" ) |
374 | { | 370 | { |
375 | #if QT_VERSION < 300 | 371 | #if QT_VERSION < 300 |
376 | interfaceName->insertItem( interface, 0 ); | 372 | interfaceName->insertItem( interface, 0 ); |
@@ -430,25 +426,25 @@ void WellenreiterConfigWindow::load() | |||
430 | startGPS->setChecked( c->readBoolEntry( "start", false ) ); | 426 | startGPS->setChecked( c->readBoolEntry( "start", false ) ); |
431 | commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); | 427 | commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); |
432 | 428 | ||
433 | #endif | 429 | #endif |
434 | } | 430 | } |
435 | 431 | ||
436 | 432 | ||
437 | void WellenreiterConfigWindow::save() | 433 | void WellenreiterConfigWindow::save() |
438 | { | 434 | { |
439 | #ifdef Q_WS_X11 | 435 | #ifdef Q_WS_X11 |
440 | #warning Persistent Configuration not yet implemented for standalone X11 build | 436 | #warning Persistent Configuration not yet implemented for standalone X11 build |
441 | #else | 437 | #else |
442 | qDebug( "saving configuration settings..." ); | 438 | odebug << "saving configuration settings..." << oendl; |
443 | 439 | ||
444 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ | 440 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ |
445 | 441 | ||
446 | OConfig* c = oApp->config(); | 442 | OConfig* c = oApp->config(); |
447 | 443 | ||
448 | c->setGroup( "Interface" ); | 444 | c->setGroup( "Interface" ); |
449 | c->writeEntry( "name", interfaceName->currentText() ); | 445 | c->writeEntry( "name", interfaceName->currentText() ); |
450 | c->writeEntry( "type", deviceType->currentText() ); | 446 | c->writeEntry( "type", deviceType->currentText() ); |
451 | c->writeEntry( "prism", prismHeader->isChecked() ); | 447 | c->writeEntry( "prism", prismHeader->isChecked() ); |
452 | c->writeEntry( "hop", hopChannels->isChecked() ); | 448 | c->writeEntry( "hop", hopChannels->isChecked() ); |
453 | c->writeEntry( "interval", hopInterval->value() ); | 449 | c->writeEntry( "interval", hopInterval->value() ); |
454 | c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); | 450 | c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); |
diff --git a/noncore/net/wellenreiter/gui/gps.cpp b/noncore/net/wellenreiter/gui/gps.cpp index a47b4ec..bd91e35 100644 --- a/noncore/net/wellenreiter/gui/gps.cpp +++ b/noncore/net/wellenreiter/gui/gps.cpp | |||
@@ -6,71 +6,75 @@ | |||
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 "gps.h" | 16 | #include "gps.h" |
17 | 17 | ||
18 | /* OPIE */ | ||
19 | #include <opie2/odebug.h> | ||
20 | using namespace Opie::Core; | ||
21 | |||
18 | /* QT */ | 22 | /* QT */ |
19 | #include <qtextstream.h> | 23 | #include <qtextstream.h> |
20 | 24 | ||
21 | /* STD */ | 25 | /* STD */ |
22 | #include <stdlib.h> | 26 | #include <stdlib.h> |
23 | #include <unistd.h> | 27 | #include <unistd.h> |
24 | 28 | ||
25 | GPS::GPS( QObject* parent, const char * name ) | 29 | GPS::GPS( QObject* parent, const char * name ) |
26 | :QObject( parent, name ) | 30 | :QObject( parent, name ) |
27 | { | 31 | { |
28 | qDebug( "GPS::GPS()" ); | 32 | odebug << "GPS::GPS()" << oendl; |
29 | _socket = new QSocket( this, "gpsd commsock" ); | 33 | _socket = new QSocket( this, "gpsd commsock" ); |
30 | } | 34 | } |
31 | 35 | ||
32 | 36 | ||
33 | GPS::~GPS() | 37 | GPS::~GPS() |
34 | { | 38 | { |
35 | qDebug( "GPS::~GPS()" ); | 39 | odebug << "GPS::~GPS()" << oendl; |
36 | } | 40 | } |
37 | 41 | ||
38 | 42 | ||
39 | bool GPS::open( const QString& host, int port ) | 43 | bool GPS::open( const QString& host, int port ) |
40 | { | 44 | { |
41 | _socket->connectToHost( host, port ); | 45 | _socket->connectToHost( host, port ); |
42 | } | 46 | } |
43 | 47 | ||
44 | 48 | ||
45 | GpsLocation GPS::position() const | 49 | GpsLocation GPS::position() const |
46 | { | 50 | { |
47 | char buf[256]; | 51 | char buf[256]; |
48 | double lat = -111.0; | 52 | double lat = -111.0; |
49 | double lon = -111.0; | 53 | double lon = -111.0; |
50 | 54 | ||
51 | int result = _socket->writeBlock( "p\r\n", 3 ); | 55 | int result = _socket->writeBlock( "p\r\n", 3 ); |
52 | _socket->flush(); | 56 | _socket->flush(); |
53 | if ( result ) | 57 | if ( result ) |
54 | { | 58 | { |
55 | int numAvail = _socket->bytesAvailable(); | 59 | int numAvail = _socket->bytesAvailable(); |
56 | qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail ); | 60 | odebug << "GPS write succeeded, " << numAvail << " bytes available for reading..." << oendl; |
57 | if ( numAvail ) | 61 | if ( numAvail ) |
58 | { | 62 | { |
59 | int numRead = _socket->readBlock( &buf[0], sizeof buf ); | 63 | int numRead = _socket->readBlock( &buf[0], sizeof buf ); |
60 | int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); | 64 | int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon); |
61 | 65 | ||
62 | if ( numRead < 7 || numScan != 2 ) | 66 | if ( numRead < 7 || numScan != 2 ) |
63 | { | 67 | { |
64 | qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] ); | 68 | odebug << "GPS read " << numRead << " bytes succeeded, invalid response: '" << &buf[0] << "'" << oendl; |
65 | return GpsLocation( -111, -111 ); | 69 | return GpsLocation( -111, -111 ); |
66 | } | 70 | } |
67 | else | 71 | else |
68 | { | 72 | { |
69 | return GpsLocation( lat, lon ); | 73 | return GpsLocation( lat, lon ); |
70 | } | 74 | } |
71 | } | 75 | } |
72 | } | 76 | } |
73 | return GpsLocation( -111, -111 ); | 77 | return GpsLocation( -111, -111 ); |
74 | } | 78 | } |
75 | 79 | ||
76 | 80 | ||
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp index 1c72cf4..714a9a9 100644 --- a/noncore/net/wellenreiter/gui/logwindow.cpp +++ b/noncore/net/wellenreiter/gui/logwindow.cpp | |||
@@ -5,49 +5,55 @@ | |||
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 "logwindow.h" | 16 | #include "logwindow.h" |
17 | |||
18 | /* OPIE */ | ||
19 | #include <opie2/odebug.h> | ||
20 | using namespace Opie::Core; | ||
21 | |||
22 | /* QT */ | ||
17 | #include <qmultilineedit.h> | 23 | #include <qmultilineedit.h> |
18 | #include <qdatetime.h> | 24 | #include <qdatetime.h> |
19 | 25 | ||
20 | MLogWindow* MLogWindow::_instance; | 26 | MLogWindow* MLogWindow::_instance; |
21 | 27 | ||
22 | MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) | 28 | MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) |
23 | :QVBox( parent, name, f ) | 29 | :QVBox( parent, name, f ) |
24 | { | 30 | { |
25 | ledit = new QMultiLineEdit( this ); | 31 | ledit = new QMultiLineEdit( this ); |
26 | ledit->setReadOnly( true ); | 32 | ledit->setReadOnly( true ); |
27 | 33 | ||
28 | MLogWindow::_instance = this; | 34 | MLogWindow::_instance = this; |
29 | } | 35 | } |
30 | 36 | ||
31 | 37 | ||
32 | void MLogWindow::log( QString text ) | 38 | void MLogWindow::log( QString text ) |
33 | { | 39 | { |
34 | QTime time = QTime::currentTime(); | 40 | QTime time = QTime::currentTime(); |
35 | QString line; | 41 | QString line; |
36 | line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); | 42 | line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); |
37 | int col; | 43 | int col; |
38 | int row; | 44 | int row; |
39 | ledit->getCursorPosition( &col, &row ); | 45 | ledit->getCursorPosition( &col, &row ); |
40 | ledit->insertAt( line, col, row ); | 46 | ledit->insertAt( line, col, row ); |
41 | qDebug( line ); | 47 | odebug << line << oendl; |
42 | } | 48 | } |
43 | 49 | ||
44 | 50 | ||
45 | void MLogWindow::clear() | 51 | void MLogWindow::clear() |
46 | { | 52 | { |
47 | ledit->clear(); | 53 | ledit->clear(); |
48 | } | 54 | } |
49 | 55 | ||
50 | 56 | ||
51 | const QString MLogWindow::getLog() const | 57 | const QString MLogWindow::getLog() const |
52 | { | 58 | { |
53 | return ledit->text(); | 59 | return ledit->text(); |
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 6bbc39b..62db967 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp | |||
@@ -5,97 +5,100 @@ | |||
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 "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | |||
17 | #ifdef QWS | 18 | #ifdef QWS |
19 | #include <opie2/odebug.h> | ||
18 | #include <opie2/oapplication.h> | 20 | #include <opie2/oapplication.h> |
19 | #include <opie2/oprocess.h> | 21 | #include <opie2/oprocess.h> |
20 | #else | 22 | #else |
21 | #include <qapplication.h> | 23 | #include <qapplication.h> |
22 | #endif | 24 | #endif |
23 | 25 | ||
26 | /* QT */ | ||
24 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
25 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
26 | 29 | ||
30 | /* STD */ | ||
27 | #include <errno.h> | 31 | #include <errno.h> |
28 | #include <signal.h> | 32 | #include <signal.h> |
29 | #include <string.h> | 33 | #include <string.h> |
30 | #include <unistd.h> | 34 | #include <unistd.h> |
31 | 35 | ||
32 | using namespace Opie::Core; | 36 | using namespace Opie::Core; |
33 | using namespace Opie::Core; | 37 | |
34 | using namespace Opie::Core; | ||
35 | int main( int argc, char **argv ) | 38 | int main( int argc, char **argv ) |
36 | { | 39 | { |
37 | #ifdef QWS | 40 | #ifdef QWS |
38 | OApplication a( argc, argv, "Wellenreiter II" ); | 41 | OApplication a( argc, argv, "Wellenreiter II" ); |
39 | #else | 42 | #else |
40 | QApplication a( argc, argv ); | 43 | QApplication a( argc, argv ); |
41 | #endif | 44 | #endif |
42 | WellenreiterMainWindow* w = new WellenreiterMainWindow(); | 45 | WellenreiterMainWindow* w = new WellenreiterMainWindow(); |
43 | #ifdef QWS | 46 | #ifdef QWS |
44 | a.showMainWidget( w ); | 47 | a.showMainWidget( w ); |
45 | #else | 48 | #else |
46 | a.setMainWidget( w ); | 49 | a.setMainWidget( w ); |
47 | w->setCaption( "Wellenreiter II" ); | 50 | w->setCaption( "Wellenreiter II" ); |
48 | w->show(); | 51 | w->show(); |
49 | #endif | 52 | #endif |
50 | 53 | ||
51 | a.processEvents(); // show the window before doing the safety checks | 54 | a.processEvents(); // show the window before doing the safety checks |
52 | int result = -1; | 55 | int result = -1; |
53 | static int killed = false; | 56 | static int killed = false; |
54 | 57 | ||
55 | bool check = true; | 58 | bool check = true; |
56 | for ( int i = 1; i < argc; ++i ) | 59 | for ( int i = 1; i < argc; ++i ) |
57 | { | 60 | { |
58 | qDebug( "Wellenreiter::main() parsing argument %d = '%s'", i, argv[i] ); | 61 | odebug << "Wellenreiter::main() parsing argument " << i << " = '" << argv[i] << "'" << oendl; |
59 | if ( !strcmp( "-nocheck", argv[i] ) ) | 62 | if ( !strcmp( "-nocheck", argv[i] ) ) |
60 | { | 63 | { |
61 | qDebug( "-nocheck found" ); | 64 | odebug << "-nocheck found" << oendl; |
62 | check = false; | 65 | check = false; |
63 | break; | 66 | break; |
64 | } | 67 | } |
65 | } | 68 | } |
66 | 69 | ||
67 | if ( check ) | 70 | if ( check ) |
68 | { | 71 | { |
69 | // root check | 72 | // root check |
70 | if ( getuid() ) | 73 | if ( getuid() ) |
71 | { | 74 | { |
72 | qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); | 75 | owarn << QObject::tr( "Wellenreiter: trying to run as non-root!" ) << oendl; |
73 | result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" | 76 | result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" |
74 | "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), | 77 | "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), |
75 | QMessageBox::Yes, QMessageBox::No ); | 78 | QMessageBox::Yes, QMessageBox::No ); |
76 | if ( result == QMessageBox::No ) return -1; | 79 | if ( result == QMessageBox::No ) return -1; |
77 | } | 80 | } |
78 | 81 | ||
79 | int dhcpid = OProcess::processPID( "dhcpc" ); | 82 | int dhcpid = OProcess::processPID( "dhcpc" ); |
80 | 83 | ||
81 | if ( dhcpid ) | 84 | if ( dhcpid ) |
82 | { | 85 | { |
83 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" | 86 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" |
84 | "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ), | 87 | "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ), |
85 | QMessageBox::Yes, QMessageBox::No ); | 88 | QMessageBox::Yes, QMessageBox::No ); |
86 | if ( result == QMessageBox::Yes ) | 89 | if ( result == QMessageBox::Yes ) |
87 | { | 90 | { |
88 | if ( -1 == ::kill( dhcpid, SIGTERM ) ) | 91 | if ( -1 == ::kill( dhcpid, SIGTERM ) ) |
89 | qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); | 92 | owarn << "Wellenreiter: can't kill process #" << result << " (" << strerror( errno ) << ")" << oendl; |
90 | else | 93 | else |
91 | killed = true; | 94 | killed = true; |
92 | } | 95 | } |
93 | } | 96 | } |
94 | } | 97 | } |
95 | 98 | ||
96 | a.exec(); | 99 | a.exec(); |
97 | 100 | ||
98 | if ( check ) | 101 | if ( check ) |
99 | { | 102 | { |
100 | 103 | ||
101 | if ( killed ) | 104 | if ( killed ) |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 7add6cd..a4b8839 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -12,59 +12,60 @@ | |||
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 "configwindow.h" | 16 | #include "configwindow.h" |
17 | #include "gps.h" | 17 | #include "gps.h" |
18 | #include "logwindow.h" | 18 | #include "logwindow.h" |
19 | #include "packetview.h" | 19 | #include "packetview.h" |
20 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
21 | #include "wellenreiter.h" | 21 | #include "wellenreiter.h" |
22 | #include "scanlist.h" | 22 | #include "scanlist.h" |
23 | 23 | ||
24 | /* OPIE */ | ||
25 | #ifdef QWS | ||
26 | #include <qpe/resource.h> | ||
27 | #include <opie2/odebug.h> | ||
28 | #include <opie2/ofiledialog.h> | ||
29 | #else | ||
30 | #include "resource.h" | ||
31 | #include <qapplication.h> | ||
32 | #include <qfiledialog.h> | ||
33 | #endif | ||
34 | using namespace Opie::Core; | ||
35 | using namespace Opie::Net; | ||
36 | using namespace Opie::Ui; | ||
37 | |||
38 | /* QT */ | ||
24 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
25 | #include <qdatastream.h> | 40 | #include <qdatastream.h> |
26 | #include <qfile.h> | 41 | #include <qfile.h> |
27 | #include <qfileinfo.h> | 42 | #include <qfileinfo.h> |
28 | #include <qlabel.h> | 43 | #include <qlabel.h> |
29 | #include <qlayout.h> | 44 | #include <qlayout.h> |
30 | #include <qlineedit.h> | 45 | #include <qlineedit.h> |
31 | #include <qiconset.h> | 46 | #include <qiconset.h> |
32 | #include <qmenubar.h> | 47 | #include <qmenubar.h> |
33 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
34 | #include <qpopupmenu.h> | 49 | #include <qpopupmenu.h> |
35 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
36 | #include <qstatusbar.h> | 51 | #include <qstatusbar.h> |
37 | #include <qspinbox.h> | 52 | #include <qspinbox.h> |
38 | #include <qtextstream.h> | 53 | #include <qtextstream.h> |
39 | #include <qtoolbutton.h> | 54 | #include <qtoolbutton.h> |
40 | #include <qwhatsthis.h> | 55 | #include <qwhatsthis.h> |
41 | 56 | ||
42 | #ifdef QWS | 57 | /* STD */ |
43 | #include <qpe/resource.h> | ||
44 | #include <opie2/ofiledialog.h> | ||
45 | using namespace Opie; | ||
46 | #else | ||
47 | #include "resource.h" | ||
48 | #include <qapplication.h> | ||
49 | #include <qfiledialog.h> | ||
50 | #endif | ||
51 | |||
52 | #include <unistd.h> | 58 | #include <unistd.h> |
53 | 59 | ||
54 | using namespace Opie::Ui; | ||
55 | using namespace Opie::Net; | ||
56 | using namespace Opie::Ui; | ||
57 | using namespace Opie::Net; | ||
58 | using namespace Opie::Net; | ||
59 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 60 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
60 | :QMainWindow( parent, name, f ) | 61 | :QMainWindow( parent, name, f ) |
61 | { | 62 | { |
62 | cw = new WellenreiterConfigWindow( this ); | 63 | cw = new WellenreiterConfigWindow( this ); |
63 | mw = new Wellenreiter( this ); | 64 | mw = new Wellenreiter( this ); |
64 | mw->setConfigWindow( cw ); | 65 | mw->setConfigWindow( cw ); |
65 | setCentralWidget( mw ); | 66 | setCentralWidget( mw ); |
66 | 67 | ||
67 | // setup application icon | 68 | // setup application icon |
68 | 69 | ||
69 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 70 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
70 | #ifndef QWS | 71 | #ifndef QWS |
@@ -179,25 +180,25 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
179 | #ifndef QWS | 180 | #ifndef QWS |
180 | statusBar()->message( tr( "Ready." ) ); | 181 | statusBar()->message( tr( "Ready." ) ); |
181 | #endif | 182 | #endif |
182 | 183 | ||
183 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | 184 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); |
184 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | 185 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); |
185 | }; | 186 | }; |
186 | 187 | ||
187 | 188 | ||
188 | 189 | ||
189 | void WellenreiterMainWindow::showConfigure() | 190 | void WellenreiterMainWindow::showConfigure() |
190 | { | 191 | { |
191 | qDebug( "show configure..." ); | 192 | odebug << "show configure..." << oendl; |
192 | cw->setCaption( tr( "Configure" ) ); | 193 | cw->setCaption( tr( "Configure" ) ); |
193 | int result = QPEApplication::execDialog( cw ); | 194 | int result = QPEApplication::execDialog( cw ); |
194 | 195 | ||
195 | if ( result ) updateToolButtonState(); | 196 | if ( result ) updateToolButtonState(); |
196 | } | 197 | } |
197 | 198 | ||
198 | 199 | ||
199 | void WellenreiterMainWindow::updateToolButtonState() | 200 | void WellenreiterMainWindow::updateToolButtonState() |
200 | { | 201 | { |
201 | const QString& interface = cw->interfaceName->currentText(); | 202 | const QString& interface = cw->interfaceName->currentText(); |
202 | const int cardtype = cw->driverType(); | 203 | const int cardtype = cw->driverType(); |
203 | 204 | ||
@@ -222,45 +223,45 @@ void WellenreiterMainWindow::changedSniffingState() | |||
222 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 223 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
223 | 224 | ||
224 | if ( !mw->sniffing ) | 225 | if ( !mw->sniffing ) |
225 | { | 226 | { |
226 | menuBar()->setItemEnabled( uploadID, true ); | 227 | menuBar()->setItemEnabled( uploadID, true ); |
227 | uploadButton->setEnabled( true ); | 228 | uploadButton->setEnabled( true ); |
228 | } | 229 | } |
229 | } | 230 | } |
230 | 231 | ||
231 | 232 | ||
232 | WellenreiterMainWindow::~WellenreiterMainWindow() | 233 | WellenreiterMainWindow::~WellenreiterMainWindow() |
233 | { | 234 | { |
234 | qDebug( "Wellenreiter: bye." ); | 235 | odebug << "Wellenreiter: bye." << oendl; |
235 | }; | 236 | }; |
236 | 237 | ||
237 | 238 | ||
238 | void WellenreiterMainWindow::demoAddStations() | 239 | void WellenreiterMainWindow::demoAddStations() |
239 | { | 240 | { |
240 | //mw = 0; // test SIGSEGV handling | 241 | //mw = 0; // test SIGSEGV handling |
241 | 242 | ||
242 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); | 243 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) ); |
243 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); | 244 | mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); |
244 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); | 245 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); |
245 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); | 246 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); |
246 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); | 247 | mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); |
247 | } | 248 | } |
248 | 249 | ||
249 | 250 | ||
250 | void WellenreiterMainWindow::demoReadFromGps() | 251 | void WellenreiterMainWindow::demoReadFromGps() |
251 | { | 252 | { |
252 | WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); | 253 | WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance(); |
253 | GPS* gps = new GPS( this ); | 254 | GPS* gps = new GPS( this ); |
254 | qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 255 | odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl; |
255 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 256 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); |
256 | GpsLocation loc = gps->position(); | 257 | GpsLocation loc = gps->position(); |
257 | QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); | 258 | QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) ); |
258 | delete gps; | 259 | delete gps; |
259 | } | 260 | } |
260 | 261 | ||
261 | 262 | ||
262 | QString WellenreiterMainWindow::getFileName( bool save ) | 263 | QString WellenreiterMainWindow::getFileName( bool save ) |
263 | { | 264 | { |
264 | QMap<QString, QStringList> map; | 265 | QMap<QString, QStringList> map; |
265 | map.insert( tr("All"), QStringList() ); | 266 | map.insert( tr("All"), QStringList() ); |
266 | QStringList text; | 267 | QStringList text; |
@@ -296,93 +297,93 @@ QString WellenreiterMainWindow::getFileName( bool save ) | |||
296 | 297 | ||
297 | void WellenreiterMainWindow::fileSaveLog() | 298 | void WellenreiterMainWindow::fileSaveLog() |
298 | { | 299 | { |
299 | QString fname = getFileName( true ); | 300 | QString fname = getFileName( true ); |
300 | if ( !fname.isEmpty() ) | 301 | if ( !fname.isEmpty() ) |
301 | { | 302 | { |
302 | QFile f( fname ); | 303 | QFile f( fname ); |
303 | if ( f.open(IO_WriteOnly) ) | 304 | if ( f.open(IO_WriteOnly) ) |
304 | { | 305 | { |
305 | QTextStream t( &f ); | 306 | QTextStream t( &f ); |
306 | t << mw->logWindow()->getLog(); | 307 | t << mw->logWindow()->getLog(); |
307 | f.close(); | 308 | f.close(); |
308 | qDebug( "Saved log to file '%s'", (const char*) fname ); | 309 | odebug << "Saved log to file '" << (const char*) fname << "'" << oendl; |
309 | } | 310 | } |
310 | else | 311 | else |
311 | { | 312 | { |
312 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); | 313 | odebug << "Problem saving log to file '" << (const char*) fname << "'" << oendl; |
313 | } | 314 | } |
314 | } | 315 | } |
315 | } | 316 | } |
316 | 317 | ||
317 | void WellenreiterMainWindow::fileSaveSession() | 318 | void WellenreiterMainWindow::fileSaveSession() |
318 | { | 319 | { |
319 | QString fname = getFileName( true ); | 320 | QString fname = getFileName( true ); |
320 | if ( !fname.isEmpty() ) | 321 | if ( !fname.isEmpty() ) |
321 | { | 322 | { |
322 | 323 | ||
323 | QFile f( fname ); | 324 | QFile f( fname ); |
324 | if ( f.open(IO_WriteOnly) ) | 325 | if ( f.open(IO_WriteOnly) ) |
325 | { | 326 | { |
326 | QDataStream t( &f ); | 327 | QDataStream t( &f ); |
327 | t << *mw->netView(); | 328 | t << *mw->netView(); |
328 | f.close(); | 329 | f.close(); |
329 | qDebug( "Saved session to file '%s'", (const char*) fname ); | 330 | odebug << "Saved session to file '" << (const char*) fname << "'" << oendl; |
330 | } | 331 | } |
331 | else | 332 | else |
332 | { | 333 | { |
333 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); | 334 | odebug << "Problem saving session to file '" << (const char*) fname << "'" << oendl; |
334 | } | 335 | } |
335 | } | 336 | } |
336 | } | 337 | } |
337 | 338 | ||
338 | void WellenreiterMainWindow::fileSaveHex() | 339 | void WellenreiterMainWindow::fileSaveHex() |
339 | { | 340 | { |
340 | #warning DOES NOT WORK AT THE MOMENT | 341 | #warning DOES NOT WORK AT THE MOMENT |
341 | /* | 342 | /* |
342 | QString fname = getFileName( true ); | 343 | QString fname = getFileName( true ); |
343 | if ( !fname.isEmpty() ) | 344 | if ( !fname.isEmpty() ) |
344 | { | 345 | { |
345 | QFile f( fname ); | 346 | QFile f( fname ); |
346 | if ( f.open(IO_WriteOnly) ) | 347 | if ( f.open(IO_WriteOnly) ) |
347 | { | 348 | { |
348 | QTextStream t( &f ); | 349 | QTextStream t( &f ); |
349 | t << mw->hexWindow()->getLog(); | 350 | t << mw->hexWindow()->getLog(); |
350 | f.close(); | 351 | f.close(); |
351 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); | 352 | odebug << "Saved hex log to file '" << (const char*) fname << "'" << oendl; |
352 | } | 353 | } |
353 | else | 354 | else |
354 | { | 355 | { |
355 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); | 356 | odebug << "Problem saving hex log to file '" << (const char*) fname << "'" << oendl; |
356 | } | 357 | } |
357 | } | 358 | } |
358 | */ | 359 | */ |
359 | } | 360 | } |
360 | 361 | ||
361 | void WellenreiterMainWindow::fileLoadSession() | 362 | void WellenreiterMainWindow::fileLoadSession() |
362 | { | 363 | { |
363 | QString fname = getFileName( false ); | 364 | QString fname = getFileName( false ); |
364 | if ( !fname.isEmpty() ) | 365 | if ( !fname.isEmpty() ) |
365 | { | 366 | { |
366 | QFile f( fname ); | 367 | QFile f( fname ); |
367 | if ( f.open(IO_ReadOnly) ) | 368 | if ( f.open(IO_ReadOnly) ) |
368 | { | 369 | { |
369 | QDataStream t( &f ); | 370 | QDataStream t( &f ); |
370 | t >> *mw->netView(); | 371 | t >> *mw->netView(); |
371 | f.close(); | 372 | f.close(); |
372 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 373 | odebug << "Loaded session from file '" << (const char*) fname << "'" << oendl; |
373 | } | 374 | } |
374 | else | 375 | else |
375 | { | 376 | { |
376 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 377 | odebug << "Problem loading session from file '" << (const char*) fname << "'" << oendl; |
377 | } | 378 | } |
378 | } | 379 | } |
379 | } | 380 | } |
380 | 381 | ||
381 | 382 | ||
382 | void WellenreiterMainWindow::fileNew() | 383 | void WellenreiterMainWindow::fileNew() |
383 | { | 384 | { |
384 | mw->netView()->clear(); | 385 | mw->netView()->clear(); |
385 | mw->logWindow()->clear(); | 386 | mw->logWindow()->clear(); |
386 | mw->hexWindow()->clear(); | 387 | mw->hexWindow()->clear(); |
387 | } | 388 | } |
388 | 389 | ||
@@ -429,29 +430,29 @@ void WellenreiterMainWindow::uploadSession() | |||
429 | g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); | 430 | g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 ); |
430 | accept->setDefault( true ); | 431 | accept->setDefault( true ); |
431 | accept->setAutoDefault( true ); | 432 | accept->setAutoDefault( true ); |
432 | from->setText( "WL II User" ); | 433 | from->setText( "WL II User" ); |
433 | location->setText( "WL II Location" ); | 434 | location->setText( "WL II Location" ); |
434 | comments->setText( "No Comments." ); | 435 | comments->setText( "No Comments." ); |
435 | connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); | 436 | connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) ); |
436 | connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); | 437 | connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) ); |
437 | int result = d->exec(); | 438 | int result = d->exec(); |
438 | 439 | ||
439 | if ( !result ) | 440 | if ( !result ) |
440 | { | 441 | { |
441 | qDebug( "Session upload cancelled :(" ); | 442 | odebug << "Session upload cancelled :(" << oendl; |
442 | return; | 443 | return; |
443 | } | 444 | } |
444 | 445 | ||
445 | qDebug( "Starting upload..." ); | 446 | odebug << "Starting upload..." << oendl; |
446 | 447 | ||
447 | struct sockaddr_in raddr; | 448 | struct sockaddr_in raddr; |
448 | struct hostent *rhost_info; | 449 | struct hostent *rhost_info; |
449 | int sock = -1; | 450 | int sock = -1; |
450 | bool ok = false; | 451 | bool ok = false; |
451 | 452 | ||
452 | rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); | 453 | rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname ); |
453 | if ( rhost_info ) | 454 | if ( rhost_info ) |
454 | { | 455 | { |
455 | 456 | ||
456 | 457 | ||
457 | if ( !QFile::exists( mw->captureFileName() ) ) | 458 | if ( !QFile::exists( mw->captureFileName() ) ) |
diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp index 3d3aa18..4df01da 100644 --- a/noncore/net/wellenreiter/gui/packetview.cpp +++ b/noncore/net/wellenreiter/gui/packetview.cpp | |||
@@ -75,25 +75,25 @@ void PacketView::showPacket( int number ) | |||
75 | { | 75 | { |
76 | _list->clear(); | 76 | _list->clear(); |
77 | _hex->setText(""); | 77 | _hex->setText(""); |
78 | const OPacket* p = _packets.at( number ); | 78 | const OPacket* p = _packets.at( number ); |
79 | 79 | ||
80 | if ( p ) | 80 | if ( p ) |
81 | { | 81 | { |
82 | _doSubPackets( const_cast<QObjectList*>( p->children() ), 0 ); | 82 | _doSubPackets( const_cast<QObjectList*>( p->children() ), 0 ); |
83 | _doHexPacket( p ); | 83 | _doHexPacket( p ); |
84 | } | 84 | } |
85 | else | 85 | else |
86 | { | 86 | { |
87 | qDebug( "D'oh! No packet!" ); | 87 | odebug << "D'oh! No packet!" << oendl; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | void PacketView::_doSubPackets( QObjectList* l, int counter ) | 91 | void PacketView::_doSubPackets( QObjectList* l, int counter ) |
92 | { | 92 | { |
93 | if (!l) return; | 93 | if (!l) return; |
94 | QObject* o = l->first(); | 94 | QObject* o = l->first(); |
95 | while ( o ) | 95 | while ( o ) |
96 | { | 96 | { |
97 | new OListViewItem( _list, QString::number( counter++ ), o->name() ); | 97 | new OListViewItem( _list, QString::number( counter++ ), o->name() ); |
98 | _doSubPackets( const_cast<QObjectList*>( o->children() ), counter ); | 98 | _doSubPackets( const_cast<QObjectList*>( o->children() ), counter ); |
99 | o = l->next(); | 99 | o = l->next(); |
diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp index d98ef0b..cb17f51 100644 --- a/noncore/net/wellenreiter/gui/resource.cpp +++ b/noncore/net/wellenreiter/gui/resource.cpp | |||
@@ -20,30 +20,30 @@ | |||
20 | #include <qiconset.h> | 20 | #include <qiconset.h> |
21 | 21 | ||
22 | namespace Resource | 22 | namespace Resource |
23 | { | 23 | { |
24 | 24 | ||
25 | QPixmap loadPixmap( const QString& pix ) | 25 | QPixmap loadPixmap( const QString& pix ) |
26 | { | 26 | { |
27 | QString filename; | 27 | QString filename; |
28 | filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); | 28 | filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); |
29 | QPixmap pixmap( filename ); | 29 | QPixmap pixmap( filename ); |
30 | if ( pixmap.isNull() ) | 30 | if ( pixmap.isNull() ) |
31 | { | 31 | { |
32 | qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); | 32 | odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; |
33 | } | 33 | } |
34 | return pixmap; | 34 | return pixmap; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | QIconSet loadIconSet( const QString& pix ) | 37 | QIconSet loadIconSet( const QString& pix ) |
38 | { | 38 | { |
39 | QString filename; | 39 | QString filename; |
40 | filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); | 40 | filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); |
41 | QPixmap pixmap( filename ); | 41 | QPixmap pixmap( filename ); |
42 | if ( pixmap.isNull() ) | 42 | if ( pixmap.isNull() ) |
43 | { | 43 | { |
44 | qDebug( "Wellenreiter::Resource: can't find pixmap " + filename ); | 44 | odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; |
45 | } | 45 | } |
46 | return QIconSet( pixmap ); | 46 | return QIconSet( pixmap ); |
47 | }; | 47 | }; |
48 | 48 | ||
49 | }; | 49 | }; |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 3b7120a..a2be782 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -8,59 +8,58 @@ | |||
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 | #include <assert.h> | 20 | /* OPIE */ |
21 | #include <qcursor.h> | ||
22 | #include <qdatetime.h> | ||
23 | #include <qpopupmenu.h> | ||
24 | #include <qcheckbox.h> | ||
25 | |||
26 | #ifdef QWS | 21 | #ifdef QWS |
22 | #include <opie2/odebug.h> | ||
27 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
28 | #endif | ||
29 | |||
30 | #ifdef QWS | ||
31 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
32 | #else | 25 | #else |
33 | #include "resource.h" | 26 | #include "resource.h" |
34 | #endif | 27 | #endif |
28 | using namespace Opie::Core; | ||
29 | using namespace Opie::Ui; | ||
30 | using namespace Opie::Net; | ||
31 | |||
32 | /* QT */ | ||
33 | #include <qcursor.h> | ||
34 | #include <qdatetime.h> | ||
35 | #include <qpopupmenu.h> | ||
36 | #include <qcheckbox.h> | ||
37 | |||
38 | /* STD */ | ||
39 | #include <assert.h> | ||
35 | 40 | ||
36 | const int col_type = 0; | 41 | const int col_type = 0; |
37 | const int col_essid = 0; | 42 | const int col_essid = 0; |
38 | const int col_sig = 1; | 43 | const int col_sig = 1; |
39 | const int col_ap = 2; | 44 | const int col_ap = 2; |
40 | const int col_channel = 3; | 45 | const int col_channel = 3; |
41 | const int col_wep = 4; | 46 | const int col_wep = 4; |
42 | const int col_traffic = 5; | 47 | const int col_traffic = 5; |
43 | const int col_ip = 6; | 48 | const int col_ip = 6; |
44 | const int col_manuf = 7; | 49 | const int col_manuf = 7; |
45 | const int col_firstseen = 8; | 50 | const int col_firstseen = 8; |
46 | const int col_lastseen = 9; | 51 | const int col_lastseen = 9; |
47 | const int col_location = 10; | 52 | const int col_location = 10; |
48 | 53 | ||
49 | using namespace Opie::Net; | ||
50 | using namespace Opie::Ui; | ||
51 | using namespace Opie::Net; | ||
52 | using namespace Opie::Ui; | ||
53 | using namespace Opie::Ui; | ||
54 | using namespace Opie::Net; | ||
55 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 54 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
56 | :OListView( parent, name ) | 55 | :OListView( parent, name ) |
57 | { | 56 | { |
58 | setFrameShape( QListView::StyledPanel ); | 57 | setFrameShape( QListView::StyledPanel ); |
59 | setFrameShadow( QListView::Sunken ); | 58 | setFrameShadow( QListView::Sunken ); |
60 | 59 | ||
61 | addColumn( tr( "Net/Station" ) ); | 60 | addColumn( tr( "Net/Station" ) ); |
62 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); | 61 | setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); |
63 | addColumn( tr( "#" ) ); | 62 | addColumn( tr( "#" ) ); |
64 | setColumnAlignment( col_sig, AlignCenter ); | 63 | setColumnAlignment( col_sig, AlignCenter ); |
65 | addColumn( tr( "MAC" ) ); | 64 | addColumn( tr( "MAC" ) ); |
66 | setColumnAlignment( col_ap, AlignCenter ); | 65 | setColumnAlignment( col_ap, AlignCenter ); |
@@ -97,32 +96,32 @@ MScanListView::~MScanListView() | |||
97 | { | 96 | { |
98 | }; | 97 | }; |
99 | 98 | ||
100 | 99 | ||
101 | OListViewItem* MScanListView::childFactory() | 100 | OListViewItem* MScanListView::childFactory() |
102 | { | 101 | { |
103 | return new MScanListItem( this ); | 102 | return new MScanListItem( this ); |
104 | } | 103 | } |
105 | 104 | ||
106 | 105 | ||
107 | void MScanListView::serializeTo( QDataStream& s) const | 106 | void MScanListView::serializeTo( QDataStream& s) const |
108 | { | 107 | { |
109 | qDebug( "serializing MScanListView" ); | 108 | odebug << "serializing MScanListView" << oendl; |
110 | OListView::serializeTo( s ); | 109 | OListView::serializeTo( s ); |
111 | } | 110 | } |
112 | 111 | ||
113 | 112 | ||
114 | void MScanListView::serializeFrom( QDataStream& s) | 113 | void MScanListView::serializeFrom( QDataStream& s) |
115 | { | 114 | { |
116 | qDebug( "serializing MScanListView" ); | 115 | odebug << "serializing MScanListView" << oendl; |
117 | OListView::serializeFrom( s ); | 116 | OListView::serializeFrom( s ); |
118 | } | 117 | } |
119 | 118 | ||
120 | 119 | ||
121 | void MScanListView::addNewItem( const QString& type, | 120 | void MScanListView::addNewItem( const QString& type, |
122 | const QString& essid, | 121 | const QString& essid, |
123 | const OMacAddress& mac, | 122 | const OMacAddress& mac, |
124 | bool wep, | 123 | bool wep, |
125 | int channel, | 124 | int channel, |
126 | int signal, | 125 | int signal, |
127 | const GpsLocation& loc, | 126 | const GpsLocation& loc, |
128 | bool probe ) | 127 | bool probe ) |
@@ -134,68 +133,68 @@ void MScanListView::addNewItem( const QString& type, | |||
134 | (const char*) essid, (const char*) macaddr, channel ); | 133 | (const char*) essid, (const char*) macaddr, channel ); |
135 | #endif | 134 | #endif |
136 | 135 | ||
137 | // search, if we already have seen this net | 136 | // search, if we already have seen this net |
138 | 137 | ||
139 | QString s; | 138 | QString s; |
140 | MScanListItem* network; | 139 | MScanListItem* network; |
141 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 140 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
142 | 141 | ||
143 | while ( item && ( item->text( col_essid ) != essid ) ) | 142 | while ( item && ( item->text( col_essid ) != essid ) ) |
144 | { | 143 | { |
145 | #ifdef DEBUG | 144 | #ifdef DEBUG |
146 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); | 145 | odebug << "itemtext: " << (const char*) item->text( col_essid ) << "" << oendl; |
147 | #endif | 146 | #endif |
148 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 147 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
149 | } | 148 | } |
150 | if ( item ) | 149 | if ( item ) |
151 | { | 150 | { |
152 | // we have already seen this net, check all childs if MAC exists | 151 | // we have already seen this net, check all childs if MAC exists |
153 | 152 | ||
154 | network = item; | 153 | network = item; |
155 | 154 | ||
156 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 155 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
157 | assert( item ); // this shouldn't fail | 156 | assert( item ); // this shouldn't fail |
158 | 157 | ||
159 | while ( item && ( item->text( col_ap ) != macaddr ) ) | 158 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
160 | { | 159 | { |
161 | #ifdef DEBUG | 160 | #ifdef DEBUG |
162 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); | 161 | odebug << "subitemtext: " << (const char*) item->text( col_ap ) << "" << oendl; |
163 | #endif | 162 | #endif |
164 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 163 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
165 | } | 164 | } |
166 | 165 | ||
167 | if ( item ) | 166 | if ( item ) |
168 | { | 167 | { |
169 | // we have already seen this item, it's a dupe | 168 | // we have already seen this item, it's a dupe |
170 | #ifdef DEBUG | 169 | #ifdef DEBUG |
171 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 170 | odebug << "" << (const char*) macaddr << " is a dupe - ignoring..." << oendl; |
172 | #endif | 171 | #endif |
173 | item->receivedBeacon(); | 172 | item->receivedBeacon(); |
174 | return; | 173 | return; |
175 | } | 174 | } |
176 | } | 175 | } |
177 | else | 176 | else |
178 | { | 177 | { |
179 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); | 178 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); |
180 | MLogWindow::logwindow()->log( s ); | 179 | MLogWindow::logwindow()->log( s ); |
181 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); | 180 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); |
182 | } | 181 | } |
183 | 182 | ||
184 | 183 | ||
185 | // insert new station as child from network | 184 | // insert new station as child from network |
186 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 185 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
187 | 186 | ||
188 | #ifdef DEBUG | 187 | #ifdef DEBUG |
189 | qDebug( "inserting new station %s", (const char*) macaddr ); | 188 | odebug << "inserting new station " << (const char*) macaddr << "" << oendl; |
190 | #endif | 189 | #endif |
191 | 190 | ||
192 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 191 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
193 | station->setManufacturer( mac.manufacturer() ); | 192 | station->setManufacturer( mac.manufacturer() ); |
194 | station->setLocation( loc.dmsPosition() ); | 193 | station->setLocation( loc.dmsPosition() ); |
195 | 194 | ||
196 | if ( type == "managed" ) | 195 | if ( type == "managed" ) |
197 | { | 196 | { |
198 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); | 197 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); |
199 | } | 198 | } |
200 | else | 199 | else |
201 | { | 200 | { |
@@ -203,196 +202,196 @@ void MScanListView::addNewItem( const QString& type, | |||
203 | } | 202 | } |
204 | MLogWindow::logwindow()->log( s ); | 203 | MLogWindow::logwindow()->log( s ); |
205 | } | 204 | } |
206 | 205 | ||
207 | 206 | ||
208 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) | 207 | void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) |
209 | { | 208 | { |
210 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 209 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
211 | 210 | ||
212 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) | 211 | while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) |
213 | { | 212 | { |
214 | #ifdef DEBUG | 213 | #ifdef DEBUG |
215 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 214 | odebug << "subitemtext: " << (const char*) subitem->text( col_ap ) << "" << oendl; |
216 | #endif | 215 | #endif |
217 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 216 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
218 | } | 217 | } |
219 | 218 | ||
220 | if ( subitem ) | 219 | if ( subitem ) |
221 | { | 220 | { |
222 | // we have already seen this item, it's a dupe | 221 | // we have already seen this item, it's a dupe |
223 | #ifdef DEBUG | 222 | #ifdef DEBUG |
224 | qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); | 223 | odebug << "" << (const char*) addr.toString(true) << " is a dupe - ignoring..." << oendl; |
225 | #endif | 224 | #endif |
226 | subitem->receivedBeacon(); //FIXME: sent data bit | 225 | subitem->receivedBeacon(); //FIXME: sent data bit |
227 | return; | 226 | return; |
228 | } | 227 | } |
229 | 228 | ||
230 | // Hey, it seems to be a new item :-D | 229 | // Hey, it seems to be a new item :-D |
231 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); | 230 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); |
232 | station->setManufacturer( addr.manufacturer() ); | 231 | station->setManufacturer( addr.manufacturer() ); |
233 | 232 | ||
234 | QString s; | 233 | QString s; |
235 | if ( type == "station" ) | 234 | if ( type == "station" ) |
236 | { | 235 | { |
237 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 236 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
238 | } | 237 | } |
239 | else | 238 | else |
240 | { | 239 | { |
241 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 240 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); |
242 | } | 241 | } |
243 | MLogWindow::logwindow()->log( s ); | 242 | MLogWindow::logwindow()->log( s ); |
244 | } | 243 | } |
245 | 244 | ||
246 | 245 | ||
247 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) | 246 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) |
248 | { | 247 | { |
249 | qDebug( "WDSTraffic: %s and %s seem to form a WDS", (const char*) viaFrom.toString(), (const char*) viaTo.toString() ); | 248 | odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << (const char*) viaTo.toString() << " seem to form a WDS" << oendl; |
250 | QString s; | 249 | QString s; |
251 | MScanListItem* network; | 250 | MScanListItem* network; |
252 | 251 | ||
253 | QListViewItemIterator it( this ); | 252 | QListViewItemIterator it( this ); |
254 | while ( it.current() && | 253 | while ( it.current() && |
255 | it.current()->text( col_ap ) != viaFrom.toString(true) && | 254 | it.current()->text( col_ap ) != viaFrom.toString(true) && |
256 | it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; | 255 | it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; |
257 | 256 | ||
258 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 257 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
259 | 258 | ||
260 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations | 259 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations |
261 | { | 260 | { |
262 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | 261 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
263 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); | 262 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); |
264 | } | 263 | } |
265 | else | 264 | else |
266 | { | 265 | { |
267 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); | 266 | odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl; |
268 | MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); | 267 | MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); |
269 | } | 268 | } |
270 | } | 269 | } |
271 | 270 | ||
272 | 271 | ||
273 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 272 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
274 | { | 273 | { |
275 | QString s; | 274 | QString s; |
276 | MScanListItem* network; | 275 | MScanListItem* network; |
277 | 276 | ||
278 | QListViewItemIterator it( this ); | 277 | QListViewItemIterator it( this ); |
279 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; | 278 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; |
280 | 279 | ||
281 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 280 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
282 | 281 | ||
283 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 282 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
284 | { | 283 | { |
285 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); | 284 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); |
286 | } | 285 | } |
287 | else | 286 | else |
288 | { | 287 | { |
289 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 288 | odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; |
290 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); | 289 | MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); |
291 | 290 | ||
292 | } | 291 | } |
293 | } | 292 | } |
294 | 293 | ||
295 | 294 | ||
296 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 295 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
297 | { | 296 | { |
298 | QString s; | 297 | QString s; |
299 | MScanListItem* network; | 298 | MScanListItem* network; |
300 | 299 | ||
301 | QListViewItemIterator it( this ); | 300 | QListViewItemIterator it( this ); |
302 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; | 301 | while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; |
303 | 302 | ||
304 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 303 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
305 | 304 | ||
306 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 305 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
307 | { | 306 | { |
308 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); | 307 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); |
309 | } | 308 | } |
310 | else | 309 | else |
311 | { | 310 | { |
312 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 311 | odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl; |
313 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); | 312 | MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); |
314 | } | 313 | } |
315 | } | 314 | } |
316 | 315 | ||
317 | 316 | ||
318 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 317 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) |
319 | { | 318 | { |
320 | qWarning( "D'oh! Not yet implemented..." ); | 319 | owarn << "D'oh! Not yet implemented..." << oendl; |
321 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); | 320 | MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); |
322 | } | 321 | } |
323 | 322 | ||
324 | 323 | ||
325 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | 324 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) |
326 | { | 325 | { |
327 | qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); | 326 | odebug << "identify " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; |
328 | 327 | ||
329 | QListViewItemIterator it( this ); | 328 | QListViewItemIterator it( this ); |
330 | for ( ; it.current(); ++it ) | 329 | for ( ; it.current(); ++it ) |
331 | { | 330 | { |
332 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | 331 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) |
333 | { | 332 | { |
334 | it.current()->setText( col_ip, ip ); | 333 | it.current()->setText( col_ip, ip ); |
335 | return; | 334 | return; |
336 | } | 335 | } |
337 | } | 336 | } |
338 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 337 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; |
339 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", | 338 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", |
340 | (const char*) macaddr.toString(), (const char*) ip ) ); | 339 | (const char*) macaddr.toString(), (const char*) ip ) ); |
341 | } | 340 | } |
342 | 341 | ||
343 | 342 | ||
344 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) | 343 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) |
345 | { | 344 | { |
346 | qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); | 345 | odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl; |
347 | 346 | ||
348 | //TODO: Refactor that out, we need it all over the place. | 347 | //TODO: Refactor that out, we need it all over the place. |
349 | // Best to do it in a more comfortable abstraction in OListView | 348 | // Best to do it in a more comfortable abstraction in OListView |
350 | // (Hmm, didn't I already start something in this direction?) | 349 | // (Hmm, didn't I already start something in this direction?) |
351 | 350 | ||
352 | QListViewItemIterator it( this ); | 351 | QListViewItemIterator it( this ); |
353 | for ( ; it.current(); ++it ) | 352 | for ( ; it.current(); ++it ) |
354 | { | 353 | { |
355 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | 354 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) |
356 | { | 355 | { |
357 | 356 | ||
358 | MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); | 357 | MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); |
359 | 358 | ||
360 | while ( subitem && ( subitem->text( col_essid ) != name ) ) | 359 | while ( subitem && ( subitem->text( col_essid ) != name ) ) |
361 | { | 360 | { |
362 | #ifdef DEBUG | 361 | #ifdef DEBUG |
363 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); | 362 | odebug << "subitemtext: " << (const char*) subitem->text( col_essid ) << "" << oendl; |
364 | #endif | 363 | #endif |
365 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 364 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
366 | } | 365 | } |
367 | 366 | ||
368 | if ( subitem ) | 367 | if ( subitem ) |
369 | { | 368 | { |
370 | // we have already seen this item, it's a dupe | 369 | // we have already seen this item, it's a dupe |
371 | #ifdef DEBUG | 370 | #ifdef DEBUG |
372 | qDebug( "%s is a dupe - ignoring...", (const char*) name ); | 371 | odebug << "" << (const char*) name << " is a dupe - ignoring..." << oendl; |
373 | #endif | 372 | #endif |
374 | subitem->receivedBeacon(); //FIXME: sent data bit | 373 | subitem->receivedBeacon(); //FIXME: sent data bit |
375 | return; | 374 | return; |
376 | } | 375 | } |
377 | 376 | ||
378 | // never seen that - add new item | 377 | // never seen that - add new item |
379 | 378 | ||
380 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); | 379 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); |
381 | item->setText( col_essid, name ); | 380 | item->setText( col_essid, name ); |
382 | 381 | ||
383 | return; | 382 | return; |
384 | } | 383 | } |
385 | } | 384 | } |
386 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 385 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; |
387 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", | 386 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", |
388 | (const char*) macaddr.toString(), (const char*) ip ) ); | 387 | (const char*) macaddr.toString(), (const char*) ip ) ); |
389 | } | 388 | } |
390 | 389 | ||
391 | 390 | ||
392 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 391 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
393 | { | 392 | { |
394 | if ( !item ) return; | 393 | if ( !item ) return; |
395 | 394 | ||
396 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 395 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
397 | 396 | ||
398 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | 397 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", |
@@ -412,74 +411,74 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in | |||
412 | 411 | ||
413 | //============================================================ | 412 | //============================================================ |
414 | // MScanListItem | 413 | // MScanListItem |
415 | //============================================================ | 414 | //============================================================ |
416 | 415 | ||
417 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, | 416 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, |
418 | bool wep, int channel, int signal, bool probed ) | 417 | bool wep, int channel, int signal, bool probed ) |
419 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 418 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
420 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 419 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
421 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 420 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
422 | { | 421 | { |
423 | #ifdef DEBUG | 422 | #ifdef DEBUG |
424 | qDebug( "creating scanlist item" ); | 423 | odebug << "creating scanlist item" << oendl; |
425 | #endif | 424 | #endif |
426 | 425 | ||
427 | if ( WellenreiterConfigWindow::instance() ) | 426 | if ( WellenreiterConfigWindow::instance() ) |
428 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here | 427 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here |
429 | 428 | ||
430 | decorateItem( type, essid, macaddr, wep, channel, signal, probed ); | 429 | decorateItem( type, essid, macaddr, wep, channel, signal, probed ); |
431 | } | 430 | } |
432 | 431 | ||
433 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, | 432 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, |
434 | bool wep, int channel, int signal ) | 433 | bool wep, int channel, int signal ) |
435 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 434 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
436 | { | 435 | { |
437 | #ifdef DEBUG | 436 | #ifdef DEBUG |
438 | qDebug( "creating scanlist item" ); | 437 | odebug << "creating scanlist item" << oendl; |
439 | #endif | 438 | #endif |
440 | if ( WellenreiterConfigWindow::instance() ) | 439 | if ( WellenreiterConfigWindow::instance() ) |
441 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here | 440 | WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here |
442 | 441 | ||
443 | decorateItem( type, essid, macaddr, wep, channel, signal, false ); | 442 | decorateItem( type, essid, macaddr, wep, channel, signal, false ); |
444 | } | 443 | } |
445 | 444 | ||
446 | const QString& MScanListItem::essid() const | 445 | const QString& MScanListItem::essid() const |
447 | { | 446 | { |
448 | if ( type == "network" ) | 447 | if ( type == "network" ) |
449 | return _essid; | 448 | return _essid; |
450 | else | 449 | else |
451 | return ( (MScanListItem*) parent() )->essid(); | 450 | return ( (MScanListItem*) parent() )->essid(); |
452 | } | 451 | } |
453 | 452 | ||
454 | OListViewItem* MScanListItem::childFactory() | 453 | OListViewItem* MScanListItem::childFactory() |
455 | { | 454 | { |
456 | return new MScanListItem( this ); | 455 | return new MScanListItem( this ); |
457 | } | 456 | } |
458 | 457 | ||
459 | void MScanListItem::serializeTo( QDataStream& s ) const | 458 | void MScanListItem::serializeTo( QDataStream& s ) const |
460 | { | 459 | { |
461 | #ifdef DEBUG | 460 | #ifdef DEBUG |
462 | qDebug( "serializing MScanListItem" ); | 461 | odebug << "serializing MScanListItem" << oendl; |
463 | #endif | 462 | #endif |
464 | OListViewItem::serializeTo( s ); | 463 | OListViewItem::serializeTo( s ); |
465 | 464 | ||
466 | s << _type; | 465 | s << _type; |
467 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); | 466 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); |
468 | } | 467 | } |
469 | 468 | ||
470 | void MScanListItem::serializeFrom( QDataStream& s ) | 469 | void MScanListItem::serializeFrom( QDataStream& s ) |
471 | { | 470 | { |
472 | #ifdef DEBUG | 471 | #ifdef DEBUG |
473 | qDebug( "serializing MScanListItem" ); | 472 | odebug << "serializing MScanListItem" << oendl; |
474 | #endif | 473 | #endif |
475 | OListViewItem::serializeFrom( s ); | 474 | OListViewItem::serializeFrom( s ); |
476 | 475 | ||
477 | char wep; | 476 | char wep; |
478 | s >> _type; | 477 | s >> _type; |
479 | s >> (Q_UINT8) wep; | 478 | s >> (Q_UINT8) wep; |
480 | _wep = (wep == 'y'); | 479 | _wep = (wep == 'y'); |
481 | 480 | ||
482 | QString name; | 481 | QString name; |
483 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | 482 | name.sprintf( "wellenreiter/%s", (const char*) _type ); |
484 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 483 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
485 | if ( _wep ) | 484 | if ( _wep ) |
@@ -547,22 +546,22 @@ void MScanListItem::setManufacturer( const QString& manufacturer ) | |||
547 | 546 | ||
548 | 547 | ||
549 | void MScanListItem::setLocation( const QString& location ) | 548 | void MScanListItem::setLocation( const QString& location ) |
550 | { | 549 | { |
551 | setText( col_location, location ); | 550 | setText( col_location, location ); |
552 | } | 551 | } |
553 | 552 | ||
554 | 553 | ||
555 | void MScanListItem::receivedBeacon() | 554 | void MScanListItem::receivedBeacon() |
556 | { | 555 | { |
557 | _beacons++; | 556 | _beacons++; |
558 | #ifdef DEBUG | 557 | #ifdef DEBUG |
559 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | 558 | odebug << "MScanListItem " << (const char*) _macaddr << ": received beacon #" << _beacons << "" << oendl; |
560 | #endif | 559 | #endif |
561 | setText( col_sig, QString::number( _beacons ) ); | 560 | setText( col_sig, QString::number( _beacons ) ); |
562 | setText( col_lastseen, QTime::currentTime().toString() ); | 561 | setText( col_lastseen, QTime::currentTime().toString() ); |
563 | 562 | ||
564 | MScanListItem* p = (MScanListItem*) parent(); | 563 | MScanListItem* p = (MScanListItem*) parent(); |
565 | if ( p ) p->receivedBeacon(); | 564 | if ( p ) p->receivedBeacon(); |
566 | 565 | ||
567 | } | 566 | } |
568 | 567 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index fff7c35..fad6efd 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -2,80 +2,72 @@ | |||
2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file may be distributed and/or modified under the terms of the | 4 | ** This file may be distributed and/or modified under the terms of the |
5 | ** GNU General Public License version 2 as published by the Free Software | 5 | ** GNU General Public License version 2 as published by the Free Software |
6 | ** Foundation and appearing in the file LICENSE.GPL included in the | 6 | ** Foundation and appearing in the file LICENSE.GPL included in the |
7 | ** packaging of this file. | 7 | ** packaging of this file. |
8 | ** | 8 | ** |
9 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 9 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
11 | ** | 11 | ** |
12 | ***********************************************************************/ | 12 | ***********************************************************************/ |
13 | 13 | ||
14 | // Local | ||
15 | |||
16 | #include "gps.h" | 14 | #include "gps.h" |
17 | #include "wellenreiter.h" | 15 | #include "wellenreiter.h" |
18 | #include "scanlist.h" | 16 | #include "scanlist.h" |
19 | #include "logwindow.h" | 17 | #include "logwindow.h" |
20 | #include "packetview.h" | 18 | #include "packetview.h" |
21 | #include "configwindow.h" | 19 | #include "configwindow.h" |
22 | #include "statwindow.h" | 20 | #include "statwindow.h" |
23 | #include "graphwindow.h" | 21 | #include "graphwindow.h" |
24 | #include "protolistview.h" | 22 | #include "protolistview.h" |
25 | 23 | ||
26 | // Opie | 24 | /* OPIE */ |
27 | |||
28 | #ifdef QWS | 25 | #ifdef QWS |
29 | #include <opie2/oapplication.h> | 26 | #include <opie2/oapplication.h> |
27 | #include <opie2/odebug.h> | ||
30 | #include <opie2/odevice.h> | 28 | #include <opie2/odevice.h> |
31 | #else | 29 | #else |
32 | #include <qapplication.h> | 30 | #include <qapplication.h> |
33 | #endif | 31 | #endif |
34 | #include <opie2/omanufacturerdb.h> | 32 | #include <opie2/omanufacturerdb.h> |
35 | #include <opie2/onetwork.h> | 33 | #include <opie2/onetwork.h> |
36 | #include <opie2/opcap.h> | 34 | #include <opie2/opcap.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
38 | using namespace Opie; | 36 | using namespace Opie::Core; |
39 | 37 | using namespace Opie::Net; | |
40 | // Qt | 38 | using namespace Opie::Ui; |
41 | 39 | ||
40 | /* QT */ | ||
42 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
43 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
44 | #include <qdatetime.h> | 43 | #include <qdatetime.h> |
45 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
46 | #include <qlineedit.h> | 45 | #include <qlineedit.h> |
47 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
48 | #include <qobjectlist.h> | 47 | #include <qobjectlist.h> |
49 | #include <qregexp.h> | 48 | #include <qregexp.h> |
50 | #include <qspinbox.h> | 49 | #include <qspinbox.h> |
51 | #include <qtimer.h> | 50 | #include <qtimer.h> |
52 | #include <qtoolbutton.h> | 51 | #include <qtoolbutton.h> |
53 | #include <qmainwindow.h> | 52 | #include <qmainwindow.h> |
54 | 53 | ||
55 | // Standard | 54 | /* STD */ |
56 | |||
57 | #include <assert.h> | 55 | #include <assert.h> |
58 | #include <errno.h> | 56 | #include <errno.h> |
59 | #include <unistd.h> | 57 | #include <unistd.h> |
60 | #include <string.h> | 58 | #include <string.h> |
61 | #include <sys/types.h> | 59 | #include <sys/types.h> |
62 | #include <stdlib.h> | 60 | #include <stdlib.h> |
63 | 61 | ||
64 | using namespace Opie::Core; | ||
65 | using namespace Opie::Net; | ||
66 | using namespace Opie::Net; | ||
67 | using namespace Opie::Core; | ||
68 | using namespace Opie::Net; | ||
69 | using namespace Opie::Core; | ||
70 | Wellenreiter::Wellenreiter( QWidget* parent ) | 62 | Wellenreiter::Wellenreiter( QWidget* parent ) |
71 | : WellenreiterBase( parent, 0, 0 ), | 63 | : WellenreiterBase( parent, 0, 0 ), |
72 | sniffing( false ), iface( 0 ), configwindow( 0 ) | 64 | sniffing( false ), iface( 0 ), configwindow( 0 ) |
73 | { | 65 | { |
74 | 66 | ||
75 | logwindow->log( "(i) Wellenreiter has been started." ); | 67 | logwindow->log( "(i) Wellenreiter has been started." ); |
76 | 68 | ||
77 | // | 69 | // |
78 | // detect operating system | 70 | // detect operating system |
79 | // | 71 | // |
80 | 72 | ||
81 | #ifdef QWS | 73 | #ifdef QWS |
@@ -97,25 +89,25 @@ Wellenreiter::Wellenreiter( QWidget* parent ) | |||
97 | 89 | ||
98 | } | 90 | } |
99 | 91 | ||
100 | 92 | ||
101 | Wellenreiter::~Wellenreiter() | 93 | Wellenreiter::~Wellenreiter() |
102 | { | 94 | { |
103 | delete pcap; | 95 | delete pcap; |
104 | } | 96 | } |
105 | 97 | ||
106 | 98 | ||
107 | void Wellenreiter::initialTimer() | 99 | void Wellenreiter::initialTimer() |
108 | { | 100 | { |
109 | qDebug( "Wellenreiter::preloading manufacturer database..." ); | 101 | odebug << "Wellenreiter::preloading manufacturer database..." << oendl; |
110 | OManufacturerDB::instance(); | 102 | OManufacturerDB::instance(); |
111 | } | 103 | } |
112 | 104 | ||
113 | 105 | ||
114 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 106 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
115 | { | 107 | { |
116 | configwindow = cw; | 108 | configwindow = cw; |
117 | } | 109 | } |
118 | 110 | ||
119 | 111 | ||
120 | void Wellenreiter::channelHopped(int c) | 112 | void Wellenreiter::channelHopped(int c) |
121 | { | 113 | { |
@@ -140,104 +132,104 @@ void Wellenreiter::channelHopped(int c) | |||
140 | void Wellenreiter::handleNotification( OPacket* p ) | 132 | void Wellenreiter::handleNotification( OPacket* p ) |
141 | { | 133 | { |
142 | QObjectList* l = p->queryList(); | 134 | QObjectList* l = p->queryList(); |
143 | QObjectListIt it( *l ); | 135 | QObjectListIt it( *l ); |
144 | QObject* o; | 136 | QObject* o; |
145 | 137 | ||
146 | while ( (o = it.current()) != 0 ) | 138 | while ( (o = it.current()) != 0 ) |
147 | { | 139 | { |
148 | QString name = it.current()->name(); | 140 | QString name = it.current()->name(); |
149 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) | 141 | if ( configwindow->parsePackets->isProtocolChecked( name ) ) |
150 | { | 142 | { |
151 | QString action = configwindow->parsePackets->protocolAction( name ); | 143 | QString action = configwindow->parsePackets->protocolAction( name ); |
152 | qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 144 | odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; |
153 | doAction( action, name, p ); | 145 | doAction( action, name, p ); |
154 | } | 146 | } |
155 | else | 147 | else |
156 | { | 148 | { |
157 | qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name ); | 149 | odebug << "protocol '" << (const char*) name << "' not checked in parsePackets." << oendl; |
158 | } | 150 | } |
159 | ++it; | 151 | ++it; |
160 | } | 152 | } |
161 | } | 153 | } |
162 | 154 | ||
163 | 155 | ||
164 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) | 156 | void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage ) |
165 | { | 157 | { |
166 | if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); | 158 | if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage ); |
167 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); | 159 | else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage ); |
168 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); | 160 | else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage ); |
169 | else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() ); | 161 | else owarn << "Wellenreiter::handleManagementFrame(): '" << (const char*) manage->managementType() << "' - please handle me!" << oendl; |
170 | } | 162 | } |
171 | 163 | ||
172 | 164 | ||
173 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) | 165 | void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) |
174 | { | 166 | { |
175 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 167 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
176 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | 168 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
177 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 169 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
178 | int channel = ds ? ds->channel() : -1; | 170 | int channel = ds ? ds->channel() : -1; |
179 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 171 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
180 | 172 | ||
181 | GpsLocation loc( -111, -111 ); | 173 | GpsLocation loc( -111, -111 ); |
182 | if ( configwindow->enableGPS->isChecked() ) | 174 | if ( configwindow->enableGPS->isChecked() ) |
183 | { | 175 | { |
184 | // TODO: add check if GPS is working!? | 176 | // TODO: add check if GPS is working!? |
185 | qDebug( "Wellenreiter::gathering GPS data..." ); | 177 | odebug << "Wellenreiter::gathering GPS data..." << oendl; |
186 | loc = gps->position(); | 178 | loc = gps->position(); |
187 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 179 | odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; |
188 | } | 180 | } |
189 | 181 | ||
190 | if ( essid.length() ) | 182 | if ( essid.length() ) |
191 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); | 183 | netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ ); |
192 | qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 184 | odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; |
193 | } | 185 | } |
194 | 186 | ||
195 | 187 | ||
196 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) | 188 | void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) |
197 | { | 189 | { |
198 | } | 190 | } |
199 | 191 | ||
200 | 192 | ||
201 | void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) | 193 | void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon ) |
202 | { | 194 | { |
203 | QString type; | 195 | QString type; |
204 | if ( beacon->canIBSS() ) | 196 | if ( beacon->canIBSS() ) |
205 | { | 197 | { |
206 | type = "adhoc"; | 198 | type = "adhoc"; |
207 | } | 199 | } |
208 | else if ( beacon->canESS() ) | 200 | else if ( beacon->canESS() ) |
209 | { | 201 | { |
210 | type = "managed"; | 202 | type = "managed"; |
211 | } | 203 | } |
212 | else | 204 | else |
213 | { | 205 | { |
214 | qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" ); | 206 | owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; |
215 | return; | 207 | return; |
216 | } | 208 | } |
217 | 209 | ||
218 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 210 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
219 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); | 211 | QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); |
220 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 212 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
221 | int channel = ds ? ds->channel() : -1; | 213 | int channel = ds ? ds->channel() : -1; |
222 | 214 | ||
223 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 215 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
224 | 216 | ||
225 | GpsLocation loc( -111, -111 ); | 217 | GpsLocation loc( -111, -111 ); |
226 | if ( configwindow->enableGPS->isChecked() ) | 218 | if ( configwindow->enableGPS->isChecked() ) |
227 | { | 219 | { |
228 | // TODO: add check if GPS is working!? | 220 | // TODO: add check if GPS is working!? |
229 | qDebug( "Wellenreiter::gathering GPS data..." ); | 221 | odebug << "Wellenreiter::gathering GPS data..." << oendl; |
230 | loc = gps->position(); | 222 | loc = gps->position(); |
231 | qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() ); | 223 | odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl; |
232 | } | 224 | } |
233 | 225 | ||
234 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); | 226 | netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc ); |
235 | 227 | ||
236 | // update graph window | 228 | // update graph window |
237 | if ( ds ) | 229 | if ( ds ) |
238 | { | 230 | { |
239 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 231 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
240 | if ( prism ) | 232 | if ( prism ) |
241 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 233 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); |
242 | else | 234 | else |
243 | graphwindow->traffic( ds->channel(), 95 ); | 235 | graphwindow->traffic( ds->channel(), 95 ); |
@@ -246,25 +238,25 @@ void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPa | |||
246 | 238 | ||
247 | 239 | ||
248 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) | 240 | void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control ) |
249 | { | 241 | { |
250 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 242 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
251 | 243 | ||
252 | if ( control->controlType() == "Acknowledge" ) | 244 | if ( control->controlType() == "Acknowledge" ) |
253 | { | 245 | { |
254 | netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); | 246 | netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) ); |
255 | } | 247 | } |
256 | else | 248 | else |
257 | { | 249 | { |
258 | qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() ); | 250 | odebug << "Wellenreiter::handleControlFrame - please handle " << (const char*) control->controlType() << " in a future version! :D" << oendl; |
259 | } | 251 | } |
260 | } | 252 | } |
261 | 253 | ||
262 | 254 | ||
263 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) | 255 | void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) |
264 | { | 256 | { |
265 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 257 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
266 | if ( wlan->fromDS() && !wlan->toDS() ) | 258 | if ( wlan->fromDS() && !wlan->toDS() ) |
267 | { | 259 | { |
268 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); | 260 | netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() ); |
269 | from = wlan->macAddress3(); | 261 | from = wlan->macAddress3(); |
270 | to = wlan->macAddress2(); | 262 | to = wlan->macAddress2(); |
@@ -295,55 +287,55 @@ void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAd | |||
295 | from = data->sourceAddress(); | 287 | from = data->sourceAddress(); |
296 | to = data->destinationAddress(); | 288 | to = data->destinationAddress(); |
297 | 289 | ||
298 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); | 290 | netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); |
299 | } | 291 | } |
300 | 292 | ||
301 | 293 | ||
302 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) | 294 | void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) |
303 | { | 295 | { |
304 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); | 296 | OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); |
305 | if ( arp ) | 297 | if ( arp ) |
306 | { | 298 | { |
307 | qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() ); | 299 | odebug << "Received ARP traffic (type '" << (const char*) arp->type() << "'): " << oendl; |
308 | if ( arp->type() == "REQUEST" ) | 300 | if ( arp->type() == "REQUEST" ) |
309 | { | 301 | { |
310 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 302 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
311 | } | 303 | } |
312 | else if ( arp->type() == "REPLY" ) | 304 | else if ( arp->type() == "REPLY" ) |
313 | { | 305 | { |
314 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); | 306 | netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() ); |
315 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); | 307 | netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() ); |
316 | } | 308 | } |
317 | } | 309 | } |
318 | } | 310 | } |
319 | 311 | ||
320 | 312 | ||
321 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) | 313 | void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) |
322 | { | 314 | { |
323 | //TODO: Implement more IP based protocols | 315 | //TODO: Implement more IP based protocols |
324 | 316 | ||
325 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); | 317 | ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); |
326 | if ( dhcp ) | 318 | if ( dhcp ) |
327 | { | 319 | { |
328 | qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() ); | 320 | odebug << "Received DHCP '" << (const char*) dhcp->type() << "' packet" << oendl; |
329 | if ( dhcp->type() == "OFFER" ) | 321 | if ( dhcp->type() == "OFFER" ) |
330 | { | 322 | { |
331 | qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() ); | 323 | odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << (const char*) dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; |
332 | netView()->identify( source, dhcp->serverAddress().toString() ); | 324 | netView()->identify( source, dhcp->serverAddress().toString() ); |
333 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); | 325 | netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); |
334 | } | 326 | } |
335 | else if ( dhcp->type() == "ACK" ) | 327 | else if ( dhcp->type() == "ACK" ) |
336 | { | 328 | { |
337 | qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() ); | 329 | odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << (const char*) dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; |
338 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); | 330 | netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); |
339 | } | 331 | } |
340 | } | 332 | } |
341 | } | 333 | } |
342 | 334 | ||
343 | 335 | ||
344 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) | 336 | QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol ) |
345 | { | 337 | { |
346 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) | 338 | if ( configwindow->parsePackets->isProtocolChecked( protocol ) ) |
347 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) | 339 | if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) |
348 | return 0; | 340 | return 0; |
349 | 341 | ||
@@ -359,34 +351,34 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) | |||
359 | return true; // semantic change - we're logging anyway now to /tmp/wellenreiter | 351 | return true; // semantic change - we're logging anyway now to /tmp/wellenreiter |
360 | 352 | ||
361 | QObjectList* l = p->queryList(); | 353 | QObjectList* l = p->queryList(); |
362 | QObjectListIt it( *l ); | 354 | QObjectListIt it( *l ); |
363 | QObject* o; | 355 | QObject* o; |
364 | 356 | ||
365 | while ( (o = it.current()) != 0 ) | 357 | while ( (o = it.current()) != 0 ) |
366 | { | 358 | { |
367 | QString name = it.current()->name(); | 359 | QString name = it.current()->name(); |
368 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) | 360 | if ( configwindow->capturePackets->isProtocolChecked( name ) ) |
369 | { | 361 | { |
370 | QString action = configwindow->capturePackets->protocolAction( name ); | 362 | QString action = configwindow->capturePackets->protocolAction( name ); |
371 | qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); | 363 | odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl; |
372 | if ( action == "Discard" ) | 364 | if ( action == "Discard" ) |
373 | { | 365 | { |
374 | logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); | 366 | logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); |
375 | return false; | 367 | return false; |
376 | } | 368 | } |
377 | } | 369 | } |
378 | else | 370 | else |
379 | { | 371 | { |
380 | qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name ); | 372 | odebug << "protocol '" << (const char*) name << "' not checked in capturePackets." << oendl; |
381 | } | 373 | } |
382 | ++it; | 374 | ++it; |
383 | } | 375 | } |
384 | return true; | 376 | return true; |
385 | } | 377 | } |
386 | 378 | ||
387 | 379 | ||
388 | void Wellenreiter::receivePacket( OPacket* p ) | 380 | void Wellenreiter::receivePacket( OPacket* p ) |
389 | { | 381 | { |
390 | hexWindow()->add( p ); | 382 | hexWindow()->add( p ); |
391 | 383 | ||
392 | if ( checkDumpPacket( p ) ) | 384 | if ( checkDumpPacket( p ) ) |
@@ -542,70 +534,70 @@ void Wellenreiter::startClicked() | |||
542 | } | 534 | } |
543 | } | 535 | } |
544 | // set monitor mode | 536 | // set monitor mode |
545 | bool usePrism = configwindow->usePrismHeader(); | 537 | bool usePrism = configwindow->usePrismHeader(); |
546 | 538 | ||
547 | switch ( cardtype ) | 539 | switch ( cardtype ) |
548 | { | 540 | { |
549 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; | 541 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break; |
550 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; | 542 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break; |
551 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; | 543 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break; |
552 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; | 544 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break; |
553 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; | 545 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
554 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 546 | case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << (const char*) interface << "'" << oendl; break; |
555 | default: assert( 0 ); // shouldn't reach this | 547 | default: assert( 0 ); // shouldn't reach this |
556 | } | 548 | } |
557 | 549 | ||
558 | // switch device into monitor mode | 550 | // switch device into monitor mode |
559 | if ( cardtype < DEVTYPE_FILE ) | 551 | if ( cardtype < DEVTYPE_FILE ) |
560 | { | 552 | { |
561 | if ( cardtype != DEVTYPE_MANUAL ) | 553 | if ( cardtype != DEVTYPE_MANUAL ) |
562 | iface->setMode( "monitor" ); | 554 | iface->setMode( "monitor" ); |
563 | if ( iface->mode() != "monitor" ) | 555 | if ( iface->mode() != "monitor" ) |
564 | { | 556 | { |
565 | if ( QMessageBox::warning( this, "Wellenreiter II", | 557 | if ( QMessageBox::warning( this, "Wellenreiter II", |
566 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + | 558 | tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) + |
567 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) | 559 | tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
568 | return; | 560 | return; |
569 | } | 561 | } |
570 | } | 562 | } |
571 | 563 | ||
572 | // open GPS device | 564 | // open GPS device |
573 | if ( configwindow->enableGPS->isChecked() ) | 565 | if ( configwindow->enableGPS->isChecked() ) |
574 | { | 566 | { |
575 | qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 567 | odebug << "Wellenreiter:GPS enabled @ " << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl; |
576 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); | 568 | gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); |
577 | } | 569 | } |
578 | 570 | ||
579 | // open pcap and start sniffing | 571 | // open pcap and start sniffing |
580 | 572 | ||
581 | if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? | 573 | if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file? |
582 | { | 574 | { |
583 | dumpname = configwindow->captureFileName->text(); | 575 | dumpname = configwindow->captureFileName->text(); |
584 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; | 576 | if ( dumpname.isEmpty() ) dumpname = "captureFile"; |
585 | dumpname.append( '-' ); | 577 | dumpname.append( '-' ); |
586 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 578 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
587 | dumpname.append( ".wellenreiter" ); | 579 | dumpname.append( ".wellenreiter" ); |
588 | } | 580 | } |
589 | else // write it anyway ;) | 581 | else // write it anyway ;) |
590 | { | 582 | { |
591 | dumpname = "/var/log/dump.wellenreiter"; | 583 | dumpname = "/var/log/dump.wellenreiter"; |
592 | } | 584 | } |
593 | 585 | ||
594 | if ( cardtype != DEVTYPE_FILE ) | 586 | if ( cardtype != DEVTYPE_FILE ) |
595 | pcap->open( interface ); | 587 | pcap->open( interface ); |
596 | else | 588 | else |
597 | pcap->open( QFile( interface ) ); | 589 | pcap->open( QFile( interface ) ); |
598 | 590 | ||
599 | qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname ); | 591 | odebug << "Wellenreiter:: dumping to " << (const char*) dumpname << "" << oendl; |
600 | pcap->openDumpFile( dumpname ); | 592 | pcap->openDumpFile( dumpname ); |
601 | 593 | ||
602 | if ( !pcap->isOpen() ) | 594 | if ( !pcap->isOpen() ) |
603 | { | 595 | { |
604 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( | 596 | QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( |
605 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); | 597 | cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); |
606 | return; | 598 | return; |
607 | } | 599 | } |
608 | 600 | ||
609 | // set capturer to non-blocking mode | 601 | // set capturer to non-blocking mode |
610 | pcap->setBlocking( false ); | 602 | pcap->setBlocking( false ); |
611 | 603 | ||
@@ -643,25 +635,25 @@ void Wellenreiter::startClicked() | |||
643 | emit( startedSniffing() ); | 635 | emit( startedSniffing() ); |
644 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 636 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
645 | else | 637 | else |
646 | { | 638 | { |
647 | assert( parent() ); | 639 | assert( parent() ); |
648 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 640 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
649 | } | 641 | } |
650 | } | 642 | } |
651 | 643 | ||
652 | 644 | ||
653 | void Wellenreiter::timerEvent( QTimerEvent* ) | 645 | void Wellenreiter::timerEvent( QTimerEvent* ) |
654 | { | 646 | { |
655 | qDebug( "Wellenreiter::timerEvent()" ); | 647 | odebug << "Wellenreiter::timerEvent()" << oendl; |
656 | OPacket* p = pcap->next(); | 648 | OPacket* p = pcap->next(); |
657 | if ( !p ) // no more packets available | 649 | if ( !p ) // no more packets available |
658 | { | 650 | { |
659 | stopClicked(); | 651 | stopClicked(); |
660 | } | 652 | } |
661 | else | 653 | else |
662 | { | 654 | { |
663 | receivePacket( p ); | 655 | receivePacket( p ); |
664 | // We no longer delete packets here. Ownership of the packets is | 656 | // We no longer delete packets here. Ownership of the packets is |
665 | // transferred to the PacketView. | 657 | // transferred to the PacketView. |
666 | //delete p; | 658 | //delete p; |
667 | } | 659 | } |
@@ -706,28 +698,28 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch | |||
706 | return; | 698 | return; |
707 | } | 699 | } |
708 | 700 | ||
709 | qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", | 701 | qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", |
710 | (const char*) iface->name(), | 702 | (const char*) iface->name(), |
711 | (const char*) type, | 703 | (const char*) type, |
712 | (const char*) essid, | 704 | (const char*) essid, |
713 | channel, | 705 | channel, |
714 | (const char*) macaddr ); | 706 | (const char*) macaddr ); |
715 | 707 | ||
716 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); | 708 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); |
717 | int count = 3; | 709 | int count = 3; |
718 | qDebug("sending %d messages",count); | 710 | odebug << "sending " << count << " messages" << oendl; |
719 | msg << QString("count") << QString::number(count); | 711 | msg << QString("count") << QString::number(count); |
720 | qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); | 712 | odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; |
721 | msg << QString(iface->name()) << QString("Mode") << type; | 713 | msg << QString(iface->name()) << QString("Mode") << type; |
722 | qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); | 714 | odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; |
723 | msg << QString(iface->name()) << QString("ESSID") << essid; | 715 | msg << QString(iface->name()) << QString("ESSID") << essid; |
724 | qDebug("msg >%s< channel >%d<", iface->name(),channel); | 716 | odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; |
725 | msg << QString(iface->name()) << QString("Channel") << channel; | 717 | msg << QString(iface->name()) << QString("Channel") << channel; |
726 | // qDebug("msg >%s< mac >%s<", iface->name(),macaddr); | 718 | // odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; |
727 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; | 719 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; |
728 | #else | 720 | #else |
729 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); | 721 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); |
730 | #endif | 722 | #endif |
731 | 723 | ||
732 | } | 724 | } |
733 | 725 | ||