summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
authorzautrix <zautrix>2005-02-03 10:48:05 (UTC)
committer zautrix <zautrix>2005-02-03 10:48:05 (UTC)
commitfb6753570dc90e936b4e89092554ab012e946a56 (patch) (unidiff)
tree6d3ae5c866f0bbb99f0b6bc8194d04d2c7681ff9 /kmicromail/libmailwrapper
parente0fce8c0f108e054cb6e4e4767affd04b398da45 (diff)
downloadkdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.zip
kdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.tar.gz
kdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.tar.bz2
mail fixes
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/settings.cpp46
-rw-r--r--kmicromail/libmailwrapper/settings.h6
2 files changed, 51 insertions, 1 deletions
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 19093b1..8f909f9 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -1,6 +1,10 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <qdir.h> 2#include <qdir.h>
3 3
4#include <qtextcodec.h>
5#include <qtextstream.h>
6#include <qfile.h>
7
4//#include <opie2/odebug.h> 8//#include <opie2/odebug.h>
5#include <kconfig.h> 9#include <kconfig.h>
6 10
@@ -366,6 +370,45 @@ SMTPaccount::SMTPaccount( QString filename )
366 port = SMTP_PORT; 370 port = SMTP_PORT;
367} 371}
368 372
373QString SMTPaccount::getSignature()
374{
375 QFileInfo fi ( signature );
376 if ( ! fi.exists() )
377 return QString();
378
379 QFile file( signature );
380 if (!file.open( IO_ReadOnly ) ) {
381 return QString();
382
383 }
384 QTextStream ts( &file );
385 ts.setCodec( QTextCodec::codecForName("utf8") );
386 QString text = ts.read();
387 file.close();
388
389 return text;
390
391}
392void SMTPaccount::setSignature( QString b )
393{
394
395 QFileInfo fi ( signature );
396 if ( ! fi.exists() ) {
397 QString filedir( locateLocal("data", "kopiemail" ) );
398 signature = filedir+ "/" + getAccountName() +".sig";
399 qDebug("new sig %s ", signature.latin1());
400 save();
401 }
402 QFile fileIn( signature );
403 if (!fileIn.open( IO_WriteOnly ) ) {
404 qDebug("OM: Cannot write signature file %s ", signature.latin1() );
405 return ;
406 }
407 QTextStream tsIn( &fileIn );
408 tsIn.setCodec( QTextCodec::codecForName("utf8") );
409 tsIn << b ;
410 fileIn.close();
411}
369QString SMTPaccount::getUniqueFileName() 412QString SMTPaccount::getUniqueFileName()
370{ 413{
371 int num = 0; 414 int num = 0;
@@ -392,7 +435,7 @@ void SMTPaccount::read()
392 connectionType = conf->readNumEntry( "ConnectionType" ); 435 connectionType = conf->readNumEntry( "ConnectionType" );
393 login = conf->readBoolEntry( "Login" ); 436 login = conf->readBoolEntry( "Login" );
394 user = conf->readEntry( "User" ); 437 user = conf->readEntry( "User" );
395 //password = conf->readEntryCrypt( "Password" ); 438 signature = conf->readEntry( "SigFile" );
396 setPasswordList( conf->readListEntry( "FolderHistory")); 439 setPasswordList( conf->readListEntry( "FolderHistory"));
397 delete conf; 440 delete conf;
398} 441}
@@ -410,6 +453,7 @@ void SMTPaccount::save()
410 conf->writeEntry( "ConnectionType", connectionType ); 453 conf->writeEntry( "ConnectionType", connectionType );
411 conf->writeEntry( "Login", login ); 454 conf->writeEntry( "Login", login );
412 conf->writeEntry( "User", user ); 455 conf->writeEntry( "User", user );
456 conf->writeEntry( "SigFile", signature );
413 //conf->writeEntryCrypt( "Password", password ); 457 //conf->writeEntryCrypt( "Password", password );
414 conf->writeEntry( "FolderHistory",getPasswordList() ); 458 conf->writeEntry( "FolderHistory",getPasswordList() );
415 conf->sync(); 459 conf->sync();
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h
index c996fe0..a6e95fe 100644
--- a/kmicromail/libmailwrapper/settings.h
+++ b/kmicromail/libmailwrapper/settings.h
@@ -127,6 +127,12 @@ public:
127 void setLogin( bool b ) { login = b; } 127 void setLogin( bool b ) { login = b; }
128 bool getLogin() { return login; } 128 bool getLogin() { return login; }
129 129
130 void setSigFile( QString b ) { signature = b; }
131 QString getSigFile() { return signature; }
132
133 QString getSignature();
134 void setSignature( QString b );
135
130private: 136private:
131 QString file, name, mail, org, cc, bcc, reply, signature; 137 QString file, name, mail, org, cc, bcc, reply, signature;
132 bool useCC, useBCC, useReply, login; 138 bool useCC, useBCC, useReply, login;