summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-09-11 10:30:57 (UTC)
committer zautrix <zautrix>2004-09-11 10:30:57 (UTC)
commitd7a273f40838f56205c1377ed0bcc5457bd46ea3 (patch) (unidiff)
tree9f01120382589404ff8dca3170f9472bdd0f18fb /kmicromail
parent0f45c977d7530b6ca827b7a7c7da7469f01800ca (diff)
downloadkdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.zip
kdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.tar.gz
kdepimpi-d7a273f40838f56205c1377ed0bcc5457bd46ea3.tar.bz2
More mail settings
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp17
-rw-r--r--kmicromail/libmailwrapper/settings.cpp85
-rw-r--r--kmicromail/libmailwrapper/settings.h3
3 files changed, 80 insertions, 25 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index e7d2750..d43d23b 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -348,43 +348,56 @@ void IMAPconfig::slotConnectionToggle( int index )
348 } 348 }
349 else 349 else
350 { 350 {
351 portLine->setText( IMAP_PORT ); 351 portLine->setText( IMAP_PORT );
352 } 352 }
353} 353}
354 354
355void IMAPconfig::fillValues() 355void IMAPconfig::fillValues()
356{ 356{
357 accountLine->setText( data->getAccountName() ); 357 accountLine->setText( data->getAccountName() );
358 serverLine->setText( data->getServer() ); 358 serverLine->setText( data->getServer() );
359 portLine->setText( data->getPort() ); 359 portLine->setText( data->getPort() );
360 ComboBox1->setCurrentItem( data->ConnectionType() ); 360 ComboBox1->setCurrentItem( data->ConnectionType() );
361 userLine->setText( data->getUser() ); 361 userLine->setText( data->getUser() );
362 passLine->setText( data->getPassword() ); 362 passLine->setText( data->getPassword() );
363 prefixLine->setText(data->getPrefix()); 363 prefixLine->setText(data->getPrefix());
364 localFolder->setText( data->getLocalFolder() );
365 int max = data->getMaxMailSize() ;
366 if ( max ) {
367 CheckBoxDown->setChecked( true );
368 SpinBoxDown->setValue ( max );
369 } else {
370 CheckBoxDown->setChecked( false );
371 SpinBoxDown->setValue ( 5 );
372 }
373 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
364} 374}
365 375
366void IMAPconfig::accept() 376void IMAPconfig::accept()
367{ 377{
368 data->setAccountName( accountLine->text() ); 378 data->setAccountName( accountLine->text() );
369 data->setServer( serverLine->text() ); 379 data->setServer( serverLine->text() );
370 data->setPort( portLine->text() ); 380 data->setPort( portLine->text() );
371 data->setConnectionType( ComboBox1->currentItem() ); 381 data->setConnectionType( ComboBox1->currentItem() );
372 data->setUser( userLine->text() ); 382 data->setUser( userLine->text() );
373 data->setPassword( passLine->text() ); 383 data->setPassword( passLine->text() );
374 data->setPrefix(prefixLine->text()); 384 data->setPrefix(prefixLine->text());
385 data->setLocalFolder( localFolder->text() );
386 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
387 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
375 388
376 QDialog::accept(); 389 QDialog::accept();
377} 390}
378 391
379/** 392/**
380 * POP3config 393 * POP3config
381 */ 394 */
382 395
383POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 396POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
384 : POP3configUI( parent, name, modal, flags ) 397 : POP3configUI( parent, name, modal, flags )
385{ 398{
386 data = account; 399 data = account;
387 fillValues(); 400 fillValues();
388 401
389 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 402 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
390 ComboBox1->insertItem( "Only if available", 0 ); 403 ComboBox1->insertItem( "Only if available", 0 );
@@ -417,44 +430,46 @@ void POP3config::fillValues()
417{ 430{
418 accountLine->setText( data->getAccountName() ); 431 accountLine->setText( data->getAccountName() );
419 serverLine->setText( data->getServer() ); 432 serverLine->setText( data->getServer() );
420 portLine->setText( data->getPort() ); 433 portLine->setText( data->getPort() );
421 ComboBox1->setCurrentItem( data->ConnectionType() ); 434 ComboBox1->setCurrentItem( data->ConnectionType() );
422 userLine->setText( data->getUser() ); 435 userLine->setText( data->getUser() );
423 passLine->setText( data->getPassword() ); 436 passLine->setText( data->getPassword() );
424 localFolder->setText( data->getLocalFolder() ); 437 localFolder->setText( data->getLocalFolder() );
425 int max = data->getMaxMailSize() ; 438 int max = data->getMaxMailSize() ;
426 if ( max ) { 439 if ( max ) {
427 CheckBoxDown->setChecked( true ); 440 CheckBoxDown->setChecked( true );
428 SpinBoxDown->setValue ( max ); 441 SpinBoxDown->setValue ( max );
429 } else { 442 } else {
430 CheckBoxDown->setChecked( false ); 443 CheckBoxDown->setChecked( false );
431 SpinBoxDown->setValue ( 5 ); 444 SpinBoxDown->setValue ( 5 );
432 } 445 }
446 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
433} 447}
434 448
435void POP3config::accept() 449void POP3config::accept()
436{ 450{
437 data->setAccountName( accountLine->text() ); 451 data->setAccountName( accountLine->text() );
438 data->setServer( serverLine->text() ); 452 data->setServer( serverLine->text() );
439 data->setPort( portLine->text() ); 453 data->setPort( portLine->text() );
440 data->setConnectionType( ComboBox1->currentItem() ); 454 data->setConnectionType( ComboBox1->currentItem() );
441 data->setUser( userLine->text() ); 455 data->setUser( userLine->text() );
442 data->setPassword( passLine->text() ); 456 data->setPassword( passLine->text() );
443 data->setLocalFolder( localFolder->text() ); 457 data->setLocalFolder( localFolder->text() );
444 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 458 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
459 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
445 460
446 QDialog::accept(); 461 QDialog::accept();
447} 462}
448 463
449/** 464/**
450 * SMTPconfig 465 * SMTPconfig
451 */ 466 */
452 467
453SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 468SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
454 : SMTPconfigUI( parent, name, modal, flags ) 469 : SMTPconfigUI( parent, name, modal, flags )
455{ 470{
456 data = account; 471 data = account;
457 472
458 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 473 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
459 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 474 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
460 475
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index f996d9c..766eba0 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -1,21 +1,21 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <qdir.h> 2#include <qdir.h>
3 3
4//#include <opie2/odebug.h> 4//#include <opie2/odebug.h>
5#include <qpe/config.h> 5#include <kconfig.h>
6 6
7#include <kstandarddirs.h> 7#include <kstandarddirs.h>
8#include "settings.h" 8#include "settings.h"
9//#include "defines.h" 9//#include "defines.h"
10 10
11#define IMAP_PORT "143" 11#define IMAP_PORT "143"
12#define IMAP_SSL_PORT "993" 12#define IMAP_SSL_PORT "993"
13#define SMTP_PORT "25" 13#define SMTP_PORT "25"
14#define SMTP_SSL_PORT "465" 14#define SMTP_SSL_PORT "465"
15#define POP3_PORT "110" 15#define POP3_PORT "110"
16#define POP3_SSL_PORT "995" 16#define POP3_SSL_PORT "995"
17#define NNTP_PORT "119" 17#define NNTP_PORT "119"
18#define NNTP_SSL_PORT "563" 18#define NNTP_SSL_PORT "563"
19 19
20 20
21Settings::Settings() 21Settings::Settings()
@@ -99,41 +99,68 @@ void Settings::saveAccounts()
99void Settings::readAccounts() 99void Settings::readAccounts()
100{ 100{
101 checkDirectory(); 101 checkDirectory();
102 Account *it; 102 Account *it;
103 103
104 for ( it = accounts.first(); it; it = accounts.next() ) { 104 for ( it = accounts.first(); it; it = accounts.next() ) {
105 it->read(); 105 it->read();
106 } 106 }
107} 107}
108 108
109Account::Account() 109Account::Account()
110{ 110{
111 accountName = "changeMe"; 111 accountName = "changeMe";
112 type = MAILLIB::A_UNDEFINED; 112 type = MAILLIB::A_UNDEFINED;
113 ssl = false; 113 ssl = false;
114 connectionType = 1; 114 connectionType = 1;
115 offline = false; 115 offline = false;
116 maxMailSize = 0;
117 lastFetch;
118 leaveOnServer = false;
116} 119}
117 120
118void Account::remove() 121void Account::remove()
119{ 122{
120 QFile file( getFileName() ); 123 QFile file( getFileName() );
121 file.remove(); 124 file.remove();
122} 125}
123 126
127void Account::setPasswordList(const QStringList &str)
128{
129 password = "";
130 int i;
131 for ( i = 0; i < str.count() ; ++i ) {
132 QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3)));
133 password.append( c );
134 }
135 //qDebug("password %s ", password.latin1());
136}
137QStringList Account::getPasswordList()
138{
139 int i;
140 int len = password.length();
141 QStringList str;
142
143 for ( i = 0; i < len ; ++i ) {
144 int val = password.at(i).unicode()*(len-(i%3))+131;
145 str.append( QString::number( val ) );
146 // qDebug("append %s ", str[i].latin1());
147 }
148 return str;
149}
150
124IMAPaccount::IMAPaccount() 151IMAPaccount::IMAPaccount()
125 : Account() 152 : Account()
126{ 153{
127 file = IMAPaccount::getUniqueFileName(); 154 file = IMAPaccount::getUniqueFileName();
128 accountName = "New IMAP Account"; 155 accountName = "New IMAP Account";
129 ssl = false; 156 ssl = false;
130 connectionType = 1; 157 connectionType = 1;
131 type = MAILLIB::A_IMAP; 158 type = MAILLIB::A_IMAP;
132 port = IMAP_PORT; 159 port = IMAP_PORT;
133} 160}
134 161
135IMAPaccount::IMAPaccount( QString filename ) 162IMAPaccount::IMAPaccount( QString filename )
136 : Account() 163 : Account()
137{ 164{
138 file = filename; 165 file = filename;
139 accountName = "New IMAP Account"; 166 accountName = "New IMAP Account";
@@ -147,81 +174,85 @@ QString IMAPaccount::getUniqueFileName()
147{ 174{
148 int num = 0; 175 int num = 0;
149 QString unique; 176 QString unique;
150 177
151 QDir dir( locateLocal("data", "kopiemail" ) ); 178 QDir dir( locateLocal("data", "kopiemail" ) );
152 179
153 QStringList imap = dir.entryList( "imap-*" ); 180 QStringList imap = dir.entryList( "imap-*" );
154 do { 181 do {
155 unique.setNum( num++ ); 182 unique.setNum( num++ );
156 } while ( imap.contains( "imap-" + unique ) > 0 ); 183 } while ( imap.contains( "imap-" + unique ) > 0 );
157 184
158 return unique; 185 return unique;
159} 186}
160 187
161void IMAPaccount::read() 188void IMAPaccount::read()
162{ 189{
163 Config *conf = new Config( getFileName(), Config::File ); 190 KConfig *conf = new KConfig( getFileName() );
164 conf->setGroup( "IMAP Account" ); 191 conf->setGroup( "IMAP Account" );
165 accountName = conf->readEntry( "Account","" ); 192 accountName = conf->readEntry( "Account","" );
166 if (accountName.isNull()) accountName = ""; 193 if (accountName.isNull()) accountName = "";
167 server = conf->readEntry( "Server","" ); 194 server = conf->readEntry( "Server","" );
168 if (server.isNull()) server=""; 195 if (server.isNull()) server="";
169 port = conf->readEntry( "Port","" ); 196 port = conf->readEntry( "Port","" );
170 if (port.isNull()) port="143"; 197 if (port.isNull()) port="143";
171 connectionType = conf->readNumEntry( "ConnectionType" ); 198 connectionType = conf->readNumEntry( "ConnectionType" );
172 ssl = conf->readBoolEntry( "SSL",false ); 199 ssl = conf->readBoolEntry( "SSL",false );
173 user = conf->readEntry( "User","" ); 200 user = conf->readEntry( "User","" );
174 if (user.isNull()) user = ""; 201 if (user.isNull()) user = "";
175 password = conf->readEntryCrypt( "Password","" ); 202 //password = conf->readEntryCrypt( "Password","" );
203 setPasswordList( conf->readListEntry( "FolderHistory"));
176 if (password.isNull()) password = ""; 204 if (password.isNull()) password = "";
177 prefix = conf->readEntry("MailPrefix",""); 205 prefix = conf->readEntry("MailPrefix","");
178 if (prefix.isNull()) prefix = ""; 206 if (prefix.isNull()) prefix = "";
179 offline = conf->readBoolEntry("Offline",false); 207 offline = conf->readBoolEntry("Offline",false);
180 localFolder = conf->readEntry( "LocalFolder" ); 208 localFolder = conf->readEntry( "LocalFolder" );
181 maxMailSize = conf->readNumEntry( "MaxSize",0 ); 209 maxMailSize = conf->readNumEntry( "MaxSize",0 );
182 int lf = conf->readNumEntry( "LastFetch",0 ); 210 int lf = conf->readNumEntry( "LastFetch",0 );
183 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); 211 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
184 leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); 212 leaveOnServer = conf->readBoolEntry("LeaveOnServer",false);
213 qDebug("reading last fetch: %d ", lf);
214 if ( lf < 0 ) lf = 0;
185 lastFetch = dt.addSecs( lf ); 215 lastFetch = dt.addSecs( lf );
186 delete conf; 216 delete conf;
187} 217}
188 218
189void IMAPaccount::save() 219void IMAPaccount::save()
190{ 220{
191 qDebug("saving %s ",getFileName().latin1() ); 221 qDebug("saving %s ",getFileName().latin1() );
192 Settings::checkDirectory(); 222 Settings::checkDirectory();
193 223
194 Config *conf = new Config( getFileName(), Config::File ); 224 KConfig *conf = new KConfig( getFileName() );
195 conf->setGroup( "IMAP Account" ); 225 conf->setGroup( "IMAP Account" );
196 conf->writeEntry( "Account", accountName ); 226 conf->writeEntry( "Account", accountName );
197 conf->writeEntry( "Server", server ); 227 conf->writeEntry( "Server", server );
198 conf->writeEntry( "Port", port ); 228 conf->writeEntry( "Port", port );
199 conf->writeEntry( "SSL", ssl ); 229 conf->writeEntry( "SSL", ssl );
200 conf->writeEntry( "ConnectionType", connectionType ); 230 conf->writeEntry( "ConnectionType", connectionType );
201 conf->writeEntry( "User", user ); 231 conf->writeEntry( "User", user );
202 conf->writeEntryCrypt( "Password", password ); 232 //conf->writeEntryCrypt( "Password", password );
233 conf->writeEntry( "FolderHistory",getPasswordList() );
203 conf->writeEntry( "MailPrefix",prefix); 234 conf->writeEntry( "MailPrefix",prefix);
204 conf->writeEntry( "Offline",offline); 235 conf->writeEntry( "Offline",offline);
205 conf->writeEntry( "LocalFolder", localFolder ); 236 conf->writeEntry( "LocalFolder", localFolder );
206 conf->writeEntry( "MaxSize", maxMailSize ); 237 conf->writeEntry( "MaxSize", maxMailSize );
207 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); 238 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
208 int lf = dt.secsTo ( lastFetch ); 239 int lf = dt.secsTo ( lastFetch );
209 conf->writeEntry( "LastFetch", lf ); 240 conf->writeEntry( "LastFetch", lf );
210 conf->writeEntry( "LeaveOnServer", leaveOnServer); 241 conf->writeEntry( "LeaveOnServer", leaveOnServer);
211 conf->write(); 242 conf->sync();
212 delete conf; 243 delete conf;
213} 244}
214 245
215 246
216QString IMAPaccount::getFileName() 247QString IMAPaccount::getFileName()
217{ 248{
218 return locateLocal("data", "kopiemail" ) +"/imap-" + file; 249 return locateLocal("data", "kopiemail" ) +"/imap-" + file;
219} 250}
220 251
221POP3account::POP3account() 252POP3account::POP3account()
222 : Account() 253 : Account()
223{ 254{
224 file = POP3account::getUniqueFileName(); 255 file = POP3account::getUniqueFileName();
225 accountName = "New POP3 Account"; 256 accountName = "New POP3 Account";
226 ssl = false; 257 ssl = false;
227 connectionType = 1; 258 connectionType = 1;
@@ -244,72 +275,74 @@ QString POP3account::getUniqueFileName()
244{ 275{
245 int num = 0; 276 int num = 0;
246 QString unique; 277 QString unique;
247 278
248 QDir dir( locateLocal("data", "kopiemail" ) ); 279 QDir dir( locateLocal("data", "kopiemail" ) );
249 280
250 QStringList imap = dir.entryList( "pop3-*" ); 281 QStringList imap = dir.entryList( "pop3-*" );
251 do { 282 do {
252 unique.setNum( num++ ); 283 unique.setNum( num++ );
253 } while ( imap.contains( "pop3-" + unique ) > 0 ); 284 } while ( imap.contains( "pop3-" + unique ) > 0 );
254 285
255 return unique; 286 return unique;
256} 287}
257 288
258void POP3account::read() 289void POP3account::read()
259{ 290{
260 Config *conf = new Config( getFileName(), Config::File ); 291 KConfig *conf = new KConfig( getFileName());
261 conf->setGroup( "POP3 Account" ); 292 conf->setGroup( "POP3 Account" );
262 accountName = conf->readEntry( "Account" ); 293 accountName = conf->readEntry( "Account" );
263 server = conf->readEntry( "Server" ); 294 server = conf->readEntry( "Server" );
264 port = conf->readEntry( "Port" ); 295 port = conf->readEntry( "Port" );
265 ssl = conf->readBoolEntry( "SSL" ); 296 ssl = conf->readBoolEntry( "SSL" );
266 connectionType = conf->readNumEntry( "ConnectionType" ); 297 connectionType = conf->readNumEntry( "ConnectionType" );
267 user = conf->readEntry( "User" ); 298 user = conf->readEntry( "User" );
268 password = conf->readEntryCrypt( "Password" ); 299 //password = conf->readEntryCrypt( "Password" );
300 setPasswordList( conf->readListEntry( "FolderHistory"));
269 offline = conf->readBoolEntry("Offline",false); 301 offline = conf->readBoolEntry("Offline",false);
270 localFolder = conf->readEntry( "LocalFolder" ); 302 localFolder = conf->readEntry( "LocalFolder" );
271 maxMailSize = conf->readNumEntry( "MaxSize",0 ); 303 maxMailSize = conf->readNumEntry( "MaxSize",0 );
272 int lf = conf->readNumEntry( "LastFetch",0 ); 304 int lf = conf->readNumEntry( "LastFetch",0 );
273 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); 305 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
274 leaveOnServer = conf->readBoolEntry("LeaveOnServer",false); 306 leaveOnServer = conf->readBoolEntry("LeaveOnServer",false);
275 lastFetch = dt.addSecs( lf ); 307 lastFetch = dt.addSecs( lf );
276 delete conf; 308 delete conf;
277} 309}
278 310
279void POP3account::save() 311void POP3account::save()
280{ 312{
281 Settings::checkDirectory(); 313 Settings::checkDirectory();
282 314
283 Config *conf = new Config( getFileName(), Config::File ); 315 KConfig *conf = new KConfig( getFileName() );
284 conf->setGroup( "POP3 Account" ); 316 conf->setGroup( "POP3 Account" );
285 conf->writeEntry( "Account", accountName ); 317 conf->writeEntry( "Account", accountName );
286 conf->writeEntry( "Server", server ); 318 conf->writeEntry( "Server", server );
287 conf->writeEntry( "Port", port ); 319 conf->writeEntry( "Port", port );
288 conf->writeEntry( "SSL", ssl ); 320 conf->writeEntry( "SSL", ssl );
289 conf->writeEntry( "ConnectionType", connectionType ); 321 conf->writeEntry( "ConnectionType", connectionType );
290 conf->writeEntry( "User", user ); 322 conf->writeEntry( "User", user );
291 conf->writeEntryCrypt( "Password", password ); 323 //conf->writeEntryCrypt( "Password", password );
324 conf->writeEntry( "FolderHistory",getPasswordList() );
292 conf->writeEntry( "Offline",offline); 325 conf->writeEntry( "Offline",offline);
293 conf->writeEntry( "LocalFolder", localFolder ); 326 conf->writeEntry( "LocalFolder", localFolder );
294 conf->writeEntry( "MaxSize", maxMailSize ); 327 conf->writeEntry( "MaxSize", maxMailSize );
295 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) ); 328 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
296 int lf = dt.secsTo ( lastFetch ); 329 int lf = dt.secsTo ( lastFetch );
297 conf->writeEntry( "LastFetch", lf ); 330 conf->writeEntry( "LastFetch", lf );
298 conf->writeEntry( "LeaveOnServer", leaveOnServer); 331 conf->writeEntry( "LeaveOnServer", leaveOnServer);
299 conf->write(); 332 conf->sync();
300 delete conf; 333 delete conf;
301} 334}
302 335
303 336
304QString POP3account::getFileName() 337QString POP3account::getFileName()
305{ 338{
306 return locateLocal("data", "kopiemail" ) +"/pop3-" + file; 339 return locateLocal("data", "kopiemail" ) +"/pop3-" + file;
307} 340}
308 341
309SMTPaccount::SMTPaccount() 342SMTPaccount::SMTPaccount()
310 : Account() 343 : Account()
311{ 344{
312 file = SMTPaccount::getUniqueFileName(); 345 file = SMTPaccount::getUniqueFileName();
313 accountName = "New SMTP Account"; 346 accountName = "New SMTP Account";
314 ssl = false; 347 ssl = false;
315 connectionType = 1; 348 connectionType = 1;
@@ -337,60 +370,62 @@ QString SMTPaccount::getUniqueFileName()
337{ 370{
338 int num = 0; 371 int num = 0;
339 QString unique; 372 QString unique;
340 373
341 QDir dir( locateLocal("data", "kopiemail" ) ); 374 QDir dir( locateLocal("data", "kopiemail" ) );
342 375
343 QStringList imap = dir.entryList( "smtp-*" ); 376 QStringList imap = dir.entryList( "smtp-*" );
344 do { 377 do {
345 unique.setNum( num++ ); 378 unique.setNum( num++ );
346 } while ( imap.contains( "smtp-" + unique ) > 0 ); 379 } while ( imap.contains( "smtp-" + unique ) > 0 );
347 380
348 return unique; 381 return unique;
349} 382}
350 383
351void SMTPaccount::read() 384void SMTPaccount::read()
352{ 385{
353 Config *conf = new Config( getFileName(), Config::File ); 386 KConfig *conf = new KConfig( getFileName() );
354 conf->setGroup( "SMTP Account" ); 387 conf->setGroup( "SMTP Account" );
355 accountName = conf->readEntry( "Account" ); 388 accountName = conf->readEntry( "Account" );
356 server = conf->readEntry( "Server" ); 389 server = conf->readEntry( "Server" );
357 port = conf->readEntry( "Port" ); 390 port = conf->readEntry( "Port" );
358 ssl = conf->readBoolEntry( "SSL" ); 391 ssl = conf->readBoolEntry( "SSL" );
359 connectionType = conf->readNumEntry( "ConnectionType" ); 392 connectionType = conf->readNumEntry( "ConnectionType" );
360 login = conf->readBoolEntry( "Login" ); 393 login = conf->readBoolEntry( "Login" );
361 user = conf->readEntry( "User" ); 394 user = conf->readEntry( "User" );
362 password = conf->readEntryCrypt( "Password" ); 395 //password = conf->readEntryCrypt( "Password" );
396 setPasswordList( conf->readListEntry( "FolderHistory"));
363 delete conf; 397 delete conf;
364} 398}
365 399
366void SMTPaccount::save() 400void SMTPaccount::save()
367{ 401{
368 Settings::checkDirectory(); 402 Settings::checkDirectory();
369 403
370 Config *conf = new Config( getFileName(), Config::File ); 404 KConfig *conf = new KConfig( getFileName() );
371 conf->setGroup( "SMTP Account" ); 405 conf->setGroup( "SMTP Account" );
372 conf->writeEntry( "Account", accountName ); 406 conf->writeEntry( "Account", accountName );
373 conf->writeEntry( "Server", server ); 407 conf->writeEntry( "Server", server );
374 conf->writeEntry( "Port", port ); 408 conf->writeEntry( "Port", port );
375 conf->writeEntry( "SSL", ssl ); 409 conf->writeEntry( "SSL", ssl );
376 conf->writeEntry( "ConnectionType", connectionType ); 410 conf->writeEntry( "ConnectionType", connectionType );
377 conf->writeEntry( "Login", login ); 411 conf->writeEntry( "Login", login );
378 conf->writeEntry( "User", user ); 412 conf->writeEntry( "User", user );
379 conf->writeEntryCrypt( "Password", password ); 413 //conf->writeEntryCrypt( "Password", password );
380 conf->write(); 414 conf->writeEntry( "FolderHistory",getPasswordList() );
415 conf->sync();
381 delete conf; 416 delete conf;
382} 417}
383 418
384 419
385QString SMTPaccount::getFileName() 420QString SMTPaccount::getFileName()
386{ 421{
387 return locateLocal("data", "kopiemail" ) +"/smtp-" + file; 422 return locateLocal("data", "kopiemail" ) +"/smtp-" + file;
388} 423}
389 424
390NNTPaccount::NNTPaccount() 425NNTPaccount::NNTPaccount()
391 : Account() 426 : Account()
392{ 427{
393 file = NNTPaccount::getUniqueFileName(); 428 file = NNTPaccount::getUniqueFileName();
394 accountName = "New NNTP Account"; 429 accountName = "New NNTP Account";
395 ssl = false; 430 ssl = false;
396 login = false; 431 login = false;
@@ -413,52 +448,54 @@ QString NNTPaccount::getUniqueFileName()
413{ 448{
414 int num = 0; 449 int num = 0;
415 QString unique; 450 QString unique;
416 451
417 QDir dir( locateLocal("data", "kopiemail" ) ); 452 QDir dir( locateLocal("data", "kopiemail" ) );
418 453
419 QStringList imap = dir.entryList( "nntp-*" ); 454 QStringList imap = dir.entryList( "nntp-*" );
420 do { 455 do {
421 unique.setNum( num++ ); 456 unique.setNum( num++ );
422 } while ( imap.contains( "nntp-" + unique ) > 0 ); 457 } while ( imap.contains( "nntp-" + unique ) > 0 );
423 458
424 return unique; 459 return unique;
425} 460}
426 461
427void NNTPaccount::read() 462void NNTPaccount::read()
428{ 463{
429 Config *conf = new Config( getFileName(), Config::File ); 464 KConfig *conf = new KConfig( getFileName() );
430 conf->setGroup( "NNTP Account" ); 465 conf->setGroup( "NNTP Account" );
431 accountName = conf->readEntry( "Account" ); 466 accountName = conf->readEntry( "Account" );
432 server = conf->readEntry( "Server" ); 467 server = conf->readEntry( "Server" );
433 port = conf->readEntry( "Port" ); 468 port = conf->readEntry( "Port" );
434 ssl = conf->readBoolEntry( "SSL" ); 469 ssl = conf->readBoolEntry( "SSL" );
435 login = conf->readBoolEntry( "Login" ); 470 login = conf->readBoolEntry( "Login" );
436 user = conf->readEntry( "User" ); 471 user = conf->readEntry( "User" );
437 password = conf->readEntryCrypt( "Password" ); 472 //password = conf->readEntryCrypt( "Password" );
438 subscribedGroups = conf->readListEntry( "Subscribed", ',' ); 473 setPasswordList( conf->readListEntry( "FolderHistory"));
474 subscribedGroups = conf->readListEntry( "Subscribed");
439 delete conf; 475 delete conf;
440} 476}
441 477
442void NNTPaccount::save() 478void NNTPaccount::save()
443{ 479{
444 Settings::checkDirectory(); 480 Settings::checkDirectory();
445 481
446 Config *conf = new Config( getFileName(), Config::File ); 482 KConfig *conf = new KConfig( getFileName() );
447 conf->setGroup( "NNTP Account" ); 483 conf->setGroup( "NNTP Account" );
448 conf->writeEntry( "Account", accountName ); 484 conf->writeEntry( "Account", accountName );
449 conf->writeEntry( "Server", server ); 485 conf->writeEntry( "Server", server );
450 conf->writeEntry( "Port", port ); 486 conf->writeEntry( "Port", port );
451 conf->writeEntry( "SSL", ssl ); 487 conf->writeEntry( "SSL", ssl );
452 conf->writeEntry( "Login", login ); 488 conf->writeEntry( "Login", login );
453 conf->writeEntry( "User", user ); 489 conf->writeEntry( "User", user );
454 conf->writeEntryCrypt( "Password", password ); 490 //conf->writeEntryCrypt( "Password", password );
455 conf->writeEntry( "Subscribed" , subscribedGroups, ',' ); 491 conf->writeEntry( "FolderHistory",getPasswordList() );
456 conf->write(); 492 conf->writeEntry( "Subscribed" , subscribedGroups );
493 conf->sync();
457 delete conf; 494 delete conf;
458} 495}
459 496
460 497
461QString NNTPaccount::getFileName() 498QString NNTPaccount::getFileName()
462{ 499{
463 return locateLocal("data", "kopiemail" ) +"/nntp-" + file; 500 return locateLocal("data", "kopiemail" ) +"/nntp-" + file;
464} 501}
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h
index 85b817c..61051dd 100644
--- a/kmicromail/libmailwrapper/settings.h
+++ b/kmicromail/libmailwrapper/settings.h
@@ -24,32 +24,35 @@ public:
24 24
25 void setServer(const QString&str){ server = str; } 25 void setServer(const QString&str){ server = str; }
26 const QString&getServer()const{ return server; } 26 const QString&getServer()const{ return server; }
27 27
28 void setLocalFolder( QString name ) { localFolder = name; } 28 void setLocalFolder( QString name ) { localFolder = name; }
29 const QString& getLocalFolder()const{ return localFolder; } 29 const QString& getLocalFolder()const{ return localFolder; }
30 30
31 void setPort(const QString&str) { port = str; } 31 void setPort(const QString&str) { port = str; }
32 const QString&getPort()const{ return port; } 32 const QString&getPort()const{ return port; }
33 33
34 void setUser(const QString&str){ user = str; } 34 void setUser(const QString&str){ user = str; }
35 const QString&getUser()const{ return user; } 35 const QString&getUser()const{ return user; }
36 36
37 void setPassword(const QString&str) { password = str; } 37 void setPassword(const QString&str) { password = str; }
38 const QString&getPassword()const { return password; } 38 const QString&getPassword()const { return password; }
39 39
40 void setPasswordList(const QStringList &str);
41 QStringList getPasswordList();
42
40 void setSSL( bool b ) { ssl = b; } 43 void setSSL( bool b ) { ssl = b; }
41 bool getSSL() { return ssl; } 44 bool getSSL() { return ssl; }
42 45
43 void setConnectionType( int x ) { connectionType = x; } 46 void setConnectionType( int x ) { connectionType = x; }
44 int ConnectionType() { return connectionType; } 47 int ConnectionType() { return connectionType; }
45 48
46 void setMaxMailSize( int x ) { maxMailSize = x; } 49 void setMaxMailSize( int x ) { maxMailSize = x; }
47 int getMaxMailSize() { return maxMailSize; } 50 int getMaxMailSize() { return maxMailSize; }
48 51
49 void setOffline(bool b) {offline = b;} 52 void setOffline(bool b) {offline = b;}
50 bool getOffline()const{return offline;} 53 bool getOffline()const{return offline;}
51 54
52 bool getLeaveOnServer(){ return leaveOnServer;} 55 bool getLeaveOnServer(){ return leaveOnServer;}
53 void setLeaveOnServer(bool b){ leaveOnServer = b;} 56 void setLeaveOnServer(bool b){ leaveOnServer = b;}
54 57
55 virtual QString getFileName() { return accountName; } 58 virtual QString getFileName() { return accountName; }