summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-28 17:50:33 (UTC)
committer alwin <alwin>2003-12-28 17:50:33 (UTC)
commit0f6e3b4aa6faeb48df9e595fb2f50e78333d64d7 (patch) (side-by-side diff)
treefee79098277e76942485646d766b21c93ccbc599
parent696a2dcfcb65fbb24b709bbae0a18a7854e2d72c (diff)
downloadopie-0f6e3b4aa6faeb48df9e595fb2f50e78333d64d7.zip
opie-0f6e3b4aa6faeb48df9e595fb2f50e78333d64d7.tar.gz
opie-0f6e3b4aa6faeb48df9e595fb2f50e78333d64d7.tar.bz2
fix for compiling with arm gcc 2.95.3 (next time I'll check before commit)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index f861c20..9f07f56 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -302,195 +302,197 @@ void IMAPfolderItem::refresh(QList<RecMail>&target)
if (folder->may_select()) {
imap->getWrapper()->listMessages( folder->getName(),target );
} else {
target.clear();
}
}
RecBody IMAPfolderItem::fetchBody(const RecMail&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("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);
qDebug("Auswahl: %i",yesno);
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::contextMenuSelected(int id)
{
qDebug("Selected id: %i",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;
default:
break;
}
}
/**
* Generic stuff
*/
const QString AccountViewItem::contextName="AccountViewItem";
void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*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((folder?folder->getDisplayName():"")),
+ arg(fname),
QObject::tr("Yes",contextName),
QObject::tr("No",contextName),QString::null,1,1);
qDebug("Auswahl: %i",yesno);
if (yesno == 0) {
if (wrapper->deleteAllMail(folder)) {
AccountView * view = (AccountView*)listView();
if (view) view->refreshCurrent();
}
}
}
AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
: QListView( parent, name, flags )
{
connect( this, SIGNAL( selectionChanged( QListViewItem * ) ),
SLOT( refresh( QListViewItem * ) ) );
connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this,
SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) );
setSorting(0);
}
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)
{
if (button==1) {return;}
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;
}
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()
{
m_currentItem = currentItem();
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();