summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
authorzautrix <zautrix>2004-09-07 22:51:29 (UTC)
committer zautrix <zautrix>2004-09-07 22:51:29 (UTC)
commit2676646d4744ccceab1063dc02d772a26a203c61 (patch) (unidiff)
tree0a0d5261b9a804a29b61a38f68339979051282e2 /kmicromail/opiemail.cpp
parent64a8ef1629f523df3006de5cb2b9882a50d96a05 (diff)
downloadkdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.zip
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.gz
kdepimpi-2676646d4744ccceab1063dc02d772a26a203c61.tar.bz2
Implemented Ompi - kapi connection
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 251f15a..3e560c5 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -43,128 +43,129 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
43 43
44} 44}
45#include <stdlib.h> 45#include <stdlib.h>
46void OpieMail::message(const QCString &msg, const QByteArray &data) 46void OpieMail::message(const QCString &msg, const QByteArray &data)
47{ 47{
48 // copied from old mail2 48 // copied from old mail2
49 static int ii = 0; 49 static int ii = 0;
50 50
51 // block second call 51 // block second call
52 if ( ii < 2 ) { 52 if ( ii < 2 ) {
53 ++ii; 53 ++ii;
54 if ( ii > 1 ) { 54 if ( ii > 1 ) {
55 qDebug("qcop call blocked "); 55 qDebug("qcop call blocked ");
56 return; 56 return;
57 } 57 }
58 } 58 }
59 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 59 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
60 if (msg == "writeMail(QString,QString)") 60 if (msg == "writeMail(QString,QString)")
61 { 61 {
62 QDataStream stream(data,IO_ReadOnly); 62 QDataStream stream(data,IO_ReadOnly);
63 QString name, email; 63 QString name, email;
64 stream >> name >> email; 64 stream >> name >> email;
65 // removing the whitespaces at beginning and end is needed! 65 // removing the whitespaces at beginning and end is needed!
66 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); 66 slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace());
67 } 67 }
68 else if (msg == "newMail()") 68 else if (msg == "newMail()")
69 { 69 {
70 slotComposeMail(); 70 slotComposeMail();
71 } 71 }
72 else if (msg == "newMail(QString)") 72 else if (msg == "newMail(QString)")
73 { 73 {
74 QDataStream stream(data,IO_ReadOnly); 74 QDataStream stream(data,IO_ReadOnly);
75 QString nameemail; 75 QString nameemail;
76 stream >> nameemail; 76 stream >> nameemail;
77 // the format is 77 // the format is
78 // NAME <EMAIL>:SUBJECT 78 // NAME <EMAIL>:SUBJECT
79 //qDebug("message %s ", nameemail.latin1()); 79 //qDebug("message %s ", nameemail.latin1());
80 80
81 slotwriteMail2( nameemail ); 81 slotwriteMail2( nameemail );
82 } 82 }
83} 83}
84void OpieMail::slotwriteMail2(const QString& namemail ) 84void OpieMail::slotwriteMail2(const QString& namemail )
85{ 85{
86 // qDebug("OpieMail::slotwriteMail2 "); 86 // qDebug("OpieMail::slotwriteMail2 ");
87 qApp->processEvents(); 87 qApp->processEvents();
88 ComposeMail compose( settings, this, 0, true ); 88 ComposeMail compose( settings, this, 0, true );
89 if ( !namemail.isEmpty() ) { 89 if ( !namemail.isEmpty() ) {
90 QString to = namemail; 90 QString to = namemail;
91 if ( namemail.find( " <") > 1 ) { 91 if ( namemail.find( " <") > 1 ) {
92 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 92 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
93 } else 93 } else
94 if ( namemail.find( "<") > 1 ) { 94 if ( namemail.find( "<") > 1 ) {
95 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 95 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
96 } 96 }
97 int sub = to.find( ">:"); 97 int sub = to.find( ">:");
98 if ( sub > 0 ) { 98 if ( sub > 0 ) {
99 compose.setTo( to.left(sub+1) ); 99 compose.setTo( to.left(sub+1) );
100 compose.setSubject( to.mid(sub+2) ); 100 compose.setSubject( to.mid(sub+2) );
101 } else 101 } else
102 compose.setTo( to ); 102 compose.setTo( to );
103 } 103 }
104 compose.slotAdjustColumns(); 104 compose.slotAdjustColumns();
105 compose.showMaximized(); 105 compose.showMaximized();
106 compose.exec(); 106 compose.exec();
107 raise();
107 //qDebug("retttich "); 108 //qDebug("retttich ");
108} 109}
109void OpieMail::slotwriteMail(const QString&name,const QString&email) 110void OpieMail::slotwriteMail(const QString&name,const QString&email)
110{ 111{
111 // qDebug("OpieMail::slotwriteMail "); 112 // qDebug("OpieMail::slotwriteMail ");
112 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); 113 ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp );
113 if (!email.isEmpty()) 114 if (!email.isEmpty())
114 { 115 {
115 if (!name.isEmpty()) 116 if (!name.isEmpty())
116 { 117 {
117 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 118 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
118 } 119 }
119 else 120 else
120 { 121 {
121 compose.setTo(email); 122 compose.setTo(email);
122 } 123 }
123 } 124 }
124 compose.slotAdjustColumns(); 125 compose.slotAdjustColumns();
125 compose.showMaximized(); 126 compose.showMaximized();
126 compose.exec(); 127 compose.exec();
127} 128}
128 129
129void OpieMail::slotComposeMail() 130void OpieMail::slotComposeMail()
130{ 131{
131 slotwriteMail2( QString () ); 132 slotwriteMail2( QString () );
132 //slotwriteMail(0l,0l); 133 //slotwriteMail(0l,0l);
133} 134}
134 135
135void OpieMail::slotSendQueued() 136void OpieMail::slotSendQueued()
136{ 137{
137 SMTPaccount *smtp = 0; 138 SMTPaccount *smtp = 0;
138 139
139 QList<Account> list = settings->getAccounts(); 140 QList<Account> list = settings->getAccounts();
140 QList<SMTPaccount> smtpList; 141 QList<SMTPaccount> smtpList;
141 smtpList.setAutoDelete(false); 142 smtpList.setAutoDelete(false);
142 Account *it; 143 Account *it;
143 for ( it = list.first(); it; it = list.next() ) 144 for ( it = list.first(); it; it = list.next() )
144 { 145 {
145 if ( it->getType() == MAILLIB::A_SMTP ) 146 if ( it->getType() == MAILLIB::A_SMTP )
146 { 147 {
147 smtp = static_cast<SMTPaccount *>(it); 148 smtp = static_cast<SMTPaccount *>(it);
148 smtpList.append(smtp); 149 smtpList.append(smtp);
149 } 150 }
150 } 151 }
151 if (smtpList.count()==0) 152 if (smtpList.count()==0)
152 { 153 {
153 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); 154 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n"));
154 return; 155 return;
155 } 156 }
156 if (smtpList.count()==1) 157 if (smtpList.count()==1)
157 { 158 {
158 smtp = smtpList.at(0); 159 smtp = smtpList.at(0);
159 } 160 }
160 else 161 else
161 { 162 {
162 smtp = 0; 163 smtp = 0;
163 selectsmtp selsmtp; 164 selectsmtp selsmtp;
164 selsmtp.setSelectionlist(&smtpList); 165 selsmtp.setSelectionlist(&smtpList);
165 selsmtp.showMaximized(); 166 selsmtp.showMaximized();
166 if ( selsmtp.exec() == QDialog::Accepted ) 167 if ( selsmtp.exec() == QDialog::Accepted )
167 { 168 {
168 smtp = selsmtp.selected_smtp(); 169 smtp = selsmtp.selected_smtp();
169 } 170 }
170 } 171 }