author | chicken <chicken> | 2004-03-02 16:24:30 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-03-02 16:24:30 (UTC) |
commit | 10d627d55eaab6cda26b03879f1b0fe31d1b273b (patch) (side-by-side diff) | |
tree | eb04a35ba5e359eb808bf0bd85b1be51dcb4b0a9 | |
parent | 49bee7ab52b819a07e9b6de4576eda467d632a66 (diff) | |
download | opie-10d627d55eaab6cda26b03879f1b0fe31d1b273b.zip opie-10d627d55eaab6cda26b03879f1b0fe31d1b273b.tar.gz opie-10d627d55eaab6cda26b03879f1b0fe31d1b273b.tar.bz2 |
fix includes
23 files changed, 1 insertions, 51 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 32a96ff..e925d8d 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp @@ -1,100 +1,99 @@ #include "accountitem.h" #include "accountview.h" -#include "selectstore.h" #include "newmaildir.h" #include "defines.h" /* OPIE */ #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> #include <libmailwrapper/mailwrapper.h> #include <qpe/qpeapplication.h> /* QT */ #include <qpopupmenu.h> #include <qmessagebox.h> #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} /** * POP3 Account stuff */ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) : AccountViewItem( parent ) { account = a; wrapper = AbstractMail::getWrapper( account ); SETPIX(PIXMAP_POP3FOLDER); #if 0 if (!account->getOffline()) { setPixmap( 0, ); } else { setPixmap( 0, PIXMAP_OFFLINE ); } #endif setText( 0, account->getAccountName() ); setOpen( true ); } POP3viewItem::~POP3viewItem() { delete wrapper; } AbstractMail *POP3viewItem::getWrapper() { return wrapper; } void POP3viewItem::refresh( QList<RecMail> & ) { refresh(); } void POP3viewItem::refresh() { if (account->getOffline()) return; QList<Folder> *folders = wrapper->listFolders(); QListViewItem *child = firstChild(); while ( child ) { QListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } Folder *it; QListViewItem*item = 0; for ( it = folders->first(); it; it = folders->next() ) { item = new POP3folderItem( it, this , item ); item->setSelectable(it->may_select()); } // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! folders->setAutoDelete(false); delete folders; } RecBody POP3viewItem::fetchBody( const RecMail &mail ) { qDebug( "POP3 fetchBody" ); 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); } } diff --git a/noncore/net/mail/addresspicker.cpp b/noncore/net/mail/addresspicker.cpp index 35f9cd4..50c82e5 100644 --- a/noncore/net/mail/addresspicker.cpp +++ b/noncore/net/mail/addresspicker.cpp @@ -1,111 +1,109 @@ #include "composemail.h" /* OPIE */ #include <opie2/ocontactaccess.h> #include <opie2/opimcontact.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> /* QT */ #include <qpushbutton.h> #include <qmessagebox.h> -#include <qtextstream.h> #include <qlistbox.h> -#include <qfile.h> /* STD */ #include <stdlib.h> AddressPicker::AddressPicker( QWidget *parent, const char *name, bool modal, WFlags flags ) : AddressPickerUI( parent, name, modal, flags ) { okButton->setIconSet( Resource::loadPixmap( "enter" ) ); cancelButton->setIconSet( Resource::loadPixmap( "editdelete" ) ); connect(okButton, SIGNAL(clicked()), SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), SLOT(close())); Opie::OPimContactAccess::List::Iterator it; QString lineEmail, lineName, contactLine; /* what name has to set here???? */ Opie::OPimContactAccess m_contactdb("opiemail"); QStringList mails; QString pre,suf; Opie::OPimContactAccess::List m_list = m_contactdb.sorted( true, 0, 0, 0 ); for ( it = m_list.begin(); it != m_list.end(); ++it ) { if ((*it).defaultEmail().length()!=0) { mails = (*it).emailList(); if ((*it).fileAs().length()>0) { pre = "\""+(*it).firstName()+" "+(*it).lastName()+"\" <"; suf = ">"; } else { pre = ""; suf = ""; } QStringList::ConstIterator sit = mails.begin(); for (;sit!=mails.end();++sit) { contactLine=pre+(*sit)+suf; addressList->insertItem(contactLine); } } } if ( addressList->count() <= 0 ) { #if 0 // makes this realy sense?? addressList->insertItem( tr( "There are no entries in the addressbook." ) ); #endif addressList->setEnabled( false ); okButton->setEnabled( false ); } else { // addressList->sort(); } } void AddressPicker::accept() { QListBoxItem *item = addressList->firstItem(); QString names; while ( item ) { if ( item->selected() ) names += item->text() + ", "; item = item->next(); } names.replace( names.length() - 2, 2, "" ); if ( names.isEmpty() ) { QMessageBox::information(this, tr("Error"), tr("<p>You have to select" " at least one address entry.</p>"), tr("Ok")); return; } selectedNames = names; QDialog::accept(); } QString AddressPicker::getNames() { QString names = 0; AddressPicker picker(0, 0, true); int ret = QPEApplication::execDialog( &picker ); if ( QDialog::Accepted == ret ) { return picker.selectedNames; } diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 741a8e1..9960f88 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp @@ -1,105 +1,103 @@ #include "abstractmail.h" #include "imapwrapper.h" #include "pop3wrapper.h" #include "nntpwrapper.h" #include "mhwrapper.h" -#include "mboxwrapper.h" #include "mailtypes.h" -#include <qstring.h> #include <qfile.h> #include <qtextstream.h> #include <stdlib.h> #include <libetpan/mailmime_content.h> #include <libetpan/mailmime.h> AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) { return new IMAPwrapper(a); } AbstractMail* AbstractMail::getWrapper(POP3account *a) { return new POP3wrapper(a); } AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) { return new NNTPwrapper(a); } AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) { return new MHwrapper(a,name); } encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) { qDebug("Decode string start"); 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"); return result; } QString AbstractMail::convert_String(const char*text) { size_t index = 0; char*res = 0; /* attention - doesn't work with arm systems! */ int err = mailmime_encoded_phrase_parse("iso-8859-1", text, strlen(text),&index, "iso-8859-1",&res); if (err != MAILIMF_NO_ERROR) { if (res) free(res); return QString(text); } if (res) { QString result(res); free(res); return result; } return QString(text); } /* 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 Folder*,const QString& delemiter,bool) { return 0; } QString AbstractMail::defaultLocalfolder() { QString f = getenv( "HOME" ); diff --git a/noncore/net/mail/libmailwrapper/sendmailprogress.cpp b/noncore/net/mail/libmailwrapper/sendmailprogress.cpp index ef22750..dc0c75a 100644 --- a/noncore/net/mail/libmailwrapper/sendmailprogress.cpp +++ b/noncore/net/mail/libmailwrapper/sendmailprogress.cpp @@ -1,48 +1,47 @@ #include "sendmailprogress.h" #include <qprogressbar.h> #include <qlabel.h> -#include <qstring.h> progressMailSend::progressMailSend(QWidget*parent, const char * name) :progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0) { } progressMailSend::~progressMailSend() { } void progressMailSend::setMaxMails(unsigned int aMaxMails) { m_max_mail = aMaxMails; allMailProgressBar->setTotalSteps(aMaxMails); setMails(); } void progressMailSend::setCurrentMails(unsigned int aCurrent) { m_current_mail = aCurrent; allMailProgressBar->setProgress(aCurrent); setMails(); } void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax) { m_current_single = aCurrent; m_max_single = aMax; setSingle(); } void progressMailSend::setSingle() { QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single); singleMailLabel->setText(text); singleMailProgressBar->setTotalSteps(m_max_single); singleMailProgressBar->setProgress(m_current_single); } void progressMailSend::setMails() { QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_mail+1).arg(m_max_mail); allMailLabel->setText(text); } diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index d75d52a..d7a005e 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -1,105 +1,103 @@ #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <fcntl.h> #include <string.h> -#include <qdir.h> #include <qt.h> -#include <qmessagebox.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <libetpan/libetpan.h> #include "smtpwrapper.h" #include "mailwrapper.h" #include "abstractmail.h" #include "logindialog.h" #include "mailtypes.h" #include "sendmailprogress.h" const char* SMTPwrapper::USER_AGENT="OpieMail v0.4"; progressMailSend*SMTPwrapper::sendProgress = 0; SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) : QObject() { m_SmtpAccount = aSmtp; Config cfg( "mail" ); cfg.setGroup( "Status" ); m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); emit queuedMails( m_queuedMail ); connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); m_smtp = 0; } SMTPwrapper::~SMTPwrapper() { disc_server(); } void SMTPwrapper::emitQCop( int queued ) { QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); env << queued; } QString SMTPwrapper::mailsmtpError( int errnum ) { switch ( errnum ) { case MAILSMTP_NO_ERROR: return tr( "No error" ); case MAILSMTP_ERROR_UNEXPECTED_CODE: return tr( "Unexpected error code" ); case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: return tr( "Service not available" ); case MAILSMTP_ERROR_STREAM: return tr( "Stream error" ); case MAILSMTP_ERROR_HOSTNAME: return tr( "gethostname() failed" ); case MAILSMTP_ERROR_NOT_IMPLEMENTED: return tr( "Not implemented" ); case MAILSMTP_ERROR_ACTION_NOT_TAKEN: return tr( "Error, action not taken" ); case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: return tr( "Data exceeds storage allocation" ); case MAILSMTP_ERROR_IN_PROCESSING: return tr( "Error in processing" ); case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: return tr( "Starttls not supported" ); // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: // return tr( "Insufficient system storage" ); case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: return tr( "Mailbox unavailable" ); case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: return tr( "Mailbox name not allowed" ); case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: return tr( "Bad command sequence" ); case MAILSMTP_ERROR_USER_NOT_LOCAL: return tr( "User not local" ); case MAILSMTP_ERROR_TRANSACTION_FAILED: return tr( "Transaction failed" ); case MAILSMTP_ERROR_MEMORY: return tr( "Memory error" ); case MAILSMTP_ERROR_CONNECTION_REFUSED: return tr( "Connection refused" ); default: return tr( "Unknown error code" ); } } mailimf_mailbox *SMTPwrapper::newMailbox(const QString&name, const QString&mail ) { return mailimf_mailbox_new( strdup( name.latin1() ), strdup( mail.latin1() ) ); } mailimf_address_list *SMTPwrapper::parseAddresses(const QString&addr ) { mailimf_address_list *addresses; if ( addr.isEmpty() ) return NULL; addresses = mailimf_address_list_new_empty(); bool literal_open = false; diff --git a/noncore/net/mail/libmailwrapper/statusmail.cpp b/noncore/net/mail/libmailwrapper/statusmail.cpp index 172c58f..4134e79 100644 --- a/noncore/net/mail/libmailwrapper/statusmail.cpp +++ b/noncore/net/mail/libmailwrapper/statusmail.cpp @@ -1,91 +1,90 @@ #include "statusmail.h" -#include <qlist.h> StatusMail::StatusMail(QList<Account>&list) { currentImapStat.message_count=0; currentImapStat.message_unseen=0; currentImapStat.message_recent=0; lastPop3Stat = currentImapStat; currentPop3Stat = currentImapStat; connectionList.setAutoDelete(true); connectionList.clear(); initAccounts(list); } StatusMail::~StatusMail() { } 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().compare( "IMAP" ) == 0 && !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().compare( "POP3" ) == 0 && !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); 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().lower()=="imap") { currentImapStat.message_unseen+=currentStat.message_unseen; currentImapStat.message_recent+=currentStat.message_recent; currentImapStat.message_count+=currentStat.message_count; } else if (it->getType().lower()=="pop3") { currentPop3Stat.message_count+=currentStat.message_count; qDebug("Pop3 count: %i",currentPop3Stat.message_count); } } qDebug("Pop3 last: %i",lastPop3Stat.message_count); 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/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 3f34fe7..bcf0866 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -1,105 +1,103 @@ #include <qlabel.h> #include <qvbox.h> #include <qheader.h> #include <qtimer.h> #include <qlayout.h> -#include <qmessagebox.h> #include <qpe/qpeapplication.h> -#include <qpe/resource.h> #include "defines.h" #include "mainwindow.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name, flags ) { setCaption( tr( "Mail" ) ); setToolBarsMovable( false ); toolBar = new QToolBar( this ); menuBar = new QMenuBar( toolBar ); mailMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Mail" ), mailMenu ); settingsMenu = new QPopupMenu( menuBar ); menuBar->insertItem( tr( "Settings" ), settingsMenu ); addToolBar( toolBar ); toolBar->setHorizontalStretchable( true ); QLabel *spacer = new QLabel( toolBar ); spacer->setBackgroundMode( QWidget::PaletteButton ); toolBar->setStretchableWidget( spacer ); composeMail = new QAction( tr( "Compose new mail" ), ICON_COMPOSEMAIL, 0, 0, this ); composeMail->addTo( toolBar ); composeMail->addTo( mailMenu ); sendQueued = new QAction( tr( "Send queued mails" ), ICON_SENDQUEUED, 0, 0, this ); sendQueued->addTo( toolBar ); sendQueued->addTo( mailMenu ); /* syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 0, 0, this ); syncFolders->addTo( toolBar ); syncFolders->addTo( mailMenu ); */ showFolders = new QAction( tr( "Show/Hide folders" ), ICON_SHOWFOLDERS, 0, 0, this, 0, true ); showFolders->addTo( toolBar ); showFolders->addTo( mailMenu ); showFolders->setOn( true ); connect(showFolders, SIGNAL( toggled(bool) ), SLOT( slotShowFolders(bool) ) ); /* searchMails = new QAction( tr( "Search mails" ), QIconSet( Resource::loadPixmap("find") ), 0, 0, this ); searchMails->addTo( toolBar ); searchMails->addTo( mailMenu ); */ deleteMails = new QAction(tr("Delete Mail"), QIconSet( Resource::loadPixmap("trash")), 0, 0, this); deleteMails->addTo( toolBar ); deleteMails->addTo( mailMenu ); connect( deleteMails, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); editSettings = new QAction( tr( "Edit settings" ), QIconSet( Resource::loadPixmap("SettingsIcon") ) , 0, 0, this ); editSettings->addTo( settingsMenu ); connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); editAccounts = new QAction( tr( "Configure accounts" ), QIconSet( Resource::loadPixmap("mail/editaccounts") ) , 0, 0, this ); editAccounts->addTo( settingsMenu ); //setCentralWidget( view ); QVBox* wrapperBox = new QVBox( this ); setCentralWidget( wrapperBox ); QWidget *view = new QWidget( wrapperBox ); layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); folderView = new AccountView( view ); folderView->header()->hide(); folderView->setRootIsDecorated( true ); folderView->addColumn( tr( "Mailbox" ) ); layout->addWidget( folderView ); mailView = new QListView( view ); mailView->addColumn( tr( "" ) ); mailView->addColumn( tr( "Subject" ),QListView::Manual ); mailView->addColumn( tr( "Sender" ),QListView::Manual ); mailView->addColumn( tr( "Size" ),QListView::Manual); mailView->addColumn( tr( "Date" )); mailView->setAllColumnsShowFocus(true); diff --git a/noncore/net/mail/newmaildir.cpp b/noncore/net/mail/newmaildir.cpp index ab0d4e3..e6e9dc7 100644 --- a/noncore/net/mail/newmaildir.cpp +++ b/noncore/net/mail/newmaildir.cpp @@ -1,38 +1,36 @@ #include "newmaildir.h" -#include <qdialog.h> -#include <qvariant.h> #include <qlineedit.h> #include <qcheckbox.h> Newmdirdlg::Newmdirdlg( QWidget* parent, const char* name,bool no_sub) : Newmdirdlgui(parent,name,true),ndir(""),possible_subs(false) { if (no_sub) { subdirsPossibleBox->setChecked(false); subdirsPossibleBox->hide(); } } Newmdirdlg::~Newmdirdlg() { } void Newmdirdlg::accept() { ndir = dirnameEdit->text(); possible_subs = subdirsPossibleBox->isChecked(); if (ndir.isEmpty()) { return; } Newmdirdlgui::accept(); } const QString&Newmdirdlg::Newdir()const { return ndir; } const bool Newmdirdlg::subpossible()const { return possible_subs; } diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index abf93dc..6bfc824 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -1,118 +1,114 @@ #include "settingsdialog.h" #include "opiemail.h" #include "editaccounts.h" #include "composemail.h" #include "mailistviewitem.h" #include "viewmail.h" #include "selectstore.h" #include "selectsmtp.h" /* OPIE */ #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> -#include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> /* QT */ -#include <qmessagebox.h> -#include <qaction.h> -#include <qapplication.h> OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) : MainWindow( parent, name, WStyle_ContextHelp ) { settings = new Settings(); folderView->populate( settings->getAccounts() ); } OpieMail::~OpieMail() { if (settings) delete settings; } void OpieMail::appMessage(const QCString &msg, const QByteArray &data) { // copied from old mail2 if (msg == "writeMail(QString,QString)") { QDataStream stream(data,IO_ReadOnly); QString name, email; stream >> name >> email; // removing the whitespaces at beginning and end is needed! slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); } else if (msg == "newMail()") { 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" ); slotwriteMail(0l,0l); } void OpieMail::slotSendQueued() { qDebug( "Send Queued" ); 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().compare( "SMTP" ) == 0 ) { 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() ) { diff --git a/noncore/net/mail/selectsmtp.cpp b/noncore/net/mail/selectsmtp.cpp index 79b10ef..82e8a0b 100644 --- a/noncore/net/mail/selectsmtp.cpp +++ b/noncore/net/mail/selectsmtp.cpp @@ -1,62 +1,55 @@ #include "selectsmtp.h" #include <libmailwrapper/mailwrapper.h> -#include <qlist.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qcheckbox.h> -#include <qframe.h> -#include <qlineedit.h> -#include <qcombobox.h> selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl) : selectstoreui(parent,name,modal,fl) { //m_smtpList.setAutoDelete(false); m_smtpList = 0; //headlabel->setText(tr("<center>Select SMTP account to use</center>")); headlabel->hide(); folderSelection->hide(); folderLabel->hide(); accountlabel->setText("<center>SMTP Accounts</center>"); Line1->hide(); newFoldersel->hide(); newFolderedit->hide(); newFolderLabel->hide(); Line2->hide(); selMove->hide(); m_current_smtp = 0; setCaption(tr("Select SMTP Account")); } selectsmtp::~selectsmtp() { } void selectsmtp::slotAccountselected(int which) { if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) { m_current_smtp = 0; return; } m_current_smtp = m_smtpList->at(which); } void selectsmtp::setSelectionlist(QList<SMTPaccount>*list) { m_smtpList = list; accountSelection->clear(); if (!m_smtpList || m_smtpList->count()==0) { accountSelection->setEnabled(false); return; } accountSelection->setEnabled(true); for (unsigned i = 0; m_smtpList!=0 && i < m_smtpList->count(); ++i) { accountSelection->insertItem( m_smtpList->at(i)->getAccountName()); } m_current_smtp = m_smtpList->at(0); } SMTPaccount*selectsmtp::selected_smtp() { return m_current_smtp; } diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 8636957..ec93f8d 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp @@ -1,118 +1,115 @@ #include "composemail.h" #include "viewmail.h" -#include "accountview.h" /* OPIE */ #include <libmailwrapper/settings.h> #include <libmailwrapper/abstractmail.h> #include <libmailwrapper/mailtypes.h> #include <opie2/ofiledialog.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> /* QT */ #include <qtextbrowser.h> #include <qmessagebox.h> #include <qtextstream.h> #include <qaction.h> #include <qpopupmenu.h> #include <qfile.h> -#include <qapplication.h> -#include <qvaluelist.h> AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, const QString&fsize,int num,const QValueList<int>&path) : QListViewItem(parent,after),_partNum(num) { _path=path; setText(0, mime); setText(1, desc); setText(2, file); setText(3, fsize); } AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, const QString&fsize,int num,const QValueList<int>&path) : QListViewItem(parent,after),_partNum(num) { _path=path; setText(0, mime); setText(1, desc); setText(2, file); setText(3, fsize); } bool AttachItem::isParentof(const QValueList<int>&path) { /* if not set, then no parent */ if (path.count()==0||_path.count()==0) return false; /* the parent must have one digit less then a child */ if (path.count()!=_path.count()+1) return false; for (unsigned int i=0; i < _path.count();++i) { if (_path[i]!=path[i]) return false; } return true; } AttachItem* ViewMail::searchParent(const QValueList<int>&path) { QListViewItemIterator it( attachments ); for ( ; it.current(); ++it ) { AttachItem*ati = (AttachItem*)it.current(); if (ati->isParentof(path)) return ati; } return 0; } AttachItem* ViewMail::lastChild(AttachItem*parent) { if (!parent) return 0; AttachItem* item = (AttachItem*)parent->firstChild(); if (!item) return item; AttachItem*temp=0; while( (temp=(AttachItem*)item->nextSibling())) { item = temp; } return item; } void ViewMail::setBody( RecBody body ) { m_body = body; m_mail[2] = body.Bodytext(); attachbutton->setEnabled(body.Parts().count()>0); attachments->setEnabled(body.Parts().count()>0); if (body.Parts().count()==0) { return; } AttachItem * curItem=0; AttachItem * parentItem = 0; QString type=body.Description().Type()+"/"+body.Description().Subtype(); QString desc,fsize; double s = body.Description().Size(); int w; w=0; while (s>1024) { s/=1024; ++w; if (w>=2) break; } QString q=""; switch(w) { case 1: q="k"; break; case 2: q="M"; break; default: diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp index 7f1d8a0..c2bf08c 100644 --- a/noncore/net/mail/viewmailbase.cpp +++ b/noncore/net/mail/viewmailbase.cpp @@ -1,90 +1,89 @@ #include <qtextbrowser.h> #include <qlistview.h> #include <qaction.h> #include <qlabel.h> #include <qvbox.h> -#include <qpopupmenu.h> #include <qpe/qpetoolbar.h> #include <qmenubar.h> #include <qpe/resource.h> #include "viewmailbase.h" //#include "opendiag.h" ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { setCaption(tr("E-Mail by %1")); setToolBarsMovable(false); toolbar = new QToolBar(this); menubar = new QMenuBar( toolbar ); mailmenu = new QPopupMenu( menubar ); menubar->insertItem( tr( "Mail" ), mailmenu ); toolbar->setHorizontalStretchable(true); addToolBar(toolbar); QLabel *spacer = new QLabel(toolbar); spacer->setBackgroundMode(QWidget::PaletteButton); toolbar->setStretchableWidget(spacer); reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this); reply->addTo(toolbar); reply->addTo(mailmenu); forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this); forward->addTo(toolbar); forward->addTo(mailmenu); attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); attachbutton->addTo(toolbar); attachbutton->addTo(mailmenu); connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/html" ) ), 0, 0, this, 0, true ); showHtml->addTo( toolbar ); showHtml->addTo( mailmenu ); deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("trash")), 0, 0, this); deleteMail->addTo(toolbar); deleteMail->addTo(mailmenu); QVBox *view = new QVBox(this); setCentralWidget(view); attachments = new QListView(view); attachments->setMinimumHeight(90); attachments->setMaximumHeight(90); attachments->setAllColumnsShowFocus(true); attachments->addColumn("Mime Type", 60); attachments->addColumn(tr("Description"), 100); attachments->addColumn(tr("Filename"), 80); attachments->addColumn(tr("Size"), 80); attachments->setSorting(-1); attachments->hide(); browser = new QTextBrowser(view); // openDiag = new OpenDiag(view); // openDiag->hide(); } void ViewMailBase::slotChangeAttachview(bool state) { if (state) attachments->show(); else attachments->hide(); } void ViewMailBase::keyPressEvent ( QKeyEvent * e ) { if( e->key()==Qt::Key_Escape ) { close(); e->accept(); return; } QWidget::keyPressEvent(e); } diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index b76b397..817936d 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp @@ -1,132 +1,131 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> .>+-= _;:, .> :=|. This library is free software; you can .> <, > . <= redistribute it and/or modify it under :=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%+i> _;_. .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=| MERCHANTABILITY or FITNESS FOR A _.=:. : :=>: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. . .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-= this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bluezapplet.h" #include <qapplication.h> -#include <qpe/resource.h> #include <qpe/qcopenvelope_qws.h> -#include <qpe/resource.h> #include <qpe/config.h> +#include <qpe/resource.h> #include <opie/odevice.h> #include <qpoint.h> #include <qpainter.h> #include <qlayout.h> #include <qframe.h> #include <qpixmap.h> #include <qstring.h> #include <qtimer.h> #include <qpopupmenu.h> #include <device.h> using namespace Opie; namespace OpieTooth { BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { setFixedHeight( 18 ); setFixedWidth( 14 ); bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); startTimer(4000); btDevice = 0; bluezactive = false; bluezDiscoveryActive = false; } BluezApplet::~BluezApplet() { if ( btDevice ) { delete btDevice; } } bool BluezApplet::checkBluezStatus() { if (btDevice) { if (btDevice->isLoaded() ) { return true; } else { return false; } } else { return false; } } int BluezApplet::setBluezStatus(int c) { if ( c == 1 ) { switch ( ODevice::inst()->model() ) { case Model_iPAQ_H39xx: btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); break; case Model_iPAQ_H5xxx: btDevice = new Device( "/dev/tts/1", "any", "921600" ); break; default: btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); break; } } else { if ( btDevice ) { delete btDevice; btDevice = 0; } } return 0; } int BluezApplet::checkBluezDiscoveryStatus() { } int BluezApplet::setBluezDiscoveryStatus(int d) { } void BluezApplet::mousePressEvent( QMouseEvent *) { QPopupMenu *menu = new QPopupMenu(); QPopupMenu *signal = new QPopupMenu(); int ret=0; /* Refresh active state */ timerEvent( 0 ); if (bluezactive) { menu->insertItem( tr("Disable Bluetooth"), 0 ); } else { menu->insertItem( tr("Enable Bluetooth"), 1 ); } diff --git a/noncore/net/opietooth/blue-pin/main.cc b/noncore/net/opietooth/blue-pin/main.cc index 1b7daec..aa360aa 100644 --- a/noncore/net/opietooth/blue-pin/main.cc +++ b/noncore/net/opietooth/blue-pin/main.cc @@ -1,39 +1,38 @@ #include <stdio.h> #include <stdlib.h> #include <qpe/qpeapplication.h> -#include <qpe/config.h> #include "pindlg.h" int main( int argc, char* argv[] ) { if (argc < 2 ) { printf("ERR\n"); exit(0); } QCString dir(argv[1] ); QCString bdaddr( argv[2] ); QCString name; if ( argc > 3 ) { name = argv[3]; } QPEApplication a(argc, argv ); QString status; if (dir == "out" ) { status = QObject::tr("Outgoing connection to "); }else status = QObject::tr("Incoming connection from "); status += name; status += "<br>"; status += "[" + bdaddr + "]"; OpieTooth::PinDlg dlg( status, bdaddr ); if ( dlg.exec() ) { printf("PIN:%s\n", dlg.pin().stripWhiteSpace().latin1() ); }else printf("ERR\n"); return 0; } diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc index 9418a20..f0b2309 100644 --- a/noncore/net/opietooth/blue-pin/pindlg.cc +++ b/noncore/net/opietooth/blue-pin/pindlg.cc @@ -1,65 +1,64 @@ #include "pindlg.h" /* OPIE */ #include <qpe/config.h> #include <qpe/qpeapplication.h> /* QT */ #include <qcheckbox.h> #include <qlabel.h> #include <qlineedit.h> -#include <qtimer.h> /* STD */ #include <stdio.h> using namespace OpieTooth; PinDlg::PinDlg( const QString& status, const QString& mac, QWidget* parent, const char* name ) : PinDlgBase( parent, name, WType_Modal ) { m_mac = mac; test( mac ); txtStatus->setText(status); QPEApplication::showDialog( this ); } PinDlg::~PinDlg() {} void PinDlg::setMac( const QString& mac ) { txtStatus->setText( mac ); } QString PinDlg::pin() const { return lnePin->text(); } void PinDlg::test( const QString& mac ) { if (!mac.isEmpty() ) { Config cfg("bluepin"); cfg.setGroup(mac); lnePin->setText(cfg.readEntryCrypt("pin", QString::null ) ); if ( !lnePin->text().isEmpty() ) { //QTimer::singleShot(100, this, SLOT(accept() ) ); } } } void PinDlg::accept() { if ( ckbPin->isChecked() ) { Config cfg("bluepin"); cfg.setGroup(m_mac ); cfg.writeEntryCrypt("pin", lnePin->text() ); } QDialog::accept(); } diff --git a/noncore/net/opietooth/manager/bticonloader.cpp b/noncore/net/opietooth/manager/bticonloader.cpp index e5d8092..6bac256 100644 --- a/noncore/net/opietooth/manager/bticonloader.cpp +++ b/noncore/net/opietooth/manager/bticonloader.cpp @@ -1,79 +1,78 @@ #include "bticonloader.h" -#include <qpixmap.h> #include <qpe/resource.h> namespace OpieTooth { BTIconLoader::BTIconLoader() { // still need to find out real ids deviceIcons.insert( 100 , "computer_16" ); deviceIcons.insert( 101 , "phone_16" ); deviceIcons.insert( 102 , "brain_16" ); deviceIcons.insert( 103 , "conduit_16" ); serviceIcons.insert( 4357 , "obex_16" ); //OBEXObjectPush serviceIcons.insert( 4358 , "obex_16" ); //OBEXFileTransfer serviceIcons.insert( 4369 , "print_16" ); //Fax serviceIcons.insert( 4353 , "serial_16" ); //SerialPort serviceIcons.insert( 4356 , "sync_16" ); //IrMCSync serviceIcons.insert( 4359 , "sync_16" ); //IrMCSyncCommand serviceIcons.insert( 4354 , "network_16" ); //LANAccessUsingPPP serviceIcons.insert( 4355 , "network_16"); //DialupNetworking serviceIcons.insert( 4360 , "phone_16"); // Headset serviceIcons.insert( 4370 , "audio_16"); //HeadsetAudioGateway serviceIcons.insert( 4374 , "network_16"); // Network Access Point serviceIcons.insert( 4361 , "phone_16"); // CordlessTelephony serviceIcons.insert( 4362 , "audio_16"); // AudioSource serviceIcons.insert( 4363 , "audio_16"); // AudioSink serviceIcons.insert( 4390 , "print_16" ); //HCR_Print serviceIcons.insert( 4392 , "phone_16" ); //Common_ISDN_Access serviceIcons.insert( 4609 , "network_16" ); //GenericNetworking serviceIcons.insert( 4610 , "folder_16" ); //GenericFileTransfer serviceIcons.insert( 4392 , "audio_16" ); //GenericAudio // serviceIcons.insert( 4392 , "phone_16" ); //GenericTelephony // the above is duplicated? -zecke //serviceIcons.insert( "106" , "link_16" ); //serviceIcons.insert( "107" , "misc_16" ); } BTIconLoader::~BTIconLoader() { } QPixmap BTIconLoader::deviceIcon( int deviceClass ) { QString iconName; QMap<int, QString>::Iterator it; it = deviceIcons.find( deviceClass ); iconName = it.data(); if ( iconName.isEmpty() ) { iconName = "unknown_16"; } return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); } QPixmap BTIconLoader::serviceIcon( int serviceClass ) { QString iconName; QMap<int, QString>::Iterator it; it = serviceIcons.find( serviceClass ); iconName = it.data(); if ( iconName.isEmpty() ) { iconName = "unknown_16"; } return( Resource::loadPixmap( "opietooth/icons/" + iconName ) ); } } diff --git a/noncore/net/opietooth/manager/btserviceitem.cpp b/noncore/net/opietooth/manager/btserviceitem.cpp index 7db93c9..fb5f21e 100644 --- a/noncore/net/opietooth/manager/btserviceitem.cpp +++ b/noncore/net/opietooth/manager/btserviceitem.cpp @@ -1,26 +1,25 @@ -#include <qobject.h> #include "btserviceitem.h" using namespace OpieTooth; BTServiceItem::BTServiceItem( QListViewItem* item, const Services& serv ) : BTListItem( item ) { m_service = serv; setText(0, QObject::tr(serv.serviceName() ) ); } BTServiceItem::~BTServiceItem() { } QString BTServiceItem::type() const { return QString::fromLatin1("service"); } int BTServiceItem::typeId() const { return Service; } Services BTServiceItem::services() const { return m_service; } int BTServiceItem::serviceId() const { return m_service.recHandle(); }; diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index 46eed42..35e9cd9 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp @@ -1,101 +1,100 @@ #include "hciconfwrapper.h" #include <qfile.h> #include <qtextstream.h> -#include <qstringlist.h> #include <qregexp.h> namespace OpieTooth { HciConfWrapper::HciConfWrapper( const QString &fileName) { m_fileName = fileName; } HciConfWrapper::~HciConfWrapper() { } void HciConfWrapper::setPinHelper( const QString& app ) { setValue( "pin_helper" , app ); } void HciConfWrapper::setName( const QString &name ) { qDebug ("NAME : " + name); setValue( "name" , "\"" + name + "\"" ); } void HciConfWrapper::setIscan( bool enable) { if ( enable ) { setValue( "iscan" , "enable" ); } else { setValue( "iscan" , "disable" ); } } void HciConfWrapper::setPscan( bool enable) { if ( enable ) { setValue( "pscan" , "enable" ); } else { setValue( "pscan" , "disable" ); } } void HciConfWrapper::setAuth( bool enable) { if ( enable ) { setValue( "auth" , "enable" ); } else { setValue( "auth" , "disable" ); } } 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"); // still need to look if its commented out!!! str.simplifyWhiteSpace(); qDebug( key ); if (str.startsWith("#")) { str = (key + " " + value + ";"); } else { str = str.replace( QRegExp( "\\s*"+key+"\\s+[^\\s][^;]*;" ), key + " " + value + ";"); } qDebug( str ); 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() { diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp index 1e7130f..a41f304 100644 --- a/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp +++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp @@ -1,54 +1,53 @@ #include "rfcommassigndialogitem.h" #include <qlineedit.h> #include <qcombobox.h> -#include <qlabel.h> #include <qgroupbox.h> using namespace OpieTooth; RfcommDialogItem::RfcommDialogItem( QWidget* parent, const char* name, WFlags fl ) : RfcommDialogItemBase( parent, name, fl ) { } RfcommDialogItem::~RfcommDialogItem() { } int RfcommDialogItem::ident() { return m_ident; } QString RfcommDialogItem::mac() { return m_macAddress->text(); } int RfcommDialogItem::channel() { return m_channelDropdown->currentItem(); } QString RfcommDialogItem::comment() { return m_commentLine->text(); } void RfcommDialogItem::setIdent( int ident ) { m_ident = ident; m_identLabel->setTitle( QString( "rfcomm%1").arg( ident ) ); } void RfcommDialogItem::setMac( const QString &mac ) { m_macAddress->setText( mac ); } void RfcommDialogItem::setChannel( int channel ) { m_channelDropdown->setCurrentItem( channel ); } void RfcommDialogItem::setComment( const QString &comment ) { m_commentLine->setText( comment ); } diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp index daca095..ed22bdd 100644 --- a/noncore/net/wellenreiter/gui/protolistview.cpp +++ b/noncore/net/wellenreiter/gui/protolistview.cpp @@ -1,122 +1,118 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** 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 "protolistview.h" #include <qcheckbox.h> #include <qcombobox.h> -#include <qhbox.h> #include <qvbox.h> -#include <qpalette.h> -#include <qcolor.h> #include <qlabel.h> -#include <qframe.h> ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f ) :QScrollView( parent, name, f ) { parse = ( QString( "parsePackets" ) == QString( name ) ); setMargins( 3, 3, 0, 0 ); viewport()->setBackgroundColor( QCheckBox(0).palette().color( QPalette::Active, QColorGroup::Background ) ); vbox = new QVBox( viewport() ); vbox->setSpacing( 1 ); addChild( vbox ); QHBox* hbox = new QHBox( vbox ); hbox->setSpacing( 40 ); new QLabel( tr( "Protocol Family" ), hbox ); new QLabel( tr( "Perform Action" ), hbox ); QFrame* frame = new QFrame( vbox ); frame->setFrameStyle( QFrame::HLine + QFrame::Sunken ); //TODO: hardcoded for now...a protocol database would be nice!? //addProtocol( "Ethernet" ); addProtocol( "Prism" ); //addProtocol( "802.11" ); addProtocol( "802.11 Management" ); addProtocol( "802.11 SSID" ); addProtocol( "802.11 Rates" ); addProtocol( "802.11 CF" ); addProtocol( "802.11 FH" ); addProtocol( "802.11 DS" ); addProtocol( "802.11 Tim" ); addProtocol( "802.11 IBSS" ); addProtocol( "802.11 Challenge" ); addProtocol( "802.11 Data" ); addProtocol( "802.11 LLC" ); addProtocol( "802.11 Data" ); addProtocol( "IP" ); addProtocol( "ARP" ); addProtocol( "UDP" ); addProtocol( "TCP" ); } ProtocolListView::~ProtocolListView() { } void ProtocolListView::addProtocol( const QString& name ) { QHBox* hbox = new QHBox( vbox ); new QCheckBox( name, hbox, (const char*) name ); if ( parse ) { QComboBox* combo = new QComboBox( hbox, (const char*) name ); #ifdef QWS combo->setFixedWidth( 75 ); #endif combo->insertItem( "Pass" ); combo->insertItem( "Discard!" ); combo->insertItem( "TouchSound" ); combo->insertItem( "AlarmSound" ); combo->insertItem( "KeySound" ); combo->insertItem( "LedOn" ); combo->insertItem( "LedOff" ); combo->insertItem( "LogMessage" ); combo->insertItem( "MessageBox" ); } else { QComboBox* combo = new QComboBox( hbox, (const char*) name ); #ifdef QWS combo->setFixedWidth( 75 ); #endif combo->insertItem( "Pass" ); combo->insertItem( "Discard!" ); } } bool ProtocolListView::isProtocolChecked( const QString& name ) { QCheckBox* box = (QCheckBox*) child( (const char*) name ); return ( box && box->isOn() ); } QString ProtocolListView::protocolAction( const QString& name ) { QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); if ( combo ) return combo->currentText(); else return "<unknown>"; diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp index a39bbcc..5e5ddc6 100644 --- a/noncore/net/wellenreiter/gui/resource.cpp +++ b/noncore/net/wellenreiter/gui/resource.cpp @@ -1,50 +1,49 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** 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 "resource.h" #define PIXMAPPATH "/usr/local/share" -#include <qpixmap.h> #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 ); } 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 ); } return QIconSet( pixmap ); }; }; diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index b42f1df..c75f9b1 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -1,119 +1,118 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** 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 <qtextstream.h> #include <qpopupmenu.h> #include <qcheckbox.h> #ifdef QWS #include <qpe/qpeapplication.h> #endif #ifdef QWS #include <qpe/resource.h> #else #include "resource.h" #endif 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; 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 ); addColumn( tr( "Last Seen" ) ); setColumnAlignment( col_lastseen, AlignCenter ); addColumn( tr( "Location" ) ); setColumnAlignment( col_location, AlignCenter ); setRootIsDecorated( true ); setAllColumnsShowFocus( true ); 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" ); OListView::serializeTo( s ); } void MScanListView::serializeFrom( QDataStream& s) { qDebug( "serializing MScanListView" ); OListView::serializeFrom( s ); } void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index c2413dc..b8b6730 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp @@ -1,124 +1,115 @@ /********************************************************************** ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. ** ** This file is part of Opie Environment. ** ** 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 "wellenreiterbase.h" -#include <qheader.h> #include <qlabel.h> -#include <qlistview.h> -#include <qmultilineedit.h> -#include <qpushbutton.h> #include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qimage.h> -#include <qpixmap.h> #include "logwindow.h" #include "hexwindow.h" #include "scanlist.h" #include "statwindow.h" #include "graphwindow.h" #ifdef QWS #include <qpe/resource.h> #include <opie2/otabwidget.h> using namespace Opie; #else #include "resource.h" #include <qtabwidget.h> #endif /* * Constructs a WellenreiterBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { //ani1 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot0" ) ); //ani2 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot90" ) ); //ani3 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot180" ) ); //ani4 = new QPixmap( Resource::loadPixmap( "wellenreiter/networks_rot270" ) ); if ( !name ) setName( "WellenreiterBase" ); resize( 191, 294 ); #ifdef QWS setCaption( tr( "Wellenreiter/Opie" ) ); #else setCaption( tr( "Wellenreiter/X11" ) ); #endif WellenreiterBaseLayout = new QVBoxLayout( this ); WellenreiterBaseLayout->setSpacing( 2 ); WellenreiterBaseLayout->setMargin( 0 ); #ifdef QWS TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global ); #else TabWidget = new QTabWidget( this, "TabWidget" ); #endif ap = new QWidget( TabWidget, "ap" ); apLayout = new QVBoxLayout( ap ); apLayout->setSpacing( 2 ); apLayout->setMargin( 2 ); //--------- NETVIEW TAB -------------- netview = new MScanListView( ap ); apLayout->addWidget( netview ); //--------- GRAPH TAB -------------- graphwindow = new MGraphWindow( TabWidget, "Graph" ); //--------- LOG TAB -------------- logwindow = new MLogWindow( TabWidget, "Log" ); //--------- HEX TAB -------------- hexwindow = new MHexWindow( TabWidget, "Hex" ); //--------- STAT TAB -------------- statwindow = new MStatWindow( TabWidget, "Stat" ); //--------- ABOUT TAB -------------- about = new QWidget( TabWidget, "about" ); aboutLayout = new QGridLayout( about ); aboutLayout->setSpacing( 6 ); aboutLayout->setMargin( 11 ); PixmapLabel1_3_2 = new QLabel( about, "PixmapLabel1_3_2" ); PixmapLabel1_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, PixmapLabel1_3_2->sizePolicy().hasHeightForWidth() ) ); PixmapLabel1_3_2->setFrameShape( QLabel::Panel ); PixmapLabel1_3_2->setFrameShadow( QLabel::Sunken ); PixmapLabel1_3_2->setLineWidth( 2 ); PixmapLabel1_3_2->setMargin( 0 ); PixmapLabel1_3_2->setMidLineWidth( 0 ); PixmapLabel1_3_2->setPixmap( Resource::loadPixmap( "wellenreiter/logo" ) ); PixmapLabel1_3_2->setScaledContents( TRUE ); PixmapLabel1_3_2->setAlignment( int( QLabel::AlignCenter ) ); aboutLayout->addWidget( PixmapLabel1_3_2, 0, 0 ); TextLabel1_4_2 = new QLabel( about, "TextLabel1_4_2" ); QFont TextLabel1_4_2_font( TextLabel1_4_2->font() ); TextLabel1_4_2_font.setFamily( "adobe-helvetica" ); TextLabel1_4_2_font.setPointSize( 10 ); TextLabel1_4_2->setFont( TextLabel1_4_2_font ); |