summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/settings.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 8f909f9..9436d43 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -58,129 +58,128 @@ void Settings::delAccount( Account *account )
58 accounts.remove( account ); 58 accounts.remove( account );
59} 59}
60 60
61void Settings::updateAccounts() 61void Settings::updateAccounts()
62{ 62{
63 accounts.clear(); 63 accounts.clear();
64 QDir dir( locateLocal("data", "kopiemail" ) ); 64 QDir dir( locateLocal("data", "kopiemail" ) );
65 QStringList::Iterator it; 65 QStringList::Iterator it;
66 66
67 QStringList imap = dir.entryList( "imap-*" ); 67 QStringList imap = dir.entryList( "imap-*" );
68 for ( it = imap.begin(); it != imap.end(); it++ ) { 68 for ( it = imap.begin(); it != imap.end(); it++ ) {
69 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); 69 IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") );
70 accounts.append( account ); 70 accounts.append( account );
71 } 71 }
72 72
73 QStringList pop3 = dir.entryList( "pop3-*" ); 73 QStringList pop3 = dir.entryList( "pop3-*" );
74 for ( it = pop3.begin(); it != pop3.end(); it++ ) { 74 for ( it = pop3.begin(); it != pop3.end(); it++ ) {
75 POP3account *account = new POP3account( (*it).replace(0, 5, "") ); 75 POP3account *account = new POP3account( (*it).replace(0, 5, "") );
76 accounts.append( account ); 76 accounts.append( account );
77 } 77 }
78 78
79 QStringList smtp = dir.entryList( "smtp-*" ); 79 QStringList smtp = dir.entryList( "smtp-*" );
80 for ( it = smtp.begin(); it != smtp.end(); it++ ) { 80 for ( it = smtp.begin(); it != smtp.end(); it++ ) {
81 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); 81 SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
82 accounts.append( account ); 82 accounts.append( account );
83 } 83 }
84 84
85 QStringList nntp = dir.entryList( "nntp-*" ); 85 QStringList nntp = dir.entryList( "nntp-*" );
86 for ( it = nntp.begin(); it != nntp.end(); it++ ) { 86 for ( it = nntp.begin(); it != nntp.end(); it++ ) {
87 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); 87 NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
88 accounts.append( account ); 88 accounts.append( account );
89 } 89 }
90 90
91 readAccounts(); 91 readAccounts();
92} 92}
93 93
94void Settings::saveAccounts() 94void Settings::saveAccounts()
95{ 95{
96 checkDirectory(); 96 checkDirectory();
97 Account *it; 97 Account *it;
98 98
99 for ( it = accounts.first(); it; it = accounts.next() ) { 99 for ( it = accounts.first(); it; it = accounts.next() ) {
100 it->save(); 100 it->save();
101 } 101 }
102} 102}
103 103
104void Settings::readAccounts() 104void Settings::readAccounts()
105{ 105{
106 checkDirectory(); 106 checkDirectory();
107 Account *it; 107 Account *it;
108 108
109 for ( it = accounts.first(); it; it = accounts.next() ) { 109 for ( it = accounts.first(); it; it = accounts.next() ) {
110 it->read(); 110 it->read();
111 } 111 }
112} 112}
113 113
114Account::Account() 114Account::Account()
115{ 115{
116 accountName = "changeMe"; 116 accountName = "changeMe";
117 type = MAILLIB::A_UNDEFINED; 117 type = MAILLIB::A_UNDEFINED;
118 ssl = false; 118 ssl = false;
119 connectionType = 1; 119 connectionType = 1;
120 offline = false; 120 offline = false;
121 maxMailSize = 0; 121 maxMailSize = 0;
122 lastFetch;
123 leaveOnServer = false; 122 leaveOnServer = false;
124} 123}
125 124
126void Account::remove() 125void Account::remove()
127{ 126{
128 QFile file( getFileName() ); 127 QFile file( getFileName() );
129 file.remove(); 128 file.remove();
130} 129}
131 130
132void Account::setPasswordList(const QStringList &str) 131void Account::setPasswordList(const QStringList &str)
133{ 132{
134 password = ""; 133 password = "";
135 int i; 134 int i;
136 for ( i = 0; i < str.count() ; ++i ) { 135 for ( i = 0; i < str.count() ; ++i ) {
137 QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3))); 136 QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3)));
138 password.append( c ); 137 password.append( c );
139 } 138 }
140 //qDebug("password %s ", password.latin1()); 139 //qDebug("password %s ", password.latin1());
141} 140}
142QStringList Account::getPasswordList() 141QStringList Account::getPasswordList()
143{ 142{
144 int i; 143 int i;
145 int len = password.length(); 144 int len = password.length();
146 QStringList str; 145 QStringList str;
147 146
148 for ( i = 0; i < len ; ++i ) { 147 for ( i = 0; i < len ; ++i ) {
149 int val = password.at(i).unicode()*(len-(i%3))+131; 148 int val = password.at(i).unicode()*(len-(i%3))+131;
150 str.append( QString::number( val ) ); 149 str.append( QString::number( val ) );
151 // qDebug("append %s ", str[i].latin1()); 150 // qDebug("append %s ", str[i].latin1());
152 } 151 }
153 return str; 152 return str;
154} 153}
155 154
156IMAPaccount::IMAPaccount() 155IMAPaccount::IMAPaccount()
157 : Account() 156 : Account()
158{ 157{
159 file = IMAPaccount::getUniqueFileName(); 158 file = IMAPaccount::getUniqueFileName();
160 accountName = "New IMAP Account"; 159 accountName = "New IMAP Account";
161 ssl = false; 160 ssl = false;
162 connectionType = 1; 161 connectionType = 1;
163 type = MAILLIB::A_IMAP; 162 type = MAILLIB::A_IMAP;
164 port = IMAP_PORT; 163 port = IMAP_PORT;
165} 164}
166 165
167IMAPaccount::IMAPaccount( QString filename ) 166IMAPaccount::IMAPaccount( QString filename )
168 : Account() 167 : Account()
169{ 168{
170 file = filename; 169 file = filename;
171 accountName = "New IMAP Account"; 170 accountName = "New IMAP Account";
172 ssl = false; 171 ssl = false;
173 connectionType = 1; 172 connectionType = 1;
174 type = MAILLIB::A_IMAP; 173 type = MAILLIB::A_IMAP;
175 port = IMAP_PORT; 174 port = IMAP_PORT;
176} 175}
177 176
178QString IMAPaccount::getUniqueFileName() 177QString IMAPaccount::getUniqueFileName()
179{ 178{
180 int num = 0; 179 int num = 0;
181 QString unique; 180 QString unique;
182 181
183 QDir dir( locateLocal("data", "kopiemail" ) ); 182 QDir dir( locateLocal("data", "kopiemail" ) );
184 183
185 QStringList imap = dir.entryList( "imap-*" ); 184 QStringList imap = dir.entryList( "imap-*" );
186 do { 185 do {