summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-10 22:52:50 (UTC)
committer zautrix <zautrix>2004-09-10 22:52:50 (UTC)
commit1b41a0e3bf63364940daf132446939e3570c57ad (patch) (unidiff)
tree81db8e427beadcf3bbd5356962b5d08b970a87e4
parentc280882f788b31f874f928e23fc29c2aaca991eb (diff)
downloadkdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.zip
kdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.tar.gz
kdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.tar.bz2
Added pop3 settings
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp12
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp2
-rw-r--r--kmicromail/libmailwrapper/settings.cpp10
-rw-r--r--kmicromail/libmailwrapper/settings.h9
-rw-r--r--kmicromail/pop3configui.ui94
5 files changed, 122 insertions, 5 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index d272c3b..e7d2750 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -11,16 +11,17 @@
11#include <qcombobox.h> 11#include <qcombobox.h>
12#include <qcheckbox.h> 12#include <qcheckbox.h>
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14#include <qpushbutton.h> 14#include <qpushbutton.h>
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qlabel.h> 16#include <qlabel.h>
17#include <qtabwidget.h> 17#include <qtabwidget.h>
18#include <qlistview.h> 18#include <qlistview.h>
19#include <qspinbox.h>
19 20
20#include <libmailwrapper/nntpwrapper.h> 21#include <libmailwrapper/nntpwrapper.h>
21 22
22using namespace Opie::Core; 23using namespace Opie::Core;
23 24
24AccountListItem::AccountListItem( QListView *parent, Account *a) 25AccountListItem::AccountListItem( QListView *parent, Account *a)
25 : QListViewItem( parent ) 26 : QListViewItem( parent )
26{ 27{
@@ -415,26 +416,37 @@ void POP3config::slotConnectionToggle( int index )
415void POP3config::fillValues() 416void POP3config::fillValues()
416{ 417{
417 accountLine->setText( data->getAccountName() ); 418 accountLine->setText( data->getAccountName() );
418 serverLine->setText( data->getServer() ); 419 serverLine->setText( data->getServer() );
419 portLine->setText( data->getPort() ); 420 portLine->setText( data->getPort() );
420 ComboBox1->setCurrentItem( data->ConnectionType() ); 421 ComboBox1->setCurrentItem( data->ConnectionType() );
421 userLine->setText( data->getUser() ); 422 userLine->setText( data->getUser() );
422 passLine->setText( data->getPassword() ); 423 passLine->setText( data->getPassword() );
424 localFolder->setText( data->getLocalFolder() );
425 int max = data->getMaxMailSize() ;
426 if ( max ) {
427 CheckBoxDown->setChecked( true );
428 SpinBoxDown->setValue ( max );
429 } else {
430 CheckBoxDown->setChecked( false );
431 SpinBoxDown->setValue ( 5 );
432 }
423} 433}
424 434
425void POP3config::accept() 435void POP3config::accept()
426{ 436{
427 data->setAccountName( accountLine->text() ); 437 data->setAccountName( accountLine->text() );
428 data->setServer( serverLine->text() ); 438 data->setServer( serverLine->text() );
429 data->setPort( portLine->text() ); 439 data->setPort( portLine->text() );
430 data->setConnectionType( ComboBox1->currentItem() ); 440 data->setConnectionType( ComboBox1->currentItem() );
431 data->setUser( userLine->text() ); 441 data->setUser( userLine->text() );
432 data->setPassword( passLine->text() ); 442 data->setPassword( passLine->text() );
443 data->setLocalFolder( localFolder->text() );
444 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
433 445
434 QDialog::accept(); 446 QDialog::accept();
435} 447}
436 448
437/** 449/**
438 * SMTPconfig 450 * SMTPconfig
439 */ 451 */
440 452
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 8d2f778..1edec9e 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -117,17 +117,17 @@ void POP3wrapper::login()
117 /* we'll hold the line */ 117 /* we'll hold the line */
118 if ( m_pop3 != NULL ) 118 if ( m_pop3 != NULL )
119 return; 119 return;
120 120
121 QString server,user, pass; 121 QString server,user, pass;
122 uint16_t port; 122 uint16_t port;
123 int err = MAILPOP3_NO_ERROR; 123 int err = MAILPOP3_NO_ERROR;
124 124
125 server = account->getServer().latin1(); 125 server = account->getServer();
126 port = account->getPort().toUInt(); 126 port = account->getPort().toUInt();
127 127
128 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 128 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
129 qApp->processEvents(); 129 qApp->processEvents();
130 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 130 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
131 login.show(); 131 login.show();
132 if ( QDialog::Accepted == login.exec() ) { 132 if ( QDialog::Accepted == login.exec() ) {
133 // ok 133 // ok
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index b0a539e..90e32fa 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -250,16 +250,21 @@ void POP3account::read()
250 accountName = conf->readEntry( "Account" ); 250 accountName = conf->readEntry( "Account" );
251 server = conf->readEntry( "Server" ); 251 server = conf->readEntry( "Server" );
252 port = conf->readEntry( "Port" ); 252 port = conf->readEntry( "Port" );
253 ssl = conf->readBoolEntry( "SSL" ); 253 ssl = conf->readBoolEntry( "SSL" );
254 connectionType = conf->readNumEntry( "ConnectionType" ); 254 connectionType = conf->readNumEntry( "ConnectionType" );
255 user = conf->readEntry( "User" ); 255 user = conf->readEntry( "User" );
256 password = conf->readEntryCrypt( "Password" ); 256 password = conf->readEntryCrypt( "Password" );
257 offline = conf->readBoolEntry("Offline",false); 257 offline = conf->readBoolEntry("Offline",false);
258 localFolder = conf->readEntry( "LocalFolder" );
259 maxMailSize = conf->readNumEntry( "MaxSize",0 );
260 int lf = conf->readNumEntry( "LastFetch",0 );
261 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
262 lastFetch = dt.addSecs( lf );
258 delete conf; 263 delete conf;
259} 264}
260 265
261void POP3account::save() 266void POP3account::save()
262{ 267{
263 Settings::checkDirectory(); 268 Settings::checkDirectory();
264 269
265 Config *conf = new Config( getFileName(), Config::File ); 270 Config *conf = new Config( getFileName(), Config::File );
@@ -267,16 +272,21 @@ void POP3account::save()
267 conf->writeEntry( "Account", accountName ); 272 conf->writeEntry( "Account", accountName );
268 conf->writeEntry( "Server", server ); 273 conf->writeEntry( "Server", server );
269 conf->writeEntry( "Port", port ); 274 conf->writeEntry( "Port", port );
270 conf->writeEntry( "SSL", ssl ); 275 conf->writeEntry( "SSL", ssl );
271 conf->writeEntry( "ConnectionType", connectionType ); 276 conf->writeEntry( "ConnectionType", connectionType );
272 conf->writeEntry( "User", user ); 277 conf->writeEntry( "User", user );
273 conf->writeEntryCrypt( "Password", password ); 278 conf->writeEntryCrypt( "Password", password );
274 conf->writeEntry( "Offline",offline); 279 conf->writeEntry( "Offline",offline);
280 conf->writeEntry( "LocalFolder", localFolder );
281 conf->writeEntry( "MaxSize", maxMailSize );
282 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
283 int lf = dt.secsTo ( lastFetch );
284 conf->writeEntry( "LastFetch", lf );
275 conf->write(); 285 conf->write();
276 delete conf; 286 delete conf;
277} 287}
278 288
279 289
280QString POP3account::getFileName() 290QString POP3account::getFileName()
281{ 291{
282 return locateLocal("data", "kopiemail" ) +"/pop3-" + file; 292 return locateLocal("data", "kopiemail" ) +"/pop3-" + file;
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h
index ba3ec89..c33c403 100644
--- a/kmicromail/libmailwrapper/settings.h
+++ b/kmicromail/libmailwrapper/settings.h
@@ -3,61 +3,70 @@
3 3
4#include "maildefines.h" 4#include "maildefines.h"
5 5
6/* OPIE */ 6/* OPIE */
7 7
8/* QT */ 8/* QT */
9#include <qobject.h> 9#include <qobject.h>
10#include <qlist.h> 10#include <qlist.h>
11#include <qdatetime.h>
11 12
12class Account 13class Account
13{ 14{
14 15
15public: 16public:
16 Account(); 17 Account();
17 virtual ~Account() {} 18 virtual ~Account() {}
18 19
19 void remove(); 20 void remove();
20 void setAccountName( QString name ) { accountName = name; } 21 void setAccountName( QString name ) { accountName = name; }
21 const QString&getAccountName()const{ return accountName; } 22 const QString&getAccountName()const{ return accountName; }
22 MAILLIB::ATYPE getType()const{ return type; } 23 MAILLIB::ATYPE getType()const{ return type; }
23 24
24 void setServer(const QString&str){ server = str; } 25 void setServer(const QString&str){ server = str; }
25 const QString&getServer()const{ return server; } 26 const QString&getServer()const{ return server; }
26 27
28 void setLocalFolder( QString name ) { localFolder = name; }
29 const QString& getLocalFolder()const{ return localFolder; }
30
27 void setPort(const QString&str) { port = str; } 31 void setPort(const QString&str) { port = str; }
28 const QString&getPort()const{ return port; } 32 const QString&getPort()const{ return port; }
29 33
30 void setUser(const QString&str){ user = str; } 34 void setUser(const QString&str){ user = str; }
31 const QString&getUser()const{ return user; } 35 const QString&getUser()const{ return user; }
32 36
33 void setPassword(const QString&str) { password = str; } 37 void setPassword(const QString&str) { password = str; }
34 const QString&getPassword()const { return password; } 38 const QString&getPassword()const { return password; }
35 39
36 void setSSL( bool b ) { ssl = b; } 40 void setSSL( bool b ) { ssl = b; }
37 bool getSSL() { return ssl; } 41 bool getSSL() { return ssl; }
38 42
39 void setConnectionType( int x ) { connectionType = x; } 43 void setConnectionType( int x ) { connectionType = x; }
40 int ConnectionType() { return connectionType; } 44 int ConnectionType() { return connectionType; }
41 45
46 void setMaxMailSize( int x ) { maxMailSize = x; }
47 int getMaxMailSize() { return maxMailSize; }
42 48
43 void setOffline(bool b) {offline = b;} 49 void setOffline(bool b) {offline = b;}
44 bool getOffline()const{return offline;} 50 bool getOffline()const{return offline;}
45 51
46 virtual QString getFileName() { return accountName; } 52 virtual QString getFileName() { return accountName; }
47 virtual void read() { ; } 53 virtual void read() { ; }
48 virtual void save() { ; } 54 virtual void save() { ; }
49 55
50protected: 56protected:
51 QString accountName, server, port, user, password; 57 QString accountName, server, port, user, password;
52 bool ssl; 58 bool ssl;
53 int connectionType; 59 int connectionType;
54 bool offline; 60 bool offline;
55 MAILLIB::ATYPE type; 61 MAILLIB::ATYPE type;
62 QString localFolder;
63 int maxMailSize;
64 QDateTime lastFetch;
56}; 65};
57 66
58class IMAPaccount : public Account 67class IMAPaccount : public Account
59{ 68{
60 69
61public: 70public:
62 IMAPaccount(); 71 IMAPaccount();
63 IMAPaccount( QString filename ); 72 IMAPaccount( QString filename );
diff --git a/kmicromail/pop3configui.ui b/kmicromail/pop3configui.ui
index 1014ef4..a2d43bd 100644
--- a/kmicromail/pop3configui.ui
+++ b/kmicromail/pop3configui.ui
@@ -6,38 +6,38 @@
6 <name>name</name> 6 <name>name</name>
7 <cstring>POP3configUI</cstring> 7 <cstring>POP3configUI</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>314</width> 14 <width>322</width>
15 <height>410</height> 15 <height>404</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 POP3</string> 20 <string>Configure POP3</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 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>11</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>3</number> 35 <number>6</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QLayoutWidget</class> 38 <class>QLayoutWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>Layout12</cstring> 41 <cstring>Layout12</cstring>
42 </property> 42 </property>
43 <hbox> 43 <hbox>
@@ -314,16 +314,102 @@
314 <name>echoMode</name> 314 <name>echoMode</name>
315 <enum>Password</enum> 315 <enum>Password</enum>
316 </property> 316 </property>
317 </widget> 317 </widget>
318 </vbox> 318 </vbox>
319 </widget> 319 </widget>
320 </hbox> 320 </hbox>
321 </widget> 321 </widget>
322 <widget>
323 <class>QLayoutWidget</class>
324 <property stdset="1">
325 <name>name</name>
326 <cstring>Layout9</cstring>
327 </property>
328 <hbox>
329 <property stdset="1">
330 <name>margin</name>
331 <number>0</number>
332 </property>
333 <property stdset="1">
334 <name>spacing</name>
335 <number>6</number>
336 </property>
337 <widget>
338 <class>QLabel</class>
339 <property stdset="1">
340 <name>name</name>
341 <cstring>TextLabel1_2</cstring>
342 </property>
343 <property stdset="1">
344 <name>text</name>
345 <string>Local storage folder:</string>
346 </property>
347 </widget>
348 <widget>
349 <class>QLineEdit</class>
350 <property stdset="1">
351 <name>name</name>
352 <cstring>localFolder</cstring>
353 </property>
354 <property stdset="1">
355 <name>text</name>
356 <string></string>
357 </property>
358 </widget>
359 </hbox>
360 </widget>
361 <widget>
362 <class>QLayoutWidget</class>
363 <property stdset="1">
364 <name>name</name>
365 <cstring>Layout10</cstring>
366 </property>
367 <hbox>
368 <property stdset="1">
369 <name>margin</name>
370 <number>0</number>
371 </property>
372 <property stdset="1">
373 <name>spacing</name>
374 <number>6</number>
375 </property>
376 <widget>
377 <class>QCheckBox</class>
378 <property stdset="1">
379 <name>name</name>
380 <cstring>CheckBoxDown</cstring>
381 </property>
382 <property stdset="1">
383 <name>text</name>
384 <string>Download only messages smaller</string>
385 </property>
386 </widget>
387 <widget>
388 <class>QSpinBox</class>
389 <property stdset="1">
390 <name>name</name>
391 <cstring>SpinBoxDown</cstring>
392 </property>
393 <property stdset="1">
394 <name>suffix</name>
395 <string>kB</string>
396 </property>
397 <property stdset="1">
398 <name>maxValue</name>
399 <number>99999</number>
400 </property>
401 <property stdset="1">
402 <name>minValue</name>
403 <number>1</number>
404 </property>
405 </widget>
406 </hbox>
407 </widget>
322 <spacer> 408 <spacer>
323 <property> 409 <property>
324 <name>name</name> 410 <name>name</name>
325 <cstring>spacer</cstring> 411 <cstring>spacer</cstring>
326 </property> 412 </property>
327 <property stdset="1"> 413 <property stdset="1">
328 <name>orientation</name> 414 <name>orientation</name>
329 <enum>Vertical</enum> 415 <enum>Vertical</enum>