summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mail.pro6
-rw-r--r--noncore/net/mail/opiemail.cpp30
-rw-r--r--noncore/net/mail/selectsmtp.cpp56
-rw-r--r--noncore/net/mail/selectsmtp.h27
4 files changed, 110 insertions, 9 deletions
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index 552f0e5..184b5b3 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -4,41 +4,43 @@ HEADERS = defines.h \
4 editaccounts.h \ 4 editaccounts.h \
5 composemail.h \ 5 composemail.h \
6 accountview.h \ 6 accountview.h \
7 accountitem.h \ 7 accountitem.h \
8 mainwindow.h \ 8 mainwindow.h \
9 viewmail.h \ 9 viewmail.h \
10 viewmailbase.h \ 10 viewmailbase.h \
11 opiemail.h \ 11 opiemail.h \
12 mailistviewitem.h \ 12 mailistviewitem.h \
13 settingsdialog.h \ 13 settingsdialog.h \
14 statuswidget.h \ 14 statuswidget.h \
15 newmaildir.h \ 15 newmaildir.h \
16 selectstore.h 16 selectstore.h \
17 selectsmtp.h
17 18
18SOURCES = main.cpp \ 19SOURCES = main.cpp \
19 opiemail.cpp \ 20 opiemail.cpp \
20 mainwindow.cpp \ 21 mainwindow.cpp \
21 accountview.cpp \ 22 accountview.cpp \
22 accountitem.cpp \ 23 accountitem.cpp \
23 composemail.cpp \ 24 composemail.cpp \
24 addresspicker.cpp \ 25 addresspicker.cpp \
25 editaccounts.cpp \ 26 editaccounts.cpp \
26 viewmail.cpp \ 27 viewmail.cpp \
27 viewmailbase.cpp \ 28 viewmailbase.cpp \
28 mailistviewitem.cpp \ 29 mailistviewitem.cpp \
29 settingsdialog.cpp \ 30 settingsdialog.cpp \
30 statuswidget.cpp \ 31 statuswidget.cpp \
31 newmaildir.cpp \ 32 newmaildir.cpp \
32 selectstore.cpp 33 selectstore.cpp \
34 selectsmtp.cpp
33 35
34INTERFACES = editaccountsui.ui \ 36INTERFACES = editaccountsui.ui \
35 selectmailtypeui.ui \ 37 selectmailtypeui.ui \
36 imapconfigui.ui \ 38 imapconfigui.ui \
37 pop3configui.ui \ 39 pop3configui.ui \
38 nntpconfigui.ui \ 40 nntpconfigui.ui \
39 smtpconfigui.ui \ 41 smtpconfigui.ui \
40 addresspickerui.ui \ 42 addresspickerui.ui \
41 composemailui.ui \ 43 composemailui.ui \
42 settingsdialogui.ui \ 44 settingsdialogui.ui \
43 statuswidgetui.ui \ 45 statuswidgetui.ui \
44 newmaildirui.ui \ 46 newmaildirui.ui \
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index d3d3cdb..ea0019d 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -4,24 +4,25 @@
4#include "editaccounts.h" 4#include "editaccounts.h"
5#include "composemail.h" 5#include "composemail.h"
6#include <libmailwrapper/smtpwrapper.h> 6#include <libmailwrapper/smtpwrapper.h>
7#include <qpe/qcopenvelope_qws.h> 7#include <qpe/qcopenvelope_qws.h>
8#include <qpe/resource.h> 8#include <qpe/resource.h>
9#include <qaction.h> 9#include <qaction.h>
10#include <qapplication.h> 10#include <qapplication.h>
11#include <libmailwrapper/mailtypes.h> 11#include <libmailwrapper/mailtypes.h>
12#include <libmailwrapper/abstractmail.h> 12#include <libmailwrapper/abstractmail.h>
13#include "mailistviewitem.h" 13#include "mailistviewitem.h"
14#include "viewmail.h" 14#include "viewmail.h"
15#include "selectstore.h" 15#include "selectstore.h"
16#include "selectsmtp.h"
16 17
17OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) 18OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags )
18 : MainWindow( parent, name, WStyle_ContextHelp ) 19 : MainWindow( parent, name, WStyle_ContextHelp )
19{ 20{
20 settings = new Settings(); 21 settings = new Settings();
21 22
22 folderView->populate( settings->getAccounts() ); 23 folderView->populate( settings->getAccounts() );
23} 24}
24 25
25OpieMail::~OpieMail() 26OpieMail::~OpieMail()
26{ 27{
27 if (settings) delete settings; 28 if (settings) delete settings;
@@ -59,33 +60,48 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email)
59void OpieMail::slotComposeMail() 60void OpieMail::slotComposeMail()
60{ 61{
61 qDebug( "Compose Mail" ); 62 qDebug( "Compose Mail" );
62 slotwriteMail(0l,0l); 63 slotwriteMail(0l,0l);
63} 64}
64 65
65void OpieMail::slotSendQueued() 66void OpieMail::slotSendQueued()
66{ 67{
67 qDebug( "Send Queued" ); 68 qDebug( "Send Queued" );
68 SMTPaccount *smtp = 0; 69 SMTPaccount *smtp = 0;
69 70
70 QList<Account> list = settings->getAccounts(); 71 QList<Account> list = settings->getAccounts();
72 QList<SMTPaccount> smtpList;
73 smtpList.setAutoDelete(false);
71 Account *it; 74 Account *it;
72// if (list.count()==1) { 75 for ( it = list.first(); it; it = list.next() ) {
73 for ( it = list.first(); it; it = list.next() ) { 76 if ( it->getType().compare( "SMTP" ) == 0 ) {
74 if ( it->getType().compare( "SMTP" ) == 0 ) { 77 smtp = static_cast<SMTPaccount *>(it);
75 smtp = static_cast<SMTPaccount *>(it); 78 smtpList.append(smtp);
76 break;
77 }
78 } 79 }
79// } 80 }
81 if (smtpList.count()==0) {
82 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
83 return;
84 }
85 if (smtpList.count()==1) {
86 smtp = smtpList.at(0);
87 } else {
88 smtp = 0;
89 selectsmtp selsmtp;
90 selsmtp.setSelectionlist(&smtpList);
91 selsmtp.showMaximized();
92 if (selsmtp.exec()==QDialog::Accepted) {
93 smtp = selsmtp.selected_smtp();
94 }
95 }
80 if (smtp) { 96 if (smtp) {
81 SMTPwrapper * wrap = new SMTPwrapper(settings); 97 SMTPwrapper * wrap = new SMTPwrapper(settings);
82 if ( wrap->flushOutbox(smtp) ) { 98 if ( wrap->flushOutbox(smtp) ) {
83 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 99 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
84 } 100 }
85 } 101 }
86} 102}
87 103
88void OpieMail::slotSearchMails() 104void OpieMail::slotSearchMails()
89{ 105{
90 qDebug( "Search Mails" ); 106 qDebug( "Search Mails" );
91} 107}
diff --git a/noncore/net/mail/selectsmtp.cpp b/noncore/net/mail/selectsmtp.cpp
new file mode 100644
index 0000000..e82c6ca
--- a/dev/null
+++ b/noncore/net/mail/selectsmtp.cpp
@@ -0,0 +1,56 @@
1#include "selectsmtp.h"
2#include <libmailwrapper/mailwrapper.h>
3#include <qlist.h>
4#include <qlabel.h>
5#include <qlayout.h>
6#include <qcheckbox.h>
7#include <qframe.h>
8#include <qlineedit.h>
9#include <qcombobox.h>
10
11selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl)
12 : selectstoreui(parent,name,modal,fl)
13{
14 //m_smtpList.setAutoDelete(false);
15 m_smtpList = 0;
16 //headlabel->setText(tr("<center>Select SMTP account to use</center>"));
17 headlabel->hide();
18 folderSelection->hide();
19 folderLabel->hide();
20 accountlabel->setText("<center>SMTP Accounts</center>");
21 Line1->hide();
22 newFoldersel->hide();
23 newFolderedit->hide();
24 newFolderLabel->hide();
25 Line2->hide();
26 selMove->hide();
27 m_current_smtp = 0;
28 setCaption(tr("Select SMTP Account"));
29}
30
31selectsmtp::~selectsmtp()
32{
33}
34
35void selectsmtp::slotAccountselected(int which)
36{
37 if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) {
38 m_current_smtp = 0;
39 return;
40 }
41 m_current_smtp = m_smtpList->at(which);
42}
43
44void selectsmtp::setSelectionlist(QList<SMTPaccount>*list)
45{
46 m_smtpList = list;
47 accountSelection->clear();
48 for (unsigned i = 0; m_smtpList!=0 && i < m_smtpList->count(); ++i) {
49 accountSelection->insertItem( m_smtpList->at(i)->getAccountName());
50 }
51}
52
53SMTPaccount*selectsmtp::selected_smtp()
54{
55 return m_current_smtp;
56}
diff --git a/noncore/net/mail/selectsmtp.h b/noncore/net/mail/selectsmtp.h
new file mode 100644
index 0000000..4bb2437
--- a/dev/null
+++ b/noncore/net/mail/selectsmtp.h
@@ -0,0 +1,27 @@
1#ifndef __selectsmtp_h
2#define __selectstmp_h
3
4#include <qt.h>
5#include "selectstoreui.h"
6#include <qlist.h>
7
8class SMTPaccount;
9
10class selectsmtp : public selectstoreui
11{
12 Q_OBJECT
13public:
14 selectsmtp(QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 );
15 virtual ~selectsmtp();
16 void setSelectionlist(QList<SMTPaccount>*list);
17 SMTPaccount*selected_smtp();
18
19protected:
20 QList<SMTPaccount>*m_smtpList;
21 SMTPaccount*m_current_smtp;
22
23protected slots:
24 virtual void slotAccountselected(int);
25};
26
27#endif