summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp11
-rw-r--r--noncore/net/mail/accountview.h1
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.cpp13
-rw-r--r--noncore/net/mail/libmailwrapper/abstractmail.h1
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp30
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h1
-rw-r--r--noncore/net/mail/mail.pro1
-rw-r--r--noncore/net/mail/mailistviewitem.cpp65
-rw-r--r--noncore/net/mail/mailistviewitem.h1
-rw-r--r--noncore/net/mail/mainwindow.cpp151
-rw-r--r--noncore/net/mail/mainwindow.h1
-rw-r--r--noncore/net/mail/opiemail.cpp119
-rw-r--r--noncore/net/mail/opiemail.h8
13 files changed, 263 insertions, 140 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index b7de7b9..9f4f358 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -872,10 +872,18 @@ QPopupMenu * MBOXfolderItem::getContextMenu()
872 if (m) { 872 if (m) {
873 m->insertItem(QObject::tr("Delete all mails",contextName),0); 873 m->insertItem(QObject::tr("Delete all mails",contextName),0);
874 m->insertItem(QObject::tr("Delete folder",contextName),1); 874 m->insertItem(QObject::tr("Delete folder",contextName),1);
875 m->insertItem(QObject::tr("Move/Copie all mails",contextName),2);
875 } 876 }
876 return m; 877 return m;
877} 878}
878 879
880void MBOXfolderItem::downloadMails()
881{
882 AccountView*bl = mbox->accountView();
883 if (!bl) return;
884 bl->downloadMails(folder,mbox->getWrapper());
885}
886
879void MBOXfolderItem::contextMenuSelected(int which) 887void MBOXfolderItem::contextMenuSelected(int which)
880{ 888{
881 switch(which) { 889 switch(which) {
@@ -885,6 +893,9 @@ void MBOXfolderItem::contextMenuSelected(int which)
885 case 1: 893 case 1:
886 deleteFolder(); 894 deleteFolder();
887 break; 895 break;
896 case 2:
897 downloadMails();
898 break;
888 default: 899 default:
889 break; 900 break;
890 } 901 }
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h
index df916c1..d9b5558 100644
--- a/noncore/net/mail/accountview.h
+++ b/noncore/net/mail/accountview.h
@@ -153,6 +153,7 @@ public:
153 virtual Folder*getFolder(); 153 virtual Folder*getFolder();
154 154
155protected: 155protected:
156 void downloadMails();
156 virtual void deleteFolder(); 157 virtual void deleteFolder();
157 Folder *folder; 158 Folder *folder;
158 MBOXviewItem *mbox; 159 MBOXviewItem *mbox;
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp
index 4b4c728..0280803 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.cpp
+++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp
@@ -123,3 +123,16 @@ void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,Abs
123 deleteAllMail(fromFolder); 123 deleteAllMail(fromFolder);
124 } 124 }
125} 125}
126
127void AbstractMail::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
128{
129 encodedString*st = 0;
130 st = fetchRawBody(mail);
131 if (st) {
132 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
133 delete st;
134 }
135 if (moveit) {
136 deleteMail(mail);
137 }
138}
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h
index 8debaae..f93bab4 100644
--- a/noncore/net/mail/libmailwrapper/abstractmail.h
+++ b/noncore/net/mail/libmailwrapper/abstractmail.h
@@ -36,6 +36,7 @@ public:
36 virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; 36 virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0;
37 37
38 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 38 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
39 virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
39 40
40 virtual void cleanMimeCache(){}; 41 virtual void cleanMimeCache(){};
41 /* mail box methods */ 42 /* mail box methods */
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 98634a3..4b633ea 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -1056,3 +1056,33 @@ void IMAPwrapper::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,Abst
1056 deleteAllMail(fromFolder); 1056 deleteAllMail(fromFolder);
1057 } 1057 }
1058} 1058}
1059
1060void IMAPwrapper::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
1061{
1062 if (targetWrapper != this) {
1063 qDebug("Using generic");
1064 AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit);
1065 return;
1066 }
1067 mailimap_set *set = 0;
1068 login();
1069 if (!m_imap) {
1070 return;
1071 }
1072 int err = selectMbox(mail.getMbox());
1073 if ( err != MAILIMAP_NO_ERROR ) {
1074 return;
1075 }
1076 set = mailimap_set_new_single(mail.getNumber());
1077 err = mailimap_copy(m_imap,set,targetFolder.latin1());
1078 mailimap_set_free( set );
1079 if ( err != MAILIMAP_NO_ERROR ) {
1080 QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response);
1081 Global::statusMessage(error_msg);
1082 qDebug(error_msg);
1083 return;
1084 }
1085 if (moveit) {
1086 deleteMail(mail);
1087 }
1088}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index 99986c2..c10f86a 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -32,6 +32,7 @@ public:
32 virtual int deleteAllMail(const Folder*folder); 32 virtual int deleteAllMail(const Folder*folder);
33 virtual void storeMessage(const char*msg,size_t length, const QString&folder); 33 virtual void storeMessage(const char*msg,size_t length, const QString&folder);
34 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); 34 virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
35 virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
35 36
36 virtual RecBody fetchBody(const RecMail&mail); 37 virtual RecBody fetchBody(const RecMail&mail);
37 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part); 38 virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index 1abd2e8..90e1e46 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -23,6 +23,7 @@ SOURCES = main.cpp \
23 editaccounts.cpp \ 23 editaccounts.cpp \
24 viewmail.cpp \ 24 viewmail.cpp \
25 viewmailbase.cpp \ 25 viewmailbase.cpp \
26 mailistviewitem.cpp \
26 settingsdialog.cpp \ 27 settingsdialog.cpp \
27 statuswidget.cpp \ 28 statuswidget.cpp \
28 newmaildir.cpp \ 29 newmaildir.cpp \
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp
new file mode 100644
index 0000000..f224dc3
--- a/dev/null
+++ b/noncore/net/mail/mailistviewitem.cpp
@@ -0,0 +1,65 @@
1#include "mailistviewitem.h"
2#include <qtextstream.h>
3#include <qpe/resource.h>
4
5MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
6 :QListViewItem(parent,item),mail_data()
7{
8}
9
10void MailListViewItem::showEntry()
11{
12 if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) {
13 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") );
14 } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
15 /* I think it looks nicer if there are not such a log of icons but only on mails
16 replied or new - Alwin*/
17 //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
18 } else {
19 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") );
20 }
21 double s = mail_data.Msgsize();
22 int w;
23 w=0;
24
25 while (s>1024) {
26 s/=1024;
27 ++w;
28 if (w>=2) break;
29 }
30
31 QString q="";
32 QString fsize="";
33 switch(w) {
34 case 1:
35 q="k";
36 break;
37 case 2:
38 q="M";
39 break;
40 default:
41 break;
42 }
43
44 {
45 QTextOStream o(&fsize);
46 if (w>0) o.precision(2); else o.precision(0);
47 o.setf(QTextStream::fixed);
48 o << s << " " << q << "Byte";
49 }
50
51 setText(1,mail_data.getSubject());
52 setText(2,mail_data.getFrom());
53 setText(3,fsize);
54 setText(4,mail_data.getDate());
55}
56
57void MailListViewItem::storeData(const RecMail&data)
58{
59 mail_data = data;
60}
61
62const RecMail& MailListViewItem::data()const
63{
64 return mail_data;
65}
diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h
index 271f616..3b352a2 100644
--- a/noncore/net/mail/mailistviewitem.h
+++ b/noncore/net/mail/mailistviewitem.h
@@ -4,7 +4,6 @@
4#include <qlistview.h> 4#include <qlistview.h>
5#include <libmailwrapper/mailtypes.h> 5#include <libmailwrapper/mailtypes.h>
6 6
7
8class MailListViewItem:public QListViewItem 7class MailListViewItem:public QListViewItem
9{ 8{
10public: 9public:
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index e16f853..c38392c 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -4,17 +4,12 @@
4#include <qtimer.h> 4#include <qtimer.h>
5#include <qlayout.h> 5#include <qlayout.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7#include <qtextstream.h>
8 7
9#include <qpe/qpeapplication.h> 8#include <qpe/qpeapplication.h>
10#include <qpe/resource.h> 9#include <qpe/resource.h>
11 10
12
13#include "defines.h" 11#include "defines.h"
14#include "mainwindow.h" 12#include "mainwindow.h"
15#include "viewmail.h"
16#include <libmailwrapper/mailtypes.h>
17#include "mailistviewitem.h"
18 13
19 14
20MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 15MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
@@ -127,6 +122,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
127 connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, 122 connect( mailView, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this,
128 SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) ); 123 SLOT( mailHold( int, QListViewItem *,const QPoint&,int ) ) );
129 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*))); 124 connect(folderView, SIGNAL(refreshMailview(QList<RecMail>*)),this,SLOT(refreshMailView(QList<RecMail>*)));
125 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
126 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
127// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
128 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
129 // Added by Stefan Eilers to allow starting by addressbook..
130 // copied from old mail2
131#if !defined(QT_NO_COP)
132 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ),
133 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
134#endif
130 135
131 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 136 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
132} 137}
@@ -135,6 +140,11 @@ MainWindow::~MainWindow()
135{ 140{
136} 141}
137 142
143void MainWindow::appMessage(const QCString &, const QByteArray &)
144{
145 qDebug("appMessage not reached");
146}
147
138void MainWindow::slotAdjustLayout() { 148void MainWindow::slotAdjustLayout() {
139 149
140 QWidget *d = QApplication::desktop(); 150 QWidget *d = QApplication::desktop();
@@ -164,141 +174,32 @@ void MainWindow::slotEditSettings()
164{ 174{
165} 175}
166 176
167void MainWindow::slotShowFolders( bool show ) 177void MainWindow::slotShowFolders( bool )
168{ 178{
169 qDebug( "Show Folders" ); 179 qDebug( "slotShowFolders not reached" );
170 if ( show && folderView->isHidden() ) {
171 qDebug( "-> showing" );
172 folderView->show();
173 } else if ( !show && !folderView->isHidden() ) {
174 qDebug( "-> hiding" );
175 folderView->hide();
176 }
177} 180}
178 181
179void MainWindow::refreshMailView(QList<RecMail>*list) 182void MainWindow::refreshMailView(QList<RecMail>*)
180{ 183{
181 MailListViewItem*item = 0; 184 qDebug( "refreshMailView not reached" );
182 mailView->clear();
183 for (unsigned int i = 0; i < list->count();++i) {
184 item = new MailListViewItem(mailView,item);
185 item->storeData(*(list->at(i)));
186 item->showEntry();
187 }
188} 185}
189void MainWindow::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) 186
187void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int )
190{ 188{
191 /* just LEFT button - or tap with stylus on pda */ 189 qDebug( "mailLeftClicked not reached" );
192 if (button!=1) return;
193 if (!item) return;
194 displayMail();
195} 190}
196 191
197void MainWindow::displayMail() 192void MainWindow::displayMail()
198{ 193{
199 QListViewItem*item = mailView->currentItem(); 194 qDebug("displayMail not reached");
200 if (!item) return;
201 RecMail mail = ((MailListViewItem*)item)->data();
202 RecBody body = folderView->fetchBody(mail);
203 ViewMail readMail( this );
204 readMail.setBody( body );
205 readMail.setMail( mail );
206 readMail.showMaximized();
207 readMail.exec();
208
209 if ( readMail.deleted ) {
210 folderView->refreshCurrent();
211 } else {
212 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "") );
213 }
214} 195}
215 196
216void MainWindow::slotDeleteMail() 197void MainWindow::slotDeleteMail()
217{ 198{
218 if (!mailView->currentItem()) return; 199 qDebug("deleteMail not reached");
219 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
220 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
221 mail.Wrapper()->deleteMail( mail );
222 folderView->refreshCurrent();
223 }
224}
225
226void MainWindow::mailHold(int button, QListViewItem *item,const QPoint&,int )
227{
228 /* just the RIGHT button - or hold on pda */
229 if (button!=2) {return;}
230 qDebug("Event right/hold");
231 if (!item) return;
232 QPopupMenu *m = new QPopupMenu(0);
233 if (m) {
234 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
235 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
236 m->setFocus();
237 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
238 delete m;
239 }
240}
241
242MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
243 :QListViewItem(parent,item),mail_data()
244{
245}
246
247void MailListViewItem::showEntry()
248{
249 if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) {
250 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") );
251 } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
252 /* I think it looks nicer if there are not such a log of icons but only on mails
253 replied or new - Alwin*/
254 //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") );
255 } else {
256 setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") );
257 }
258 double s = mail_data.Msgsize();
259 int w;
260 w=0;
261
262 while (s>1024) {
263 s/=1024;
264 ++w;
265 if (w>=2) break;
266 }
267
268 QString q="";
269 QString fsize="";
270 switch(w) {
271 case 1:
272 q="k";
273 break;
274 case 2:
275 q="M";
276 break;
277 default:
278 break;
279 }
280
281 {
282 QTextOStream o(&fsize);
283 if (w>0) o.precision(2); else o.precision(0);
284 o.setf(QTextStream::fixed);
285 o << s << " " << q << "Byte";
286 }
287
288 setText(1,mail_data.getSubject());
289 setText(2,mail_data.getFrom());
290 setText(3,fsize);
291 setText(4,mail_data.getDate());
292} 200}
293 201
294void MailListViewItem::storeData(const RecMail&data) 202void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
295{ 203{
296 mail_data = data; 204 qDebug("mailHold not reached");
297} 205}
298
299const RecMail& MailListViewItem::data()const
300{
301 return mail_data;
302}
303
304
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h
index 15d216a..20614cc 100644
--- a/noncore/net/mail/mainwindow.h
+++ b/noncore/net/mail/mainwindow.h
@@ -23,6 +23,7 @@ public:
23 23
24public slots: 24public slots:
25 virtual void slotAdjustColumns(); 25 virtual void slotAdjustColumns();
26 virtual void appMessage(const QCString &msg, const QByteArray &data);
26 27
27protected slots: 28protected slots:
28 virtual void slotShowFolders( bool show ); 29 virtual void slotShowFolders( bool show );
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index c888708..dee3f70 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -5,8 +5,13 @@
5#include "composemail.h" 5#include "composemail.h"
6#include <libmailwrapper/smtpwrapper.h> 6#include <libmailwrapper/smtpwrapper.h>
7#include <qpe/qcopenvelope_qws.h> 7#include <qpe/qcopenvelope_qws.h>
8#include <qpe/resource.h>
8#include <qaction.h> 9#include <qaction.h>
9#include <qapplication.h> 10#include <qapplication.h>
11#include <libmailwrapper/mailtypes.h>
12#include "mailistviewitem.h"
13#include "viewmail.h"
14#include "selectstore.h"
10 15
11OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) 16OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
12 : MainWindow( parent, name, flags ) 17 : MainWindow( parent, name, flags )
@@ -14,20 +19,6 @@ OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
14 settings = new Settings(); 19 settings = new Settings();
15 20
16 folderView->populate( settings->getAccounts() ); 21 folderView->populate( settings->getAccounts() );
17
18 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
19 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
20// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
21 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
22 // Added by Stefan Eilers to allow starting by addressbook..
23 // copied from old mail2
24#if !defined(QT_NO_COP)
25 connect( qApp, SIGNAL( appMessage( const QCString&, const QByteArray& ) ),
26 this, SLOT( appMessage( const QCString&, const QByteArray& ) ) );
27#endif
28
29
30
31} 22}
32 23
33OpieMail::~OpieMail() 24OpieMail::~OpieMail()
@@ -118,3 +109,103 @@ void OpieMail::slotEditAccounts()
118 folderView->populate( settings->getAccounts() ); 109 folderView->populate( settings->getAccounts() );
119} 110}
120 111
112void OpieMail::displayMail()
113{
114 QListViewItem*item = mailView->currentItem();
115 if (!item) return;
116 RecMail mail = ((MailListViewItem*)item)->data();
117 RecBody body = folderView->fetchBody(mail);
118 ViewMail readMail( this );
119 readMail.setBody( body );
120 readMail.setMail( mail );
121 readMail.showMaximized();
122 readMail.exec();
123
124 if ( readMail.deleted ) {
125 folderView->refreshCurrent();
126 } else {
127 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "") );
128 }
129}
130
131void OpieMail::slotDeleteMail()
132{
133 if (!mailView->currentItem()) return;
134 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
135 if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
136 mail.Wrapper()->deleteMail( mail );
137 folderView->refreshCurrent();
138 }
139}
140
141void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
142{
143 /* just the RIGHT button - or hold on pda */
144 if (button!=2) {return;}
145 qDebug("Event right/hold");
146 if (!item) return;
147 QPopupMenu *m = new QPopupMenu(0);
148 if (m) {
149 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
150 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
151 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
152 m->setFocus();
153 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
154 delete m;
155 }
156}
157
158void OpieMail::slotShowFolders( bool show )
159{
160 qDebug( "Show Folders" );
161 if ( show && folderView->isHidden() ) {
162 qDebug( "-> showing" );
163 folderView->show();
164 } else if ( !show && !folderView->isHidden() ) {
165 qDebug( "-> hiding" );
166 folderView->hide();
167 }
168}
169
170void OpieMail::refreshMailView(QList<RecMail>*list)
171{
172 MailListViewItem*item = 0;
173 mailView->clear();
174 for (unsigned int i = 0; i < list->count();++i) {
175 item = new MailListViewItem(mailView,item);
176 item->storeData(*(list->at(i)));
177 item->showEntry();
178 }
179}
180
181void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
182{
183 /* just LEFT button - or tap with stylus on pda */
184 if (button!=1) return;
185 if (!item) return;
186 displayMail();
187}
188
189void OpieMail::slotMoveCopyMail()
190{
191 if (!mailView->currentItem()) return;
192 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
193 AbstractMail*targetMail = 0;
194 QString targetFolder = "";
195 Selectstore sels;
196 folderView->setupFolderselect(&sels);
197 if (!sels.exec()) return;
198 targetMail = sels.currentMail();
199 targetFolder = sels.currentFolder();
200 if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) ||
201 targetFolder.isEmpty()) {
202 return;
203 }
204 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) {
205 QMessageBox::critical(0,tr("Error creating new Folder"),
206 tr("<center>Error while creating<br>new folder - breaking.</center>"));
207 return;
208 }
209 mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
210 folderView->refreshCurrent();
211}
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h
index 69b8d43..5821856 100644
--- a/noncore/net/mail/opiemail.h
+++ b/noncore/net/mail/opiemail.h
@@ -23,6 +23,14 @@ protected slots:
23 virtual void slotSearchMails(); 23 virtual void slotSearchMails();
24 virtual void slotEditSettings(); 24 virtual void slotEditSettings();
25 virtual void slotEditAccounts(); 25 virtual void slotEditAccounts();
26 virtual void displayMail();
27 virtual void slotDeleteMail();
28 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
29 virtual void slotShowFolders( bool show );
30 virtual void refreshMailView(QList<RecMail>*);
31 virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int );
32 virtual void slotMoveCopyMail();
33
26private: 34private:
27 Settings *settings; 35 Settings *settings;
28 36