summaryrefslogtreecommitdiff
authorjgf <jgf>2003-12-18 16:02:47 (UTC)
committer jgf <jgf>2003-12-18 16:02:47 (UTC)
commit5b88f5d05b2f3f5d106b58b07bc7018f757cfc03 (patch) (side-by-side diff)
tree27f8a7ccb9dd659ea8484cb12c0e3dc3c3c99252
parent5cb08b0c69ffc7216405b552e17ff0541578bda0 (diff)
downloadopie-5b88f5d05b2f3f5d106b58b07bc7018f757cfc03.zip
opie-5b88f5d05b2f3f5d106b58b07bc7018f757cfc03.tar.gz
opie-5b88f5d05b2f3f5d106b58b07bc7018f757cfc03.tar.bz2
ask for user/password if field is empty
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/imapwrapper.cpp19
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp19
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp20
-rw-r--r--noncore/net/mail/pop3wrapper.cpp20
4 files changed, 70 insertions, 8 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index 838300a..cce3d34 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -1,13 +1,14 @@
#include <stdlib.h>
#include "imapwrapper.h"
#include "mailtypes.h"
+#include "logindialog.h"
#include <libetpan/mailimap.h>
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
: AbstractMail()
{
account = a;
m_imap = 0;
}
@@ -31,18 +32,32 @@ void IMAPwrapper::login()
/* we are connected this moment */
/* TODO: setup a timer holding the line or if connection closed - delete the value */
if (m_imap) {
mailstream_flush(m_imap->imap_stream);
return;
}
server = account->getServer().latin1();
port = account->getPort().toUInt();
- user = account->getUser().latin1();
- pass = account->getPassword().latin1();
+ if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
+ LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
+ login.show();
+ if ( QDialog::Accepted == login.exec() ) {
+ // ok
+ user = strdup( login.getUser().latin1() );
+ pass = strdup( login.getPassword().latin1() );
+ } else {
+ // cancel
+ qDebug( "IMAP: Login canceled" );
+ return;
+ }
+ } else {
+ user = account->getUser().latin1();
+ pass = account->getPassword().latin1();
+ }
m_imap = mailimap_new( 20, &imap_progress );
/* connect */
if (account->getSSL()) {
err = mailimap_ssl_connect( m_imap, (char*)server, port );
} else {
err = mailimap_socket_connect( m_imap, (char*)server, port );
}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 838300a..cce3d34 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -1,13 +1,14 @@
#include <stdlib.h>
#include "imapwrapper.h"
#include "mailtypes.h"
+#include "logindialog.h"
#include <libetpan/mailimap.h>
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
: AbstractMail()
{
account = a;
m_imap = 0;
}
@@ -31,18 +32,32 @@ void IMAPwrapper::login()
/* we are connected this moment */
/* TODO: setup a timer holding the line or if connection closed - delete the value */
if (m_imap) {
mailstream_flush(m_imap->imap_stream);
return;
}
server = account->getServer().latin1();
port = account->getPort().toUInt();
- user = account->getUser().latin1();
- pass = account->getPassword().latin1();
+ if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
+ LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
+ login.show();
+ if ( QDialog::Accepted == login.exec() ) {
+ // ok
+ user = strdup( login.getUser().latin1() );
+ pass = strdup( login.getPassword().latin1() );
+ } else {
+ // cancel
+ qDebug( "IMAP: Login canceled" );
+ return;
+ }
+ } else {
+ user = account->getUser().latin1();
+ pass = account->getPassword().latin1();
+ }
m_imap = mailimap_new( 20, &imap_progress );
/* connect */
if (account->getSSL()) {
err = mailimap_ssl_connect( m_imap, (char*)server, port );
} else {
err = mailimap_socket_connect( m_imap, (char*)server, port );
}
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 22a4c70..b0b985c 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -1,11 +1,12 @@
#include <stdlib.h>
#include "pop3wrapper.h"
#include "mailtypes.h"
+#include "logindialog.h"
#include <libetpan/mailpop3.h>
#include <libetpan/mailmime.h>
#include <libetpan/data_message_driver.h>
#include <qfile.h>
/* we don't fetch messages larger than 5 MB */
#define HARD_MSG_SIZE_LIMIT 5242880
@@ -352,18 +353,33 @@ void POP3wrapper::login()
if ( m_pop3 != NULL ) return;
const char *server, *user, *pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer().latin1();
port = account->getPort().toUInt();
- user = account->getUser().latin1();
- pass = account->getPassword().latin1();
+
+ if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
+ LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
+ login.show();
+ if ( QDialog::Accepted == login.exec() ) {
+ // ok
+ user = strdup( login.getUser().latin1() );
+ pass = strdup( login.getPassword().latin1() );
+ } else {
+ // cancel
+ qDebug( "POP3: Login canceled" );
+ return;
+ }
+ } else {
+ user = account->getUser().latin1();
+ pass = account->getPassword().latin1();
+ }
m_pop3 = mailpop3_new( 200, &pop3_progress );
// connect
if (account->getSSL()) {
err = mailpop3_ssl_connect( m_pop3, (char*)server, port );
} else {
err = mailpop3_socket_connect( m_pop3, (char*)server, port );
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp
index 22a4c70..b0b985c 100644
--- a/noncore/net/mail/pop3wrapper.cpp
+++ b/noncore/net/mail/pop3wrapper.cpp
@@ -1,11 +1,12 @@
#include <stdlib.h>
#include "pop3wrapper.h"
#include "mailtypes.h"
+#include "logindialog.h"
#include <libetpan/mailpop3.h>
#include <libetpan/mailmime.h>
#include <libetpan/data_message_driver.h>
#include <qfile.h>
/* we don't fetch messages larger than 5 MB */
#define HARD_MSG_SIZE_LIMIT 5242880
@@ -352,18 +353,33 @@ void POP3wrapper::login()
if ( m_pop3 != NULL ) return;
const char *server, *user, *pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer().latin1();
port = account->getPort().toUInt();
- user = account->getUser().latin1();
- pass = account->getPassword().latin1();
+
+ if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
+ LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
+ login.show();
+ if ( QDialog::Accepted == login.exec() ) {
+ // ok
+ user = strdup( login.getUser().latin1() );
+ pass = strdup( login.getPassword().latin1() );
+ } else {
+ // cancel
+ qDebug( "POP3: Login canceled" );
+ return;
+ }
+ } else {
+ user = account->getUser().latin1();
+ pass = account->getPassword().latin1();
+ }
m_pop3 = mailpop3_new( 200, &pop3_progress );
// connect
if (account->getSSL()) {
err = mailpop3_ssl_connect( m_pop3, (char*)server, port );
} else {
err = mailpop3_socket_connect( m_pop3, (char*)server, port );