summaryrefslogtreecommitdiffabout
path: root/kmicromail
Side-by-side diff
Diffstat (limited to 'kmicromail') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp4
-rw-r--r--kmicromail/accountview.cpp11
-rw-r--r--kmicromail/mainwindow.cpp22
-rw-r--r--kmicromail/mainwindow.h1
-rw-r--r--kmicromail/opiemail.cpp4
5 files changed, 36 insertions, 6 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index fcb2052..985a762 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -690,195 +690,195 @@ QPopupMenu * IMAPfolderItem::getContextMenu()
{
m->insertItem(i18n("Delete folder"),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,i18n("Delete folder"),
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();
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
{
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");
+ wrapper = AbstractMail::getWrapper( m_Path,"Local Mailfolders");
setPixmap( 0, PIXMAP_LOCALFOLDER );
- setText( 0, " Local Folders" );
+ setText( 0, i18n(" Local Mailfolders") );
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)
{
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;
}
void MHviewItem::createFolder()
{
Newmdirdlg ndirdlg(0,0,true);
//ndirdlg.showMaximized();
if ( ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
if (wrapper->createMbox(ndir))
{
refresh(true);
}
}
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp
index cef55ab..4879d57 100644
--- a/kmicromail/accountview.cpp
+++ b/kmicromail/accountview.cpp
@@ -4,197 +4,208 @@
#include "selectstore.h"
#include <libmailwrapper/settings.h>
#include <libmailwrapper/mailwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qcheckbox.h>
#include <qtimer.h>
#include <qspinbox.h>
#include <klocale.h>
#include <kmessagebox.h>
using namespace Opie::Core;
AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
: QListView( parent, name, flags )
{
//connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
// SLOT( refresh(QListViewItem*) ) );
connect( this, SIGNAL( clicked(QListViewItem*) ),
SLOT( refresh(QListViewItem*) ) );
connect( this, SIGNAL( returnPressed(QListViewItem*) ),
SLOT( refresh(QListViewItem*) ) );
connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) );
setSorting(0);
}
AccountView::~AccountView()
{
imapAccounts.clear();
mhAccounts.clear();
}
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();
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);
imapAccounts.append(new IMAPviewItem( imap, this ));
}
else if ( it->getType() == MAILLIB::A_POP3 )
{
POP3account *pop3 = static_cast<POP3account *>(it);
/* must not be hold 'cause it isn't required */
(void) new POP3viewItem( pop3, this );
}
else if ( it->getType() == MAILLIB::A_NNTP )
{
NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
/* must not be hold 'cause it isn't required */
(void) new NNTPviewItem( nntp, this );
}
}
}
void AccountView::refresh(QListViewItem *item)
{
if ( item )
{
+ bool ask = true;
+ qDebug("text -%s- ",item->text( 0 ).latin1() );
+ if ( item->text( 0 ) == i18n (" Local Mailfolders") )
+ ask = false;
+ else {
+ if ( item->parent() )
+ if ( item->parent()->text( 0 ) == i18n (" Local Mailfolders") )
+ ask = false;
+ }
+ if ( ask ) {
int result = KMessageBox::warningContinueCancel(this,
i18n("Refresh\n%1\n?").arg( item->text(0) ),
i18n("Refresh"),i18n("Refresh"),i18n("Cancel"),
true);
if (result != KMessageBox::Continue) return;
+ }
m_currentItem = item;
topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ;
QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) );
}
}
void AccountView::refreshOutgoing()
{
m_currentItem = currentItem();
if ( !m_currentItem ) return;
AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
if ( !view->getFolder() )
return;
QString bName = view->getFolder()->getDisplayName();
if (bName.startsWith("/")&&bName.length()>1)
{
bName.replace(0,1,"");
}
int pos = bName.findRev("/");
if (pos > 0)
{
bName.replace(0,pos+1,"");
}
//qDebug("name *%s* ",bName.lower().latin1() );
if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) {
refreshCurrent();
// qDebug("refresh ");
}
}
void AccountView::refreshCurrentSelected()
{
if ( !m_currentItem ) return;
QValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
view->refresh(headerlist);
emit refreshMailview(headerlist);
topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ;
}
void AccountView::refreshCurrent()
{
m_currentItem = currentItem();
if ( !m_currentItem ) return;
topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ;
QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) );
}
void AccountView::refreshAll()
{
}
RecBodyP AccountView::fetchBody(const RecMailP&aMail)
{
QListViewItem*item = selectedItem ();
if (!item) return new RecBody();
AccountViewItem *view = static_cast<AccountViewItem *>(item);
return view->fetchBody(aMail);
}
void AccountView::setupFolderselect(Selectstore*sels)
{
#ifndef DESKTOP_VERSION
sels->showMaximized();
#else
sels->show();
#endif
QStringList sFolders;
unsigned int i = 0;
for (i=0; i < mhAccounts.count();++i)
{
mhAccounts[i]->refresh(false);
sFolders = mhAccounts[i]->subFolders();
sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders);
}
for (i=0; i < imapAccounts.count();++i)
{
if (imapAccounts[i]->offline())
continue;
imapAccounts[i]->refreshFolders(false);
sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders());
}
}
void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper)
{
#if 0
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) ||
targetFolder.isEmpty())
{
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 82a915e..3dde3cd 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -272,162 +272,176 @@ void MainWindow::setInfoFields(QListViewItem* item )
if ( fromLE ) fromLE->setText(mail->getFrom());
if ( toLE ) toLE->setText(mail->To().join(";" ));
if ( subLE ) subLE->setCursorPosition(0);
if ( fromLE ) fromLE->setCursorPosition(0);
if ( toLE ) toLE->setCursorPosition(0);
}
void MainWindow::slotSetCodec( int codec )
{
codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
//qDebug("codec %d ", codec);
KOPrefs::instance()->mCurrentCodec = codec;
KOPrefs::instance()->isDirty = true;
QString name;
switch ( codec ) {
case 0:
name = "iso-8859-1";
break;
case 1:
name = "iso-8859-5";
break;
case 2:
name = "iso-8859-15";
break;
case 3:
name = "big-5";
break;
case 4:
name = "utf-8";
break;
case 5:
name = KOPrefs::instance()->mSendCodec.lower();
break;
}
KOPrefs::instance()->mCurrentCodeName = name ;
codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")");
codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true );
}
void MainWindow::showLicence()
{
KApplication::showLicence();
}
void MainWindow::showAbout()
{
QString version;
#include <../version>
QString cap = "About KOpieMail/Pi";
QString text = i18n("KOpieMail/Platform-independent\n") +
"(OM/Pi) " + version + " - "
#ifdef DESKTOP_VERSION
"Desktop Edition\n"
#else
"PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
#endif
"www.pi-sync.info\n\n"
"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n"
"KOpieMail/Pi is based on Opie Mail\n"
"Copyright (c) Rajko Albrecht and the Opie team\n"
"KOpieMail/Pi is licensed under the GPL\n"
"\n"
"KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
"Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
"libEtPan has its own licence - see LibEtPan licence\n";
KApplication::showText( cap, text );
}
void MainWindow::showEtpanLicence()
{
KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
}
void MainWindow::appMessage(const QCString &, const QByteArray &)
{
qDebug("appMessage implemented by subclass");
}
void MainWindow::slotAdjustLayout() {
/*
QWidget *d = QApplication::desktop();
if ( d->width() < d->height() ) {
layout->setDirection( QBoxLayout::TopToBottom );
} else {
layout->setDirection( QBoxLayout::LeftToRight );
}
*/
}
void MainWindow::slotAdjustColumns()
{
- bool hidden = folderView->isHidden();
- if ( hidden ) folderView->show();
+
+ if ( !folderView->isHidden() )
folderView->setColumnWidth( 0, folderView->visibleWidth() );
- if ( hidden ) folderView->hide();
mailView->setColumnWidth( 0, 10 );
mailView->setColumnWidth( 1, 100 );
mailView->setColumnWidth( 2, 100 );
mailView->setColumnWidth( 3, 70 );
- mailView->setColumnWidth( 4, 170 );
+ mailView->setColumnWidth( 4, 180 );
+ if ( KOPrefs::instance()->mShowToField )
+ mailView->setColumnWidth( 5, 100 );
+ mailView->setColumnAlignment( 3, AlignRight);
+ mailView->setColumnAlignment( 4, AlignRight);
+}
+void MainWindow::slotAdjustColumnsWide()
+{
+ if ( !folderView->isHidden() )
+ folderView->setColumnWidth( 0, folderView->visibleWidth() );
+
+ mailView->setColumnWidth( 0, 10 );
+ mailView->setColumnWidth( 1, 200 );
+ mailView->setColumnWidth( 2, 200 );
+ mailView->setColumnWidth( 3, 70 );
+ mailView->setColumnWidth( 4, 180 );
if ( KOPrefs::instance()->mShowToField )
mailView->setColumnWidth( 5, 100 );
mailView->setColumnAlignment( 3, AlignRight);
}
void MainWindow::slotEditSettings()
{
}
void MainWindow::slotEditGlobalSettings()
{
}
void MainWindow::slotShowFolders( bool )
{
qDebug("not implemented: ");
}
void MainWindow::refreshMailView(const QValueList<RecMailP>&)
{
qDebug("not implemented: ");
}
void MainWindow::mailLeftClicked(QListViewItem * )
{
qDebug("not implemented: ");
}
void MainWindow::displayMail()
{
qDebug("not implemented: ");
}
void MainWindow::slotDeleteMail()
{
qDebug("not implemented: ");
}
void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
{
qDebug("not implemented: ");
}
void MainWindow::slotSendQueued()
{
qDebug("not implemented: ");
}
void MainWindow::slotEditAccounts()
{
qDebug("not implemented: ");
}
void MainWindow::slotComposeMail()
{
qDebug("not implemented: ");
}
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index 178d2bb..f65f3b4 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -1,74 +1,75 @@
// CHANGED 2004-08-06 Lutz Rogowski
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
#include <klistview.h>
#include <qaction.h>
#include <qlineedit.h>
#include <qtoolbar.h>
#ifdef DESKTOP_VERSION
#include <qmenubar.h>
#define QPEMenuBar QMenuBar
#else
#include <qpe/qpemenubar.h>
#endif
#include "accountview.h"
#include "statuswidget.h"
#include <libmailwrapper/mailtypes.h>
#include <opie2/osmartpointer.h>
class RecMail;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
virtual ~MainWindow();
public slots:
virtual void slotAdjustColumns();
+ virtual void slotAdjustColumnsWide();
virtual void appMessage(const QCString &msg, const QByteArray &data);
virtual void slotComposeMail();
protected slots:
virtual void setInfoFields(QListViewItem* );
virtual void slotSendQueued();
virtual void slotEditAccounts();
virtual void slotShowFolders( bool show );
virtual void refreshMailView(const QValueList<RecMailP>&);
virtual void displayMail();
virtual void slotGetMail() = 0;
virtual void slotGetAllMail() = 0;
virtual void slotDeleteMail();
virtual void slotDeleteAllMail() = 0;
virtual void slotSetCodec(int);
virtual void mailHold(int, QListViewItem *,const QPoint&,int);
virtual void slotAdjustLayout();
virtual void slotEditSettings();
virtual void slotEditGlobalSettings();
virtual void mailLeftClicked( QListViewItem * );
void showLicence();
void showAbout();
void showEtpanLicence();
protected:
QToolBar *toolBar;
StatusWidget *statusWidget;
QPEMenuBar *menuBar;
QPopupMenu *mailMenu, *settingsMenu, *codecMenu;
QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
*editSettings, *editAccounts, *syncFolders;
AccountView *folderView;
KListView *mailView;
QLineEdit* toLE,*fromLE,*subLE;
//QBoxLayout *layout;
};
#endif
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index e296d9c..75a75b9 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -448,197 +448,201 @@ void OpieMail::slotGetAllMail()
void OpieMail::slotGetMail()
{
QListViewItem * item = folderView->currentItem();
if ( ! item ) return;
((AccountViewItem *)item)->contextMenuSelected( 101 );
}
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
mail->Wrapper()->deleteMail( mail );
folderView->refreshCurrent();
}
}
void OpieMail::slotDeleteAllMail()
{
QValueList<RecMailP> t;
if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
}
else
return;
if ( t.count() == 0 )
return;
RecMailP mail = t.first();
mail->Wrapper()->deleteMailList(t);
folderView->refreshCurrent();
}
void OpieMail::clearSelection()
{
mailView->clearSelection();
}
void OpieMail::selectAll()
{
QListViewItem* item = mailView->firstChild ();
while ( item ) {
mailView->setSelected ( item, true );
item = item->nextSibling();
}
}
void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
{
if (!mailView->currentItem()) return;
MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
/* just the RIGHT button - or hold on pda */
if (button!=2) {return;}
if (!item) return;
QPopupMenu *m = new QPopupMenu(0);
if (m)
{
if (mailtype==MAILLIB::A_NNTP) {
m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
m->insertSeparator();
m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
} else {
if (folderView->currentisDraft()) {
m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
}
m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
m->insertSeparator();
m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
m->insertSeparator();
m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
m->insertSeparator();
m->insertItem(i18n("Select all"),this,SLOT(selectAll()));
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
}
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
}
void OpieMail::slotShowFolders( bool show )
{
if ( show && folderView->isHidden() )
{
+ slotAdjustColumns();
folderView->show();
+ //slotAdjustColumns();
}
else if ( !show && !folderView->isHidden() )
{
+ slotAdjustColumnsWide();
folderView->hide();
+ //slotAdjustColumnsWide();
}
}
void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
{
MailListViewItem*item = 0;
mailView->clear();
QValueList<RecMailP>::ConstIterator it;
for (it = list.begin(); it != list.end();++it)
{
item = new MailListViewItem(mailView,item);
item->storeData((*it));
item->showEntry();
}
mailView->setSorting ( 4, false );
}
void OpieMail::mailLeftClicked( QListViewItem *item )
{
mailView->clearSelection();
/* just LEFT button - or tap with stylus on pda */
//if (button!=1) return;
if (!item) return;
if (folderView->currentisDraft()) {
reEditMail();
} else {
displayMail();
}
}
void OpieMail::slotMoveCopyMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
folderView->setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
targetFolder.isEmpty())
{
return;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
sels.hide();
qApp->processEvents();
// qDebug("hiding sels ");
mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
folderView->refreshCurrent();
}
void OpieMail::slotMoveCopyAllMail()
{
if (!mailView->currentItem()) return;
QValueList<RecMailP> t;
// if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
}
// else
// return;
if ( t.count() == 0 )
return;
RecMailP mail = t.first();
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
folderView->setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
targetFolder.isEmpty())
{
return;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("<center>Error while creating<br>new folder - breaking.</center>"));