summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -350,99 +350,101 @@ void IMAPfolderItem::deleteFolder()
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);