summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (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
-rw-r--r--noncore/net/mail/mail.pro9
-rw-r--r--noncore/net/mail/sendmailprogress.cpp48
-rw-r--r--noncore/net/mail/sendmailprogress.h19
-rw-r--r--noncore/net/mail/sendmailprogressui.ui110
-rw-r--r--noncore/net/mail/smtpwrapper.cpp16
-rw-r--r--noncore/net/mail/smtpwrapper.h4
11 files changed, 396 insertions, 7 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 @@
+#include "sendmailprogress.h"
+#include <qprogressbar.h>
+#include <qlabel.h>
+#include <qstring.h>
+
+progressMailSend::progressMailSend(QWidget*parent, const char * name)
+ :progressMailSendUI(parent,name,false),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0)
+{
+}
+
+progressMailSend::~progressMailSend()
+{
+}
+
+void progressMailSend::setMaxMails(unsigned int aMaxMails)
+{
+ m_max_mail = aMaxMails;
+ allMailProgressBar->setTotalSteps(aMaxMails);
+ setMails();
+}
+
+void progressMailSend::setCurrentMails(unsigned int aCurrent)
+{
+ m_current_mail = aCurrent;
+ allMailProgressBar->setProgress(aCurrent);
+ setMails();
+}
+
+void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax)
+{
+ m_current_single = aCurrent;
+ m_max_single = aMax;
+ setSingle();
+}
+
+void progressMailSend::setSingle()
+{
+ QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single);
+ singleMailLabel->setText(text);
+ singleMailProgressBar->setTotalSteps(m_max_single);
+ singleMailProgressBar->setProgress(m_current_single);
+}
+
+void progressMailSend::setMails()
+{
+ QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_single+1).arg(m_max_single);
+ allMailLabel->setText(text);
+}
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 @@
+#include "sendmailprogressui.h"
+
+class progressMailSend:public progressMailSendUI
+{
+ Q_OBJECT
+public:
+ progressMailSend(QWidget*parent = 0, const char * name = 0);
+ ~progressMailSend();
+
+ void setMaxMails(unsigned int aMaxMails);
+ void setCurrentMails(unsigned int aCurrent);
+
+ void setSingleMail(unsigned int aCurrent,unsigned int aMax);
+
+protected:
+ unsigned m_current_mail,m_current_single,m_max_mail,m_max_single;
+ void setSingle();
+ void setMails();
+};
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 @@
+<!DOCTYPE UI><UI>
+<class>progressMailSendUI</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>progressMailSendUI</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>316</width>
+ <height>266</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Sending mail</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>4</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>singleMailLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Progress of mail</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignCenter</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ </widget>
+ <widget>
+ <class>QProgressBar</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>singleMailProgressBar</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>allMailLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Sending mail</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignCenter</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ </widget>
+ <widget>
+ <class>QProgressBar</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>allMailProgressBar</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer6</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+</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 @@
#include "defines.h"
+#include "sendmailprogress.h"
+
+progressMailSend*SMTPwrapper::sendProgress = 0;
@@ -522,3 +525,6 @@ void SMTPwrapper::progress( size_t current, size_t maximum )
{
-// qDebug( "Current: %i of %i", current, maximum );
+ if (SMTPwrapper::sendProgress) {
+ SMTPwrapper::sendProgress->setSingleMail(current, maximum );
+ qDebug("%u of %u",current,maximum);
+ }
}
@@ -647,2 +653,6 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later )
} else {
+ sendProgress = new progressMailSend();
+ sendProgress->showMaximized();
+ sendProgress->show();
+ qApp->processEvents(10);
smtpSend( mimeMail,later,smtp);
@@ -650,2 +660,5 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later )
qDebug("Clean up done");
+ sendProgress->hide();
+ delete sendProgress;
+ sendProgress = 0;
}
@@ -675,2 +688,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
from = getFrom(ffrom);
+
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;
struct mailimf_address_list;
+class progressMailSend;
@@ -31,2 +32,3 @@ public:
+ static progressMailSend*sendProgress;
protected:
@@ -54,3 +56,3 @@ protected:
static mailimf_field *getField( mailimf_fields *fields, int type );
- static int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp );
+ int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp );
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro
index dd3c337..ea5fb58 100644
--- a/noncore/net/mail/mail.pro
+++ b/noncore/net/mail/mail.pro
@@ -22,3 +22,4 @@ HEADERS = defines.h \
genericwrapper.h \
- mboxwrapper.h
+ mboxwrapper.h \
+ sendmailprogress.h
@@ -44,3 +45,4 @@ SOURCES = main.cpp \
genericwrapper.cpp \
- mboxwrapper.cpp
+ mboxwrapper.cpp \
+ sendmailprogress.cpp
@@ -56,3 +58,4 @@ INTERFACES = editaccountsui.ui \
settingsdialogui.ui \
- statuswidgetui.ui
+ statuswidgetui.ui \
+ sendmailprogressui.ui
diff --git a/noncore/net/mail/sendmailprogress.cpp b/noncore/net/mail/sendmailprogress.cpp
new file mode 100644
index 0000000..13ddd37
--- a/dev/null
+++ b/noncore/net/mail/sendmailprogress.cpp
@@ -0,0 +1,48 @@
+#include "sendmailprogress.h"
+#include <qprogressbar.h>
+#include <qlabel.h>
+#include <qstring.h>
+
+progressMailSend::progressMailSend(QWidget*parent, const char * name)
+ :progressMailSendUI(parent,name,false),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0)
+{
+}
+
+progressMailSend::~progressMailSend()
+{
+}
+
+void progressMailSend::setMaxMails(unsigned int aMaxMails)
+{
+ m_max_mail = aMaxMails;
+ allMailProgressBar->setTotalSteps(aMaxMails);
+ setMails();
+}
+
+void progressMailSend::setCurrentMails(unsigned int aCurrent)
+{
+ m_current_mail = aCurrent;
+ allMailProgressBar->setProgress(aCurrent);
+ setMails();
+}
+
+void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax)
+{
+ m_current_single = aCurrent;
+ m_max_single = aMax;
+ setSingle();
+}
+
+void progressMailSend::setSingle()
+{
+ QString text = QString(tr("%1 of %2 bytes send")).arg(m_current_single).arg(m_max_single);
+ singleMailLabel->setText(text);
+ singleMailProgressBar->setTotalSteps(m_max_single);
+ singleMailProgressBar->setProgress(m_current_single);
+}
+
+void progressMailSend::setMails()
+{
+ QString text = QString(tr("Sending mail %1 of %2")).arg(m_current_single+1).arg(m_max_single);
+ allMailLabel->setText(text);
+}
diff --git a/noncore/net/mail/sendmailprogress.h b/noncore/net/mail/sendmailprogress.h
new file mode 100644
index 0000000..5b7d33b
--- a/dev/null
+++ b/noncore/net/mail/sendmailprogress.h
@@ -0,0 +1,19 @@
+#include "sendmailprogressui.h"
+
+class progressMailSend:public progressMailSendUI
+{
+ Q_OBJECT
+public:
+ progressMailSend(QWidget*parent = 0, const char * name = 0);
+ ~progressMailSend();
+
+ void setMaxMails(unsigned int aMaxMails);
+ void setCurrentMails(unsigned int aCurrent);
+
+ void setSingleMail(unsigned int aCurrent,unsigned int aMax);
+
+protected:
+ unsigned m_current_mail,m_current_single,m_max_mail,m_max_single;
+ void setSingle();
+ void setMails();
+};
diff --git a/noncore/net/mail/sendmailprogressui.ui b/noncore/net/mail/sendmailprogressui.ui
new file mode 100644
index 0000000..b90b088
--- a/dev/null
+++ b/noncore/net/mail/sendmailprogressui.ui
@@ -0,0 +1,110 @@
+<!DOCTYPE UI><UI>
+<class>progressMailSendUI</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>progressMailSendUI</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>316</width>
+ <height>266</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Sending mail</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>4</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>singleMailLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Progress of mail</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignCenter</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ </widget>
+ <widget>
+ <class>QProgressBar</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>singleMailProgressBar</cstring>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>allMailLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Sending mail</string>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignCenter</set>
+ </property>
+ <property>
+ <name>hAlign</name>
+ </property>
+ </widget>
+ <widget>
+ <class>QProgressBar</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>allMailProgressBar</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer6</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+</UI>
diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp
index b81a87f..53c0af5 100644
--- a/noncore/net/mail/smtpwrapper.cpp
+++ b/noncore/net/mail/smtpwrapper.cpp
@@ -17,2 +17,5 @@
#include "defines.h"
+#include "sendmailprogress.h"
+
+progressMailSend*SMTPwrapper::sendProgress = 0;
@@ -522,3 +525,6 @@ void SMTPwrapper::progress( size_t current, size_t maximum )
{
-// qDebug( "Current: %i of %i", current, maximum );
+ if (SMTPwrapper::sendProgress) {
+ SMTPwrapper::sendProgress->setSingleMail(current, maximum );
+ qDebug("%u of %u",current,maximum);
+ }
}
@@ -647,2 +653,6 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later )
} else {
+ sendProgress = new progressMailSend();
+ sendProgress->showMaximized();
+ sendProgress->show();
+ qApp->processEvents(10);
smtpSend( mimeMail,later,smtp);
@@ -650,2 +660,5 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later )
qDebug("Clean up done");
+ sendProgress->hide();
+ delete sendProgress;
+ sendProgress = 0;
}
@@ -675,2 +688,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which)
from = getFrom(ffrom);
+
qDebug("Size: %i vs. %i",length,strlen(data));
diff --git a/noncore/net/mail/smtpwrapper.h b/noncore/net/mail/smtpwrapper.h
index c0dcc11..baa353b 100644
--- a/noncore/net/mail/smtpwrapper.h
+++ b/noncore/net/mail/smtpwrapper.h
@@ -20,2 +20,3 @@ struct mailmime;
struct mailimf_address_list;
+class progressMailSend;
@@ -31,2 +32,3 @@ public:
+ static progressMailSend*sendProgress;
protected:
@@ -54,3 +56,3 @@ protected:
static mailimf_field *getField( mailimf_fields *fields, int type );
- static int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp );
+ int smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccount *smtp );