-rw-r--r-- | kmicromail/composemail.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index f7604ad..14feeee 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -108,193 +108,193 @@ ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool m | |||
108 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 108 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
109 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 109 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
110 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 110 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
111 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 111 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
112 | mMail = 0; | 112 | mMail = 0; |
113 | warnAttach = true; | 113 | warnAttach = true; |
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | void ComposeMail::saveAsDraft() | 119 | void ComposeMail::saveAsDraft() |
120 | { | 120 | { |
121 | 121 | ||
122 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 122 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
123 | mail->setMail(fromBox->currentText()); | 123 | mail->setMail(fromBox->currentText()); |
124 | mail->setTo( toLine->text() ); | 124 | mail->setTo( toLine->text() ); |
125 | mail->setName(senderNameEdit->text()); | 125 | mail->setName(senderNameEdit->text()); |
126 | mail->setCC( ccLine->text() ); | 126 | mail->setCC( ccLine->text() ); |
127 | mail->setBCC( bccLine->text() ); | 127 | mail->setBCC( bccLine->text() ); |
128 | mail->setReply( replyLine->text() ); | 128 | mail->setReply( replyLine->text() ); |
129 | mail->setSubject( subjectLine->text() ); | 129 | mail->setSubject( subjectLine->text() ); |
130 | if (!m_replyid.isEmpty()) { | 130 | if (!m_replyid.isEmpty()) { |
131 | QStringList ids; | 131 | QStringList ids; |
132 | ids.append(m_replyid); | 132 | ids.append(m_replyid); |
133 | mail->setInreply(ids); | 133 | mail->setInreply(ids); |
134 | } | 134 | } |
135 | QString txt = message->text(); | 135 | QString txt = message->text(); |
136 | if ( !sigMultiLine->text().isEmpty() ) { | 136 | if ( !sigMultiLine->text().isEmpty() ) { |
137 | txt.append( "\n--\n" ); | 137 | txt.append( "\n--\n" ); |
138 | txt.append( sigMultiLine->text() ); | 138 | txt.append( sigMultiLine->text() ); |
139 | } | 139 | } |
140 | mail->setMessage( txt ); | 140 | mail->setMessage( txt ); |
141 | 141 | ||
142 | /* only use the default drafts folder name! */ | 142 | /* only use the default drafts folder name! */ |
143 | Storemail wrapper(AbstractMail::draftFolder()); | 143 | Storemail wrapper(AbstractMail::draftFolder()); |
144 | wrapper.storeMail(mail); | 144 | wrapper.storeMail(mail); |
145 | 145 | ||
146 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 146 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
147 | /* attachments we will ignore! */ | 147 | /* attachments we will ignore! */ |
148 | if ( it != 0 ) { | 148 | if ( it != 0 ) { |
149 | if ( warnAttach ) | 149 | if ( warnAttach ) |
150 | QMessageBox::warning(0,tr("Store message"), | 150 | QMessageBox::warning(0,tr("Store message"), |
151 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 151 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
152 | warnAttach = false; | 152 | warnAttach = false; |
153 | } | 153 | } |
154 | setStatus( tr("Mail saved as draft!") ); | 154 | setStatus( tr("Mail saved as draft!") ); |
155 | } | 155 | } |
156 | void ComposeMail::clearStatus() | 156 | void ComposeMail::clearStatus() |
157 | { | 157 | { |
158 | topLevelWidget()->setCaption( tr("Compose mail") ); | 158 | topLevelWidget()->setCaption( tr("Compose mail") ); |
159 | } | 159 | } |
160 | void ComposeMail::setStatus( QString status ) | 160 | void ComposeMail::setStatus( QString status ) |
161 | { | 161 | { |
162 | topLevelWidget()->setCaption( status ); | 162 | topLevelWidget()->setCaption( status ); |
163 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 163 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
164 | } | 164 | } |
165 | void ComposeMail::pickAddress( ) | 165 | void ComposeMail::pickAddress( ) |
166 | { | 166 | { |
167 | 167 | ||
168 | QLineEdit *line = mPickLineEdit; | 168 | QLineEdit *line = mPickLineEdit; |
169 | if ( line == 0 ) | 169 | if ( line == 0 ) |
170 | return; | 170 | return; |
171 | #ifdef DESKTOP_VERSION | 171 | #ifdef DESKTOP_VERSION |
172 | //qDebug(" ComposeMail::pickAddress "); | 172 | //qDebug(" ComposeMail::pickAddress "); |
173 | QString names ;//= AddressPicker::getNames(); | 173 | QString names ;//= AddressPicker::getNames(); |
174 | 174 | ||
175 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 175 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
176 | uint i=0; | 176 | uint i=0; |
177 | for (i=0; i < list.count(); i++) { | 177 | for (i=0; i < list.count(); i++) { |
178 | if ( !list[i].preferredEmail().isEmpty()) { | 178 | if ( !list[i].preferredEmail().isEmpty()) { |
179 | if ( ! names.isEmpty() ) | 179 | if ( ! names.isEmpty() ) |
180 | names+= ","; | 180 | names+= ","; |
181 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 181 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
182 | 182 | ||
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | if ( line->text().isEmpty() ) { | 187 | if ( line->text().isEmpty() ) { |
188 | line->setText( names ); | 188 | line->setText( names ); |
189 | } else if ( !names.isEmpty() ) { | 189 | } else if ( !names.isEmpty() ) { |
190 | line->setText( line->text() + ", " + names ); | 190 | line->setText( line->text() + ", " + names ); |
191 | } | 191 | } |
192 | #else | 192 | #else |
193 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); | 193 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); |
194 | // the result should now arrive through method insertAttendees | 194 | // the result should now arrive through method insertAttendees |
195 | #endif | 195 | #endif |
196 | } | 196 | } |
197 | //the map includes name/email pairs, that comes from Ka/Pi | 197 | //the map includes name/email pairs, that comes from Ka/Pi |
198 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 198 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
199 | { | 199 | { |
200 | qDebug("ComposeMail::insertAttendees "); | 200 | qDebug("ComposeMail::insertAttendees "); |
201 | raise(); | 201 | raise(); |
202 | 202 | ||
203 | if ( mPickLineEdit == 0 ) { //whoami received | 203 | if ( mPickLineEdit == 0 ) { //whoami received |
204 | 204 | qDebug("returnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn "); | |
205 | QString defmail = uidList[0]; | 205 | QString defmail = uidList[0]; |
206 | if ( emailList.count() == 0 ) | 206 | if ( emailList.count() == 0 ) |
207 | QMessageBox::information( 0, tr( "Hint" ), | 207 | QMessageBox::information( 0, tr( "Hint" ), |
208 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 208 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
209 | tr( "Ok" ) ); | 209 | tr( "Ok" ) ); |
210 | if (defmail.length()!=0) { | 210 | if (defmail.length()!=0) { |
211 | fromBox->insertItem(defmail); | 211 | fromBox->insertItem(defmail); |
212 | } | 212 | } |
213 | QStringList::ConstIterator sit = emailList.begin(); | 213 | QStringList::ConstIterator sit = emailList.begin(); |
214 | int pref = 0; | 214 | int pref = 0; |
215 | for (;sit!=emailList.end();++sit) { | 215 | for (;sit!=emailList.end();++sit) { |
216 | if ( (*sit)==defmail) | 216 | if ( (*sit)==defmail) |
217 | continue; | 217 | continue; |
218 | fromBox->insertItem((*sit)); | 218 | fromBox->insertItem((*sit)); |
219 | } | 219 | } |
220 | senderNameEdit->setText(nameList[0]); | 220 | senderNameEdit->setText(nameList[0]); |
221 | return; | 221 | return; |
222 | } | 222 | } |
223 | QString names ; | 223 | QString names ; |
224 | QLineEdit *line = mPickLineEdit; | 224 | QLineEdit *line = mPickLineEdit; |
225 | if (uid == this->name()) | 225 | if (uid == this->name()) |
226 | { | 226 | { |
227 | for ( int i = 0; i < nameList.count(); i++) | 227 | for ( int i = 0; i < nameList.count(); i++) |
228 | { | 228 | { |
229 | QString _name = nameList[i]; | 229 | QString _name = nameList[i]; |
230 | QString _email = emailList[i]; | 230 | QString _email = emailList[i]; |
231 | QString _uid = uidList[i]; | 231 | QString _uid = uidList[i]; |
232 | if ( ! _email.isEmpty() ) { | 232 | if ( ! _email.isEmpty() ) { |
233 | if ( ! names.isEmpty() ) | 233 | if ( ! names.isEmpty() ) |
234 | names+= ","; | 234 | names+= ","; |
235 | names+= "\""+_name +"\"<" +_email +">"; | 235 | names+= "\""+_name +"\"<" +_email +">"; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | } | 238 | } |
239 | if ( line->text().isEmpty() ) { | 239 | if ( line->text().isEmpty() ) { |
240 | line->setText( names ); | 240 | line->setText( names ); |
241 | } else if ( !names.isEmpty() ) { | 241 | } else if ( !names.isEmpty() ) { |
242 | line->setText( line->text() + ", " + names ); | 242 | line->setText( line->text() + ", " + names ); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | void ComposeMail::setTo( const QString & to ) | 246 | void ComposeMail::setTo( const QString & to ) |
247 | { | 247 | { |
248 | toLine->setText( to ); | 248 | toLine->setText( to ); |
249 | } | 249 | } |
250 | 250 | ||
251 | void ComposeMail::setSubject( const QString & subject ) | 251 | void ComposeMail::setSubject( const QString & subject ) |
252 | { | 252 | { |
253 | subjectLine->setText( subject ); | 253 | subjectLine->setText( subject ); |
254 | } | 254 | } |
255 | 255 | ||
256 | void ComposeMail::setInReplyTo( const QString & messageId ) | 256 | void ComposeMail::setInReplyTo( const QString & messageId ) |
257 | { | 257 | { |
258 | m_replyid = messageId; | 258 | m_replyid = messageId; |
259 | } | 259 | } |
260 | 260 | ||
261 | void ComposeMail::setMessage( const QString & text ) | 261 | void ComposeMail::setMessage( const QString & text ) |
262 | { | 262 | { |
263 | message->setText( text ); | 263 | message->setText( text ); |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | void ComposeMail::pickAddressTo() | 267 | void ComposeMail::pickAddressTo() |
268 | { | 268 | { |
269 | mPickLineEdit = toLine; | 269 | mPickLineEdit = toLine; |
270 | pickAddress( ); | 270 | pickAddress( ); |
271 | } | 271 | } |
272 | 272 | ||
273 | void ComposeMail::pickAddressCC() | 273 | void ComposeMail::pickAddressCC() |
274 | { | 274 | { |
275 | mPickLineEdit = ccLine; | 275 | mPickLineEdit = ccLine; |
276 | pickAddress( ); | 276 | pickAddress( ); |
277 | } | 277 | } |
278 | 278 | ||
279 | void ComposeMail::pickAddressBCC() | 279 | void ComposeMail::pickAddressBCC() |
280 | { | 280 | { |
281 | mPickLineEdit = bccLine; | 281 | mPickLineEdit = bccLine; |
282 | pickAddress( ); | 282 | pickAddress( ); |
283 | } | 283 | } |
284 | 284 | ||
285 | void ComposeMail::pickAddressReply() | 285 | void ComposeMail::pickAddressReply() |
286 | { | 286 | { |
287 | mPickLineEdit = replyLine; | 287 | mPickLineEdit = replyLine; |
288 | pickAddress( ); | 288 | pickAddress( ); |
289 | } | 289 | } |
290 | 290 | ||
291 | void ComposeMail::fillValues( int ) | 291 | void ComposeMail::fillValues( int ) |
292 | { | 292 | { |
293 | #if 0 | 293 | #if 0 |
294 | SMTPaccount *smtp = smtpAccounts.at( current ); | 294 | SMTPaccount *smtp = smtpAccounts.at( current ); |
295 | ccLine->clear(); | 295 | ccLine->clear(); |
296 | if ( smtp->getUseCC() ) { | 296 | if ( smtp->getUseCC() ) { |
297 | ccLine->setText( smtp->getCC() ); | 297 | ccLine->setText( smtp->getCC() ); |
298 | } | 298 | } |
299 | bccLine->clear(); | 299 | bccLine->clear(); |
300 | if ( smtp->getUseBCC() ) { | 300 | if ( smtp->getUseBCC() ) { |