-rw-r--r-- | kmicromail/opiemail.cpp | 1 |
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 | |||
@@ -59,96 +59,97 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) | |||
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 | } |
84 | void OpieMail::slotwriteMail2(const QString& namemail ) | 84 | void 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 | } |
109 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 110 | void 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 | ||
129 | void OpieMail::slotComposeMail() | 130 | void OpieMail::slotComposeMail() |
130 | { | 131 | { |
131 | slotwriteMail2( QString () ); | 132 | slotwriteMail2( QString () ); |
132 | //slotwriteMail(0l,0l); | 133 | //slotwriteMail(0l,0l); |
133 | } | 134 | } |
134 | 135 | ||
135 | void OpieMail::slotSendQueued() | 136 | void 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; |