-rw-r--r-- | kmicromail/accountitem.cpp | 128 |
1 files changed, 65 insertions, 63 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 985a762..9b1ea2f 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp @@ -7,18 +7,20 @@ #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> #include <libmailwrapper/mailwrapper.h> /* OPIE */ //#include <qpe/qpeapplication.h> /* QT */ -#include <qpopupmenu.h> +#include <q3popupmenu.h> #include <qmessagebox.h> +//Added by qt3to4: +#include <Q3ValueList> #include <kiconloader.h> #include <klocale.h> #define GET_NEW_MAILS 101 using namespace Opie::Core; #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} /** @@ -49,51 +51,51 @@ POP3viewItem::~POP3viewItem() delete wrapper; } AbstractMail *POP3viewItem::getWrapper() { return wrapper; } -void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) +void POP3viewItem::refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > & ) { refresh(); } void POP3viewItem::refresh() { if (account->getOffline()) return; - QValueList<FolderP> *folders = wrapper->listFolders(); - QListViewItem *child = firstChild(); + Q3ValueList<FolderP> *folders = wrapper->listFolders(); + Q3ListViewItem *child = firstChild(); while ( child ) { - QListViewItem *tmp = child; + Q3ListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } - QValueList<FolderP>::ConstIterator it; - QListViewItem*item = 0; + Q3ValueList<FolderP>::ConstIterator it; + Q3ListViewItem*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 ) { return wrapper->fetchBody( mail ); } -QPopupMenu * POP3viewItem::getContextMenu() +Q3PopupMenu * POP3viewItem::getContextMenu() { - QPopupMenu *m = new QPopupMenu(0); + Q3PopupMenu *m = new Q3PopupMenu(0); if (m) { if (!account->getOffline()) { m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); m->insertItem(i18n("Disconnect"),0); m->insertItem(i18n("Set offline"),1); } @@ -103,20 +105,20 @@ QPopupMenu * POP3viewItem::getContextMenu() m->insertItem(i18n("Set online"),1); } } return m; } void POP3viewItem::disconnect() { - QListViewItem *child = firstChild(); + Q3ListViewItem *child = firstChild(); while ( child ) { - QListViewItem *tmp = child; + Q3ListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } wrapper->logout(); } void POP3viewItem::setOnOffline() { @@ -152,45 +154,45 @@ void POP3viewItem::contextMenuSelected(int which) setOnOffline(); break; } } POP3folderItem::~POP3folderItem() {} -POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) +POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , Q3ListViewItem*after ) : AccountViewItem(folderInit,parent,after ) { pop3 = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_POP3FOLDER ); } else { setPixmap( 0, PIXMAP_INBOXFOLDER); } setText( 0, folder->getDisplayName() ); } -void POP3folderItem::refresh(QValueList<RecMailP>&target) +void POP3folderItem::refresh(Q3ValueList<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() +Q3PopupMenu * POP3folderItem::getContextMenu() { - QPopupMenu *m = new QPopupMenu(0); + Q3PopupMenu *m = new Q3PopupMenu(0); if (m) { m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); m->insertItem(i18n("Refresh header list"),0); m->insertItem(i18n("Delete all mails"),1); m->insertItem(i18n("Move/Copie all mails"),2); } return m; @@ -256,52 +258,52 @@ NNTPviewItem::~NNTPviewItem() delete wrapper; } AbstractMail *NNTPviewItem::getWrapper() { return wrapper; } -void NNTPviewItem::refresh( QValueList<RecMailP> & ) +void NNTPviewItem::refresh( Q3ValueList<RecMailP> & ) { refresh(); } void NNTPviewItem::refresh() { if (account->getOffline()) return; - QValueList<FolderP> *folders = wrapper->listFolders(); + Q3ValueList<FolderP> *folders = wrapper->listFolders(); - QListViewItem *child = firstChild(); + Q3ListViewItem *child = firstChild(); while ( child ) { - QListViewItem *tmp = child; + Q3ListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } - QValueList<FolderP>::ConstIterator it; - QListViewItem*item = 0; + Q3ValueList<FolderP>::ConstIterator it; + Q3ListViewItem*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 ) { return wrapper->fetchBody( mail ); } -QPopupMenu * NNTPviewItem::getContextMenu() +Q3PopupMenu * NNTPviewItem::getContextMenu() { - QPopupMenu *m = new QPopupMenu(0); + Q3PopupMenu *m = new Q3PopupMenu(0); if (m) { if (!account->getOffline()) { m->insertItem(i18n("Disconnect"),0); m->insertItem(i18n("Set offline"),1); //m->insertItem(i18n("(Un-)Subscribe groups"),2); } @@ -321,20 +323,20 @@ void NNTPviewItem::subscribeGroups() #endif if ( dlg.exec()== QDialog::Accepted ){ refresh(); } } void NNTPviewItem::disconnect() { - QListViewItem *child = firstChild(); + Q3ListViewItem *child = firstChild(); while ( child ) { - QListViewItem *tmp = child; + Q3ListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } wrapper->logout(); } void NNTPviewItem::setOnOffline() { @@ -363,45 +365,45 @@ void NNTPviewItem::contextMenuSelected(int which) subscribeGroups(); break; } } NNTPfolderItem::~NNTPfolderItem() {} -NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) +NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , Q3ListViewItem*after ) : AccountViewItem( folderInit, parent,after ) { nntp = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_POP3FOLDER ); } else { setPixmap( 0, PIXMAP_INBOXFOLDER); } setText( 0, folder->getDisplayName() ); } -void NNTPfolderItem::refresh(QValueList<RecMailP>&target) +void NNTPfolderItem::refresh(Q3ValueList<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() +Q3PopupMenu * NNTPfolderItem::getContextMenu() { - QPopupMenu *m = new QPopupMenu(0); + Q3PopupMenu *m = new Q3PopupMenu(0); if (m) { m->insertItem(i18n("Refresh header list"),0); m->insertItem(i18n("Copy all postings"),1); } return m; } @@ -448,38 +450,38 @@ IMAPviewItem::~IMAPviewItem() delete wrapper; } AbstractMail *IMAPviewItem::getWrapper() { return wrapper; } -void IMAPviewItem::refresh(QValueList<RecMailP>&) +void IMAPviewItem::refresh(Q3ValueList<RecMailP>&) { refreshFolders(false); } const QStringList&IMAPviewItem::subFolders() { return currentFolders; } void IMAPviewItem::refreshFolders(bool force) { if (childCount()>0 && force==false) return; if (account->getOffline()) return; removeChilds(); currentFolders.clear(); - QValueList<FolderP> * folders = wrapper->listFolders(); + Q3ValueList<FolderP> * folders = wrapper->listFolders(); - QValueList<FolderP>::Iterator it; - QListViewItem*item = 0; - QListViewItem*titem = 0; + Q3ValueList<FolderP>::Iterator it; + Q3ListViewItem*item = 0; + Q3ListViewItem*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 ); @@ -508,19 +510,19 @@ void IMAPviewItem::refreshFolders(bool force) else { item = new IMAPfolderItem( (*it), this , item ); } } delete folders; } -QPopupMenu * IMAPviewItem::getContextMenu() +Q3PopupMenu * IMAPviewItem::getContextMenu() { - QPopupMenu *m = new QPopupMenu(0); + Q3PopupMenu *m = new Q3PopupMenu(0); if (m) { if (!account->getOffline()) { m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); m->insertItem(i18n("Refresh folder list"),0); m->insertItem(i18n("Create new folder"),1); m->insertSeparator(); @@ -610,32 +612,32 @@ RECBODYP IMAPviewItem::fetchBody(const RecMailP&) return new RecBody(); } bool IMAPviewItem::offline() { return account->getOffline(); } -IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) +IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , Q3ListViewItem*after ) : AccountViewItem( folderInit, parent , after ) { imap = parent; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_IMAPFOLDER ); } else { setPixmap( 0, PIXMAP_INBOXFOLDER); } setText( 0, folder->getDisplayName() ); } -IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) +IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , Q3ListViewItem*after, IMAPviewItem *master ) : AccountViewItem(folderInit, parent,after ) { imap = master; if (folder->getDisplayName().lower()!="inbox") { setPixmap( 0, PIXMAP_IMAPFOLDER ); } else @@ -648,36 +650,36 @@ IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent IMAPfolderItem::~IMAPfolderItem() {} const QString& IMAPfolderItem::Delemiter()const { return folder->Separator(); } -void IMAPfolderItem::refresh(QValueList<RecMailP>&target) +void IMAPfolderItem::refresh(Q3ValueList<RecMailP>&target) { if (folder->may_select()) { imap->getWrapper()->listMessages( folder->getName(),target ); } else { target.clear(); } } RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) { return imap->getWrapper()->fetchBody(aMail); } -QPopupMenu * IMAPfolderItem::getContextMenu() +Q3PopupMenu * IMAPfolderItem::getContextMenu() { - QPopupMenu *m = new QPopupMenu(0); + Q3PopupMenu *m = new Q3PopupMenu(0); if (m) { if (folder->may_select()) { m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); m->insertItem(i18n("Refresh header list"),0); m->insertItem(i18n("Move/Copie all mails"),4); m->insertItem(i18n("Delete all mails"),1); @@ -716,17 +718,17 @@ void IMAPfolderItem::deleteFolder() i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), i18n("Yes"), i18n("No"),QString::null,1,1); if (yesno == 0) { if (imap->getWrapper()->deleteMbox(folder)) { - QListView*v=listView(); + Q3ListView*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); } @@ -795,29 +797,29 @@ MHviewItem::~MHviewItem() delete wrapper; } AbstractMail *MHviewItem::getWrapper() { return wrapper; } -void MHviewItem::refresh( QValueList<RecMailP> & target) +void MHviewItem::refresh( Q3ValueList<RecMailP> & target) { refresh(false); getWrapper()->listMessages( "",target ); } void MHviewItem::refresh(bool force) { if (childCount()>0 && force==false) return; removeChilds(); currentFolders.clear(); - QValueList<FolderP> *folders = wrapper->listFolders(); - QValueList<FolderP>::ConstIterator it; + Q3ValueList<FolderP> *folders = wrapper->listFolders(); + Q3ValueList<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 */ @@ -852,19 +854,19 @@ void MHviewItem::refresh(bool force) } RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) { return wrapper->fetchBody( mail ); } -QPopupMenu * MHviewItem::getContextMenu() +Q3PopupMenu * MHviewItem::getContextMenu() { - QPopupMenu *m = new QPopupMenu(0); + Q3PopupMenu *m = new Q3PopupMenu(0); if (m) { m->insertItem(i18n("Refresh folder list"),0); m->insertItem(i18n("Create new folder"),1); m->insertItem(i18n("Delete all mails"),2); m->insertItem(i18n("Move/Copie all mails"),3); } return m; @@ -915,24 +917,24 @@ void MHviewItem::contextMenuSelected(int which) default: break; } } MHfolderItem::~MHfolderItem() {} -MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) +MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , Q3ListViewItem*after ) : AccountViewItem(folderInit, parent,after ) { mbox = parent; initName(); } -MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) +MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, Q3ListViewItem*after, MHviewItem*master) : AccountViewItem(folderInit, parent,after ) { folder = folderInit; mbox = master; initName(); } void MHfolderItem::initName() @@ -962,17 +964,17 @@ void MHfolderItem::initName() setText( 0, bName ); } const FolderP&MHfolderItem::getFolder()const { return folder; } -void MHfolderItem::refresh(QValueList<RecMailP>&target) +void MHfolderItem::refresh(Q3ValueList<RecMailP>&target) { if (folder->may_select()) mbox->getWrapper()->listMessages( folder->getName(),target ); } RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) { return mbox->getWrapper()->fetchBody(aMail); @@ -984,32 +986,32 @@ void MHfolderItem::deleteFolder() i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), i18n("Yes"), i18n("No"),QString::null,1,1); if (yesno == 0) { if (mbox->getWrapper()->deleteMbox(folder)) { - QListView*v=listView(); + Q3ListView*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() +Q3PopupMenu * MHfolderItem::getContextMenu() { - QPopupMenu *m = new QPopupMenu(0); + Q3PopupMenu *m = new Q3PopupMenu(0); if (m) { m->insertItem(i18n("Move/Copie all mails"),2); m->insertItem(i18n("Delete all mails"),0); m->insertItem(i18n("Create new subfolder"),3); m->insertItem(i18n("Delete folder"),1); } return m; @@ -1026,17 +1028,17 @@ void MHfolderItem::createFolder() { Newmdirdlg ndirdlg(0,0,true); //ndirdlg.showMaximized(); if (ndirdlg.exec() ) { QString ndir = ndirdlg.Newdir(); if (mbox->getWrapper()->createMbox(ndir,folder)) { - QListView*v=listView(); + Q3ListView*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); } @@ -1073,36 +1075,36 @@ bool MHfolderItem::isDraftfolder() /** * Generic stuff */ const QString AccountViewItem::contextName="AccountViewItem"; AccountViewItem::AccountViewItem( AccountView *parent ) - : QListViewItem( parent ) + : Q3ListViewItem( parent ) { init(); m_Backlink = parent; } -AccountViewItem::AccountViewItem( QListViewItem *parent) - : QListViewItem( parent),folder(0) +AccountViewItem::AccountViewItem( Q3ListViewItem *parent) + : Q3ListViewItem( parent),folder(0) { init(); } -AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) - :QListViewItem( parent,after ),folder(0) +AccountViewItem::AccountViewItem( Q3ListViewItem *parent , Q3ListViewItem*after ) + :Q3ListViewItem( parent,after ),folder(0) { init(); } -AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) - :QListViewItem( parent,after ),folder(folderInit) +AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,Q3ListViewItem *parent , Q3ListViewItem*after ) + :Q3ListViewItem( parent,after ),folder(folderInit) { init(); } void AccountViewItem::init() { m_Backlink = 0; } @@ -1135,20 +1137,20 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) AccountView * view = (AccountView*)listView(); if (view) view->refreshCurrent(); } } } void AccountViewItem::removeChilds() { - QListViewItem *child = firstChild(); + Q3ListViewItem *child = firstChild(); while ( child ) { - QListViewItem *tmp = child; + Q3ListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } } bool AccountViewItem::matchName(const QString&name)const { if (!folder) return false; |