-rw-r--r-- | noncore/net/mail/opiemail.cpp | 101 |
1 files changed, 65 insertions, 36 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 0795436..abf93dc 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -1,2 +1,2 @@ | |||
1 | #include <qmessagebox.h> | 1 | |
2 | #include "settingsdialog.h" | 2 | #include "settingsdialog.h" |
@@ -5,13 +5,19 @@ | |||
5 | #include "composemail.h" | 5 | #include "composemail.h" |
6 | #include "mailistviewitem.h" | ||
7 | #include "viewmail.h" | ||
8 | #include "selectstore.h" | ||
9 | #include "selectsmtp.h" | ||
10 | |||
11 | /* OPIE */ | ||
6 | #include <libmailwrapper/smtpwrapper.h> | 12 | #include <libmailwrapper/smtpwrapper.h> |
13 | #include <libmailwrapper/mailtypes.h> | ||
14 | #include <libmailwrapper/abstractmail.h> | ||
7 | #include <qpe/qcopenvelope_qws.h> | 15 | #include <qpe/qcopenvelope_qws.h> |
8 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <qpe/qpeapplication.h> | ||
18 | |||
19 | /* QT */ | ||
20 | #include <qmessagebox.h> | ||
9 | #include <qaction.h> | 21 | #include <qaction.h> |
10 | #include <qapplication.h> | 22 | #include <qapplication.h> |
11 | #include <libmailwrapper/mailtypes.h> | ||
12 | #include <libmailwrapper/abstractmail.h> | ||
13 | #include "mailistviewitem.h" | ||
14 | #include "viewmail.h" | ||
15 | #include "selectstore.h" | ||
16 | #include "selectsmtp.h" | ||
17 | 23 | ||
@@ -33,3 +39,4 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | |||
33 | // copied from old mail2 | 39 | // copied from old mail2 |
34 | if (msg == "writeMail(QString,QString)") { | 40 | if (msg == "writeMail(QString,QString)") |
41 | { | ||
35 | QDataStream stream(data,IO_ReadOnly); | 42 | QDataStream stream(data,IO_ReadOnly); |
@@ -39,3 +46,5 @@ void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | |||
39 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 46 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
40 | } else if (msg == "newMail()") { | 47 | } |
48 | else if (msg == "newMail()") | ||
49 | { | ||
41 | slotComposeMail(); | 50 | slotComposeMail(); |
@@ -47,6 +56,10 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) | |||
47 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 56 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
48 | if (!email.isEmpty()) { | 57 | if (!email.isEmpty()) |
49 | if (!name.isEmpty()) { | 58 | { |
59 | if (!name.isEmpty()) | ||
60 | { | ||
50 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 61 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
51 | } else { | 62 | } |
63 | else | ||
64 | { | ||
52 | compose.setTo(email); | 65 | compose.setTo(email); |
@@ -54,5 +67,4 @@ void OpieMail::slotwriteMail(const QString&name,const QString&email) | |||
54 | } | 67 | } |
55 | compose.showMaximized(); | ||
56 | compose.slotAdjustColumns(); | 68 | compose.slotAdjustColumns(); |
57 | compose.exec(); | 69 | QPEApplication::execDialog( &compose ); |
58 | } | 70 | } |
@@ -74,4 +86,6 @@ void OpieMail::slotSendQueued() | |||
74 | Account *it; | 86 | Account *it; |
75 | for ( it = list.first(); it; it = list.next() ) { | 87 | for ( it = list.first(); it; it = list.next() ) |
76 | if ( it->getType().compare( "SMTP" ) == 0 ) { | 88 | { |
89 | if ( it->getType().compare( "SMTP" ) == 0 ) | ||
90 | { | ||
77 | smtp = static_cast<SMTPaccount *>(it); | 91 | smtp = static_cast<SMTPaccount *>(it); |
@@ -80,3 +94,4 @@ void OpieMail::slotSendQueued() | |||
80 | } | 94 | } |
81 | if (smtpList.count()==0) { | 95 | if (smtpList.count()==0) |
96 | { | ||
82 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); | 97 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); |
@@ -84,5 +99,8 @@ void OpieMail::slotSendQueued() | |||
84 | } | 99 | } |
85 | if (smtpList.count()==1) { | 100 | if (smtpList.count()==1) |
101 | { | ||
86 | smtp = smtpList.at(0); | 102 | smtp = smtpList.at(0); |
87 | } else { | 103 | } |
104 | else | ||
105 | { | ||
88 | smtp = 0; | 106 | smtp = 0; |
@@ -90,4 +108,4 @@ void OpieMail::slotSendQueued() | |||
90 | selsmtp.setSelectionlist(&smtpList); | 108 | selsmtp.setSelectionlist(&smtpList); |
91 | selsmtp.showMaximized(); | 109 | if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) |
92 | if (selsmtp.exec()==QDialog::Accepted) { | 110 | { |
93 | smtp = selsmtp.selected_smtp(); | 111 | smtp = selsmtp.selected_smtp(); |
@@ -95,5 +113,7 @@ void OpieMail::slotSendQueued() | |||
95 | } | 113 | } |
96 | if (smtp) { | 114 | if (smtp) |
115 | { | ||
97 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 116 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
98 | if ( wrap->flushOutbox() ) { | 117 | if ( wrap->flushOutbox() ) |
118 | { | ||
99 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 119 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
@@ -112,4 +132,3 @@ void OpieMail::slotEditSettings() | |||
112 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 132 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
113 | settingsDialog.showMaximized(); | 133 | QPEApplication::execDialog( &settingsDialog ); |
114 | settingsDialog.exec(); | ||
115 | } | 134 | } |
@@ -120,5 +139,4 @@ void OpieMail::slotEditAccounts() | |||
120 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 139 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
121 | eaDialog.showMaximized(); | ||
122 | eaDialog.slotAdjustColumns(); | 140 | eaDialog.slotAdjustColumns(); |
123 | eaDialog.exec(); | 141 | QPEApplication::execDialog( &eaDialog ); |
124 | if ( settings ) delete settings; | 142 | if ( settings ) delete settings; |
@@ -141,5 +159,8 @@ void OpieMail::displayMail() | |||
141 | 159 | ||
142 | if ( readMail.deleted ) { | 160 | if ( readMail.deleted ) |
161 | { | ||
143 | folderView->refreshCurrent(); | 162 | folderView->refreshCurrent(); |
144 | } else { | 163 | } |
164 | else | ||
165 | { | ||
145 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); | 166 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); |
@@ -152,3 +173,4 @@ void OpieMail::slotDeleteMail() | |||
152 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 173 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
153 | 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 ) { | 174 | 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 ) |
175 | { | ||
154 | mail.Wrapper()->deleteMail( mail ); | 176 | mail.Wrapper()->deleteMail( mail ); |
@@ -165,3 +187,4 @@ void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | |||
165 | QPopupMenu *m = new QPopupMenu(0); | 187 | QPopupMenu *m = new QPopupMenu(0); |
166 | if (m) { | 188 | if (m) |
189 | { | ||
167 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 190 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
@@ -178,6 +201,9 @@ void OpieMail::slotShowFolders( bool show ) | |||
178 | qDebug( "Show Folders" ); | 201 | qDebug( "Show Folders" ); |
179 | if ( show && folderView->isHidden() ) { | 202 | if ( show && folderView->isHidden() ) |
203 | { | ||
180 | qDebug( "-> showing" ); | 204 | qDebug( "-> showing" ); |
181 | folderView->show(); | 205 | folderView->show(); |
182 | } else if ( !show && !folderView->isHidden() ) { | 206 | } |
207 | else if ( !show && !folderView->isHidden() ) | ||
208 | { | ||
183 | qDebug( "-> hiding" ); | 209 | qDebug( "-> hiding" ); |
@@ -191,3 +217,4 @@ void OpieMail::refreshMailView(QList<RecMail>*list) | |||
191 | mailView->clear(); | 217 | mailView->clear(); |
192 | for (unsigned int i = 0; i < list->count();++i) { | 218 | for (unsigned int i = 0; i < list->count();++i) |
219 | { | ||
193 | item = new MailListViewItem(mailView,item); | 220 | item = new MailListViewItem(mailView,item); |
@@ -218,6 +245,8 @@ void OpieMail::slotMoveCopyMail() | |||
218 | if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || | 245 | if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || |
219 | targetFolder.isEmpty()) { | 246 | targetFolder.isEmpty()) |
247 | { | ||
220 | return; | 248 | return; |
221 | } | 249 | } |
222 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) { | 250 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
251 | { | ||
223 | QMessageBox::critical(0,tr("Error creating new Folder"), | 252 | QMessageBox::critical(0,tr("Error creating new Folder"), |