summaryrefslogtreecommitdiffabout
path: root/kmicromail/accountitem.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/accountitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 7795055..49d86fc 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -209,193 +209,193 @@ void POP3folderItem::contextMenuSelected(int which)
{
case 0:
/* must be 'cause pop3 lists are cached */
pop3->getWrapper()->logout();
view->refreshCurrent();
break;
case 1:
deleteAllMail(pop3->getWrapper(),folder);
break;
case 2:
downloadMails();
break;
case GET_NEW_MAILS: // daunlood
view->downloadMailsInbox(getFolder() ,pop3->getWrapper());
break;
default:
break;
}
}
/**
* NNTP Account stuff
*/
NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
//FIXME
SETPIX(PIXMAP_POP3FOLDER);
#if 0
if (!account->getOffline())
{
setPixmap( 0, );
}
else
{
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
setText( 0, account->getAccountName() );
setOpen( true );
}
NNTPviewItem::~NNTPviewItem()
{
delete wrapper;
}
AbstractMail *NNTPviewItem::getWrapper()
{
return wrapper;
}
void NNTPviewItem::refresh( QValueList<RecMailP> & )
{
refresh();
}
void NNTPviewItem::refresh()
{
if (account->getOffline()) return;
QValueList<FolderP> *folders = wrapper->listFolders();
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
QValueList<FolderP>::ConstIterator it;
QListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new NNTPfolderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
{
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("(Un-)Subscribe groups",contextName),2);
}
else
{
m->insertItem(QObject::tr("Set online",contextName),1);
}
}
return m;
}
void NNTPviewItem::subscribeGroups()
{
NNTPGroupsDlg dlg(account);
dlg.showMaximized();
if ( dlg.exec()== QDialog::Accepted ){
refresh();
}
}
void NNTPviewItem::disconnect()
{
QListViewItem *child = firstChild();
while ( child )
{
QListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
wrapper->logout();
}
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:
disconnect();
break;
case 1:
setOnOffline();
break;
case 2:
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 );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
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);
}
@@ -666,195 +666,194 @@ RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
}
QPopupMenu * IMAPfolderItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (folder->may_select())
{
m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS);
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);
}
if (folder->no_inferior()==false)
{
m->insertItem(QObject::tr("Create new subfolder",contextName),2);
}
if (folder->getDisplayName().lower()!="inbox")
{
m->insertItem(QObject::tr("Delete folder",contextName),3);
}
}
return m;
}
void IMAPfolderItem::createNewFolder()
{
Newmdirdlg ndirdlg;
ndirdlg.showMaximized();
if ( ndirdlg.exec() )
{
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);
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)
{
AccountView * view = (AccountView*)listView();
switch(id)
{
case 0:
view->refreshCurrent();
break;
case 1:
deleteAllMail(imap->getWrapper(),folder);
break;
case 2:
createNewFolder();
break;
case 3:
deleteFolder();
break;
case 4:
downloadMails();
break;
case GET_NEW_MAILS: // daunlood
{
- AccountView*bl = accountView();
- if (!bl) return;
- bl->downloadMailsInbox(getFolder(),imap->getWrapper());
+ if (!view) return;
+ view->downloadMailsInbox(getFolder(),imap->getWrapper());
}
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;
/* be carefull - the space within settext is wanted - thats why the string twice */
wrapper = AbstractMail::getWrapper( m_Path,"Local Folders");
setPixmap( 0, PIXMAP_LOCALFOLDER );
setText( 0, " Local Folders" );
setOpen( true );
folder = 0;
}
MHviewItem::~MHviewItem()
{
delete wrapper;
}
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;
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);
continue;
}
currentFolders.append(fname);
pos = fname.findRev("/");
if (pos > 0)
{
fname = fname.left(pos);
pmaster = (MHfolderItem*)findSubItem(fname);
}
else
{
pmaster = 0;
}
if (pmaster)
{
item = new MHfolderItem( (*it), pmaster, item, this );
}
else
{
item = new MHfolderItem( (*it), this , item );
}
item->setSelectable((*it)->may_select());
}
delete folders;
}
RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
{
return wrapper->fetchBody( mail );
}
QPopupMenu * MHviewItem::getContextMenu()
{
QPopupMenu *m = new QPopupMenu(0);
if (m)
{