-rw-r--r-- | kmicromail/composemail.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index ed8a2ee..3231b45 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,155 +1,156 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | 3 | ||
4 | #ifdef DESKTOP_VERSION | 4 | #ifdef DESKTOP_VERSION |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <kabc/addresseedialog.h> | 6 | #include <kabc/addresseedialog.h> |
7 | #include <kabc/stdaddressbook.h> | 7 | #include <kabc/stdaddressbook.h> |
8 | #include <kabc/addressee.h> | 8 | #include <kabc/addressee.h> |
9 | #else | 9 | #else |
10 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
11 | #endif //DESKTOP_VERSION | 11 | #endif //DESKTOP_VERSION |
12 | #include <libkdepim/externalapphandler.h> | 12 | #include <libkdepim/externalapphandler.h> |
13 | 13 | ||
14 | #include "koprefs.h" | 14 | #include "koprefs.h" |
15 | #include <klocale.h> | 15 | #include <klocale.h> |
16 | #include <kglobal.h> | 16 | #include <kglobal.h> |
17 | 17 | ||
18 | #ifdef MINIKDE_KDIALOG_H | 18 | #ifdef MINIKDE_KDIALOG_H |
19 | #undef MINIKDE_KDIALOG_H | 19 | #undef MINIKDE_KDIALOG_H |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | 22 | ||
23 | #include "composemail.h" | 23 | #include "composemail.h" |
24 | 24 | ||
25 | #include <libmailwrapper/smtpwrapper.h> | 25 | #include <libmailwrapper/smtpwrapper.h> |
26 | #include <libmailwrapper/storemail.h> | 26 | #include <libmailwrapper/storemail.h> |
27 | #include <libmailwrapper/abstractmail.h> | 27 | #include <libmailwrapper/abstractmail.h> |
28 | #include <libmailwrapper/mailtypes.h> | 28 | #include <libmailwrapper/mailtypes.h> |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | //#include <opie2/ofiledialog.h> | 31 | //#include <opie2/ofiledialog.h> |
32 | //#include <opie2/odebug.h> | 32 | //#include <opie2/odebug.h> |
33 | #include <kfiledialog.h> | 33 | #include <kfiledialog.h> |
34 | //#include <qpe/resource.h> | 34 | //#include <qpe/resource.h> |
35 | #include <qpe/global.h> | 35 | #include <qpe/global.h> |
36 | //#include <qpe/contact.h> | 36 | //#include <qpe/contact.h> |
37 | 37 | ||
38 | 38 | ||
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
41 | #include <qiconset.h> | 41 | #include <qiconset.h> |
42 | #include <qtimer.h> | 42 | #include <qtimer.h> |
43 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qmultilineedit.h> | 45 | #include <qmultilineedit.h> |
46 | #include <qlabel.h> | 46 | #include <qlabel.h> |
47 | #include <qtabwidget.h> | 47 | #include <qtabwidget.h> |
48 | #include <qlistview.h> | 48 | #include <qlistview.h> |
49 | 49 | ||
50 | //using namespace Opie::Core; | 50 | //using namespace Opie::Core; |
51 | //using namespace Opie::Ui; | 51 | //using namespace Opie::Ui; |
52 | ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) | 52 | ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) |
53 | : ComposeMailUI( parent, name, modal ) | 53 | : ComposeMailUI( parent, name, modal ) |
54 | { | 54 | { |
55 | 55 | ||
56 | mPickLineEdit = 0; | 56 | mPickLineEdit = 0; |
57 | mEncoding = KOPrefs::instance()->mCurrentCodeName; | 57 | mEncoding = KOPrefs::instance()->mCurrentCodeName; |
58 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 58 | //managed from opiemail now |
59 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 59 | //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
60 | // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | ||
60 | settings = sett; | 61 | settings = sett; |
61 | m_replyid = ""; | 62 | m_replyid = ""; |
62 | if ( KOPrefs::instance()->mUseKapi) { | 63 | if ( KOPrefs::instance()->mUseKapi) { |
63 | KConfig config( locateLocal("config", "kabcrc") ); | 64 | KConfig config( locateLocal("config", "kabcrc") ); |
64 | config.setGroup( "General" ); | 65 | config.setGroup( "General" ); |
65 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 66 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
66 | 67 | ||
67 | if ( whoami_uid.isEmpty() ) { | 68 | if ( whoami_uid.isEmpty() ) { |
68 | QMessageBox::information( 0, i18n( "Hint" ), | 69 | QMessageBox::information( 0, i18n( "Hint" ), |
69 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 70 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
70 | i18n( "Ok" ) ); | 71 | i18n( "Ok" ) ); |
71 | 72 | ||
72 | 73 | ||
73 | fillSettings(); | 74 | fillSettings(); |
74 | } else | 75 | } else |
75 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 76 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); |
76 | 77 | ||
77 | 78 | ||
78 | #ifdef DESKTOP_VERSION | 79 | #ifdef DESKTOP_VERSION |
79 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 80 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
80 | QStringList mails = con.emails(); | 81 | QStringList mails = con.emails(); |
81 | QString defmail = con.preferredEmail(); | 82 | QString defmail = con.preferredEmail(); |
82 | if ( mails.count() == 0) | 83 | if ( mails.count() == 0) |
83 | QMessageBox::information( 0, i18n( "Hint" ), | 84 | QMessageBox::information( 0, i18n( "Hint" ), |
84 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 85 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
85 | i18n( "Ok" ) ); | 86 | i18n( "Ok" ) ); |
86 | if (defmail.length()!=0) { | 87 | if (defmail.length()!=0) { |
87 | fromBox->insertItem(defmail); | 88 | fromBox->insertItem(defmail); |
88 | } | 89 | } |
89 | QStringList::ConstIterator sit = mails.begin(); | 90 | QStringList::ConstIterator sit = mails.begin(); |
90 | for (;sit!=mails.end();++sit) { | 91 | for (;sit!=mails.end();++sit) { |
91 | if ( (*sit)==defmail) | 92 | if ( (*sit)==defmail) |
92 | continue; | 93 | continue; |
93 | fromBox->insertItem((*sit)); | 94 | fromBox->insertItem((*sit)); |
94 | } | 95 | } |
95 | senderNameEdit->setText(con.formattedName()); | 96 | senderNameEdit->setText(con.formattedName()); |
96 | #endif | 97 | #endif |
97 | 98 | ||
98 | } else { | 99 | } else { |
99 | fillSettings(); | 100 | fillSettings(); |
100 | } | 101 | } |
101 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); | 102 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); |
102 | 103 | ||
103 | attList->addColumn( i18n( "Name" ) ); | 104 | attList->addColumn( i18n( "Name" ) ); |
104 | attList->addColumn( i18n( "Size" ) ); | 105 | attList->addColumn( i18n( "Size" ) ); |
105 | QList<Account> accounts = settings->getAccounts(); | 106 | QList<Account> accounts = settings->getAccounts(); |
106 | 107 | ||
107 | if ( QApplication::desktop()->width() < 320 ) | 108 | if ( QApplication::desktop()->width() < 320 ) |
108 | smtpAccountBox->setMaximumWidth( 80 ); | 109 | smtpAccountBox->setMaximumWidth( 80 ); |
109 | Account *it; | 110 | Account *it; |
110 | for ( it = accounts.first(); it; it = accounts.next() ) { | 111 | for ( it = accounts.first(); it; it = accounts.next() ) { |
111 | if ( it->getType()==MAILLIB::A_SMTP ) { | 112 | if ( it->getType()==MAILLIB::A_SMTP ) { |
112 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 113 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
113 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 114 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
114 | smtpAccounts.append( smtp ); | 115 | smtpAccounts.append( smtp ); |
115 | } | 116 | } |
116 | } | 117 | } |
117 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 118 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
118 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 119 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
119 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 120 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
120 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 121 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
121 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 122 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
122 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 123 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
123 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 124 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
124 | mMail = 0; | 125 | mMail = 0; |
125 | warnAttach = true; | 126 | warnAttach = true; |
126 | QIconSet icon; | 127 | QIconSet icon; |
127 | //icon = SmallIcon("fileexport"); | 128 | //icon = SmallIcon("fileexport"); |
128 | icon = SmallIcon("filesave"); | 129 | icon = SmallIcon("filesave"); |
129 | SaveButton->setIconSet (icon ) ; | 130 | SaveButton->setIconSet (icon ) ; |
130 | if ( QApplication::desktop()->width() < 320 ) { | 131 | if ( QApplication::desktop()->width() < 320 ) { |
131 | SaveButton->setText ("") ; | 132 | SaveButton->setText ("") ; |
132 | SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; | 133 | SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; |
133 | } | 134 | } |
134 | else | 135 | else |
135 | SaveButton->setText (i18n("Save")); | 136 | SaveButton->setText (i18n("Save")); |
136 | #ifndef DESKTOP_VERSION | 137 | #ifndef DESKTOP_VERSION |
137 | QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); | 138 | QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); |
138 | QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); | 139 | QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); |
139 | QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); | 140 | QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); |
140 | #endif | 141 | #endif |
141 | message->setFont ( KOPrefs::instance()->mComposeFont ); | 142 | message->setFont ( KOPrefs::instance()->mComposeFont ); |
142 | message->setWordWrap (QMultiLineEdit::WidgetWidth); | 143 | message->setWordWrap (QMultiLineEdit::WidgetWidth); |
143 | if ( smtpAccounts.count() > 0 ) { | 144 | if ( smtpAccounts.count() > 0 ) { |
144 | fillValues( smtpAccountBox->currentItem() ); | 145 | fillValues( smtpAccountBox->currentItem() ); |
145 | } else { | 146 | } else { |
146 | QMessageBox::information( 0, i18n( "Problem" ), | 147 | QMessageBox::information( 0, i18n( "Problem" ), |
147 | i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), | 148 | i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), |
148 | i18n( "Ok" ) ); | 149 | i18n( "Ok" ) ); |
149 | return; | 150 | return; |
150 | } | 151 | } |
151 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 152 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
152 | connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); | 153 | connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); |
153 | if ( smtpAccountBox->count()) | 154 | if ( smtpAccountBox->count()) |
154 | fillValues(0); | 155 | fillValues(0); |
155 | 156 | ||
@@ -167,214 +168,221 @@ void ComposeMail::fillSettings() | |||
167 | } | 168 | } |
168 | senderNameEdit->setText(KOPrefs::instance()->mName); | 169 | senderNameEdit->setText(KOPrefs::instance()->mName); |
169 | } | 170 | } |
170 | void ComposeMail::saveSig() | 171 | void ComposeMail::saveSig() |
171 | { | 172 | { |
172 | if ( smtpAccountBox->count()) { | 173 | if ( smtpAccountBox->count()) { |
173 | int cur = smtpAccountBox->currentItem (); | 174 | int cur = smtpAccountBox->currentItem (); |
174 | SMTPaccount *smtp = smtpAccounts.at( cur ); | 175 | SMTPaccount *smtp = smtpAccounts.at( cur ); |
175 | if ( smtp ) | 176 | if ( smtp ) |
176 | smtp->setSignature( sigMultiLine->text()); | 177 | smtp->setSignature( sigMultiLine->text()); |
177 | } | 178 | } |
178 | } | 179 | } |
179 | void ComposeMail::saveAsDraft() | 180 | void ComposeMail::saveAsDraft() |
180 | { | 181 | { |
181 | 182 | ||
182 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 183 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
183 | mail->setMail(fromBox->currentText()); | 184 | mail->setMail(fromBox->currentText()); |
184 | mail->setTo( toLine->text() ); | 185 | mail->setTo( toLine->text() ); |
185 | mail->setName(senderNameEdit->text()); | 186 | mail->setName(senderNameEdit->text()); |
186 | mail->setCC( ccLine->text() ); | 187 | mail->setCC( ccLine->text() ); |
187 | mail->setBCC( bccLine->text() ); | 188 | mail->setBCC( bccLine->text() ); |
188 | mail->setReply( replyLine->text() ); | 189 | mail->setReply( replyLine->text() ); |
189 | mail->setSubject( subjectLine->text() ); | 190 | mail->setSubject( subjectLine->text() ); |
190 | if (!m_replyid.isEmpty()) { | 191 | if (!m_replyid.isEmpty()) { |
191 | QStringList ids; | 192 | QStringList ids; |
192 | ids.append(m_replyid); | 193 | ids.append(m_replyid); |
193 | mail->setInreply(ids); | 194 | mail->setInreply(ids); |
194 | } | 195 | } |
195 | QString txt = message->text(); | 196 | QString txt = message->text(); |
196 | if ( !sigMultiLine->text().isEmpty() ) { | 197 | if ( !sigMultiLine->text().isEmpty() ) { |
197 | txt.append( "\n--\n" ); | 198 | txt.append( "\n--\n" ); |
198 | txt.append( sigMultiLine->text() ); | 199 | txt.append( sigMultiLine->text() ); |
199 | } | 200 | } |
200 | mail->setMessage( txt ); | 201 | mail->setMessage( txt ); |
201 | mail->setCharset (mEncoding); | 202 | mail->setCharset (mEncoding); |
202 | /* only use the default drafts folder name! */ | 203 | /* only use the default drafts folder name! */ |
203 | Storemail wrapper(AbstractMail::draftFolder()); | 204 | Storemail wrapper(AbstractMail::draftFolder()); |
204 | wrapper.storeMail(mail); | 205 | wrapper.storeMail(mail); |
205 | 206 | ||
206 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 207 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
207 | /* attachments we will ignore! */ | 208 | /* attachments we will ignore! */ |
208 | if ( it != 0 ) { | 209 | if ( it != 0 ) { |
209 | if ( warnAttach ) | 210 | if ( warnAttach ) |
210 | QMessageBox::warning(0,i18n("Store message"), | 211 | QMessageBox::warning(0,i18n("Store message"), |
211 | i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 212 | i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
212 | warnAttach = false; | 213 | warnAttach = false; |
213 | } | 214 | } |
214 | setStatus( i18n("Mail saved as draft!") ); | 215 | setStatus( i18n("Mail saved as draft!") ); |
215 | } | 216 | } |
216 | void ComposeMail::clearStatus() | 217 | void ComposeMail::clearStatus() |
217 | { | 218 | { |
218 | topLevelWidget()->setCaption( i18n("Compose mail") ); | 219 | topLevelWidget()->setCaption( i18n("Compose mail") ); |
219 | } | 220 | } |
220 | void ComposeMail::setStatus( QString status ) | 221 | void ComposeMail::setStatus( QString status ) |
221 | { | 222 | { |
222 | topLevelWidget()->setCaption( status ); | 223 | topLevelWidget()->setCaption( status ); |
223 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 224 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
224 | } | 225 | } |
225 | void ComposeMail::pickAddress( ) | 226 | void ComposeMail::pickAddress( ) |
226 | { | 227 | { |
227 | 228 | ||
228 | QLineEdit *line = mPickLineEdit; | 229 | QLineEdit *line = mPickLineEdit; |
229 | if ( line == 0 ) | 230 | if ( line == 0 ) |
230 | return; | 231 | return; |
231 | #ifdef DESKTOP_VERSION | 232 | #ifdef DESKTOP_VERSION |
232 | //qDebug(" ComposeMail::pickAddress "); | 233 | //qDebug(" ComposeMail::pickAddress "); |
233 | QString names ;//= AddressPicker::getNames(); | 234 | QString names ;//= AddressPicker::getNames(); |
234 | 235 | ||
235 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 236 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
236 | uint i=0; | 237 | uint i=0; |
237 | for (i=0; i < list.count(); i++) { | 238 | for (i=0; i < list.count(); i++) { |
238 | if ( !list[i].preferredEmail().isEmpty()) { | 239 | if ( !list[i].preferredEmail().isEmpty()) { |
239 | if ( ! names.isEmpty() ) | 240 | if ( ! names.isEmpty() ) |
240 | names+= ","; | 241 | names+= ","; |
241 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 242 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
242 | 243 | ||
243 | } | 244 | } |
244 | } | 245 | } |
245 | 246 | ||
246 | 247 | ||
247 | if ( line->text().isEmpty() ) { | 248 | if ( line->text().isEmpty() ) { |
248 | line->setText( names ); | 249 | line->setText( names ); |
249 | } else if ( !names.isEmpty() ) { | 250 | } else if ( !names.isEmpty() ) { |
250 | line->setText( line->text() + ", " + names ); | 251 | line->setText( line->text() + ", " + names ); |
251 | } | 252 | } |
252 | #else | 253 | #else |
253 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); | 254 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); |
254 | // the result should now arrive through method insertAttendees | 255 | // the result should now arrive through method insertAttendees |
255 | #endif | 256 | #endif |
256 | } | 257 | } |
257 | //the map includes name/email pairs, that comes from Ka/Pi | 258 | //the map includes name/email pairs, that comes from Ka/Pi |
258 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 259 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
259 | { | 260 | { |
260 | //qDebug("ComposeMail::insertAttendees "); | 261 | //qDebug("ComposeMail::insertAttendees "); |
261 | raise(); | 262 | raise(); |
262 | 263 | ||
264 | QString UID = uid; | ||
265 | if ( uid.left( 18 ) == (this->name() +QString("pick2")) ) { | ||
266 | mPickLineEdit = toLine; | ||
267 | UID = this->name(); | ||
268 | subjectLine->setText( uid.mid( 18 ) ); | ||
269 | } | ||
270 | //qDebug("ccc %s %s ", uid.latin1(), this->name()); | ||
263 | if ( mPickLineEdit == 0 ) { //whoami received | 271 | if ( mPickLineEdit == 0 ) { //whoami received |
264 | QString defmail = uidList[0]; | 272 | QString defmail = uidList[0]; |
265 | if ( emailList.count() == 0 ) | 273 | if ( emailList.count() == 0 ) |
266 | QMessageBox::information( 0, i18n( "Hint" ), | 274 | QMessageBox::information( 0, i18n( "Hint" ), |
267 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 275 | i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
268 | i18n( "Ok" ) ); | 276 | i18n( "Ok" ) ); |
269 | if (defmail.length()!=0) { | 277 | if (defmail.length()!=0) { |
270 | fromBox->insertItem(defmail); | 278 | fromBox->insertItem(defmail); |
271 | } | 279 | } |
272 | QStringList::ConstIterator sit = emailList.begin(); | 280 | QStringList::ConstIterator sit = emailList.begin(); |
273 | int pref = 0; | 281 | int pref = 0; |
274 | for (;sit!=emailList.end();++sit) { | 282 | for (;sit!=emailList.end();++sit) { |
275 | if ( (*sit)==defmail) | 283 | if ( (*sit)==defmail) |
276 | continue; | 284 | continue; |
277 | fromBox->insertItem((*sit)); | 285 | fromBox->insertItem((*sit)); |
278 | } | 286 | } |
279 | senderNameEdit->setText(nameList[0]); | 287 | senderNameEdit->setText(nameList[0]); |
280 | return; | 288 | return; |
281 | } | 289 | } |
282 | QString names ; | 290 | QString names ; |
283 | QLineEdit *line = mPickLineEdit; | 291 | QLineEdit *line = mPickLineEdit; |
284 | if (uid == this->name()) | 292 | if (UID == this->name()) |
285 | { | 293 | { |
286 | for ( int i = 0; i < nameList.count(); i++) | 294 | for ( int i = 0; i < nameList.count(); i++) |
287 | { | 295 | { |
288 | QString _name = nameList[i]; | 296 | QString _name = nameList[i]; |
289 | QString _email = emailList[i]; | 297 | QString _email = emailList[i]; |
290 | QString _uid = uidList[i]; | 298 | QString _uid = uidList[i]; |
291 | if ( ! _email.isEmpty() ) { | 299 | if ( ! _email.isEmpty() ) { |
292 | if ( ! names.isEmpty() ) | 300 | if ( ! names.isEmpty() ) |
293 | names+= ","; | 301 | names+= ","; |
294 | names+= "\""+_name +"\"<" +_email +">"; | 302 | names+= "\""+_name +"\"<" +_email +">"; |
295 | } | 303 | } |
296 | } | 304 | } |
297 | } | 305 | } |
298 | if ( line->text().isEmpty() ) { | 306 | if ( line->text().isEmpty() ) { |
299 | line->setText( names ); | 307 | line->setText( names ); |
300 | } else if ( !names.isEmpty() ) { | 308 | } else if ( !names.isEmpty() ) { |
301 | line->setText( line->text() + ", " + names ); | 309 | line->setText( line->text() + ", " + names ); |
302 | } | 310 | } |
303 | } | 311 | } |
304 | 312 | ||
305 | void ComposeMail::setTo( const QString & to ) | 313 | void ComposeMail::setTo( const QString & to ) |
306 | { | 314 | { |
307 | toLine->setText( to ); | 315 | toLine->setText( to ); |
308 | } | 316 | } |
309 | 317 | ||
310 | void ComposeMail::setSubject( const QString & subject ) | 318 | void ComposeMail::setSubject( const QString & subject ) |
311 | { | 319 | { |
312 | subjectLine->setText( subject ); | 320 | subjectLine->setText( subject ); |
313 | } | 321 | } |
314 | 322 | ||
315 | void ComposeMail::setInReplyTo( const QString & messageId ) | 323 | void ComposeMail::setInReplyTo( const QString & messageId ) |
316 | { | 324 | { |
317 | m_replyid = messageId; | 325 | m_replyid = messageId; |
318 | } | 326 | } |
319 | 327 | ||
320 | void ComposeMail::setMessage( const QString & text ) | 328 | void ComposeMail::setMessage( const QString & text ) |
321 | { | 329 | { |
322 | message->setText( text ); | 330 | message->setText( text ); |
323 | } | 331 | } |
324 | 332 | ||
325 | 333 | ||
326 | void ComposeMail::pickAddressTo() | 334 | void ComposeMail::pickAddressTo() |
327 | { | 335 | { |
328 | mPickLineEdit = toLine; | 336 | mPickLineEdit = toLine; |
329 | pickAddress( ); | 337 | pickAddress( ); |
330 | } | 338 | } |
331 | 339 | ||
332 | void ComposeMail::pickAddressCC() | 340 | void ComposeMail::pickAddressCC() |
333 | { | 341 | { |
334 | mPickLineEdit = ccLine; | 342 | mPickLineEdit = ccLine; |
335 | pickAddress( ); | 343 | pickAddress( ); |
336 | } | 344 | } |
337 | 345 | ||
338 | void ComposeMail::pickAddressBCC() | 346 | void ComposeMail::pickAddressBCC() |
339 | { | 347 | { |
340 | mPickLineEdit = bccLine; | 348 | mPickLineEdit = bccLine; |
341 | pickAddress( ); | 349 | pickAddress( ); |
342 | } | 350 | } |
343 | 351 | ||
344 | void ComposeMail::pickAddressReply() | 352 | void ComposeMail::pickAddressReply() |
345 | { | 353 | { |
346 | mPickLineEdit = replyLine; | 354 | mPickLineEdit = replyLine; |
347 | pickAddress( ); | 355 | pickAddress( ); |
348 | } | 356 | } |
349 | 357 | ||
350 | void ComposeMail::fillValues( int current ) | 358 | void ComposeMail::fillValues( int current ) |
351 | { | 359 | { |
352 | #if 0 | 360 | #if 0 |
353 | SMTPaccount *smtp = smtpAccounts.at( current ); | 361 | SMTPaccount *smtp = smtpAccounts.at( current ); |
354 | ccLine->clear(); | 362 | ccLine->clear(); |
355 | if ( smtp->getUseCC() ) { | 363 | if ( smtp->getUseCC() ) { |
356 | ccLine->setText( smtp->getCC() ); | 364 | ccLine->setText( smtp->getCC() ); |
357 | } | 365 | } |
358 | bccLine->clear(); | 366 | bccLine->clear(); |
359 | if ( smtp->getUseBCC() ) { | 367 | if ( smtp->getUseBCC() ) { |
360 | bccLine->setText( smtp->getBCC() ); | 368 | bccLine->setText( smtp->getBCC() ); |
361 | } | 369 | } |
362 | replyLine->clear(); | 370 | replyLine->clear(); |
363 | if ( smtp->getUseReply() ) { | 371 | if ( smtp->getUseReply() ) { |
364 | replyLine->setText( smtp->getReply() ); | 372 | replyLine->setText( smtp->getReply() ); |
365 | } | 373 | } |
366 | #endif | 374 | #endif |
367 | SMTPaccount *smtp = smtpAccounts.at( current ); | 375 | SMTPaccount *smtp = smtpAccounts.at( current ); |
368 | if ( smtp ) | 376 | if ( smtp ) |
369 | sigMultiLine->setText( smtp->getSignature() ); | 377 | sigMultiLine->setText( smtp->getSignature() ); |
370 | } | 378 | } |
371 | 379 | ||
372 | void ComposeMail::slotAdjustColumns() | 380 | void ComposeMail::slotAdjustColumns() |
373 | { | 381 | { |
374 | int currPage = tabWidget->currentPageIndex(); | 382 | int currPage = tabWidget->currentPageIndex(); |
375 | 383 | ||
376 | tabWidget->showPage( attachTab ); | 384 | tabWidget->showPage( attachTab ); |
377 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 385 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
378 | attList->setColumnWidth( 1, 80 ); | 386 | attList->setColumnWidth( 1, 80 ); |
379 | 387 | ||
380 | tabWidget->setCurrentPage( currPage ); | 388 | tabWidget->setCurrentPage( currPage ); |