summaryrefslogtreecommitdiff
path: root/noncore/net
Unidiff
Diffstat (limited to 'noncore/net') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/opiemail.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index 2f87e44..b153292 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -2,89 +2,101 @@
2#include "settingsdialog.h" 2#include "settingsdialog.h"
3#include "opiemail.h" 3#include "opiemail.h"
4#include "editaccounts.h" 4#include "editaccounts.h"
5#include "composemail.h" 5#include "composemail.h"
6#include "mailistviewitem.h" 6#include "mailistviewitem.h"
7#include "viewmail.h" 7#include "viewmail.h"
8#include "selectstore.h" 8#include "selectstore.h"
9#include "selectsmtp.h" 9#include "selectsmtp.h"
10 10
11#include <libmailwrapper/smtpwrapper.h> 11#include <libmailwrapper/smtpwrapper.h>
12#include <libmailwrapper/mailtypes.h> 12#include <libmailwrapper/mailtypes.h>
13#include <libmailwrapper/abstractmail.h> 13#include <libmailwrapper/abstractmail.h>
14/* OPIE */ 14/* OPIE */
15#include <opie2/odebug.h> 15#include <opie2/odebug.h>
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
18 18
19/* QT */ 19/* QT */
20 20
21/* UNIX */ 21/* UNIX */
22#include <signal.h> 22#include <signal.h>
23 23
24using namespace Opie::Core; 24using namespace Opie::Core;
25 25
26OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) 26OpieMail::OpieMail( QWidget *parent, const char *name, WFlags )
27 : MainWindow( parent, name, WStyle_ContextHelp ) 27 : MainWindow( parent, name, WStyle_ContextHelp )
28{ 28{
29 setup_signalblocking(); 29 setup_signalblocking();
30 settings = new Settings(); 30 settings = new Settings();
31 31
32 folderView->populate( settings->getAccounts() ); 32 folderView->populate( settings->getAccounts() );
33} 33}
34 34
35OpieMail::~OpieMail() 35OpieMail::~OpieMail()
36{ 36{
37 if (settings) delete settings; 37 if (settings) delete settings;
38} 38}
39 39
40void OpieMail::setup_signalblocking() 40void OpieMail::setup_signalblocking()
41{ 41{
42 /* for networking we must block SIGPIPE and Co. */ 42 /* for networking we must block SIGPIPE and Co. */
43 struct sigaction blocking_action,temp_action; 43 struct sigaction blocking_action,temp_action;
44 blocking_action.sa_handler = SIG_IGN; 44 blocking_action.sa_handler = SIG_IGN;
45 sigemptyset(&(blocking_action.sa_mask)); 45 sigemptyset(&(blocking_action.sa_mask));
46 blocking_action.sa_flags = 0; 46 blocking_action.sa_flags = 0;
47 sigaction(SIGPIPE,&blocking_action,&temp_action); 47 sigaction(SIGPIPE,&blocking_action,&temp_action);
48} 48}
49 49
50void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 50void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
51{ 51{
52 // copied from old mail2 52 // copied from old mail2
53 if (msg == "writeMail(QString,QString)") 53 if (msg == "writeMail(QString,QString)")
54 { 54 {
55 QDataStream stream(data,IO_ReadOnly); 55 QDataStream stream(data,IO_ReadOnly);
56 QString name, email; 56 QString name, email;
57 stream >> name >> email; 57 stream >> name >> email;
58 // removing the whitespaces at beginning and end is needed! 58 // removing the whitespaces at beginning and end is needed!
59 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); 59 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
60 } 60 }
61 else if (msg == "newMail()") 61 else if (msg == "newMail()")
62 { 62 {
63 slotComposeMail(); 63 slotComposeMail();
64 } 64 }
65} 65}
66 66
67/**
68 * Konqueror calls us with the mailto:name@address
69 */
70void OpieMail::setDocument(const QString& mail)
71{
72 /*
73 * It looks like a mailto address, lets try it
74 */
75 if( mail.startsWith(QString::fromLatin1("mailto:")) )
76 slotwriteMail(QString::null, mail.mid(7));
77}
78
67void OpieMail::slotwriteMail(const QString&name,const QString&email) 79void OpieMail::slotwriteMail(const QString&name,const QString&email)
68{ 80{
69 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 81 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
70 if (!email.isEmpty()) 82 if (!email.isEmpty())
71 { 83 {
72 if (!name.isEmpty()) 84 if (!name.isEmpty())
73 { 85 {
74 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 86 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
75 } 87 }
76 else 88 else
77 { 89 {
78 compose.setTo(email); 90 compose.setTo(email);
79 } 91 }
80 } 92 }
81 compose.slotAdjustColumns(); 93 compose.slotAdjustColumns();
82 QPEApplication::execDialog( &compose ); 94 QPEApplication::execDialog( &compose );
83} 95}
84 96
85void OpieMail::slotComposeMail() 97void OpieMail::slotComposeMail()
86{ 98{
87 odebug << "Compose Mail" << oendl; 99 odebug << "Compose Mail" << oendl;
88 slotwriteMail(0l,0l); 100 slotwriteMail(0l,0l);
89} 101}
90 102