summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/settings.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 04afe7c..19093b1 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -1,150 +1,150 @@
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 <kconfig.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()
22 : QObject() 22 : QObject()
23{ 23{
24 accounts.setAutoDelete( true ); ; 24 accounts.setAutoDelete( true ); ;
25 updateAccounts(); 25 updateAccounts();
26 //qDebug("++++++++++++++++++new settings "); 26 //qDebug("++++++++++++++++++new settings ");
27} 27}
28 28
29void Settings::checkDirectory() 29void Settings::checkDirectory()
30{ 30{
31 return; 31 return;
32 locateLocal("data", "kopiemail" ); 32 locateLocal("data", "kopiemail" );
33 /* 33 /*
34 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { 34 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
35 system( "mkdir -p $HOME/Applications/opiemail" ); 35 system( "mkdir -p $HOME/Applications/opiemail" );
36 qDebug("$HOME/Applications/opiemail created "); 36 qDebug("$HOME/Applications/opiemail created ");
37 } 37 }
38 */ 38 */
39} 39}
40 40
41QList<Account> Settings::getAccounts() 41QList<Account> Settings::getAccounts()
42{ 42{
43 return accounts; 43 return accounts;
44} 44}
45 45
46void Settings::addAccount( Account *account ) 46void Settings::addAccount( Account *account )
47{ 47{
48 accounts.append( account ); 48 accounts.append( account );
49} 49}
50 50
51void Settings::delAccount( Account *account ) 51void Settings::delAccount( Account *account )
52{ 52{
53 accounts.remove( account );
54 account->remove(); 53 account->remove();
54 accounts.remove( account );
55} 55}
56 56
57void Settings::updateAccounts() 57void Settings::updateAccounts()
58{ 58{
59 accounts.clear(); 59 accounts.clear();
60 QDir dir( locateLocal("data", "kopiemail" ) ); 60 QDir dir( locateLocal("data", "kopiemail" ) );
61 QStringList::Iterator it; 61 QStringList::Iterator it;
62 62
63 QStringList imap = dir.entryList( "imap-*" ); 63 QStringList imap = dir.entryList( "imap-*" );
64 for ( it = imap.begin(); it != imap.end(); it++ ) { 64 for ( it = imap.begin(); it != imap.end(); it++ ) {
65 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); 65 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
66 accounts.append( account ); 66 accounts.append( account );
67 } 67 }
68 68
69 QStringList pop3 = dir.entryList( "pop3-*" ); 69 QStringList pop3 = dir.entryList( "pop3-*" );
70 for ( it = pop3.begin(); it != pop3.end(); it++ ) { 70 for ( it = pop3.begin(); it != pop3.end(); it++ ) {
71 POP3account *account = new POP3account( (*it).replace(0, 5, "") ); 71 POP3account *account = new POP3account( (*it).replace(0, 5, "") );
72 accounts.append( account ); 72 accounts.append( account );
73 } 73 }
74 74
75 QStringList smtp = dir.entryList( "smtp-*" ); 75 QStringList smtp = dir.entryList( "smtp-*" );
76 for ( it = smtp.begin(); it != smtp.end(); it++ ) { 76 for ( it = smtp.begin(); it != smtp.end(); it++ ) {
77 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); 77 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
78 accounts.append( account ); 78 accounts.append( account );
79 } 79 }
80 80
81 QStringList nntp = dir.entryList( "nntp-*" ); 81 QStringList nntp = dir.entryList( "nntp-*" );
82 for ( it = nntp.begin(); it != nntp.end(); it++ ) { 82 for ( it = nntp.begin(); it != nntp.end(); it++ ) {
83 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); 83 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
84 accounts.append( account ); 84 accounts.append( account );
85 } 85 }
86 86
87 readAccounts(); 87 readAccounts();
88} 88}
89 89
90void Settings::saveAccounts() 90void Settings::saveAccounts()
91{ 91{
92 checkDirectory(); 92 checkDirectory();
93 Account *it; 93 Account *it;
94 94
95 for ( it = accounts.first(); it; it = accounts.next() ) { 95 for ( it = accounts.first(); it; it = accounts.next() ) {
96 it->save(); 96 it->save();
97 } 97 }
98} 98}
99 99
100void Settings::readAccounts() 100void Settings::readAccounts()
101{ 101{
102 checkDirectory(); 102 checkDirectory();
103 Account *it; 103 Account *it;
104 104
105 for ( it = accounts.first(); it; it = accounts.next() ) { 105 for ( it = accounts.first(); it; it = accounts.next() ) {
106 it->read(); 106 it->read();
107 } 107 }
108} 108}
109 109
110Account::Account() 110Account::Account()
111{ 111{
112 accountName = "changeMe"; 112 accountName = "changeMe";
113 type = MAILLIB::A_UNDEFINED; 113 type = MAILLIB::A_UNDEFINED;
114 ssl = false; 114 ssl = false;
115 connectionType = 1; 115 connectionType = 1;
116 offline = false; 116 offline = false;
117 maxMailSize = 0; 117 maxMailSize = 0;
118 lastFetch; 118 lastFetch;
119 leaveOnServer = false; 119 leaveOnServer = false;
120} 120}
121 121
122void Account::remove() 122void Account::remove()
123{ 123{
124 QFile file( getFileName() ); 124 QFile file( getFileName() );
125 file.remove(); 125 file.remove();
126} 126}
127 127
128void Account::setPasswordList(const QStringList &str) 128void Account::setPasswordList(const QStringList &str)
129{ 129{
130 password = ""; 130 password = "";
131 int i; 131 int i;
132 for ( i = 0; i < str.count() ; ++i ) { 132 for ( i = 0; i < str.count() ; ++i ) {
133 QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3))); 133 QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3)));
134 password.append( c ); 134 password.append( c );
135 } 135 }
136 //qDebug("password %s ", password.latin1()); 136 //qDebug("password %s ", password.latin1());
137} 137}
138QStringList Account::getPasswordList() 138QStringList Account::getPasswordList()
139{ 139{
140 int i; 140 int i;
141 int len = password.length(); 141 int len = password.length();
142 QStringList str; 142 QStringList str;
143 143
144 for ( i = 0; i < len ; ++i ) { 144 for ( i = 0; i < len ; ++i ) {
145 int val = password.at(i).unicode()*(len-(i%3))+131; 145 int val = password.at(i).unicode()*(len-(i%3))+131;
146 str.append( QString::number( val ) ); 146 str.append( QString::number( val ) );
147 // qDebug("append %s ", str[i].latin1()); 147 // qDebug("append %s ", str[i].latin1());
148 } 148 }
149 return str; 149 return str;
150} 150}