summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Side-by-side diff
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
@@ -3,2 +3,6 @@
+#include <qtextcodec.h>
+#include <qtextstream.h>
+#include <qfile.h>
+
//#include <opie2/odebug.h>
@@ -368,2 +372,41 @@ SMTPaccount::SMTPaccount( QString filename )
+QString SMTPaccount::getSignature()
+{
+ QFileInfo fi ( signature );
+ if ( ! fi.exists() )
+ return QString();
+
+ QFile file( signature );
+ if (!file.open( IO_ReadOnly ) ) {
+ return QString();
+
+ }
+ QTextStream ts( &file );
+ ts.setCodec( QTextCodec::codecForName("utf8") );
+ QString text = ts.read();
+ file.close();
+
+ return text;
+
+}
+void SMTPaccount::setSignature( QString b )
+{
+
+ QFileInfo fi ( signature );
+ if ( ! fi.exists() ) {
+ QString filedir( locateLocal("data", "kopiemail" ) );
+ signature = filedir+ "/" + getAccountName() +".sig";
+ qDebug("new sig %s ", signature.latin1());
+ save();
+ }
+ QFile fileIn( signature );
+ if (!fileIn.open( IO_WriteOnly ) ) {
+ qDebug("OM: Cannot write signature file %s ", signature.latin1() );
+ return ;
+ }
+ QTextStream tsIn( &fileIn );
+ tsIn.setCodec( QTextCodec::codecForName("utf8") );
+ tsIn << b ;
+ fileIn.close();
+}
QString SMTPaccount::getUniqueFileName()
@@ -394,3 +437,3 @@ void SMTPaccount::read()
user = conf->readEntry( "User" );
- //password = conf->readEntryCrypt( "Password" );
+ signature = conf->readEntry( "SigFile" );
setPasswordList( conf->readListEntry( "FolderHistory"));
@@ -412,2 +455,3 @@ void SMTPaccount::save()
conf->writeEntry( "User", user );
+ conf->writeEntry( "SigFile", signature );
//conf->writeEntryCrypt( "Password", password );
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
@@ -129,2 +129,8 @@ public:
+ void setSigFile( QString b ) { signature = b; }
+ QString getSigFile() { return signature; }
+
+ QString getSignature();
+ void setSignature( QString b );
+
private: