summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/imapwrapper.cpp15
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp15
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp16
-rw-r--r--noncore/net/mail/pop3wrapper.cpp16
4 files changed, 62 insertions, 0 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
@@ -3,6 +3,7 @@
#include "imapwrapper.h"
#include "mailtypes.h"
+#include "logindialog.h"
#include <libetpan/mailimap.h>
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
@@ -36,8 +37,22 @@ void IMAPwrapper::login()
}
server = account->getServer().latin1();
port = account->getPort().toUInt();
+ 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 */
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
@@ -3,6 +3,7 @@
#include "imapwrapper.h"
#include "mailtypes.h"
+#include "logindialog.h"
#include <libetpan/mailimap.h>
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
@@ -36,8 +37,22 @@ void IMAPwrapper::login()
}
server = account->getServer().latin1();
port = account->getPort().toUInt();
+ 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 */
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,6 +1,7 @@
#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>
@@ -357,8 +358,23 @@ void POP3wrapper::login()
server = account->getServer().latin1();
port = account->getPort().toUInt();
+
+ 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 );
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,6 +1,7 @@
#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>
@@ -357,8 +358,23 @@ void POP3wrapper::login()
server = account->getServer().latin1();
port = account->getPort().toUInt();
+
+ 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 );