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
@@ -1,9 +1,13 @@
#include <stdlib.h>
#include <qdir.h>
+#include <qtextcodec.h>
+#include <qtextstream.h>
+#include <qfile.h>
+
//#include <opie2/odebug.h>
#include <kconfig.h>
#include <kstandarddirs.h>
#include "settings.h"
//#include "defines.h"
@@ -363,12 +367,51 @@ SMTPaccount::SMTPaccount( QString filename )
connectionType = 1;
login = false;
type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
+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()
{
int num = 0;
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
@@ -389,13 +432,13 @@ void SMTPaccount::read()
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
- //password = conf->readEntryCrypt( "Password" );
+ signature = conf->readEntry( "SigFile" );
setPasswordList( conf->readListEntry( "FolderHistory"));
delete conf;
}
void SMTPaccount::save()
{
@@ -407,12 +450,13 @@ void SMTPaccount::save()
conf->writeEntry( "Server", server );
conf->writeEntry( "Port", port );
conf->writeEntry( "SSL", ssl );
conf->writeEntry( "ConnectionType", connectionType );
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
+ conf->writeEntry( "SigFile", signature );
//conf->writeEntryCrypt( "Password", password );
conf->writeEntry( "FolderHistory",getPasswordList() );
conf->sync();
delete conf;
}
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
@@ -124,12 +124,18 @@ public:
virtual void save();
virtual QString getFileName();
void setLogin( bool b ) { login = b; }
bool getLogin() { return login; }
+ void setSigFile( QString b ) { signature = b; }
+ QString getSigFile() { return signature; }
+
+ QString getSignature();
+ void setSignature( QString b );
+
private:
QString file, name, mail, org, cc, bcc, reply, signature;
bool useCC, useBCC, useReply, login;
};