summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper
authoralwin <alwin>2003-12-24 01:29:43 (UTC)
committer alwin <alwin>2003-12-24 01:29:43 (UTC)
commit242f7a04e3e4963a5606ac603d54a4f115de4a04 (patch) (unidiff)
treedd8578fbc812791dd7e5026a28710a8313cf5cf8 /noncore/net/mail/libmailwrapper
parent7c720aabcad9b325dbf9910493e3c9fa1d63805e (diff)
downloadopie-242f7a04e3e4963a5606ac603d54a4f115de4a04.zip
opie-242f7a04e3e4963a5606ac603d54a4f115de4a04.tar.gz
opie-242f7a04e3e4963a5606ac603d54a4f115de4a04.tar.bz2
tried to implement a progress dialog when sending mails. It doesn't work
(dialog will show but makes no updates, when using qApp->progressEvents(x) dialog hides) I don't know why - and I giving up for the moment.
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/sendmailprogress.cpp48
-rw-r--r--noncore/net/mail/libmailwrapper/sendmailprogress.h19
-rw-r--r--noncore/net/mail/libmailwrapper/sendmailprogressui.ui110
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp16
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h4
5 files changed, 195 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/sendmailprogress.cpp b/noncore/net/mail/libmailwrapper/sendmailprogress.cpp
new file mode 100644
index 0000000..13ddd37
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/sendmailprogress.cpp
@@ -0,0 +1,48 @@
1#include "sendmailprogress.h"
2#include <qprogressbar.h>
3#include <qlabel.h>
4#include <qstring.h>
5
6progressMailSend::progressMailSend(QWidget*parent, const char * name)
7 :progressMailSendUI(parent,name,false),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0)
8{
9}
10
11progressMailSend::~progressMailSend()
12{
13}
14
15void progressMailSend::setMaxMails(unsigned int aMaxMails)
16{
17 m_max_mail = aMaxMails;
18 allMailProgressBar->setTotalSteps(aMaxMails);
19 setMails();
20}
21
22void progressMailSend::setCurrentMails(unsigned int aCurrent)
23{
24 m_current_mail = aCurrent;
25 allMailProgressBar->setProgress(aCurrent);
26 setMails();
27}
28
29void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax)
30{
31 m_current_single = aCurrent;
32 m_max_single = aMax;
33 setSingle();
34}
35
36void progressMailSend::setSingle()
37{
38 QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single);
39 singleMailLabel->setText(text);
40 singleMailProgressBar->setTotalSteps(m_max_single);
41 singleMailProgressBar->setProgress(m_current_single);
42}
43
44void progressMailSend::setMails()
45{
46 QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_single+1).arg(m_max_single);
47 allMailLabel->setText(text);
48}
diff --git a/noncore/net/mail/libmailwrapper/sendmailprogress.h b/noncore/net/mail/libmailwrapper/sendmailprogress.h
new file mode 100644
index 0000000..5b7d33b
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/sendmailprogress.h
@@ -0,0 +1,19 @@
1#include "sendmailprogressui.h"
2
3class progressMailSend:public progressMailSendUI
4{
5 Q_OBJECT
6public:
7 progressMailSend(QWidget*parent = 0, const char * name = 0);
8 ~progressMailSend();
9
10 void setMaxMails(unsigned int aMaxMails);
11 void setCurrentMails(unsigned int aCurrent);
12
13 void setSingleMail(unsigned int aCurrent,unsigned int aMax);
14
15protected:
16 unsigned m_current_mail,m_current_single,m_max_mail,m_max_single;
17 void setSingle();
18 void setMails();
19};
diff --git a/noncore/net/mail/libmailwrapper/sendmailprogressui.ui b/noncore/net/mail/libmailwrapper/sendmailprogressui.ui
new file mode 100644
index 0000000..b90b088
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/sendmailprogressui.ui
@@ -0,0 +1,110 @@
1<!DOCTYPE UI><UI>
2<class>progressMailSendUI</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>progressMailSendUI</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>316</width>
15 <height>266</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Sending mail</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>4</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>2</number>
36 </property>
37 <widget>
38 <class>QLabel</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>singleMailLabel</cstring>
42 </property>
43 <property stdset="1">
44 <name>text</name>
45 <string>Progress of mail</string>
46 </property>
47 <property stdset="1">
48 <name>alignment</name>
49 <set>AlignCenter</set>
50 </property>
51 <property>
52 <name>hAlign</name>
53 </property>
54 </widget>
55 <widget>
56 <class>QProgressBar</class>
57 <property stdset="1">
58 <name>name</name>
59 <cstring>singleMailProgressBar</cstring>
60 </property>
61 </widget>
62 <widget>
63 <class>QLabel</class>
64 <property stdset="1">
65 <name>name</name>
66 <cstring>allMailLabel</cstring>
67 </property>
68 <property stdset="1">
69 <name>text</name>
70 <string>Sending mail</string>
71 </property>
72 <property stdset="1">
73 <name>alignment</name>
74 <set>AlignCenter</set>
75 </property>
76 <property>
77 <name>hAlign</name>
78 </property>
79 </widget>
80 <widget>
81 <class>QProgressBar</class>
82 <property stdset="1">
83 <name>name</name>
84 <cstring>allMailProgressBar</cstring>
85 </property>
86 </widget>
87 <spacer>
88 <property>
89 <name>name</name>
90 <cstring>Spacer6</cstring>
91 </property>
92 <property stdset="1">
93 <name>orientation</name>
94 <enum>Vertical</enum>
95 </property>
96 <property stdset="1">
97 <name>sizeType</name>
98 <enum>Expanding</enum>
99 </property>
100 <property>
101 <name>sizeHint</name>
102 <size>
103 <width>20</width>
104 <height>20</height>
105 </size>
106 </property>
107 </spacer>
108 </vbox>
109</widget>
110</UI>
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index b81a87f..53c0af5 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -17,2 +17,5 @@
17#include "defines.h" 17#include "defines.h"
18#include "sendmailprogress.h"
19
20progressMailSend*SMTPwrapper::sendProgress = 0;
18 21
@@ -522,3 +525,6 @@ void SMTPwrapper::progress( size_t current, size_t maximum )
522{ 525{
523// qDebug( "Current: %i of %i", current, maximum ); 526 if (SMTPwrapper::sendProgress) {
527 SMTPwrapper::sendProgress->setSingleMail(current, maximum );
528 qDebug("%u of %u",current,maximum);
529 }
524} 530}
@@ -647,2 +653,6 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later )
647 } else { 653 } else {
654 sendProgress = new progressMailSend();
655 sendProgress->showMaximized();
656 sendProgress->show();
657 qApp->processEvents(10);
648 smtpSend( mimeMail,later,smtp); 658 smtpSend( mimeMail,later,smtp);
@@ -650,2 +660,5 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later )
650 qDebug("Clean up done"); 660 qDebug("Clean up done");
661 sendProgress->hide();
662 delete sendProgress;
663 sendProgress = 0;
651 } 664 }
@@ -675,2 +688,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
675 from = getFrom(ffrom); 688 from = getFrom(ffrom);
689
676 qDebug("Size: %i vs. %i",length,strlen(data)); 690 qDebug("Size: %i vs. %i",length,strlen(data));
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index c0dcc11..baa353b 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -20,2 +20,3 @@ struct mailmime;
20struct mailimf_address_list; 20struct mailimf_address_list;
21class progressMailSend;
21 22
@@ -31,2 +32,3 @@ public:
31 32
33 static progressMailSend*sendProgress;
32protected: 34protected:
@@ -54,3 +56,3 @@ protected:
54 static mailimf_field *getField( mailimf_fields *fields, int type ); 56 static mailimf_field *getField( mailimf_fields *fields, int type );
55 static int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp ); 57 int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp );
56 58