summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp2
-rw-r--r--kmicromail/mainwindow.cpp2
-rw-r--r--kmicromail/opiemail.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 88545f8..673f288 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -136,124 +136,126 @@ QString AbstractMail::defaultLocalfolder()
136QString AbstractMail::draftFolder() 136QString AbstractMail::draftFolder()
137{ 137{
138 return QString("Drafts"); 138 return QString("Drafts");
139} 139}
140 140
141/* temporary - will be removed when implemented in all classes */ 141/* temporary - will be removed when implemented in all classes */
142void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) 142void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &)
143{ 143{
144} 144}
145void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) 145void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
146{ 146{
147 //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); 147 //qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
148 // this is currently re-implemented in pop3wrapper and imapwrapper 148 // this is currently re-implemented in pop3wrapper and imapwrapper
149 int iii = 0; 149 int iii = 0;
150 int count = target.count(); 150 int count = target.count();
151 QProgressBar wid ( count ); 151 QProgressBar wid ( count );
152 wid.setCaption( tr("Deleting ...")); 152 wid.setCaption( tr("Deleting ..."));
153 wid.show(); 153 wid.show();
154 while (iii < count ) { 154 while (iii < count ) {
155 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); 155 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count));
156 wid.setProgress( iii ); 156 wid.setProgress( iii );
157 wid.raise(); 157 wid.raise();
158 qApp->processEvents(); 158 qApp->processEvents();
159 RecMailP mail = (*target.at( iii )); 159 RecMailP mail = (*target.at( iii ));
160 deleteMail(mail); 160 deleteMail(mail);
161 ++iii; 161 ++iii;
162 } 162 }
163} 163}
164 164
165void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) 165void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail )
166{ 166{
167 //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); 167 //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1());
168 // get local folder 168 // get local folder
169 Account * acc = getAccount(); 169 Account * acc = getAccount();
170 if ( !acc ) return; 170 if ( !acc ) return;
171 QString lfName = acc->getLocalFolder(); 171 QString lfName = acc->getLocalFolder();
172 if ( lfName.isEmpty() ) 172 if ( lfName.isEmpty() )
173 lfName = acc->getAccountName(); 173 lfName = acc->getAccountName();
174 // create local folder 174 // create local folder
175 if ( !targetMail->createMbox(lfName)) 175 if ( !targetMail->createMbox(lfName))
176 { 176 {
177 QMessageBox::critical(0,tr("Error creating new Folder"), 177 QMessageBox::critical(0,tr("Error creating new Folder"),
178 tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); 178 tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
179 return; 179 return;
180 } 180 }
181 QValueList<RecMailP> t; 181 QValueList<RecMailP> t;
182 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); 182 listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
183 if ( t.count() == 0 ) { 183 if ( t.count() == 0 ) {
184 qDebug("There are no new messages %s", fromFolder->getName().latin1());
184 Global::statusMessage(tr("There are no new messages")); 185 Global::statusMessage(tr("There are no new messages"));
185 return; 186 return;
186 } 187 }
187 QValueList<RecMailP> e; 188 QValueList<RecMailP> e;
188 targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); 189 targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
189 //qDebug("target has mails %d ", e.count()); 190 //qDebug("target has mails %d ", e.count());
190 QValueList<RecMailP> n; 191 QValueList<RecMailP> n;
191 int iii = 0; 192 int iii = 0;
192 int count = t.count(); 193 int count = t.count();
193 while (iii < count ) { 194 while (iii < count ) {
194 RecMailP r = (*t.at( iii )); 195 RecMailP r = (*t.at( iii ));
195 bool found = false; 196 bool found = false;
196 int jjj = 0; 197 int jjj = 0;
197 int countE = e.count(); 198 int countE = e.count();
198 while (jjj < countE ) { 199 while (jjj < countE ) {
199 RecMailP re = (*e.at( jjj )); 200 RecMailP re = (*e.at( jjj ));
200 if ( re->isEqual(r) ) { 201 if ( re->isEqual(r) ) {
201 found = true; 202 found = true;
202 break; 203 break;
203 } 204 }
204 ++jjj; 205 ++jjj;
205 } 206 }
206 if ( !found ) { 207 if ( !found ) {
207 //qDebug("AAAdate *%s* ", r->isodate.latin1() ); 208 //qDebug("AAAdate *%s* ", r->isodate.latin1() );
208 n.append( r ); 209 n.append( r );
209 } 210 }
210 ++iii; 211 ++iii;
211 } 212 }
213 qDebug("Downloaded %d messages ",n.count() );
212 if ( n.count() == 0 ) { 214 if ( n.count() == 0 ) {
213 Global::statusMessage(tr("There are no new messages")); 215 Global::statusMessage(tr("There are no new messages"));
214 return; 216 return;
215 } 217 }
216 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); 218 mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer());
217 Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); 219 Global::statusMessage(tr("Downloaded %1 messages").arg(n.count()));
218 220
219#if 0 221#if 0
220 QValueList<RecMailP> t; 222 QValueList<RecMailP> t;
221 listMessages(fromFolder->getName(),t, maxSizeInKb); 223 listMessages(fromFolder->getName(),t, maxSizeInKb);
222 mvcpMailList( t,targetFolder,targetWrapper,moveit); 224 mvcpMailList( t,targetFolder,targetWrapper,moveit);
223#endif 225#endif
224 226
225} 227}
226void AbstractMail::mvcpAllMails(const FolderP&fromFolder, 228void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
227 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) 229 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
228{ 230{
229 QValueList<RecMailP> t; 231 QValueList<RecMailP> t;
230 listMessages(fromFolder->getName(),t, maxSizeInKb); 232 listMessages(fromFolder->getName(),t, maxSizeInKb);
231 mvcpMailList( t,targetFolder,targetWrapper,moveit); 233 mvcpMailList( t,targetFolder,targetWrapper,moveit);
232 234
233} 235}
234void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, 236void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
235 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 237 const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
236{ 238{
237 encodedString*st = 0; 239 encodedString*st = 0;
238 int iii = 0; 240 int iii = 0;
239 int count = t.count(); 241 int count = t.count();
240 if ( count == 0 ) 242 if ( count == 0 )
241 return; 243 return;
242 // wel, processevents is qite strange, we need a widget for getting 244 // wel, processevents is qite strange, we need a widget for getting
243 // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye 245 // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye
244 246
245 QProgressBar wid ( count ); 247 QProgressBar wid ( count );
246 wid.setCaption( tr("Copying ...")); 248 wid.setCaption( tr("Copying ..."));
247 wid.show(); 249 wid.show();
248 while (iii < count ) { 250 while (iii < count ) {
249 Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count)); 251 Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count));
250 wid.setProgress( iii ); 252 wid.setProgress( iii );
251 wid.raise(); 253 wid.raise();
252 qApp->processEvents(); 254 qApp->processEvents();
253 RecMailP r = (*t.at( iii )); 255 RecMailP r = (*t.at( iii ));
254 st = fetchRawBody(r); 256 st = fetchRawBody(r);
255 if (st) { 257 if (st) {
256 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); 258 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
257 delete st; 259 delete st;
258 } 260 }
259 ++iii; 261 ++iii;
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 2a67e39..ddded2a 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,85 +1,85 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qvbox.h> 4#include <qvbox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qlayout.h> 7#include <qlayout.h>
8#include <kdialog.h> 8#include <kdialog.h>
9#include <kiconloader.h> 9#include <kiconloader.h>
10#include <kapplication.h> 10#include <kapplication.h>
11 11
12#ifndef DESKTOP_VERSION 12#ifndef DESKTOP_VERSION
13#include <qpe/qpeapplication.h> 13#include <qpe/qpeapplication.h>
14#endif 14#endif
15#include "defines.h" 15#include "defines.h"
16#include "mainwindow.h" 16#include "mainwindow.h"
17#include <KDGanttMinimizeSplitter.h> 17#include <KDGanttMinimizeSplitter.h>
18 18
19 19
20#include <kabc/stdaddressbook.h> 20#include <kabc/stdaddressbook.h>
21 21
22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 22MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
23 : QMainWindow( parent, name ) //, flags ) 23 : QMainWindow( parent, name ) //, flags )
24{ 24{
25 setCaption( tr( "KOpieMail/Pi" ) ); 25 setCaption( tr( "KOpieMail/Pi" ) );
26 setToolBarsMovable( false ); 26 setToolBarsMovable( false );
27 //KABC::StdAddressBook::self(); 27 //KABC::StdAddressBook::self();
28 toolBar = new QToolBar( this ); 28 toolBar = new QToolBar( this );
29 menuBar = new QPEMenuBar( toolBar ); 29 menuBar = new QPEMenuBar( toolBar );
30 mailMenu = new QPopupMenu( menuBar ); 30 mailMenu = new QPopupMenu( menuBar );
31 menuBar->insertItem( tr( "Mail" ), mailMenu ); 31 menuBar->insertItem( tr( "Mail" ), mailMenu );
32 settingsMenu = new QPopupMenu( menuBar ); 32 settingsMenu = new QPopupMenu( menuBar );
33 menuBar->insertItem( tr( "Settings" ), settingsMenu ); 33 menuBar->insertItem( tr( "Settings" ), settingsMenu );
34 34
35 addToolBar( toolBar ); 35 addToolBar( toolBar );
36 toolBar->setHorizontalStretchable( true ); 36 toolBar->setHorizontalStretchable( true );
37 QAction* getMail = new QAction( tr( "Get all new mails" ), SmallIcon("add"), 37 QAction* getMail = new QAction( tr( "Get all new mails" ), SmallIcon("enter"),
38 0, 0, this ); 38 0, 0, this );
39 connect(getMail, SIGNAL( activated() ), 39 connect(getMail, SIGNAL( activated() ),
40 SLOT( slotGetAllMail() ) ); 40 SLOT( slotGetAllMail() ) );
41 getMail->addTo( mailMenu ); 41 getMail->addTo( mailMenu );
42 42
43 getMail = new QAction( tr( "Get new messages" ), SmallIcon("add"), 43 getMail = new QAction( tr( "Get new messages" ), SmallIcon("add"),
44 0, 0, this ); 44 0, 0, this );
45 getMail->addTo( toolBar ); 45 getMail->addTo( toolBar );
46 getMail->addTo( mailMenu ); 46 getMail->addTo( mailMenu );
47 connect(getMail, SIGNAL( activated() ), 47 connect(getMail, SIGNAL( activated() ),
48 SLOT( slotGetMail() ) ); 48 SLOT( slotGetMail() ) );
49 49
50 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), 50 composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"),
51 0, 0, this ); 51 0, 0, this );
52 composeMail->addTo( toolBar ); 52 composeMail->addTo( toolBar );
53 composeMail->addTo( mailMenu ); 53 composeMail->addTo( mailMenu );
54 54
55 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , 55 sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") ,
56 0, 0, this ); 56 0, 0, this );
57 sendQueued->addTo( toolBar ); 57 sendQueued->addTo( toolBar );
58 sendQueued->addTo( mailMenu ); 58 sendQueued->addTo( mailMenu );
59 59
60 /* 60 /*
61 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, 61 syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC,
62 0, 0, this ); 62 0, 0, this );
63 syncFolders->addTo( toolBar ); 63 syncFolders->addTo( toolBar );
64 syncFolders->addTo( mailMenu ); 64 syncFolders->addTo( mailMenu );
65 */ 65 */
66 66
67 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , 67 showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") ,
68 0, 0, this, 0, true ); 68 0, 0, this, 0, true );
69 showFolders->addTo( toolBar ); 69 showFolders->addTo( toolBar );
70 showFolders->addTo( mailMenu ); 70 showFolders->addTo( mailMenu );
71 showFolders->setOn( true ); 71 showFolders->setOn( true );
72 connect(showFolders, SIGNAL( toggled(bool) ), 72 connect(showFolders, SIGNAL( toggled(bool) ),
73 SLOT( slotShowFolders(bool) ) ); 73 SLOT( slotShowFolders(bool) ) );
74 74
75 /* 75 /*
76 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), 76 searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ),
77 0, 0, this ); 77 0, 0, this );
78 searchMails->addTo( toolBar ); 78 searchMails->addTo( toolBar );
79 searchMails->addTo( mailMenu ); 79 searchMails->addTo( mailMenu );
80 */ 80 */
81 81
82 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); 82 deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this);
83 deleteMails->addTo( toolBar ); 83 deleteMails->addTo( toolBar );
84 deleteMails->addTo( mailMenu ); 84 deleteMails->addTo( mailMenu );
85 connect( deleteMails, SIGNAL( activated() ), 85 connect( deleteMails, SIGNAL( activated() ),
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 3cbac8e..9a1a750 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -220,98 +220,96 @@ void OpieMail::slotEditSettings()
220 settingsDialog.exec(); 220 settingsDialog.exec();
221} 221}
222 222
223void OpieMail::slotEditAccounts() 223void OpieMail::slotEditAccounts()
224{ 224{
225 EditAccounts eaDialog( settings, this, 0, true ); 225 EditAccounts eaDialog( settings, this, 0, true );
226 eaDialog.slotAdjustColumns(); 226 eaDialog.slotAdjustColumns();
227 eaDialog.showMaximized(); 227 eaDialog.showMaximized();
228 eaDialog.exec(); 228 eaDialog.exec();
229 if ( settings ) delete settings; 229 if ( settings ) delete settings;
230 settings = new Settings(); 230 settings = new Settings();
231 231
232 folderView->populate( settings->getAccounts() ); 232 folderView->populate( settings->getAccounts() );
233} 233}
234 234
235void OpieMail::displayMail() 235void OpieMail::displayMail()
236{ 236{
237 QListViewItem*item = mailView->currentItem(); 237 QListViewItem*item = mailView->currentItem();
238 if (!item) return; 238 if (!item) return;
239 RecMailP mail = ((MailListViewItem*)item)->data(); 239 RecMailP mail = ((MailListViewItem*)item)->data();
240 RecBodyP body = folderView->fetchBody(mail); 240 RecBodyP body = folderView->fetchBody(mail);
241 ViewMail readMail( this,"", Qt::WType_Modal ); 241 ViewMail readMail( this,"", Qt::WType_Modal );
242 readMail.setBody( body ); 242 readMail.setBody( body );
243 readMail.setMail( mail ); 243 readMail.setMail( mail );
244 readMail.showMaximized(); 244 readMail.showMaximized();
245 readMail.exec(); 245 readMail.exec();
246 246
247 if ( readMail.deleted ) 247 if ( readMail.deleted )
248 { 248 {
249 folderView->refreshCurrent(); 249 folderView->refreshCurrent();
250 } 250 }
251 else 251 else
252 { 252 {
253 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 253 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
254 } 254 }
255} 255}
256void OpieMail::slotGetAllMail() 256void OpieMail::slotGetAllMail()
257{ 257{
258 QListViewItem * item = folderView->firstChild(); 258 QListViewItem * item = folderView->firstChild();
259 while ( item ){ 259 while ( item ){
260 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 260 ((AccountViewItem *)item)->contextMenuSelected( 101 );
261 item = item->nextSibling (); 261 item = item->nextSibling ();
262 } 262 }
263} 263}
264void OpieMail::slotGetMail() 264void OpieMail::slotGetMail()
265{ 265{
266 QListViewItem * item = folderView->currentItem(); 266 QListViewItem * item = folderView->currentItem();
267 if ( ! item ) return; 267 if ( ! item ) return;
268 while ( item->parent () )
269 item = item->parent ();
270 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 268 ((AccountViewItem *)item)->contextMenuSelected( 101 );
271} 269}
272void OpieMail::slotDeleteMail() 270void OpieMail::slotDeleteMail()
273{ 271{
274 if (!mailView->currentItem()) return; 272 if (!mailView->currentItem()) return;
275 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 273 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
276 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 ) 274 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 )
277 { 275 {
278 mail->Wrapper()->deleteMail( mail ); 276 mail->Wrapper()->deleteMail( mail );
279 folderView->refreshCurrent(); 277 folderView->refreshCurrent();
280 } 278 }
281} 279}
282void OpieMail::slotDeleteAllMail() 280void OpieMail::slotDeleteAllMail()
283{ 281{
284 282
285 QValueList<RecMailP> t; 283 QValueList<RecMailP> t;
286 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 284 if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
287 { 285 {
288 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 286 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
289 while ( item ) { 287 while ( item ) {
290 if ( item->isSelected() ) { 288 if ( item->isSelected() ) {
291 t.append( item->data() ); 289 t.append( item->data() );
292 } 290 }
293 item = (MailListViewItem*)item->nextSibling(); 291 item = (MailListViewItem*)item->nextSibling();
294 } 292 }
295 } 293 }
296 else 294 else
297 return; 295 return;
298 if ( t.count() == 0 ) 296 if ( t.count() == 0 )
299 return; 297 return;
300 RecMailP mail = t.first(); 298 RecMailP mail = t.first();
301 mail->Wrapper()->deleteMailList(t); 299 mail->Wrapper()->deleteMailList(t);
302 folderView->refreshCurrent(); 300 folderView->refreshCurrent();
303 301
304 302
305} 303}
306void OpieMail::clearSelection() 304void OpieMail::clearSelection()
307{ 305{
308 mailView->clearSelection(); 306 mailView->clearSelection();
309 307
310} 308}
311 309
312void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 310void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
313{ 311{
314 if (!mailView->currentItem()) return; 312 if (!mailView->currentItem()) return;
315 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 313 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
316 /* just the RIGHT button - or hold on pda */ 314 /* just the RIGHT button - or hold on pda */
317 if (button!=2) {return;} 315 if (button!=2) {return;}