summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-16 23:29:24 (UTC)
committer zautrix <zautrix>2004-09-16 23:29:24 (UTC)
commiteebe4409884ccd4dedb7cb697a800f74b33eb292 (patch) (unidiff)
treecd0a235edcab08ee8512c738624dcebac9502749
parentaf411746b1480e7b331ea7d163f39d2507cf7264 (diff)
downloadkdepimpi-eebe4409884ccd4dedb7cb697a800f74b33eb292.zip
kdepimpi-eebe4409884ccd4dedb7cb697a800f74b33eb292.tar.gz
kdepimpi-eebe4409884ccd4dedb7cb697a800f74b33eb292.tar.bz2
Fixes in ompi
Diffstat (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
@@ -1,278 +1,280 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#include "abstractmail.h" 2#include "abstractmail.h"
3#include "imapwrapper.h" 3#include "imapwrapper.h"
4#include "pop3wrapper.h" 4#include "pop3wrapper.h"
5#include "nntpwrapper.h" 5#include "nntpwrapper.h"
6#include "mhwrapper.h" 6#include "mhwrapper.h"
7#include "mailtypes.h" 7#include "mailtypes.h"
8#include <qpe/global.h> 8#include <qpe/global.h>
9 9
10 10
11#include <qprogressbar.h> 11#include <qprogressbar.h>
12#include <qapplication.h> 12#include <qapplication.h>
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14 14
15#include <kdecore/kstandarddirs.h> 15#include <kdecore/kstandarddirs.h>
16#include <qfile.h> 16#include <qfile.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#include <stdlib.h> 18#include <stdlib.h>
19#include <libetpan/mailmime_content.h> 19#include <libetpan/mailmime_content.h>
20#include <libetpan/mailmime.h> 20#include <libetpan/mailmime.h>
21 21
22using namespace Opie::Core; 22using namespace Opie::Core;
23AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) 23AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
24{ 24{
25 return new IMAPwrapper(a); 25 return new IMAPwrapper(a);
26} 26}
27 27
28AbstractMail* AbstractMail::getWrapper(POP3account *a) 28AbstractMail* AbstractMail::getWrapper(POP3account *a)
29{ 29{
30 return new POP3wrapper(a); 30 return new POP3wrapper(a);
31} 31}
32 32
33AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) 33AbstractMail* AbstractMail::getWrapper(NNTPaccount *a)
34{ 34{
35 return new NNTPwrapper(a); 35 return new NNTPwrapper(a);
36} 36}
37 37
38AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) 38AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
39{ 39{
40 return new MHwrapper(a,name); 40 return new MHwrapper(a,name);
41} 41}
42 42
43AbstractMail* AbstractMail::getWrapper(Account*a) 43AbstractMail* AbstractMail::getWrapper(Account*a)
44{ 44{
45 if (!a) return 0; 45 if (!a) return 0;
46 switch (a->getType()) { 46 switch (a->getType()) {
47 case MAILLIB::A_IMAP: 47 case MAILLIB::A_IMAP:
48 return new IMAPwrapper((IMAPaccount*)a); 48 return new IMAPwrapper((IMAPaccount*)a);
49 break; 49 break;
50 case MAILLIB::A_POP3: 50 case MAILLIB::A_POP3:
51 return new POP3wrapper((POP3account*)a); 51 return new POP3wrapper((POP3account*)a);
52 break; 52 break;
53 case MAILLIB::A_NNTP: 53 case MAILLIB::A_NNTP:
54 return new NNTPwrapper((NNTPaccount*)a); 54 return new NNTPwrapper((NNTPaccount*)a);
55 break; 55 break;
56 default: 56 default:
57 return 0; 57 return 0;
58 } 58 }
59} 59}
60 60
61encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) 61encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc)
62{ 62{
63 // odebug << "Decode string start" << oendl; 63 // odebug << "Decode string start" << oendl;
64 char*result_text; 64 char*result_text;
65 size_t index = 0; 65 size_t index = 0;
66 /* reset for recursive use! */ 66 /* reset for recursive use! */
67 size_t target_length = 0; 67 size_t target_length = 0;
68 result_text = 0; 68 result_text = 0;
69 int mimetype = MAILMIME_MECHANISM_7BIT; 69 int mimetype = MAILMIME_MECHANISM_7BIT;
70 if (enc.lower()=="quoted-printable") { 70 if (enc.lower()=="quoted-printable") {
71 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 71 mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
72 } else if (enc.lower()=="base64") { 72 } else if (enc.lower()=="base64") {
73 mimetype = MAILMIME_MECHANISM_BASE64; 73 mimetype = MAILMIME_MECHANISM_BASE64;
74 } else if (enc.lower()=="8bit") { 74 } else if (enc.lower()=="8bit") {
75 mimetype = MAILMIME_MECHANISM_8BIT; 75 mimetype = MAILMIME_MECHANISM_8BIT;
76 } else if (enc.lower()=="binary") { 76 } else if (enc.lower()=="binary") {
77 mimetype = MAILMIME_MECHANISM_BINARY; 77 mimetype = MAILMIME_MECHANISM_BINARY;
78 } 78 }
79 79
80 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, 80 int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype,
81 &result_text,&target_length); 81 &result_text,&target_length);
82 82
83 encodedString* result = new encodedString(); 83 encodedString* result = new encodedString();
84 if (err == MAILIMF_NO_ERROR) { 84 if (err == MAILIMF_NO_ERROR) {
85 result->setContent(result_text,target_length); 85 result->setContent(result_text,target_length);
86 } 86 }
87 //odebug << "Decode string finished" << oendl; 87 //odebug << "Decode string finished" << oendl;
88 return result; 88 return result;
89} 89}
90 90
91QString AbstractMail::convert_String(const char*text) 91QString AbstractMail::convert_String(const char*text)
92{ 92{
93 //size_t index = 0; 93 //size_t index = 0;
94 char*res = 0; 94 char*res = 0;
95 int err = MAILIMF_NO_ERROR; 95 int err = MAILIMF_NO_ERROR;
96 96
97 QString result(text); 97 QString result(text);
98 98
99 /* due a bug in libetpan it isn't usable this moment */ 99 /* due a bug in libetpan it isn't usable this moment */
100/* int err = mailmime_encoded_phrase_parse("iso-8859-1", 100/* int err = mailmime_encoded_phrase_parse("iso-8859-1",
101 text, strlen(text),&index, "iso-8859-1",&res);*/ 101 text, strlen(text),&index, "iso-8859-1",&res);*/
102 //odebug << "Input: " << text << "" << oendl; 102 //odebug << "Input: " << text << "" << oendl;
103 if (err == MAILIMF_NO_ERROR && res && strlen(res)) { 103 if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
104// result = QString(res); 104// result = QString(res);
105// odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl; 105// odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl;
106 } 106 }
107 if (res) free(res); 107 if (res) free(res);
108 return result; 108 return result;
109} 109}
110 110
111/* cp & paste from launcher */ 111/* cp & paste from launcher */
112QString AbstractMail::gen_attachment_id() 112QString AbstractMail::gen_attachment_id()
113{ 113{
114 QFile file( "/proc/sys/kernel/random/uuid" ); 114 QFile file( "/proc/sys/kernel/random/uuid" );
115 if (!file.open(IO_ReadOnly ) ) 115 if (!file.open(IO_ReadOnly ) )
116 return QString::null; 116 return QString::null;
117 117
118 QTextStream stream(&file); 118 QTextStream stream(&file);
119 119
120 return "{" + stream.read().stripWhiteSpace() + "}"; 120 return "{" + stream.read().stripWhiteSpace() + "}";
121} 121}
122 122
123int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) 123int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
124{ 124{
125 return 0; 125 return 0;
126} 126}
127 127
128QString AbstractMail::defaultLocalfolder() 128QString AbstractMail::defaultLocalfolder()
129{ 129{
130 // QString f = getenv( "HOME" ); 130 // QString f = getenv( "HOME" );
131 QString f = locateLocal( "data", "kopiemail/localmail"); 131 QString f = locateLocal( "data", "kopiemail/localmail");
132 // f += "/Applications/opiemail/localmail"; 132 // f += "/Applications/opiemail/localmail";
133 return f; 133 return f;
134} 134}
135 135
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;
260 } 262 }
261 if (moveit) { 263 if (moveit) {
262 deleteMailList( t ); 264 deleteMailList( t );
263 //deleteAllMail(fromFolder); 265 //deleteAllMail(fromFolder);
264 } 266 }
265} 267}
266 268
267void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) 269void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
268{ 270{
269 encodedString*st = 0; 271 encodedString*st = 0;
270 st = fetchRawBody(mail); 272 st = fetchRawBody(mail);
271 if (st) { 273 if (st) {
272 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); 274 targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
273 delete st; 275 delete st;
274 } 276 }
275 if (moveit) { 277 if (moveit) {
276 deleteMail(mail); 278 deleteMail(mail);
277 } 279 }
278} 280}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 2a67e39..ddded2a 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,229 +1,229 @@
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() ),
86 SLOT( slotDeleteMail() ) ); 86 SLOT( slotDeleteMail() ) );
87 87
88 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , 88 editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") ,
89 0, 0, this ); 89 0, 0, this );
90 editSettings->addTo( settingsMenu ); 90 editSettings->addTo( settingsMenu );
91 connect( editSettings, SIGNAL( activated() ), 91 connect( editSettings, SIGNAL( activated() ),
92 SLOT( slotEditSettings() ) ); 92 SLOT( slotEditSettings() ) );
93 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , 93 editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") ,
94 0, 0, this ); 94 0, 0, this );
95 editAccounts->addTo( settingsMenu ); 95 editAccounts->addTo( settingsMenu );
96 96
97 //setCentralWidget( view ); 97 //setCentralWidget( view );
98 98
99 QVBox* wrapperBox = new QVBox( this ); 99 QVBox* wrapperBox = new QVBox( this );
100 setCentralWidget( wrapperBox ); 100 setCentralWidget( wrapperBox );
101 101
102 // QWidget *view = new QWidget( wrapperBox ); 102 // QWidget *view = new QWidget( wrapperBox );
103 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 103 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
104 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 104 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
105 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 105 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
106 106
107 folderView = new AccountView( split ); 107 folderView = new AccountView( split );
108 folderView->header()->hide(); 108 folderView->header()->hide();
109 folderView->setRootIsDecorated( false ); 109 folderView->setRootIsDecorated( false );
110 folderView->addColumn( tr( "Mailbox" ) ); 110 folderView->addColumn( tr( "Mailbox" ) );
111 111
112 //layout->addWidget( folderView ); 112 //layout->addWidget( folderView );
113 113
114 mailView = new QListView( split ); 114 mailView = new QListView( split );
115 mailView->addColumn( tr( " " ) ); 115 mailView->addColumn( tr( " " ) );
116 mailView->addColumn( tr( "Subject" ),QListView::Manual ); 116 mailView->addColumn( tr( "Subject" ),QListView::Manual );
117 mailView->addColumn( tr( "Sender" ),QListView::Manual ); 117 mailView->addColumn( tr( "Sender" ),QListView::Manual );
118 mailView->addColumn( tr( "Size" ),QListView::Manual); 118 mailView->addColumn( tr( "Size" ),QListView::Manual);
119 mailView->addColumn( tr( "Date" ),QListView::Manual); 119 mailView->addColumn( tr( "Date" ),QListView::Manual);
120 mailView->setAllColumnsShowFocus(true); 120 mailView->setAllColumnsShowFocus(true);
121 //mailView->setSorting(-1); 121 //mailView->setSorting(-1);
122 mailView->setRootIsDecorated( false ); 122 mailView->setRootIsDecorated( false );
123 statusWidget = new StatusWidget( wrapperBox ); 123 statusWidget = new StatusWidget( wrapperBox );
124 statusWidget->hide(); 124 statusWidget->hide();
125 125
126 //layout->addWidget( mailView ); 126 //layout->addWidget( mailView );
127 //layout->setStretchFactor( folderView, 1 ); 127 //layout->setStretchFactor( folderView, 1 );
128 //layout->setStretchFactor( mailView, 2 ); 128 //layout->setStretchFactor( mailView, 2 );
129 129
130 slotAdjustLayout(); 130 slotAdjustLayout();
131#ifndef DESKTOP_VERSION 131#ifndef DESKTOP_VERSION
132 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 132 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
133 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 133 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
134#endif 134#endif
135 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 135 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
136 SLOT( mailLeftClicked(QListViewItem*) ) ); 136 SLOT( mailLeftClicked(QListViewItem*) ) );
137 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 137 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
138 SLOT( mailLeftClicked(QListViewItem*) ) ); 138 SLOT( mailLeftClicked(QListViewItem*) ) );
139 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 139 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
140 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 140 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
141 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 141 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
142 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 142 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
143 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 143 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
144 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 144 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
145// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 145// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
146 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 146 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
147 //mailView->setMultiSelection ( true ); 147 //mailView->setMultiSelection ( true );
148 mailView->setSelectionMode( QListView::Extended ); 148 mailView->setSelectionMode( QListView::Extended );
149 QValueList<int> list; 149 QValueList<int> list;
150 int fw = 100; 150 int fw = 100;
151 if ( QApplication::desktop()->width() > 320 ) 151 if ( QApplication::desktop()->width() > 320 )
152 fw = 50; 152 fw = 50;
153 list.append( fw ); 153 list.append( fw );
154 list.append( 100 ); 154 list.append( 100 );
155 split->setSizes( list ); 155 split->setSizes( list );
156 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 156 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
157 mailView->setShowSortIndicator ( true ); 157 mailView->setShowSortIndicator ( true );
158 QLabel *spacer = new QLabel( toolBar ); 158 QLabel *spacer = new QLabel( toolBar );
159 spacer->setBackgroundMode( QWidget::PaletteButton ); 159 spacer->setBackgroundMode( QWidget::PaletteButton );
160 toolBar->setStretchableWidget( spacer ); 160 toolBar->setStretchableWidget( spacer );
161 161
162 QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); 162 QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this);
163 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 163 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
164 if ( QApplication::desktop()->width() > 320 ) 164 if ( QApplication::desktop()->width() > 320 )
165 closeMail->addTo(toolBar); 165 closeMail->addTo(toolBar);
166 closeMail->addTo(mailMenu); 166 closeMail->addTo(mailMenu);
167 167
168 168
169 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 169 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
170 menuBar->insertItem( tr( "Help" ), helpMenu ); 170 menuBar->insertItem( tr( "Help" ), helpMenu );
171 QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); 171 QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this);
172 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 172 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
173 li->addTo(helpMenu); 173 li->addTo(helpMenu);
174 li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); 174 li = new QAction(tr("Licence"),QPixmap(), 0, 0, this);
175 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 175 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
176 li->addTo(helpMenu); 176 li->addTo(helpMenu);
177 li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); 177 li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this);
178 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 178 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
179 li->addTo(helpMenu); 179 li->addTo(helpMenu);
180} 180}
181 181
182MainWindow::~MainWindow() 182MainWindow::~MainWindow()
183{ 183{
184} 184}
185 185
186void MainWindow::showLicence() 186void MainWindow::showLicence()
187{ 187{
188 KApplication::showLicence(); 188 KApplication::showLicence();
189} 189}
190void MainWindow::showAbout() 190void MainWindow::showAbout()
191{ 191{
192 QString version; 192 QString version;
193#include <../version> 193#include <../version>
194 194
195 QString cap = "About KOpieMail/Pi"; 195 QString cap = "About KOpieMail/Pi";
196 QString text =i18n("KOpieMail/Platform-independent\n") + 196 QString text =i18n("KOpieMail/Platform-independent\n") +
197 "(OM/Pi) " + version + " - " 197 "(OM/Pi) " + version + " - "
198 198
199#ifdef DESKTOP_VERSION 199#ifdef DESKTOP_VERSION
200 "Desktop Edition\n" 200 "Desktop Edition\n"
201#else 201#else
202 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 202 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
203#endif 203#endif
204 "www.pi-sync.net\n\n" 204 "www.pi-sync.net\n\n"
205 205
206 206
207 207
208"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" 208"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
209 "KOpieMail/Pi is based on Opie Mail\n" 209 "KOpieMail/Pi is based on Opie Mail\n"
210 "Copyright (c) Rajko Albrecht and the Opie team\n" 210 "Copyright (c) Rajko Albrecht and the Opie team\n"
211 "KOpieMail/Pi is licensed under the GPL\n" 211 "KOpieMail/Pi is licensed under the GPL\n"
212 "\n" 212 "\n"
213 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 213 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
214 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 214 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
215 "libEtPan has its own licence - see LibEtPan licence\n"; 215 "libEtPan has its own licence - see LibEtPan licence\n";
216 216
217 KApplication::showText( cap, text ); 217 KApplication::showText( cap, text );
218} 218}
219void MainWindow::showEtpanLicence() 219void MainWindow::showEtpanLicence()
220{ 220{
221 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 221 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
222 222
223} 223}
224void MainWindow::appMessage(const QCString &, const QByteArray &) 224void MainWindow::appMessage(const QCString &, const QByteArray &)
225{ 225{
226 qDebug("appMessage implemented by subclass"); 226 qDebug("appMessage implemented by subclass");
227} 227}
228 228
229void MainWindow::slotAdjustLayout() { 229void MainWindow::slotAdjustLayout() {
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 3cbac8e..9a1a750 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -76,386 +76,384 @@ void OpieMail::message(const QCString &msg, const QByteArray &data)
76 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 76 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
77 // slotComposeMail(); 77 // slotComposeMail();
78 } 78 }
79 else if (msg == "newMail(QString)") 79 else if (msg == "newMail(QString)")
80 { 80 {
81 //qDebug(" newMail(QString)"); 81 //qDebug(" newMail(QString)");
82 QDataStream stream(data,IO_ReadOnly); 82 QDataStream stream(data,IO_ReadOnly);
83 stream >> mPendingName; 83 stream >> mPendingName;
84 // the format is 84 // the format is
85 // NAME <EMAIL>:SUBJECT 85 // NAME <EMAIL>:SUBJECT
86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
87 } else { 87 } else {
88 mPendingData = data; 88 mPendingData = data;
89 mPendingMessage = msg; 89 mPendingMessage = msg;
90 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 90 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
91 } 91 }
92 92
93 //qDebug("END OpieMail::message "); 93 //qDebug("END OpieMail::message ");
94} 94}
95void OpieMail::slotExtAppHandler() 95void OpieMail::slotExtAppHandler()
96{ 96{
97 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 97 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
98} 98}
99void OpieMail::slotwriteMail2(const QString& namemail ) 99void OpieMail::slotwriteMail2(const QString& namemail )
100{ 100{
101 //qDebug("OpieMail::slotwriteMail2 "); 101 //qDebug("OpieMail::slotwriteMail2 ");
102 //qApp->processEvents(); 102 //qApp->processEvents();
103 ComposeMail compose( settings, this, 0, true ); 103 ComposeMail compose( settings, this, 0, true );
104 if ( !namemail.isEmpty() ) { 104 if ( !namemail.isEmpty() ) {
105 QString to = namemail; 105 QString to = namemail;
106 if ( namemail.find( " <") > 1 ) { 106 if ( namemail.find( " <") > 1 ) {
107 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 107 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
108 } else 108 } else
109 if ( namemail.find( "<") > 1 ) { 109 if ( namemail.find( "<") > 1 ) {
110 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 110 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
111 } 111 }
112 int sub = to.find( ">:"); 112 int sub = to.find( ">:");
113 if ( sub > 0 ) { 113 if ( sub > 0 ) {
114 compose.setTo( to.left(sub+1) ); 114 compose.setTo( to.left(sub+1) );
115 compose.setSubject( to.mid(sub+2) ); 115 compose.setSubject( to.mid(sub+2) );
116 } else 116 } else
117 compose.setTo( to ); 117 compose.setTo( to );
118 } 118 }
119 compose.slotAdjustColumns(); 119 compose.slotAdjustColumns();
120 compose.showMaximized(); 120 compose.showMaximized();
121 compose.exec(); 121 compose.exec();
122 raise(); 122 raise();
123 //qDebug("retttich "); 123 //qDebug("retttich ");
124} 124}
125void OpieMail::slotwriteMail(const QString&name,const QString&email) 125void OpieMail::slotwriteMail(const QString&name,const QString&email)
126{ 126{
127 // qDebug("OpieMail::slotwriteMail "); 127 // qDebug("OpieMail::slotwriteMail ");
128 ComposeMail compose( settings, this, 0, true ); 128 ComposeMail compose( settings, this, 0, true );
129 if (!email.isEmpty()) 129 if (!email.isEmpty())
130 { 130 {
131 if (!name.isEmpty()) 131 if (!name.isEmpty())
132 { 132 {
133 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 133 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
134 } 134 }
135 else 135 else
136 { 136 {
137 compose.setTo(email); 137 compose.setTo(email);
138 } 138 }
139 } 139 }
140 compose.slotAdjustColumns(); 140 compose.slotAdjustColumns();
141 compose.showMaximized(); 141 compose.showMaximized();
142 compose.exec(); 142 compose.exec();
143 raise(); 143 raise();
144} 144}
145 145
146void OpieMail::slotComposeMail() 146void OpieMail::slotComposeMail()
147{ 147{
148 if ( mPendingEmail == QString::null && mPendingName == QString::null) 148 if ( mPendingEmail == QString::null && mPendingName == QString::null)
149 slotwriteMail2( QString () ); 149 slotwriteMail2( QString () );
150 else { 150 else {
151 if ( mPendingEmail == QString::null ) 151 if ( mPendingEmail == QString::null )
152 slotwriteMail2( mPendingName ); 152 slotwriteMail2( mPendingName );
153 else 153 else
154 slotwriteMail( mPendingName, mPendingEmail ); 154 slotwriteMail( mPendingName, mPendingEmail );
155 } 155 }
156 //slotwriteMail(0l,0l); 156 //slotwriteMail(0l,0l);
157} 157}
158 158
159void OpieMail::slotSendQueued() 159void OpieMail::slotSendQueued()
160{ 160{
161 SMTPaccount *smtp = 0; 161 SMTPaccount *smtp = 0;
162 162
163 QList<Account> list = settings->getAccounts(); 163 QList<Account> list = settings->getAccounts();
164 QList<SMTPaccount> smtpList; 164 QList<SMTPaccount> smtpList;
165 smtpList.setAutoDelete(false); 165 smtpList.setAutoDelete(false);
166 Account *it; 166 Account *it;
167 for ( it = list.first(); it; it = list.next() ) 167 for ( it = list.first(); it; it = list.next() )
168 { 168 {
169 if ( it->getType() == MAILLIB::A_SMTP ) 169 if ( it->getType() == MAILLIB::A_SMTP )
170 { 170 {
171 smtp = static_cast<SMTPaccount *>(it); 171 smtp = static_cast<SMTPaccount *>(it);
172 smtpList.append(smtp); 172 smtpList.append(smtp);
173 } 173 }
174 } 174 }
175 if (smtpList.count()==0) 175 if (smtpList.count()==0)
176 { 176 {
177 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); 177 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
178 return; 178 return;
179 } 179 }
180 if (smtpList.count()==1) 180 if (smtpList.count()==1)
181 { 181 {
182 smtp = smtpList.at(0); 182 smtp = smtpList.at(0);
183 } 183 }
184 else 184 else
185 { 185 {
186 smtp = 0; 186 smtp = 0;
187 selectsmtp selsmtp; 187 selectsmtp selsmtp;
188 selsmtp.setSelectionlist(&smtpList); 188 selsmtp.setSelectionlist(&smtpList);
189 selsmtp.showMaximized(); 189 selsmtp.showMaximized();
190 if ( selsmtp.exec() == QDialog::Accepted ) 190 if ( selsmtp.exec() == QDialog::Accepted )
191 { 191 {
192 smtp = selsmtp.selected_smtp(); 192 smtp = selsmtp.selected_smtp();
193 } 193 }
194 } 194 }
195 if (smtp) 195 if (smtp)
196 { 196 {
197 SMTPwrapper * wrap = new SMTPwrapper(smtp); 197 SMTPwrapper * wrap = new SMTPwrapper(smtp);
198 if ( wrap->flushOutbox() ) 198 if ( wrap->flushOutbox() )
199 { 199 {
200 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 200 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
201 } 201 }
202 delete wrap; 202 delete wrap;
203 } 203 }
204} 204}
205 205
206void OpieMail::slotSearchMails() 206void OpieMail::slotSearchMails()
207{ 207{
208 qDebug("OpieMail::slotSearchMails():not implemented "); 208 qDebug("OpieMail::slotSearchMails():not implemented ");
209} 209}
210 210
211void OpieMail::slotEditSettings() 211void OpieMail::slotEditSettings()
212{ 212{
213#if 0 213#if 0
214 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 214 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
215 settingsDialog.showMaximized(); 215 settingsDialog.showMaximized();
216 settingsDialog.exec(); 216 settingsDialog.exec();
217#endif 217#endif
218 KOPrefsDialog settingsDialog( this, "koprefs", true ); 218 KOPrefsDialog settingsDialog( this, "koprefs", true );
219 settingsDialog.showMaximized(); 219 settingsDialog.showMaximized();
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;}
318 if (!item) return; 316 if (!item) return;
319 QPopupMenu *m = new QPopupMenu(0); 317 QPopupMenu *m = new QPopupMenu(0);
320 if (m) 318 if (m)
321 { 319 {
322 if (mailtype==MAILLIB::A_NNTP) { 320 if (mailtype==MAILLIB::A_NNTP) {
323 m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); 321 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
324 m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); 322 m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
325 m->insertSeparator(); 323 m->insertSeparator();
326 m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 324 m->insertItem(tr("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
327 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 325 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
328 } else { 326 } else {
329 if (folderView->currentisDraft()) { 327 if (folderView->currentisDraft()) {
330 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); 328 m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail()));
331 } 329 }
332 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 330 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
333 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 331 m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
334 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 332 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
335 m->insertSeparator(); 333 m->insertSeparator();
336 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 334 m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
337 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 335 m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
338 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); 336 m->insertItem(tr("Clear selection"),this,SLOT(clearSelection()));
339 } 337 }
340 m->setFocus(); 338 m->setFocus();
341 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 339 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
342 delete m; 340 delete m;
343 } 341 }
344} 342}
345 343
346void OpieMail::slotShowFolders( bool show ) 344void OpieMail::slotShowFolders( bool show )
347{ 345{
348 if ( show && folderView->isHidden() ) 346 if ( show && folderView->isHidden() )
349 { 347 {
350 folderView->show(); 348 folderView->show();
351 } 349 }
352 else if ( !show && !folderView->isHidden() ) 350 else if ( !show && !folderView->isHidden() )
353 { 351 {
354 folderView->hide(); 352 folderView->hide();
355 } 353 }
356} 354}
357 355
358void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 356void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
359{ 357{
360 MailListViewItem*item = 0; 358 MailListViewItem*item = 0;
361 mailView->clear(); 359 mailView->clear();
362 360
363 QValueList<RecMailP>::ConstIterator it; 361 QValueList<RecMailP>::ConstIterator it;
364 for (it = list.begin(); it != list.end();++it) 362 for (it = list.begin(); it != list.end();++it)
365 { 363 {
366 item = new MailListViewItem(mailView,item); 364 item = new MailListViewItem(mailView,item);
367 item->storeData((*it)); 365 item->storeData((*it));
368 item->showEntry(); 366 item->showEntry();
369 } 367 }
370} 368}
371 369
372void OpieMail::mailLeftClicked( QListViewItem *item ) 370void OpieMail::mailLeftClicked( QListViewItem *item )
373{ 371{
374 mailView->clearSelection(); 372 mailView->clearSelection();
375 /* just LEFT button - or tap with stylus on pda */ 373 /* just LEFT button - or tap with stylus on pda */
376 //if (button!=1) return; 374 //if (button!=1) return;
377 if (!item) return; 375 if (!item) return;
378 if (folderView->currentisDraft()) { 376 if (folderView->currentisDraft()) {
379 reEditMail(); 377 reEditMail();
380 } else { 378 } else {
381 displayMail(); 379 displayMail();
382 } 380 }
383} 381}
384 382
385void OpieMail::slotMoveCopyMail() 383void OpieMail::slotMoveCopyMail()
386{ 384{
387 if (!mailView->currentItem()) return; 385 if (!mailView->currentItem()) return;
388 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 386 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
389 AbstractMail*targetMail = 0; 387 AbstractMail*targetMail = 0;
390 QString targetFolder = ""; 388 QString targetFolder = "";
391 Selectstore sels; 389 Selectstore sels;
392 folderView->setupFolderselect(&sels); 390 folderView->setupFolderselect(&sels);
393 if (!sels.exec()) return; 391 if (!sels.exec()) return;
394 targetMail = sels.currentMail(); 392 targetMail = sels.currentMail();
395 targetFolder = sels.currentFolder(); 393 targetFolder = sels.currentFolder();
396 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 394 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
397 targetFolder.isEmpty()) 395 targetFolder.isEmpty())
398 { 396 {
399 return; 397 return;
400 } 398 }
401 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 399 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
402 { 400 {
403 QMessageBox::critical(0,tr("Error creating new Folder"), 401 QMessageBox::critical(0,tr("Error creating new Folder"),
404 tr("<center>Error while creating<br>new folder - breaking.</center>")); 402 tr("<center>Error while creating<br>new folder - breaking.</center>"));
405 return; 403 return;
406 } 404 }
407 sels.hide(); 405 sels.hide();
408 qApp->processEvents(); 406 qApp->processEvents();
409 // qDebug("hiding sels "); 407 // qDebug("hiding sels ");
410 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 408 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
411 folderView->refreshCurrent(); 409 folderView->refreshCurrent();
412} 410}
413 411
414void OpieMail::slotMoveCopyAllMail() 412void OpieMail::slotMoveCopyAllMail()
415{ 413{
416 414
417 if (!mailView->currentItem()) return; 415 if (!mailView->currentItem()) return;
418 QValueList<RecMailP> t; 416 QValueList<RecMailP> t;
419 // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 417 // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
420 { 418 {
421 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 419 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
422 while ( item ) { 420 while ( item ) {
423 if ( item->isSelected() ) { 421 if ( item->isSelected() ) {
424 t.append( item->data() ); 422 t.append( item->data() );
425 } 423 }
426 item = (MailListViewItem*)item->nextSibling(); 424 item = (MailListViewItem*)item->nextSibling();
427 } 425 }
428 } 426 }
429 // else 427 // else
430 // return; 428 // return;
431 if ( t.count() == 0 ) 429 if ( t.count() == 0 )
432 return; 430 return;
433 RecMailP mail = t.first(); 431 RecMailP mail = t.first();
434 AbstractMail*targetMail = 0; 432 AbstractMail*targetMail = 0;
435 QString targetFolder = ""; 433 QString targetFolder = "";
436 Selectstore sels; 434 Selectstore sels;
437 folderView->setupFolderselect(&sels); 435 folderView->setupFolderselect(&sels);
438 if (!sels.exec()) return; 436 if (!sels.exec()) return;
439 targetMail = sels.currentMail(); 437 targetMail = sels.currentMail();
440 targetFolder = sels.currentFolder(); 438 targetFolder = sels.currentFolder();
441 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 439 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
442 targetFolder.isEmpty()) 440 targetFolder.isEmpty())
443 { 441 {
444 return; 442 return;
445 } 443 }
446 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 444 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
447 { 445 {
448 QMessageBox::critical(0,tr("Error creating new Folder"), 446 QMessageBox::critical(0,tr("Error creating new Folder"),
449 tr("<center>Error while creating<br>new folder - breaking.</center>")); 447 tr("<center>Error while creating<br>new folder - breaking.</center>"));
450 return; 448 return;
451 } 449 }
452 sels.hide(); 450 sels.hide();
453 qApp->processEvents(); 451 qApp->processEvents();
454 //qDebug("hiding sels "); 452 //qDebug("hiding sels ");
455 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); 453 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
456 folderView->refreshCurrent(); 454 folderView->refreshCurrent();
457} 455}
458 456
459void OpieMail::reEditMail() 457void OpieMail::reEditMail()
460{ 458{
461 if (!mailView->currentItem()) return; 459 if (!mailView->currentItem()) return;