author | zautrix <zautrix> | 2004-09-08 02:02:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-08 02:02:15 (UTC) |
commit | e5f6ea343bc2b129f81fde3734b100cfa2ed6c83 (patch) (unidiff) | |
tree | 8d33b16e52b1d886cf524052418e8dd445689a66 /kmicromail | |
parent | 199025628054eef739a261437a51a98f5218ab0f (diff) | |
download | kdepimpi-e5f6ea343bc2b129f81fde3734b100cfa2ed6c83.zip kdepimpi-e5f6ea343bc2b129f81fde3734b100cfa2ed6c83.tar.gz kdepimpi-e5f6ea343bc2b129f81fde3734b100cfa2ed6c83.tar.bz2 |
Some fixes
-rw-r--r-- | kmicromail/composemail.cpp | 2 | ||||
-rw-r--r-- | kmicromail/main.cpp | 2 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 11 |
3 files changed, 9 insertions, 6 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index f7604ad..14feeee 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,459 +1,459 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | #include "composemail.h" | 3 | #include "composemail.h" |
4 | 4 | ||
5 | #include <libmailwrapper/smtpwrapper.h> | 5 | #include <libmailwrapper/smtpwrapper.h> |
6 | #include <libmailwrapper/storemail.h> | 6 | #include <libmailwrapper/storemail.h> |
7 | #include <libmailwrapper/abstractmail.h> | 7 | #include <libmailwrapper/abstractmail.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | 9 | ||
10 | /* OPIE */ | 10 | /* OPIE */ |
11 | //#include <opie2/ofiledialog.h> | 11 | //#include <opie2/ofiledialog.h> |
12 | //#include <opie2/odebug.h> | 12 | //#include <opie2/odebug.h> |
13 | #include <kfiledialog.h> | 13 | #include <kfiledialog.h> |
14 | //#include <qpe/resource.h> | 14 | //#include <qpe/resource.h> |
15 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
16 | #include <qpe/global.h> | 16 | #include <qpe/global.h> |
17 | //#include <qpe/contact.h> | 17 | //#include <qpe/contact.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qmultilineedit.h> | 25 | #include <qmultilineedit.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qtabwidget.h> | 27 | #include <qtabwidget.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <kabc/addresseedialog.h> | 29 | #include <kabc/addresseedialog.h> |
30 | #include <kabc/stdaddressbook.h> | 30 | #include <kabc/stdaddressbook.h> |
31 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
32 | #ifdef DESKTOP_VERSION | 32 | #ifdef DESKTOP_VERSION |
33 | #include <kabc/addresseedialog.h> | 33 | #include <kabc/addresseedialog.h> |
34 | #else //DESKTOP_VERSION | 34 | #else //DESKTOP_VERSION |
35 | #include <libkdepim/externalapphandler.h> | 35 | #include <libkdepim/externalapphandler.h> |
36 | #endif //DESKTOP_VERSION | 36 | #endif //DESKTOP_VERSION |
37 | 37 | ||
38 | 38 | ||
39 | //using namespace Opie::Core; | 39 | //using namespace Opie::Core; |
40 | //using namespace Opie::Ui; | 40 | //using namespace Opie::Ui; |
41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
42 | : ComposeMailUI( parent, name, modal, flags ) | 42 | : ComposeMailUI( parent, name, modal, flags ) |
43 | { | 43 | { |
44 | 44 | ||
45 | mPickLineEdit = 0; | 45 | mPickLineEdit = 0; |
46 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 46 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
47 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 47 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
48 | settings = s; | 48 | settings = s; |
49 | m_replyid = ""; | 49 | m_replyid = ""; |
50 | KConfig config( locateLocal("config", "kabcrc") ); | 50 | KConfig config( locateLocal("config", "kabcrc") ); |
51 | config.setGroup( "General" ); | 51 | config.setGroup( "General" ); |
52 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 52 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
53 | if ( whoami_uid.isEmpty() ) { | 53 | if ( whoami_uid.isEmpty() ) { |
54 | QMessageBox::information( 0, tr( "Hint" ), | 54 | QMessageBox::information( 0, tr( "Hint" ), |
55 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 55 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
56 | tr( "Ok" ) ); | 56 | tr( "Ok" ) ); |
57 | 57 | ||
58 | } else | 58 | } else |
59 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 59 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); |
60 | #ifdef DESKTOP_VERSION | 60 | #ifdef DESKTOP_VERSION |
61 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 61 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
62 | QStringList mails = con.emails(); | 62 | QStringList mails = con.emails(); |
63 | QString defmail = con.preferredEmail(); | 63 | QString defmail = con.preferredEmail(); |
64 | if ( mails.count() == 0) | 64 | if ( mails.count() == 0) |
65 | QMessageBox::information( 0, tr( "Hint" ), | 65 | QMessageBox::information( 0, tr( "Hint" ), |
66 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 66 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
67 | tr( "Ok" ) ); | 67 | tr( "Ok" ) ); |
68 | if (defmail.length()!=0) { | 68 | if (defmail.length()!=0) { |
69 | fromBox->insertItem(defmail); | 69 | fromBox->insertItem(defmail); |
70 | } | 70 | } |
71 | QStringList::ConstIterator sit = mails.begin(); | 71 | QStringList::ConstIterator sit = mails.begin(); |
72 | for (;sit!=mails.end();++sit) { | 72 | for (;sit!=mails.end();++sit) { |
73 | if ( (*sit)==defmail) | 73 | if ( (*sit)==defmail) |
74 | continue; | 74 | continue; |
75 | fromBox->insertItem((*sit)); | 75 | fromBox->insertItem((*sit)); |
76 | } | 76 | } |
77 | senderNameEdit->setText(con.formattedName()); | 77 | senderNameEdit->setText(con.formattedName()); |
78 | #endif | 78 | #endif |
79 | Config cfg( "mail" ); | 79 | Config cfg( "mail" ); |
80 | cfg.setGroup( "Compose" ); | 80 | cfg.setGroup( "Compose" ); |
81 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 81 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
82 | 82 | ||
83 | attList->addColumn( tr( "Name" ) ); | 83 | attList->addColumn( tr( "Name" ) ); |
84 | attList->addColumn( tr( "Size" ) ); | 84 | attList->addColumn( tr( "Size" ) ); |
85 | 85 | ||
86 | QList<Account> accounts = settings->getAccounts(); | 86 | QList<Account> accounts = settings->getAccounts(); |
87 | 87 | ||
88 | Account *it; | 88 | Account *it; |
89 | for ( it = accounts.first(); it; it = accounts.next() ) { | 89 | for ( it = accounts.first(); it; it = accounts.next() ) { |
90 | if ( it->getType()==MAILLIB::A_SMTP ) { | 90 | if ( it->getType()==MAILLIB::A_SMTP ) { |
91 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 91 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
92 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 92 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
93 | smtpAccounts.append( smtp ); | 93 | smtpAccounts.append( smtp ); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | if ( smtpAccounts.count() > 0 ) { | 96 | if ( smtpAccounts.count() > 0 ) { |
97 | fillValues( smtpAccountBox->currentItem() ); | 97 | fillValues( smtpAccountBox->currentItem() ); |
98 | } else { | 98 | } else { |
99 | QMessageBox::information( 0, tr( "Problem" ), | 99 | QMessageBox::information( 0, tr( "Problem" ), |
100 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | 100 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), |
101 | tr( "Ok" ) ); | 101 | tr( "Ok" ) ); |
102 | return; | 102 | return; |
103 | } | 103 | } |
104 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 104 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
105 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 105 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
106 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 106 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
107 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 107 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
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() ) { |
301 | bccLine->setText( smtp->getBCC() ); | 301 | bccLine->setText( smtp->getBCC() ); |
302 | } | 302 | } |
303 | replyLine->clear(); | 303 | replyLine->clear(); |
304 | if ( smtp->getUseReply() ) { | 304 | if ( smtp->getUseReply() ) { |
305 | replyLine->setText( smtp->getReply() ); | 305 | replyLine->setText( smtp->getReply() ); |
306 | } | 306 | } |
307 | sigMultiLine->setText( smtp->getSignature() ); | 307 | sigMultiLine->setText( smtp->getSignature() ); |
308 | #endif | 308 | #endif |
309 | } | 309 | } |
310 | 310 | ||
311 | void ComposeMail::slotAdjustColumns() | 311 | void ComposeMail::slotAdjustColumns() |
312 | { | 312 | { |
313 | int currPage = tabWidget->currentPageIndex(); | 313 | int currPage = tabWidget->currentPageIndex(); |
314 | 314 | ||
315 | tabWidget->showPage( attachTab ); | 315 | tabWidget->showPage( attachTab ); |
316 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 316 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
317 | attList->setColumnWidth( 1, 80 ); | 317 | attList->setColumnWidth( 1, 80 ); |
318 | 318 | ||
319 | tabWidget->setCurrentPage( currPage ); | 319 | tabWidget->setCurrentPage( currPage ); |
320 | } | 320 | } |
321 | 321 | ||
322 | void ComposeMail::addAttachment() | 322 | void ComposeMail::addAttachment() |
323 | { | 323 | { |
324 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 324 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
325 | if ( !lnk.isEmpty() ) { | 325 | if ( !lnk.isEmpty() ) { |
326 | Attachment *att = new Attachment( lnk ); | 326 | Attachment *att = new Attachment( lnk ); |
327 | (void) new AttachViewItem( attList, att ); | 327 | (void) new AttachViewItem( attList, att ); |
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | void ComposeMail::removeAttachment() | 331 | void ComposeMail::removeAttachment() |
332 | { | 332 | { |
333 | if ( !attList->currentItem() ) { | 333 | if ( !attList->currentItem() ) { |
334 | QMessageBox::information( this, tr( "Error" ), | 334 | QMessageBox::information( this, tr( "Error" ), |
335 | tr( "<p>Please select a File.</p>" ), | 335 | tr( "<p>Please select a File.</p>" ), |
336 | tr( "Ok" ) ); | 336 | tr( "Ok" ) ); |
337 | } else { | 337 | } else { |
338 | attList->takeItem( attList->currentItem() ); | 338 | attList->takeItem( attList->currentItem() ); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
342 | void ComposeMail::accept() | 342 | void ComposeMail::accept() |
343 | { | 343 | { |
344 | if ( smtpAccountBox->count() == 0 ) { | 344 | if ( smtpAccountBox->count() == 0 ) { |
345 | 345 | ||
346 | reject(); | 346 | reject(); |
347 | return; | 347 | return; |
348 | } | 348 | } |
349 | 349 | ||
350 | if (! checkBoxLater->isChecked() ) { | 350 | if (! checkBoxLater->isChecked() ) { |
351 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 351 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), |
352 | tr("Send this message?"), | 352 | tr("Send this message?"), |
353 | tr("Yes"), | 353 | tr("Yes"), |
354 | tr("Cancel")); | 354 | tr("Cancel")); |
355 | 355 | ||
356 | if (yesno == 1) { | 356 | if (yesno == 1) { |
357 | return; | 357 | return; |
358 | } | 358 | } |
359 | } | 359 | } |
360 | #if 0 | 360 | #if 0 |
361 | odebug << "Sending Mail with " | 361 | odebug << "Sending Mail with " |
362 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 362 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
363 | #endif | 363 | #endif |
364 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 364 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
365 | 365 | ||
366 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 366 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
367 | mail->setMail(fromBox->currentText()); | 367 | mail->setMail(fromBox->currentText()); |
368 | 368 | ||
369 | if ( !toLine->text().isEmpty() ) { | 369 | if ( !toLine->text().isEmpty() ) { |
370 | mail->setTo( toLine->text() ); | 370 | mail->setTo( toLine->text() ); |
371 | } else { | 371 | } else { |
372 | QMessageBox::warning(0,tr("Sending mail"), | 372 | QMessageBox::warning(0,tr("Sending mail"), |
373 | tr("No Receiver spezified" ) ); | 373 | tr("No Receiver spezified" ) ); |
374 | return; | 374 | return; |
375 | } | 375 | } |
376 | 376 | ||
377 | mail->setName(senderNameEdit->text()); | 377 | mail->setName(senderNameEdit->text()); |
378 | mail->setCC( ccLine->text() ); | 378 | mail->setCC( ccLine->text() ); |
379 | mail->setBCC( bccLine->text() ); | 379 | mail->setBCC( bccLine->text() ); |
380 | mail->setReply( replyLine->text() ); | 380 | mail->setReply( replyLine->text() ); |
381 | mail->setSubject( subjectLine->text() ); | 381 | mail->setSubject( subjectLine->text() ); |
382 | if (!m_replyid.isEmpty()) { | 382 | if (!m_replyid.isEmpty()) { |
383 | QStringList ids; | 383 | QStringList ids; |
384 | ids.append(m_replyid); | 384 | ids.append(m_replyid); |
385 | mail->setInreply(ids); | 385 | mail->setInreply(ids); |
386 | } | 386 | } |
387 | QString txt = message->text(); | 387 | QString txt = message->text(); |
388 | if ( !sigMultiLine->text().isEmpty() ) { | 388 | if ( !sigMultiLine->text().isEmpty() ) { |
389 | txt.append( "\n--\n" ); | 389 | txt.append( "\n--\n" ); |
390 | txt.append( sigMultiLine->text() ); | 390 | txt.append( sigMultiLine->text() ); |
391 | } | 391 | } |
392 | mail->setMessage( txt ); | 392 | mail->setMessage( txt ); |
393 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 393 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
394 | while ( it != 0 ) { | 394 | while ( it != 0 ) { |
395 | mail->addAttachment( it->getAttachment() ); | 395 | mail->addAttachment( it->getAttachment() ); |
396 | it = (AttachViewItem *) it->nextSibling(); | 396 | it = (AttachViewItem *) it->nextSibling(); |
397 | } | 397 | } |
398 | 398 | ||
399 | SMTPwrapper wrapper( smtp ); | 399 | SMTPwrapper wrapper( smtp ); |
400 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 400 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
401 | setStatus( tr ("Mail sent")); | 401 | setStatus( tr ("Mail sent")); |
402 | else { | 402 | else { |
403 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 403 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
404 | return; | 404 | return; |
405 | } | 405 | } |
406 | 406 | ||
407 | 407 | ||
408 | QDialog::accept(); | 408 | QDialog::accept(); |
409 | } | 409 | } |
410 | 410 | ||
411 | void ComposeMail::reject() | 411 | void ComposeMail::reject() |
412 | { | 412 | { |
413 | //qDebug("ComposeMail::reject() "); | 413 | //qDebug("ComposeMail::reject() "); |
414 | int yesno = QMessageBox::warning(0,tr("Store message?"), | 414 | int yesno = QMessageBox::warning(0,tr("Store message?"), |
415 | tr("Store message into drafts?\n"), | 415 | tr("Store message into drafts?\n"), |
416 | tr("Yes"), | 416 | tr("Yes"), |
417 | tr("No")); | 417 | tr("No")); |
418 | 418 | ||
419 | //qDebug("button %d ", yesno); | 419 | //qDebug("button %d ", yesno); |
420 | if (yesno == 0) { | 420 | if (yesno == 0) { |
421 | if ( toLine->text().isEmpty() ) { | 421 | if ( toLine->text().isEmpty() ) { |
422 | QMessageBox::warning(0,tr("Sending mail"), | 422 | QMessageBox::warning(0,tr("Sending mail"), |
423 | tr("No Receiver spezified" ) ); | 423 | tr("No Receiver spezified" ) ); |
424 | return; | 424 | return; |
425 | } | 425 | } |
426 | saveAsDraft(); | 426 | saveAsDraft(); |
427 | } | 427 | } |
428 | if (yesno == 2) { | 428 | if (yesno == 2) { |
429 | qDebug("return "); | 429 | qDebug("return "); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | QDialog::reject(); | 432 | QDialog::reject(); |
433 | } | 433 | } |
434 | 434 | ||
435 | ComposeMail::~ComposeMail() | 435 | ComposeMail::~ComposeMail() |
436 | { | 436 | { |
437 | } | 437 | } |
438 | 438 | ||
439 | void ComposeMail::reEditMail(const RecMailP¤t) | 439 | void ComposeMail::reEditMail(const RecMailP¤t) |
440 | { | 440 | { |
441 | RecMailP data = current; | 441 | RecMailP data = current; |
442 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 442 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
443 | subjectLine->setText( data->getSubject()); | 443 | subjectLine->setText( data->getSubject()); |
444 | toLine->setText(data->To().join(",")); | 444 | toLine->setText(data->To().join(",")); |
445 | ccLine->setText(data->CC().join(",")); | 445 | ccLine->setText(data->CC().join(",")); |
446 | bccLine->setText(data->Bcc().join(",")); | 446 | bccLine->setText(data->Bcc().join(",")); |
447 | replyLine->setText(data->Replyto()); | 447 | replyLine->setText(data->Replyto()); |
448 | } | 448 | } |
449 | 449 | ||
450 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 450 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
451 | : QListViewItem( parent ) | 451 | : QListViewItem( parent ) |
452 | { | 452 | { |
453 | attachment = att; | 453 | attachment = att; |
454 | if ( !attachment->getPixmap().isNull() ) | 454 | if ( !attachment->getPixmap().isNull() ) |
455 | setPixmap( 0,attachment->getPixmap() ); | 455 | setPixmap( 0,attachment->getPixmap() ); |
456 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 456 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
457 | setText( 1, QString::number( att->getSize() ) ); | 457 | setText( 1, QString::number( att->getSize() ) ); |
458 | } | 458 | } |
459 | 459 | ||
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index a3e1b86..65de770 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp | |||
@@ -1,61 +1,61 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | 3 | ||
4 | #ifndef DESKTOP_VERSION | 4 | #ifndef DESKTOP_VERSION |
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | #include <libkdepim/externalapphandler.h> | 6 | #include <libkdepim/externalapphandler.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #else | 8 | #else |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
12 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
13 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
14 | #endif | 14 | #endif |
15 | #include "opiemail.h" | 15 | #include "opiemail.h" |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include <kstandarddirs.h> | 17 | #include <kstandarddirs.h> |
18 | #include <kglobal.h> | 18 | #include <kglobal.h> |
19 | #include <stdio.h> | 19 | #include <stdio.h> |
20 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
21 | 21 | ||
22 | using namespace Opie::Core; | 22 | using namespace Opie::Core; |
23 | int main( int argc, char **argv ) { | 23 | int main( int argc, char **argv ) { |
24 | 24 | ||
25 | #ifndef DESKTOP_VERSION | 25 | #ifndef DESKTOP_VERSION |
26 | QPEApplication a( argc, argv ); | 26 | QPEApplication a( argc, argv ); |
27 | a.setKeepRunning (); | 27 | a.setKeepRunning (); |
28 | #else | 28 | #else |
29 | QApplication a( argc, argv ); | 29 | QApplication a( argc, argv ); |
30 | QApplication::setStyle( new QPlatinumStyle ()); | 30 | QApplication::setStyle( new QPlatinumStyle ()); |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | KGlobal::setAppName( "kmicromail" ); | 33 | KGlobal::setAppName( "kmicromail" ); |
34 | QString fileName ; | 34 | QString fileName ; |
35 | #ifndef DESKTOP_VERSION | 35 | #ifndef DESKTOP_VERSION |
36 | fileName = getenv("QPEDIR"); | 36 | fileName = getenv("QPEDIR"); |
37 | if ( QApplication::desktop()->width() > 320 ) | 37 | if ( QApplication::desktop()->width() > 320 ) |
38 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); | 38 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); |
39 | else | 39 | else |
40 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); | 40 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); |
41 | #else | 41 | #else |
42 | fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; | 42 | fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; |
43 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 43 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
44 | #endif | 44 | #endif |
45 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); | 45 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); |
46 | OpieMail mw; | 46 | OpieMail mw; |
47 | #ifndef DESKTOP_VERSION | 47 | #ifndef DESKTOP_VERSION |
48 | //qDebug("CONNECT "); | 48 | //qDebug("CONNECT "); |
49 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); | 49 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); |
50 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 50 | // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
51 | a.showMainWidget(&mw ); | 51 | a.showMainWidget(&mw ); |
52 | #else | 52 | #else |
53 | a.setMainWidget(&mw ); | 53 | a.setMainWidget(&mw ); |
54 | mw.show(); | 54 | mw.show(); |
55 | //m.resize( 800, 600 ); | 55 | //m.resize( 800, 600 ); |
56 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 56 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
57 | #endif | 57 | #endif |
58 | int rv = a.exec(); | 58 | int rv = a.exec(); |
59 | return rv; | 59 | return rv; |
60 | 60 | ||
61 | } | 61 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 3e560c5..a1c5645 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,422 +1,425 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | 3 | ||
4 | #include "settingsdialog.h" | 4 | #include "settingsdialog.h" |
5 | #include "opiemail.h" | 5 | #include "opiemail.h" |
6 | #include "editaccounts.h" | 6 | #include "editaccounts.h" |
7 | #include "composemail.h" | 7 | #include "composemail.h" |
8 | #include "mailistviewitem.h" | 8 | #include "mailistviewitem.h" |
9 | #include "viewmail.h" | 9 | #include "viewmail.h" |
10 | #include "selectstore.h" | 10 | #include "selectstore.h" |
11 | #include "selectsmtp.h" | 11 | #include "selectsmtp.h" |
12 | 12 | ||
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <libkdepim/externalapphandler.h> | ||
14 | 15 | ||
15 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
16 | #include <libmailwrapper/smtpwrapper.h> | 17 | #include <libmailwrapper/smtpwrapper.h> |
17 | #include <libmailwrapper/mailtypes.h> | 18 | #include <libmailwrapper/mailtypes.h> |
18 | #include <libmailwrapper/abstractmail.h> | 19 | #include <libmailwrapper/abstractmail.h> |
19 | /* OPIE */ | 20 | /* OPIE */ |
20 | //#include <qpe/resource.h> | 21 | //#include <qpe/resource.h> |
21 | //#include <qpe/qpeapplication.h> | 22 | //#include <qpe/qpeapplication.h> |
22 | 23 | ||
23 | /* QT */ | 24 | /* QT */ |
24 | 25 | ||
25 | using namespace Opie::Core; | 26 | using namespace Opie::Core; |
26 | 27 | ||
27 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 28 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
28 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 29 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
29 | { | 30 | { |
30 | settings = new Settings(); | 31 | settings = new Settings(); |
31 | 32 | ||
32 | folderView->populate( settings->getAccounts() ); | 33 | folderView->populate( settings->getAccounts() ); |
33 | 34 | ||
34 | } | 35 | } |
35 | 36 | ||
36 | OpieMail::~OpieMail() | 37 | OpieMail::~OpieMail() |
37 | { | 38 | { |
38 | if (settings) delete settings; | 39 | if (settings) delete settings; |
39 | } | 40 | } |
40 | 41 | ||
41 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 42 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
42 | { | 43 | { |
43 | 44 | ||
44 | } | 45 | } |
45 | #include <stdlib.h> | 46 | #include <stdlib.h> |
46 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 47 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
47 | { | 48 | { |
48 | // copied from old mail2 | 49 | // copied from old mail2 |
49 | static int ii = 0; | 50 | static int ii = 0; |
50 | 51 | qDebug("call ############################# %d ", ii); | |
51 | // block second call | 52 | // block second call |
52 | if ( ii < 2 ) { | 53 | if ( ii < 2 ) { |
53 | ++ii; | 54 | //++ii; |
54 | if ( ii > 1 ) { | 55 | if ( ii > 1 ) { |
55 | qDebug("qcop call blocked "); | 56 | qDebug("qcop call blocked "); |
56 | return; | 57 | //return; |
57 | } | 58 | } |
58 | } | 59 | } |
60 | ++ii; | ||
59 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 61 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
60 | if (msg == "writeMail(QString,QString)") | 62 | if (msg == "writeMail(QString,QString)") |
61 | { | 63 | { |
62 | QDataStream stream(data,IO_ReadOnly); | 64 | QDataStream stream(data,IO_ReadOnly); |
63 | QString name, email; | 65 | QString name, email; |
64 | stream >> name >> email; | 66 | stream >> name >> email; |
65 | // removing the whitespaces at beginning and end is needed! | 67 | // removing the whitespaces at beginning and end is needed! |
66 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 68 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
67 | } | 69 | } |
68 | else if (msg == "newMail()") | 70 | else if (msg == "newMail()") |
69 | { | 71 | { |
70 | slotComposeMail(); | 72 | slotComposeMail(); |
71 | } | 73 | } |
72 | else if (msg == "newMail(QString)") | 74 | else if (msg == "newMail(QString)") |
73 | { | 75 | { |
74 | QDataStream stream(data,IO_ReadOnly); | 76 | QDataStream stream(data,IO_ReadOnly); |
75 | QString nameemail; | 77 | QString nameemail; |
76 | stream >> nameemail; | 78 | stream >> nameemail; |
77 | // the format is | 79 | // the format is |
78 | // NAME <EMAIL>:SUBJECT | 80 | // NAME <EMAIL>:SUBJECT |
79 | //qDebug("message %s ", nameemail.latin1()); | 81 | //qDebug("message %s ", nameemail.latin1()); |
80 | 82 | ||
81 | slotwriteMail2( nameemail ); | 83 | slotwriteMail2( nameemail ); |
82 | } | 84 | } else |
85 | ExternalAppHandler::instance()->appMessage ( msg, data); | ||
83 | } | 86 | } |
84 | void OpieMail::slotwriteMail2(const QString& namemail ) | 87 | void OpieMail::slotwriteMail2(const QString& namemail ) |
85 | { | 88 | { |
86 | // qDebug("OpieMail::slotwriteMail2 "); | 89 | // qDebug("OpieMail::slotwriteMail2 "); |
87 | qApp->processEvents(); | 90 | qApp->processEvents(); |
88 | ComposeMail compose( settings, this, 0, true ); | 91 | ComposeMail compose( settings, this, 0, true ); |
89 | if ( !namemail.isEmpty() ) { | 92 | if ( !namemail.isEmpty() ) { |
90 | QString to = namemail; | 93 | QString to = namemail; |
91 | if ( namemail.find( " <") > 1 ) { | 94 | if ( namemail.find( " <") > 1 ) { |
92 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 95 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
93 | } else | 96 | } else |
94 | if ( namemail.find( "<") > 1 ) { | 97 | if ( namemail.find( "<") > 1 ) { |
95 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 98 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
96 | } | 99 | } |
97 | int sub = to.find( ">:"); | 100 | int sub = to.find( ">:"); |
98 | if ( sub > 0 ) { | 101 | if ( sub > 0 ) { |
99 | compose.setTo( to.left(sub+1) ); | 102 | compose.setTo( to.left(sub+1) ); |
100 | compose.setSubject( to.mid(sub+2) ); | 103 | compose.setSubject( to.mid(sub+2) ); |
101 | } else | 104 | } else |
102 | compose.setTo( to ); | 105 | compose.setTo( to ); |
103 | } | 106 | } |
104 | compose.slotAdjustColumns(); | 107 | compose.slotAdjustColumns(); |
105 | compose.showMaximized(); | 108 | compose.showMaximized(); |
106 | compose.exec(); | 109 | compose.exec(); |
107 | raise(); | 110 | raise(); |
108 | //qDebug("retttich "); | 111 | //qDebug("retttich "); |
109 | } | 112 | } |
110 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 113 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
111 | { | 114 | { |
112 | // qDebug("OpieMail::slotwriteMail "); | 115 | // qDebug("OpieMail::slotwriteMail "); |
113 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 116 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
114 | if (!email.isEmpty()) | 117 | if (!email.isEmpty()) |
115 | { | 118 | { |
116 | if (!name.isEmpty()) | 119 | if (!name.isEmpty()) |
117 | { | 120 | { |
118 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 121 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
119 | } | 122 | } |
120 | else | 123 | else |
121 | { | 124 | { |
122 | compose.setTo(email); | 125 | compose.setTo(email); |
123 | } | 126 | } |
124 | } | 127 | } |
125 | compose.slotAdjustColumns(); | 128 | compose.slotAdjustColumns(); |
126 | compose.showMaximized(); | 129 | compose.showMaximized(); |
127 | compose.exec(); | 130 | compose.exec(); |
128 | } | 131 | } |
129 | 132 | ||
130 | void OpieMail::slotComposeMail() | 133 | void OpieMail::slotComposeMail() |
131 | { | 134 | { |
132 | slotwriteMail2( QString () ); | 135 | slotwriteMail2( QString () ); |
133 | //slotwriteMail(0l,0l); | 136 | //slotwriteMail(0l,0l); |
134 | } | 137 | } |
135 | 138 | ||
136 | void OpieMail::slotSendQueued() | 139 | void OpieMail::slotSendQueued() |
137 | { | 140 | { |
138 | SMTPaccount *smtp = 0; | 141 | SMTPaccount *smtp = 0; |
139 | 142 | ||
140 | QList<Account> list = settings->getAccounts(); | 143 | QList<Account> list = settings->getAccounts(); |
141 | QList<SMTPaccount> smtpList; | 144 | QList<SMTPaccount> smtpList; |
142 | smtpList.setAutoDelete(false); | 145 | smtpList.setAutoDelete(false); |
143 | Account *it; | 146 | Account *it; |
144 | for ( it = list.first(); it; it = list.next() ) | 147 | for ( it = list.first(); it; it = list.next() ) |
145 | { | 148 | { |
146 | if ( it->getType() == MAILLIB::A_SMTP ) | 149 | if ( it->getType() == MAILLIB::A_SMTP ) |
147 | { | 150 | { |
148 | smtp = static_cast<SMTPaccount *>(it); | 151 | smtp = static_cast<SMTPaccount *>(it); |
149 | smtpList.append(smtp); | 152 | smtpList.append(smtp); |
150 | } | 153 | } |
151 | } | 154 | } |
152 | if (smtpList.count()==0) | 155 | if (smtpList.count()==0) |
153 | { | 156 | { |
154 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); | 157 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); |
155 | return; | 158 | return; |
156 | } | 159 | } |
157 | if (smtpList.count()==1) | 160 | if (smtpList.count()==1) |
158 | { | 161 | { |
159 | smtp = smtpList.at(0); | 162 | smtp = smtpList.at(0); |
160 | } | 163 | } |
161 | else | 164 | else |
162 | { | 165 | { |
163 | smtp = 0; | 166 | smtp = 0; |
164 | selectsmtp selsmtp; | 167 | selectsmtp selsmtp; |
165 | selsmtp.setSelectionlist(&smtpList); | 168 | selsmtp.setSelectionlist(&smtpList); |
166 | selsmtp.showMaximized(); | 169 | selsmtp.showMaximized(); |
167 | if ( selsmtp.exec() == QDialog::Accepted ) | 170 | if ( selsmtp.exec() == QDialog::Accepted ) |
168 | { | 171 | { |
169 | smtp = selsmtp.selected_smtp(); | 172 | smtp = selsmtp.selected_smtp(); |
170 | } | 173 | } |
171 | } | 174 | } |
172 | if (smtp) | 175 | if (smtp) |
173 | { | 176 | { |
174 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 177 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
175 | if ( wrap->flushOutbox() ) | 178 | if ( wrap->flushOutbox() ) |
176 | { | 179 | { |
177 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 180 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
178 | } | 181 | } |
179 | delete wrap; | 182 | delete wrap; |
180 | } | 183 | } |
181 | } | 184 | } |
182 | 185 | ||
183 | void OpieMail::slotSearchMails() | 186 | void OpieMail::slotSearchMails() |
184 | { | 187 | { |
185 | qDebug("OpieMail::slotSearchMails():not implemented "); | 188 | qDebug("OpieMail::slotSearchMails():not implemented "); |
186 | } | 189 | } |
187 | 190 | ||
188 | void OpieMail::slotEditSettings() | 191 | void OpieMail::slotEditSettings() |
189 | { | 192 | { |
190 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 193 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
191 | settingsDialog.showMaximized(); | 194 | settingsDialog.showMaximized(); |
192 | settingsDialog.exec(); | 195 | settingsDialog.exec(); |
193 | } | 196 | } |
194 | 197 | ||
195 | void OpieMail::slotEditAccounts() | 198 | void OpieMail::slotEditAccounts() |
196 | { | 199 | { |
197 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 200 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
198 | eaDialog.slotAdjustColumns(); | 201 | eaDialog.slotAdjustColumns(); |
199 | eaDialog.showMaximized(); | 202 | eaDialog.showMaximized(); |
200 | eaDialog.exec(); | 203 | eaDialog.exec(); |
201 | if ( settings ) delete settings; | 204 | if ( settings ) delete settings; |
202 | settings = new Settings(); | 205 | settings = new Settings(); |
203 | 206 | ||
204 | folderView->populate( settings->getAccounts() ); | 207 | folderView->populate( settings->getAccounts() ); |
205 | } | 208 | } |
206 | 209 | ||
207 | void OpieMail::displayMail() | 210 | void OpieMail::displayMail() |
208 | { | 211 | { |
209 | QListViewItem*item = mailView->currentItem(); | 212 | QListViewItem*item = mailView->currentItem(); |
210 | if (!item) return; | 213 | if (!item) return; |
211 | RecMailP mail = ((MailListViewItem*)item)->data(); | 214 | RecMailP mail = ((MailListViewItem*)item)->data(); |
212 | RecBodyP body = folderView->fetchBody(mail); | 215 | RecBodyP body = folderView->fetchBody(mail); |
213 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 216 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
214 | readMail.setBody( body ); | 217 | readMail.setBody( body ); |
215 | readMail.setMail( mail ); | 218 | readMail.setMail( mail ); |
216 | readMail.showMaximized(); | 219 | readMail.showMaximized(); |
217 | readMail.exec(); | 220 | readMail.exec(); |
218 | 221 | ||
219 | if ( readMail.deleted ) | 222 | if ( readMail.deleted ) |
220 | { | 223 | { |
221 | folderView->refreshCurrent(); | 224 | folderView->refreshCurrent(); |
222 | } | 225 | } |
223 | else | 226 | else |
224 | { | 227 | { |
225 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 228 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
226 | } | 229 | } |
227 | } | 230 | } |
228 | 231 | ||
229 | void OpieMail::slotDeleteMail() | 232 | void OpieMail::slotDeleteMail() |
230 | { | 233 | { |
231 | if (!mailView->currentItem()) return; | 234 | if (!mailView->currentItem()) return; |
232 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 235 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
233 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 236 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
234 | { | 237 | { |
235 | mail->Wrapper()->deleteMail( mail ); | 238 | mail->Wrapper()->deleteMail( mail ); |
236 | folderView->refreshCurrent(); | 239 | folderView->refreshCurrent(); |
237 | } | 240 | } |
238 | } | 241 | } |
239 | void OpieMail::slotDeleteAllMail() | 242 | void OpieMail::slotDeleteAllMail() |
240 | { | 243 | { |
241 | 244 | ||
242 | QValueList<RecMailP> t; | 245 | QValueList<RecMailP> t; |
243 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 246 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
244 | { | 247 | { |
245 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 248 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
246 | while ( item ) { | 249 | while ( item ) { |
247 | if ( item->isSelected() ) { | 250 | if ( item->isSelected() ) { |
248 | t.append( item->data() ); | 251 | t.append( item->data() ); |
249 | } | 252 | } |
250 | item = (MailListViewItem*)item->nextSibling(); | 253 | item = (MailListViewItem*)item->nextSibling(); |
251 | } | 254 | } |
252 | } | 255 | } |
253 | else | 256 | else |
254 | return; | 257 | return; |
255 | if ( t.count() == 0 ) | 258 | if ( t.count() == 0 ) |
256 | return; | 259 | return; |
257 | RecMailP mail = t.first(); | 260 | RecMailP mail = t.first(); |
258 | mail->Wrapper()->deleteMailList(t); | 261 | mail->Wrapper()->deleteMailList(t); |
259 | folderView->refreshCurrent(); | 262 | folderView->refreshCurrent(); |
260 | 263 | ||
261 | 264 | ||
262 | } | 265 | } |
263 | void OpieMail::clearSelection() | 266 | void OpieMail::clearSelection() |
264 | { | 267 | { |
265 | mailView->clearSelection(); | 268 | mailView->clearSelection(); |
266 | 269 | ||
267 | } | 270 | } |
268 | 271 | ||
269 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 272 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
270 | { | 273 | { |
271 | if (!mailView->currentItem()) return; | 274 | if (!mailView->currentItem()) return; |
272 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 275 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
273 | /* just the RIGHT button - or hold on pda */ | 276 | /* just the RIGHT button - or hold on pda */ |
274 | if (button!=2) {return;} | 277 | if (button!=2) {return;} |
275 | if (!item) return; | 278 | if (!item) return; |
276 | QPopupMenu *m = new QPopupMenu(0); | 279 | QPopupMenu *m = new QPopupMenu(0); |
277 | if (m) | 280 | if (m) |
278 | { | 281 | { |
279 | if (mailtype==MAILLIB::A_NNTP) { | 282 | if (mailtype==MAILLIB::A_NNTP) { |
280 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 283 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
281 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 284 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
282 | } else { | 285 | } else { |
283 | if (folderView->currentisDraft()) { | 286 | if (folderView->currentisDraft()) { |
284 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 287 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
285 | } | 288 | } |
286 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 289 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
287 | m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 290 | m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
288 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 291 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
289 | m->insertSeparator(); | 292 | m->insertSeparator(); |
290 | m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 293 | m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
291 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 294 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
292 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); | 295 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); |
293 | } | 296 | } |
294 | m->setFocus(); | 297 | m->setFocus(); |
295 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 298 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
296 | delete m; | 299 | delete m; |
297 | } | 300 | } |
298 | } | 301 | } |
299 | 302 | ||
300 | void OpieMail::slotShowFolders( bool show ) | 303 | void OpieMail::slotShowFolders( bool show ) |
301 | { | 304 | { |
302 | if ( show && folderView->isHidden() ) | 305 | if ( show && folderView->isHidden() ) |
303 | { | 306 | { |
304 | folderView->show(); | 307 | folderView->show(); |
305 | } | 308 | } |
306 | else if ( !show && !folderView->isHidden() ) | 309 | else if ( !show && !folderView->isHidden() ) |
307 | { | 310 | { |
308 | folderView->hide(); | 311 | folderView->hide(); |
309 | } | 312 | } |
310 | } | 313 | } |
311 | 314 | ||
312 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 315 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
313 | { | 316 | { |
314 | MailListViewItem*item = 0; | 317 | MailListViewItem*item = 0; |
315 | mailView->clear(); | 318 | mailView->clear(); |
316 | 319 | ||
317 | QValueList<RecMailP>::ConstIterator it; | 320 | QValueList<RecMailP>::ConstIterator it; |
318 | for (it = list.begin(); it != list.end();++it) | 321 | for (it = list.begin(); it != list.end();++it) |
319 | { | 322 | { |
320 | item = new MailListViewItem(mailView,item); | 323 | item = new MailListViewItem(mailView,item); |
321 | item->storeData((*it)); | 324 | item->storeData((*it)); |
322 | item->showEntry(); | 325 | item->showEntry(); |
323 | } | 326 | } |
324 | } | 327 | } |
325 | 328 | ||
326 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 329 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
327 | { | 330 | { |
328 | mailView->clearSelection(); | 331 | mailView->clearSelection(); |
329 | /* just LEFT button - or tap with stylus on pda */ | 332 | /* just LEFT button - or tap with stylus on pda */ |
330 | //if (button!=1) return; | 333 | //if (button!=1) return; |
331 | if (!item) return; | 334 | if (!item) return; |
332 | if (folderView->currentisDraft()) { | 335 | if (folderView->currentisDraft()) { |
333 | reEditMail(); | 336 | reEditMail(); |
334 | } else { | 337 | } else { |
335 | displayMail(); | 338 | displayMail(); |
336 | } | 339 | } |
337 | } | 340 | } |
338 | 341 | ||
339 | void OpieMail::slotMoveCopyMail() | 342 | void OpieMail::slotMoveCopyMail() |
340 | { | 343 | { |
341 | if (!mailView->currentItem()) return; | 344 | if (!mailView->currentItem()) return; |
342 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 345 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
343 | AbstractMail*targetMail = 0; | 346 | AbstractMail*targetMail = 0; |
344 | QString targetFolder = ""; | 347 | QString targetFolder = ""; |
345 | Selectstore sels; | 348 | Selectstore sels; |
346 | folderView->setupFolderselect(&sels); | 349 | folderView->setupFolderselect(&sels); |
347 | if (!sels.exec()) return; | 350 | if (!sels.exec()) return; |
348 | targetMail = sels.currentMail(); | 351 | targetMail = sels.currentMail(); |
349 | targetFolder = sels.currentFolder(); | 352 | targetFolder = sels.currentFolder(); |
350 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 353 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
351 | targetFolder.isEmpty()) | 354 | targetFolder.isEmpty()) |
352 | { | 355 | { |
353 | return; | 356 | return; |
354 | } | 357 | } |
355 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 358 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
356 | { | 359 | { |
357 | QMessageBox::critical(0,tr("Error creating new Folder"), | 360 | QMessageBox::critical(0,tr("Error creating new Folder"), |
358 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 361 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
359 | return; | 362 | return; |
360 | } | 363 | } |
361 | sels.hide(); | 364 | sels.hide(); |
362 | qApp->processEvents(); | 365 | qApp->processEvents(); |
363 | // qDebug("hiding sels "); | 366 | // qDebug("hiding sels "); |
364 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 367 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
365 | folderView->refreshCurrent(); | 368 | folderView->refreshCurrent(); |
366 | } | 369 | } |
367 | 370 | ||
368 | void OpieMail::slotMoveCopyAllMail() | 371 | void OpieMail::slotMoveCopyAllMail() |
369 | { | 372 | { |
370 | 373 | ||
371 | if (!mailView->currentItem()) return; | 374 | if (!mailView->currentItem()) return; |
372 | QValueList<RecMailP> t; | 375 | QValueList<RecMailP> t; |
373 | // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 376 | // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
374 | { | 377 | { |
375 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 378 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
376 | while ( item ) { | 379 | while ( item ) { |
377 | if ( item->isSelected() ) { | 380 | if ( item->isSelected() ) { |
378 | t.append( item->data() ); | 381 | t.append( item->data() ); |
379 | } | 382 | } |
380 | item = (MailListViewItem*)item->nextSibling(); | 383 | item = (MailListViewItem*)item->nextSibling(); |
381 | } | 384 | } |
382 | } | 385 | } |
383 | // else | 386 | // else |
384 | // return; | 387 | // return; |
385 | if ( t.count() == 0 ) | 388 | if ( t.count() == 0 ) |
386 | return; | 389 | return; |
387 | RecMailP mail = t.first(); | 390 | RecMailP mail = t.first(); |
388 | AbstractMail*targetMail = 0; | 391 | AbstractMail*targetMail = 0; |
389 | QString targetFolder = ""; | 392 | QString targetFolder = ""; |
390 | Selectstore sels; | 393 | Selectstore sels; |
391 | folderView->setupFolderselect(&sels); | 394 | folderView->setupFolderselect(&sels); |
392 | if (!sels.exec()) return; | 395 | if (!sels.exec()) return; |
393 | targetMail = sels.currentMail(); | 396 | targetMail = sels.currentMail(); |
394 | targetFolder = sels.currentFolder(); | 397 | targetFolder = sels.currentFolder(); |
395 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 398 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
396 | targetFolder.isEmpty()) | 399 | targetFolder.isEmpty()) |
397 | { | 400 | { |
398 | return; | 401 | return; |
399 | } | 402 | } |
400 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 403 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
401 | { | 404 | { |
402 | QMessageBox::critical(0,tr("Error creating new Folder"), | 405 | QMessageBox::critical(0,tr("Error creating new Folder"), |
403 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 406 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
404 | return; | 407 | return; |
405 | } | 408 | } |
406 | sels.hide(); | 409 | sels.hide(); |
407 | qApp->processEvents(); | 410 | qApp->processEvents(); |
408 | //qDebug("hiding sels "); | 411 | //qDebug("hiding sels "); |
409 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | 412 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); |
410 | folderView->refreshCurrent(); | 413 | folderView->refreshCurrent(); |
411 | } | 414 | } |
412 | 415 | ||
413 | void OpieMail::reEditMail() | 416 | void OpieMail::reEditMail() |
414 | { | 417 | { |
415 | if (!mailView->currentItem()) return; | 418 | if (!mailView->currentItem()) return; |
416 | 419 | ||
417 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 420 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
418 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 421 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
419 | compose.slotAdjustColumns(); | 422 | compose.slotAdjustColumns(); |
420 | compose.showMaximized(); | 423 | compose.showMaximized(); |
421 | compose.exec(); | 424 | compose.exec(); |
422 | } | 425 | } |