-rw-r--r-- | noncore/net/mail/accountitem.cpp | 155 | ||||
-rw-r--r-- | noncore/net/mail/accountitem.h | 13 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 52 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 11 | ||||
-rw-r--r-- | noncore/net/mail/defines.h | 27 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 35 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 4 |
8 files changed, 217 insertions, 85 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index c1574fd..4869df8 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp @@ -66,49 +66,49 @@ void POP3viewItem::refresh() 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 ) { - odebug << "POP3 fetchBody" << oendl; + 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); + m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); + m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); } else { - m->insertItem(QObject::tr("Set online",contextName),1); + m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); } } return m; } void POP3viewItem::disconnect() { QListViewItem *child = firstChild(); while ( child ) { QListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } wrapper->logout(); } @@ -116,36 +116,36 @@ void POP3viewItem::disconnect() void POP3viewItem::setOnOffline() { if (!account->getOffline()) { disconnect(); } account->setOffline(!account->getOffline()); account->save(); SETPIX(PIXMAP_POP3FOLDER); refresh(); } void POP3viewItem::contextMenuSelected(int which) { switch (which) { - case 0: + case SERVER_MENU_DISCONNECT: disconnect(); break; - case 1: + case SERVER_MENU_OFFLINE: setOnOffline(); break; } } POP3folderItem::~POP3folderItem() {} POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) : AccountViewItem(folderInit,parent,after ) { pop3 = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_POP3FOLDER ); } @@ -159,60 +159,60 @@ POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , void POP3folderItem::refresh(QValueList<RecMailP>&target) { if (folder->may_select()) pop3->getWrapper()->listMessages( folder->getName(),target ); } RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) { return pop3->getWrapper()->fetchBody(aMail); } QPopupMenu * POP3folderItem::getContextMenu() { QPopupMenu *m = new QPopupMenu(0); if (m) { - m->insertItem(QObject::tr("Refresh header list",contextName),0); - m->insertItem(QObject::tr("Delete all mails",contextName),1); - m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); + m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); + m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); + m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); } return m; } void POP3folderItem::downloadMails() { AccountView*bl = pop3->accountView(); if (!bl) return; bl->downloadMails(folder,pop3->getWrapper()); } void POP3folderItem::contextMenuSelected(int which) { AccountView * view = (AccountView*)listView(); switch (which) { - case 0: + case FOLDER_MENU_REFRESH_HEADER: /* must be 'cause pop3 lists are cached */ pop3->getWrapper()->logout(); view->refreshCurrent(); break; - case 1: + case FOLDER_MENU_DELETE_ALL_MAILS: deleteAllMail(pop3->getWrapper(),folder); break; - case 2: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); break; default: break; } } /** * NNTP Account stuff */ NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) : AccountViewItem( parent ) { account = a; wrapper = AbstractMail::getWrapper( account ); //FIXME @@ -257,50 +257,50 @@ void NNTPviewItem::refresh() 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 ) { - odebug << "NNTP fetchBody" << oendl; + 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); + m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); + m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); + m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),SERVER_MENU_SUBSCRIBE); } else { - m->insertItem(QObject::tr("Set online",contextName),1); + m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); } } return m; } void NNTPviewItem::subscribeGroups() { NNTPGroupsDlg dlg(account); if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){ refresh(); } } void NNTPviewItem::disconnect() { QListViewItem *child = firstChild(); @@ -317,39 +317,39 @@ void NNTPviewItem::setOnOffline() { if (!account->getOffline()) { disconnect(); } account->setOffline(!account->getOffline()); account->save(); //FIXME SETPIX(PIXMAP_POP3FOLDER); refresh(); } void NNTPviewItem::contextMenuSelected(int which) { switch (which) { - case 0: + case SERVER_MENU_DISCONNECT: disconnect(); break; - case 1: + case SERVER_MENU_OFFLINE: setOnOffline(); break; - case 2: + case SERVER_MENU_SUBSCRIBE: subscribeGroups(); break; } } NNTPfolderItem::~NNTPfolderItem() {} NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) : AccountViewItem( folderInit, parent,after ) { nntp = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_POP3FOLDER ); } @@ -363,56 +363,56 @@ NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent void NNTPfolderItem::refresh(QValueList<RecMailP>&target) { if (folder->may_select()) nntp->getWrapper()->listMessages( folder->getName(),target ); } RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) { return nntp->getWrapper()->fetchBody(aMail); } QPopupMenu * NNTPfolderItem::getContextMenu() { QPopupMenu *m = new QPopupMenu(0); if (m) { - m->insertItem(QObject::tr("Refresh header list",contextName),0); - m->insertItem(QObject::tr("Copy all postings",contextName),1); + m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); + m->insertItem(QObject::tr("Copy all postings",contextName),FOLDER_MENU_MOVE_MAILS); } return m; } void NNTPfolderItem::downloadMails() { AccountView*bl = nntp->accountView(); if (!bl) return; bl->downloadMails(folder,nntp->getWrapper()); } void NNTPfolderItem::contextMenuSelected(int which) { AccountView * view = (AccountView*)listView(); switch (which) { - case 0: - /* must be 'cause pop3 lists are cached */ + case FOLDER_MENU_REFRESH_HEADER: + /* must be 'cause nntp lists are cached */ nntp->getWrapper()->logout(); view->refreshCurrent(); break; - case 1: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); break; default: break; } } /** * IMAP Account stuff */ IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) : AccountViewItem( parent ) { account = a; wrapper = AbstractMail::getWrapper( account ); SETPIX(PIXMAP_IMAPFOLDER); @@ -448,33 +448,33 @@ void IMAPviewItem::refreshFolders(bool force) 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); - odebug << "inbox found" << oendl; + 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; @@ -485,82 +485,82 @@ void IMAPviewItem::refreshFolders(bool force) } else { item = new IMAPfolderItem( (*it), this , item ); } } delete folders; } QPopupMenu * IMAPviewItem::getContextMenu() { QPopupMenu *m = new QPopupMenu(0); if (m) { if (!account->getOffline()) { - m->insertItem(QObject::tr("Refresh folder list",contextName),0); - m->insertItem(QObject::tr("Create new folder",contextName),1); + m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); + m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); m->insertSeparator(); - m->insertItem(QObject::tr("Disconnect",contextName),2); - m->insertItem(QObject::tr("Set offline",contextName),3); + m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); + m->insertItem(QObject::tr("Create new folder",contextName),SERVER_MENU_CREATE_FOLDER); } else { - m->insertItem(QObject::tr("Set online",contextName),3); + m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); } } return m; } 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) { - odebug << "Id selected: " << id << "" << oendl; + odebug << "Id selected: " << id << "" << oendl; switch (id) { - case 0: + case SERVER_MENU_REFRESH_FOLDER: refreshFolders(true); break; - case 1: + case SERVER_MENU_CREATE_FOLDER: createNewFolder(); break; - case 2: + case SERVER_MENU_DISCONNECT: removeChilds(); wrapper->logout(); break; - case 3: + case SERVER_MENU_OFFLINE: if (account->getOffline()==false) { removeChilds(); wrapper->logout(); } account->setOffline(!account->getOffline()); account->save(); SETPIX(PIXMAP_IMAPFOLDER); refreshFolders(false); break; default: break; } } RECBODYP IMAPviewItem::fetchBody(const RecMailP&) @@ -622,113 +622,117 @@ void IMAPfolderItem::refresh(QValueList<RecMailP>&target) target.clear(); } } RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) { return imap->getWrapper()->fetchBody(aMail); } QPopupMenu * IMAPfolderItem::getContextMenu() { QPopupMenu *m = new QPopupMenu(0); if (m) { if (folder->may_select()) { - m->insertItem(QObject::tr("Refresh header list",contextName),0); - m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); - m->insertItem(QObject::tr("Delete all mails",contextName),1); + m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); + m->insertItem(QObject::tr("Move/Copy all mails",contextName),FOLDER_MENU_MOVE_MAILS); + m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); } if (folder->no_inferior()==false) { - m->insertItem(QObject::tr("Create new subfolder",contextName),2); + m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); } if (folder->getDisplayName().lower()!="inbox") { - m->insertItem(QObject::tr("Delete folder",contextName),3); + m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); } } 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); - odebug << "Auswahl: " << yesno << "" << oendl; + 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) { - odebug << "Selected id: " << id << "" << oendl; + odebug << "Selected id: " << id << "" << oendl; AccountView * view = (AccountView*)listView(); switch(id) { - case 0: + case FOLDER_MENU_REFRESH_HEADER: view->refreshCurrent(); break; - case 1: + case FOLDER_MENU_DELETE_ALL_MAILS: deleteAllMail(imap->getWrapper(),folder); break; - case 2: - createNewFolder(); + case FOLDER_MENU_NEW_SUBFOLDER: + if (folder->no_inferior()==false) { + createNewFolder(); + } break; - case 3: - deleteFolder(); + case FOLDER_MENU_DELETE_FOLDER: + if (folder->getDisplayName().lower()!="inbox") { + deleteFolder(); + } break; - case 4: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); break; default: break; } } /** * MH Account stuff */ /* MH is a little bit different - the top folder can contains messages other than in IMAP and POP3 and MBOX */ MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) : AccountViewItem( parent ) { m_Path = aPath; @@ -746,32 +750,33 @@ MHviewItem::~MHviewItem() } AbstractMail *MHviewItem::getWrapper() { return wrapper; } void MHviewItem::refresh( QValueList<RecMailP> & target) { refresh(false); getWrapper()->listMessages( "",target ); } void MHviewItem::refresh(bool force) { if (childCount()>0 && force==false) return; + odebug << "Refresh mh folders" << oendl; removeChilds(); currentFolders.clear(); QValueList<FolderP> *folders = wrapper->listFolders(); QValueList<FolderP>::ConstIterator it; MHfolderItem*item = 0; MHfolderItem*pmaster = 0; QString fname = ""; int pos; for ( it = folders->begin(); it!=folders->end(); ++it) { fname = (*it)->getDisplayName(); /* this folder itself */ if (fname=="/") { currentFolders.append(fname); folder = (*it); @@ -790,90 +795,96 @@ void MHviewItem::refresh(bool force) } 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 ) { - odebug << "MH fetchBody" << oendl; + 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); + m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); + m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER); + m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); + m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); } return m; } void MHviewItem::createFolder() { Newmdirdlg ndirdlg(0,0,true); if ( QPEApplication::execDialog( &ndirdlg ) ) { QString ndir = ndirdlg.Newdir(); if (wrapper->createMbox(ndir)) { refresh(true); } } } void MHviewItem::downloadMails() { AccountView*bl = accountView(); if (!bl) return; bl->downloadMails(folder,getWrapper()); } QStringList MHviewItem::subFolders() { return currentFolders; } void MHviewItem::contextMenuSelected(int which) { + AccountView*view = 0; + switch (which) { - case 0: + case SERVER_MENU_REFRESH_FOLDER: refresh(true); break; - case 1: + case FOLDER_MENU_NEW_SUBFOLDER: createFolder(); break; - case 2: + case FOLDER_MENU_DELETE_ALL_MAILS: deleteAllMail(getWrapper(),folder); break; - case 3: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); break; + case FOLDER_MENU_REFRESH_HEADER: + view = (AccountView*)listView(); + if (view) view->refreshCurrent(); + break; default: break; } } MHfolderItem::~MHfolderItem() {} MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) : AccountViewItem(folderInit, parent,after ) { mbox = parent; initName(); } MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) @@ -920,59 +931,60 @@ 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); - odebug << "Auswahl: " << yesno << "" << oendl; + 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); - m->insertItem(QObject::tr("Create new subfolder",contextName),3); - m->insertItem(QObject::tr("Delete folder",contextName),1); + m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); + m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); + m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); + m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); + m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); } return m; } void MHfolderItem::downloadMails() { AccountView*bl = mbox->accountView(); if (!bl) return; bl->downloadMails(folder,mbox->getWrapper()); } void MHfolderItem::createFolder() { Newmdirdlg ndirdlg(0,0,true); if ( QPEApplication::execDialog( &ndirdlg ) ) { @@ -981,46 +993,51 @@ void MHfolderItem::createFolder() { 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); } } } } void MHfolderItem::contextMenuSelected(int which) { + AccountView*view = 0; switch(which) { - case 0: + case FOLDER_MENU_DELETE_ALL_MAILS: deleteAllMail(mbox->getWrapper(),folder); break; - case 1: + case FOLDER_MENU_DELETE_FOLDER: deleteFolder(); break; - case 2: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); break; - case 3: + case FOLDER_MENU_NEW_SUBFOLDER: createFolder(); break; + case FOLDER_MENU_REFRESH_HEADER: + view = (AccountView*)listView(); + if (view) view->refreshCurrent(); + break; default: break; } } bool MHfolderItem::isDraftfolder() { if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; return false; } /** * Generic stuff */ const QString AccountViewItem::contextName="AccountViewItem"; @@ -1062,33 +1079,33 @@ AccountViewItem::~AccountViewItem() 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); - odebug << "Auswahl: " << yesno << "" << oendl; + 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; diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index f125eeb..b2c50a1 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h @@ -23,190 +23,203 @@ class AccountViewItem : public QListViewItem { public: AccountViewItem( AccountView *parent ); AccountViewItem( QListViewItem *parent); AccountViewItem( QListViewItem *parent , QListViewItem*after ); AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); virtual ~AccountViewItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; virtual QPopupMenu * getContextMenu(){return 0;}; virtual void contextMenuSelected(int){} virtual AccountView*accountView(); virtual bool matchName(const QString&name)const; virtual bool isDraftfolder(); + /* 1 - server + * 2 - folder + * 3 - beides + */ + virtual int isServer()const=0; protected: AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); virtual void init(); virtual void removeChilds(); virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); static const QString contextName; AccountView*m_Backlink; Opie::Core::OSmartPointer<Folder> folder; }; class POP3viewItem : public AccountViewItem { public: POP3viewItem( POP3account *a, AccountView *parent ); virtual ~POP3viewItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); + virtual int isServer()const{return 1;} protected: POP3account *account; virtual void refresh(); AbstractMail *wrapper; void disconnect(); void setOnOffline(); }; class POP3folderItem : public AccountViewItem { public: POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); virtual ~POP3folderItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); + virtual int isServer()const{return 2;} protected: void downloadMails(); POP3viewItem *pop3; }; class NNTPviewItem : public AccountViewItem { public: NNTPviewItem( NNTPaccount *a, AccountView *parent ); virtual ~NNTPviewItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); + virtual int isServer()const{return 1;} protected: NNTPaccount *account; virtual void refresh(); AbstractMail *wrapper; void disconnect(); void setOnOffline(); void subscribeGroups(); }; class NNTPfolderItem : public AccountViewItem { public: NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); virtual ~NNTPfolderItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); + virtual int isServer()const{return 2;} protected: void downloadMails(); NNTPviewItem *nntp; }; class IMAPviewItem : public AccountViewItem { friend class IMAPfolderItem; public: IMAPviewItem( IMAPaccount *a, AccountView *parent ); virtual ~IMAPviewItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); AbstractMail *getWrapper(); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); const QStringList&subFolders(); virtual void refreshFolders(bool force=false); + virtual int isServer()const{return 1;} bool offline(); protected: virtual void createNewFolder(); IMAPaccount *account; AbstractMail *wrapper; QStringList currentFolders; }; class IMAPfolderItem : public AccountViewItem { public: IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); virtual ~IMAPfolderItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); virtual const QString& Delemiter()const; + virtual int isServer()const{return 2;} protected: virtual void createNewFolder(); virtual void deleteFolder(); virtual void downloadMails(); IMAPviewItem *imap; }; class MHviewItem : public AccountViewItem { friend class MHfolderItem; public: MHviewItem( const QString&aMboxPath, AccountView *parent ); virtual ~MHviewItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); AbstractMail *getWrapper(); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); QStringList subFolders(); virtual void refresh(bool force=false); + virtual int isServer()const{return 3;} protected: void downloadMails(); virtual void createFolder(); QString m_Path; AbstractMail *wrapper; QStringList currentFolders; }; class MHfolderItem : public AccountViewItem { public: MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); virtual ~MHfolderItem(); virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); virtual QPopupMenu * getContextMenu(); virtual void contextMenuSelected(int); virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; virtual bool isDraftfolder(); + virtual int isServer()const{return 2;} protected: void downloadMails(); virtual void createFolder(); virtual void deleteFolder(); void initName(); MHviewItem *mbox; }; #endif diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index c747a8b..d01d6bb 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -7,63 +7,105 @@ #include <libmailwrapper/mailwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> /* OPIE */ #include <opie2/odebug.h> #include <qpe/qpeapplication.h> /* QT */ #include <qmessagebox.h> #include <qpopupmenu.h> using namespace Opie::Core; AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) : QListView( parent, name, flags ) { + setSorting(0); + setSelectionMode(Single); + m_rightPressed = false; + connect( this, SIGNAL( selectionChanged(QListViewItem*) ), - SLOT( refresh(QListViewItem*) ) ); + SLOT( slotSelectionChanged(QListViewItem*) ) ); connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, - SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); - setSorting(0); + SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) ); + connect( this, SIGNAL(clicked(QListViewItem*) ),this, + SLOT( slotMouseClicked(QListViewItem*) ) ); + m_currentItem = 0; } AccountView::~AccountView() { imapAccounts.clear(); mhAccounts.clear(); } +void AccountView::slotSelectionChanged(QListViewItem*item) +{ + odebug << "AccountView: Selection changed" << oendl; + if (!item) { + emit serverSelected(0); + return; + } + AccountViewItem *view = static_cast<AccountViewItem *>(item); + + emit serverSelected(view->isServer()); +} + void AccountView::slotContextMenu(int id) { AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); if (!view) return; view->contextMenuSelected(id); } -void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) +void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&,int) { - if (button==1) {return;} + m_rightPressed = true; if (!item) return; 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; + setSelected(item,true); +} + +void AccountView::slotLeftButton(int button, QListViewItem * item,const QPoint&,int) +{ + m_rightPressed = false; +} + +void AccountView::slotMouseClicked(QListViewItem*item) +{ + if (m_rightPressed) return; + if (!item || m_currentItem == item) return; + /* ### ToDo check settings if on single tab it should open */ + m_currentItem = item; + refresh(m_currentItem); +} + +void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column) +{ + if (button==1) { + slotLeftButton(button,item,pos,column); + } else if (button==2) { + slotRightButton(button,item,pos,column); + } } 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); odebug << "added IMAP " + imap->getAccountName() << oendl; imapAccounts.append(new IMAPviewItem( imap, this )); diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 787b0b0..ae24dce 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h @@ -16,30 +16,39 @@ class MHviewItem; class AccountView : public QListView { Q_OBJECT public: AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); virtual ~AccountView(); virtual void populate( QList<Account> list ); virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); virtual bool currentisDraft(); public slots: virtual void refreshAll(); virtual void refresh(QListViewItem *item); virtual void refreshCurrent(); - virtual void slotHold(int, QListViewItem *,const QPoint&,int); virtual void slotContextMenu(int id); + void setupFolderselect(Selectstore*sels); signals: void refreshMailview(const QValueList<RecMailP>& ); + void serverSelected(int); protected: QListViewItem* m_currentItem; QValueList<IMAPviewItem*> imapAccounts; QValueList<MHviewItem*> mhAccounts; + bool m_rightPressed:1; + +protected slots: + virtual void slotRightButton(int, QListViewItem *,const QPoint&,int); + virtual void slotLeftButton(int, QListViewItem *,const QPoint&,int); + virtual void slotMouseButton(int, QListViewItem *,const QPoint&,int); + virtual void slotMouseClicked(QListViewItem*); + virtual void slotSelectionChanged(QListViewItem*); }; #endif diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h index d840f09..5fcbf0f 100644 --- a/noncore/net/mail/defines.h +++ b/noncore/net/mail/defines.h @@ -5,53 +5,66 @@ #define USER_AGENT "OpieMail v0.3" #define PIC_COMPOSEMAIL "mail/composemail" #define PIC_SENDQUEUED "mail/sendqueued" #define PIC_SHOWFOLDERS "mail/showfolders" #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 PIC_OFFLINE "mail/notconnected" -#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 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 PIXMAP_OFFLINE QPixmap( Resource::loadPixmap( PIC_OFFLINE) ) #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 +/* used for making menuids transparent */ +#define FOLDER_MENU_REFRESH_HEADER 0 +#define FOLDER_MENU_DELETE_ALL_MAILS 1 +#define FOLDER_MENU_NEW_SUBFOLDER 2 +#define FOLDER_MENU_DELETE_FOLDER 3 +#define FOLDER_MENU_MOVE_MAILS 4 + +#define SERVER_MENU_DISCONNECT 5 +#define SERVER_MENU_OFFLINE 6 +#define SERVER_MENU_REFRESH_FOLDER 7 +#define SERVER_MENU_CREATE_FOLDER 8 +#define SERVER_MENU_SUBSCRIBE 9 + #endif diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 0a45445..81c8fee 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp @@ -8,38 +8,62 @@ #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> #include "defines.h" #include "mainwindow.h" using namespace Opie::Core; 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 ); + serverMenu = new QPopupMenu( menuBar ); + m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu ); + serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT); + serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE); + serverMenu->insertSeparator(); + serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER); + serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER); + serverMenu->insertSeparator(); + serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE); + + folderMenu = new QPopupMenu( menuBar ); + m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu ); + folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER); + folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS); + folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER); + folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER); + folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS); + + menuBar->setItemEnabled(m_ServerMenuId,false); + menuBar->setItemEnabled(m_FolderMenuId,false); + 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 ); @@ -77,32 +101,36 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 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 ); QWidget *view = new QWidget( this ); setCentralWidget( view ); layout = new QBoxLayout ( view, QBoxLayout::LeftToRight ); folderView = new AccountView( view ); folderView->header()->hide(); folderView->setRootIsDecorated( true ); folderView->addColumn( tr( "Mailbox" ) ); + connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int))); + connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); + connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); + layout->addWidget( folderView ); mailView = new QListView( view ); mailView->addColumn( "" ); 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); mailView->setShowSortIndicator(true); mailView->setSorting(4,false); layout->addWidget( mailView ); layout->setStretchFactor( folderView, 1 ); layout->setStretchFactor( mailView, 2 ); @@ -132,32 +160,39 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) #if !defined(QT_NO_COP) connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); m_sysChannel = new QCopChannel( "QPE/System", this ); connect( m_sysChannel, SIGNAL( received(const QCString&,const QByteArray&) ), this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); #endif QTimer::singleShot( 10, this, SLOT( slotAdjustColumns() ) ); } MainWindow::~MainWindow() { } +void MainWindow::serverSelected(int m_isFolder) +{ + mailView->clear(); + menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1); + menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2); +} + void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) { int _newrotation; QDataStream stream( data, IO_ReadOnly ); if ( msg == "setCurrentRotation(int)" ) { stream >> _newrotation; if (m_Rotate != _newrotation) { slotAdjustLayout(); m_Rotate = _newrotation; } } } void MainWindow::appMessage(const QCString &, const QByteArray &) { diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index ad71a54..409f160 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h @@ -28,31 +28,34 @@ public slots: virtual void slotAdjustColumns(); virtual void appMessage(const QCString &msg, const QByteArray &data); virtual void slotComposeMail(); virtual void systemMessage( const QCString&, const QByteArray& ); protected slots: virtual void slotSendQueued(); virtual void slotEditAccounts(); virtual void slotShowFolders( bool show ); virtual void refreshMailView(const QValueList<RecMailP>&); virtual void displayMail(); virtual void slotDeleteMail(); virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotAdjustLayout(); virtual void slotEditSettings(); virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); + virtual void serverSelected(int); protected: QToolBar *toolBar; QMenuBar *menuBar; - QPopupMenu *mailMenu, *settingsMenu; + QPopupMenu *mailMenu, *settingsMenu,*serverMenu,*folderMenu; + QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, *editSettings, *editAccounts, *syncFolders; AccountView *folderView; QListView *mailView; QBoxLayout *layout; int m_Rotate; QCopChannel* m_sysChannel; + int m_ServerMenuId,m_FolderMenuId; }; #endif diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 9eba23e..7c6d314 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -67,34 +67,34 @@ ValueExplode::~ValueExplode() ValueExplode::ValueExplode(const QString&aCommand,const char aDelemiter,const char a2Delemiter) :m_LastParsed(),m_Command(aCommand) { mDelemiter = aDelemiter; m2Delemiter = a2Delemiter; splitit(); } void ValueExplode::splitit() { QString iLine; m_LastParsed.clear(); if (mDelemiter.isEmpty()||m2Delemiter.isEmpty()) { m_LastParsed.append(tkeyvalues(m_Command,"")); return; } - int pos,pos2,startpos; - startpos = 0; + int pos,pos2; + unsigned startpos = 0; iLine = m_Command; while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { pos2 = iLine.find(m2Delemiter,startpos); if (pos2==-1||pos2>pos) { m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos-startpos),"")); } else { m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1,pos-pos2-1))); } startpos = pos+1; } if (startpos<iLine.length()) { pos2 = iLine.find(m2Delemiter,startpos); if (pos2==-1) { m_LastParsed.append(tkeyvalues(iLine.mid(startpos),"")); } else { m_LastParsed.append(tkeyvalues(iLine.mid(startpos,pos2-startpos),iLine.mid(pos2+1))); |