summaryrefslogtreecommitdiff
path: root/noncore/net
authormickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
committer mickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
commit16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff)
tree0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/net
parent8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff)
downloadopie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/net') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp18
-rw-r--r--noncore/net/mail/accountview.cpp12
-rw-r--r--noncore/net/mail/composemail.cpp6
-rw-r--r--noncore/net/mail/editaccounts.cpp22
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp14
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp66
-rw-r--r--noncore/net/mail/libmailwrapper/logindialog.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/mailwrapper.cpp2
-rw-r--r--noncore/net/mail/libmailwrapper/mboxwrapper.cpp22
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp60
-rw-r--r--noncore/net/mail/libmailwrapper/nntpwrapper.cpp8
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp10
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp18
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/statusmail.cpp6
-rw-r--r--noncore/net/mail/libmailwrapper/storemail.cpp4
-rw-r--r--noncore/net/mail/mainwindow.cpp14
-rw-r--r--noncore/net/mail/nntpgroups.cpp2
-rw-r--r--noncore/net/mail/opiemail.cpp16
-rw-r--r--noncore/net/mail/taskbarapplet/mailapplet.cpp2
-rw-r--r--noncore/net/mail/viewmail.cpp2
-rw-r--r--noncore/net/opieftp/config.in2
-rw-r--r--noncore/net/opieftp/filePermissions.cpp2
-rw-r--r--noncore/net/opieftp/opieftp.cpp77
-rw-r--r--noncore/net/opieftp/opieftp.pro11
-rw-r--r--noncore/net/opieirc/config.in2
-rw-r--r--noncore/net/opieirc/ircmisc.cpp9
-rw-r--r--noncore/net/opieirc/opieirc.pro13
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp2
-rw-r--r--noncore/net/opietooth/lib/startdunconnection.cpp2
-rw-r--r--noncore/net/opietooth/lib/startpanconnection.cpp8
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp16
-rw-r--r--noncore/net/opietooth/manager/devicehandler.cpp10
-rw-r--r--noncore/net/opietooth/manager/dunpopup.cpp2
-rw-r--r--noncore/net/opietooth/manager/hciconfwrapper.cpp16
-rw-r--r--noncore/net/opietooth/manager/obexdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/obexpopup.cpp4
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp2
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp4
-rw-r--r--noncore/net/opietooth/manager/pppdialog.cpp2
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp4
-rw-r--r--noncore/net/opietooth/manager/rfcommconfhandler.cpp10
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.cpp8
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp30
-rw-r--r--noncore/net/wellenreiter/gui/gps.cpp12
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.cpp8
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp15
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp57
-rw-r--r--noncore/net/wellenreiter/gui/packetview.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/resource.cpp4
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp77
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp74
56 files changed, 439 insertions, 434 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
@@ -57,49 +57,49 @@ void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
void POP3viewItem::refresh()
{
if (account->getOffline()) return;
QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
QValueList<FolderP>::ConstIterator it;
QListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new POP3folderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
{
- qDebug( "POP3 fetchBody" );
+ odebug << "POP3 fetchBody" << oendl;
return wrapper->fetchBody( mail );
}
QPopupMenu * POP3viewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(QObject::tr("Disconnect",contextName),0);
m->insertItem(QObject::tr("Set offline",contextName),1);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),1);
}
}
return m;
}
void POP3viewItem::disconnect()
{
QListViewItem *child = firstChild();
@@ -248,49 +248,49 @@ void NNTPviewItem::refresh( QValueList<RecMailP> & )
void NNTPviewItem::refresh()
{
if (account->getOffline()) return;
QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
QValueList<FolderP>::ConstIterator it;
QListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new NNTPfolderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
{
- qDebug( "NNTP fetchBody" );
+ odebug << "NNTP fetchBody" << oendl;
return wrapper->fetchBody( mail );
}
QPopupMenu * NNTPviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(QObject::tr("Disconnect",contextName),0);
m->insertItem(QObject::tr("Set offline",contextName),1);
m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),1);
}
}
return m;
}
void NNTPviewItem::subscribeGroups()
{
@@ -439,49 +439,49 @@ const QStringList&IMAPviewItem::subFolders()
return currentFolders;
}
void IMAPviewItem::refreshFolders(bool force)
{
if (childCount()>0 && force==false) return;
if (account->getOffline()) return;
removeChilds();
currentFolders.clear();
QValueList<FolderP> * folders = wrapper->listFolders();
QValueList<FolderP>::Iterator it;
QListViewItem*item = 0;
QListViewItem*titem = 0;
QString fname,del,search;
int pos;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
if ((*it)->getDisplayName().lower()=="inbox")
{
item = new IMAPfolderItem( (*it), this , item );
folders->remove(it);
- qDebug("inbox found");
+ odebug << "inbox found" << oendl;
break;
}
}
for ( it = folders->begin(); it!=folders->end(); ++it)
{
fname = (*it)->getDisplayName();
currentFolders.append((*it)->getName());
pos = fname.findRev((*it)->Separator());
if (pos != -1)
{
fname = fname.left(pos);
}
IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname);
if (pitem)
{
titem = item;
item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this);
/* setup the short name */
item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1));
item = titem;
}
else
{
item = new IMAPfolderItem( (*it), this , item );
@@ -512,49 +512,49 @@ QPopupMenu * IMAPviewItem::getContextMenu()
}
void IMAPviewItem::createNewFolder()
{
Newmdirdlg ndirdlg;
if ( QPEApplication::execDialog( &ndirdlg ))
{
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
QString delemiter = "/";
IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
if (item)
{
delemiter = item->Delemiter();
}
if (wrapper->createMbox(ndir,0,delemiter,makesubs))
{
refreshFolders(true);
}
}
}
void IMAPviewItem::contextMenuSelected(int id)
{
- qDebug("Id selected: %i",id);
+ odebug << "Id selected: " << id << "" << oendl;
switch (id)
{
case 0:
refreshFolders(true);
break;
case 1:
createNewFolder();
break;
case 2:
removeChilds();
wrapper->logout();
break;
case 3:
if (account->getOffline()==false)
{
removeChilds();
wrapper->logout();
}
account->setOffline(!account->getOffline());
account->save();
SETPIX(PIXMAP_IMAPFOLDER);
refreshFolders(false);
break;
default:
@@ -650,76 +650,76 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
return m;
}
void IMAPfolderItem::createNewFolder()
{
Newmdirdlg ndirdlg;
if ( QPEApplication::execDialog( &ndirdlg ) )
{
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
QString delemiter = Delemiter();
if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
{
imap->refreshFolders(true);
}
}
}
void IMAPfolderItem::deleteFolder()
{
int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
- qDebug("Auswahl: %i",yesno);
+ odebug << "Auswahl: " << yesno << "" << oendl;
if (yesno == 0)
{
if (imap->getWrapper()->deleteMbox(folder))
{
QListView*v=listView();
IMAPviewItem * box = imap;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
imap->refreshFolders(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
void IMAPfolderItem::downloadMails()
{
AccountView*bl = imap->accountView();
if (!bl) return;
bl->downloadMails(folder,imap->getWrapper());
}
void IMAPfolderItem::contextMenuSelected(int id)
{
- qDebug("Selected id: %i",id);
+ odebug << "Selected id: " << id << "" << oendl;
AccountView * view = (AccountView*)listView();
switch(id)
{
case 0:
view->refreshCurrent();
break;
case 1:
deleteAllMail(imap->getWrapper(),folder);
break;
case 2:
createNewFolder();
break;
case 3:
deleteFolder();
break;
case 4:
downloadMails();
break;
default:
break;
}
}
/**
@@ -781,49 +781,49 @@ void MHviewItem::refresh(bool force)
if (pos > 0)
{
fname = fname.left(pos);
pmaster = (MHfolderItem*)findSubItem(fname);
}
else
{
pmaster = 0;
}
if (pmaster)
{
item = new MHfolderItem( (*it), pmaster, item, this );
}
else
{
item = new MHfolderItem( (*it), this , item );
}
item->setSelectable((*it)->may_select());
}
delete folders;
}
RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
{
- qDebug( "MH fetchBody" );
+ odebug << "MH fetchBody" << oendl;
return wrapper->fetchBody( mail );
}
QPopupMenu * MHviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
m->insertItem(QObject::tr("Refresh folder list",contextName),0);
m->insertItem(QObject::tr("Create new folder",contextName),1);
m->insertItem(QObject::tr("Delete all mails",contextName),2);
m->insertItem(QObject::tr("Move/Copie all mails",contextName),3);
}
return m;
}
void MHviewItem::createFolder()
{
Newmdirdlg ndirdlg(0,0,true);
if ( QPEApplication::execDialog( &ndirdlg ) )
{
QString ndir = ndirdlg.Newdir();
if (wrapper->createMbox(ndir))
{
@@ -911,49 +911,49 @@ void MHfolderItem::initName()
}
const FolderP&MHfolderItem::getFolder()const
{
return folder;
}
void MHfolderItem::refresh(QValueList<RecMailP>&target)
{
if (folder->may_select())
mbox->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
{
return mbox->getWrapper()->fetchBody(aMail);
}
void MHfolderItem::deleteFolder()
{
int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
- qDebug("Auswahl: %i",yesno);
+ odebug << "Auswahl: " << yesno << "" << oendl;
if (yesno == 0)
{
if (mbox->getWrapper()->deleteMbox(folder))
{
QListView*v=listView();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
QPopupMenu * MHfolderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
m->insertItem(QObject::tr("Delete all mails",contextName),0);
@@ -1053,49 +1053,49 @@ void AccountViewItem::init()
{
m_Backlink = 0;
}
AccountViewItem::~AccountViewItem()
{
folder = 0;
}
AccountView*AccountViewItem::accountView()
{
return m_Backlink;
}
void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
{
if (!wrapper) return;
QString fname="";
if (folder) fname = folder->getDisplayName();
int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
arg(fname),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
- qDebug("Auswahl: %i",yesno);
+ odebug << "Auswahl: " << yesno << "" << oendl;
if (yesno == 0)
{
if (wrapper->deleteAllMail(folder))
{
AccountView * view = (AccountView*)listView();
if (view) view->refreshCurrent();
}
}
}
void AccountViewItem::removeChilds()
{
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
}
bool AccountViewItem::matchName(const QString&name)const
{
if (!folder) return false;
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
@@ -45,72 +45,72 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
AccountViewItem *view = static_cast<AccountViewItem *>(item);
QPopupMenu*m = view->getContextMenu();
if (!m) return;
connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
void AccountView::populate( QList<Account> list )
{
clear();
imapAccounts.clear();
mhAccounts.clear();
mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_IMAP )
{
IMAPaccount *imap = static_cast<IMAPaccount *>(it);
- qDebug( "added IMAP " + imap->getAccountName() );
+ odebug << "added IMAP " + imap->getAccountName() << oendl;
imapAccounts.append(new IMAPviewItem( imap, this ));
}
else if ( it->getType() == MAILLIB::A_POP3 )
{
POP3account *pop3 = static_cast<POP3account *>(it);
- qDebug( "added POP3 " + pop3->getAccountName() );
+ odebug << "added POP3 " + pop3->getAccountName() << oendl;
/* must not be hold 'cause it isn't required */
(void) new POP3viewItem( pop3, this );
}
else if ( it->getType() == MAILLIB::A_NNTP )
{
NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
- qDebug( "added NNTP " + nntp->getAccountName() );
+ odebug << "added NNTP " + nntp->getAccountName() << oendl;
/* must not be hold 'cause it isn't required */
(void) new NNTPviewItem( nntp, this );
}
}
}
void AccountView::refresh(QListViewItem *item)
{
- qDebug("AccountView refresh...");
+ odebug << "AccountView refresh..." << oendl;
if ( item )
{
m_currentItem = item;
QValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(item);
view->refresh(headerlist);
emit refreshMailview(headerlist);
}
}
void AccountView::refreshCurrent()
{
m_currentItem = currentItem();
if ( !m_currentItem ) return;
QValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
view->refresh(headerlist);
emit refreshMailview(headerlist);
}
void AccountView::refreshAll()
{
}
@@ -141,36 +141,36 @@ void AccountView::setupFolderselect(Selectstore*sels)
sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders());
}
}
void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper)
{
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
targetFolder.isEmpty())
{
return;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,tr("Error creating new Folder"),
tr("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
- qDebug("Targetfolder: %s",targetFolder.latin1());
- qDebug("Fromfolder: %s",fromFolder->getName().latin1());
+ odebug << "Targetfolder: " << targetFolder.latin1() << "" << oendl;
+ odebug << "Fromfolder: " << fromFolder->getName().latin1() << "" << oendl;
fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails());
refreshCurrent();
}
bool AccountView::currentisDraft()
{
AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
if (!view) return false;
return view->isDraftfolder();
}
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
@@ -162,49 +162,49 @@ void ComposeMail::slotAdjustColumns()
void ComposeMail::addAttachment()
{
DocLnk lnk = OFileDialog::getOpenFileName( 1, "/" );
if ( !lnk.name().isEmpty() ) {
Attachment *att = new Attachment( lnk );
(void) new AttachViewItem( attList, att );
}
}
void ComposeMail::removeAttachment()
{
if ( !attList->currentItem() ) {
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select a File.</p>" ),
tr( "Ok" ) );
} else {
attList->takeItem( attList->currentItem() );
}
}
void ComposeMail::accept()
{
if ( checkBoxLater->isChecked() ) {
- qDebug( "Send later" );
+ odebug << "Send later" << oendl;
}
#if 0
qDebug( "Sending Mail with " +
smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() );
#endif
Opie::Core::OSmartPointer<Mail> mail=new Mail;
SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
mail->setMail(fromBox->currentText());
if ( !toLine->text().isEmpty() ) {
mail->setTo( toLine->text() );
} else {
QMessageBox::warning(0,tr("Sending mail"),
tr("No Receiver spezified" ) );
return;
}
mail->setName(senderNameEdit->text());
mail->setCC( ccLine->text() );
mail->setBCC( bccLine->text() );
mail->setReply( replyLine->text() );
mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
@@ -235,68 +235,68 @@ void ComposeMail::reject()
int yesno = QMessageBox::warning(0,tr("Store message"),
tr("Store message into drafts?"),
tr("Yes"),
tr("No"),QString::null,0,1);
if (yesno == 0) {
Opie::Core::OSmartPointer<Mail> mail=new Mail();
mail->setMail(fromBox->currentText());
mail->setTo( toLine->text() );
mail->setName(senderNameEdit->text());
mail->setCC( ccLine->text() );
mail->setBCC( bccLine->text() );
mail->setReply( replyLine->text() );
mail->setSubject( subjectLine->text() );
if (!m_replyid.isEmpty()) {
QStringList ids;
ids.append(m_replyid);
mail->setInreply(ids);
}
QString txt = message->text();
if ( !sigMultiLine->text().isEmpty() ) {
txt.append( "\n--\n" );
txt.append( sigMultiLine->text() );
}
- qDebug(txt);
+ odebug << txt << oendl;
mail->setMessage( txt );
/* only use the default drafts folder name! */
Storemail wrapper(AbstractMail::draftFolder());
wrapper.storeMail(mail);
AttachViewItem *it = (AttachViewItem *) attList->firstChild();
/* attachments we will ignore! */
if ( it != NULL ) {
QMessageBox::warning(0,tr("Store message"),
tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
}
}
QDialog::reject();
}
ComposeMail::~ComposeMail()
{
}
void ComposeMail::reEditMail(const RecMailP&current)
{
RecMailP data = current;
message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
subjectLine->setText( data->getSubject());
toLine->setText(data->To().join(","));
ccLine->setText(data->CC().join(","));
bccLine->setText(data->Bcc().join(","));
replyLine->setText(data->Replyto());
}
AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
: QListViewItem( parent )
{
attachment = att;
- qDebug( att->getMimeType() );
+ odebug << att->getMimeType() << oendl;
setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ?
Resource::loadPixmap( "UnknownDocument-14" ) :
attachment->getDocLnk().pixmap() );
setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
setText( 1, QString::number( att->getSize() ) );
}
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
@@ -19,152 +19,152 @@ AccountListItem::AccountListItem( QListView *parent, Account *a)
QString ttext = "";
switch (account->getType()) {
case MAILLIB::A_NNTP:
ttext="NNTP";
break;
case MAILLIB::A_POP3:
ttext = "POP3";
break;
case MAILLIB::A_IMAP:
ttext = "IMAP";
break;
case MAILLIB::A_SMTP:
ttext = "SMTP";
break;
default:
ttext = "UNKNOWN";
break;
}
setText( 1, ttext);
}
EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
: EditAccountsUI( parent, name, modal, flags )
{
- qDebug( "New Account Configuration Widget" );
+ odebug << "New Account Configuration Widget" << oendl;
settings = s;
mailList->addColumn( tr( "Account" ) );
mailList->addColumn( tr( "Type" ) );
newsList->addColumn( tr( "Account" ) );
connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
slotFillLists();
}
void EditAccounts::slotFillLists()
{
mailList->clear();
newsList->clear();
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() )
{
if ( it->getType()==MAILLIB::A_NNTP )
{
(void) new AccountListItem( newsList, it );
}
else
{
(void) new AccountListItem( mailList, it );
}
}
}
void EditAccounts::slotNewMail()
{
- qDebug( "New Mail Account" );
+ odebug << "New Mail Account" << oendl;
QString *selection = new QString();
SelectMailType selType( selection, this, 0, true );
selType.show();
if ( QDialog::Accepted == selType.exec() )
{
slotNewAccount( *selection );
}
}
void EditAccounts::slotNewAccount( const QString &type )
{
if ( type.compare( "IMAP" ) == 0 )
{
- qDebug( "-> config IMAP" );
+ odebug << "-> config IMAP" << oendl;
IMAPaccount *account = new IMAPaccount();
IMAPconfig imap( account, this, 0, true );
if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
{
settings->addAccount( account );
account->save();
slotFillLists();
}
else
{
account->remove();
}
}
else if ( type.compare( "POP3" ) == 0 )
{
- qDebug( "-> config POP3" );
+ odebug << "-> config POP3" << oendl;
POP3account *account = new POP3account();
POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &pop3 ) )
{
settings->addAccount( account );
account->save();
slotFillLists();
}
else
{
account->remove();
}
}
else if ( type.compare( "SMTP" ) == 0 )
{
- qDebug( "-> config SMTP" );
+ odebug << "-> config SMTP" << oendl;
SMTPaccount *account = new SMTPaccount();
SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &smtp ) )
{
settings->addAccount( account );
account->save();
slotFillLists();
}
else
{
account->remove();
}
}
else if ( type.compare( "NNTP" ) == 0 )
{
- qDebug( "-> config NNTP" );
+ odebug << "-> config NNTP" << oendl;
NNTPaccount *account = new NNTPaccount();
NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
{
settings->addAccount( account );
account->save();
slotFillLists();
}
else
{
account->remove();
}
}
}
void EditAccounts::slotEditAccount( Account *account )
{
if ( account->getType() == MAILLIB::A_IMAP )
{
IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &imap ) )
{
slotFillLists();
@@ -191,99 +191,99 @@ void EditAccounts::slotEditAccount( Account *account )
else if ( account->getType()==MAILLIB::A_NNTP)
{
NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
if ( QDialog::Accepted == QPEApplication::execDialog( &nntp ) )
{
slotFillLists();
}
}
}
void EditAccounts::slotDeleteAccount( Account *account )
{
if ( QMessageBox::information( this, tr( "Question" ),
tr( "<p>Do you really want to delete the selected Account?</p>" ),
tr( "Yes" ), tr( "No" ) ) == 0 )
{
settings->delAccount( account );
slotFillLists();
}
}
void EditAccounts::slotEditMail()
{
- qDebug( "Edit Mail Account" );
+ odebug << "Edit Mail Account" << oendl;
if ( !mailList->currentItem() )
{
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
return;
}
Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
slotEditAccount( a );
}
void EditAccounts::slotDeleteMail()
{
if ( !mailList->currentItem() )
{
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
return;
}
Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
slotDeleteAccount( a );
}
void EditAccounts::slotNewNews()
{
- qDebug( "New News Account" );
+ odebug << "New News Account" << oendl;
slotNewAccount( "NNTP" );
}
void EditAccounts::slotEditNews()
{
- qDebug( "Edit News Account" );
+ odebug << "Edit News Account" << oendl;
if ( !newsList->currentItem() )
{
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
return;
}
Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
slotEditAccount( a );
}
void EditAccounts::slotDeleteNews()
{
- qDebug( "Delete News Account" );
+ odebug << "Delete News Account" << oendl;
if ( !newsList->currentItem() )
{
QMessageBox::information( this, tr( "Error" ),
tr( "<p>Please select an account.</p>" ),
tr( "Ok" ) );
return;
}
Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
slotDeleteAccount( a );
}
void EditAccounts::slotAdjustColumns()
{
int currPage = configTab->currentPageIndex();
configTab->showPage( mailTab );
mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
mailList->setColumnWidth( 1, 50 );
configTab->showPage( newsTab );
newsList->setColumnWidth( 0, newsList->visibleWidth() );
configTab->setCurrentPage( currPage );
@@ -557,38 +557,38 @@ void NNTPconfig::fillValues()
/* don't forget that - you will overwrite values if user clicks cancel! */
for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
QCheckListItem *item;
item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
item->setOn( true );
}
}
void NNTPconfig::save()
{
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
data->setSSL( sslBox->isChecked() );
data->setLogin( loginBox->isChecked() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
QListViewItemIterator list_it( ListViewGroups );
QStringList groupList;
for ( ; list_it.current(); ++list_it ) {
if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
- qDebug(list_it.current()->text(0) );
+ odebug << list_it.current()->text(0) << oendl;
groupList.append( list_it.current()->text(0) );
}
}
data->setGroups( groupList );
}
void NNTPconfig::accept()
{
save();
QDialog::accept();
}
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
@@ -31,91 +31,91 @@ AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
{
return new MHwrapper(a,name);
}
AbstractMail* AbstractMail::getWrapper(Account*a)
{
if (!a) return 0;
switch (a->getType()) {
case MAILLIB::A_IMAP:
return new IMAPwrapper((IMAPaccount*)a);
break;
case MAILLIB::A_POP3:
return new POP3wrapper((POP3account*)a);
break;
case MAILLIB::A_NNTP:
return new NNTPwrapper((NNTPaccount*)a);
break;
default:
return 0;
}
}
encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
{
- qDebug("Decode string start");
+ odebug << "Decode string start" << oendl;
char*result_text;
size_t index = 0;
/* reset for recursive use! */
size_t target_length = 0;
result_text = 0;
int mimetype = MAILMIME_MECHANISM_7BIT;
if (enc.lower()=="quoted-printable") {
mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
} else if (enc.lower()=="base64") {
mimetype = MAILMIME_MECHANISM_BASE64;
} else if (enc.lower()=="8bit") {
mimetype = MAILMIME_MECHANISM_8BIT;
} else if (enc.lower()=="binary") {
mimetype = MAILMIME_MECHANISM_BINARY;
}
int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
&result_text,&target_length);
encodedString* result = new encodedString();
if (err == MAILIMF_NO_ERROR) {
result->setContent(result_text,target_length);
}
- qDebug("Decode string finished");
+ odebug << "Decode string finished" << oendl;
return result;
}
QString AbstractMail::convert_String(const char*text)
{
//size_t index = 0;
char*res = 0;
int err = MAILIMF_NO_ERROR;
QString result(text);
/* due a bug in libetpan it isn't usable this moment */
/* int err = mailmime_encoded_phrase_parse("iso-8859-1",
text, strlen(text),&index, "iso-8859-1",&res);*/
- //qDebug("Input: %s",text);
+ //odebug << "Input: " << text << "" << oendl;
if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
// result = QString(res);
-// qDebug("Res: %s, length: %i",res,strlen(res));
+// odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl;
}
if (res) free(res);
return result;
}
/* cp & paste from launcher */
QString AbstractMail::gen_attachment_id()
{
QFile file( "/proc/sys/kernel/random/uuid" );
if (!file.open(IO_ReadOnly ) )
return QString::null;
QTextStream stream(&file);
return "{" + stream.read().stripWhiteSpace() + "}";
}
int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
{
return 0;
}
QString AbstractMail::defaultLocalfolder()
{
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
@@ -76,71 +76,71 @@ mailimf_field *Generatemail::getField( mailimf_fields *fields, int type ) {
mailimf_address_list *Generatemail::parseAddresses(const QString&addr ) {
mailimf_address_list *addresses;
if ( addr.isEmpty() )
return NULL;
addresses = mailimf_address_list_new_empty();
bool literal_open = false;
unsigned int startpos = 0;
QStringList list;
QString s;
unsigned int i = 0;
for (; i < addr.length();++i) {
switch (addr[i]) {
case '\"':
literal_open = !literal_open;
break;
case ',':
if (!literal_open) {
s = addr.mid(startpos,i-startpos);
if (!s.isEmpty()) {
list.append(s);
- qDebug("Appended %s",s.latin1());
+ odebug << "Appended " << s.latin1() << "" << oendl;
}
// !!!! this is a MUST BE!
startpos = ++i;
}
break;
default:
break;
}
}
s = addr.mid(startpos,i-startpos);
if (!s.isEmpty()) {
list.append(s);
- qDebug("Appended %s",s.latin1());
+ odebug << "Appended " << s.latin1() << "" << oendl;
}
QStringList::Iterator it;
for ( it = list.begin(); it != list.end(); it++ ) {
int err = mailimf_address_list_add_parse( addresses, (char*)(*it).latin1() );
if ( err != MAILIMF_NO_ERROR ) {
- qDebug( "Error parsing" );
- qDebug( *it );
+ odebug << "Error parsing" << oendl;
+ odebug << *it << oendl;
} else {
- qDebug( "Parse success! %s",(*it).latin1());
+ odebug << "Parse success! " << (*it).latin1() << "" << oendl;
}
}
return addresses;
}
mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimetype,const QString&TextContent ) {
mailmime * filePart = 0;
mailmime_fields * fields = 0;
mailmime_content * content = 0;
mailmime_parameter * param = 0;
char*name = 0;
char*file = 0;
int err;
int pos = filename.findRev( '/' );
if (filename.length()>0) {
QString tmp = filename.right( filename.length() - ( pos + 1 ) );
name = strdup( tmp.latin1() ); // just filename
file = strdup( filename.latin1() ); // full name with path
}
int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT;
int mechanism = MAILMIME_MECHANISM_BASE64;
@@ -154,144 +154,144 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet
fields = mailmime_fields_new_filename(
disptype, name,
mechanism );
content = mailmime_content_new_with_str( (char*)mimetype.latin1() );
if (content!=0 && fields != 0) {
if (param) {
clist_append(content->ct_parameters,param);
param = 0;
}
if (filename.length()>0) {
QFileInfo f(filename);
param = mailmime_parameter_new(strdup("name"),strdup(f.fileName().latin1()));
clist_append(content->ct_parameters,param);
param = 0;
}
filePart = mailmime_new_empty( content, fields );
}
if (filePart) {
if (filename.length()>0) {
err = mailmime_set_body_file( filePart, file );
} else {
err = mailmime_set_body_text(filePart,strdup(TextContent.data()),TextContent.length());
}
if (err != MAILIMF_NO_ERROR) {
- qDebug("Error setting body with file %s",file);
+ odebug << "Error setting body with file " << file << "" << oendl;
mailmime_free( filePart );
filePart = 0;
}
}
if (!filePart) {
if ( param != NULL ) {
mailmime_parameter_free( param );
}
if (content) {
mailmime_content_free( content );
}
if (fields) {
mailmime_fields_free( fields );
} else {
if (name) {
free( name );
}
if (file) {
free( file );
}
}
}
return filePart; // Success :)
}
void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) {
const Attachment *it;
unsigned int count = files.count();
- qDebug("List contains %i values",count);
+ odebug << "List contains " << count << " values" << oendl;
for ( unsigned int i = 0; i < count; ++i ) {
- qDebug( "Adding file" );
+ odebug << "Adding file" << oendl;
mailmime *filePart;
int err;
it = ((QList<Attachment>)files).at(i);
filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" );
if ( filePart == NULL ) {
- qDebug( "addFileParts: error adding file:" );
- qDebug( it->getFileName() );
+ odebug << "addFileParts: error adding file:" << oendl;
+ odebug << it->getFileName() << oendl;
continue;
}
err = mailmime_smart_add_part( message, filePart );
if ( err != MAILIMF_NO_ERROR ) {
mailmime_free( filePart );
- qDebug("error smart add");
+ odebug << "error smart add" << oendl;
}
}
}
mailmime *Generatemail::buildTxtPart(const QString&str ) {
mailmime *txtPart;
mailmime_fields *fields;
mailmime_content *content;
mailmime_parameter *param;
int err;
param = mailmime_parameter_new( strdup( "charset" ),
strdup( "iso-8859-1" ) );
if ( param == NULL )
goto err_free;
content = mailmime_content_new_with_str( "text/plain" );
if ( content == NULL )
goto err_free_param;
err = clist_append( content->ct_parameters, param );
if ( err != MAILIMF_NO_ERROR )
goto err_free_content;
fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
if ( fields == NULL )
goto err_free_content;
txtPart = mailmime_new_empty( content, fields );
if ( txtPart == NULL )
goto err_free_fields;
err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() );
if ( err != MAILIMF_NO_ERROR )
goto err_free_txtPart;
return txtPart; // Success :)
err_free_txtPart:
mailmime_free( txtPart );
err_free_fields:
mailmime_fields_free( fields );
err_free_content:
mailmime_content_free( content );
err_free_param:
mailmime_parameter_free( param );
err_free:
- qDebug( "buildTxtPart - error" );
+ odebug << "buildTxtPart - error" << oendl;
return NULL; // Error :(
}
mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) {
return mailimf_mailbox_new( strdup( name.latin1() ),
strdup( mail.latin1() ) );
}
mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail )
{
mailimf_fields *fields = NULL;
mailimf_field *xmailer = NULL;
mailimf_mailbox *sender=0,*fromBox=0;
mailimf_mailbox_list *from=0;
mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
clist*in_reply_to = 0;
char *subject = strdup( mail->getSubject().latin1() );
int err;
int res = 1;
sender = newMailbox( mail->getName(), mail->getMail() );
if ( sender == NULL ) {
res = 0;
@@ -324,57 +324,57 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma
if (res) reply = parseAddresses( mail->getReply() );
if (res && mail->Inreply().count()>0) {
in_reply_to = clist_new();
char*c_reply;
unsigned int nsize = 0;
for (QStringList::ConstIterator it=mail->Inreply().begin();
it != mail->Inreply().end();++it) {
if ((*it).isEmpty())
continue;
QString h((*it));
while (h.length()>0 && h[0]=='<') {
h.remove(0,1);
}
while (h.length()>0 && h[h.length()-1]=='>') {
h.remove(h.length()-1,1);
}
if (h.isEmpty()) continue;
nsize = strlen(h.latin1());
/* yes! must be malloc! */
c_reply = (char*)malloc( (nsize+1)*sizeof(char));
memset(c_reply,0,nsize+1);
memcpy(c_reply,h.latin1(),nsize);
clist_append(in_reply_to,c_reply);
- qDebug("In reply to: %s",c_reply);
+ odebug << "In reply to: " << c_reply << "" << oendl;
}
}
if (res) {
fields = mailimf_fields_new_with_data( from, sender, reply, to, cc, bcc,
in_reply_to, NULL, subject );
if ( fields == NULL ) {
- qDebug("Error creating mailimf fields");
+ odebug << "Error creating mailimf fields" << oendl;
res = 0;
}
}
if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ),
strdup( USER_AGENT ) );
if ( xmailer == NULL ) {
res = 0;
} else {
err = mailimf_fields_add( fields, xmailer );
if ( err != MAILIMF_NO_ERROR ) {
res = 0;
}
}
if (!res ) {
if (xmailer) {
mailimf_field_free( xmailer );
xmailer = NULL;
}
if (fields) {
mailimf_fields_free( fields );
fields = NULL;
} else {
if (reply)
mailimf_address_list_free( reply );
@@ -414,49 +414,49 @@ mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &ma
goto err_free_fields;
mailmime_set_imf_fields( message, fields );
txtPart = buildTxtPart( mail->getMessage() );
if ( txtPart == NULL )
goto err_free_message;
err = mailmime_smart_add_part( message, txtPart );
if ( err != MAILIMF_NO_ERROR )
goto err_free_txtPart;
addFileParts( message, mail->getAttachments() );
return message; // Success :)
err_free_txtPart:
mailmime_free( txtPart );
err_free_message:
mailmime_free( message );
err_free_fields:
mailimf_fields_free( fields );
err_free:
- qDebug( "createMimeMail: error" );
+ odebug << "createMimeMail: error" << oendl;
return NULL; // Error :(
}
clist *Generatemail::createRcptList( mailimf_fields *fields ) {
clist *rcptList;
mailimf_field *field;
rcptList = esmtp_address_list_new();
field = getField( fields, MAILIMF_FIELD_TO );
if ( field && (field->fld_type == MAILIMF_FIELD_TO)
&& field->fld_data.fld_to->to_addr_list ) {
addRcpts( rcptList, field->fld_data.fld_to->to_addr_list );
}
field = getField( fields, MAILIMF_FIELD_CC );
if ( field && (field->fld_type == MAILIMF_FIELD_CC)
&& field->fld_data.fld_cc->cc_addr_list ) {
addRcpts( rcptList, field->fld_data.fld_cc->cc_addr_list );
}
field = getField( fields, MAILIMF_FIELD_BCC );
if ( field && (field->fld_type == MAILIMF_FIELD_BCC)
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
@@ -114,49 +114,49 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
enc = "8bit";
break;
case MAILMIME_MECHANISM_BINARY:
enc = "binary";
break;
case MAILMIME_MECHANISM_QUOTED_PRINTABLE:
enc = "quoted-printable";
break;
case MAILMIME_MECHANISM_BASE64:
enc = "base64";
break;
case MAILMIME_MECHANISM_TOKEN:
default:
if (aEnc->enc_token) {
enc = QString(aEnc->enc_token);
}
break;
}
return enc;
}
void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
{
if (current_rec >= 10) {
- qDebug("too deep recursion!");
+ odebug << "too deep recursion!" << oendl;
}
if (!message || !mime) {
return;
}
int r;
char*data = 0;
size_t len;
clistiter * cur = 0;
QString b;
RecPartP part = new RecPart();
switch (mime->mm_type) {
case MAILMIME_SINGLE:
{
QValueList<int>countlist = recList;
countlist.append(current_count);
r = mailmessage_fetch_section(message,mime,&data,&len);
part->setSize(len);
part->setPositionlist(countlist);
b = gen_attachment_id();
part->setIdentifier(b);
fillSingleBody(part,message,mime);
if (part->Type()=="text" && target->Bodytext().isNull()) {
encodedString*rs = new encodedString();
@@ -251,49 +251,49 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
QString Genericwrapper::parseAddressList( mailimf_address_list *list )
{
QString result( "" );
bool first = true;
if (list == 0) return result;
for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
mailimf_address *addr = (mailimf_address *) current->data;
if ( !first ) {
result.append( "," );
} else {
first = false;
}
switch ( addr->ad_type ) {
case MAILIMF_ADDRESS_MAILBOX:
result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
break;
case MAILIMF_ADDRESS_GROUP:
result.append( parseGroup( addr->ad_data.ad_group ) );
break;
default:
- qDebug( "Generic: unkown mailimf address type" );
+ odebug << "Generic: unkown mailimf address type" << oendl;
break;
}
}
return result;
}
QString Genericwrapper::parseGroup( mailimf_group *group )
{
QString result( "" );
result.append( group->grp_display_name );
result.append( ": " );
if ( group->grp_mb_list != NULL ) {
result.append( parseMailboxList( group->grp_mb_list ) );
}
result.append( ";" );
return result;
}
QString Genericwrapper::parseMailbox( mailimf_mailbox *box )
@@ -344,132 +344,132 @@ encodedString* Genericwrapper::fetchRawPart(const RecMailP&,const RecPartP&part)
{
QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part->Identifier());
if (it==bodyCache.end()) return new encodedString();
encodedString*t = it.data();
return t;
}
QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
{
encodedString*t = fetchDecodedPart(mail,part);
QString text=t->Content();
delete t;
return text;
}
void Genericwrapper::cleanMimeCache()
{
QMap<QString,encodedString*>::Iterator it = bodyCache.begin();
for (;it!=bodyCache.end();++it) {
encodedString*t = it.data();
//it.setValue(0);
if (t) delete t;
}
bodyCache.clear();
- qDebug("Genericwrapper: cache cleaned");
+ odebug << "Genericwrapper: cache cleaned" << oendl;
}
QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
{
QStringList res;
if (!in_replies || !in_replies->mid_list) return res;
clistiter * current = 0;
for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) {
QString h((char*)current->data);
while (h.length()>0 && h[0]=='<') {
h.remove(0,1);
}
while (h.length()>0 && h[h.length()-1]=='>') {
h.remove(h.length()-1,1);
}
if (h.length()>0) {
res.append(h);
}
}
return res;
}
void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to)
{
int r;
mailmessage_list * env_list = 0;
r = mailsession_get_messages_list(session,&env_list);
if (r != MAIL_NO_ERROR) {
- qDebug("Error message list");
+ odebug << "Error message list" << oendl;
return;
}
r = mailsession_get_envelopes_list(session, env_list);
if (r != MAIL_NO_ERROR) {
- qDebug("Error filling message list");
+ odebug << "Error filling message list" << oendl;
if (env_list) {
mailmessage_list_free(env_list);
}
return;
}
mailimf_references * refs = 0;
mailimf_in_reply_to * in_replies = 0;
uint32_t i = 0;
for(; i < carray_count(env_list->msg_tab) ; ++i) {
mailmessage * msg;
QBitArray mFlags(7);
msg = (mailmessage*)carray_get(env_list->msg_tab, i);
if (msg->msg_fields == NULL) {
- //qDebug("could not fetch envelope of message %i", i);
+ //odebug << "could not fetch envelope of message " << i << "" << oendl;
continue;
}
RecMailP mail = new RecMail();
mail->setWrapper(this);
mail_flags * flag_result = 0;
r = mailmessage_get_flags(msg,&flag_result);
if (r == MAIL_ERROR_NOT_IMPLEMENTED) {
mFlags.setBit(FLAG_SEEN);
}
mailimf_single_fields single_fields;
mailimf_single_fields_init(&single_fields, msg->msg_fields);
mail->setMsgsize(msg->msg_size);
mail->setFlags(mFlags);
mail->setMbox(mailbox);
mail->setNumber(msg->msg_index);
if (single_fields.fld_subject)
mail->setSubject( convert_String(single_fields.fld_subject->sbj_value));
if (single_fields.fld_from)
mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list));
if (!mbox_as_to) {
if (single_fields.fld_to)
mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) );
} else {
mail->setTo(mailbox);
}
if (single_fields.fld_cc)
mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
if (single_fields.fld_bcc)
mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
if (single_fields.fld_orig_date)
mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) );
// crashes when accessing pop3 account?
if (single_fields.fld_message_id->mid_value) {
mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
- qDebug("Msgid == %s",mail->Msgid().latin1());
+ odebug << "Msgid == " << mail->Msgid().latin1() << "" << oendl;
}
if (single_fields.fld_reply_to) {
QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list);
if (t.count()>0) {
mail->setReplyto(t[0]);
}
}
#if 0
refs = single_fields.fld_references;
if (refs && refs->mid_list && clist_count(refs->mid_list)) {
char * text = (char*)refs->mid_list->first->data;
mail->setReplyto(QString(text));
}
#endif
if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list &&
clist_count(single_fields.fld_in_reply_to->mid_list)) {
mail->setInreply(parseInreplies(single_fields.fld_in_reply_to));
}
target.append(mail);
}
if (env_list) {
mailmessage_list_free(env_list);
}
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
@@ -9,93 +9,93 @@
using namespace Opie::Core;
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
: AbstractMail()
{
account = a;
m_imap = 0;
m_Lastmbox = "";
}
IMAPwrapper::~IMAPwrapper()
{
logout();
}
/* to avoid to often select statements in loops etc.
we trust that we are logged in and connection is established!*/
int IMAPwrapper::selectMbox(const QString&mbox)
{
if (mbox == m_Lastmbox) {
return MAILIMAP_NO_ERROR;
}
int err = mailimap_select( m_imap, (char*)mbox.latin1());
if ( err != MAILIMAP_NO_ERROR ) {
- qDebug("error selecting mailbox: %s",m_imap->imap_response);
+ odebug << "error selecting mailbox: " << m_imap->imap_response << "" << oendl;
m_Lastmbox = "";
return err;
}
m_Lastmbox = mbox;
return err;
}
void IMAPwrapper::imap_progress( size_t current, size_t maximum )
{
qApp->processEvents();
- qDebug( "IMAP: %i of %i", current, maximum );
+ odebug << "IMAP: " << current << " of " << maximum << "" << oendl;
}
bool IMAPwrapper::start_tls(bool force_tls)
{
int err;
bool try_tls;
mailimap_capability_data * cap_data = 0;
err = mailimap_capability(m_imap,&cap_data);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage("error getting capabilities!");
- qDebug("error getting capabilities!");
+ odebug << "error getting capabilities!" << oendl;
return false;
}
clistiter * cur;
for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) {
struct mailimap_capability * cap;
cap = (struct mailimap_capability *)clist_content(cur);
if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) {
if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) {
try_tls = true;
break;
}
}
}
if (cap_data) {
mailimap_capability_data_free(cap_data);
}
if (try_tls) {
err = mailimap_starttls(m_imap);
if (err != MAILIMAP_NO_ERROR && force_tls) {
Global::statusMessage(tr("Server has no TLS support!"));
- qDebug("Server has no TLS support!");
+ odebug << "Server has no TLS support!" << oendl;
try_tls = false;
} else {
mailstream_low * low;
mailstream_low * new_low;
low = mailstream_get_low(m_imap->imap_stream);
if (!low) {
try_tls = false;
} else {
int fd = mailstream_low_get_fd(low);
if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) {
mailstream_low_free(low);
mailstream_set_low(m_imap->imap_stream, new_low);
} else {
try_tls = false;
}
}
}
}
return try_tls;
}
void IMAPwrapper::login()
{
const char *server, *user, *pass;
@@ -104,100 +104,100 @@ void IMAPwrapper::login()
if (account->getOffline()) return;
/* we are connected this moment */
/* TODO: setup a timer holding the line or if connection closed - delete the value */
if (m_imap) {
err = mailimap_noop(m_imap);
if (err!=MAILIMAP_NO_ERROR) {
logout();
} else {
mailstream_flush(m_imap->imap_stream);
return;
}
}
server = account->getServer().latin1();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
} else {
// cancel
- qDebug( "IMAP: Login canceled" );
+ odebug << "IMAP: Login canceled" << oendl;
return;
}
} else {
user = account->getUser().latin1();
pass = account->getPassword().latin1();
}
m_imap = mailimap_new( 20, &imap_progress );
/* connect */
bool ssl = false;
bool try_tls = false;
bool force_tls = false;
if ( account->ConnectionType() == 2 ) {
ssl = true;
}
if (account->ConnectionType()==1) {
force_tls = true;
}
if ( ssl ) {
- qDebug( "using ssl" );
+ odebug << "using ssl" << oendl;
err = mailimap_ssl_connect( m_imap, (char*)server, port );
} else {
err = mailimap_socket_connect( m_imap, (char*)server, port );
}
if ( err != MAILIMAP_NO_ERROR &&
err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
QString failure = "";
if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
failure="Connection refused";
} else {
failure="Unknown failure";
}
Global::statusMessage(tr("error connecting imap server: %1").arg(failure));
mailimap_free( m_imap );
m_imap = 0;
return;
}
if (!ssl) {
try_tls = start_tls(force_tls);
}
bool ok = true;
if (force_tls && !try_tls) {
Global::statusMessage(tr("Server has no TLS support!"));
- qDebug("Server has no TLS support!");
+ odebug << "Server has no TLS support!" << oendl;
ok = false;
}
/* login */
if (ok) {
err = mailimap_login_simple( m_imap, (char*)user, (char*)pass );
if ( err != MAILIMAP_NO_ERROR ) {
Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response));
ok = false;
}
}
if (!ok) {
err = mailimap_close( m_imap );
mailimap_free( m_imap );
m_imap = 0;
}
}
void IMAPwrapper::logout()
{
int err = MAILIMAP_NO_ERROR;
if (!m_imap) return;
@@ -296,86 +296,86 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
QString del;
bool selectable = true;
bool no_inferiors = false;
if ( err == MAILIMAP_NO_ERROR ) {
current = result->first;
for ( int i = result->count; i > 0; i-- ) {
list = (mailimap_mailbox_list *) current->data;
// it is better use the deep copy mechanism of qt itself
// instead of using strdup!
temp = list->mb_name;
del = list->mb_delimiter;
current = current->next;
if ( (bflags = list->mb_flag) ) {
selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
no_inferiors = true;
}
}
}
folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
}
} else {
- qDebug("error fetching folders: %s",m_imap->imap_response);
+ odebug << "error fetching folders: " << m_imap->imap_response << "" << oendl;
}
mailimap_list_result_free( result );
/*
* second stage - get the other then inbox folders
*/
mask = "*" ;
path = account->getPrefix().latin1();
if (!path) path = "";
- qDebug(path);
+ odebug << path << oendl;
err = mailimap_list( m_imap, (char*)path, (char*)mask, &result );
if ( err == MAILIMAP_NO_ERROR ) {
current = result->first;
for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) {
no_inferiors = false;
list = (mailimap_mailbox_list *) current->data;
// it is better use the deep copy mechanism of qt itself
// instead of using strdup!
temp = list->mb_name;
if (temp.lower()=="inbox")
continue;
if (temp.lower()==account->getPrefix().lower())
continue;
if ( (bflags = list->mb_flag) ) {
selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) {
no_inferiors = true;
}
}
}
del = list->mb_delimiter;
folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix()));
}
} else {
- qDebug("error fetching folders %s",m_imap->imap_response);
+ odebug << "error fetching folders " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_list_result_free( result );
return folders;
}
RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
{
RecMail * m = 0;
mailimap_msg_att_item *item=0;
clistcell *current,*c,*cf;
mailimap_msg_att_dynamic*flist;
mailimap_flag_fetch*cflag;
int size;
QBitArray mFlags(7);
QStringList addresslist;
if (!m_att) {
return m;
}
m = new RecMail();
for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
current = c;
size = 0;
item = (mailimap_msg_att_item*)current->data;
@@ -445,50 +445,50 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
if (addresslist.count()) {
m->setReplyto(addresslist.first());
}
}
if (head->env_in_reply_to!=NULL) {
QString h(head->env_in_reply_to);
while (h.length()>0 && h[0]=='<') {
h.remove(0,1);
}
while (h.length()>0 && h[h.length()-1]=='>') {
h.remove(h.length()-1,1);
}
if (h.length()>0) {
m->setInreply(QStringList(h));
}
}
if (head->env_message_id) {
m->setMsgid(QString(head->env_message_id));
}
} else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
#if 0
mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
- 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);
- qDebug(da.toString());
+ odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl;
+ odebug << da.toString() << oendl;
#endif
} else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
size = item->att_data.att_static->att_data.att_rfc822_size;
}
}
/* msg is already deleted */
if (mFlags.testBit(FLAG_DELETED) && m) {
delete m;
m = 0;
}
if (m) {
m->setFlags(mFlags);
m->setMsgsize(size);
}
return m;
}
RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
{
RecBodyP body = new RecBody();
const char *mb;
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
clistcell *current;
@@ -503,49 +503,49 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
if (!m_imap) {
return body;
}
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return body;
}
/* the range has to start at 1!!! not with 0!!!! */
set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() );
fetchAtt = mailimap_fetch_att_new_bodystructure();
fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
mailimap_msg_att * msg_att;
msg_att = (mailimap_msg_att*)current->data;
mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
QValueList<int> path;
body_desc = item->att_data.att_static->att_data.att_body;
traverseBody(mail,body_desc,body,0,path);
} else {
- qDebug("error fetching body: %s",m_imap->imap_response);
+ odebug << "error fetching body: " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_fetch_list_free(result);
return body;
}
QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
{
QStringList l;
QString from;
bool named_from;
clistcell *current = NULL;
mailimap_address * current_address=NULL;
if (!list) {
return l;
}
unsigned int count = 0;
for (current=clist_begin(list);current!= NULL;current=clist_next(current)) {
from = "";
named_from = false;
current_address=(mailimap_address*)current->data;
if (current_address->ad_personal_name){
from+=convert_String((const char*)current_address->ad_personal_name);
from+=" ";
named_from = true;
@@ -615,173 +615,173 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
fetchType = mailimap_fetch_type_new_fetch_att(fetch_att);
clist*result = 0;
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
mailimap_msg_att * msg_att;
msg_att = (mailimap_msg_att*)current->data;
mailimap_msg_att_item*msg_att_item;
for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
/* detach - we take over the content */
msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
}
}
}
} else {
- qDebug("error fetching text: %s",m_imap->imap_response);
+ odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_fetch_list_free(result);
return res;
}
/* current_recursion is for recursive calls.
current_count means the position inside the internal loop! */
void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,
int current_recursion,QValueList<int>recList,int current_count)
{
if (!body || current_recursion>=10) {
return;
}
switch (body->bd_type) {
case MAILIMAP_BODY_1PART:
{
QValueList<int>countlist = recList;
countlist.append(current_count);
RecPartP currentPart = new RecPart();
mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
QString id("");
currentPart->setPositionlist(countlist);
for (unsigned int j = 0; j < countlist.count();++j) {
id+=(j>0?" ":"");
id+=QString("%1").arg(countlist[j]);
}
- qDebug("ID = %s",id.latin1());
+ odebug << "ID = " << id.latin1() << "" << oendl;
currentPart->setIdentifier(id);
fillSinglePart(currentPart,part1);
/* important: Check for is NULL 'cause a body can be empty!
And we put it only into the mail if it is the FIRST part */
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
target_body->setDescription(currentPart);
target_body->setBodytext(body_text);
if (countlist.count()>1) {
target_body->addPart(currentPart);
}
} else {
target_body->addPart(currentPart);
}
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) {
traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist);
}
}
break;
case MAILIMAP_BODY_MPART:
{
QValueList<int>countlist = recList;
clistcell*current=0;
mailimap_body*current_body=0;
unsigned int ccount = 1;
mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart;
for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) {
current_body = (mailimap_body*)current->data;
if (current_body->bd_type==MAILIMAP_BODY_MPART) {
RecPartP targetPart = new RecPart();
targetPart->setType("multipart");
fillMultiPart(targetPart,mailDescription);
countlist.append(current_count);
targetPart->setPositionlist(countlist);
target_body->addPart(targetPart);
QString id("");
for (unsigned int j = 0; j < countlist.count();++j) {
id+=(j>0?" ":"");
id+=QString("%1").arg(countlist[j]);
}
- qDebug("ID(mpart) = %s",id.latin1());
+ odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
}
traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount);
if (current_body->bd_type==MAILIMAP_BODY_MPART) {
countlist = recList;
}
++ccount;
}
}
break;
default:
break;
}
}
void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description)
{
if (!Description) {
return;
}
switch (Description->bd_type) {
case MAILIMAP_BODY_TYPE_1PART_TEXT:
target_part->setType("text");
fillSingleTextPart(target_part,Description->bd_data.bd_type_text);
break;
case MAILIMAP_BODY_TYPE_1PART_BASIC:
fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic);
break;
case MAILIMAP_BODY_TYPE_1PART_MSG:
target_part->setType("message");
fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg);
break;
default:
break;
}
}
void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which)
{
if (!which) {
return;
}
QString sub;
sub = which->bd_media_text;
- qDebug("Type= text/%s",which->bd_media_text);
+ odebug << "Type= text/" << which->bd_media_text << "" << oendl;
target_part->setSubtype(sub.lower());
target_part->setLines(which->bd_lines);
fillBodyFields(target_part,which->bd_fields);
}
void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which)
{
if (!which) {
return;
}
target_part->setSubtype("rfc822");
- qDebug("Message part");
+ odebug << "Message part" << oendl;
/* we set this type to text/plain */
target_part->setLines(which->bd_lines);
fillBodyFields(target_part,which->bd_fields);
}
void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which)
{
if (!which) return;
QString sub = which->bd_media_subtype;
target_part->setSubtype(sub.lower());
if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) {
clistcell*cur = 0;
mailimap_single_body_fld_param*param=0;
for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) {
param = (mailimap_single_body_fld_param*)cur->data;
if (param) {
target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
}
}
}
}
void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which)
{
@@ -798,49 +798,49 @@ void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_ba
break;
case MAILIMAP_MEDIA_BASIC_IMAGE:
type = "image";
break;
case MAILIMAP_MEDIA_BASIC_MESSAGE:
type = "message";
break;
case MAILIMAP_MEDIA_BASIC_VIDEO:
type = "video";
break;
case MAILIMAP_MEDIA_BASIC_OTHER:
default:
if (which->bd_media_basic->med_basic_type) {
type = which->bd_media_basic->med_basic_type;
} else {
type = "";
}
break;
}
if (which->bd_media_basic->med_subtype) {
sub = which->bd_media_basic->med_subtype;
} else {
sub = "";
}
- qDebug("Type = %s/%s",type.latin1(),sub.latin1());
+ odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl;
target_part->setType(type.lower());
target_part->setSubtype(sub.lower());
fillBodyFields(target_part,which->bd_fields);
}
void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which)
{
if (!which) return;
if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) {
clistcell*cur;
mailimap_single_body_fld_param*param=0;
for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) {
param = (mailimap_single_body_fld_param*)cur->data;
if (param) {
target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
}
}
}
mailimap_body_fld_enc*enc = which->bd_encoding;
QString encoding("");
switch (enc->enc_type) {
case MAILIMAP_BODY_FLD_ENC_7BIT:
encoding = "7bit";
break;
@@ -874,84 +874,84 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which
void IMAPwrapper::deleteMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
if (!m_imap) {
return;
}
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
store_flags = mailimap_store_att_flags_new_set_flags(flist);
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
- qDebug("error deleting mail: %s",m_imap->imap_response);
+ odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
return;
}
- qDebug("deleting mail: %s",m_imap->imap_response);
+ odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
- qDebug("error deleting mail: %s",m_imap->imap_response);
+ odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
}
- qDebug("Delete successfull %s",m_imap->imap_response);
+ odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
}
void IMAPwrapper::answeredMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
if (!m_imap) {
return;
}
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_answered());
store_flags = mailimap_store_att_flags_new_add_flags(flist);
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
- qDebug("error marking mail: %s",m_imap->imap_response);
+ odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
return;
}
}
QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
{
QString body("");
encodedString*res = fetchRawPart(mail,path,internal_call);
encodedString*r = decode_String(res,enc);
delete res;
if (r) {
if (r->Length()>0) {
body = r->Content();
}
delete r;
}
return body;
}
QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
{
return fetchTextPart(mail,part->Positionlist(),false,part->Encoding());
}
@@ -977,81 +977,81 @@ int IMAPwrapper::deleteAllMail(const FolderP&folder)
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err = selectMbox(folder->getName());
if ( err != MAILIMAP_NO_ERROR ) {
return 0;
}
int last = m_imap->imap_selection_info->sel_exists;
if (last == 0) {
Global::statusMessage(tr("Mailbox has no mails!"));
return 0;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
store_flags = mailimap_store_att_flags_new_set_flags(flist);
set = mailimap_set_new_interval( 1, last );
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
return 0;
}
- qDebug("deleting mail: %s",m_imap->imap_response);
+ odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
err = mailimap_expunge(m_imap);
if (err != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response));
return 0;
}
- qDebug("Delete successfull %s",m_imap->imap_response);
+ odebug << "Delete successfull " << m_imap->imap_response << "" << oendl;
return 1;
}
int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder)
{
if (folder.length()==0) return 0;
login();
if (!m_imap) {return 0;}
QString pre = account->getPrefix();
if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) {
pre+=delemiter;
}
if (parentfolder) {
pre += parentfolder->getDisplayName()+delemiter;
}
pre+=folder;
if (getsubfolder) {
if (delemiter.length()>0) {
pre+=delemiter;
} else {
Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre));
return 0;
}
}
- qDebug("Creating %s",pre.latin1());
+ odebug << "Creating " << pre.latin1() << "" << oendl;
int res = mailimap_create(m_imap,pre.latin1());
if (res != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("%1").arg(m_imap->imap_response));
return 0;
}
return 1;
}
int IMAPwrapper::deleteMbox(const FolderP&folder)
{
if (!folder) return 0;
login();
if (!m_imap) {return 0;}
int res = mailimap_delete(m_imap,folder->getName());
if (res != MAILIMAP_NO_ERROR) {
Global::statusMessage(tr("%1").arg(m_imap->imap_response));
return 0;
}
return 1;
}
void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
{
mailimap_status_att_list * att_list =0;
@@ -1068,120 +1068,120 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
att_list = mailimap_status_att_list_new_empty();
if (!att_list) return;
r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES);
r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT);
r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN);
r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status);
if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) {
for (cur = clist_begin(status->st_info_list);
cur != NULL ; cur = clist_next(cur)) {
mailimap_status_info * status_info;
status_info = (mailimap_status_info *)clist_content(cur);
switch (status_info->st_att) {
case MAILIMAP_STATUS_ATT_MESSAGES:
target_stat.message_count = status_info->st_value;
break;
case MAILIMAP_STATUS_ATT_RECENT:
target_stat.message_recent = status_info->st_value;
break;
case MAILIMAP_STATUS_ATT_UNSEEN:
target_stat.message_unseen = status_info->st_value;
break;
}
}
} else {
- qDebug("Error retrieving status");
+ odebug << "Error retrieving status" << oendl;
}
if (status) mailimap_mailbox_data_status_free(status);
if (att_list) mailimap_status_att_list_free(att_list);
}
void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
{
login();
if (!m_imap) return;
if (!msg) return;
int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
if (r != MAILIMAP_NO_ERROR) {
Global::statusMessage("Error storing mail!");
}
}
MAILLIB::ATYPE IMAPwrapper::getType()const
{
return account->getType();
}
const QString&IMAPwrapper::getName()const
{
- qDebug("Get name: %s",account->getAccountName().latin1());
+ odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
return account->getAccountName();
}
encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
{
// dummy
QValueList<int> path;
return fetchRawPart(mail,path,false);
}
void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
if (targetWrapper != this) {
AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
- qDebug("Using generic");
+ odebug << "Using generic" << oendl;
return;
}
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
int err = selectMbox(fromFolder->getName());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
int last = m_imap->imap_selection_info->sel_exists;
set = mailimap_set_new_interval( 1, last );
err = mailimap_copy(m_imap,set,targetFolder.latin1());
mailimap_set_free( set );
if ( err != MAILIMAP_NO_ERROR ) {
QString error_msg = tr("error copy mails: %1").arg(m_imap->imap_response);
Global::statusMessage(error_msg);
- qDebug(error_msg);
+ odebug << error_msg << oendl;
return;
}
if (moveit) {
deleteAllMail(fromFolder);
}
}
void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
if (targetWrapper != this) {
- qDebug("Using generic");
+ odebug << "Using generic" << oendl;
AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit);
return;
}
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
int err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_copy(m_imap,set,targetFolder.latin1());
mailimap_set_free( set );
if ( err != MAILIMAP_NO_ERROR ) {
QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response);
Global::statusMessage(error_msg);
- qDebug(error_msg);
+ odebug << error_msg << oendl;
return;
}
if (moveit) {
deleteMail(mail);
}
}
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
@@ -3,27 +3,27 @@
#include "logindialog.h"
LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, WFlags flags )
: LoginDialogUI( parent, name, modal, flags )
{
userLine->setText( (user.isEmpty()?QString(""):user) );
passLine->setText( (pass.isEmpty()?QString(""):pass) );
_user = user;
_pass = pass;
if ( user.isEmpty() ) {
userLine->setFocus();
} else {
passLine->setFocus();
}
}
void LoginDialog::accept()
{
//_user.replace( 0, _user.length(), userLine->text() );
//_pass.replace( 0, _pass.length(), passLine->text() );
_user = userLine->text();
_pass = passLine->text();
- qDebug("User im accept: |%s|",_user.latin1());
+ odebug << "User im accept: |" << _user.latin1() << "|" << oendl;
QDialog::accept();
}
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
@@ -1,40 +1,40 @@
#include "mailtypes.h"
#include <stdlib.h>
using namespace Opie::Core;
RecMail::RecMail()
:Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
{
init();
}
RecMail::RecMail(const RecMail&old)
:Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
{
init();
copy_old(old);
- qDebug("Copy constructor RecMail");
+ odebug << "Copy constructor RecMail" << oendl;
}
RecMail::~RecMail()
{
wrapper = 0;
}
void RecMail::copy_old(const RecMail&old)
{
subject = old.subject;
date = old.date;
mbox = old.mbox;
msg_id = old.msg_id;
msg_size = old.msg_size;
msg_number = old.msg_number;
from = old.from;
msg_flags = old.msg_flags;
to = old.to;
cc = old.cc;
bcc = old.bcc;
wrapper = old.wrapper;
in_reply_to = old.in_reply_to;
references = old.references;
replyto = old.replyto;
@@ -110,49 +110,49 @@ const QStringList& RecMail::References()const
return references;
}
RecPart::RecPart()
: Opie::Core::ORefCount(),
m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
{
m_Parameters.clear();
m_poslist.clear();
}
RecPart::RecPart(const RecPart&old)
: Opie::Core::ORefCount(),
m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
{
m_type = old.m_type;
m_subtype = old.m_subtype;
m_identifier = old.m_identifier;
m_encoding = old.m_encoding;
m_description = old.m_description;
m_lines = old.m_lines;
m_size = old.m_size;
m_Parameters = old.m_Parameters;
m_poslist = old.m_poslist;
- qDebug("RecPart copy constructor");
+ odebug << "RecPart copy constructor" << oendl;
}
RecPart::~RecPart()
{
}
void RecPart::setSize(unsigned int size)
{
m_size = size;
}
const unsigned int RecPart::Size()const
{
return m_size;
}
void RecPart::setLines(unsigned int lines)
{
m_lines = lines;
}
const unsigned int RecPart::Lines()const
{
return m_lines;
@@ -234,49 +234,49 @@ const QString RecPart::searchParamter(const QString&key)const
}
void RecPart::setPositionlist(const QValueList<int>&poslist)
{
m_poslist = poslist;
}
const QValueList<int>& RecPart::Positionlist()const
{
return m_poslist;
}
RecBody::RecBody()
: Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
{
m_PartsList.clear();
}
RecBody::RecBody(const RecBody&old)
:Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
{
m_BodyText = old.m_BodyText;
m_PartsList = old.m_PartsList;
m_description = old.m_description;
- qDebug("Recbody copy constructor");
+ odebug << "Recbody copy constructor" << oendl;
}
RecBody::~RecBody()
{
}
void RecBody::setBodytext(const QString&bodyText)
{
m_BodyText = bodyText;
}
const QString& RecBody::Bodytext()const
{
return m_BodyText;
}
void RecBody::setParts(const QValueList<RecPartP>&parts)
{
m_PartsList.clear();
m_PartsList = parts;
}
const QValueList<RecPartP>& RecBody::Parts()const
{
@@ -299,56 +299,56 @@ const RecPartP& RecBody::Description()const
}
/* handling encoded content */
encodedString::encodedString()
{
init();
}
encodedString::encodedString(const char*nContent,unsigned int nSize)
{
init();
setContent(nContent,nSize);
}
encodedString::encodedString(char*nContent,unsigned int nSize)
{
init();
setContent(nContent,nSize);
}
encodedString::encodedString(const encodedString&old)
{
init();
copy_old(old);
- qDebug("encodedeString: copy constructor!");
+ odebug << "encodedeString: copy constructor!" << oendl;
}
encodedString& encodedString::operator=(const encodedString&old)
{
init();
copy_old(old);
- qDebug("encodedString: assign operator!");
+ odebug << "encodedString: assign operator!" << oendl;
return *this;
}
encodedString::~encodedString()
{
clean();
}
void encodedString::init()
{
content = 0;
size = 0;
}
void encodedString::clean()
{
if (content) {
free(content);
}
content = 0;
size = 0;
}
void encodedString::copy_old(const encodedString&old)
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
@@ -30,49 +30,49 @@ Attachment::Attachment( DocLnk lnk )
Folder::Folder(const QString&tmp_name, const QString&sep )
{
name = tmp_name;
nameDisplay = name;
separator = sep;
prefix = "";
}
Folder::~Folder()
{
}
const QString& Folder::Separator()const
{
return separator;
}
IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix )
: Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf)
{
// Decode IMAP foldername
nameDisplay = IMAPFolder::decodeFolderName( name );
/*
- qDebug( "folder " + name + " - displayed as " + nameDisplay );
+ odebug << "folder " + name + " - displayed as " + nameDisplay << oendl;
*/
prefix = aprefix;
if (prefix.length()>0) {
if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) {
nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length());
}
}
}
IMAPFolder::~IMAPFolder()
{
}
static unsigned char base64chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
/**
* Decodes base64 encoded parts of the imapfolder name
* Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc
*/
QString IMAPFolder::decodeFolderName( const QString &name )
{
unsigned char c, i, bitcount;
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
@@ -10,150 +10,150 @@ using namespace Opie::Core;
MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name)
{
QDir dir(MBOXPath);
if (!dir.exists()) {
dir.mkdir(MBOXPath);
}
}
MBOXwrapper::~MBOXwrapper()
{
}
void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target )
{
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
p+=mailbox;
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
- qDebug("Error initializing mbox");
+ odebug << "Error initializing mbox" << oendl;
mailfolder_free(folder);
mailstorage_free(storage);
return;
}
parseList(target,folder->fld_session,mailbox);
mailfolder_disconnect(folder);
mailfolder_free(folder);
mailstorage_free(storage);
Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
}
QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
{
QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
QDir dir(MBOXPath);
if (!dir.exists()) return folders;
dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable);
QStringList entries = dir.entryList();
QStringList::ConstIterator it = entries.begin();
for (;it!=entries.end();++it) {
FolderP inb=new Folder(*it,"/");
folders->append(inb);
}
return folders;
}
void MBOXwrapper::deleteMail(const RecMailP & mail)
{
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
p+=mail->getMbox();
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
- qDebug("Error initializing mbox");
+ odebug << "Error initializing mbox" << oendl;
mailfolder_free(folder);
mailstorage_free(storage);
return;
}
r = mailsession_remove_message(folder->fld_session,mail->getNumber());
if (r != MAIL_NO_ERROR) {
- qDebug("error deleting mail");
+ odebug << "error deleting mail" << oendl;
}
mailfolder_free(folder);
mailstorage_free(storage);
}
void MBOXwrapper::answeredMail(const RecMailP&)
{
}
RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail )
{
RecBodyP body = new RecBody();
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
p+=mail->getMbox();
mailmessage * msg;
char*data=0;
size_t size;
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
- qDebug("Error initializing mbox");
+ odebug << "Error initializing mbox" << oendl;
mailfolder_free(folder);
mailstorage_free(storage);
return body;
}
r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
- qDebug("Error fetching mail %i",mail->getNumber());
+ odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
mailfolder_free(folder);
mailstorage_free(storage);
return body;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
- qDebug("Error fetching mail %i",mail->getNumber());
+ odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
return body;
}
body = parseMail(msg);
mailmessage_fetch_result_free(msg,data);
mailfolder_free(folder);
mailstorage_free(storage);
return body;
}
void MBOXwrapper::mbox_progress( size_t current, size_t maximum )
{
- qDebug("MBOX %i von %i",current,maximum);
+ odebug << "MBOX " << current << " von " << maximum << "" << oendl;
}
int MBOXwrapper::createMbox(const QString&folder,const FolderP&,const QString&,bool )
{
QString p = MBOXPath+"/";
p+=folder;
QFileInfo fi(p);
if (fi.exists()) {
Global::statusMessage(tr("Mailbox exists."));
return 0;
}
mailmbox_folder*f = 0;
if (mailmbox_init(p.latin1(),0,1,0,&f) != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error init folder"));
return 0;
}
if (f) mailmbox_done(f);
return 1;
}
void MBOXwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
{
QString p = MBOXPath+"/";
p+=folder;
@@ -199,98 +199,98 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
return 0;
}
encodedString*result = new encodedString(data,size);
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
return result;
}
void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
{
QString p = MBOXPath+"/";
p+=mailbox;
mailmbox_folder*f = 0;
int r = mailmbox_init(p.latin1(),0,1,0,&f);
if (r != MAIL_NO_ERROR) {
- qDebug("Error init folder");
+ odebug << "Error init folder" << oendl;
return;
}
deleteMails(f,target);
mailmbox_done(f);
}
void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target)
{
if (!f) return;
int r;
QValueList<RecMailP>::ConstIterator it;
for (it=target.begin(); it != target.end();++it) {
r = mailmbox_delete_msg(f,(*it)->getNumber());
if (r!=MAILMBOX_NO_ERROR) {
- qDebug("error delete mail");
+ odebug << "error delete mail" << oendl;
}
}
r = mailmbox_expunge(f);
if (r != MAILMBOX_NO_ERROR) {
- qDebug("error expunge mailbox");
+ odebug << "error expunge mailbox" << oendl;
}
}
int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
{
if (!tfolder) return 0;
QString p = MBOXPath+"/"+tfolder->getDisplayName();
int res = 1;
mailfolder*folder = 0;
mailmessage_list*l=0;
mailstorage*storage = mailstorage_new(NULL);
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error initializing mbox"));
res = 0;
}
if (res) {
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error initializing mbox"));
res = 0;
}
}
if (res) {
r = mailsession_get_messages_list(folder->fld_session,&l);
if (r != MAIL_NO_ERROR) {
- qDebug("Error message list");
+ odebug << "Error message list" << oendl;
res=0;
}
}
for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
r = mailsession_remove_message(folder->fld_session,i+1);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
res = 0;
break;
}
}
if (l) mailmessage_list_free(l);
if (folder) mailfolder_free(folder);
if (storage) mailstorage_free(storage);
return res;
}
int MBOXwrapper::deleteMbox(const FolderP&tfolder)
{
if (!tfolder) return 0;
QString p = MBOXPath+"/"+tfolder->getDisplayName();
QFile fi(p);
if (!fi.exists()) {
Global::statusMessage(tr("Mailbox doesn't exist."));
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
@@ -1,442 +1,442 @@
#include "mhwrapper.h"
#include "mailtypes.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
#include <qdir.h>
#include <qmessagebox.h>
#include <stdlib.h>
#include <qpe/global.h>
#include <opie2/oprocess.h>
using namespace Opie::Core;
MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
{
if (MHPath.length()>0) {
if (MHPath[MHPath.length()-1]=='/') {
MHPath=MHPath.left(MHPath.length()-1);
}
- qDebug(MHPath);
+ odebug << MHPath << oendl;
QDir dir(MHPath);
if (!dir.exists()) {
dir.mkdir(MHPath);
}
init_storage();
}
}
void MHwrapper::init_storage()
{
int r;
QString pre = MHPath;
if (!m_storage) {
m_storage = mailstorage_new(NULL);
r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0);
if (r != MAIL_NO_ERROR) {
- qDebug("error initializing storage");
+ odebug << "error initializing storage" << oendl;
mailstorage_free(m_storage);
m_storage = 0;
return;
}
}
r = mailstorage_connect(m_storage);
if (r!=MAIL_NO_ERROR) {
- qDebug("error connecting storage");
+ odebug << "error connecting storage" << oendl;
mailstorage_free(m_storage);
m_storage = 0;
}
}
void MHwrapper::clean_storage()
{
if (m_storage) {
mailstorage_disconnect(m_storage);
mailstorage_free(m_storage);
m_storage = 0;
}
}
MHwrapper::~MHwrapper()
{
clean_storage();
}
void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target )
{
init_storage();
if (!m_storage) {
return;
}
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- qDebug("listMessages: error selecting folder!");
+ odebug << "listMessages: error selecting folder!" << oendl;
return;
}
parseList(target,m_storage->sto_session,f);
Global::statusMessage(tr("Mailbox has %1 mail(s)").arg(target.count()));
}
QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
{
QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
/* this is needed! */
if (m_storage) mailstorage_disconnect(m_storage);
init_storage();
if (!m_storage) {
return folders;
}
mail_list*flist = 0;
clistcell*current=0;
int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
if (r != MAIL_NO_ERROR || !flist) {
- qDebug("error getting folder list");
+ odebug << "error getting folder list" << oendl;
return folders;
}
for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
QString t = (char*)current->data;
t.replace(0,MHPath.length(),"");
folders->append(new MHFolder(t,MHPath));
}
mail_list_free(flist);
return folders;
}
void MHwrapper::deleteMail(const RecMailP&mail)
{
init_storage();
if (!m_storage) {
return;
}
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
- qDebug("error selecting folder!");
+ odebug << "error selecting folder!" << oendl;
return;
}
r = mailsession_remove_message(m_storage->sto_session,mail->getNumber());
if (r != MAIL_NO_ERROR) {
- qDebug("error deleting mail");
+ odebug << "error deleting mail" << oendl;
}
}
void MHwrapper::answeredMail(const RecMailP&)
{
}
RecBodyP MHwrapper::fetchBody( const RecMailP &mail )
{
RecBodyP body = new RecBody();
init_storage();
if (!m_storage) {
return body;
}
mailmessage * msg;
char*data=0;
/* mail should hold the complete path! */
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r != MAIL_NO_ERROR) {
return body;
}
r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
- qDebug("Error fetching mail %i",mail->getNumber());
+ odebug << "Error fetching mail " << mail->getNumber() << "" << oendl;
return body;
}
body = parseMail(msg);
mailmessage_fetch_result_free(msg,data);
return body;
}
void MHwrapper::mbox_progress( size_t current, size_t maximum )
{
- qDebug("MH %i von %i",current,maximum);
+ odebug << "MH " << current << " von " << maximum << "" << oendl;
}
QString MHwrapper::buildPath(const QString&p)
{
QString f="";
if (p.length()==0||p=="/")
return MHPath;
if (!p.startsWith(MHPath)) {
f+=MHPath;
}
if (!p.startsWith("/")) {
f+="/";
}
f+=p;
return f;
}
int MHwrapper::createMbox(const QString&folder,const FolderP&pfolder,const QString&,bool )
{
init_storage();
if (!m_storage) {
return 0;
}
QString f;
if (!pfolder) {
// toplevel folder
f = buildPath(folder);
} else {
f = pfolder->getName();
f+="/";
f+=folder;
}
- qDebug(f);
+ odebug << f << oendl;
int r = mailsession_create_folder(m_storage->sto_session,(char*)f.latin1());
if (r != MAIL_NO_ERROR) {
- qDebug("error creating folder %i",r);
+ odebug << "error creating folder " << r << "" << oendl;
return 0;
}
- qDebug("Folder created");
+ odebug << "Folder created" << oendl;
return 1;
}
void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
{
init_storage();
if (!m_storage) {
return;
}
QString f = buildPath(Folder);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- qDebug("error selecting folder!");
+ odebug << "error selecting folder!" << oendl;
return;
}
r = mailsession_append_message(m_storage->sto_session,(char*)msg,length);
if (r!=MAIL_NO_ERROR) {
- qDebug("error storing mail");
+ odebug << "error storing mail" << oendl;
}
return;
}
encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
{
encodedString*result = 0;
init_storage();
if (!m_storage) {
return result;
}
mailmessage * msg = 0;
char*data=0;
size_t size;
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
- qDebug("error selecting folder!");
+ odebug << "error selecting folder!" << oendl;
return result;
}
r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
return 0;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error fetching mail %i").arg(mail->getNumber()));
if (msg) mailmessage_free(msg);
return 0;
}
result = new encodedString(data,size);
if (msg) mailmessage_free(msg);
return result;
}
void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
{
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
- qDebug("deleteMails: error selecting folder!");
+ odebug << "deleteMails: error selecting folder!" << oendl;
return;
}
QValueList<RecMailP>::ConstIterator it;
for (it=target.begin(); it!=target.end();++it) {
r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
if (r != MAIL_NO_ERROR) {
- qDebug("error deleting mail");
+ odebug << "error deleting mail" << oendl;
break;
}
}
}
int MHwrapper::deleteAllMail(const FolderP&tfolder)
{
init_storage();
if (!m_storage) {
return 0;
}
int res = 1;
if (!tfolder) return 0;
int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
if (r!=MAIL_NO_ERROR) {
- qDebug("error selecting folder!");
+ odebug << "error selecting folder!" << oendl;
return 0;
}
mailmessage_list*l=0;
r = mailsession_get_messages_list(m_storage->sto_session,&l);
if (r != MAIL_NO_ERROR) {
- qDebug("Error message list");
+ odebug << "Error message list" << oendl;
res = 0;
}
unsigned j = 0;
for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
mailmessage * msg;
msg = (mailmessage*)carray_get(l->msg_tab, i);
j = msg->msg_index;
r = mailsession_remove_message(m_storage->sto_session,j);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
res = 0;
break;
}
}
if (l) mailmessage_list_free(l);
return res;
}
int MHwrapper::deleteMbox(const FolderP&tfolder)
{
init_storage();
if (!m_storage) {
return 0;
}
if (!tfolder) return 0;
if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0;
int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
if (r != MAIL_NO_ERROR) {
- qDebug("error deleting mail box");
+ odebug << "error deleting mail box" << oendl;
return 0;
}
QString cmd = "rm -rf "+tfolder->getName();
QStringList command;
command << "/bin/sh";
command << "-c";
command << cmd.latin1();
OProcess *process = new OProcess();
connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
this, SLOT( processEnded(Opie::Core::OProcess*)));
connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
*process << command;
removeMboxfailed = false;
if(!process->start(OProcess::Block, OProcess::All) ) {
- qDebug("could not start process");
+ odebug << "could not start process" << oendl;
return 0;
}
- qDebug("mail box deleted");
+ odebug << "mail box deleted" << oendl;
return 1;
}
void MHwrapper::processEnded(OProcess *p)
{
if (p) delete p;
}
void MHwrapper::oprocessStderr(OProcess*, char *buffer, int )
{
QString lineStr = buffer;
QMessageBox::warning( 0, tr("Error"), lineStr ,tr("Ok") );
removeMboxfailed = true;
}
void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
{
init_storage();
if (!m_storage) {
return;
}
target_stat.message_count = 0;
target_stat.message_unseen = 0;
target_stat.message_recent = 0;
QString f = buildPath(mailbox);
int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error retrieving status"));
}
}
MAILLIB::ATYPE MHwrapper::getType()const
{
return MAILLIB::A_MH;
}
const QString&MHwrapper::getName()const
{
return MHName;
}
void MHwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
init_storage();
if (!m_storage) {
return;
}
if (targetWrapper != this) {
- qDebug("Using generic");
+ odebug << "Using generic" << oendl;
Genericwrapper::mvcpMail(mail,targetFolder,targetWrapper,moveit);
return;
}
- qDebug("Using internal routines for move/copy");
+ odebug << "Using internal routines for move/copy" << oendl;
QString tf = buildPath(targetFolder);
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r != MAIL_NO_ERROR) {
- qDebug("Error selecting source mailbox");
+ odebug << "Error selecting source mailbox" << oendl;
return;
}
if (moveit) {
r = mailsession_move_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
} else {
r = mailsession_copy_message(m_storage->sto_session,mail->getNumber(),(char*)tf.latin1());
}
if (r != MAIL_NO_ERROR) {
- qDebug("Error copy/moving mail internal (%i)",r);
+ odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
}
}
void MHwrapper::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
init_storage();
if (!m_storage) {
return;
}
if (targetWrapper != this) {
- qDebug("Using generic");
+ odebug << "Using generic" << oendl;
Genericwrapper::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit);
return;
}
if (!fromFolder) return;
int r = mailsession_select_folder(m_storage->sto_session,(char*)fromFolder->getName().latin1());
if (r!=MAIL_NO_ERROR) {
- qDebug("error selecting source folder!");
+ odebug << "error selecting source folder!" << oendl;
return;
}
QString tf = buildPath(targetFolder);
mailmessage_list*l=0;
r = mailsession_get_messages_list(m_storage->sto_session,&l);
if (r != MAIL_NO_ERROR) {
- qDebug("Error message list");
+ odebug << "Error message list" << oendl;
}
unsigned j = 0;
for(unsigned int i = 0 ; l!= 0 && i < carray_count(l->msg_tab) ; ++i) {
mailmessage * msg;
msg = (mailmessage*)carray_get(l->msg_tab, i);
j = msg->msg_index;
if (moveit) {
r = mailsession_move_message(m_storage->sto_session,j,(char*)tf.latin1());
} else {
r = mailsession_copy_message(m_storage->sto_session,j,(char*)tf.latin1());
}
if (r != MAIL_NO_ERROR) {
- qDebug("Error copy/moving mail internal (%i)",r);
+ odebug << "Error copy/moving mail internal (" << r << ")" << oendl;
break;
}
}
if (l) mailmessage_list_free(l);
}
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
@@ -8,66 +8,66 @@
#include <libetpan/libetpan.h>
#define HARD_MSG_SIZE_LIMIT 5242880
using namespace Opie::Core;
NNTPwrapper::NNTPwrapper( NNTPaccount *a )
: Genericwrapper() {
account = a;
m_nntp = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
}
NNTPwrapper::~NNTPwrapper() {
logout();
QFile msg_cache(msgTempName);
if (msg_cache.exists()) {
msg_cache.remove();
}
}
void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) {
- qDebug( "NNTP: %i of %i", current, maximum );
+ odebug << "NNTP: " << current << " of " << maximum << "" << oendl;
}
RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) {
int err = NEWSNNTP_NO_ERROR;
char *message = 0;
size_t length = 0;
RecBodyP body = new RecBody();
login();
if ( !m_nntp ) {
return body;
}
mailmessage * mailmsg;
if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
- qDebug("Message to large: %i",mail->Msgsize());
+ odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
return body;
}
QFile msg_cache(msgTempName);
cleanMimeCache();
if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
msg_cache.open(IO_ReadWrite|IO_Truncate);
last_msg_id = mail->getNumber();
err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
QString msg="";
msg_cache.open(IO_ReadOnly);
message = new char[4096];
memset(message,0,4096);
while (msg_cache.readBlock(message,4095)>0) {
msg+=message;
memset(message,0,4096);
@@ -113,86 +113,86 @@ void NNTPwrapper::login()
return;
/* we'll hold the line */
if ( m_nntp != NULL )
return;
const char *server, *user, *pass;
QString User,Pass;
uint16_t port;
int err = NEWSNNTP_NO_ERROR;
server = account->getServer().latin1();
port = account->getPort().toUInt();
user = pass = 0;
if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
User = login.getUser().latin1();
Pass = login.getPassword().latin1();
} else {
// cancel
- qDebug( "NNTP: Login canceled" );
+ odebug << "NNTP: Login canceled" << oendl;
return;
}
} else {
User = account->getUser().latin1();
Pass = account->getPassword().latin1();
}
if (User.isEmpty()) {
user=0;
pass = 0;
} else {
user=User.latin1();
pass=Pass.latin1();
}
// bool ssl = account->getSSL();
m_nntp=mailstorage_new(NULL);
int conntypeset = account->ConnectionType();
int conntype = 0;
if ( conntypeset == 3 ) {
conntype = CONNECTION_TYPE_COMMAND;
} else if ( conntypeset == 2 ) {
conntype = CONNECTION_TYPE_TLS;
} else if ( conntypeset == 1 ) {
conntype = CONNECTION_TYPE_STARTTLS;
} else if ( conntypeset == 0 ) {
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN,
(char*)user,(char*)pass,0,0,0);
err = mailstorage_connect( m_nntp );
if (err != NEWSNNTP_NO_ERROR) {
- qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) );
+ odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
// Global::statusMessage(tr("Error initializing folder"));
mailstorage_free(m_nntp);
m_nntp = 0;
} else {
mailsession * session = m_nntp->sto_session;
newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
news->nntp_progr_fun = &nntp_progress;
}
}
void NNTPwrapper::logout()
{
int err = NEWSNNTP_NO_ERROR;
if ( m_nntp == NULL )
return;
mailstorage_free(m_nntp);
m_nntp = 0;
}
QValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
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
@@ -7,66 +7,66 @@
#include <qfile.h>
//#include <qstring.h>
/* we don't fetch messages larger than 5 MB */
#define HARD_MSG_SIZE_LIMIT 5242880
using namespace Opie::Core;
POP3wrapper::POP3wrapper( POP3account *a )
: Genericwrapper() {
account = a;
m_pop3 = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
}
POP3wrapper::~POP3wrapper() {
logout();
QFile msg_cache(msgTempName);
if (msg_cache.exists()) {
msg_cache.remove();
}
}
void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
- qDebug( "POP3: %i of %i", current, maximum );
+ odebug << "POP3: " << current << " of " << maximum << "" << oendl;
}
RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
int err = MAILPOP3_NO_ERROR;
char *message = 0;
size_t length = 0;
RecBodyP body = new RecBody();
login();
if ( !m_pop3 ) {
return body;
}
mailmessage * mailmsg;
if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
- qDebug("Message to large: %i",mail->Msgsize());
+ odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
return body;
}
QFile msg_cache(msgTempName);
cleanMimeCache();
if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
msg_cache.open(IO_ReadWrite|IO_Truncate);
last_msg_id = mail->getNumber();
err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
QString msg="";
msg_cache.open(IO_ReadOnly);
message = new char[4096];
memset(message,0,4096);
while (msg_cache.readBlock(message,4095)>0) {
msg+=message;
memset(message,0,4096);
@@ -109,81 +109,81 @@ void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPoi
void POP3wrapper::login()
{
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_pop3 != NULL )
return;
const char *server, *user, *pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer().latin1();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
} else {
// cancel
- qDebug( "POP3: Login canceled" );
+ odebug << "POP3: Login canceled" << oendl;
return;
}
} else {
user = account->getUser().latin1();
pass = account->getPassword().latin1();
}
// bool ssl = account->getSSL();
m_pop3=mailstorage_new(NULL);
int conntypeset = account->ConnectionType();
int conntype = 0;
if ( conntypeset == 3 ) {
conntype = CONNECTION_TYPE_COMMAND;
} else if ( conntypeset == 2 ) {
conntype = CONNECTION_TYPE_TLS;
} else if ( conntypeset == 1 ) {
conntype = CONNECTION_TYPE_STARTTLS;
} else if ( conntypeset == 0 ) {
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
//(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
(char*)user,(char*)pass,0,0,0);
err = mailstorage_connect(m_pop3);
if (err != MAIL_NO_ERROR) {
- qDebug( QString( "FEHLERNUMMER %1" ).arg( err ) );
+ odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
Global::statusMessage(tr("Error initializing folder"));
mailstorage_free(m_pop3);
m_pop3 = 0;
} else {
mailsession * session = m_pop3->sto_session;
mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
if (mail) {
mail->pop3_progr_fun = &pop3_progress;
}
}
}
void POP3wrapper::logout()
{
if ( m_pop3 == NULL )
return;
mailstorage_free(m_pop3);
m_pop3 = 0;
}
QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>();
FolderP inb=new Folder("INBOX","/");
@@ -215,49 +215,49 @@ int POP3wrapper::deleteAllMail(const FolderP&) {
Global::statusMessage(tr("Error getting folder info"));
return 0;
}
for (unsigned int i = 0; i < result; ++i) {
err = mailsession_remove_message(m_pop3->sto_session,i+1);
if (err != MAIL_NO_ERROR) {
Global::statusMessage(tr("Error deleting mail %1").arg(i+1));
res=0;
}
break;
}
return res;
}
void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
login();
target_stat.message_count = 0;
target_stat.message_unseen = 0;
target_stat.message_recent = 0;
if (!m_pop3)
return;
int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
if (r != MAIL_NO_ERROR) {
- qDebug("error getting folter status.");
+ odebug << "error getting folter status." << oendl;
}
}
encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) {
char*target=0;
size_t length=0;
encodedString*res = 0;
mailmessage * mailmsg = 0;
int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&target,&length);
if (mailmsg)
mailmessage_free(mailmsg);
if (target) {
res = new encodedString(target,length);
}
return res;
}
MAILLIB::ATYPE POP3wrapper::getType()const {
return account->getType();
}
const QString&POP3wrapper::getName()const{
return account->getAccountName();
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
@@ -5,98 +5,98 @@
#include "settings.h"
//#include "defines.h"
#define IMAP_PORT "143"
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
Settings::Settings()
: QObject()
{
updateAccounts();
}
void Settings::checkDirectory()
{
if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
system( "mkdir -p $HOME/Applications/opiemail" );
- qDebug( "$HOME/Applications/opiemail created" );
+ odebug << "$HOME/Applications/opiemail created" << oendl;
}
}
QList<Account> Settings::getAccounts()
{
return accounts;
}
void Settings::addAccount( Account *account )
{
accounts.append( account );
}
void Settings::delAccount( Account *account )
{
accounts.remove( account );
account->remove();
}
void Settings::updateAccounts()
{
accounts.clear();
QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
QStringList::Iterator it;
QStringList imap = dir.entryList( "imap-*" );
for ( it = imap.begin(); it != imap.end(); it++ ) {
- qDebug( "Added IMAP account" );
+ odebug << "Added IMAP account" << oendl;
IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList pop3 = dir.entryList( "pop3-*" );
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
- qDebug( "Added POP account" );
+ odebug << "Added POP account" << oendl;
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
- qDebug( "Added SMTP account" );
+ odebug << "Added SMTP account" << oendl;
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
- qDebug( "Added NNTP account" );
+ odebug << "Added NNTP account" << oendl;
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
readAccounts();
}
void Settings::saveAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->save();
}
}
void Settings::readAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->read();
@@ -158,49 +158,49 @@ QString IMAPaccount::getUniqueFileName()
void IMAPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "IMAP Account" );
accountName = conf->readEntry( "Account","" );
if (accountName.isNull()) accountName = "";
server = conf->readEntry( "Server","" );
if (server.isNull()) server="";
port = conf->readEntry( "Port","" );
if (port.isNull()) port="143";
connectionType = conf->readNumEntry( "ConnectionType" );
ssl = conf->readBoolEntry( "SSL",false );
user = conf->readEntry( "User","" );
if (user.isNull()) user = "";
password = conf->readEntryCrypt( "Password","" );
if (password.isNull()) password = "";
prefix = conf->readEntry("MailPrefix","");
if (prefix.isNull()) prefix = "";
offline = conf->readBoolEntry("Offline",false);
delete conf;
}
void IMAPaccount::save()
{
- qDebug( "saving " + getFileName() );
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "IMAP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "MailPrefix",prefix);
conf->writeEntry( "Offline",offline);
conf->write();
delete conf;
}
QString IMAPaccount::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file;
}
POP3account::POP3account()
@@ -236,49 +236,49 @@ QString POP3account::getUniqueFileName()
do {
unique.setNum( num++ );
} while ( imap.contains( "pop3-" + unique ) > 0 );
return unique;
}
void POP3account::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "POP3 Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
offline = conf->readBoolEntry("Offline",false);
delete conf;
}
void POP3account::save()
{
- qDebug( "saving " + getFileName() );
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "POP3 Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "Offline",offline);
conf->write();
delete conf;
}
QString POP3account::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file;
}
SMTPaccount::SMTPaccount()
: Account()
@@ -318,49 +318,49 @@ QString SMTPaccount::getUniqueFileName()
do {
unique.setNum( num++ );
} while ( imap.contains( "smtp-" + unique ) > 0 );
return unique;
}
void SMTPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "SMTP Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
delete conf;
}
void SMTPaccount::save()
{
- qDebug( "saving " + getFileName() );
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "SMTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->write();
delete conf;
}
QString SMTPaccount::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/smtp-" + file;
}
NNTPaccount::NNTPaccount()
: Account()
@@ -395,46 +395,46 @@ QString NNTPaccount::getUniqueFileName()
do {
unique.setNum( num++ );
} while ( imap.contains( "nntp-" + unique ) > 0 );
return unique;
}
void NNTPaccount::read()
{
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "NNTP Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
subscribedGroups = conf->readListEntry( "Subscribed", ',' );
delete conf;
}
void NNTPaccount::save()
{
- qDebug( "saving " + getFileName() );
+ odebug << "saving " + getFileName() << oendl;
Settings::checkDirectory();
Config *conf = new Config( getFileName(), Config::File );
conf->setGroup( "NNTP Account" );
conf->writeEntry( "Account", accountName );
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "Subscribed" , subscribedGroups, ',' );
conf->write();
delete conf;
}
QString NNTPaccount::getFileName()
{
return (QString) getenv( "HOME" ) + "/Applications/opiemail/nntp-" + file;
}
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
@@ -94,49 +94,49 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
return;
QString localfolders = AbstractMail::defaultLocalfolder();
AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
wrap->createMbox(box);
wrap->storeMessage(mail,length,box);
delete wrap;
}
void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
clist *rcpts = 0;
char *from, *data;
size_t size;
from = data = 0;
mailmessage * msg = 0;
msg = mime_message_init(mail);
mime_message_set_tmpdir(msg,getenv( "HOME" ));
int r = mailmessage_fetch(msg,&data,&size);
mime_message_detach_mime(msg);
mailmessage_free(msg);
if (r != MAIL_NO_ERROR || !data) {
if (data)
free(data);
- qDebug("Error fetching mime...");
+ odebug << "Error fetching mime..." << oendl;
return;
}
msg = 0;
if (later) {
storeMail(data,size,"Outgoing");
if (data)
free( data );
Config cfg( "mail" );
cfg.setGroup( "Status" );
cfg.writeEntry( "outgoing", ++m_queuedMail );
emit queuedMails( m_queuedMail );
return;
}
from = getFrom( mail );
rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
smtpSend(from,rcpts,data,size);
if (data) {
free(data);
}
if (from) {
free(from);
}
if (rcpts)
smtp_address_list_free( rcpts );
@@ -187,166 +187,166 @@ void SMTPwrapper::connect_server()
server = user = pass = 0;
QString failuretext = "";
if (m_smtp || !m_SmtpAccount) {
return;
}
server = m_SmtpAccount->getServer().latin1();
if ( m_SmtpAccount->ConnectionType() == 2 ) {
ssl = true;
try_tls = false;
} else if (m_SmtpAccount->ConnectionType() == 1) {
force_tls = true;
}
int result = 1;
port = m_SmtpAccount->getPort().toUInt();
m_smtp = mailsmtp_new( 20, &progress );
if ( m_smtp == NULL ) {
/* no failure message cause this happens when problems with memory - than we
we can not display any messagebox */
return;
}
int err = MAILSMTP_NO_ERROR;
- qDebug( "Servername %s at port %i", server, port );
+ odebug << "Servername " << server << " at port " << port << "" << oendl;
if ( ssl ) {
- qDebug( "SSL session" );
+ odebug << "SSL session" << oendl;
err = mailsmtp_ssl_connect( m_smtp, server, port );
} else {
- qDebug( "No SSL session" );
+ odebug << "No SSL session" << oendl;
err = mailsmtp_socket_connect( m_smtp, server, port );
}
if ( err != MAILSMTP_NO_ERROR ) {
- qDebug("Error init connection");
+ odebug << "Error init connection" << oendl;
failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
result = 0;
}
/* switch to tls after init 'cause there it will send the ehlo */
if (result) {
err = mailsmtp_init( m_smtp );
if (err != MAILSMTP_NO_ERROR) {
result = 0;
failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
}
}
if (try_tls) {
err = start_smtp_tls();
if (err != MAILSMTP_NO_ERROR) {
try_tls = false;
} else {
err = mailesmtp_ehlo(m_smtp);
}
}
if (!try_tls && force_tls) {
result = 0;
failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err));
}
if (result==1 && m_SmtpAccount->getLogin() ) {
- qDebug("smtp with auth");
+ odebug << "smtp with auth" << oendl;
if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
// get'em
LoginDialog login( m_SmtpAccount->getUser(),
m_SmtpAccount->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
} else {
result = 0;
failuretext=tr("Login aborted - storing mail to localfolder");
}
} else {
user = m_SmtpAccount->getUser().latin1();
pass = m_SmtpAccount->getPassword().latin1();
}
- qDebug( "session->auth: %i", m_smtp->auth);
+ odebug << "session->auth: " << m_smtp->auth << "" << oendl;
if (result) {
err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass );
if ( err == MAILSMTP_NO_ERROR ) {
- qDebug("auth ok");
+ odebug << "auth ok" << oendl;
} else {
failuretext = tr("Authentification failed");
result = 0;
}
}
}
}
void SMTPwrapper::disc_server()
{
if (m_smtp) {
mailsmtp_quit( m_smtp );
mailsmtp_free( m_smtp );
m_smtp = 0;
}
}
int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
{
int err,result;
QString failuretext = "";
connect_server();
result = 1;
if (m_smtp) {
err = mailsmtp_send( m_smtp, from, rcpts, data, size );
if ( err != MAILSMTP_NO_ERROR ) {
failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err));
result = 0;
}
} else {
result = 0;
}
if (!result) {
storeFailedMail(data,size,failuretext);
} else {
- qDebug( "Mail sent." );
+ odebug << "Mail sent." << oendl;
storeMail(data,size,"Sent");
}
return result;
}
void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
{
mailmime * mimeMail;
mimeMail = createMimeMail(mail );
if ( mimeMail == NULL ) {
- qDebug( "sendMail: error creating mime mail" );
+ odebug << "sendMail: error creating mime mail" << oendl;
} else {
sendProgress = new progressMailSend();
sendProgress->show();
sendProgress->setMaxMails(1);
smtpSend( mimeMail,later);
- qDebug("Clean up done");
+ odebug << "Clean up done" << oendl;
sendProgress->hide();
delete sendProgress;
sendProgress = 0;
mailmime_free( mimeMail );
}
}
int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
size_t curTok = 0;
mailimf_fields *fields = 0;
mailimf_field*ffrom = 0;
clist *rcpts = 0;
char*from = 0;
int res = 0;
encodedString * data = wrap->fetchRawBody(which);
if (!data)
return 0;
int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields );
if (err != MAILIMF_NO_ERROR) {
delete data;
delete wrap;
return 0;
}
@@ -357,69 +357,69 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
if (rcpts && from) {
res = smtpSend(from,rcpts,data->Content(),data->Length());
}
if (fields) {
mailimf_fields_free(fields);
fields = 0;
}
if (data) {
delete data;
}
if (from) {
free(from);
}
if (rcpts) {
smtp_address_list_free( rcpts );
}
return res;
}
/* this is a special fun */
bool SMTPwrapper::flushOutbox() {
bool returnValue = true;
- qDebug("Sending the queue");
+ odebug << "Sending the queue" << oendl;
if (!m_SmtpAccount) {
- qDebug("No smtp account given");
+ odebug << "No smtp account given" << oendl;
return false;
}
bool reset_user_value = false;
QString localfolders = AbstractMail::defaultLocalfolder();
AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
if (!wrap) {
- qDebug("memory error");
+ odebug << "memory error" << oendl;
return false;
}
QString oldPw, oldUser;
QValueList<RecMailP> mailsToSend;
QValueList<RecMailP> mailsToRemove;
QString mbox("Outgoing");
wrap->listMessages(mbox,mailsToSend);
if (mailsToSend.count()==0) {
delete wrap;
- qDebug("No mails to send");
+ odebug << "No mails to send" << oendl;
return false;
}
oldPw = m_SmtpAccount->getPassword();
oldUser = m_SmtpAccount->getUser();
if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
// get'em
QString user,pass;
LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
reset_user_value = true;
m_SmtpAccount->setUser(user);
m_SmtpAccount->setPassword(pass);
} else {
return true;
}
}
sendProgress = new progressMailSend();
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
@@ -22,69 +22,69 @@ void StatusMail::initAccounts(QList<Account>&accounts)
Account *it;
folderStat currentStat;
AbstractMail * current = 0;
currentPop3Stat.message_count=0;
currentPop3Stat.message_recent=0;
currentPop3Stat.message_unseen=0;
for ( it = accounts.first(); it; it = accounts.next() ) {
if ( it->getType()==MAILLIB::A_IMAP && !it->getOffline() ) {
IMAPaccount*ima = static_cast<IMAPaccount *>(it);
current = AbstractMail::getWrapper(ima);
connectionList.append(current);
current->statusFolder(currentStat);
currentImapStat.message_count+=currentStat.message_unseen;
currentImapStat.message_count+=currentStat.message_recent;
currentImapStat.message_count+=currentStat.message_count;
} else if ( it->getType() == MAILLIB::A_POP3 && !it->getOffline() ) {
POP3account *pop3 = static_cast<POP3account *>(it);
current = AbstractMail::getWrapper(pop3);
connectionList.append(current);
current->statusFolder(currentStat);
currentPop3Stat.message_count+=currentStat.message_count;
}
current->logout();
}
- qDebug("Pop3 init count: %i",currentPop3Stat.message_count);
+ odebug << "Pop3 init count: " << currentPop3Stat.message_count << "" << oendl;
currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
lastPop3Stat.message_unseen = currentPop3Stat.message_unseen;
lastPop3Stat.message_recent = currentPop3Stat.message_recent;
lastPop3Stat.message_count = currentPop3Stat.message_count;
}
void StatusMail::reset_status()
{
lastPop3Stat = currentPop3Stat;
}
void StatusMail::check_current_stat(folderStat&targetStat)
{
AbstractMail*it = 0;
folderStat currentStat;
currentPop3Stat.message_recent = 0;
currentPop3Stat.message_count = 0;
currentPop3Stat.message_unseen = 0;
currentImapStat = currentPop3Stat;
for ( it = connectionList.first(); it; it = connectionList.next() ) {
it->statusFolder(currentStat);
it->logout();
if (it->getType() == MAILLIB::A_IMAP) {
currentImapStat.message_unseen+=currentStat.message_unseen;
currentImapStat.message_recent+=currentStat.message_recent;
currentImapStat.message_count+=currentStat.message_count;
} else if (it->getType() == MAILLIB::A_POP3) {
currentPop3Stat.message_count+=currentStat.message_count;
- qDebug("Pop3 count: %i",currentPop3Stat.message_count);
+ odebug << "Pop3 count: " << currentPop3Stat.message_count << "" << oendl;
}
}
- qDebug("Pop3 last: %i",lastPop3Stat.message_count);
+ odebug << "Pop3 last: " << lastPop3Stat.message_count << "" << oendl;
if (currentPop3Stat.message_count > lastPop3Stat.message_count) {
currentPop3Stat.message_recent = currentPop3Stat.message_count - lastPop3Stat.message_count;
currentPop3Stat.message_unseen = currentPop3Stat.message_recent;
} else {
lastPop3Stat.message_count = currentPop3Stat.message_count;
currentPop3Stat.message_recent = currentPop3Stat.message_unseen = 0;
}
targetStat = currentImapStat;
targetStat.message_unseen+=currentPop3Stat.message_unseen;
targetStat.message_recent+=currentPop3Stat.message_recent;
targetStat.message_count+=currentPop3Stat.message_count;
}
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
@@ -37,55 +37,55 @@ Storemail::Storemail(const QString&dir,const QString&aFolder)
Storemail::Storemail(const QString&aFolder)
: Generatemail()
{
wrapper = 0;
m_Account = 0;
m_tfolder = aFolder;
wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder());
if (wrapper) {
wrapper->createMbox(m_tfolder);
}
}
Storemail::~Storemail()
{
}
int Storemail::storeMail(const Opie::Core::OSmartPointer<Mail>&mail)
{
if (!wrapper) return 0;
int ret = 1;
mailmime * mimeMail = 0;
mimeMail = createMimeMail(mail );
if ( mimeMail == NULL ) {
- qDebug( "storeMail: error creating mime mail" );
+ odebug << "storeMail: error creating mime mail" << oendl;
return 0;
}
char *data;
size_t size;
data = 0;
mailmessage * msg = 0;
msg = mime_message_init(mimeMail);
mime_message_set_tmpdir(msg,getenv( "HOME" ));
int r = mailmessage_fetch(msg,&data,&size);
mime_message_detach_mime(msg);
mailmessage_free(msg);
msg = 0;
if (r != MAIL_NO_ERROR || !data) {
- qDebug("Error fetching mime...");
+ odebug << "Error fetching mime..." << oendl;
ret = 0;
}
if (ret) {
wrapper->storeMessage(data,size,m_tfolder);
}
if (data) {
free(data);
}
if (mimeMail) {
mailmime_free( mimeMail );
}
return ret;
}
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
@@ -120,97 +120,97 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
// Added by Stefan Eilers to allow starting by addressbook..
// copied from old mail2
#if !defined(QT_NO_COP)
connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
this, SLOT( appMessage(const QCString&,const QByteArray&) ) );
#endif
QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
}
MainWindow::~MainWindow()
{
}
void MainWindow::appMessage(const QCString &, const QByteArray &)
{
- qDebug("appMessage not reached");
+ odebug << "appMessage not reached" << oendl;
}
void MainWindow::slotAdjustLayout() {
QWidget *d = QApplication::desktop();
if ( d->width() < d->height() ) {
layout->setDirection( QBoxLayout::TopToBottom );
} else {
layout->setDirection( QBoxLayout::LeftToRight );
}
}
void MainWindow::slotAdjustColumns()
{
bool hidden = folderView->isHidden();
if ( hidden ) folderView->show();
folderView->setColumnWidth( 0, folderView->visibleWidth() );
if ( hidden ) folderView->hide();
mailView->setColumnWidth( 0, 10 );
mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 );
mailView->setColumnWidth( 2, 80 );
mailView->setColumnWidth( 3, 50 );
mailView->setColumnWidth( 4, 50 );
}
void MainWindow::slotEditSettings()
{
}
void MainWindow::slotShowFolders( bool )
{
- qDebug( "slotShowFolders not reached" );
+ odebug << "slotShowFolders not reached" << oendl;
}
void MainWindow::refreshMailView(const QValueList<RecMailP>&)
{
- qDebug( "refreshMailView not reached" );
+ odebug << "refreshMailView not reached" << oendl;
}
void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
{
- qDebug( "mailLeftClicked not reached" );
+ odebug << "mailLeftClicked not reached" << oendl;
}
void MainWindow::displayMail()
{
- qDebug("displayMail not reached");
+ odebug << "displayMail not reached" << oendl;
}
void MainWindow::slotDeleteMail()
{
- qDebug("deleteMail not reached");
+ odebug << "deleteMail not reached" << oendl;
}
void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
{
- qDebug("mailHold not reached");
+ odebug << "mailHold not reached" << oendl;
}
void MainWindow::slotSendQueued()
{
}
void MainWindow::slotEditAccounts()
{
}
void MainWindow::slotComposeMail()
{
}
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
@@ -32,31 +32,31 @@ void NNTPGroups::slotGetNG()
item->setOn( true );
subscribedGroupsNotListed.remove((*it));
}
}
}
void NNTPGroups::fillGroups()
{
if (!m_Account) return;
subscribedGroups = m_Account->getGroups();
for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
QCheckListItem *item;
item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
item->setOn( true );
}
}
void NNTPGroups::storeValues()
{
if (!m_Account) return;
QListViewItemIterator list_it( GroupListView );
subscribedGroups.clear();
for ( ; list_it.current(); ++list_it ) {
if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
- qDebug(list_it.current()->text(0) );
+ odebug << list_it.current()->text(0) << oendl;
subscribedGroups.append( list_it.current()->text(0) );
}
}
subscribedGroups+=subscribedGroupsNotListed;
m_Account->setGroups( subscribedGroups );
}
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
@@ -46,194 +46,194 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
slotComposeMail();
}
}
void OpieMail::slotwriteMail(const QString&name,const QString&email)
{
ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
if (!email.isEmpty())
{
if (!name.isEmpty())
{
compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
}
else
{
compose.setTo(email);
}
}
compose.slotAdjustColumns();
QPEApplication::execDialog( &compose );
}
void OpieMail::slotComposeMail()
{
- qDebug( "Compose Mail" );
+ odebug << "Compose Mail" << oendl;
slotwriteMail(0l,0l);
}
void OpieMail::slotSendQueued()
{
- qDebug( "Send Queued" );
+ odebug << "Send Queued" << oendl;
SMTPaccount *smtp = 0;
QList<Account> list = settings->getAccounts();
QList<SMTPaccount> smtpList;
smtpList.setAutoDelete(false);
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_SMTP )
{
smtp = static_cast<SMTPaccount *>(it);
smtpList.append(smtp);
}
}
if (smtpList.count()==0)
{
QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
return;
}
if (smtpList.count()==1)
{
smtp = smtpList.at(0);
}
else
{
smtp = 0;
selectsmtp selsmtp;
selsmtp.setSelectionlist(&smtpList);
if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted )
{
smtp = selsmtp.selected_smtp();
}
}
if (smtp)
{
SMTPwrapper * wrap = new SMTPwrapper(smtp);
if ( wrap->flushOutbox() )
{
QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
}
delete wrap;
}
}
void OpieMail::slotSearchMails()
{
- qDebug( "Search Mails" );
+ odebug << "Search Mails" << oendl;
}
void OpieMail::slotEditSettings()
{
SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
QPEApplication::execDialog( &settingsDialog );
}
void OpieMail::slotEditAccounts()
{
- qDebug( "Edit Accounts" );
+ odebug << "Edit Accounts" << oendl;
EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
eaDialog.slotAdjustColumns();
QPEApplication::execDialog( &eaDialog );
if ( settings ) delete settings;
settings = new Settings();
folderView->populate( settings->getAccounts() );
}
void OpieMail::displayMail()
{
QListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
readMail.setBody( body );
readMail.setMail( mail );
readMail.showMaximized();
readMail.exec();
if ( readMail.deleted )
{
folderView->refreshCurrent();
}
else
{
( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) );
}
}
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
mail->Wrapper()->deleteMail( mail );
folderView->refreshCurrent();
}
}
void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
{
if (!mailView->currentItem()) return;
MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
/* just the RIGHT button - or hold on pda */
if (button!=2) {return;}
- qDebug("Event right/hold");
+ odebug << "Event right/hold" << oendl;
if (!item) return;
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (mailtype==MAILLIB::A_NNTP) {
m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
} else {
if (folderView->currentisDraft()) {
m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
}
m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
}
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
}
void OpieMail::slotShowFolders( bool show )
{
- qDebug( "Show Folders" );
+ odebug << "Show Folders" << oendl;
if ( show && folderView->isHidden() )
{
- qDebug( "-> showing" );
+ odebug << "-> showing" << oendl;
folderView->show();
}
else if ( !show && !folderView->isHidden() )
{
- qDebug( "-> hiding" );
+ odebug << "-> hiding" << oendl;
folderView->hide();
}
}
void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
{
MailListViewItem*item = 0;
mailView->clear();
QValueList<RecMailP>::ConstIterator it;
for (it = list.begin(); it != list.end();++it)
{
item = new MailListViewItem(mailView,item);
item->storeData((*it));
item->showEntry();
}
}
void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
{
/* just LEFT button - or tap with stylus on pda */
if (button!=1) return;
if (!item) return;
if (folderView->currentisDraft()) {
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
@@ -83,49 +83,49 @@ void MailApplet::startup() {
delete settings;
m_intervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
m_intervalTimer = new QTimer();
m_intervalTimer->start( m_intervalMs );
connect( m_intervalTimer, SIGNAL( timeout() ), this, SLOT( slotCheck() ) );
}
void MailApplet::slotCheck() {
// Check wether the check interval has been changed.
int newIntervalMs = m_config->readNumEntry( "CheckEvery", 5 ) * 60000;
if ( newIntervalMs != m_intervalMs ) {
m_intervalTimer->changeInterval( newIntervalMs );
m_intervalMs = newIntervalMs;
}
if (m_statusMail == 0) {
return;
}
folderStat stat;
m_statusMail->check_current_stat( stat );
int newMailsOld = m_newMails;
m_newMails = stat.message_unseen;
- qDebug( QString( "test %1" ).arg( m_newMails ) );
+ odebug << QString( "test %1" ).arg( m_newMails ) << oendl;
if ( m_newMails > 0 && newMailsOld != m_newMails ) {
ODevice *device = ODevice::inst();
if ( isHidden() )
show();
if ( m_config->readBoolEntry( "BlinkLed", true ) ) {
if ( !device->ledList().isEmpty() ) {
OLed led = ( device->ledList().contains( Led_Mail ) ) ? Led_Mail : device->ledList()[0];
device->setLedState( led, device->ledStateList( led ).contains( Led_BlinkSlow ) ? Led_BlinkSlow : Led_On );
}
}
if ( m_config->readBoolEntry( "PlaySound", false ) )
device->playAlarmSound();
Config cfg( "mail" );
cfg.setGroup( "Status" );
cfg.writeEntry( "newMails", m_newMails );
QCopEnvelope env( "QPE/Pim", "newMails(int)" );
env << m_newMails;
repaint( true );
} else {
ODevice *device = ODevice::inst();
if ( !isHidden() )
hide();
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
@@ -118,49 +118,49 @@ void ViewMail::setBody(const RecBodyP&body )
}
{
/* I did not found a method to make a CONTENT reset on a QTextStream
so I use this construct that the stream will re-constructed in each
loop. To let it work, the textstream is packed into a own area of
code is it will be destructed after finishing its small job.
*/
QTextOStream o(&fsize);
if (w>0) o.precision(2); else o.precision(0);
o.setf(QTextStream::fixed);
o << s << " " << q << "Byte";
}
curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
QString filename = "";
for (unsigned int i = 0; i < body->Parts().count();++i)
{
filename = "";
type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
for (;it!=body->Parts()[i]->Parameters().end();++it)
{
- qDebug(it.key());
+ odebug << it.key() << oendl;
if (it.key().lower()=="name")
{
filename=it.data();
}
}
s = body->Parts()[i]->Size();
w = 0;
while (s>1024)
{
s/=1024;
++w;
if (w>=2) break;
}
switch(w)
{
case 1:
q="k";
break;
case 2:
q="M";
break;
default:
q="";
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 @@
config OPIEFTP
boolean "opie-ftp (ftp client for Opie)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && FTPLIB
+ 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
@@ -11,49 +11,49 @@
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include "filePermissions.h"
#include <qfileinfo.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qmessagebox.h>
#include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName, bool useRemote )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( tr("filePermissions") );
-// qDebug("FilePermissions "+fileName);
+// odebug << "FilePermissions "+fileName << oendl;
resize( 236, 210 );
isRemote=useRemote;
setMaximumSize( QSize( 236, 210 ) );
setCaption( tr( "Set File Permissions" ) );
TextLabel1 = new QLabel( this, "TextLabel1" );
TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) );
TextLabel1->setText( tr( "Set file permissions for:" ) );
LineEdit1 = new QLineEdit( this, "LineEdit1" );
LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) );
LineEdit1->setReadOnly(true);
TextLabel4 = new QLabel( this, "TextLabel4" );
TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) );
TextLabel4->setText( tr( "owner" ) );
TextLabel4_2 = new QLabel( this, "TextLabel4_2" );
TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) );
TextLabel4_2->setText( tr( "group" ) );
TextLabel4_3 = new QLabel( this, "TextLabel4_3" );
TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) );
TextLabel4_3->setText( tr( "others" ) );
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
@@ -1,88 +1,91 @@
/***************************************************************************
opieftp.cpp
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
//#define DEVELOPERS_VERSION
#include "opieftp.h"
extern "C" {
#include "../ftplib/ftplib.h"
}
#include "inputDialog.h"
-#include <qmenubar.h>
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
+using namespace Opie::Core;
#include <qtextstream.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qcombobox.h>
#include <qlistview.h>
#include <qlabel.h>
#include <qprogressbar.h>
#include <qspinbox.h>
#include <qtabwidget.h>
#include <qlayout.h>
#include <qmessagebox.h>
+#include <qmenubar.h>
#include <qlineedit.h>
#include <qlistbox.h>
#include <qvbox.h>
+/* STD */
#include <unistd.h>
#include <stdlib.h>
-
QProgressBar *ProgressBar;
static netbuf *conn=NULL;
static int log_progress(netbuf *, int xfered, void *)
{
// int fsz = *(int *)arg;
// int pct = (xfered * 100) / fsz;
// printf("%3d%%\r", pct);
// fflush(stdout);
ProgressBar->setProgress(xfered);
qApp->processEvents();
return 1;
}
OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
: QMainWindow( parent, name, fl )
{
- qDebug("OpieFtp constructor");
+ odebug << "OpieFtp constructor" << oendl;
setCaption( tr( "OpieFtp" ) );
fuckeduphack=FALSE;
QVBox* wrapperBox = new QVBox( this );
setCentralWidget( wrapperBox );
QWidget *view = new QWidget( wrapperBox );
QGridLayout *layout = new QGridLayout( view );
layout->setSpacing( 2);
layout->setMargin( 2);
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
QMenuBar *menuBar = new QMenuBar(this);
// QToolBar *menuBar = new QToolBar(this);
// menuBar->setHorizontalStretchable( TRUE );
QWMatrix matrix;
QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
matrix.scale( .4, .4);
unknownXpm = pix.xForm(matrix);
connectionMenu = new QPopupMenu( this );
localMenu = new QPopupMenu( this );
@@ -313,49 +316,49 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
currentPathCombo ->setFixedWidth(220);
currentPathCombo->setEditable(TRUE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
#if 0
connect( currentPathCombo, SIGNAL( activated(const QString&) ),
this, SLOT( currentPathComboActivated(const QString&) ) );
connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
this,SLOT(currentPathComboChanged()));
#endif
ProgressBar = new QProgressBar( view, "ProgressBar" );
layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
ProgressBar->setMaximumHeight(10);
filterStr="*";
b=FALSE;
#if 0
populateLocalView();
#endif
readConfig();
// ServerComboBox->setCurrentItem(currentServerConfig);
TabWidget->setCurrentPage(2);
- qDebug("Constructor done");
+ odebug << "Constructor done" << oendl;
}
OpieFtp::~OpieFtp()
{
}
void OpieFtp::cleanUp()
{
if(conn)
FtpQuit(conn);
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
if(file.exists())
file.remove();
Config cfg("opieftp");
cfg.setGroup("Server");
cfg.writeEntry("currentServer", currentServerConfig);
exit(0);
}
@@ -384,49 +387,49 @@ void OpieFtp::tabChanged(QWidget *)
}
if (TabWidget->currentPageIndex() == 2) {
tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
cdUpButton->hide();
homeButton->hide();
}
}
void OpieFtp::newConnection()
{
UsernameComboBox->lineEdit()->setText("");
PasswordEdit->setText( "" );
ServerComboBox->lineEdit()->setText( "");
remotePath->setText( currentRemoteDir = "/");
PortSpinBox->setValue( 21);
TabWidget->setCurrentPage(2);
}
void OpieFtp::serverComboEdited(const QString & )
{
// if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) {
-// qDebug("ServerComboEdited");
+// odebug << "ServerComboEdited" << oendl;
// // currentServerConfig = -1;
// }
}
void OpieFtp::UsernameComboBoxEdited(const QString &) {
// currentServerConfig = -1;
}
void OpieFtp::PasswordEditEdited(const QString & ) {
// currentServerConfig = -1;
}
void OpieFtp::connectorBtnToggled(bool On)
{
if(On) {
connector();
} else {
disConnector();
}
}
void OpieFtp::connector()
{
@@ -509,49 +512,49 @@ void OpieFtp::disConnector()
setCaption("OpieFtp");
}
void OpieFtp::localUpload()
{
int fsz;
// QCopEnvelope ( "QPE/System", "busy()" );
// qApp->processEvents();
QList<QListViewItem> * getSelectedItems( QListView * Local_View );
QListViewItemIterator it( Local_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QString strItem = it.current()->text(0);
QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
QFileInfo fi(localFile);
if( !fi.isDir()) {
fsz=fi.size();
ProgressBar->setTotalSteps(fsz);
FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
- qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
+ odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl;
if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
QString msg;
msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
} else {
QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
}
ProgressBar->reset();
nullifyCallBack();
it.current()->setSelected(FALSE);
} //end currentSelected
}
for ( ; it.current(); ++it ) {
Local_View->clearSelection();
}
Local_View->clearFocus();
TabWidget->setCurrentPage(1);
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
// QCopEnvelope ( "QPE/System", "notBusy()" );
}
@@ -570,271 +573,271 @@ void OpieFtp::remoteDownload()
// QCopEnvelope ( "QPE/System", "busy()" );
QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
QListViewItemIterator it( Remote_View );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QString strItem = it.current()->text(0);
// strItem=strItem.right(strItem.length()-1);
QString localFile = currentDir.canonicalPath();
if(localFile.right(1).find("/",0,TRUE) == -1)
localFile += "/";
localFile += strItem;
// QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
fsz = 0;
QString temp;
temp.sprintf( remoteFile+" "+" %dkb", fsz);
ProgressBar->setTotalSteps(fsz);
FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
- qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
+ odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl;
if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
QString msg;
msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
}
ProgressBar->reset();
nullifyCallBack();
it.current()->setSelected(FALSE);
}
}
for ( ; it.current(); ++it ) {
Remote_View->clearSelection();
}
Remote_View->setFocus();
TabWidget->setCurrentPage(0);
populateLocalView();
// QCopEnvelope ( "QPE/System", "notBusy()" );
}
bool OpieFtp::remoteDirList(const QString &dir)
{
QString tmp = QDir::homeDirPath();
if(tmp.right(1) != "/")
tmp+="/._temp";
else
tmp+="._temp";
-// qDebug("Listing remote dir "+tmp);
+// odebug << "Listing remote dir "+tmp << oendl;
// QCopEnvelope ( "QPE/System", "busy()" );
if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
QString msg;
msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
return false;
}
populateRemoteView() ;
// QCopEnvelope ( "QPE/System", "notBusy()" );
return true;
}
bool OpieFtp::remoteChDir(const QString &dir)
{
// QCopEnvelope ( "QPE/System", "busy()" );
if (!FtpChdir( dir.latin1(), conn )) {
QString msg;
msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
-// qDebug(msg);
+// odebug << msg << oendl;
// QCopEnvelope ( "QPE/System", "notBusy()" );
return FALSE;
}
// QCopEnvelope ( "QPE/System", "notBusy()" );
return TRUE;
}
void OpieFtp::populateLocalView()
{
Local_View->clear();
currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
currentDir.setMatchAllDirs(TRUE);
currentDir.setNameFilter(filterStr);
QString fileL, fileS, fileDate;
bool isDir=FALSE;
const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
QFileInfoListIterator it(*list);
QFileInfo *fi;
while ( (fi=it.current()) ) {
if (fi->isSymLink() ){
QString symLink=fi->readLink();
- qDebug("Symlink detected "+symLink);
+ odebug << "Symlink detected "+symLink << oendl;
QFileInfo sym( symLink);
fileS.sprintf( "%10i", sym.size() );
fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
fileDate = sym.lastModified().toString();
} else {
- qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
+ odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl;
fileS.sprintf( "%10i", fi->size() );
fileL.sprintf( "%s",fi->fileName().data() );
fileDate= fi->lastModified().toString();
if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
fileL+="/";
isDir=TRUE;
- qDebug( fileL);
+ odebug << fileL << oendl;
}
}
if(fileL !="./" && fi->exists()) {
item = new QListViewItem( Local_View,fileL, fileDate, fileS );
QPixmap pm;
if(isDir || fileL.find("/",0,TRUE) != -1) {
if( !QDir( fi->filePath() ).isReadable())
pm = Resource::loadPixmap( "lockedfolder" );
else
pm= Resource::loadPixmap( "folder" );
item->setPixmap( 0,pm );
} else {
if( !fi->isReadable() )
pm = Resource::loadPixmap( "locked" );
else {
MimeType mt(fi->filePath());
pm=mt.pixmap(); //sets the correct pixmap for mimetype
if(pm.isNull())
pm = unknownXpm;
}
}
if( fileL.find("->",0,TRUE) != -1) {
// overlay link image
pm= Resource::loadPixmap( "folder" );
QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
QPainter painter( &pm );
painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
pm.setMask( pm.createHeuristicMask( FALSE ) );
}
item->setPixmap( 0,pm);
}
isDir=FALSE;
++it;
}
Local_View->setSorting( 3,FALSE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
fillCombo( (const QString &)currentDir);
}
bool OpieFtp::populateRemoteView( )
{
-// qDebug("populate remoteview");
+// odebug << "populate remoteview" << oendl;
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
Remote_View->clear();
QString s, File_Name;
QListViewItem *itemDir=NULL, *itemFile=NULL;
QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] ");
QString fileL, fileS, fileDate;
if ( file.open(IO_ReadOnly)) {
QTextStream t( &file ); // use a text stream
while ( !t.eof()) {
s = t.readLine();
if(s.find("total",0,TRUE) == 0)
continue;
int len, month = monthRe.match(s, 0, &len);
fileDate = s.mid(month + 1, len - 2); // minus spaces
fileL = s.right(s.length() - month - len);
if(s.left(1) == "d")
fileL = fileL+"/";
fileS = s.mid(month - 8, 8); // FIXME
fileS = fileS.stripWhiteSpace();
if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
item->setPixmap( 0, Resource::loadPixmap( "folder" ));
// if(itemDir)
item->moveItem(itemDir);
itemDir=item;
} else {
QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
// if(itemFile)
item->moveItem(itemDir);
item->moveItem(itemFile);
itemFile=item;
}
}
QListViewItem * item1 = new QListViewItem( Remote_View, "../");
item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
file.close();
if( file.exists())
file. remove();
} else
- qDebug("temp file not opened successfully "+sfile);
+ odebug << "temp file not opened successfully "+sfile << oendl;
Remote_View->setSorting( 4,TRUE);
return true;
}
void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
{
if( selectedItem) {
// if(selectedItem!= NULL) {
// QCopEnvelope ( "QPE/System", "busy()" );
QString oldRemoteCurrentDir = currentRemoteDir;
QString strItem=selectedItem->text(0);
strItem=strItem.simplifyWhiteSpace();
if(strItem == "../") { // the user wants to go ^
if( FtpCDUp( conn) == 0) {
QString msg;
msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
-// qDebug(msg);
+// odebug << msg << oendl;
}
char path[256];
if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
QString msg;
msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
-// qDebug(msg);
+// odebug << msg << oendl;
}
currentRemoteDir=path;
} else {
if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
strItem = strItem.stripWhiteSpace();
currentRemoteDir = strItem;
if( !remoteChDir( (const QString &)strItem)) {
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
-// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
+// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl;
}
} else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
-// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
+// odebug << "RemoteCurrentDir1 "+oldRemoteCurrentDir << oendl;
} else {
currentRemoteDir = currentRemoteDir+strItem;
}
} else {
// QCopEnvelope ( "QPE/System", "notBusy()" );
return;
}
}
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
if(currentRemoteDir.right(1) !="/")
currentRemoteDir +="/";
currentPathCombo->lineEdit()->setText( currentRemoteDir);
fillRemoteCombo( (const QString &)currentRemoteDir);
// QCopEnvelope ( "QPE/System", "notBusy()" );
Remote_View->ensureItemVisible(Remote_View->firstChild());
}
}
void OpieFtp::localListClicked(QListViewItem *selectedItem)
{
if(selectedItem!= NULL) {
@@ -845,49 +848,49 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem)
// is symlink
QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
if(QDir(strItem2).exists() ) {
currentDir.cd(strItem2, TRUE);
populateLocalView();
}
} else { // not a symlink
if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
currentDir.cd(strItem,FALSE);
populateLocalView();
} else {
currentDir.cdUp();
populateLocalView();
}
if(QDir(strItem).exists()){
currentDir.cd(strItem, TRUE);
populateLocalView();
}
} else {
strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
if( QFile::exists(strItem ) ) {
- // qDebug("upload "+strItem);
+ // odebug << "upload "+strItem << oendl;
return;
}
} //end not symlink
chdir(strItem.latin1());
}
Local_View->ensureItemVisible(Local_View->firstChild());
}
}
void OpieFtp::doLocalCd()
{
localListClicked( Local_View->currentItem());
}
void OpieFtp:: doRemoteCd()
{
remoteListClicked( Remote_View->currentItem());
}
void OpieFtp::showHidden()
{
if (!b) {
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
@@ -1149,270 +1152,270 @@ void OpieFtp::fillCombo(const QString &currentPath) {
localDirPathStringList.prepend(currentPath );
currentPathCombo->insertStringList( localDirPathStringList,-1);
}
currentPathCombo->lineEdit()->setText(currentPath);
if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
currentPathCombo->clear();
remoteDirPathStringList.prepend(currentPath );
currentPathCombo->insertStringList( remoteDirPathStringList,-1);
}
}
void OpieFtp::fillRemoteCombo(const QString &currentPath) {
currentPathCombo->lineEdit()->setText(currentPath);
if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
currentPathCombo->clear();
remoteDirPathStringList.prepend(currentPath );
currentPathCombo->insertStringList( remoteDirPathStringList,-1);
}
}
void OpieFtp::currentPathComboChanged()
{
QString oldRemoteCurrentDir = currentRemoteDir;
-// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
+// odebug << "oldRemoteCurrentDir "+oldRemoteCurrentDir << oendl;
if (TabWidget->currentPageIndex() == 0) {
if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
currentDir.setPath( currentPathCombo->lineEdit()->text() );
populateLocalView();
} else {
QMessageBox::message(tr("Note"),tr("That directory does not exist"));
}
}
if (TabWidget->currentPageIndex() == 1) {
currentRemoteDir = currentPathCombo->lineEdit()->text();
if(currentRemoteDir.right(1) !="/") {
currentRemoteDir = currentRemoteDir +"/";
currentPathCombo->lineEdit()->setText( currentRemoteDir );
}
if( !remoteChDir( (const QString &)currentRemoteDir) ) {
currentRemoteDir = oldRemoteCurrentDir;
currentPathCombo->lineEdit()->setText( currentRemoteDir );
}
remoteDirList( (const QString &)currentRemoteDir);
}
}
void OpieFtp::switchToLocalTab()
{
TabWidget->setCurrentPage(0);
}
void OpieFtp::switchToRemoteTab()
{
TabWidget->setCurrentPage(1);
}
void OpieFtp::switchToConfigTab()
{
TabWidget->setCurrentPage(2);
}
void OpieFtp::readConfig()
{
fillCombos();
Config cfg("opieftp");
cfg.setGroup("Server");
currentServerConfig = cfg.readNumEntry("currentServer", -1);
-// qDebug("Reading %d", currentServerConfig);
+// odebug << "Reading " << currentServerConfig << "" << oendl;
serverComboSelected( currentServerConfig-1);
}
void OpieFtp::writeConfig()
{
- qDebug("write config");
+ odebug << "write config" << oendl;
Config cfg("opieftp");
cfg.setGroup("Server");
QString username, remoteServerStr, remotePathStr, password, port, temp;
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
if( currentServerConfig == -1) {
for (int i = 1; i <= numberOfEntries; i++) {
temp.setNum(i);
cfg.setGroup("Server");
QString tempStr = cfg.readEntry( temp,"");
}
temp.setNum( numberOfEntries + 1);
cfg.setGroup("Server");
remoteServerStr = cfg.readEntry( temp,"");
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
temp.setNum(numberOfEntries+1);
cfg.setGroup("Server");
cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
cfg.writeEntry("currentServer", numberOfEntries+1);
currentServerConfig = numberOfEntries+1;
- qDebug("setting currentserverconfig to %d", currentServerConfig);
+ odebug << "setting currentserverconfig to " << currentServerConfig << "" << oendl;
cfg.setGroup(temp);
if(!newServerName.isEmpty())
cfg.writeEntry("ServerName", newServerName);
cfg.writeEntry("RemotePath", remotePath->text());
cfg.writeEntry("Username", UsernameComboBox->currentText());
cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
cfg.setGroup("Server");
cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
}
}
void OpieFtp::clearCombos() {
- qDebug("clearing");
+ odebug << "clearing" << oendl;
ServerComboBox->clear();
UsernameComboBox->clear();
PasswordEdit->clear();
serverListView->clear();
}
void OpieFtp::fillCombos()
{
clearCombos();
Config cfg("opieftp");
cfg.setGroup("Server");
QString username, remoteServerStr, remotePathStr, password, port, temp;
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
for (int i = 1; i <= numberOfEntries; i++) {
temp.setNum(i);
- qDebug(temp);
+ odebug << temp << oendl;
cfg.setGroup("Server");
remoteServerStr = cfg.readEntry( temp,"");
- qDebug( remoteServerStr);
+ odebug << remoteServerStr << oendl;
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
port = remoteServerStr.right( divider - 1);
bool ok;
PortSpinBox->setValue( port.toInt(&ok,10));
remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
- qDebug( "remote server string "+remoteServerStr);
+ odebug << "remote server string "+remoteServerStr << oendl;
ServerComboBox->insertItem( remoteServerStr );
cfg.setGroup(temp);
username = cfg.readEntry(temp);
UsernameComboBox->insertItem(username);
password = cfg.readEntryCrypt(username,"");
PasswordEdit->setText(password);
serverListView->insertItem( cfg.readEntry("ServerName"));
}
}
void OpieFtp::serverComboSelected(int index)
{
currentServerConfig = index+1;
- qDebug("server combo selected %d", index+1);
+ odebug << "server combo selected " << index+1 << "" << oendl;
QString username, remoteServerStr, remotePathStr, password, port, temp;
// remoteServerStr = ServerComboBox->text(index);
Config cfg("opieftp");
cfg.setGroup("Server");
// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
temp.setNum(index+1);
remoteServerStr = cfg.readEntry( temp,"");
- qDebug("Group" +temp);
+ odebug << "Group" +temp << oendl;
cfg.setGroup(temp);
-// qDebug(temp);
+// odebug << temp << oendl;
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
port = remoteServerStr.right( divider - 1);
bool ok;
int portInt = port.toInt(&ok,10);
if( portInt == 0) portInt = 21;
ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
PortSpinBox->setValue( portInt);
remotePath->setText(cfg.readEntry("RemotePath", "/"));
username = cfg.readEntry("Username", "anonymous");
UsernameComboBox->lineEdit()->setText(username);
- qDebug(username);
-// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org"));
+ odebug << username << oendl;
+// odebug << "Password is "+cfg.readEntryCrypt(username << oendl;
PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
// UsernameComboBox
// PasswordEdit
cfg.setGroup("Server");
temp.sprintf("%d",currentServerConfig);
cfg.writeEntry("currentServer", temp);
fuckeduphack = TRUE;
serverListView->setCurrentItem( index);
fuckeduphack=FALSE;
- qDebug("server list set selected %d",index);
+ odebug << "server list set selected " << index << "" << oendl;
update();
}
void OpieFtp::deleteServer()
{
QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
remoteServerStr = ServerComboBox->currentText( );
username = UsernameComboBox->currentText();
servername=serverListView->currentText();
Config cfg("opieftp");
cfg.setGroup("Server");
QString tempname;
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
for (int i = 1; i <= numberOfEntries; i++) {
temp.setNum(i);
// cfg.setGroup("Server");
cfg.setGroup(QString::number(i));
tempname=cfg.readEntry( "ServerName","");
if( tempname.find( servername,0,TRUE) != -1 ) {
// servername.find( cfg.readEntry("ServerName")) != -1 &&
// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 &&
// username.find( cfg.readEntry("Username")) != -1) {
serverListView->removeItem(i);
- qDebug("OK DELETE "+tempname);
+ odebug << "OK DELETE "+tempname << oendl;
cfg.removeEntry(QString::number(i));
for ( ; i <= numberOfEntries; i++) {
cfg.setGroup("Server");
cfg.writeEntry("Server", QString::number(numberOfEntries + 1 ));
cfg.setGroup(QString::number(i+1)); //get next server config
servername=cfg.readEntry("ServerName");
remoteServerStr=cfg.readEntry("RemotePath");
username=cfg.readEntry("Username");
password=cfg.readEntryCrypt( username);
cfg.setGroup(QString::number(i));
cfg.writeEntry("RemotePath", remoteServerStr);
cfg.writeEntry("ServerName", servername);
cfg.writeEntry("Username", username);
cfg.writeEntryCrypt( username, password);
}
cfg.setGroup("Server");
cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries - 1 ));
}
}
cfg.setGroup(QString::number(numberOfEntries));
@@ -1425,57 +1428,57 @@ void OpieFtp::deleteServer()
currentServerConfig=currentServerConfig-1;
fillCombos();
update();
}
void OpieFtp::upDir()
{
if (TabWidget->currentPageIndex() == 0) {
QString current = currentDir.canonicalPath();
QDir dir(current);
dir.cdUp();
current = dir.canonicalPath();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateLocalView();
update();
} else {
if( FtpCDUp( conn) == 0) {
QString msg;
msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
-// qDebug(msg);
+// odebug << msg << oendl;
}
char path[256];
if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
QString msg;
msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
-// qDebug(msg);
+// odebug << msg << oendl;
}
currentRemoteDir=path;
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
if(currentRemoteDir.right(1) !="/")
currentRemoteDir +="/";
currentPathCombo->lineEdit()->setText( currentRemoteDir);
fillRemoteCombo( (const QString &)currentRemoteDir);
}
}
void OpieFtp::docButtonPushed() {
QString current = QPEApplication::documentDir();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
populateLocalView();
update();
}
void OpieFtp::homeButtonPushed() {
QString current = QDir::homeDirPath();
chdir( current.latin1() );
currentDir.cd( current, TRUE);
@@ -1494,36 +1497,36 @@ void OpieFtp::doAbout() {
void OpieFtp::NewServer() {
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0);
fileDlg->exec();
Config cfg("opieftp");
if( fileDlg->result() == 1 ) {
newServerName = fileDlg->LineEdit1->text();
for(int i=1;i<serverListView->count();i++) {
cfg.setGroup( QString::number(i));
if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) {
QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken"));
return;
}
}
currentServerConfig =-1;
writeConfig();
serverListView->insertItem( newServerName );
serverListView->setCurrentItem( serverListView->count());
}
}
void OpieFtp::serverListClicked( const QString &item) {
if(item.isEmpty()) return;
Config cfg("opieftp");
- qDebug("highltined "+item);
+ odebug << "highltined "+item << oendl;
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
for (int i = 1; i <= numberOfEntries; i++) {
cfg.setGroup(QString::number(i));
if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack)
serverComboSelected(i-1);
}
}
void OpieFtp::timerOut() {
}
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 @@
-#CONFIG += qt warn_on quick-app
-CONFIG += qt warn_on
-HEADERS = opieftp.h inputDialog.h
-SOURCES = opieftp.cpp inputDialog.cpp main.cpp
-TARGET = opieftp
+CONFIG += qt warn_on
+HEADERS = opieftp.h inputDialog.h
+SOURCES = opieftp.cpp inputDialog.cpp main.cpp
+TARGET = opieftp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lftplib
+LIBS += -lqpe -lopiecore2 -lftplib
DESTDIR = $(OPIEDIR)/bin
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 @@
config OPIEIRC
boolean "opie-irc (chat via your favorite IRC server)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LIBQTAUX
+ 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,27 +1,30 @@
-#include <stdio.h>
#include "ircmisc.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
IRCTabBar::IRCTabBar(QWidget *parent, const char *name) : QTabBar(parent, name) {
}
int IRCTabBar::insertTab(QTab *tab, int index) {
/* FIXME: find some nicer way to do this */
QExtTab *ext = new QExtTab();
ext->color = black;
ext->label = tab->text();
ext->r = tab->rect();
ext->enabled = tab->isEnabled();
ext->iconset = tab->iconSet();
delete tab;
return QTabBar::insertTab(ext, index);
}
void IRCTabBar::setTabColor(int index, QColor color) {
((QExtTab *)tab(index))->color = color;
update();
}
void IRCTabBar::paintLabel(QPainter* p, const QRect& br, QTab* t, bool focus) const {
QRect r = br;
QTabBar::paintLabel(p, br, t, focus);
if (t->id == currentTab())
@@ -43,41 +46,41 @@ IRCHistoryLineEdit::IRCHistoryLineEdit(QWidget *parent, const char *name) : QLin
m_index = -1;
installEventFilter(this);
}
void IRCHistoryLineEdit::keyPressEvent(QKeyEvent *event) {
int key = event->key();
if (key == Key_Up) {
if (m_history.count() > 0 && m_index < (signed int)m_history.count()-1) {
m_index++;
setText(m_history[m_index]);
}
} else if (key == Key_Down) {
if (m_history.count() > 0 && m_index > 0) {
m_index--;
setText(m_history[m_index]);
}
if (m_index == 0) {
m_index = -1;
setText("");
}
} else if (key == Key_Return) {
m_history.prepend(text());
m_index = -1;
} else if (key == Key_Tab) {
- printf("got tab\n");
+ odebug << "got tab" << oendl;
return;
}
QLineEdit::keyPressEvent(event);
}
bool IRCHistoryLineEdit::eventFilter(QObject *object, QEvent *event) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *k = (QKeyEvent *) event;
/* Catch tab characters */
if (k->key() == Key_Tab) {
- qDebug("tab!");
+ odebug << "tab!" << oendl;
return TRUE;
}
}
return QLineEdit::eventFilter(object, event);
}
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
@@ -1,25 +1,24 @@
-CONFIG = qt warn_on quick-app
-HEADERS = ircchannel.h ircconnection.h \
+CONFIG = qt warn_on quick-app
+HEADERS = ircchannel.h ircconnection.h \
ircmessage.h \
ircmessageparser.h ircoutput.h \
ircperson.h ircserver.h ircsession.h \
mainwindow.h irctab.h ircservertab.h \
ircchanneltab.h ircchannellist.h \
ircserverlist.h ircservereditor.h \
ircquerytab.h ircsettings.h ircmisc.h
-SOURCES = ircchannel.cpp ircconnection.cpp \
+SOURCES = ircchannel.cpp ircconnection.cpp \
ircmessage.cpp \
ircmessageparser.cpp ircoutput.cpp \
ircperson.cpp ircserver.cpp \
ircsession.cpp main.cpp mainwindow.cpp \
irctab.cpp ircservertab.cpp \
ircchanneltab.cpp ircchannellist.cpp \
ircserverlist.cpp ircservereditor.cpp \
ircquerytab.cpp ircsettings.cpp ircmisc.cpp
INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopieui2 -lqtaux2
-
-TARGET = opieirc
+DEPENDPATH += $(OPIEDIR)/include
+LIBS += -lqpe -lopiecore2 -lopieui2 -lqtaux2
+TARGET = opieirc
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
@@ -185,37 +185,37 @@ namespace OpieTooth {
}
/**
* Refresh timer
* @param the timer event
*/
void BluezApplet::timerEvent( QTimerEvent * ) {
bool oldactive = bluezactive;
int olddiscovery = bluezDiscoveryActive;
bluezactive = checkBluezStatus();
bluezDiscoveryActive = checkBluezDiscoveryStatus();
if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) {
update();
}
}
/**
* Implementation of the paint event
* @param the QPaintEvent
*/
void BluezApplet::paintEvent( QPaintEvent* ) {
QPainter p(this);
- qDebug("paint bluetooth pixmap");
+ odebug << "paint bluetooth pixmap" << oendl;
if (bluezactive > 0) {
p.drawPixmap( 0, 1, bluezOnPixmap );
} else {
p.drawPixmap( 0, 1, bluezOffPixmap );
}
if (bluezDiscoveryActive > 0) {
p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap );
}
}
};
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
@@ -24,45 +24,45 @@ void StartDunConnection::setName( QString name ) {
m_name = name;
}
QString StartDunConnection::name() {
return m_name;
}
void StartDunConnection::setConnectionType() {
m_connectionType = Pan;
}
StartConnection::ConnectionType StartDunConnection::type() {
return m_connectionType;
}
void StartDunConnection::start() {
m_dunConnect = new OProcess();
*m_dunConnect << "dund" << "--listen" << "--connect" << m_mac;
connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
this, SLOT( slotExited(Opie::Core::OProcess*) ) );
connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
- qWarning( "could not start" );
+ owarn << "could not start" << oendl;
delete m_dunConnect;
}
}
void StartDunConnection::slotExited( OProcess* proc ) {
delete m_dunConnect;
}
void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len)
{}
void StartDunConnection::stop() {
if ( m_dunConnect ) {
delete m_dunConnect;
m_dunConnect = 0l;
}
}
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
@@ -18,67 +18,67 @@ StartPanConnection::~StartPanConnection() {
StartPanConnection::StartPanConnection( QString mac ) {
m_panConnect = 0l;
m_mac = mac;
setConnectionType();
}
void StartPanConnection::setName( QString name ) {
m_name = name;
}
QString StartPanConnection::name() {
return m_name;
}
void StartPanConnection::setConnectionType() {
m_connectionType = Pan;
}
StartConnection::ConnectionType StartPanConnection::type() {
return m_connectionType;
}
void StartPanConnection::start() {
m_panConnect = new OProcess();
- qDebug( "IM START " + m_mac );
+ odebug << "IM START " + m_mac << oendl;
*m_panConnect << "pand" << "--connect" << m_mac;
connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
this, SLOT( slotExited(Opie::Core::OProcess*) ) );
connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
- qWarning( "could not start" );
+ owarn << "could not start" << oendl;
delete m_panConnect;
}
}
void StartPanConnection::slotExited( OProcess* proc ) {
delete m_panConnect;
m_panConnect = 0l;
}
void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len)
{}
void StartPanConnection::stop() {
if ( m_panConnect ) {
delete m_panConnect;
m_panConnect = 0l;
}
m_panConnect = new OProcess();
- qDebug("IM STOP " + m_mac);
+ odebug << "IM STOP " + m_mac << oendl;
*m_panConnect << "pand" << "--kill" << m_mac;
connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
this, SLOT( slotExited(Opie::Core::OProcess*) ) );
connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
- qWarning( "could not stop" );
+ owarn << "could not stop" << oendl;
delete m_panConnect;
}
}
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
@@ -134,49 +134,49 @@ void BlueBase::readConfig()
/**
* Writes all options to the config file
*/
void BlueBase::writeConfig()
{
Config cfg( "bluetoothmanager" );
cfg.setGroup( "bluezsettings" );
cfg.writeEntry( "name" , m_deviceName );
cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
cfg.writeEntry( "useEncryption" , m_useEncryption );
cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
cfg.writeEntry( "enablePagescan" , m_enablePagescan );
cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
writeToHciConfig();
}
/**
* Modify the hcid.conf file to our needs
*/
void BlueBase::writeToHciConfig()
{
- qWarning("writeToHciConfig");
+ owarn << "writeToHciConfig" << oendl;
HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
hciconf.load();
hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" );
hciconf.setName( m_deviceName );
hciconf.setEncrypt( m_useEncryption );
hciconf.setAuth( m_enableAuthentification );
hciconf.setPscan( m_enablePagescan );
hciconf.setIscan( m_enableInquiryscan );
hciconf.save();
}
/**
* Read the list of allready known devices
*/
void BlueBase::readSavedDevices()
{
QValueList<RemoteDevice> loadedDevices;
DeviceHandler handler;
loadedDevices = handler.load();
addSearchedDevices( loadedDevices );
}
@@ -346,105 +346,105 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
}
delete groups;
}
/*
* We got service sensitive PopupMenus in our factory
* We will create one through the factory and will insert
* our Separator + ShowInfo into the menu or create a new
* one if the factory returns 0
* PopupMenu deletion is kind of weird.
* If escaped( -1 ) or any of our items were chosen we'll
* delete the PopupMenu otherwise it's the responsibility of
* the PopupMenu to delete itself
*
*/
else if ( ((BTListItem*)item)->type() == "service")
{
BTServiceItem* service = (BTServiceItem*)item;
QMap<int, QString> list = service->services().classIdList();
QMap<int, QString>::Iterator it = list.begin();
QPopupMenu *popup =0l;
if ( it != list.end() )
{
- qWarning("Searching id %d %s", it.key(), it.data().latin1() );
+ owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl;
popup = m_popHelper.find( it.key(),
service->services(),
(BTDeviceItem*)service->parent() );
}
else
{
- qWarning("Empty");
+ owarn << "Empty" << oendl;
}
if ( popup == 0l )
{
- qWarning("factory returned 0l");
+ owarn << "factory returned 0l" << oendl;
popup = new QPopupMenu();
}
int test1 = popup->insertItem( tr("Test1:"), 2);
ret = popup->exec( point );
- qWarning("returned from exec() ");
+ owarn << "returned from exec() " << oendl;
if ( ret == -1 )
{
;
}
else if ( ret == test1 )
{
;
}
delete popup;
}
delete menu;
}
/**
* Search and display avail. services for a device (on expand from device listing)
* @param item the service item returned
*/
void BlueBase::addServicesToDevice( BTDeviceItem * item )
{
- qDebug("addServicesToDevice");
+ odebug << "addServicesToDevice" << oendl;
// row of mac adress text(3)
RemoteDevice device = item->remoteDevice();
m_deviceList.insert( item->mac() , item );
// and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
m_localDevice->searchServices( device );
}
/**
* Overloaded. This one it the one that is
ted to the foundServices signal
* @param device the mac address of the remote device
* @param servicesList the list with the service the device has.
*/
void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList )
{
- qDebug("fill services list");
+ odebug << "fill services list" << oendl;
QMap<QString,BTDeviceItem*>::Iterator it;
BTDeviceItem* deviceItem = 0;
// get the right devices which requested the search
it = m_deviceList.find( device );
if( it == m_deviceList.end() )
return;
deviceItem = it.data();
// remove previous entries
QList<QListViewItem> tempList;
tempList.setAutoDelete( true );
QListViewItem * child = deviceItem->firstChild();
while( child )
{
tempList.append( child );
child = child->nextSibling();
}
tempList.clear();
QValueList<OpieTooth::Services>::Iterator it2;
BTServiceItem* serviceItem;
@@ -586,49 +586,49 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
// recall connection search after some time
QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
}
/**
* Find out if a device can currently be reached
* @param device
*/
void BlueBase::deviceActive( const RemoteDevice &device )
{
// search by mac, async, gets a signal back
// We should have a BTDeviceItem there or where does it get added to the map -zecke
m_localDevice->isAvailable( device.mac() );
}
/**
* The signal catcher. Set the avail. status on device.
* @param device - the mac address
* @param connected - if it is avail. or not
*/
void BlueBase::deviceActive( const QString& device, bool connected )
{
- qDebug("deviceActive slot");
+ odebug << "deviceActive slot" << oendl;
QMap<QString,BTDeviceItem*>::Iterator it;
it = m_deviceList.find( device );
if( it == m_deviceList.end() )
return;
BTDeviceItem* deviceItem = it.data();
if ( connected )
{
deviceItem->setPixmap( 1, m_onPix );
}
else
{
deviceItem->setPixmap( 1, m_offPix );
}
m_deviceList.remove( it );
}
/**
* Open the "scan for devices" dialog
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
@@ -12,76 +12,76 @@ DeviceHandler::DeviceHandler() {
};
DeviceHandler::~DeviceHandler() {
}
RemoteDevice::ValueList DeviceHandler::load() {
RemoteDevice::ValueList list;
QString path = QDir::homeDirPath() + "/Settings/bluetooth";
QDir deviceListSave( path);
// list of .conf files
QStringList devicesFileList = deviceListSave.entryList();
// cut .conf of to get the mac and also read the name entry in it.
if (!devicesFileList.isEmpty() ) {
QString name;
QString mac;
QStringList::Iterator it;
for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) {
if ( (*it) == "." || (*it) == ".." )
continue;
- qDebug((*it).latin1() );
+ odebug << (*it).latin1() << oendl;
Config conf(path + "/"+(*it), Config::File);
conf.setGroup("Info");
name = conf.readEntry("name", "Error");
mac = conf.readEntry("mac", QString::null);
- qDebug("MAC: " + mac);
- qDebug("NAME: " + name);
+ odebug << "MAC: " + mac << oendl;
+ odebug << "NAME: " + name << oendl;
if (mac.isEmpty() )
continue;
RemoteDevice currentDevice( mac , name );
list.append( currentDevice );
}
}
return list;
};
/*
* This is some how rude but make sure all old devices
* are getting deleted
*/
void DeviceHandler::save( const RemoteDevice::ValueList& list) {
QCString rm;
rm += "rm -rf ";
rm += QDir::homeDirPath() + "/Settings/bluetooth";
system ( rm.data() );
if (list.isEmpty() ) // no need to create the dir
return;
/**
* Create a new dir
*/
rm = "mkdir ";
rm += QDir::homeDirPath() + "/Settings/bluetooth";
- qWarning("out %s", rm.data() );
+ owarn << "out " << rm.data() << "" << oendl;
system( rm.data() );
RemoteDevice::ValueList::ConstIterator it;
// write the config
for ( it = list.begin(); it != list.end(); ++it ) {
- qDebug( "/Settings/bluetooth/" + (*it).mac() + ".conf");
+ odebug << "/Settings/bluetooth/" + (*it).mac() + ".conf" << oendl;
Config conf( QDir::homeDirPath() +
"/Settings/bluetooth/" +
(*it).mac() + ".conf", Config::File );
conf.setGroup( "Info" );
conf.writeEntry( "name", (*it).name() );
conf.writeEntry( "mac", (*it).mac() );
}
}
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
@@ -1,38 +1,38 @@
#include <qpe/qcopenvelope_qws.h>
#include <qtimer.h>
#include "dunpopup.h"
using namespace OpieTooth;
/*
* c'tor init the QAction
*/
DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
- qWarning("DunPopup c'tor");
+ owarn << "DunPopup c'tor" << oendl;
m_item = item;
QAction *a, *b, *c;
m_dunconnection = 0l;
/* connect action */
a = new QAction(); // so it's get deleted
a->setText( tr("connect") );
a->addTo( this );
connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
b = new QAction();
b->setText( tr( "connect+conf" ) );
b->addTo( this );
connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
c = new QAction();
c->setText( tr( "disconnect" ) );
c->addTo( this );
connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
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
@@ -53,87 +53,87 @@ namespace OpieTooth {
}
void HciConfWrapper::setEncrypt( bool enable) {
if ( enable ) {
setValue( "encrypt" , "enable" );
} else {
setValue( "encrypt" , "disable" );
}
}
void HciConfWrapper::setValue(const QString &key, const QString &value ) {
if (m_file.isEmpty() ) // load first
return;
QStringList::Iterator it;
QString str;
for (it = m_file.begin(); it != m_file.end(); ++it ) {
str = (*it);
if( (str.contains(key)) > 0 ) {
- qDebug("Found");
+ odebug << "Found" << oendl;
// still need to look if its commented out!!!
str.simplifyWhiteSpace();
- qDebug( key );
+ odebug << key << oendl;
if (str.startsWith("#")) {
str = (key + " " + value + ";");
} else {
str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";");
}
- qDebug( str );
+ odebug << str << oendl;
it = m_file.remove( it );
it = m_file.insert( it, str );
//return; the regexp is too wide -zecke // all set
}
}
}
/**
* This loads the config file and stores it inside
* the m_file
*/
void HciConfWrapper::load() {
- qWarning("loaded");
+ owarn << "loaded" << oendl;
m_file.clear();
QFile file( m_fileName );
if (!file.open( IO_ReadOnly ) ) {
- qDebug("Could not open");
+ odebug << "Could not open" << oendl;
return;
}
/**
* readAll() into a QByteArray
* QStringList::split('\n', array )
* would this be faster? -zecke
*/
QTextStream stream(&file );
QString tmp;
while ( !stream.atEnd() ) {
tmp = stream.readLine();
m_file.append( tmp );
}
}
void HciConfWrapper::save() {
- qWarning("save");
+ owarn << "save" << oendl;
if (m_file.isEmpty() ) // load first
return;
QFile file( m_fileName );
if ( !file.open(IO_WriteOnly ) ) {
- qWarning("could not open %s", m_fileName.latin1() );
+ owarn << "could not open " << m_fileName.latin1() << "" << oendl;
return;
}
QTextStream stream(&file );
QStringList::Iterator it;
for ( it = m_file.begin(); it != m_file.end(); ++it ) {
stream << (*it) << endl;
}
- qWarning("saved");
+ owarn << "saved" << oendl;
};
}
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
@@ -59,31 +59,31 @@ void ObexDialog::browse() {
MimeTypes types;
QStringList all;
all << "*/*";
types.insert("All Files", all );
QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
cmdLine->setText( str );
}
void ObexDialog::sendData() {
QString fileURL = cmdLine->text();
QString file = QFileInfo( fileURL ).fileName();
QString modifiedName = chNameLine->text();
// vom popupmenu beziehen
OProcess* obexSend = new OProcess();
if ( !modifiedName.isEmpty() ) {
*obexSend << "ussp-push" << m_device << fileURL << modifiedName;
} else {
*obexSend << "ussp-push" << m_device << fileURL << file;
}
if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) {
- qWarning("could not start");
+ owarn << "could not start" << oendl;
delete obexSend;
}
}
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
@@ -1,45 +1,45 @@
#include "obexdialog.h"
#include "obexpopup.h"
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qtimer.h>
using namespace OpieTooth;
/*
* c'tor init the QAction
*/
ObexPopup::ObexPopup()
: QPopupMenu()
{
- qWarning("RfcCommPopup c'tor");
+ owarn << "RfcCommPopup c'tor" << oendl;
QAction* a;
/* connect action */
a = new QAction( ); // so it's get deleted
a->setText("Push file");
a->addTo( this );
connect( a, SIGNAL( activated() ),
this, SLOT( slotPush() ) );
};
ObexPopup::~ObexPopup()
{}
void ObexPopup::slotPush()
{
- qWarning("push something");
+ owarn << "push something" << oendl;
ObexDialog obexDialog;
QPEApplication::execDialog( &obexDialog );
}
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
@@ -1,38 +1,38 @@
#include <qpe/qcopenvelope_qws.h>
#include <qtimer.h>
#include "panpopup.h"
using namespace OpieTooth;
/*
* c'tor init the QAction
*/
PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
- qWarning("PanPopup c'tor");
+ owarn << "PanPopup c'tor" << oendl;
m_item = item;
QAction *a, *b, *c;
m_panconnection = 0l;
/* connect action */
a = new QAction(); // so it's get deleted
a->setText( tr("connect") );
a->addTo( this );
connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
b = new QAction();
b->setText( tr( "connect+conf" ) );
b->addTo( this );
connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
c = new QAction();
c->setText( tr( "disconnect" ) );
c->addTo( this );
connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
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
@@ -1,36 +1,36 @@
#include "stdpopups.h"
#include "popuphelper.h"
using namespace OpieTooth;
PopupHelper::PopupHelper() {
init();
}
PopupHelper::~PopupHelper() {
}
void PopupHelper::insert( int id, popupFactory fact ) {
m_map.insert(id, fact );
}
QPopupMenu* PopupHelper::find( int id, const Services& ser, BTDeviceItem* item ) {
- //qWarning("find");
+ //owarn << "find" << oendl;
FactoryMap::Iterator it = m_map.find(id );
if ( it != m_map.end() ) {
- //qWarning("found");
+ //owarn << "found" << oendl;
popupFactory fact = it.data();
return (*fact)(ser, item);
}
return 0l;
}
void PopupHelper::init() {
insert( 4355, newRfcComPopup );
insert( 4354, newDunPopup );
insert( 4353, newRfcComPopup );
insert( 4357, newObexPushPopup );
insert( 4358, newObexPushPopup );
insert( 4374, newPanPopup );
}
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
@@ -35,35 +35,35 @@ PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl,
connectButton = new QPushButton( this );
connectButton->setText( tr( "Connect" ) );
layout->addWidget(info);
layout->addWidget(cmdLine);
layout->addWidget(outPut);
layout->addWidget(connectButton);
connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
}
PPPDialog::~PPPDialog() {
}
void PPPDialog::connectToDevice() {
outPut->clear();
// vom popupmenu beziehen
QString connectScript = "/etc/ppp/peers/" + cmdLine->text();
OProcess* pppDial = new OProcess();
*pppDial << "pppd" << m_device << "call" << connectScript;
connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ),
this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) );
if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) {
- qWarning("could not start");
+ owarn << "could not start" << oendl;
delete pppDial;
}
}
void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) {
QCString str(cha, len );
outPut->insertLine( str );
delete pppDial;
}
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
@@ -50,70 +50,70 @@ void RfcommAssignDialog::newDevice( const QString & mac )
{
for ( int i = 0 ; i < m_range; i++ )
{
QMap<QString, RfCommConfObject*>::Iterator it;
it = confHandler->foundEntries().find( QString("%1").arg( i ) );
// make sure that rfcommX is not assigned yet
if ( it == confHandler->foundEntries().end() )
{
QDialog dialog( this, "newdevice", true, WStyle_ContextHelp );
RfcommDialogItem *newDev = new RfcommDialogItem( &dialog );
newDev->setIdent( i );
newDev->setMac( mac );
if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted )
{
RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
m_itemList.insert( i , rfcomm );
rfcomm->setIdent( i );
rfcomm->setMac( mac );
rfcomm->setChannel( newDev->channel() );
rfcomm->setComment( newDev->comment() );
- qDebug( "New device set up" );
+ odebug << "New device set up" << oendl;
}
}
}
}
void RfcommAssignDialog::loadConfig()
{
//Config cfg( "bluetoothmanager-rfcommbind" );
for ( int i = 0 ; i < m_range; i++ )
{
// cfg.setGroup( QString("%1").arg( i ) );
RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
m_itemList.insert( i , rfcomm );
rfcomm->setIdent( i );
QMap<QString, RfCommConfObject*>::Iterator it;
it = confHandler->foundEntries().find( QString("%1").arg( i ) );
if ( it != confHandler->foundEntries().end() )
{
- qDebug( "Found key in foundEntries() " );
+ odebug << "Found key in foundEntries() " << oendl;
rfcomm->setMac( it.data()->mac() );
rfcomm->setChannel( it.data()->channel() );
rfcomm->setComment( it.data()->comment() );
}
/* Use rfcomm.conf directly for now
* rfcomm->setMac( cfg.readEntry( "mac", "" ) );
* rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) );
* rfcomm->setComment( cfg.readEntry( "comment", "" ) );
*/
}
}
void RfcommAssignDialog::saveConfig()
{
//Config cfg( "bluetoothmanager-rfcommbind" );
QMap< int, RfcommDialogItem*>::Iterator it;
QMap< QString, RfCommConfObject*> outMap;
for( it = m_itemList.begin(); it != m_itemList.end(); ++it )
{
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
@@ -71,44 +71,44 @@ void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) {
QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() {
return m_foundEntries;
}
void RfCommConfHandler::load() {
QFile rfCommConf( m_filename );
if ( rfCommConf.open( IO_ReadOnly ) ) {
QStringList list;
QTextStream inStream( &rfCommConf );
list = QStringList::split( "\n", inStream.read() );
QString number;
QString mac;
QString channel;
QString comment;
for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) {
QString tmpLine = ( *line ).stripWhiteSpace();
if ( tmpLine.startsWith("rfcomm") ) {
QString number = tmpLine.mid( 6,1 );
- qDebug( tmpLine );
- qDebug( "TEST " + number );
+ odebug << tmpLine << oendl;
+ odebug << "TEST " + number << oendl;
} else if ( tmpLine.startsWith( "}" ) ) {
m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) );
} else if ( tmpLine.startsWith( "device" ) ) {
mac = tmpLine.mid( 7, 17 );
- qDebug( "mac" + mac );
+ odebug << "mac" + mac << oendl;
} else if ( tmpLine.startsWith( "channel" ) ) {
channel = tmpLine.mid( 8, 1 );
qDebug ( "Channel :" + channel );
} else if ( tmpLine.startsWith( "comment" ) ) {
comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 );
- qDebug( "Comment: " + comment );
+ odebug << "Comment: " + comment << oendl;
}
}
rfCommConf.close();
}
save( m_foundEntries );
- qDebug( QString( "ENTries: %1").arg( m_foundEntries.count() ) );
+ odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl;
}
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
@@ -1,44 +1,44 @@
#include "pppdialog.h"
#include "rfcpopup.h"
#include "rfcommassigndialogimpl.h"
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qtimer.h>
using namespace OpieTooth;
/*
* c'tor init the QAction
*/
RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
: QPopupMenu()
{
- qWarning("RfcCommPopup c'tor");
+ owarn << "RfcCommPopup c'tor" << oendl;
QAction* a;
m_item = item;
/* connect action */
a = new QAction( ); // so it's get deleted
a->setText("Connect");
a->addTo( this );
connect( a, SIGNAL( activated() ),
this, SLOT( slotConnect() ) );
/* disconnect action */
a = new QAction( );
a->setText("Disconnect");
a->addTo( this );
connect( a, SIGNAL( activated() ) ,
this, SLOT( slotDisconnect() ) );
/* foo action */
a = new QAction( );
@@ -49,55 +49,55 @@ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item )
/* bar action */
a = new QAction( );
a->setText( "Bar" );
a->addTo( this );
connect( a, SIGNAL( activated() ),
this, SLOT( slotBar() ) );
};
RfcCommPopup::~RfcCommPopup()
{
/* delete m_con;
delete m_dis;
delete m_foo;
delete m_bar; */
}
void RfcCommPopup::slotConnect()
{
- qWarning("connect");
+ owarn << "connect" << oendl;
PPPDialog pppDialog;
QPEApplication::execDialog( &pppDialog );
}
void RfcCommPopup::slotDisconnect()
{
- qWarning("slot disconnected");
+ owarn << "slot disconnected" << oendl;
}
void RfcCommPopup::slotBind()
{
RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
rfcommAssign.newDevice( m_item->mac() );
if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
{
rfcommAssign.saveConfig();
}
}
void RfcCommPopup::slotBar()
{
- qWarning("slotBar");
+ owarn << "slotBar" << oendl;
};
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
@@ -134,28 +134,28 @@ namespace OpieTooth {
* Then it emits it, so the manager can connect to the signal to fill the listing.
*/
void ScanDialog::emitToManager() {
if (!ListView1) {
return;
}
QValueList<RemoteDevice> deviceList;
QListViewItemIterator it( ListView1 );
for ( ; it.current(); ++it ) {
if ( ( (QCheckListItem*)it.current() )->isOn() ) {
RemoteDevice device( it.current()->text(1), it.current()->text(0) );
deviceList.append( device );
}
}
emit selectedDevices( deviceList );
}
/**
* Cleanup
*/
ScanDialog::~ScanDialog() {
- qWarning("delete scan dialog");
+ owarn << "delete scan dialog" << oendl;
delete localDevice;
}
}
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
@@ -2,74 +2,70 @@
** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Wellenreiter II.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
/* LOCAL */
#include "configwindow.h"
#include "mainwindow.h"
/* OPIE */
#include <opie2/onetwork.h>
#ifdef QWS
#include <opie2/oapplication.h>
#include <opie2/oconfig.h>
#include <opie2/odevice.h>
-using namespace Opie;
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+using namespace Opie::Net;
#endif
/* QT */
#include <qapplication.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qfile.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qmap.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qtoolbutton.h>
#include <qspinbox.h>
#include <qtextstream.h>
-/* POSIX */
+/* STD */
#include <assert.h>
-using namespace Opie::Core;
-using namespace Opie::Net;
-using namespace Opie::Core;
-using namespace Opie::Net;
-using namespace Opie::Core;
-using namespace Opie::Net;
WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
:WellenreiterConfigBase( parent, name, true, f )
{
_devicetype[ "cisco" ] = DEVTYPE_CISCO;
_devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
_devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
_devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
_devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
_devicetype[ "<file>" ] = DEVTYPE_FILE;
// gather possible interface names from ONetwork
ONetwork* net = ONetwork::instance();
ONetwork::InterfaceIterator it = net->iterator();
while ( it.current() )
{
if ( it.current()->isWireless() )
interfaceName->insertItem( it.current()->name() );
++it;
}
load();
@@ -95,70 +91,70 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
// hide tab4 (parse) until Wellenreiter 1.2
tab->removePage( tab_4 );
};
void WellenreiterConfigWindow::accept()
{
save();
QDialog::accept();
}
WellenreiterConfigWindow::~WellenreiterConfigWindow()
{
}
void WellenreiterConfigWindow::performAutodetection()
{
//TODO: insert modal splash screen here
// and sleep a second, so that it looks
// like we're actually doing something fancy... ;-)
- qDebug( "WellenreiterConfigWindow::performAutodetection()" );
+ odebug << "WellenreiterConfigWindow::performAutodetection()" << oendl;
// try to guess device type
QFile m( "/proc/modules" );
if ( m.open( IO_ReadOnly ) )
{
int devicetype(0);
QString line;
QTextStream modules( &m );
while( !modules.atEnd() && !devicetype )
{
modules >> line;
if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
}
if ( devicetype )
{
deviceType->setCurrentItem( devicetype );
_guess = devicetype;
- qDebug( "Wellenreiter: guessed device type to be #%d", devicetype );
+ odebug << "Wellenreiter: guessed device type to be #" << devicetype << "" << oendl;
}
}
}
int WellenreiterConfigWindow::driverType() const
{
QString name = deviceType->currentText();
if ( _devicetype.contains( name ) )
{
return _devicetype[name];
}
else
{
return 0;
}
};
int WellenreiterConfigWindow::hoppingInterval() const
{
return hopInterval->cleanText().toInt();
}
@@ -220,49 +216,49 @@ void WellenreiterConfigWindow::synchronizeActionsAndScripts()
}
void WellenreiterConfigWindow::changedNetworkAction(int t)
{
synchronizeActionsAndScripts();
}
void WellenreiterConfigWindow::changedClientAction(int t)
{
synchronizeActionsAndScripts();
}
void WellenreiterConfigWindow::changedStationAction(int t)
{
synchronizeActionsAndScripts();
}
void WellenreiterConfigWindow::getCaptureFileNameClicked()
{
QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
- qDebug( "name = %s", (const char*) name );
+ odebug << "name = " << (const char*) name << "" << oendl;
if ( !name.isEmpty() )
{
captureFileName->setText( name );
}
}
void WellenreiterConfigWindow::channelAllClicked(int state)
{
bool b = state;
channel1->setChecked( b );
channel2->setChecked( b );
channel3->setChecked( b );
channel4->setChecked( b );
channel5->setChecked( b );
channel6->setChecked( b );
channel7->setChecked( b );
channel8->setChecked( b );
channel9->setChecked( b );
channel10->setChecked( b );
channel11->setChecked( b );
channel12->setChecked( b );
channel13->setChecked( b );
channel14->setChecked( b );
@@ -295,94 +291,94 @@ void WellenreiterConfigWindow::performAction( const QString& type,
int channel,
int signal
/* , const GpsLocation& loc */ )
{
int action;
QString script;
if ( type == "network" )
{
action = newNetworkAction->currentItem();
script = newNetworkScript->text();
}
else if ( type == "managed" || type == "adhoc" )
{
action = newClientAction->currentItem();
script = newClientScript->text();
}
else if ( type == "station" )
{
action = newStationAction->currentItem();
script = newStationScript->text();
}
else
{
- qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type );
+ owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << (const char*) type << "'" << oendl;
return;
}
- qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script );
+ odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << (const char*) script << "')" << oendl;
switch( action )
{
case 0: /* Ignore */ return;
case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return;
case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return;
case 3: /* Blink LED */ break; //FIXME: Implement this
case 4: /* Run Script */
{
/**
*
* Script Substitution Information:
*
* $SSID = SSID
* $MAC = MAC
* $WEP = Wep
* $CHAN = Channel
*
**/
script = script.replace( QRegExp( "$SSID" ), essid );
script = script.replace( QRegExp( "$MAC" ), mac );
script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
- qDebug( "going to call script '%s'", (const char*) script );
+ odebug << "going to call script '" << (const char*) script << "'" << oendl;
::system( script );
- qDebug( "script returned." );
+ odebug << "script returned." << oendl;
return;
}
default: assert( false );
}
}
void WellenreiterConfigWindow::load()
{
#ifdef Q_WS_X11
#warning Persistent Configuration not yet implemented for standalone X11 build
performAutodetection();
#else
- qDebug( "loading configuration settings..." );
+ odebug << "loading configuration settings..." << oendl;
/* This is dumb monkey typing stuff... We _need_ to do this automatically! */
OConfig* c = oApp->config();
c->setGroup( "Interface" );
QString interface = c->readEntry( "name", "<none>" );
if ( interface != "<none>" )
{
#if QT_VERSION < 300
interfaceName->insertItem( interface, 0 );
interfaceName->setCurrentItem( 0 );
#else
interfaceName->setCurrentText( interface );
#endif
QString device = c->readEntry( "type", "<select>" );
#if QT_VERSION < 300
for ( int i = 0; i < deviceType->count(); ++i )
{
if ( deviceType->text( i ) == device )
{
deviceType->setCurrentItem( i );
@@ -418,49 +414,49 @@ void WellenreiterConfigWindow::load()
newStationScript->setText( c->readEntry( "newStationScript", "" ) );
synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand
c->setGroup( "GPS" );
enableGPS->setChecked( c->readBoolEntry( "use", false ) );
#if QT_VERSION < 300
gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 );
gpsdHost->setCurrentItem( 0 );
#else
gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) );
#endif
gpsdPort->setValue( c->readNumEntry( "port", 2947 ) );
startGPS->setChecked( c->readBoolEntry( "start", false ) );
commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) );
#endif
}
void WellenreiterConfigWindow::save()
{
#ifdef Q_WS_X11
#warning Persistent Configuration not yet implemented for standalone X11 build
#else
- qDebug( "saving configuration settings..." );
+ odebug << "saving configuration settings..." << oendl;
/* This is dumb monkey typing stuff... We _need_ to do this automatically! */
OConfig* c = oApp->config();
c->setGroup( "Interface" );
c->writeEntry( "name", interfaceName->currentText() );
c->writeEntry( "type", deviceType->currentText() );
c->writeEntry( "prism", prismHeader->isChecked() );
c->writeEntry( "hop", hopChannels->isChecked() );
c->writeEntry( "interval", hopInterval->value() );
c->writeEntry( "adaptive", adaptiveHopping->isChecked() );
c->setGroup( "Capture" );
c->writeEntry( "filename", captureFileName->text() );
c->setGroup( "UI" );
c->writeEntry( "lookupVendor", lookupVendor->isChecked() );
c->writeEntry( "openTree", openTree->isChecked() );
c->writeEntry( "disablePM", disablePM->isChecked() );
c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() );
c->writeEntry( "newNetworkScript", newNetworkScript->text() );
c->writeEntry( "newClientAction", newClientAction->currentItem() );
c->writeEntry( "newClientScript", newClientScript->text() );
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
@@ -1,88 +1,92 @@
/**********************************************************************
** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Wellenreiter II.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "gps.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
/* QT */
#include <qtextstream.h>
/* STD */
#include <stdlib.h>
#include <unistd.h>
GPS::GPS( QObject* parent, const char * name )
:QObject( parent, name )
{
- qDebug( "GPS::GPS()" );
+ odebug << "GPS::GPS()" << oendl;
_socket = new QSocket( this, "gpsd commsock" );
}
GPS::~GPS()
{
- qDebug( "GPS::~GPS()" );
+ odebug << "GPS::~GPS()" << oendl;
}
bool GPS::open( const QString& host, int port )
{
_socket->connectToHost( host, port );
}
GpsLocation GPS::position() const
{
char buf[256];
double lat = -111.0;
double lon = -111.0;
int result = _socket->writeBlock( "p\r\n", 3 );
_socket->flush();
if ( result )
{
int numAvail = _socket->bytesAvailable();
- qDebug( "GPS write succeeded, %d bytes available for reading...", numAvail );
+ odebug << "GPS write succeeded, " << numAvail << " bytes available for reading..." << oendl;
if ( numAvail )
{
int numRead = _socket->readBlock( &buf[0], sizeof buf );
int numScan = ::sscanf( &buf[0], "GPSD,P=%lg %lg", &lat, &lon);
if ( numRead < 7 || numScan != 2 )
{
- qDebug( "GPS read %d bytes succeeded, invalid response: '%s'", numRead, &buf[0] );
+ odebug << "GPS read " << numRead << " bytes succeeded, invalid response: '" << &buf[0] << "'" << oendl;
return GpsLocation( -111, -111 );
}
else
{
return GpsLocation( lat, lon );
}
}
}
return GpsLocation( -111, -111 );
}
QString GpsLocation::dmsPosition() const
{
if ( _latitude == -111 || _longitude == -111 )
return "N/A";
if ( _latitude == 0.0 && _longitude == 0.0 )
return "NULL";
/* compute latitude */
QString dms = "N";
if ( _latitude >= 0 ) dms.append( "+" );
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
@@ -1,54 +1,60 @@
/**********************************************************************
** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Wellenreiter II.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "logwindow.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qmultilineedit.h>
#include <qdatetime.h>
MLogWindow* MLogWindow::_instance;
MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f )
:QVBox( parent, name, f )
{
ledit = new QMultiLineEdit( this );
ledit->setReadOnly( true );
MLogWindow::_instance = this;
}
void MLogWindow::log( QString text )
{
QTime time = QTime::currentTime();
QString line;
line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text );
int col;
int row;
ledit->getCursorPosition( &col, &row );
ledit->insertAt( line, col, row );
- qDebug( line );
+ odebug << line << oendl;
}
void MLogWindow::clear()
{
ledit->clear();
}
const QString MLogWindow::getLog() const
{
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
@@ -1,113 +1,116 @@
/**********************************************************************
** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Wellenreiter II.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "mainwindow.h"
+
#ifdef QWS
+#include <opie2/odebug.h>
#include <opie2/oapplication.h>
#include <opie2/oprocess.h>
#else
#include <qapplication.h>
#endif
+/* QT */
#include <qmessagebox.h>
#include <qstringlist.h>
+/* STD */
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
using namespace Opie::Core;
-using namespace Opie::Core;
-using namespace Opie::Core;
+
int main( int argc, char **argv )
{
#ifdef QWS
OApplication a( argc, argv, "Wellenreiter II" );
#else
QApplication a( argc, argv );
#endif
WellenreiterMainWindow* w = new WellenreiterMainWindow();
#ifdef QWS
a.showMainWidget( w );
#else
a.setMainWidget( w );
w->setCaption( "Wellenreiter II" );
w->show();
#endif
a.processEvents(); // show the window before doing the safety checks
int result = -1;
static int killed = false;
bool check = true;
for ( int i = 1; i < argc; ++i )
{
- qDebug( "Wellenreiter::main() parsing argument %d = '%s'", i, argv[i] );
+ odebug << "Wellenreiter::main() parsing argument " << i << " = '" << argv[i] << "'" << oendl;
if ( !strcmp( "-nocheck", argv[i] ) )
{
- qDebug( "-nocheck found" );
+ odebug << "-nocheck found" << oendl;
check = false;
break;
}
}
if ( check )
{
// root check
if ( getuid() )
{
- qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) );
+ owarn << QObject::tr( "Wellenreiter: trying to run as non-root!" ) << oendl;
result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n"
"as non-root. You will have\nonly limited functionality.\nProceed anyway?" ),
QMessageBox::Yes, QMessageBox::No );
if ( result == QMessageBox::No ) return -1;
}
int dhcpid = OProcess::processPID( "dhcpc" );
if ( dhcpid )
{
result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
"(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ),
QMessageBox::Yes, QMessageBox::No );
if ( result == QMessageBox::Yes )
{
if ( -1 == ::kill( dhcpid, SIGTERM ) )
- qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) );
+ owarn << "Wellenreiter: can't kill process #" << result << " (" << strerror( errno ) << ")" << oendl;
else
killed = true;
}
}
}
a.exec();
if ( check )
{
if ( killed )
{
result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No );
if ( result == QMessageBox::Yes )
{
::system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
}
}
delete w;
}
return 0;
}
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
@@ -1,82 +1,83 @@
/**********************************************************************
** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Wellenreiter II.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "configwindow.h"
#include "gps.h"
#include "logwindow.h"
#include "packetview.h"
#include "mainwindow.h"
#include "wellenreiter.h"
#include "scanlist.h"
+/* OPIE */
+#ifdef QWS
+#include <qpe/resource.h>
+#include <opie2/odebug.h>
+#include <opie2/ofiledialog.h>
+#else
+#include "resource.h"
+#include <qapplication.h>
+#include <qfiledialog.h>
+#endif
+using namespace Opie::Core;
+using namespace Opie::Net;
+using namespace Opie::Ui;
+
+/* QT */
#include <qcombobox.h>
#include <qdatastream.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qiconset.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qpushbutton.h>
#include <qstatusbar.h>
#include <qspinbox.h>
#include <qtextstream.h>
#include <qtoolbutton.h>
#include <qwhatsthis.h>
-#ifdef QWS
-#include <qpe/resource.h>
-#include <opie2/ofiledialog.h>
-using namespace Opie;
-#else
-#include "resource.h"
-#include <qapplication.h>
-#include <qfiledialog.h>
-#endif
-
+/* STD */
#include <unistd.h>
-using namespace Opie::Ui;
-using namespace Opie::Net;
-using namespace Opie::Ui;
-using namespace Opie::Net;
-using namespace Opie::Net;
WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
:QMainWindow( parent, name, f )
{
cw = new WellenreiterConfigWindow( this );
mw = new Wellenreiter( this );
mw->setConfigWindow( cw );
setCentralWidget( mw );
// setup application icon
setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
#ifndef QWS
setIconText( "Wellenreiter/X11" );
#endif
// setup tool buttons
startButton = new QToolButton( 0 );
QWhatsThis::add( startButton, tr( "Click here to start scanning." ) );
#ifdef QWS
startButton->setAutoRaise( true );
#endif
startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) );
startButton->setEnabled( false );
@@ -167,112 +168,112 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
mb->insertItem( d );
#else // Qt3 changed the insertion order. It's now totally random :(
mb->insertItem( d );
mb->insertItem( uploadButton );
mb->insertItem( stopButton );
mb->insertItem( startButton );
#endif
updateToolButtonState();
// setup status bar (for now only on X11)
#ifndef QWS
statusBar()->message( tr( "Ready." ) );
#endif
connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) );
connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) );
};
void WellenreiterMainWindow::showConfigure()
{
- qDebug( "show configure..." );
+ odebug << "show configure..." << oendl;
cw->setCaption( tr( "Configure" ) );
int result = QPEApplication::execDialog( cw );
if ( result ) updateToolButtonState();
}
void WellenreiterMainWindow::updateToolButtonState()
{
const QString& interface = cw->interfaceName->currentText();
const int cardtype = cw->driverType();
if ( ( interface != "<select>" ) && ( cardtype != 0 ) )
{
startButton->setEnabled( true );
menuBar()->setItemEnabled( startID, true );
}
else
{
startButton->setEnabled( false );
menuBar()->setItemEnabled( startID, false );
}
}
void WellenreiterMainWindow::changedSniffingState()
{
startButton->setEnabled( !mw->sniffing );
menuBar()->setItemEnabled( startID, !mw->sniffing );
stopButton->setEnabled( mw->sniffing );
menuBar()->setItemEnabled( stopID, mw->sniffing );
if ( !mw->sniffing )
{
menuBar()->setItemEnabled( uploadID, true );
uploadButton->setEnabled( true );
}
}
WellenreiterMainWindow::~WellenreiterMainWindow()
{
- qDebug( "Wellenreiter: bye." );
+ odebug << "Wellenreiter: bye." << oendl;
};
void WellenreiterMainWindow::demoAddStations()
{
//mw = 0; // test SIGSEGV handling
mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 39.8794, -94.0936) );
mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:03:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) );
mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:04:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) );
mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:05:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) );
}
void WellenreiterMainWindow::demoReadFromGps()
{
WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance();
GPS* gps = new GPS( this );
- qDebug( "Wellenreiter::demoReadFromGps(): url=gps://%s:%d/", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
+ odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl;
gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
GpsLocation loc = gps->position();
QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) );
delete gps;
}
QString WellenreiterMainWindow::getFileName( bool save )
{
QMap<QString, QStringList> map;
map.insert( tr("All"), QStringList() );
QStringList text;
text << "text/*";
map.insert( tr("Text"), text );
text << "*";
map.insert( tr("All"), text );
QString str;
if ( save )
{
#ifdef QWS
str = OFileDialog::getSaveFileName( 2, "/", QString::null, map );
#else
str = QFileDialog::getSaveFileName();
@@ -284,117 +285,117 @@ QString WellenreiterMainWindow::getFileName( bool save )
{
#ifdef QWS
str = OFileDialog::getOpenFileName( 2, "/", QString::null, map );
#else
str = QFileDialog::getOpenFileName();
#endif
if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() )
return "";
}
return str;
}
void WellenreiterMainWindow::fileSaveLog()
{
QString fname = getFileName( true );
if ( !fname.isEmpty() )
{
QFile f( fname );
if ( f.open(IO_WriteOnly) )
{
QTextStream t( &f );
t << mw->logWindow()->getLog();
f.close();
- qDebug( "Saved log to file '%s'", (const char*) fname );
+ odebug << "Saved log to file '" << (const char*) fname << "'" << oendl;
}
else
{
- qDebug( "Problem saving log to file '%s'", (const char*) fname );
+ odebug << "Problem saving log to file '" << (const char*) fname << "'" << oendl;
}
}
}
void WellenreiterMainWindow::fileSaveSession()
{
QString fname = getFileName( true );
if ( !fname.isEmpty() )
{
QFile f( fname );
if ( f.open(IO_WriteOnly) )
{
QDataStream t( &f );
t << *mw->netView();
f.close();
- qDebug( "Saved session to file '%s'", (const char*) fname );
+ odebug << "Saved session to file '" << (const char*) fname << "'" << oendl;
}
else
{
- qDebug( "Problem saving session to file '%s'", (const char*) fname );
+ odebug << "Problem saving session to file '" << (const char*) fname << "'" << oendl;
}
}
}
void WellenreiterMainWindow::fileSaveHex()
{
#warning DOES NOT WORK AT THE MOMENT
/*
QString fname = getFileName( true );
if ( !fname.isEmpty() )
{
QFile f( fname );
if ( f.open(IO_WriteOnly) )
{
QTextStream t( &f );
t << mw->hexWindow()->getLog();
f.close();
- qDebug( "Saved hex log to file '%s'", (const char*) fname );
+ odebug << "Saved hex log to file '" << (const char*) fname << "'" << oendl;
}
else
{
- qDebug( "Problem saving hex log to file '%s'", (const char*) fname );
+ odebug << "Problem saving hex log to file '" << (const char*) fname << "'" << oendl;
}
}
*/
}
void WellenreiterMainWindow::fileLoadSession()
{
QString fname = getFileName( false );
if ( !fname.isEmpty() )
{
QFile f( fname );
if ( f.open(IO_ReadOnly) )
{
QDataStream t( &f );
t >> *mw->netView();
f.close();
- qDebug( "Loaded session from file '%s'", (const char*) fname );
+ odebug << "Loaded session from file '" << (const char*) fname << "'" << oendl;
}
else
{
- qDebug( "Problem loading session from file '%s'", (const char*) fname );
+ odebug << "Problem loading session from file '" << (const char*) fname << "'" << oendl;
}
}
}
void WellenreiterMainWindow::fileNew()
{
mw->netView()->clear();
mw->logWindow()->clear();
mw->hexWindow()->clear();
}
void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
{
if ( mw->isDaemonRunning() )
{
QMessageBox::warning( this, "Wellenreiter/Opie",
tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) );
e->ignore();
}
else
{
QMainWindow::closeEvent( e );
@@ -417,53 +418,53 @@ void WellenreiterMainWindow::uploadSession()
QPushButton* reject;
QDialog* d = new QDialog( 0, "session upload", true );
d->setCaption( tr( "Upload Session" ) );
QGridLayout* g = new QGridLayout( d, 4, 2, 3 );
g->addWidget( new QLabel( tr( "From: " ), d ), 0, 0 );
g->addWidget( from = new QLineEdit( d ), 0, 1 );
g->addWidget( new QLabel( tr( "Location: " ), d ), 1, 0 );
g->addWidget( location = new QLineEdit( d ), 1, 1 );
g->addWidget( new QLabel( tr( "Comments: " ), d ), 2, 0 );
g->addWidget( comments = new QLineEdit( d ), 2, 1 );
g->addWidget( accept = new QPushButton( tr( "&Ok" ), d ), 3, 0 );
g->addWidget( reject = new QPushButton( tr( "&Cancel" ), d ), 3, 1 );
accept->setDefault( true );
accept->setAutoDefault( true );
from->setText( "WL II User" );
location->setText( "WL II Location" );
comments->setText( "No Comments." );
connect( accept, SIGNAL( clicked() ), d, SLOT( accept() ) );
connect( reject, SIGNAL( clicked() ), d, SLOT( reject() ) );
int result = d->exec();
if ( !result )
{
- qDebug( "Session upload cancelled :(" );
+ odebug << "Session upload cancelled :(" << oendl;
return;
}
- qDebug( "Starting upload..." );
+ odebug << "Starting upload..." << oendl;
struct sockaddr_in raddr;
struct hostent *rhost_info;
int sock = -1;
bool ok = false;
rhost_info = (struct hostent *) ::gethostbyname( CAP_hostname );
if ( rhost_info )
{
if ( !QFile::exists( mw->captureFileName() ) )
{
QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile '%1' doesn't exist</p>").arg( mw->captureFileName() ) );
return;
}
QFile f( mw->captureFileName() );
if ( !f.open( IO_ReadOnly ) )
{
QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile '%1'</p>").arg( mw->captureFileName() ) );
return;
}
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
@@ -63,49 +63,49 @@ PacketView::PacketView( QWidget * parent, const char * name, WFlags f )
_packets.setAutoDelete( true );
connect( _number, SIGNAL( valueChanged( int ) ), this, SLOT( showPacket( int ) ) );
}
void PacketView::add( const OPacket* p )
{
_packets.append( p );
// Add Circular Buffer and check for number of elements here
}
void PacketView::showPacket( int number )
{
_list->clear();
_hex->setText("");
const OPacket* p = _packets.at( number );
if ( p )
{
_doSubPackets( const_cast<QObjectList*>( p->children() ), 0 );
_doHexPacket( p );
}
else
{
- qDebug( "D'oh! No packet!" );
+ odebug << "D'oh! No packet!" << oendl;
}
}
void PacketView::_doSubPackets( QObjectList* l, int counter )
{
if (!l) return;
QObject* o = l->first();
while ( o )
{
new OListViewItem( _list, QString::number( counter++ ), o->name() );
_doSubPackets( const_cast<QObjectList*>( o->children() ), counter );
o = l->next();
}
}
void PacketView::_doHexPacket( const OPacket* p )
{
_hex->setText( p->dump( 16 ) );
}
const QString PacketView::getLog() const
{
}
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
@@ -8,42 +8,42 @@
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "resource.h"
#define PIXMAPPATH "/usr/local/share"
#include <qiconset.h>
namespace Resource
{
QPixmap loadPixmap( const QString& pix )
{
QString filename;
filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix );
QPixmap pixmap( filename );
if ( pixmap.isNull() )
{
- qDebug( "Wellenreiter::Resource: can't find pixmap " + filename );
+ odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl;
}
return pixmap;
};
QIconSet loadIconSet( const QString& pix )
{
QString filename;
filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix );
QPixmap pixmap( filename );
if ( pixmap.isNull() )
{
- qDebug( "Wellenreiter::Resource: can't find pixmap " + filename );
+ odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl;
}
return QIconSet( pixmap );
};
};
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
@@ -1,78 +1,77 @@
/**********************************************************************
** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Wellenreiter II.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "scanlist.h"
#include "configwindow.h"
#include "logwindow.h"
-#include <assert.h>
-#include <qcursor.h>
-#include <qdatetime.h>
-#include <qpopupmenu.h>
-#include <qcheckbox.h>
-
+/* OPIE */
#ifdef QWS
+#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
-#endif
-
-#ifdef QWS
#include <qpe/resource.h>
#else
#include "resource.h"
#endif
+using namespace Opie::Core;
+using namespace Opie::Ui;
+using namespace Opie::Net;
+
+/* QT */
+#include <qcursor.h>
+#include <qdatetime.h>
+#include <qpopupmenu.h>
+#include <qcheckbox.h>
+
+/* STD */
+#include <assert.h>
const int col_type = 0;
const int col_essid = 0;
const int col_sig = 1;
const int col_ap = 2;
const int col_channel = 3;
const int col_wep = 4;
const int col_traffic = 5;
const int col_ip = 6;
const int col_manuf = 7;
const int col_firstseen = 8;
const int col_lastseen = 9;
const int col_location = 10;
-using namespace Opie::Net;
-using namespace Opie::Ui;
-using namespace Opie::Net;
-using namespace Opie::Ui;
-using namespace Opie::Ui;
-using namespace Opie::Net;
MScanListView::MScanListView( QWidget* parent, const char* name )
:OListView( parent, name )
{
setFrameShape( QListView::StyledPanel );
setFrameShadow( QListView::Sunken );
addColumn( tr( "Net/Station" ) );
setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
addColumn( tr( "#" ) );
setColumnAlignment( col_sig, AlignCenter );
addColumn( tr( "MAC" ) );
setColumnAlignment( col_ap, AlignCenter );
addColumn( tr( "Chn" ) );
setColumnAlignment( col_channel, AlignCenter );
addColumn( tr( "W" ) );
setColumnAlignment( col_wep, AlignCenter );
addColumn( tr( "T" ) );
setColumnAlignment( col_traffic, AlignCenter );
addColumn( tr( "IP" ) );
setColumnAlignment( col_ip, AlignCenter );
addColumn( tr( "Manufacturer" ) );
setColumnAlignment( col_manuf, AlignCenter );
addColumn( tr( "First Seen" ) );
setColumnAlignment( col_firstseen, AlignCenter );
@@ -85,413 +84,413 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
#ifdef QWS
QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
};
MScanListView::~MScanListView()
{
};
OListViewItem* MScanListView::childFactory()
{
return new MScanListItem( this );
}
void MScanListView::serializeTo( QDataStream& s) const
{
- qDebug( "serializing MScanListView" );
+ odebug << "serializing MScanListView" << oendl;
OListView::serializeTo( s );
}
void MScanListView::serializeFrom( QDataStream& s)
{
- qDebug( "serializing MScanListView" );
+ odebug << "serializing MScanListView" << oendl;
OListView::serializeFrom( s );
}
void MScanListView::addNewItem( const QString& type,
const QString& essid,
const OMacAddress& mac,
bool wep,
int channel,
int signal,
const GpsLocation& loc,
bool probe )
{
QString macaddr = mac.toString(true);
#ifdef DEBUG
qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type,
(const char*) essid, (const char*) macaddr, channel );
#endif
// search, if we already have seen this net
QString s;
MScanListItem* network;
MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
while ( item && ( item->text( col_essid ) != essid ) )
{
#ifdef DEBUG
- qDebug( "itemtext: %s", (const char*) item->text( col_essid ) );
+ odebug << "itemtext: " << (const char*) item->text( col_essid ) << "" << oendl;
#endif
item = static_cast<MScanListItem*> ( item->nextSibling() );
}
if ( item )
{
// we have already seen this net, check all childs if MAC exists
network = item;
item = static_cast<MScanListItem*> ( item->firstChild() );
assert( item ); // this shouldn't fail
while ( item && ( item->text( col_ap ) != macaddr ) )
{
#ifdef DEBUG
- qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) );
+ odebug << "subitemtext: " << (const char*) item->text( col_ap ) << "" << oendl;
#endif
item = static_cast<MScanListItem*> ( item->nextSibling() );
}
if ( item )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
- qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
+ odebug << "" << (const char*) macaddr << " is a dupe - ignoring..." << oendl;
#endif
item->receivedBeacon();
return;
}
}
else
{
s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid );
MLogWindow::logwindow()->log( s );
network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe );
}
// insert new station as child from network
// no essid to reduce clutter, maybe later we have a nick or stationname to display!?
#ifdef DEBUG
- qDebug( "inserting new station %s", (const char*) macaddr );
+ odebug << "inserting new station " << (const char*) macaddr << "" << oendl;
#endif
MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
station->setManufacturer( mac.manufacturer() );
station->setLocation( loc.dmsPosition() );
if ( type == "managed" )
{
s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel );
}
else
{
s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel );
}
MLogWindow::logwindow()->log( s );
}
void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type )
{
MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) )
{
#ifdef DEBUG
- qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
+ odebug << "subitemtext: " << (const char*) subitem->text( col_ap ) << "" << oendl;
#endif
subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
}
if ( subitem )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
- qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) );
+ odebug << "" << (const char*) addr.toString(true) << " is a dupe - ignoring..." << oendl;
#endif
subitem->receivedBeacon(); //FIXME: sent data bit
return;
}
// Hey, it seems to be a new item :-D
MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 );
station->setManufacturer( addr.manufacturer() );
QString s;
if ( type == "station" )
{
s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) );
}
else
{
s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) );
}
MLogWindow::logwindow()->log( s );
}
void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo )
{
- qDebug( "WDSTraffic: %s and %s seem to form a WDS", (const char*) viaFrom.toString(), (const char*) viaTo.toString() );
+ odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << (const char*) viaTo.toString() << " seem to form a WDS" << oendl;
QString s;
MScanListItem* network;
QListViewItemIterator it( this );
while ( it.current() &&
it.current()->text( col_ap ) != viaFrom.toString(true) &&
it.current()->text( col_ap ) != viaTo.toString(true) ) ++it;
MScanListItem* item = static_cast<MScanListItem*>( it.current() );
if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations
{
addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to );
}
else
{
- qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" );
+ odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl;
MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" );
}
}
void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
{
QString s;
MScanListItem* network;
QListViewItemIterator it( this );
while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it;
MScanListItem* item = static_cast<MScanListItem*>( it.current() );
if ( item ) // AP has shown up yet, so just add our new "from" - station
{
addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" );
}
else
{
- qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
+ odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" );
}
}
void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
{
QString s;
MScanListItem* network;
QListViewItemIterator it( this );
while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it;
MScanListItem* item = static_cast<MScanListItem*>( it.current() );
if ( item ) // AP has shown up yet, so just add our new "from" - station
{
addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" );
}
else
{
- qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
+ odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" );
}
}
void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
{
- qWarning( "D'oh! Not yet implemented..." );
+ owarn << "D'oh! Not yet implemented..." << oendl;
MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" );
}
void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
{
- qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip );
+ odebug << "identify " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl;
QListViewItemIterator it( this );
for ( ; it.current(); ++it )
{
if ( it.current()->text( col_ap ) == macaddr.toString(true) )
{
it.current()->setText( col_ip, ip );
return;
}
}
- qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" );
+ odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!",
(const char*) macaddr.toString(), (const char*) ip ) );
}
void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip )
{
- qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip );
+ odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl;
//TODO: Refactor that out, we need it all over the place.
// Best to do it in a more comfortable abstraction in OListView
// (Hmm, didn't I already start something in this direction?)
QListViewItemIterator it( this );
for ( ; it.current(); ++it )
{
if ( it.current()->text( col_ap ) == macaddr.toString(true) )
{
MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
while ( subitem && ( subitem->text( col_essid ) != name ) )
{
#ifdef DEBUG
- qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) );
+ odebug << "subitemtext: " << (const char*) subitem->text( col_essid ) << "" << oendl;
#endif
subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
}
if ( subitem )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
- qDebug( "%s is a dupe - ignoring...", (const char*) name );
+ odebug << "" << (const char*) name << " is a dupe - ignoring..." << oendl;
#endif
subitem->receivedBeacon(); //FIXME: sent data bit
return;
}
// never seen that - add new item
MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
item->setText( col_essid, name );
return;
}
}
- qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" );
+ odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!",
(const char*) macaddr.toString(), (const char*) ip ) );
}
void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col )
{
if ( !item ) return;
MScanListItem* itm = static_cast<MScanListItem*>( item );
qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'",
(const char*) itm->text(0), (const char*) itm->type, col );
if ( itm->type == "adhoc" || itm->type == "managed" )
{
QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() );
QPopupMenu m( this );
m.insertItem( entry, 37773, 0 );
int result = m.exec( QCursor::pos() );
if ( result == 37773 )
emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() );
}
}
//============================================================
// MScanListItem
//============================================================
MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr,
bool wep, int channel, int signal, bool probed )
:OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
_type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
_channel( channel ), _signal( signal ), _beacons( 1 )
{
#ifdef DEBUG
- qDebug( "creating scanlist item" );
+ odebug << "creating scanlist item" << oendl;
#endif
if ( WellenreiterConfigWindow::instance() )
WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
decorateItem( type, essid, macaddr, wep, channel, signal, probed );
}
MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr,
bool wep, int channel, int signal )
:OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
{
#ifdef DEBUG
- qDebug( "creating scanlist item" );
+ odebug << "creating scanlist item" << oendl;
#endif
if ( WellenreiterConfigWindow::instance() )
WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
decorateItem( type, essid, macaddr, wep, channel, signal, false );
}
const QString& MScanListItem::essid() const
{
if ( type == "network" )
return _essid;
else
return ( (MScanListItem*) parent() )->essid();
}
OListViewItem* MScanListItem::childFactory()
{
return new MScanListItem( this );
}
void MScanListItem::serializeTo( QDataStream& s ) const
{
#ifdef DEBUG
- qDebug( "serializing MScanListItem" );
+ odebug << "serializing MScanListItem" << oendl;
#endif
OListViewItem::serializeTo( s );
s << _type;
s << (Q_UINT8) ( _wep ? 'y' : 'n' );
}
void MScanListItem::serializeFrom( QDataStream& s )
{
#ifdef DEBUG
- qDebug( "serializing MScanListItem" );
+ odebug << "serializing MScanListItem" << oendl;
#endif
OListViewItem::serializeFrom( s );
char wep;
s >> _type;
s >> (Q_UINT8) wep;
_wep = (wep == 'y');
QString name;
name.sprintf( "wellenreiter/%s", (const char*) _type );
setPixmap( col_type, Resource::loadPixmap( name ) );
if ( _wep )
setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
listView()->triggerUpdate();
}
void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed )
{
#ifdef DEBUG
qDebug( "decorating scanlist item %s / %s / %s [%d]",
(const char*) type,
(const char*) essid,
(const char*) macaddr,
channel );
@@ -535,34 +534,34 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
if ( WellenreiterConfigWindow::instance()->openTree->isChecked() )
{
listView()->ensureItemVisible( this );
}
}
void MScanListItem::setManufacturer( const QString& manufacturer )
{
setText( col_manuf, manufacturer );
}
void MScanListItem::setLocation( const QString& location )
{
setText( col_location, location );
}
void MScanListItem::receivedBeacon()
{
_beacons++;
#ifdef DEBUG
- qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
+ odebug << "MScanListItem " << (const char*) _macaddr << ": received beacon #" << _beacons << "" << oendl;
#endif
setText( col_sig, QString::number( _beacons ) );
setText( col_lastseen, QTime::currentTime().toString() );
MScanListItem* p = (MScanListItem*) parent();
if ( p ) p->receivedBeacon();
}
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
@@ -1,404 +1,396 @@
/**********************************************************************
** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
***********************************************************************/
-// Local
-
#include "gps.h"
#include "wellenreiter.h"
#include "scanlist.h"
#include "logwindow.h"
#include "packetview.h"
#include "configwindow.h"
#include "statwindow.h"
#include "graphwindow.h"
#include "protolistview.h"
-// Opie
-
+/* OPIE */
#ifdef QWS
#include <opie2/oapplication.h>
+#include <opie2/odebug.h>
#include <opie2/odevice.h>
#else
#include <qapplication.h>
#endif
#include <opie2/omanufacturerdb.h>
#include <opie2/onetwork.h>
#include <opie2/opcap.h>
#include <qpe/qcopenvelope_qws.h>
-using namespace Opie;
-
-// Qt
+using namespace Opie::Core;
+using namespace Opie::Net;
+using namespace Opie::Ui;
+/* QT */
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qdatetime.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qmessagebox.h>
#include <qobjectlist.h>
#include <qregexp.h>
#include <qspinbox.h>
#include <qtimer.h>
#include <qtoolbutton.h>
#include <qmainwindow.h>
-// Standard
-
+/* STD */
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
-using namespace Opie::Core;
-using namespace Opie::Net;
-using namespace Opie::Net;
-using namespace Opie::Core;
-using namespace Opie::Net;
-using namespace Opie::Core;
Wellenreiter::Wellenreiter( QWidget* parent )
: WellenreiterBase( parent, 0, 0 ),
sniffing( false ), iface( 0 ), configwindow( 0 )
{
logwindow->log( "(i) Wellenreiter has been started." );
//
// detect operating system
//
#ifdef QWS
QString sys;
sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
_system = ODevice::inst()->system();
logwindow->log( sys );
#endif
netview->setColumnWidthMode( 1, QListView::Manual );
connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ),
this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) );
pcap = new OPacketCapturer();
pcap->setAutoDelete( false );
gps = new GPS( this );
QTimer::singleShot( 1000, this, SLOT( initialTimer() ) );
}
Wellenreiter::~Wellenreiter()
{
delete pcap;
}
void Wellenreiter::initialTimer()
{
- qDebug( "Wellenreiter::preloading manufacturer database..." );
+ odebug << "Wellenreiter::preloading manufacturer database..." << oendl;
OManufacturerDB::instance();
}
void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
{
configwindow = cw;
}
void Wellenreiter::channelHopped(int c)
{
QString title = "Wellenreiter II -scan- [";
QString left;
if ( c > 1 ) left.fill( '.', c-1 );
title.append( left );
title.append( '|' );
if ( c < iface->channels() )
{
QString right;
right.fill( '.', iface->channels()-c );
title.append( right );
}
title.append( "]" );
//title.append( QString().sprintf( " %02d", c ) );
assert( parent() );
( (QMainWindow*) parent() )->setCaption( title );
}
void Wellenreiter::handleNotification( OPacket* p )
{
QObjectList* l = p->queryList();
QObjectListIt it( *l );
QObject* o;
while ( (o = it.current()) != 0 )
{
QString name = it.current()->name();
if ( configwindow->parsePackets->isProtocolChecked( name ) )
{
QString action = configwindow->parsePackets->protocolAction( name );
- qDebug( "parsePacket-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
+ odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl;
doAction( action, name, p );
}
else
{
- qDebug( "protocol '%s' not checked in parsePackets.", (const char*) name );
+ odebug << "protocol '" << (const char*) name << "' not checked in parsePackets." << oendl;
}
++it;
}
}
void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage )
{
if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage );
else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage );
else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage );
- else qWarning( "Wellenreiter::handleManagementFrame(): '%s' - please handle me!", (const char*) manage->managementType() );
+ else owarn << "Wellenreiter::handleManagementFrame(): '" << (const char*) manage->managementType() << "' - please handle me!" << oendl;
}
void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request )
{
OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
int channel = ds ? ds->channel() : -1;
OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
GpsLocation loc( -111, -111 );
if ( configwindow->enableGPS->isChecked() )
{
// TODO: add check if GPS is working!?
- qDebug( "Wellenreiter::gathering GPS data..." );
+ odebug << "Wellenreiter::gathering GPS data..." << oendl;
loc = gps->position();
- qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() );
+ odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl;
}
if ( essid.length() )
netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ );
- qDebug( "Wellenreiter::invalid frame [possibly noise] detected!" );
+ odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl;
}
void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response )
{
}
void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
{
QString type;
if ( beacon->canIBSS() )
{
type = "adhoc";
}
else if ( beacon->canESS() )
{
type = "managed";
}
else
{
- qWarning( "Wellenreiter::invalid frame [possibly noise] detected!" );
+ owarn << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl;
return;
}
OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>");
OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
int channel = ds ? ds->channel() : -1;
OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
GpsLocation loc( -111, -111 );
if ( configwindow->enableGPS->isChecked() )
{
// TODO: add check if GPS is working!?
- qDebug( "Wellenreiter::gathering GPS data..." );
+ odebug << "Wellenreiter::gathering GPS data..." << oendl;
loc = gps->position();
- qDebug( "Wellenreiter::GPS data received is ( %f , %f ) - dms string = '%s'", loc.latitude(), loc.longitude(), loc.dmsPosition().latin1() );
+ odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl;
}
netView()->addNewItem( type, essid, header->macAddress2(), beacon->canPrivacy(), channel, 0, loc );
// update graph window
if ( ds )
{
OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) );
if ( prism )
graphwindow->traffic( ds->channel(), prism->signalStrength() );
else
graphwindow->traffic( ds->channel(), 95 );
}
}
void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* control )
{
OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
if ( control->controlType() == "Acknowledge" )
{
netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) );
}
else
{
- qDebug( "Wellenreiter::handleControlFrame - please handle %s in a future version! :D", (const char*) control->controlType() );
+ odebug << "Wellenreiter::handleControlFrame - please handle " << (const char*) control->controlType() << " in a future version! :D" << oendl;
}
}
void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to )
{
OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
if ( wlan->fromDS() && !wlan->toDS() )
{
netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
from = wlan->macAddress3();
to = wlan->macAddress2();
}
else if ( !wlan->fromDS() && wlan->toDS() )
{
netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() );
from = wlan->macAddress2();
to = wlan->macAddress3();
}
else if ( wlan->fromDS() && wlan->toDS() )
{
netView()->WDStraffic( wlan->macAddress4(), wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
from = wlan->macAddress4();
to = wlan->macAddress3();
}
else
{
netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() );
from = wlan->macAddress2();
to = wlan->macAddress1();
}
}
void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to )
{
from = data->sourceAddress();
to = data->destinationAddress();
netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) );
}
void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest )
{
OARPPacket* arp = (OARPPacket*) p->child( "ARP" );
if ( arp )
{
- qDebug( "Received ARP traffic (type '%s'): ", (const char*) arp->type() );
+ odebug << "Received ARP traffic (type '" << (const char*) arp->type() << "'): " << oendl;
if ( arp->type() == "REQUEST" )
{
netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
}
else if ( arp->type() == "REPLY" )
{
netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
}
}
}
void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest )
{
//TODO: Implement more IP based protocols
ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" );
if ( dhcp )
{
- qDebug( "Received DHCP '%s' packet", (const char*) dhcp->type() );
+ odebug << "Received DHCP '" << (const char*) dhcp->type() << "' packet" << oendl;
if ( dhcp->type() == "OFFER" )
{
- qDebug( "DHCP: '%s' ('%s') seems to be a DHCP server.", (const char*) source.toString(), (const char*) dhcp->serverAddress().toString() );
+ odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << (const char*) dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl;
netView()->identify( source, dhcp->serverAddress().toString() );
netView()->addService( "DHCP", source, dhcp->serverAddress().toString() );
}
else if ( dhcp->type() == "ACK" )
{
- qDebug( "DHCP: '%s' ('%s') accepted the offered DHCP address.", (const char*) dhcp->clientMacAddress().toString(), (const char*) dhcp->yourAddress().toString() );
+ odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << (const char*) dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl;
netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() );
}
}
}
QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
{
if ( configwindow->parsePackets->isProtocolChecked( protocol ) )
if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
return 0;
return p->child( protocol );
}
bool Wellenreiter::checkDumpPacket( OPacket* p )
{
// go through all child packets and see if one is inside the child hierarchy for p
// if so, do what the user requested (protocolAction), e.g. pass or discard
if ( !configwindow->writeCaptureFile->isChecked() )
return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
QObjectList* l = p->queryList();
QObjectListIt it( *l );
QObject* o;
while ( (o = it.current()) != 0 )
{
QString name = it.current()->name();
if ( configwindow->capturePackets->isProtocolChecked( name ) )
{
QString action = configwindow->capturePackets->protocolAction( name );
- qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
+ odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << (const char*) action << "'" << oendl;
if ( action == "Discard" )
{
logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) );
return false;
}
}
else
{
- qDebug( "protocol '%s' not checked in capturePackets.", (const char*) name );
+ odebug << "protocol '" << (const char*) name << "' not checked in capturePackets." << oendl;
}
++it;
}
return true;
}
void Wellenreiter::receivePacket( OPacket* p )
{
hexWindow()->add( p );
if ( checkDumpPacket( p ) )
{
pcap->dump( p );
}
// check for a management frame
OWaveLanManagementPacket* manage = static_cast<OWaveLanManagementPacket*>( childIfToParse( p, "802.11 Management" ) );
if ( manage )
{
handleManagementFrame( p, manage );
return;
}
@@ -530,94 +522,94 @@ void Wellenreiter::startClicked()
}
iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); // fails if network is not wireless!
assert( iface );
// bring device UP
iface->setUp( true );
if ( !iface->isUp() )
{
QMessageBox::warning( this, "Wellenreiter II",
tr( "Can't bring interface '%1' up:\n" ).arg( iface->name() ) + strerror( errno ) );
return;
}
}
// set monitor mode
bool usePrism = configwindow->usePrismHeader();
switch ( cardtype )
{
case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface, usePrism ) ); break;
case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface, usePrism ) ); break;
case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface, usePrism ) ); break;
case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface, usePrism ) ); break;
case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break;
- case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break;
+ case DEVTYPE_FILE: odebug << "Wellenreiter: Capturing from file '" << (const char*) interface << "'" << oendl; break;
default: assert( 0 ); // shouldn't reach this
}
// switch device into monitor mode
if ( cardtype < DEVTYPE_FILE )
{
if ( cardtype != DEVTYPE_MANUAL )
iface->setMode( "monitor" );
if ( iface->mode() != "monitor" )
{
if ( QMessageBox::warning( this, "Wellenreiter II",
tr( "Can't set interface '%1'\ninto monitor mode:\n" ).arg( iface->name() ) + strerror( errno ) +
tr( "\nContinue with limited functionality?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
return;
}
}
// open GPS device
if ( configwindow->enableGPS->isChecked() )
{
- qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
+ odebug << "Wellenreiter:GPS enabled @ " << (const char*) configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "" << oendl;
gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
}
// open pcap and start sniffing
if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
{
dumpname = configwindow->captureFileName->text();
if ( dumpname.isEmpty() ) dumpname = "captureFile";
dumpname.append( '-' );
dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
dumpname.append( ".wellenreiter" );
}
else // write it anyway ;)
{
dumpname = "/var/log/dump.wellenreiter";
}
if ( cardtype != DEVTYPE_FILE )
pcap->open( interface );
else
pcap->open( QFile( interface ) );
- qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname );
+ odebug << "Wellenreiter:: dumping to " << (const char*) dumpname << "" << oendl;
pcap->openDumpFile( dumpname );
if ( !pcap->isOpen() )
{
QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
return;
}
// set capturer to non-blocking mode
pcap->setBlocking( false );
// start channel hopper
if ( cardtype != DEVTYPE_FILE )
{
logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) );
iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window
}
if ( cardtype != DEVTYPE_FILE )
{
// connect socket notifier and start channel hopper
connect( pcap, SIGNAL( receivedPacket(Opie::Net::OPacket*) ), this, SLOT( receivePacket(Opie::Net::OPacket*) ) );
connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
@@ -631,49 +623,49 @@ void Wellenreiter::startClicked()
logwindow->log( "(i) Started Scanning." );
sniffing = true;
#ifdef QWS
if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
{
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable;
}
#else
#warning FIXME: setScreenSaverMode is not operational on the X11 build
#endif
emit( startedSniffing() );
if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
else
{
assert( parent() );
( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
}
}
void Wellenreiter::timerEvent( QTimerEvent* )
{
- qDebug( "Wellenreiter::timerEvent()" );
+ odebug << "Wellenreiter::timerEvent()" << oendl;
OPacket* p = pcap->next();
if ( !p ) // no more packets available
{
stopClicked();
}
else
{
receivePacket( p );
// We no longer delete packets here. Ownership of the packets is
// transferred to the PacketView.
//delete p;
}
}
void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p )
{
#ifdef QWS
if ( action == "TouchSound" )
ODevice::inst()->playTouchSound();
else if ( action == "AlarmSound" )
ODevice::inst()->playAlarmSound();
else if ( action == "KeySound" )
ODevice::inst()->playKeySound();
@@ -694,40 +686,40 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa
void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
{
#ifdef QWS
if ( !iface )
{
QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
return;
}
if ( sniffing )
{
QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) );
return;
}
qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s",
(const char*) iface->name(),
(const char*) type,
(const char*) essid,
channel,
(const char*) macaddr );
QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
int count = 3;
- qDebug("sending %d messages",count);
+ odebug << "sending " << count << " messages" << oendl;
msg << QString("count") << QString::number(count);
- qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() );
+ odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl;
msg << QString(iface->name()) << QString("Mode") << type;
- qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1());
+ odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl;
msg << QString(iface->name()) << QString("ESSID") << essid;
- qDebug("msg >%s< channel >%d<", iface->name(),channel);
+ odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl;
msg << QString(iface->name()) << QString("Channel") << channel;
-// qDebug("msg >%s< mac >%s<", iface->name(),macaddr);
+// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl;
// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
#else
QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
#endif
}