summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/editaccounts.cpp21
-rw-r--r--noncore/net/mail/editaccounts.h2
-rw-r--r--noncore/net/mail/imapconfigui.ui159
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp36
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp2
5 files changed, 129 insertions, 91 deletions
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index 9fc97e8..1cb202e 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -245,77 +245,86 @@ void EditAccounts::accept()
245SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 245SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
246 : SelectMailTypeUI( parent, name, modal, flags ) 246 : SelectMailTypeUI( parent, name, modal, flags )
247{ 247{
248 selected = selection; 248 selected = selection;
249 selected->replace( 0, selected->length(), typeBox->currentText() ); 249 selected->replace( 0, selected->length(), typeBox->currentText() );
250 connect( typeBox, SIGNAL( activated( const QString & ) ), SLOT( slotSelection( const QString & ) ) ); 250 connect( typeBox, SIGNAL( activated( const QString & ) ), SLOT( slotSelection( const QString & ) ) );
251} 251}
252 252
253void SelectMailType::slotSelection( const QString &sel ) 253void SelectMailType::slotSelection( const QString &sel )
254{ 254{
255 selected->replace( 0, selected->length(), sel ); 255 selected->replace( 0, selected->length(), sel );
256} 256}
257 257
258/** 258/**
259 * IMAPconfig 259 * IMAPconfig
260 */ 260 */
261 261
262IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 262IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
263 : IMAPconfigUI( parent, name, modal, flags ) 263 : IMAPconfigUI( parent, name, modal, flags )
264{ 264{
265 data = account; 265 data = account;
266 266
267 fillValues(); 267 fillValues();
268 268
269 connect( sslBox, SIGNAL( toggled( bool ) ), SLOT( slotSSL( bool ) ) ); 269 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) );
270 ComboBox1->insertItem( "Only if available", 0 );
271 ComboBox1->insertItem( "Always, Negotiated", 1 );
272 ComboBox1->insertItem( "Connect on secure port", 2 );
273 ComboBox1->insertItem( "Run command instead", 3 );
274 CommandEdit->hide();
275 ComboBox1->setCurrentItem( data->ConnectionType() );
270} 276}
271 277
272void IMAPconfig::slotSSL( bool enabled ) 278void IMAPconfig::slotConnectionToggle( int index )
273{ 279{
274 if ( enabled ) { 280 if ( index == 2 ) {
275 portLine->setText( IMAP_SSL_PORT ); 281 portLine->setText( IMAP_SSL_PORT );
282 } else if ( index == 3 ) {
283 portLine->setText( IMAP_PORT );
284 CommandEdit->show();
276 } else { 285 } else {
277 portLine->setText( IMAP_PORT ); 286 portLine->setText( IMAP_PORT );
278 } 287 }
279} 288}
280 289
281void IMAPconfig::fillValues() 290void IMAPconfig::fillValues()
282{ 291{
283 accountLine->setText( data->getAccountName() ); 292 accountLine->setText( data->getAccountName() );
284 serverLine->setText( data->getServer() ); 293 serverLine->setText( data->getServer() );
285 portLine->setText( data->getPort() ); 294 portLine->setText( data->getPort() );
286 sslBox->setChecked( data->getSSL() ); 295 ComboBox1->setCurrentItem( data->ConnectionType() );
287 userLine->setText( data->getUser() ); 296 userLine->setText( data->getUser() );
288 passLine->setText( data->getPassword() ); 297 passLine->setText( data->getPassword() );
289 prefixLine->setText(data->getPrefix()); 298 prefixLine->setText(data->getPrefix());
290} 299}
291 300
292void IMAPconfig::accept() 301void IMAPconfig::accept()
293{ 302{
294 data->setAccountName( accountLine->text() ); 303 data->setAccountName( accountLine->text() );
295 data->setServer( serverLine->text() ); 304 data->setServer( serverLine->text() );
296 data->setPort( portLine->text() ); 305 data->setPort( portLine->text() );
297 data->setSSL( sslBox->isChecked() ); 306 data->setConnectionType( ComboBox1->currentItem() );
298 data->setUser( userLine->text() ); 307 data->setUser( userLine->text() );
299 data->setPassword( passLine->text() ); 308 data->setPassword( passLine->text() );
300 data->setPrefix(prefixLine->text()); 309 data->setPrefix(prefixLine->text());
301 310
302 QDialog::accept(); 311 QDialog::accept();
303} 312}
304 313
305/** 314/**
306 * POP3config 315 * POP3config
307 */ 316 */
308 317
309POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 318POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
310 : POP3configUI( parent, name, modal, flags ) 319 : POP3configUI( parent, name, modal, flags )
311{ 320{
312 data = account; 321 data = account;
313 fillValues(); 322 fillValues();
314 323
315 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) ); 324 connect( ComboBox1, SIGNAL( activated( int ) ), SLOT( slotConnectionToggle( int ) ) );
316 ComboBox1->insertItem( "Only if available", 0 ); 325 ComboBox1->insertItem( "Only if available", 0 );
317 ComboBox1->insertItem( "Always, Negotiated", 1 ); 326 ComboBox1->insertItem( "Always, Negotiated", 1 );
318 ComboBox1->insertItem( "Connect on secure port", 2 ); 327 ComboBox1->insertItem( "Connect on secure port", 2 );
319 ComboBox1->insertItem( "Run command instead", 3 ); 328 ComboBox1->insertItem( "Run command instead", 3 );
320 CommandEdit->hide(); 329 CommandEdit->hide();
321 ComboBox1->setCurrentItem( data->ConnectionType() ); 330 ComboBox1->setCurrentItem( data->ConnectionType() );
diff --git a/noncore/net/mail/editaccounts.h b/noncore/net/mail/editaccounts.h
index d51e299..d8e1219 100644
--- a/noncore/net/mail/editaccounts.h
+++ b/noncore/net/mail/editaccounts.h
@@ -58,49 +58,49 @@ class SelectMailType : public SelectMailTypeUI
58 Q_OBJECT 58 Q_OBJECT
59 59
60public: 60public:
61 SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 61 SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
62 62
63private slots: 63private slots:
64 void slotSelection( const QString &sel ); 64 void slotSelection( const QString &sel );
65 65
66private: 66private:
67 QString *selected; 67 QString *selected;
68 68
69}; 69};
70 70
71class IMAPconfig : public IMAPconfigUI 71class IMAPconfig : public IMAPconfigUI
72{ 72{
73 Q_OBJECT 73 Q_OBJECT
74 74
75public: 75public:
76 IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 76 IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
77 77
78public slots: 78public slots:
79 void fillValues(); 79 void fillValues();
80 80
81protected slots: 81protected slots:
82 void slotSSL( bool enabled ); 82 void slotConnectionToggle( int index );
83 void accept(); 83 void accept();
84 84
85private: 85private:
86 IMAPaccount *data; 86 IMAPaccount *data;
87 87
88}; 88};
89 89
90class POP3config : public POP3configUI 90class POP3config : public POP3configUI
91{ 91{
92 Q_OBJECT 92 Q_OBJECT
93 93
94public: 94public:
95 POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 ); 95 POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
96 96
97public slots: 97public slots:
98 void fillValues(); 98 void fillValues();
99 99
100protected slots: 100protected slots:
101 void slotConnectionToggle( int index ); 101 void slotConnectionToggle( int index );
102 void accept(); 102 void accept();
103 103
104private: 104private:
105 POP3account *data; 105 POP3account *data;
106 106
diff --git a/noncore/net/mail/imapconfigui.ui b/noncore/net/mail/imapconfigui.ui
index ac0297f..a96c1a2 100644
--- a/noncore/net/mail/imapconfigui.ui
+++ b/noncore/net/mail/imapconfigui.ui
@@ -1,242 +1,259 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>IMAPconfigUI</class> 2<class>IMAPconfigUI</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>IMAPconfigUI</cstring> 7 <cstring>IMAPconfigUI</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>228</width> 14 <width>425</width>
15 <height>320</height> 15 <height>428</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Configure IMAP</string> 20 <string>Configure IMAP</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <grid> 28 <grid>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>3</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>2</number> 35 <number>3</number>
36 </property> 36 </property>
37 <widget row="6" column="0" >
38 <class>QLabel</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>userLabel</cstring>
42 </property>
43 <property stdset="1">
44 <name>text</name>
45 <string>User</string>
46 </property>
47 </widget>
48 <widget row="4" column="1" >
49 <class>QCheckBox</class>
50 <property stdset="1">
51 <name>name</name>
52 <cstring>sslBox</cstring>
53 </property>
54 <property stdset="1">
55 <name>text</name>
56 <string>Use SSL</string>
57 </property>
58 </widget>
59 <widget row="2" column="1" > 37 <widget row="2" column="1" >
60 <class>QLineEdit</class> 38 <class>QLineEdit</class>
61 <property stdset="1"> 39 <property stdset="1">
62 <name>name</name> 40 <name>name</name>
63 <cstring>serverLine</cstring> 41 <cstring>serverLine</cstring>
64 </property> 42 </property>
65 </widget> 43 </widget>
66 <widget row="6" column="1" >
67 <class>QLineEdit</class>
68 <property stdset="1">
69 <name>name</name>
70 <cstring>userLine</cstring>
71 </property>
72 </widget>
73 <widget row="7" column="0" >
74 <class>QLabel</class>
75 <property stdset="1">
76 <name>name</name>
77 <cstring>passLabel</cstring>
78 </property>
79 <property stdset="1">
80 <name>text</name>
81 <string>Password</string>
82 </property>
83 </widget>
84 <widget row="3" column="0" > 44 <widget row="3" column="0" >
85 <class>QLabel</class> 45 <class>QLabel</class>
86 <property stdset="1"> 46 <property stdset="1">
87 <name>name</name> 47 <name>name</name>
88 <cstring>portLabel</cstring> 48 <cstring>portLabel</cstring>
89 </property> 49 </property>
90 <property stdset="1"> 50 <property stdset="1">
91 <name>text</name> 51 <name>text</name>
92 <string>Port</string> 52 <string>Port</string>
93 </property> 53 </property>
94 </widget> 54 </widget>
95 <widget row="2" column="0" > 55 <widget row="2" column="0" >
96 <class>QLabel</class> 56 <class>QLabel</class>
97 <property stdset="1"> 57 <property stdset="1">
98 <name>name</name> 58 <name>name</name>
99 <cstring>serverLabel</cstring> 59 <cstring>serverLabel</cstring>
100 </property> 60 </property>
101 <property stdset="1"> 61 <property stdset="1">
102 <name>text</name> 62 <name>text</name>
103 <string>Server</string> 63 <string>Server</string>
104 </property> 64 </property>
105 </widget> 65 </widget>
106 <widget row="3" column="1" > 66 <widget row="3" column="1" >
107 <class>QLineEdit</class> 67 <class>QLineEdit</class>
108 <property stdset="1"> 68 <property stdset="1">
109 <name>name</name> 69 <name>name</name>
110 <cstring>portLine</cstring> 70 <cstring>portLine</cstring>
111 </property> 71 </property>
112 </widget> 72 </widget>
113 <widget row="7" column="1" > 73 <widget row="0" column="1" >
114 <class>QLineEdit</class> 74 <class>QLineEdit</class>
115 <property stdset="1"> 75 <property stdset="1">
116 <name>name</name> 76 <name>name</name>
117 <cstring>passLine</cstring> 77 <cstring>accountLine</cstring>
78 </property>
79 <property>
80 <name>toolTip</name>
81 <string>Name of the Account</string>
118 </property> 82 </property>
83 </widget>
84 <widget row="0" column="0" >
85 <class>QLabel</class>
119 <property stdset="1"> 86 <property stdset="1">
120 <name>echoMode</name> 87 <name>name</name>
121 <enum>Password</enum> 88 <cstring>accountLabel</cstring>
89 </property>
90 <property stdset="1">
91 <name>text</name>
92 <string>Account</string>
93 </property>
94 </widget>
95 <widget row="1" column="0" rowspan="1" colspan="2" >
96 <class>Line</class>
97 <property stdset="1">
98 <name>name</name>
99 <cstring>line1</cstring>
100 </property>
101 <property stdset="1">
102 <name>orientation</name>
103 <enum>Horizontal</enum>
122 </property> 104 </property>
123 </widget> 105 </widget>
124 <spacer row="10" column="1" > 106 <spacer row="12" column="1" >
125 <property> 107 <property>
126 <name>name</name> 108 <name>name</name>
127 <cstring>spacer</cstring> 109 <cstring>spacer</cstring>
128 </property> 110 </property>
129 <property stdset="1"> 111 <property stdset="1">
130 <name>orientation</name> 112 <name>orientation</name>
131 <enum>Vertical</enum> 113 <enum>Vertical</enum>
132 </property> 114 </property>
133 <property stdset="1"> 115 <property stdset="1">
134 <name>sizeType</name> 116 <name>sizeType</name>
135 <enum>Expanding</enum> 117 <enum>Expanding</enum>
136 </property> 118 </property>
137 <property> 119 <property>
138 <name>sizeHint</name> 120 <name>sizeHint</name>
139 <size> 121 <size>
140 <width>20</width> 122 <width>20</width>
141 <height>20</height> 123 <height>20</height>
142 </size> 124 </size>
143 </property> 125 </property>
144 </spacer> 126 </spacer>
145 <widget row="0" column="1" > 127 <widget row="8" column="1" >
146 <class>QLineEdit</class> 128 <class>QLineEdit</class>
147 <property stdset="1"> 129 <property stdset="1">
148 <name>name</name> 130 <name>name</name>
149 <cstring>accountLine</cstring> 131 <cstring>userLine</cstring>
150 </property>
151 <property>
152 <name>toolTip</name>
153 <string>Name of the Account</string>
154 </property> 132 </property>
155 </widget> 133 </widget>
156 <widget row="0" column="0" > 134 <widget row="9" column="1" >
157 <class>QLabel</class> 135 <class>QLineEdit</class>
158 <property stdset="1"> 136 <property stdset="1">
159 <name>name</name> 137 <name>name</name>
160 <cstring>accountLabel</cstring> 138 <cstring>passLine</cstring>
161 </property> 139 </property>
162 <property stdset="1"> 140 <property stdset="1">
163 <name>text</name> 141 <name>echoMode</name>
164 <string>Account</string> 142 <enum>Password</enum>
165 </property> 143 </property>
166 </widget> 144 </widget>
167 <widget row="1" column="0" rowspan="1" colspan="2" > 145 <widget row="11" column="0" >
168 <class>Line</class> 146 <class>QLabel</class>
169 <property stdset="1"> 147 <property stdset="1">
170 <name>name</name> 148 <name>name</name>
171 <cstring>line1</cstring> 149 <cstring>prefixLabel</cstring>
172 </property> 150 </property>
173 <property stdset="1"> 151 <property stdset="1">
174 <name>orientation</name> 152 <name>text</name>
175 <enum>Horizontal</enum> 153 <string>Prefix</string>
176 </property> 154 </property>
177 </widget> 155 </widget>
178 <widget row="9" column="1" > 156 <widget row="11" column="1" >
179 <class>QLineEdit</class> 157 <class>QLineEdit</class>
180 <property stdset="1"> 158 <property stdset="1">
181 <name>name</name> 159 <name>name</name>
182 <cstring>prefixLine</cstring> 160 <cstring>prefixLine</cstring>
183 </property> 161 </property>
184 </widget> 162 </widget>
185 <widget row="9" column="0" > 163 <widget row="8" column="0" >
186 <class>QLabel</class> 164 <class>QLabel</class>
187 <property stdset="1"> 165 <property stdset="1">
188 <name>name</name> 166 <name>name</name>
189 <cstring>prefixLabel</cstring> 167 <cstring>userLabel</cstring>
190 </property> 168 </property>
191 <property stdset="1"> 169 <property stdset="1">
192 <name>text</name> 170 <name>text</name>
193 <string>Prefix</string> 171 <string>User</string>
194 </property> 172 </property>
195 </widget> 173 </widget>
196 <widget row="5" column="0" rowspan="1" colspan="2" > 174 <widget row="7" column="0" rowspan="1" colspan="2" >
197 <class>Line</class> 175 <class>Line</class>
198 <property stdset="1"> 176 <property stdset="1">
199 <name>name</name> 177 <name>name</name>
200 <cstring>line2</cstring> 178 <cstring>line2</cstring>
201 </property> 179 </property>
202 <property stdset="1"> 180 <property stdset="1">
203 <name>enabled</name> 181 <name>enabled</name>
204 <bool>true</bool> 182 <bool>true</bool>
205 </property> 183 </property>
206 <property stdset="1"> 184 <property stdset="1">
207 <name>caption</name> 185 <name>caption</name>
208 <string></string> 186 <string></string>
209 </property> 187 </property>
210 <property stdset="1"> 188 <property stdset="1">
211 <name>orientation</name> 189 <name>orientation</name>
212 <enum>Horizontal</enum> 190 <enum>Horizontal</enum>
213 </property> 191 </property>
214 <property> 192 <property>
215 <name>layoutMargin</name> 193 <name>layoutMargin</name>
216 </property> 194 </property>
217 <property> 195 <property>
218 <name>layoutSpacing</name> 196 <name>layoutSpacing</name>
219 </property> 197 </property>
220 </widget> 198 </widget>
221 <widget row="8" column="0" rowspan="1" colspan="2" > 199 <widget row="10" column="0" rowspan="1" colspan="2" >
222 <class>Line</class> 200 <class>Line</class>
223 <property stdset="1"> 201 <property stdset="1">
224 <name>name</name> 202 <name>name</name>
225 <cstring>Line3</cstring> 203 <cstring>Line3</cstring>
226 </property> 204 </property>
227 <property stdset="1"> 205 <property stdset="1">
228 <name>orientation</name> 206 <name>orientation</name>
229 <enum>Horizontal</enum> 207 <enum>Horizontal</enum>
230 </property> 208 </property>
231 </widget> 209 </widget>
210 <widget row="9" column="0" >
211 <class>QLabel</class>
212 <property stdset="1">
213 <name>name</name>
214 <cstring>passLabel</cstring>
215 </property>
216 <property stdset="1">
217 <name>text</name>
218 <string>Password</string>
219 </property>
220 </widget>
221 <widget row="6" column="0" rowspan="1" colspan="2" >
222 <class>QLineEdit</class>
223 <property stdset="1">
224 <name>name</name>
225 <cstring>CommandEdit</cstring>
226 </property>
227 <property stdset="1">
228 <name>text</name>
229 <string>ssh $SERVER exec</string>
230 </property>
231 </widget>
232 <widget row="5" column="0" rowspan="1" colspan="2" >
233 <class>QComboBox</class>
234 <property stdset="1">
235 <name>name</name>
236 <cstring>ComboBox1</cstring>
237 </property>
238 </widget>
239 <widget row="4" column="0" rowspan="1" colspan="2" >
240 <class>QLabel</class>
241 <property stdset="1">
242 <name>name</name>
243 <cstring>TextLabel1</cstring>
244 </property>
245 <property stdset="1">
246 <name>text</name>
247 <string>Use secure sockets:</string>
248 </property>
249 </widget>
232 </grid> 250 </grid>
233</widget> 251</widget>
234<tabstops> 252<tabstops>
235 <tabstop>accountLine</tabstop> 253 <tabstop>accountLine</tabstop>
236 <tabstop>serverLine</tabstop> 254 <tabstop>serverLine</tabstop>
237 <tabstop>portLine</tabstop> 255 <tabstop>portLine</tabstop>
238 <tabstop>sslBox</tabstop>
239 <tabstop>userLine</tabstop> 256 <tabstop>userLine</tabstop>
240 <tabstop>passLine</tabstop> 257 <tabstop>passLine</tabstop>
241</tabstops> 258</tabstops>
242</UI> 259</UI>
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 4b633ea..1c22c26 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -59,50 +59,60 @@ void IMAPwrapper::login()
59 return; 59 return;
60 } 60 }
61 } 61 }
62 server = account->getServer().latin1(); 62 server = account->getServer().latin1();
63 port = account->getPort().toUInt(); 63 port = account->getPort().toUInt();
64 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 64 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
65 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 65 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
66 login.show(); 66 login.show();
67 if ( QDialog::Accepted == login.exec() ) { 67 if ( QDialog::Accepted == login.exec() ) {
68 // ok 68 // ok
69 user = login.getUser().latin1(); 69 user = login.getUser().latin1();
70 pass = login.getPassword().latin1(); 70 pass = login.getPassword().latin1();
71 } else { 71 } else {
72 // cancel 72 // cancel
73 qDebug( "IMAP: Login canceled" ); 73 qDebug( "IMAP: Login canceled" );
74 return; 74 return;
75 } 75 }
76 } else { 76 } else {
77 user = account->getUser().latin1(); 77 user = account->getUser().latin1();
78 pass = account->getPassword().latin1(); 78 pass = account->getPassword().latin1();
79 } 79 }
80 80
81 m_imap = mailimap_new( 20, &imap_progress ); 81 m_imap = mailimap_new( 20, &imap_progress );
82 82
83
84
83 /* connect */ 85 /* connect */
84 if (account->getSSL()) { 86
87 bool ssl = false;
88
89 if ( account->ConnectionType() == 2 ) {
90 ssl = true;
91 }
92
93 if ( ssl ) {
94 qDebug( "using ssl" );
85 err = mailimap_ssl_connect( m_imap, (char*)server, port ); 95 err = mailimap_ssl_connect( m_imap, (char*)server, port );
86 } else { 96 } else {
87 err = mailimap_socket_connect( m_imap, (char*)server, port ); 97 err = mailimap_socket_connect( m_imap, (char*)server, port );
88 } 98 }
89 99
90 if ( err != MAILIMAP_NO_ERROR && 100 if ( err != MAILIMAP_NO_ERROR &&
91 err != MAILIMAP_NO_ERROR_AUTHENTICATED && 101 err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
92 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { 102 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
93 QString failure = ""; 103 QString failure = "";
94 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { 104 if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) {
95 failure="Connection refused"; 105 failure="Connection refused";
96 } else { 106 } else {
97 failure="Unknown failure"; 107 failure="Unknown failure";
98 } 108 }
99 Global::statusMessage(tr("error connecting imap server: %1").arg(failure)); 109 Global::statusMessage(tr("error connecting imap server: %1").arg(failure));
100 mailimap_free( m_imap ); 110 mailimap_free( m_imap );
101 m_imap = 0; 111 m_imap = 0;
102 return; 112 return;
103 } 113 }
104 114
105 /* login */ 115 /* login */
106 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass ); 116 err = mailimap_login_simple( m_imap, (char*)user, (char*)pass );
107 if ( err != MAILIMAP_NO_ERROR ) { 117 if ( err != MAILIMAP_NO_ERROR ) {
108 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); 118 Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response));
@@ -348,88 +358,88 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
348 addresslist = address_list_to_stringlist(head->env_to->to_list); 358 addresslist = address_list_to_stringlist(head->env_to->to_list);
349 m->setTo(addresslist); 359 m->setTo(addresslist);
350 } 360 }
351 if (head->env_cc!=NULL) { 361 if (head->env_cc!=NULL) {
352 addresslist = address_list_to_stringlist(head->env_cc->cc_list); 362 addresslist = address_list_to_stringlist(head->env_cc->cc_list);
353 m->setCC(addresslist); 363 m->setCC(addresslist);
354 } 364 }
355 if (head->env_bcc!=NULL) { 365 if (head->env_bcc!=NULL) {
356 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); 366 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list);
357 m->setBcc(addresslist); 367 m->setBcc(addresslist);
358 } 368 }
359 if (head->env_reply_to!=NULL) { 369 if (head->env_reply_to!=NULL) {
360 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); 370 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
361 if (addresslist.count()) { 371 if (addresslist.count()) {
362 m->setReplyto(addresslist.first()); 372 m->setReplyto(addresslist.first());
363 } 373 }
364 } 374 }
365 m->setMsgid(QString(head->env_message_id)); 375 m->setMsgid(QString(head->env_message_id));
366 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { 376 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
367#if 0 377#if 0
368 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; 378 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
369 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); 379 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
370 qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); 380 qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec);
371 qDebug(da.toString()); 381 qDebug(da.toString());
372#endif 382#endif
373 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { 383 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
374 size = item->att_data.att_static->att_data.att_rfc822_size; 384 size = item->att_data.att_static->att_data.att_rfc822_size;
375 } 385 }
376 } 386 }
377 /* msg is already deleted */ 387 /* msg is already deleted */
378 if (mFlags.testBit(FLAG_DELETED) && m) { 388 if (mFlags.testBit(FLAG_DELETED) && m) {
379 delete m; 389 delete m;
380 m = 0; 390 m = 0;
381 } 391 }
382 if (m) { 392 if (m) {
383 m->setFlags(mFlags); 393 m->setFlags(mFlags);
384 m->setMsgsize(size); 394 m->setMsgsize(size);
385 } 395 }
386 return m; 396 return m;
387} 397}
388 398
389RecBody IMAPwrapper::fetchBody(const RecMail&mail) 399RecBody IMAPwrapper::fetchBody(const RecMail&mail)
390{ 400{
391 RecBody body; 401 RecBody body;
392 const char *mb; 402 const char *mb;
393 int err = MAILIMAP_NO_ERROR; 403 int err = MAILIMAP_NO_ERROR;
394 clist *result = 0; 404 clist *result = 0;
395 clistcell *current; 405 clistcell *current;
396 mailimap_fetch_att *fetchAtt = 0; 406 mailimap_fetch_att *fetchAtt = 0;
397 mailimap_fetch_type *fetchType = 0; 407 mailimap_fetch_type *fetchType = 0;
398 mailimap_set *set = 0; 408 mailimap_set *set = 0;
399 mailimap_body*body_desc = 0; 409 mailimap_body*body_desc = 0;
400 410
401 mb = mail.getMbox().latin1(); 411 mb = mail.getMbox().latin1();
402 412
403 login(); 413 login();
404 if (!m_imap) { 414 if (!m_imap) {
405 return body; 415 return body;
406 } 416 }
407 err = selectMbox(mail.getMbox()); 417 err = selectMbox(mail.getMbox());
408 if ( err != MAILIMAP_NO_ERROR ) { 418 if ( err != MAILIMAP_NO_ERROR ) {
409 return body; 419 return body;
410 } 420 }
411 421
412 /* the range has to start at 1!!! not with 0!!!! */ 422 /* the range has to start at 1!!! not with 0!!!! */
413 set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); 423 set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() );
414 fetchAtt = mailimap_fetch_att_new_bodystructure(); 424 fetchAtt = mailimap_fetch_att_new_bodystructure();
415 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); 425 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
416 err = mailimap_fetch( m_imap, set, fetchType, &result ); 426 err = mailimap_fetch( m_imap, set, fetchType, &result );
417 mailimap_set_free( set ); 427 mailimap_set_free( set );
418 mailimap_fetch_type_free( fetchType ); 428 mailimap_fetch_type_free( fetchType );
419 429
420 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 430 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
421 mailimap_msg_att * msg_att; 431 mailimap_msg_att * msg_att;
422 msg_att = (mailimap_msg_att*)current->data; 432 msg_att = (mailimap_msg_att*)current->data;
423 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; 433 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
424 QValueList<int> path; 434 QValueList<int> path;
425 body_desc = item->att_data.att_static->att_data.att_body; 435 body_desc = item->att_data.att_static->att_data.att_body;
426 traverseBody(mail,body_desc,body,0,path); 436 traverseBody(mail,body_desc,body,0,path);
427 } else { 437 } else {
428 qDebug("error fetching body: %s",m_imap->imap_response); 438 qDebug("error fetching body: %s",m_imap->imap_response);
429 } 439 }
430 if (result) mailimap_fetch_list_free(result); 440 if (result) mailimap_fetch_list_free(result);
431 return body; 441 return body;
432} 442}
433 443
434QStringList IMAPwrapper::address_list_to_stringlist(clist*list) 444QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
435{ 445{
@@ -474,89 +484,89 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
474 484
475encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call) 485encodedString*IMAPwrapper::fetchRawPart(const RecMail&mail,const QValueList<int>&path,bool internal_call)
476{ 486{
477 encodedString*res=new encodedString; 487 encodedString*res=new encodedString;
478 int err; 488 int err;
479 mailimap_fetch_type *fetchType; 489 mailimap_fetch_type *fetchType;
480 mailimap_set *set; 490 mailimap_set *set;
481 clistcell*current,*cur; 491 clistcell*current,*cur;
482 mailimap_section_part * section_part = 0; 492 mailimap_section_part * section_part = 0;
483 mailimap_section_spec * section_spec = 0; 493 mailimap_section_spec * section_spec = 0;
484 mailimap_section * section = 0; 494 mailimap_section * section = 0;
485 mailimap_fetch_att * fetch_att = 0; 495 mailimap_fetch_att * fetch_att = 0;
486 496
487 login(); 497 login();
488 if (!m_imap) { 498 if (!m_imap) {
489 return res; 499 return res;
490 } 500 }
491 if (!internal_call) { 501 if (!internal_call) {
492 err = selectMbox(mail.getMbox()); 502 err = selectMbox(mail.getMbox());
493 if ( err != MAILIMAP_NO_ERROR ) { 503 if ( err != MAILIMAP_NO_ERROR ) {
494 return res; 504 return res;
495 } 505 }
496 } 506 }
497 set = mailimap_set_new_single(mail.getNumber()); 507 set = mailimap_set_new_single(mail.getNumber());
498 508
499 clist*id_list = 0; 509 clist*id_list = 0;
500 510
501 /* if path == empty then its a request for the whole rfc822 mail and generates 511 /* if path == empty then its a request for the whole rfc822 mail and generates
502 a "fetch <id> (body[])" statement on imap server */ 512 a "fetch <id> (body[])" statement on imap server */
503 if (path.count()>0 ) { 513 if (path.count()>0 ) {
504 id_list = clist_new(); 514 id_list = clist_new();
505 for (unsigned j=0; j < path.count();++j) { 515 for (unsigned j=0; j < path.count();++j) {
506 uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); 516 uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id));
507 *p_id = path[j]; 517 *p_id = path[j];
508 clist_append(id_list,p_id); 518 clist_append(id_list,p_id);
509 } 519 }
510 section_part = mailimap_section_part_new(id_list); 520 section_part = mailimap_section_part_new(id_list);
511 section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); 521 section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL);
512 } 522 }
513 523
514 section = mailimap_section_new(section_spec); 524 section = mailimap_section_new(section_spec);
515 fetch_att = mailimap_fetch_att_new_body_section(section); 525 fetch_att = mailimap_fetch_att_new_body_section(section);
516 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); 526 fetchType = mailimap_fetch_type_new_fetch_att(fetch_att);
517 527
518 clist*result = 0; 528 clist*result = 0;
519 529
520 err = mailimap_fetch( m_imap, set, fetchType, &result ); 530 err = mailimap_fetch( m_imap, set, fetchType, &result );
521 mailimap_set_free( set ); 531 mailimap_set_free( set );
522 mailimap_fetch_type_free( fetchType ); 532 mailimap_fetch_type_free( fetchType );
523 533
524 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 534 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
525 mailimap_msg_att * msg_att; 535 mailimap_msg_att * msg_att;
526 msg_att = (mailimap_msg_att*)current->data; 536 msg_att = (mailimap_msg_att*)current->data;
527 mailimap_msg_att_item*msg_att_item; 537 mailimap_msg_att_item*msg_att_item;
528 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { 538 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
529 msg_att_item = (mailimap_msg_att_item*)clist_content(cur); 539 msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
530 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { 540 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
531 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { 541 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
532 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; 542 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
533 /* detach - we take over the content */ 543 /* detach - we take over the content */
534 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; 544 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
535 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); 545 res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
536 } 546 }
537 } 547 }
538 } 548 }
539 } else { 549 } else {
540 qDebug("error fetching text: %s",m_imap->imap_response); 550 qDebug("error fetching text: %s",m_imap->imap_response);
541 } 551 }
542 if (result) mailimap_fetch_list_free(result); 552 if (result) mailimap_fetch_list_free(result);
543 return res; 553 return res;
544} 554}
545 555
546/* current_recursion is for recursive calls. 556/* current_recursion is for recursive calls.
547 current_count means the position inside the internal loop! */ 557 current_count means the position inside the internal loop! */
548void IMAPwrapper::traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body, 558void IMAPwrapper::traverseBody(const RecMail&mail,mailimap_body*body,RecBody&target_body,
549 int current_recursion,QValueList<int>recList,int current_count) 559 int current_recursion,QValueList<int>recList,int current_count)
550{ 560{
551 if (!body || current_recursion>=10) { 561 if (!body || current_recursion>=10) {
552 return; 562 return;
553 } 563 }
554 switch (body->bd_type) { 564 switch (body->bd_type) {
555 case MAILIMAP_BODY_1PART: 565 case MAILIMAP_BODY_1PART:
556 { 566 {
557 QValueList<int>countlist = recList; 567 QValueList<int>countlist = recList;
558 countlist.append(current_count); 568 countlist.append(current_count);
559 RecPart currentPart; 569 RecPart currentPart;
560 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; 570 mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
561 QString id(""); 571 QString id("");
562 currentPart.setPositionlist(countlist); 572 currentPart.setPositionlist(countlist);
@@ -643,65 +653,65 @@ void IMAPwrapper::fillSinglePart(RecPart&target_part,mailimap_body_type_1part*De
643} 653}
644 654
645void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which) 655void IMAPwrapper::fillSingleTextPart(RecPart&target_part,mailimap_body_type_text*which)
646{ 656{
647 if (!which) { 657 if (!which) {
648 return; 658 return;
649 } 659 }
650 QString sub; 660 QString sub;
651 sub = which->bd_media_text; 661 sub = which->bd_media_text;
652 qDebug("Type= text/%s",which->bd_media_text); 662 qDebug("Type= text/%s",which->bd_media_text);
653 target_part.setSubtype(sub.lower()); 663 target_part.setSubtype(sub.lower());
654 target_part.setLines(which->bd_lines); 664 target_part.setLines(which->bd_lines);
655 fillBodyFields(target_part,which->bd_fields); 665 fillBodyFields(target_part,which->bd_fields);
656} 666}
657 667
658void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which) 668void IMAPwrapper::fillSingleMsgPart(RecPart&target_part,mailimap_body_type_msg*which)
659{ 669{
660 if (!which) { 670 if (!which) {
661 return; 671 return;
662 } 672 }
663 target_part.setSubtype("rfc822"); 673 target_part.setSubtype("rfc822");
664 qDebug("Message part"); 674 qDebug("Message part");
665 /* we set this type to text/plain */ 675 /* we set this type to text/plain */
666 target_part.setLines(which->bd_lines); 676 target_part.setLines(which->bd_lines);
667 fillBodyFields(target_part,which->bd_fields); 677 fillBodyFields(target_part,which->bd_fields);
668} 678}
669 679
670void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which) 680void IMAPwrapper::fillMultiPart(RecPart&target_part,mailimap_body_type_mpart*which)
671{ 681{
672 if (!which) return; 682 if (!which) return;
673 QString sub = which->bd_media_subtype; 683 QString sub = which->bd_media_subtype;
674 target_part.setSubtype(sub.lower()); 684 target_part.setSubtype(sub.lower());
675 if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { 685 if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) {
676 clistcell*cur = 0; 686 clistcell*cur = 0;
677 mailimap_single_body_fld_param*param=0; 687 mailimap_single_body_fld_param*param=0;
678 for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { 688 for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) {
679 param = (mailimap_single_body_fld_param*)cur->data; 689 param = (mailimap_single_body_fld_param*)cur->data;
680 if (param) { 690 if (param) {
681 target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); 691 target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
682 } 692 }
683 } 693 }
684 } 694 }
685} 695}
686 696
687void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which) 697void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_basic*which)
688{ 698{
689 if (!which) { 699 if (!which) {
690 return; 700 return;
691 } 701 }
692 QString type,sub; 702 QString type,sub;
693 switch (which->bd_media_basic->med_type) { 703 switch (which->bd_media_basic->med_type) {
694 case MAILIMAP_MEDIA_BASIC_APPLICATION: 704 case MAILIMAP_MEDIA_BASIC_APPLICATION:
695 type = "application"; 705 type = "application";
696 break; 706 break;
697 case MAILIMAP_MEDIA_BASIC_AUDIO: 707 case MAILIMAP_MEDIA_BASIC_AUDIO:
698 type = "audio"; 708 type = "audio";
699 break; 709 break;
700 case MAILIMAP_MEDIA_BASIC_IMAGE: 710 case MAILIMAP_MEDIA_BASIC_IMAGE:
701 type = "image"; 711 type = "image";
702 break; 712 break;
703 case MAILIMAP_MEDIA_BASIC_MESSAGE: 713 case MAILIMAP_MEDIA_BASIC_MESSAGE:
704 type = "message"; 714 type = "message";
705 break; 715 break;
706 case MAILIMAP_MEDIA_BASIC_VIDEO: 716 case MAILIMAP_MEDIA_BASIC_VIDEO:
707 type = "video"; 717 type = "video";
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 7b6a58d..3279f39 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -143,70 +143,72 @@ QString IMAPaccount::getUniqueFileName()
143{ 143{
144 int num = 0; 144 int num = 0;
145 QString unique; 145 QString unique;
146 146
147 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); 147 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
148 148
149 QStringList imap = dir.entryList( "imap-*" ); 149 QStringList imap = dir.entryList( "imap-*" );
150 do { 150 do {
151 unique.setNum( num++ ); 151 unique.setNum( num++ );
152 } while ( imap.contains( "imap-" + unique ) > 0 ); 152 } while ( imap.contains( "imap-" + unique ) > 0 );
153 153
154 return unique; 154 return unique;
155} 155}
156 156
157void IMAPaccount::read() 157void IMAPaccount::read()
158{ 158{
159 Config *conf = new Config( getFileName(), Config::File ); 159 Config *conf = new Config( getFileName(), Config::File );
160 conf->setGroup( "IMAP Account" ); 160 conf->setGroup( "IMAP Account" );
161 accountName = conf->readEntry( "Account","" ); 161 accountName = conf->readEntry( "Account","" );
162 if (accountName.isNull()) accountName = ""; 162 if (accountName.isNull()) accountName = "";
163 server = conf->readEntry( "Server","" ); 163 server = conf->readEntry( "Server","" );
164 if (server.isNull()) server=""; 164 if (server.isNull()) server="";
165 port = conf->readEntry( "Port","" ); 165 port = conf->readEntry( "Port","" );
166 if (port.isNull()) port="143"; 166 if (port.isNull()) port="143";
167 connectionType = conf->readNumEntry( "ConnectionType" );
167 ssl = conf->readBoolEntry( "SSL",false ); 168 ssl = conf->readBoolEntry( "SSL",false );
168 user = conf->readEntry( "User","" ); 169 user = conf->readEntry( "User","" );
169 if (user.isNull()) user = ""; 170 if (user.isNull()) user = "";
170 password = conf->readEntryCrypt( "Password","" ); 171 password = conf->readEntryCrypt( "Password","" );
171 if (password.isNull()) password = ""; 172 if (password.isNull()) password = "";
172 prefix = conf->readEntry("MailPrefix",""); 173 prefix = conf->readEntry("MailPrefix","");
173 if (prefix.isNull()) prefix = ""; 174 if (prefix.isNull()) prefix = "";
174 offline = conf->readBoolEntry("Offline",false); 175 offline = conf->readBoolEntry("Offline",false);
175 delete conf; 176 delete conf;
176} 177}
177 178
178void IMAPaccount::save() 179void IMAPaccount::save()
179{ 180{
180 qDebug( "saving " + getFileName() ); 181 qDebug( "saving " + getFileName() );
181 Settings::checkDirectory(); 182 Settings::checkDirectory();
182 183
183 Config *conf = new Config( getFileName(), Config::File ); 184 Config *conf = new Config( getFileName(), Config::File );
184 conf->setGroup( "IMAP Account" ); 185 conf->setGroup( "IMAP Account" );
185 conf->writeEntry( "Account", accountName ); 186 conf->writeEntry( "Account", accountName );
186 conf->writeEntry( "Server", server ); 187 conf->writeEntry( "Server", server );
187 conf->writeEntry( "Port", port ); 188 conf->writeEntry( "Port", port );
188 conf->writeEntry( "SSL", ssl ); 189 conf->writeEntry( "SSL", ssl );
190 conf->writeEntry( "ConnectionType", connectionType );
189 conf->writeEntry( "User", user ); 191 conf->writeEntry( "User", user );
190 conf->writeEntryCrypt( "Password", password ); 192 conf->writeEntryCrypt( "Password", password );
191 conf->writeEntry( "MailPrefix",prefix); 193 conf->writeEntry( "MailPrefix",prefix);
192 conf->writeEntry( "Offline",offline); 194 conf->writeEntry( "Offline",offline);
193 conf->write(); 195 conf->write();
194 delete conf; 196 delete conf;
195} 197}
196 198
197 199
198QString IMAPaccount::getFileName() 200QString IMAPaccount::getFileName()
199{ 201{
200 return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; 202 return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file;
201} 203}
202 204
203POP3account::POP3account() 205POP3account::POP3account()
204 : Account() 206 : Account()
205{ 207{
206 file = POP3account::getUniqueFileName(); 208 file = POP3account::getUniqueFileName();
207 accountName = "New POP3 Account"; 209 accountName = "New POP3 Account";
208 ssl = false; 210 ssl = false;
209 connectionType = 1; 211 connectionType = 1;
210 type = "POP3"; 212 type = "POP3";
211 port = POP3_PORT; 213 port = POP3_PORT;
212} 214}