-rw-r--r-- | noncore/net/mail/accountview.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/defines.h | 6 | ||||
-rw-r--r-- | pics/mail/imapfolder.png | bin | 767 -> 470 bytes | |||
-rw-r--r-- | pics/mail/inbox.png | bin | 616 -> 783 bytes | |||
-rw-r--r-- | pics/mail/localfolder.png | bin | 0 -> 736 bytes | |||
-rw-r--r-- | pics/mail/mboxfolder.png | bin | 0 -> 473 bytes | |||
-rw-r--r-- | pics/mail/outbox.png | bin | 0 -> 769 bytes | |||
-rw-r--r-- | pics/mail/pop3folder.png | bin | 701 -> 520 bytes |
8 files changed, 13 insertions, 5 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 6bc8b8b..59e8bc0 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -54,326 +54,328 @@ RecBody POP3viewItem::fetchBody( const RecMail &mail ) } POP3folderItem::~POP3folderItem() { delete folder; } POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) : AccountViewItem( parent,after ) { folder = folderInit; pop3 = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_POP3FOLDER ); } else { setPixmap( 0, PIXMAP_INBOXFOLDER); } setText( 0, folder->getDisplayName() ); } void POP3folderItem::refresh(QList<RecMail>&target) { if (folder->may_select()) pop3->getWrapper()->listMessages( folder->getName(),target ); } RecBody POP3folderItem::fetchBody(const RecMail&aMail) { return pop3->getWrapper()->fetchBody(aMail); } /** * IMAP Account stuff */ IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) : AccountViewItem( parent ) { account = a; wrapper = AbstractMail::getWrapper( account ); setPixmap( 0, PIXMAP_IMAPFOLDER ); setText( 0, account->getAccountName() ); setOpen( true ); } IMAPviewItem::~IMAPviewItem() { delete wrapper; } AbstractMail *IMAPviewItem::getWrapper() { return wrapper; } IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) { IMAPfolderItem*pitem,*sitem; if (!start) pitem = (IMAPfolderItem*)firstChild(); else pitem = (IMAPfolderItem*)start->firstChild(); while (pitem) { if (pitem->matchName(path)) { break; } if (pitem->childCount()>0) { sitem = findSubItem(path,pitem); if (sitem) { pitem = sitem; break; } } pitem=(IMAPfolderItem*)pitem->nextSibling(); } return pitem; } void IMAPviewItem::refresh(QList<RecMail>&) { if (childCount()>0) return; QList<Folder> *folders = wrapper->listFolders(); QListViewItem *child = firstChild(); while ( child ) { QListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } Folder *it; QListViewItem*item = 0; QListViewItem*titem = 0; QString fname,del,search; int pos; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! folders->setAutoDelete(false); for ( it = folders->first(); it; it = folders->next() ) { if (it->getDisplayName().lower()=="inbox") { item = new IMAPfolderItem( it, this , item ); folders->remove(it); qDebug("inbox found"); break; } } for ( it = folders->first(); it; it = folders->next() ) { fname = it->getDisplayName(); pos = fname.findRev(it->Separator()); if (pos != -1) { fname = fname.left(pos); } IMAPfolderItem*pitem = findSubItem(fname); if (pitem) { titem = item; item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); item->setSelectable(it->may_select()); /* setup the short name */ item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); item = titem; } else { item = new IMAPfolderItem( it, this , item ); item->setSelectable(it->may_select()); } } delete folders; } RecBody IMAPviewItem::fetchBody(const RecMail&) { return RecBody(); } IMAPfolderItem::~IMAPfolderItem() { delete folder; } IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) : AccountViewItem( parent , after ) { folder = folderInit; imap = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_IMAPFOLDER ); } else { setPixmap( 0, PIXMAP_INBOXFOLDER); } setText( 0, folder->getDisplayName() ); } IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) : AccountViewItem( parent,after ) { folder = folderInit; imap = master; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_IMAPFOLDER ); } else { setPixmap( 0, PIXMAP_INBOXFOLDER); } setText( 0, folder->getDisplayName() ); } bool IMAPfolderItem::matchName(const QString&name)const { return folder->getDisplayName()==name; } void IMAPfolderItem::refresh(QList<RecMail>&target) { if (folder->may_select()) imap->getWrapper()->listMessages( folder->getName(),target ); } RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) { return imap->getWrapper()->fetchBody(aMail); } /** * Generic stuff */ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) : QListView( parent, name, flags ) { connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), SLOT( refresh( QListViewItem * ) ) ); setSorting(0); } void AccountView::populate( QList<Account> list ) { clear(); QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); (void) new MBOXviewItem(localfolders,this); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType().compare( "IMAP" ) == 0 ) { IMAPaccount *imap = static_cast<IMAPaccount *>(it); qDebug( "added IMAP " + imap->getAccountName() ); (void) new IMAPviewItem( imap, this ); } else if ( it->getType().compare( "POP3" ) == 0 ) { POP3account *pop3 = static_cast<POP3account *>(it); qDebug( "added POP3 " + pop3->getAccountName() ); (void) new POP3viewItem( pop3, this ); } } } void AccountView::refresh(QListViewItem *item) { qDebug("AccountView refresh..."); if ( item ) { m_currentItem = item; QList<RecMail> headerlist; headerlist.setAutoDelete(true); AccountViewItem *view = static_cast<AccountViewItem *>(item); view->refresh(headerlist); emit refreshMailview(&headerlist); } } void AccountView::refreshCurrent() { if ( !m_currentItem ) return; QList<RecMail> headerlist; headerlist.setAutoDelete(true); AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); view->refresh(headerlist); emit refreshMailview(&headerlist); } void AccountView::refreshAll() { } RecBody AccountView::fetchBody(const RecMail&aMail) { QListViewItem*item = selectedItem (); if (!item) return RecBody(); AccountViewItem *view = static_cast<AccountViewItem *>(item); return view->fetchBody(aMail); } /** * MBOX Account stuff */ MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) : AccountViewItem( parent ) { m_Path = aPath; wrapper = AbstractMail::getWrapper( m_Path ); - setPixmap( 0, PIXMAP_POP3FOLDER ); + setPixmap( 0, PIXMAP_LOCALFOLDER ); setText( 0, " Local Folders" ); setOpen( true ); } MBOXviewItem::~MBOXviewItem() { delete wrapper; } AbstractMail *MBOXviewItem::getWrapper() { return wrapper; } void MBOXviewItem::refresh( QList<RecMail> & ) { 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 MBOXfolderItem( it, this , item ); item->setSelectable(it->may_select()); } // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! folders->setAutoDelete(false); delete folders; } RecBody MBOXviewItem::fetchBody( const RecMail &mail ) { qDebug( "POP3 fetchBody" ); return wrapper->fetchBody( mail ); } MBOXfolderItem::~MBOXfolderItem() { delete folder; } MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) : AccountViewItem( parent,after ) { folder = folderInit; mbox = parent; - if (folder->getDisplayName().lower()!="inbox") { - setPixmap( 0, PIXMAP_POP3FOLDER ); - } else { + if (folder->getDisplayName().lower() == "outgoing") { + setPixmap( 0, PIXMAP_OUTBOXFOLDER ); + } else if (folder->getDisplayName().lower() == "inbox") { setPixmap( 0, PIXMAP_INBOXFOLDER); - } + } else { + setPixmap( 0, PIXMAP_MBOXFOLDER ); + } setText( 0, folder->getDisplayName() ); } void MBOXfolderItem::refresh(QList<RecMail>&target) { if (folder->may_select()) mbox->getWrapper()->listMessages( folder->getName(),target ); } RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) { return mbox->getWrapper()->fetchBody(aMail); } diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h index d9cdab0..36c85c7 100644 --- a/noncore/net/mail/defines.h +++ b/noncore/net/mail/defines.h @@ -1,51 +1,57 @@ #ifndef DEFINE_CONSTANTS_H #define DEFINE_CONSTANTS_H #include <qpe/resource.h> #define USER_AGENT "OpieMail v0.1" #define PIC_COMPOSEMAIL "mail/composemail" #define PIC_SENDQUEUED "mail/sendqueued" #define PIC_SHOWFOLDERS "mail/showfolders" #define PIC_SEARCHMAILS "mail/searchmails" #define PIC_EDITSETTINGS "mail/editsettings" #define PIC_EDITACCOUNTS "mail/editaccounts" #define PIC_SYNC "mail/sync" #define PIC_IMAPFOLDER "mail/imapfolder" +#define PIC_MBOXFOLDER "mail/mboxfolder" #define PIC_POP3FOLDER "mail/pop3folder" #define PIC_INBOXFOLDER "mail/inbox" +#define PIC_OUTBOXFOLDER "mail/outbox" +#define PIC_LOCALFOLDER "mail/localfolder" #define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) #define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) #define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) #define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) #define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) #define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) #define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) #define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) #define PIXMAP_POP3FOLDER QPixmap( Resource::loadPixmap( PIC_POP3FOLDER ) ) #define PIXMAP_INBOXFOLDER QPixmap( Resource::loadPixmap( PIC_INBOXFOLDER) ) +#define PIXMAP_MBOXFOLDER QPixmap( Resource::loadPixmap( PIC_MBOXFOLDER ) ) +#define PIXMAP_OUTBOXFOLDER QPixmap( Resource::loadPixmap( PIC_OUTBOXFOLDER) ) +#define PIXMAP_LOCALFOLDER QPixmap( Resource::loadPixmap( PIC_LOCALFOLDER) ) #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" /* used for decoding imapfoldername */ #define UNDEFINED 64 #define MAXLINE 76 #define UTF16MASK 0x03FFUL #define UTF16SHIFT 10 #define UTF16BASE 0x10000UL #define UTF16HIGHSTART 0xD800UL #define UTF16HIGHEND 0xDBFFUL #define UTF16LOSTART 0xDC00UL #define UTF16LOEND 0xDFFFUL #endif diff --git a/pics/mail/imapfolder.png b/pics/mail/imapfolder.png Binary files differindex 0c980dc..f7a2901 100644 --- a/pics/mail/imapfolder.png +++ b/pics/mail/imapfolder.png diff --git a/pics/mail/inbox.png b/pics/mail/inbox.png Binary files differindex 662573d..b34f5fe 100644 --- a/pics/mail/inbox.png +++ b/pics/mail/inbox.png diff --git a/pics/mail/localfolder.png b/pics/mail/localfolder.png Binary files differnew file mode 100644 index 0000000..6b0ac61 --- a/dev/null +++ b/pics/mail/localfolder.png diff --git a/pics/mail/mboxfolder.png b/pics/mail/mboxfolder.png Binary files differnew file mode 100644 index 0000000..5012829 --- a/dev/null +++ b/pics/mail/mboxfolder.png diff --git a/pics/mail/outbox.png b/pics/mail/outbox.png Binary files differnew file mode 100644 index 0000000..3c81b43 --- a/dev/null +++ b/pics/mail/outbox.png diff --git a/pics/mail/pop3folder.png b/pics/mail/pop3folder.png Binary files differindex fad29f4..65baa24 100644 --- a/pics/mail/pop3folder.png +++ b/pics/mail/pop3folder.png |