-rw-r--r-- | bin/kdepim/WhatsNew.txt | 3 | ||||
-rw-r--r-- | kmicromail/accountview.cpp | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 12 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 5 |
4 files changed, 18 insertions, 7 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index dc22fc6..a9b6c87 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,104 +1,107 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.13 ************ | 3 | ********** VERSION 2.0.13 ************ |
4 | 4 | ||
5 | Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. | 5 | Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. |
6 | 6 | ||
7 | In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". | 7 | In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". |
8 | 8 | ||
9 | OM/Pi: | ||
10 | Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. | ||
11 | |||
9 | ********** VERSION 2.0.12 ************ | 12 | ********** VERSION 2.0.12 ************ |
10 | 13 | ||
11 | KO/Pi: | 14 | KO/Pi: |
12 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. | 15 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. |
13 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. | 16 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. |
14 | Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. | 17 | Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. |
15 | 18 | ||
16 | Fixed problem in pi-sync mode when wrong password was sent. | 19 | Fixed problem in pi-sync mode when wrong password was sent. |
17 | 20 | ||
18 | OM/Pi: | 21 | OM/Pi: |
19 | Fixed a crash when displaying mails with "Show mail as html" was checked in the config. | 22 | Fixed a crash when displaying mails with "Show mail as html" was checked in the config. |
20 | Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. | 23 | Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. |
21 | 24 | ||
22 | ********** VERSION 2.0.11 ************ | 25 | ********** VERSION 2.0.11 ************ |
23 | 26 | ||
24 | Fixed some problems in pi-sync mode | 27 | Fixed some problems in pi-sync mode |
25 | (e.g. details of events were not synced properly) | 28 | (e.g. details of events were not synced properly) |
26 | 29 | ||
27 | ********** VERSION 2.0.10 ************ | 30 | ********** VERSION 2.0.10 ************ |
28 | 31 | ||
29 | KO/Pi: | 32 | KO/Pi: |
30 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. | 33 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. |
31 | This is fixed. | 34 | This is fixed. |
32 | Changed the search dialog a bit to make it more user friendly. | 35 | Changed the search dialog a bit to make it more user friendly. |
33 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). | 36 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). |
34 | 37 | ||
35 | Added config option to hide the week number in KO/Pi toolbar. | 38 | Added config option to hide the week number in KO/Pi toolbar. |
36 | 39 | ||
37 | ********** VERSION 2.0.9 ************ | 40 | ********** VERSION 2.0.9 ************ |
38 | 41 | ||
39 | Made month view icons for multiday events a bit nicer. | 42 | Made month view icons for multiday events a bit nicer. |
40 | Some minor fixes in KO/Pi | 43 | Some minor fixes in KO/Pi |
41 | (e.g. go to today did not work for new week view properly). | 44 | (e.g. go to today did not work for new week view properly). |
42 | 45 | ||
43 | 46 | ||
44 | ********** VERSION 2.0.8 ************ | 47 | ********** VERSION 2.0.8 ************ |
45 | 48 | ||
46 | Fixed a problem in dependency info in the ipk files for the Zaurus. | 49 | Fixed a problem in dependency info in the ipk files for the Zaurus. |
47 | 50 | ||
48 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. | 51 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. |
49 | 52 | ||
50 | Added a "go today" button to the datepicker. | 53 | Added a "go today" button to the datepicker. |
51 | 54 | ||
52 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) | 55 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) |
53 | and made it configureable to show these values. | 56 | and made it configureable to show these values. |
54 | 57 | ||
55 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. | 58 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. |
56 | 59 | ||
57 | 60 | ||
58 | ********** VERSION 2.0.7 ************ | 61 | ********** VERSION 2.0.7 ************ |
59 | 62 | ||
60 | Added global application font settings | 63 | Added global application font settings |
61 | (for all KDE-Pim/Pi apps) to the general settings. | 64 | (for all KDE-Pim/Pi apps) to the general settings. |
62 | 65 | ||
63 | Fixed a problem in OM/Pi when trying to login to some IMAP servers | 66 | Fixed a problem in OM/Pi when trying to login to some IMAP servers |
64 | (like the IMAP server of Apple: mail.mac.com ) | 67 | (like the IMAP server of Apple: mail.mac.com ) |
65 | 68 | ||
66 | Added recurring todos to KO/Pi. | 69 | Added recurring todos to KO/Pi. |
67 | 70 | ||
68 | 71 | ||
69 | ********** VERSION 2.0.6 ************ | 72 | ********** VERSION 2.0.6 ************ |
70 | 73 | ||
71 | Some bugfixes in the pi-sync mode. | 74 | Some bugfixes in the pi-sync mode. |
72 | Added German translation for pi-sync mode. | 75 | Added German translation for pi-sync mode. |
73 | 76 | ||
74 | KO/Pi: | 77 | KO/Pi: |
75 | Made the todolist using alternate background. | 78 | Made the todolist using alternate background. |
76 | 79 | ||
77 | Other minor fixes in KO/Pi. | 80 | Other minor fixes in KO/Pi. |
78 | 81 | ||
79 | 82 | ||
80 | ********** VERSION 2.0.5 ************ | 83 | ********** VERSION 2.0.5 ************ |
81 | 84 | ||
82 | Bugfixes in KO/Pi. | 85 | Bugfixes in KO/Pi. |
83 | 86 | ||
84 | ********** VERSION 2.0.4 ************ | 87 | ********** VERSION 2.0.4 ************ |
85 | 88 | ||
86 | KO/Pi: | 89 | KO/Pi: |
87 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | 90 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. |
88 | 91 | ||
89 | Added a general "select week number" to the toolbar. | 92 | Added a general "select week number" to the toolbar. |
90 | 93 | ||
91 | Fixed some small problem of the new features introduced in version 2.0.3. | 94 | Fixed some small problem of the new features introduced in version 2.0.3. |
92 | 95 | ||
93 | Made it possible to specify one specific category as category color, | 96 | Made it possible to specify one specific category as category color, |
94 | if more than one categories are selected. | 97 | if more than one categories are selected. |
95 | 98 | ||
96 | Fixed a bug in saving colors for categories with non-ascii characters. | 99 | Fixed a bug in saving colors for categories with non-ascii characters. |
97 | (Like, e.g. German Umlauts). | 100 | (Like, e.g. German Umlauts). |
98 | Propably you have to set your colors again for those categories. | 101 | Propably you have to set your colors again for those categories. |
99 | 102 | ||
100 | 103 | ||
101 | ********** VERSION 2.0.3 ************ | 104 | ********** VERSION 2.0.3 ************ |
102 | 105 | ||
103 | KO/Pi: | 106 | KO/Pi: |
104 | Added feature for changing alarm settings for many items at once: | 107 | Added feature for changing alarm settings for many items at once: |
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index 3ad3e9b..e9be224 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -20,194 +20,197 @@ | |||
20 | 20 | ||
21 | using namespace Opie::Core; | 21 | using namespace Opie::Core; |
22 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 22 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
23 | : QListView( parent, name, flags ) | 23 | : QListView( parent, name, flags ) |
24 | { | 24 | { |
25 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 25 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
26 | SLOT( refresh(QListViewItem*) ) ); | 26 | SLOT( refresh(QListViewItem*) ) ); |
27 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 27 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
28 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); | 28 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); |
29 | setSorting(0); | 29 | setSorting(0); |
30 | } | 30 | } |
31 | 31 | ||
32 | AccountView::~AccountView() | 32 | AccountView::~AccountView() |
33 | { | 33 | { |
34 | imapAccounts.clear(); | 34 | imapAccounts.clear(); |
35 | mhAccounts.clear(); | 35 | mhAccounts.clear(); |
36 | } | 36 | } |
37 | 37 | ||
38 | void AccountView::slotContextMenu(int id) | 38 | void AccountView::slotContextMenu(int id) |
39 | { | 39 | { |
40 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 40 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
41 | if (!view) return; | 41 | if (!view) return; |
42 | view->contextMenuSelected(id); | 42 | view->contextMenuSelected(id); |
43 | } | 43 | } |
44 | 44 | ||
45 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 45 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
46 | { | 46 | { |
47 | if (button==1) {return;} | 47 | if (button==1) {return;} |
48 | if (!item) return; | 48 | if (!item) return; |
49 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 49 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
50 | QPopupMenu*m = view->getContextMenu(); | 50 | QPopupMenu*m = view->getContextMenu(); |
51 | if (!m) return; | 51 | if (!m) return; |
52 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 52 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
53 | m->setFocus(); | 53 | m->setFocus(); |
54 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 54 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
55 | delete m; | 55 | delete m; |
56 | } | 56 | } |
57 | 57 | ||
58 | void AccountView::populate( QList<Account> list ) | 58 | void AccountView::populate( QList<Account> list ) |
59 | { | 59 | { |
60 | clear(); | 60 | clear(); |
61 | 61 | ||
62 | imapAccounts.clear(); | 62 | imapAccounts.clear(); |
63 | mhAccounts.clear(); | 63 | mhAccounts.clear(); |
64 | 64 | ||
65 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 65 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
66 | 66 | ||
67 | Account *it; | 67 | Account *it; |
68 | for ( it = list.first(); it; it = list.next() ) | 68 | for ( it = list.first(); it; it = list.next() ) |
69 | { | 69 | { |
70 | if ( it->getType() == MAILLIB::A_IMAP ) | 70 | if ( it->getType() == MAILLIB::A_IMAP ) |
71 | { | 71 | { |
72 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 72 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
73 | imapAccounts.append(new IMAPviewItem( imap, this )); | 73 | imapAccounts.append(new IMAPviewItem( imap, this )); |
74 | } | 74 | } |
75 | else if ( it->getType() == MAILLIB::A_POP3 ) | 75 | else if ( it->getType() == MAILLIB::A_POP3 ) |
76 | { | 76 | { |
77 | POP3account *pop3 = static_cast<POP3account *>(it); | 77 | POP3account *pop3 = static_cast<POP3account *>(it); |
78 | /* must not be hold 'cause it isn't required */ | 78 | /* must not be hold 'cause it isn't required */ |
79 | (void) new POP3viewItem( pop3, this ); | 79 | (void) new POP3viewItem( pop3, this ); |
80 | } | 80 | } |
81 | else if ( it->getType() == MAILLIB::A_NNTP ) | 81 | else if ( it->getType() == MAILLIB::A_NNTP ) |
82 | { | 82 | { |
83 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 83 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
84 | /* must not be hold 'cause it isn't required */ | 84 | /* must not be hold 'cause it isn't required */ |
85 | (void) new NNTPviewItem( nntp, this ); | 85 | (void) new NNTPviewItem( nntp, this ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | void AccountView::refresh(QListViewItem *item) | 90 | void AccountView::refresh(QListViewItem *item) |
91 | { | 91 | { |
92 | if ( item ) | 92 | if ( item ) |
93 | { | 93 | { |
94 | m_currentItem = item; | 94 | m_currentItem = item; |
95 | QValueList<RecMailP> headerlist; | 95 | QValueList<RecMailP> headerlist; |
96 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 96 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
97 | view->refresh(headerlist); | 97 | view->refresh(headerlist); |
98 | emit refreshMailview(headerlist); | 98 | emit refreshMailview(headerlist); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | void AccountView::refreshOutgoing() | 101 | void AccountView::refreshOutgoing() |
102 | { | 102 | { |
103 | m_currentItem = currentItem(); | 103 | m_currentItem = currentItem(); |
104 | if ( !m_currentItem ) return; | 104 | if ( !m_currentItem ) return; |
105 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 105 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
106 | QString bName = view->getFolder()->getDisplayName(); | 106 | QString bName = view->getFolder()->getDisplayName(); |
107 | if (bName.startsWith("/")&&bName.length()>1) | 107 | if (bName.startsWith("/")&&bName.length()>1) |
108 | { | 108 | { |
109 | bName.replace(0,1,""); | 109 | bName.replace(0,1,""); |
110 | } | 110 | } |
111 | int pos = bName.findRev("/"); | 111 | int pos = bName.findRev("/"); |
112 | if (pos > 0) | 112 | if (pos > 0) |
113 | { | 113 | { |
114 | bName.replace(0,pos+1,""); | 114 | bName.replace(0,pos+1,""); |
115 | } | 115 | } |
116 | if ( bName.lower() == "outgoing" ) | 116 | //qDebug("name *%s* ",bName.lower().latin1() ); |
117 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { | ||
117 | refreshCurrent(); | 118 | refreshCurrent(); |
119 | // qDebug("refresh "); | ||
120 | } | ||
118 | } | 121 | } |
119 | 122 | ||
120 | void AccountView::refreshCurrent() | 123 | void AccountView::refreshCurrent() |
121 | { | 124 | { |
122 | m_currentItem = currentItem(); | 125 | m_currentItem = currentItem(); |
123 | if ( !m_currentItem ) return; | 126 | if ( !m_currentItem ) return; |
124 | QValueList<RecMailP> headerlist; | 127 | QValueList<RecMailP> headerlist; |
125 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 128 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
126 | view->refresh(headerlist); | 129 | view->refresh(headerlist); |
127 | emit refreshMailview(headerlist); | 130 | emit refreshMailview(headerlist); |
128 | } | 131 | } |
129 | 132 | ||
130 | void AccountView::refreshAll() | 133 | void AccountView::refreshAll() |
131 | { | 134 | { |
132 | } | 135 | } |
133 | 136 | ||
134 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) | 137 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) |
135 | { | 138 | { |
136 | QListViewItem*item = selectedItem (); | 139 | QListViewItem*item = selectedItem (); |
137 | if (!item) return new RecBody(); | 140 | if (!item) return new RecBody(); |
138 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 141 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
139 | return view->fetchBody(aMail); | 142 | return view->fetchBody(aMail); |
140 | } | 143 | } |
141 | 144 | ||
142 | void AccountView::setupFolderselect(Selectstore*sels) | 145 | void AccountView::setupFolderselect(Selectstore*sels) |
143 | { | 146 | { |
144 | 147 | ||
145 | #ifndef DESKTOP_VERSION | 148 | #ifndef DESKTOP_VERSION |
146 | sels->showMaximized(); | 149 | sels->showMaximized(); |
147 | #else | 150 | #else |
148 | sels->show(); | 151 | sels->show(); |
149 | #endif | 152 | #endif |
150 | QStringList sFolders; | 153 | QStringList sFolders; |
151 | unsigned int i = 0; | 154 | unsigned int i = 0; |
152 | for (i=0; i < mhAccounts.count();++i) | 155 | for (i=0; i < mhAccounts.count();++i) |
153 | { | 156 | { |
154 | mhAccounts[i]->refresh(false); | 157 | mhAccounts[i]->refresh(false); |
155 | sFolders = mhAccounts[i]->subFolders(); | 158 | sFolders = mhAccounts[i]->subFolders(); |
156 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 159 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
157 | } | 160 | } |
158 | for (i=0; i < imapAccounts.count();++i) | 161 | for (i=0; i < imapAccounts.count();++i) |
159 | { | 162 | { |
160 | if (imapAccounts[i]->offline()) | 163 | if (imapAccounts[i]->offline()) |
161 | continue; | 164 | continue; |
162 | imapAccounts[i]->refreshFolders(false); | 165 | imapAccounts[i]->refreshFolders(false); |
163 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 166 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
164 | } | 167 | } |
165 | } | 168 | } |
166 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) | 169 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) |
167 | { | 170 | { |
168 | #if 0 | 171 | #if 0 |
169 | AbstractMail*targetMail = 0; | 172 | AbstractMail*targetMail = 0; |
170 | QString targetFolder = ""; | 173 | QString targetFolder = ""; |
171 | Selectstore sels; | 174 | Selectstore sels; |
172 | setupFolderselect(&sels); | 175 | setupFolderselect(&sels); |
173 | if (!sels.exec()) return; | 176 | if (!sels.exec()) return; |
174 | targetMail = sels.currentMail(); | 177 | targetMail = sels.currentMail(); |
175 | targetFolder = sels.currentFolder(); | 178 | targetFolder = sels.currentFolder(); |
176 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 179 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
177 | targetFolder.isEmpty()) | 180 | targetFolder.isEmpty()) |
178 | { | 181 | { |
179 | return; | 182 | return; |
180 | } | 183 | } |
181 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 184 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
182 | { | 185 | { |
183 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 186 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
184 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 187 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
185 | return; | 188 | return; |
186 | } | 189 | } |
187 | int maxsize = 0; | 190 | int maxsize = 0; |
188 | if ( sels.useSize->isChecked()) | 191 | if ( sels.useSize->isChecked()) |
189 | maxsize = sels.sizeSpinBox->value(); | 192 | maxsize = sels.sizeSpinBox->value(); |
190 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); | 193 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); |
191 | #endif | 194 | #endif |
192 | fromWrapper->downloadNewMails( fromFolder, mhAccounts[0]->getWrapper()); | 195 | fromWrapper->downloadNewMails( fromFolder, mhAccounts[0]->getWrapper()); |
193 | refreshCurrent(); | 196 | refreshCurrent(); |
194 | 197 | ||
195 | } | 198 | } |
196 | 199 | ||
197 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) | 200 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) |
198 | { | 201 | { |
199 | AbstractMail*targetMail = 0; | 202 | AbstractMail*targetMail = 0; |
200 | QString targetFolder = ""; | 203 | QString targetFolder = ""; |
201 | Selectstore sels; | 204 | Selectstore sels; |
202 | setupFolderselect(&sels); | 205 | setupFolderselect(&sels); |
203 | if (!sels.exec()) return; | 206 | if (!sels.exec()) return; |
204 | targetMail = sels.currentMail(); | 207 | targetMail = sels.currentMail(); |
205 | targetFolder = sels.currentFolder(); | 208 | targetFolder = sels.currentFolder(); |
206 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 209 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
207 | targetFolder.isEmpty()) | 210 | targetFolder.isEmpty()) |
208 | { | 211 | { |
209 | return; | 212 | return; |
210 | } | 213 | } |
211 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 214 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
212 | { | 215 | { |
213 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 216 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index 24f4786..5096f67 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp | |||
@@ -1,142 +1,143 @@ | |||
1 | #include "smtpwrapper.h" | 1 | #include "smtpwrapper.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | #include "abstractmail.h" | 3 | #include "abstractmail.h" |
4 | #include "logindialog.h" | 4 | #include "logindialog.h" |
5 | #include "mailtypes.h" | 5 | #include "mailtypes.h" |
6 | #include "sendmailprogress.h" | 6 | #include "sendmailprogress.h" |
7 | 7 | ||
8 | //#include <opie2/odebug.h> | 8 | //#include <opie2/odebug.h> |
9 | //#include <qt.h> | 9 | //#include <qt.h> |
10 | #include <qapplication.h> | 10 | #include <qapplication.h> |
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | #include <stdlib.h> | 12 | #include <stdlib.h> |
13 | #ifndef DESKTOP_VERSION | 13 | #ifndef DESKTOP_VERSION |
14 | //#include <qpe/config.h> | 14 | //#include <qpe/config.h> |
15 | #include <qpe/qcopenvelope_qws.h> | 15 | #include <qpe/qcopenvelope_qws.h> |
16 | #endif | 16 | #endif |
17 | #include <libetpan/libetpan.h> | 17 | #include <libetpan/libetpan.h> |
18 | #include <klocale.h> | 18 | #include <klocale.h> |
19 | #include <kglobal.h> | 19 | #include <kglobal.h> |
20 | #include <kconfig.h> | 20 | #include <kconfig.h> |
21 | 21 | ||
22 | 22 | ||
23 | using namespace Opie::Core; | 23 | using namespace Opie::Core; |
24 | progressMailSend*SMTPwrapper::sendProgress = 0; | 24 | progressMailSend*SMTPwrapper::sendProgress = 0; |
25 | 25 | ||
26 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) | 26 | SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) |
27 | : Generatemail() | 27 | : Generatemail() |
28 | { | 28 | { |
29 | m_SmtpAccount = aSmtp; | 29 | m_SmtpAccount = aSmtp; |
30 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); | 30 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); |
31 | cfg.setGroup( "Status" ); | 31 | cfg.setGroup( "Status" ); |
32 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); | 32 | m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); |
33 | emit queuedMails( m_queuedMail ); | 33 | emit queuedMails( m_queuedMail ); |
34 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); | 34 | connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); |
35 | m_smtp = 0; | 35 | m_smtp = 0; |
36 | } | 36 | } |
37 | 37 | ||
38 | SMTPwrapper::~SMTPwrapper() | 38 | SMTPwrapper::~SMTPwrapper() |
39 | { | 39 | { |
40 | disc_server(); | 40 | disc_server(); |
41 | } | 41 | } |
42 | 42 | ||
43 | void SMTPwrapper::emitQCop( int queued ) { | 43 | void SMTPwrapper::emitQCop( int queued ) { |
44 | #ifndef DESKTOP_VERSION | 44 | #ifndef DESKTOP_VERSION |
45 | QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); | 45 | // LR : not used in kde-pim |
46 | env << queued; | 46 | //QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); |
47 | //env << queued; | ||
47 | #endif | 48 | #endif |
48 | } | 49 | } |
49 | 50 | ||
50 | QString SMTPwrapper::mailsmtpError( int errnum ) { | 51 | QString SMTPwrapper::mailsmtpError( int errnum ) { |
51 | switch ( errnum ) { | 52 | switch ( errnum ) { |
52 | case MAILSMTP_NO_ERROR: | 53 | case MAILSMTP_NO_ERROR: |
53 | return i18n( "No error" ); | 54 | return i18n( "No error" ); |
54 | case MAILSMTP_ERROR_UNEXPECTED_CODE: | 55 | case MAILSMTP_ERROR_UNEXPECTED_CODE: |
55 | return i18n( "Unexpected error code" ); | 56 | return i18n( "Unexpected error code" ); |
56 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: | 57 | case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: |
57 | return i18n( "Service not available" ); | 58 | return i18n( "Service not available" ); |
58 | case MAILSMTP_ERROR_STREAM: | 59 | case MAILSMTP_ERROR_STREAM: |
59 | return i18n( "Stream error" ); | 60 | return i18n( "Stream error" ); |
60 | case MAILSMTP_ERROR_HOSTNAME: | 61 | case MAILSMTP_ERROR_HOSTNAME: |
61 | return i18n( "gethostname() failed" ); | 62 | return i18n( "gethostname() failed" ); |
62 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: | 63 | case MAILSMTP_ERROR_NOT_IMPLEMENTED: |
63 | return i18n( "Not implemented" ); | 64 | return i18n( "Not implemented" ); |
64 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: | 65 | case MAILSMTP_ERROR_ACTION_NOT_TAKEN: |
65 | return i18n( "Error, action not taken" ); | 66 | return i18n( "Error, action not taken" ); |
66 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: | 67 | case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: |
67 | return i18n( "Data exceeds storage allocation" ); | 68 | return i18n( "Data exceeds storage allocation" ); |
68 | case MAILSMTP_ERROR_IN_PROCESSING: | 69 | case MAILSMTP_ERROR_IN_PROCESSING: |
69 | return i18n( "Error in processing" ); | 70 | return i18n( "Error in processing" ); |
70 | case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: | 71 | case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: |
71 | return i18n( "Starttls not supported" ); | 72 | return i18n( "Starttls not supported" ); |
72 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: | 73 | // case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE: |
73 | // return i18n( "Insufficient system storage" ); | 74 | // return i18n( "Insufficient system storage" ); |
74 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: | 75 | case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE: |
75 | return i18n( "Mailbox unavailable" ); | 76 | return i18n( "Mailbox unavailable" ); |
76 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: | 77 | case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED: |
77 | return i18n( "Mailbox name not allowed" ); | 78 | return i18n( "Mailbox name not allowed" ); |
78 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: | 79 | case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND: |
79 | return i18n( "Bad command sequence" ); | 80 | return i18n( "Bad command sequence" ); |
80 | case MAILSMTP_ERROR_USER_NOT_LOCAL: | 81 | case MAILSMTP_ERROR_USER_NOT_LOCAL: |
81 | return i18n( "User not local" ); | 82 | return i18n( "User not local" ); |
82 | case MAILSMTP_ERROR_TRANSACTION_FAILED: | 83 | case MAILSMTP_ERROR_TRANSACTION_FAILED: |
83 | return i18n( "Transaction failed" ); | 84 | return i18n( "Transaction failed" ); |
84 | case MAILSMTP_ERROR_MEMORY: | 85 | case MAILSMTP_ERROR_MEMORY: |
85 | return i18n( "Memory error" ); | 86 | return i18n( "Memory error" ); |
86 | case MAILSMTP_ERROR_CONNECTION_REFUSED: | 87 | case MAILSMTP_ERROR_CONNECTION_REFUSED: |
87 | return i18n( "Connection refused" ); | 88 | return i18n( "Connection refused" ); |
88 | default: | 89 | default: |
89 | return i18n( "Unknown error code" ); | 90 | return i18n( "Unknown error code" ); |
90 | } | 91 | } |
91 | } | 92 | } |
92 | 93 | ||
93 | 94 | ||
94 | void SMTPwrapper::progress( size_t current, size_t maximum ) { | 95 | void SMTPwrapper::progress( size_t current, size_t maximum ) { |
95 | if (SMTPwrapper::sendProgress) { | 96 | if (SMTPwrapper::sendProgress) { |
96 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); | 97 | SMTPwrapper::sendProgress->setSingleMail(current, maximum ); |
97 | qApp->processEvents(); | 98 | qApp->processEvents(); |
98 | } | 99 | } |
99 | } | 100 | } |
100 | 101 | ||
101 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { | 102 | void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { |
102 | if (!mail) | 103 | if (!mail) |
103 | return; | 104 | return; |
104 | QString localfolders = AbstractMail::defaultLocalfolder(); | 105 | QString localfolders = AbstractMail::defaultLocalfolder(); |
105 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 106 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
106 | wrap->createMbox(box); | 107 | wrap->createMbox(box); |
107 | wrap->storeMessage(mail,length,box); | 108 | wrap->storeMessage(mail,length,box); |
108 | delete wrap; | 109 | delete wrap; |
109 | } | 110 | } |
110 | 111 | ||
111 | bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { | 112 | bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { |
112 | clist *rcpts = 0; | 113 | clist *rcpts = 0; |
113 | char *from, *data; | 114 | char *from, *data; |
114 | size_t size; | 115 | size_t size; |
115 | 116 | ||
116 | from = data = 0; | 117 | from = data = 0; |
117 | 118 | ||
118 | mailmessage * msg = 0; | 119 | mailmessage * msg = 0; |
119 | msg = mime_message_init(mail); | 120 | msg = mime_message_init(mail); |
120 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | 121 | mime_message_set_tmpdir(msg,getenv( "HOME" )); |
121 | int r = mailmessage_fetch(msg,&data,&size); | 122 | int r = mailmessage_fetch(msg,&data,&size); |
122 | mime_message_detach_mime(msg); | 123 | mime_message_detach_mime(msg); |
123 | mailmessage_free(msg); | 124 | mailmessage_free(msg); |
124 | if (r != MAIL_NO_ERROR || !data) { | 125 | if (r != MAIL_NO_ERROR || !data) { |
125 | if (data) | 126 | if (data) |
126 | free(data); | 127 | free(data); |
127 | qDebug("Error fetching mime... "); | 128 | qDebug("Error fetching mime... "); |
128 | return false; | 129 | return false; |
129 | } | 130 | } |
130 | msg = 0; | 131 | msg = 0; |
131 | if (later) { | 132 | if (later) { |
132 | storeMail(data,size,"Outgoing"); | 133 | storeMail(data,size,"Outgoing"); |
133 | if (data) | 134 | if (data) |
134 | free( data ); | 135 | free( data ); |
135 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); | 136 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); |
136 | cfg.setGroup( "Status" ); | 137 | cfg.setGroup( "Status" ); |
137 | cfg.writeEntry( "outgoing", ++m_queuedMail ); | 138 | cfg.writeEntry( "outgoing", ++m_queuedMail ); |
138 | emit queuedMails( m_queuedMail ); | 139 | emit queuedMails( m_queuedMail ); |
139 | return true; | 140 | return true; |
140 | } | 141 | } |
141 | from = getFrom( mail ); | 142 | from = getFrom( mail ); |
142 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); | 143 | rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); |
@@ -348,123 +349,122 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later | |||
348 | return result; | 349 | return result; |
349 | } | 350 | } |
350 | 351 | ||
351 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { | 352 | int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { |
352 | size_t curTok = 0; | 353 | size_t curTok = 0; |
353 | mailimf_fields *fields = 0; | 354 | mailimf_fields *fields = 0; |
354 | mailimf_field*ffrom = 0; | 355 | mailimf_field*ffrom = 0; |
355 | clist *rcpts = 0; | 356 | clist *rcpts = 0; |
356 | char*from = 0; | 357 | char*from = 0; |
357 | int res = 0; | 358 | int res = 0; |
358 | 359 | ||
359 | encodedString * data = wrap->fetchRawBody(which); | 360 | encodedString * data = wrap->fetchRawBody(which); |
360 | if (!data) | 361 | if (!data) |
361 | return 0; | 362 | return 0; |
362 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); | 363 | int err = mailimf_fields_parse( data->Content(), data->Length(), &curTok, &fields ); |
363 | if (err != MAILIMF_NO_ERROR) { | 364 | if (err != MAILIMF_NO_ERROR) { |
364 | delete data; | 365 | delete data; |
365 | delete wrap; | 366 | delete wrap; |
366 | return 0; | 367 | return 0; |
367 | } | 368 | } |
368 | 369 | ||
369 | rcpts = createRcptList( fields ); | 370 | rcpts = createRcptList( fields ); |
370 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); | 371 | ffrom = getField(fields, MAILIMF_FIELD_FROM ); |
371 | from = getFrom(ffrom); | 372 | from = getFrom(ffrom); |
372 | 373 | ||
373 | if (rcpts && from) { | 374 | if (rcpts && from) { |
374 | res = smtpSend(from,rcpts,data->Content(),data->Length()); | 375 | res = smtpSend(from,rcpts,data->Content(),data->Length()); |
375 | } | 376 | } |
376 | if (fields) { | 377 | if (fields) { |
377 | mailimf_fields_free(fields); | 378 | mailimf_fields_free(fields); |
378 | fields = 0; | 379 | fields = 0; |
379 | } | 380 | } |
380 | if (data) { | 381 | if (data) { |
381 | delete data; | 382 | delete data; |
382 | } | 383 | } |
383 | if (from) { | 384 | if (from) { |
384 | free(from); | 385 | free(from); |
385 | } | 386 | } |
386 | if (rcpts) { | 387 | if (rcpts) { |
387 | smtp_address_list_free( rcpts ); | 388 | smtp_address_list_free( rcpts ); |
388 | } | 389 | } |
389 | return res; | 390 | return res; |
390 | } | 391 | } |
391 | 392 | ||
392 | /* this is a special fun */ | 393 | /* this is a special fun */ |
393 | bool SMTPwrapper::flushOutbox() { | 394 | bool SMTPwrapper::flushOutbox() { |
394 | bool returnValue = true; | 395 | bool returnValue = true; |
395 | 396 | ||
396 | ; // odebug << "Sending the queue" << oendl; | 397 | ; // odebug << "Sending the queue" << oendl; |
397 | if (!m_SmtpAccount) { | 398 | if (!m_SmtpAccount) { |
398 | ; // odebug << "No smtp account given" << oendl; | 399 | ; // odebug << "No smtp account given" << oendl; |
399 | return false; | 400 | return false; |
400 | } | 401 | } |
401 | 402 | ||
402 | bool reset_user_value = false; | 403 | bool reset_user_value = false; |
403 | QString localfolders = AbstractMail::defaultLocalfolder(); | 404 | QString localfolders = AbstractMail::defaultLocalfolder(); |
404 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); | 405 | AbstractMail*wrap = AbstractMail::getWrapper(localfolders); |
405 | if (!wrap) { | 406 | if (!wrap) { |
406 | ; // odebug << "memory error" << oendl; | 407 | ; // odebug << "memory error" << oendl; |
407 | return false; | 408 | return false; |
408 | } | 409 | } |
409 | QString oldPw, oldUser; | 410 | QString oldPw, oldUser; |
410 | QValueList<RecMailP> mailsToSend; | 411 | QValueList<RecMailP> mailsToSend; |
411 | QValueList<RecMailP> mailsToRemove; | 412 | QValueList<RecMailP> mailsToRemove; |
412 | QString mbox("Outgoing"); | 413 | QString mbox("Outgoing"); |
413 | wrap->listMessages(mbox,mailsToSend); | 414 | wrap->listMessages(mbox,mailsToSend); |
414 | if (mailsToSend.count()==0) { | 415 | if (mailsToSend.count()==0) { |
415 | delete wrap; | 416 | delete wrap; |
416 | ; // odebug << "No mails to send" << oendl; | 417 | ; // odebug << "No mails to send" << oendl; |
417 | return false; | 418 | return false; |
418 | } | 419 | } |
419 | 420 | ||
420 | oldPw = m_SmtpAccount->getPassword(); | 421 | oldPw = m_SmtpAccount->getPassword(); |
421 | oldUser = m_SmtpAccount->getUser(); | 422 | oldUser = m_SmtpAccount->getUser(); |
422 | if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { | 423 | if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { |
423 | // get'em | 424 | // get'em |
424 | QString user,pass; | 425 | QString user,pass; |
425 | LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); | 426 | LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); |
426 | login.show(); | 427 | login.show(); |
427 | if ( QDialog::Accepted == login.exec() ) { | 428 | if ( QDialog::Accepted == login.exec() ) { |
428 | // ok | 429 | // ok |
429 | user = login.getUser().latin1(); | 430 | user = login.getUser().latin1(); |
430 | pass = login.getPassword().latin1(); | 431 | pass = login.getPassword().latin1(); |
431 | reset_user_value = true; | 432 | reset_user_value = true; |
432 | m_SmtpAccount->setUser(user); | 433 | m_SmtpAccount->setUser(user); |
433 | m_SmtpAccount->setPassword(pass); | 434 | m_SmtpAccount->setPassword(pass); |
434 | } else { | 435 | } else { |
435 | return true; | 436 | return true; |
436 | } | 437 | } |
437 | } | 438 | } |
438 | 439 | ||
439 | 440 | ||
440 | sendProgress = new progressMailSend(); | 441 | sendProgress = new progressMailSend(); |
441 | sendProgress->show(); | 442 | sendProgress->show(); |
442 | sendProgress->setMaxMails(mailsToSend.count()); | 443 | sendProgress->setMaxMails(mailsToSend.count()); |
443 | 444 | ||
444 | while (mailsToSend.count()>0) { | 445 | while (returnValue && mailsToSend.count()>0) { |
445 | if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { | 446 | if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { |
446 | QMessageBox::critical(0,i18n("Error sending mail"), | 447 | QMessageBox::critical(0,i18n("Error sending mail"), |
447 | i18n("Error sending queued mail - breaking")); | 448 | i18n("Error sending queued mail.\nBreaking.")); |
448 | returnValue = false; | 449 | returnValue = false; |
449 | break; | ||
450 | } | 450 | } |
451 | mailsToRemove.append((*mailsToSend.begin())); | 451 | mailsToRemove.append((*mailsToSend.begin())); |
452 | mailsToSend.remove(mailsToSend.begin()); | 452 | mailsToSend.remove(mailsToSend.begin()); |
453 | sendProgress->setCurrentMails(mailsToRemove.count()); | 453 | sendProgress->setCurrentMails(mailsToRemove.count()); |
454 | } | 454 | } |
455 | if (reset_user_value) { | 455 | if (reset_user_value) { |
456 | m_SmtpAccount->setUser(oldUser); | 456 | m_SmtpAccount->setUser(oldUser); |
457 | m_SmtpAccount->setPassword(oldPw); | 457 | m_SmtpAccount->setPassword(oldPw); |
458 | } | 458 | } |
459 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); | 459 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); |
460 | cfg.setGroup( "Status" ); | 460 | cfg.setGroup( "Status" ); |
461 | m_queuedMail = 0; | 461 | m_queuedMail = mailsToSend.count(); |
462 | cfg.writeEntry( "outgoing", m_queuedMail ); | 462 | cfg.writeEntry( "outgoing", m_queuedMail ); |
463 | emit queuedMails( m_queuedMail ); | 463 | emit queuedMails( m_queuedMail ); |
464 | sendProgress->hide(); | 464 | sendProgress->hide(); |
465 | delete sendProgress; | 465 | delete sendProgress; |
466 | sendProgress = 0; | 466 | sendProgress = 0; |
467 | wrap->deleteMails(mbox,mailsToRemove); | 467 | wrap->deleteMails(mbox,mailsToRemove); |
468 | delete wrap; | 468 | delete wrap; |
469 | return returnValue; | 469 | return returnValue; |
470 | } | 470 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index f68467c..197f7ec 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -50,363 +50,366 @@ OpieMail::OpieMail( QWidget *parent, const char *name ) | |||
50 | settings = new Settings(); | 50 | settings = new Settings(); |
51 | tb = 0; | 51 | tb = 0; |
52 | setIcon(SmallIcon( "kmicromail" ) ); | 52 | setIcon(SmallIcon( "kmicromail" ) ); |
53 | folderView->populate( settings->getAccounts() ); | 53 | folderView->populate( settings->getAccounts() ); |
54 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 54 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
55 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 55 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
56 | } | 56 | } |
57 | 57 | ||
58 | OpieMail::~OpieMail() | 58 | OpieMail::~OpieMail() |
59 | { | 59 | { |
60 | if (settings) delete settings; | 60 | if (settings) delete settings; |
61 | if ( tb ) | 61 | if ( tb ) |
62 | delete tb; | 62 | delete tb; |
63 | } | 63 | } |
64 | 64 | ||
65 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 65 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
66 | { | 66 | { |
67 | 67 | ||
68 | } | 68 | } |
69 | #include <stdlib.h> | 69 | #include <stdlib.h> |
70 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 70 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
71 | { | 71 | { |
72 | // copied from old mail2 | 72 | // copied from old mail2 |
73 | static int ii = 0; | 73 | static int ii = 0; |
74 | //qDebug("QCOP CALL ############################# %d ", ii); | 74 | //qDebug("QCOP CALL ############################# %d ", ii); |
75 | //QString mess ( msg ); | 75 | //QString mess ( msg ); |
76 | //qDebug("Message = %s ",mess.latin1()); | 76 | //qDebug("Message = %s ",mess.latin1()); |
77 | ++ii; | 77 | ++ii; |
78 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 78 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
79 | 79 | ||
80 | mPendingEmail = QString::null; | 80 | mPendingEmail = QString::null; |
81 | mPendingName = QString::null; | 81 | mPendingName = QString::null; |
82 | if (msg == "writeMail(QString,QString)") | 82 | if (msg == "writeMail(QString,QString)") |
83 | { | 83 | { |
84 | //qDebug("writeMail(QString,QString) "); | 84 | //qDebug("writeMail(QString,QString) "); |
85 | QDataStream stream(data,IO_ReadOnly); | 85 | QDataStream stream(data,IO_ReadOnly); |
86 | stream >> mPendingName >> mPendingEmail; | 86 | stream >> mPendingName >> mPendingEmail; |
87 | // removing the whitespaces at beginning and end is needed! | 87 | // removing the whitespaces at beginning and end is needed! |
88 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 88 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
89 | } | 89 | } |
90 | else if (msg == "newMail()") | 90 | else if (msg == "newMail()") |
91 | { | 91 | { |
92 | //qDebug("slotComposeMail() "); | 92 | //qDebug("slotComposeMail() "); |
93 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | 93 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call |
94 | // and a QCOP call does not like a processevents in his execution | 94 | // and a QCOP call does not like a processevents in his execution |
95 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | 95 | // with the Qtimer we call slotComposeMail() after we reached the main event loop |
96 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 96 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
97 | // slotComposeMail(); | 97 | // slotComposeMail(); |
98 | } | 98 | } |
99 | else if (msg == "newMail(QString)") | 99 | else if (msg == "newMail(QString)") |
100 | { | 100 | { |
101 | //qDebug(" newMail(QString)"); | 101 | //qDebug(" newMail(QString)"); |
102 | QDataStream stream(data,IO_ReadOnly); | 102 | QDataStream stream(data,IO_ReadOnly); |
103 | stream >> mPendingName; | 103 | stream >> mPendingName; |
104 | // the format is | 104 | // the format is |
105 | // NAME <EMAIL>:SUBJECT | 105 | // NAME <EMAIL>:SUBJECT |
106 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 106 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
107 | } else { | 107 | } else { |
108 | mPendingData = data; | 108 | mPendingData = data; |
109 | mPendingMessage = msg; | 109 | mPendingMessage = msg; |
110 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); | 110 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); |
111 | } | 111 | } |
112 | 112 | ||
113 | //qDebug("END OpieMail::message "); | 113 | //qDebug("END OpieMail::message "); |
114 | } | 114 | } |
115 | void OpieMail::slotExtAppHandler() | 115 | void OpieMail::slotExtAppHandler() |
116 | { | 116 | { |
117 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); | 117 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); |
118 | } | 118 | } |
119 | void OpieMail::slotwriteMail2(const QString& namemail ) | 119 | void OpieMail::slotwriteMail2(const QString& namemail ) |
120 | { | 120 | { |
121 | //qDebug("OpieMail::slotwriteMail2 "); | 121 | //qDebug("OpieMail::slotwriteMail2 "); |
122 | //qApp->processEvents(); | 122 | //qApp->processEvents(); |
123 | ComposeMail compose( settings, this, 0, true ); | 123 | ComposeMail compose( settings, this, 0, true ); |
124 | if ( !namemail.isEmpty() ) { | 124 | if ( !namemail.isEmpty() ) { |
125 | QString to = namemail; | 125 | QString to = namemail; |
126 | if ( namemail.find( " <") > 1 ) { | 126 | if ( namemail.find( " <") > 1 ) { |
127 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 127 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
128 | } else | 128 | } else |
129 | if ( namemail.find( "<") > 1 ) { | 129 | if ( namemail.find( "<") > 1 ) { |
130 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 130 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
131 | } | 131 | } |
132 | int sub = to.find( ">:"); | 132 | int sub = to.find( ">:"); |
133 | if ( sub > 0 ) { | 133 | if ( sub > 0 ) { |
134 | compose.setTo( to.left(sub+1) ); | 134 | compose.setTo( to.left(sub+1) ); |
135 | compose.setSubject( to.mid(sub+2) ); | 135 | compose.setSubject( to.mid(sub+2) ); |
136 | } else | 136 | } else |
137 | compose.setTo( to ); | 137 | compose.setTo( to ); |
138 | } | 138 | } |
139 | compose.slotAdjustColumns(); | 139 | compose.slotAdjustColumns(); |
140 | #ifndef DESKTOP_VERSION | 140 | #ifndef DESKTOP_VERSION |
141 | compose.showMaximized(); | 141 | compose.showMaximized(); |
142 | #endif | 142 | #endif |
143 | mCurrentComposer = &compose; | 143 | mCurrentComposer = &compose; |
144 | compose.exec(); | 144 | compose.exec(); |
145 | mCurrentComposer = 0; | 145 | mCurrentComposer = 0; |
146 | folderView->refreshOutgoing(); | ||
146 | raise(); | 147 | raise(); |
147 | //qDebug("retttich "); | 148 | //qDebug("retttich "); |
148 | } | 149 | } |
149 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 150 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
150 | { | 151 | { |
151 | // qDebug("OpieMail::slotwriteMail "); | 152 | // qDebug("OpieMail::slotwriteMail "); |
152 | ComposeMail compose( settings, this, 0, true ); | 153 | ComposeMail compose( settings, this, 0, true ); |
153 | if (!email.isEmpty()) | 154 | if (!email.isEmpty()) |
154 | { | 155 | { |
155 | if (!name.isEmpty()) | 156 | if (!name.isEmpty()) |
156 | { | 157 | { |
157 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 158 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
158 | } | 159 | } |
159 | else | 160 | else |
160 | { | 161 | { |
161 | compose.setTo(email); | 162 | compose.setTo(email); |
162 | } | 163 | } |
163 | } | 164 | } |
164 | compose.slotAdjustColumns(); | 165 | compose.slotAdjustColumns(); |
165 | #ifndef DESKTOP_VERSION | 166 | #ifndef DESKTOP_VERSION |
166 | compose.showMaximized(); | 167 | compose.showMaximized(); |
167 | #endif | 168 | #endif |
168 | 169 | ||
169 | mCurrentComposer = &compose; | 170 | mCurrentComposer = &compose; |
170 | compose.exec(); | 171 | compose.exec(); |
171 | mCurrentComposer = 0; | 172 | mCurrentComposer = 0; |
173 | folderView->refreshOutgoing(); | ||
172 | raise(); | 174 | raise(); |
173 | } | 175 | } |
174 | 176 | ||
175 | void OpieMail::slotComposeMail() | 177 | void OpieMail::slotComposeMail() |
176 | { | 178 | { |
177 | if ( mPendingEmail == QString::null && mPendingName == QString::null) | 179 | if ( mPendingEmail == QString::null && mPendingName == QString::null) |
178 | slotwriteMail2( QString () ); | 180 | slotwriteMail2( QString () ); |
179 | else { | 181 | else { |
180 | if ( mPendingEmail == QString::null ) | 182 | if ( mPendingEmail == QString::null ) |
181 | slotwriteMail2( mPendingName ); | 183 | slotwriteMail2( mPendingName ); |
182 | else | 184 | else |
183 | slotwriteMail( mPendingName, mPendingEmail ); | 185 | slotwriteMail( mPendingName, mPendingEmail ); |
184 | } | 186 | } |
185 | //slotwriteMail(0l,0l); | 187 | //slotwriteMail(0l,0l); |
186 | } | 188 | } |
187 | 189 | ||
188 | void OpieMail::slotSendQueued() | 190 | void OpieMail::slotSendQueued() |
189 | { | 191 | { |
190 | SMTPaccount *smtp = 0; | 192 | SMTPaccount *smtp = 0; |
191 | 193 | ||
192 | QList<Account> list = settings->getAccounts(); | 194 | QList<Account> list = settings->getAccounts(); |
193 | QList<SMTPaccount> smtpList; | 195 | QList<SMTPaccount> smtpList; |
194 | smtpList.setAutoDelete(false); | 196 | smtpList.setAutoDelete(false); |
195 | Account *it; | 197 | Account *it; |
196 | for ( it = list.first(); it; it = list.next() ) | 198 | for ( it = list.first(); it; it = list.next() ) |
197 | { | 199 | { |
198 | if ( it->getType() == MAILLIB::A_SMTP ) | 200 | if ( it->getType() == MAILLIB::A_SMTP ) |
199 | { | 201 | { |
200 | smtp = static_cast<SMTPaccount *>(it); | 202 | smtp = static_cast<SMTPaccount *>(it); |
201 | smtpList.append(smtp); | 203 | smtpList.append(smtp); |
202 | } | 204 | } |
203 | } | 205 | } |
204 | if (smtpList.count()==0) | 206 | if (smtpList.count()==0) |
205 | { | 207 | { |
206 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); | 208 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); |
207 | return; | 209 | return; |
208 | } | 210 | } |
209 | if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) | 211 | if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
210 | return; | 212 | return; |
211 | if (smtpList.count()==1) | 213 | if (smtpList.count()==1) |
212 | { | 214 | { |
213 | smtp = smtpList.at(0); | 215 | smtp = smtpList.at(0); |
214 | } | 216 | } |
215 | else | 217 | else |
216 | { | 218 | { |
217 | smtp = 0; | 219 | smtp = 0; |
218 | selectsmtp selsmtp; | 220 | selectsmtp selsmtp; |
219 | selsmtp.setSelectionlist(&smtpList); | 221 | selsmtp.setSelectionlist(&smtpList); |
220 | #ifndef DESKTOP_VERSION | 222 | #ifndef DESKTOP_VERSION |
221 | selsmtp.showMaximized(); | 223 | selsmtp.showMaximized(); |
222 | #endif | 224 | #endif |
223 | if ( selsmtp.exec() == QDialog::Accepted ) | 225 | if ( selsmtp.exec() == QDialog::Accepted ) |
224 | { | 226 | { |
225 | smtp = selsmtp.selected_smtp(); | 227 | smtp = selsmtp.selected_smtp(); |
226 | } | 228 | } |
227 | } | 229 | } |
228 | if (smtp) | 230 | if (smtp) |
229 | { | 231 | { |
230 | 232 | ||
231 | Global::statusMessage("Sending mails...!"); | 233 | Global::statusMessage("Sending mails...!"); |
232 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 234 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
233 | if ( wrap->flushOutbox() ) | 235 | if ( wrap->flushOutbox() ) |
234 | { | 236 | { |
235 | Global::statusMessage("Mails sent!"); | 237 | Global::statusMessage("Mails sent!"); |
236 | } | 238 | } |
237 | delete wrap; | 239 | delete wrap; |
238 | } | 240 | } |
239 | folderView->refreshOutgoing(); | 241 | folderView->refreshOutgoing(); |
240 | } | 242 | } |
241 | 243 | ||
242 | void OpieMail::slotSearchMails() | 244 | void OpieMail::slotSearchMails() |
243 | { | 245 | { |
244 | qDebug("OpieMail::slotSearchMails():not implemented "); | 246 | qDebug("OpieMail::slotSearchMails():not implemented "); |
245 | } | 247 | } |
246 | 248 | ||
247 | void OpieMail::slotEditSettings() | 249 | void OpieMail::slotEditSettings() |
248 | { | 250 | { |
249 | 251 | ||
250 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | 252 | KOPrefsDialog settingsDialog( this, "koprefs", true ); |
251 | #ifndef DESKTOP_VERSION | 253 | #ifndef DESKTOP_VERSION |
252 | settingsDialog.showMaximized(); | 254 | settingsDialog.showMaximized(); |
253 | #endif | 255 | #endif |
254 | settingsDialog.exec(); | 256 | settingsDialog.exec(); |
255 | 257 | ||
256 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | 258 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); |
257 | // KApplication::execDialog(settingsDialog); | 259 | // KApplication::execDialog(settingsDialog); |
258 | } | 260 | } |
259 | 261 | ||
260 | void OpieMail::slotEditAccounts() | 262 | void OpieMail::slotEditAccounts() |
261 | { | 263 | { |
262 | EditAccounts eaDialog( settings, this, 0, true ); | 264 | EditAccounts eaDialog( settings, this, 0, true ); |
263 | eaDialog.slotAdjustColumns(); | 265 | eaDialog.slotAdjustColumns(); |
264 | #ifndef DESKTOP_VERSION | 266 | #ifndef DESKTOP_VERSION |
265 | eaDialog.showMaximized(); | 267 | eaDialog.showMaximized(); |
266 | #endif | 268 | #endif |
267 | eaDialog.exec(); | 269 | eaDialog.exec(); |
268 | if ( settings ) delete settings; | 270 | if ( settings ) delete settings; |
269 | settings = new Settings(); | 271 | settings = new Settings(); |
270 | 272 | ||
271 | folderView->populate( settings->getAccounts() ); | 273 | folderView->populate( settings->getAccounts() ); |
272 | } | 274 | } |
273 | void OpieMail::replyMail() | 275 | void OpieMail::replyMail() |
274 | { | 276 | { |
275 | 277 | ||
276 | QListViewItem*item = mailView->currentItem(); | 278 | QListViewItem*item = mailView->currentItem(); |
277 | if (!item) return; | 279 | if (!item) return; |
278 | RecMailP mail = ((MailListViewItem*)item)->data(); | 280 | RecMailP mail = ((MailListViewItem*)item)->data(); |
279 | RecBodyP body = folderView->fetchBody(mail); | 281 | RecBodyP body = folderView->fetchBody(mail); |
280 | 282 | ||
281 | QString rtext; | 283 | QString rtext; |
282 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 284 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
283 | .arg( mail->getFrom()) | 285 | .arg( mail->getFrom()) |
284 | .arg( mail->getDate()); | 286 | .arg( mail->getDate()); |
285 | 287 | ||
286 | QString text = body->Bodytext(); | 288 | QString text = body->Bodytext(); |
287 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 289 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
288 | QStringList::Iterator it; | 290 | QStringList::Iterator it; |
289 | for (it = lines.begin(); it != lines.end(); it++) | 291 | for (it = lines.begin(); it != lines.end(); it++) |
290 | { | 292 | { |
291 | rtext += "> " + *it + "\n"; | 293 | rtext += "> " + *it + "\n"; |
292 | } | 294 | } |
293 | rtext += "\n"; | 295 | rtext += "\n"; |
294 | 296 | ||
295 | QString prefix; | 297 | QString prefix; |
296 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 298 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
297 | else prefix = "Re: "; // no i18n on purpose | 299 | else prefix = "Re: "; // no i18n on purpose |
298 | 300 | ||
299 | Settings *settings = new Settings(); | 301 | Settings *settings = new Settings(); |
300 | ComposeMail composer( settings ,this, 0, true); | 302 | ComposeMail composer( settings ,this, 0, true); |
301 | if (mail->Replyto().isEmpty()) { | 303 | if (mail->Replyto().isEmpty()) { |
302 | composer.setTo( mail->getFrom()); | 304 | composer.setTo( mail->getFrom()); |
303 | } else { | 305 | } else { |
304 | composer.setTo( mail->Replyto()); | 306 | composer.setTo( mail->Replyto()); |
305 | } | 307 | } |
306 | composer.setSubject( prefix + mail->getSubject()); | 308 | composer.setSubject( prefix + mail->getSubject()); |
307 | composer.setMessage( rtext ); | 309 | composer.setMessage( rtext ); |
308 | composer.setInReplyTo( mail->Msgid()); | 310 | composer.setInReplyTo( mail->Msgid()); |
309 | composer.setCharset( body->getCharset() ); | 311 | composer.setCharset( body->getCharset() ); |
310 | 312 | ||
311 | mCurrentComposer = &composer; | 313 | mCurrentComposer = &composer; |
312 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 314 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
313 | { | 315 | { |
314 | mail->Wrapper()->answeredMail(mail); | 316 | mail->Wrapper()->answeredMail(mail); |
315 | } | 317 | } |
316 | mCurrentComposer = 0; | 318 | mCurrentComposer = 0; |
319 | folderView->refreshOutgoing(); | ||
317 | delete settings; | 320 | delete settings; |
318 | 321 | ||
319 | } | 322 | } |
320 | void OpieMail::closeViewMail(ViewMail * vm) | 323 | void OpieMail::closeViewMail(ViewMail * vm) |
321 | { | 324 | { |
322 | vm->hide(); | 325 | vm->hide(); |
323 | } | 326 | } |
324 | 327 | ||
325 | void OpieMail::slotDownloadMail( ) | 328 | void OpieMail::slotDownloadMail( ) |
326 | { | 329 | { |
327 | QListViewItem*item = mailView->currentItem(); | 330 | QListViewItem*item = mailView->currentItem(); |
328 | if (!item ) { | 331 | if (!item ) { |
329 | Global::statusMessage("Error: No item slected!"); | 332 | Global::statusMessage("Error: No item slected!"); |
330 | return; | 333 | return; |
331 | } | 334 | } |
332 | RecMailP mail = ((MailListViewItem*)item)->data(); | 335 | RecMailP mail = ((MailListViewItem*)item)->data(); |
333 | Account * acc = mail->Wrapper()->getAccount(); | 336 | Account * acc = mail->Wrapper()->getAccount(); |
334 | if ( !acc ) { | 337 | if ( !acc ) { |
335 | Global::statusMessage("Mail is already stored locally!"); | 338 | Global::statusMessage("Mail is already stored locally!"); |
336 | return; | 339 | return; |
337 | } | 340 | } |
338 | QString lfName = acc->getLocalFolder(); | 341 | QString lfName = acc->getLocalFolder(); |
339 | //qDebug("local folder " + lfName ); | 342 | //qDebug("local folder " + lfName ); |
340 | if ( lfName.isEmpty() ) | 343 | if ( lfName.isEmpty() ) |
341 | lfName = acc->getAccountName(); | 344 | lfName = acc->getAccountName(); |
342 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); | 345 | AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper(); |
343 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); | 346 | //qDebug("target %d %d ",targetMail,mail->Wrapper() ); |
344 | if ( targetMail == mail->Wrapper() ) { | 347 | if ( targetMail == mail->Wrapper() ) { |
345 | Global::statusMessage("Mail is already locally stored!"); | 348 | Global::statusMessage("Mail is already locally stored!"); |
346 | return; | 349 | return; |
347 | } | 350 | } |
348 | if ( !targetMail->createMbox(lfName)) { | 351 | if ( !targetMail->createMbox(lfName)) { |
349 | Global::statusMessage("Error creating folder!"); | 352 | Global::statusMessage("Error creating folder!"); |
350 | return; | 353 | return; |
351 | } | 354 | } |
352 | Global::statusMessage("Fetching mail...please wait!"); | 355 | Global::statusMessage("Fetching mail...please wait!"); |
353 | qApp->processEvents(); | 356 | qApp->processEvents(); |
354 | encodedString*st = 0; | 357 | encodedString*st = 0; |
355 | st = mail->Wrapper()->fetchRawBody(mail); | 358 | st = mail->Wrapper()->fetchRawBody(mail); |
356 | if ( st ) { | 359 | if ( st ) { |
357 | targetMail->storeMessage(st->Content(),st->Length(),lfName); | 360 | targetMail->storeMessage(st->Content(),st->Length(),lfName); |
358 | Global::statusMessage("Mail stored in "+ lfName); | 361 | Global::statusMessage("Mail stored in "+ lfName); |
359 | delete st; | 362 | delete st; |
360 | } else { | 363 | } else { |
361 | Global::statusMessage("Error: Cannot fetch mail!"); | 364 | Global::statusMessage("Error: Cannot fetch mail!"); |
362 | } | 365 | } |
363 | } | 366 | } |
364 | 367 | ||
365 | 368 | ||
366 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | 369 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) |
367 | { | 370 | { |
368 | QListViewItem*item = mailView->currentItem(); | 371 | QListViewItem*item = mailView->currentItem(); |
369 | if (!item ) { | 372 | if (!item ) { |
370 | closeViewMail(vm); | 373 | closeViewMail(vm); |
371 | return; | 374 | return; |
372 | } | 375 | } |
373 | RecMailP mail = ((MailListViewItem*)item)->data(); | 376 | RecMailP mail = ((MailListViewItem*)item)->data(); |
374 | mail->Wrapper()->deleteMail( mail ); | 377 | mail->Wrapper()->deleteMail( mail ); |
375 | item = item->itemBelow(); | 378 | item = item->itemBelow(); |
376 | if (!item ) { | 379 | if (!item ) { |
377 | closeViewMail(vm); | 380 | closeViewMail(vm); |
378 | return; | 381 | return; |
379 | } | 382 | } |
380 | mailView->setCurrentItem(item); | 383 | mailView->setCurrentItem(item); |
381 | mail = ((MailListViewItem*)item)->data(); | 384 | mail = ((MailListViewItem*)item)->data(); |
382 | RecBodyP body = folderView->fetchBody(mail); | 385 | RecBodyP body = folderView->fetchBody(mail); |
383 | vm->setBody( body ); | 386 | vm->setBody( body ); |
384 | vm->setMail( mail ); | 387 | vm->setMail( mail ); |
385 | } | 388 | } |
386 | void OpieMail::displayNextMail(ViewMail * vm) | 389 | void OpieMail::displayNextMail(ViewMail * vm) |
387 | { | 390 | { |
388 | QListViewItem*item = mailView->currentItem(); | 391 | QListViewItem*item = mailView->currentItem(); |
389 | if (!item) return; | 392 | if (!item) return; |
390 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 393 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
391 | item = item->itemBelow(); | 394 | item = item->itemBelow(); |
392 | if (!item) { | 395 | if (!item) { |
393 | vm->setCaption(i18n("End of List" )); | 396 | vm->setCaption(i18n("End of List" )); |
394 | return; | 397 | return; |
395 | } | 398 | } |
396 | mailView->setCurrentItem(item); | 399 | mailView->setCurrentItem(item); |
397 | RecMailP mail = ((MailListViewItem*)item)->data(); | 400 | RecMailP mail = ((MailListViewItem*)item)->data(); |
398 | RecBodyP body = folderView->fetchBody(mail); | 401 | RecBodyP body = folderView->fetchBody(mail); |
399 | vm->setBody( body ); | 402 | vm->setBody( body ); |
400 | vm->setMail( mail ); | 403 | vm->setMail( mail ); |
401 | } | 404 | } |
402 | void OpieMail::displayMail() | 405 | void OpieMail::displayMail() |
403 | { | 406 | { |
404 | QListViewItem*item = mailView->currentItem(); | 407 | QListViewItem*item = mailView->currentItem(); |
405 | if (!item) return; | 408 | if (!item) return; |
406 | RecMailP mail = ((MailListViewItem*)item)->data(); | 409 | RecMailP mail = ((MailListViewItem*)item)->data(); |
407 | RecBodyP body = folderView->fetchBody(mail); | 410 | RecBodyP body = folderView->fetchBody(mail); |
408 | ViewMail readMail( this,"", Qt::WType_Modal ); | 411 | ViewMail readMail( this,"", Qt::WType_Modal ); |
409 | readMail.setBody( body ); | 412 | readMail.setBody( body ); |
410 | readMail.setMail( mail ); | 413 | readMail.setMail( mail ); |
411 | #ifndef DESKTOP_VERSION | 414 | #ifndef DESKTOP_VERSION |
412 | readMail.showMaximized(); | 415 | readMail.showMaximized(); |
@@ -556,117 +559,119 @@ void OpieMail::mailLeftClicked( QListViewItem *item ) | |||
556 | if (!item) return; | 559 | if (!item) return; |
557 | if (folderView->currentisDraft()) { | 560 | if (folderView->currentisDraft()) { |
558 | reEditMail(); | 561 | reEditMail(); |
559 | } else { | 562 | } else { |
560 | displayMail(); | 563 | displayMail(); |
561 | } | 564 | } |
562 | } | 565 | } |
563 | 566 | ||
564 | void OpieMail::slotMoveCopyMail() | 567 | void OpieMail::slotMoveCopyMail() |
565 | { | 568 | { |
566 | if (!mailView->currentItem()) return; | 569 | if (!mailView->currentItem()) return; |
567 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 570 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
568 | AbstractMail*targetMail = 0; | 571 | AbstractMail*targetMail = 0; |
569 | QString targetFolder = ""; | 572 | QString targetFolder = ""; |
570 | Selectstore sels; | 573 | Selectstore sels; |
571 | folderView->setupFolderselect(&sels); | 574 | folderView->setupFolderselect(&sels); |
572 | if (!sels.exec()) return; | 575 | if (!sels.exec()) return; |
573 | targetMail = sels.currentMail(); | 576 | targetMail = sels.currentMail(); |
574 | targetFolder = sels.currentFolder(); | 577 | targetFolder = sels.currentFolder(); |
575 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 578 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
576 | targetFolder.isEmpty()) | 579 | targetFolder.isEmpty()) |
577 | { | 580 | { |
578 | return; | 581 | return; |
579 | } | 582 | } |
580 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 583 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
581 | { | 584 | { |
582 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 585 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
583 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 586 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
584 | return; | 587 | return; |
585 | } | 588 | } |
586 | sels.hide(); | 589 | sels.hide(); |
587 | qApp->processEvents(); | 590 | qApp->processEvents(); |
588 | // qDebug("hiding sels "); | 591 | // qDebug("hiding sels "); |
589 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 592 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
590 | folderView->refreshCurrent(); | 593 | folderView->refreshCurrent(); |
591 | } | 594 | } |
592 | 595 | ||
593 | void OpieMail::slotMoveCopyAllMail() | 596 | void OpieMail::slotMoveCopyAllMail() |
594 | { | 597 | { |
595 | 598 | ||
596 | if (!mailView->currentItem()) return; | 599 | if (!mailView->currentItem()) return; |
597 | QValueList<RecMailP> t; | 600 | QValueList<RecMailP> t; |
598 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 601 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
599 | { | 602 | { |
600 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 603 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
601 | while ( item ) { | 604 | while ( item ) { |
602 | if ( item->isSelected() ) { | 605 | if ( item->isSelected() ) { |
603 | t.append( item->data() ); | 606 | t.append( item->data() ); |
604 | } | 607 | } |
605 | item = (MailListViewItem*)item->nextSibling(); | 608 | item = (MailListViewItem*)item->nextSibling(); |
606 | } | 609 | } |
607 | } | 610 | } |
608 | // else | 611 | // else |
609 | // return; | 612 | // return; |
610 | if ( t.count() == 0 ) | 613 | if ( t.count() == 0 ) |
611 | return; | 614 | return; |
612 | RecMailP mail = t.first(); | 615 | RecMailP mail = t.first(); |
613 | AbstractMail*targetMail = 0; | 616 | AbstractMail*targetMail = 0; |
614 | QString targetFolder = ""; | 617 | QString targetFolder = ""; |
615 | Selectstore sels; | 618 | Selectstore sels; |
616 | folderView->setupFolderselect(&sels); | 619 | folderView->setupFolderselect(&sels); |
617 | if (!sels.exec()) return; | 620 | if (!sels.exec()) return; |
618 | targetMail = sels.currentMail(); | 621 | targetMail = sels.currentMail(); |
619 | targetFolder = sels.currentFolder(); | 622 | targetFolder = sels.currentFolder(); |
620 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 623 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
621 | targetFolder.isEmpty()) | 624 | targetFolder.isEmpty()) |
622 | { | 625 | { |
623 | return; | 626 | return; |
624 | } | 627 | } |
625 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 628 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
626 | { | 629 | { |
627 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 630 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
628 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 631 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
629 | return; | 632 | return; |
630 | } | 633 | } |
631 | sels.hide(); | 634 | sels.hide(); |
632 | qApp->processEvents(); | 635 | qApp->processEvents(); |
633 | //qDebug("hiding sels "); | 636 | //qDebug("hiding sels "); |
634 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | 637 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); |
635 | folderView->refreshCurrent(); | 638 | folderView->refreshCurrent(); |
636 | } | 639 | } |
637 | 640 | ||
638 | void OpieMail::reEditMail() | 641 | void OpieMail::reEditMail() |
639 | { | 642 | { |
640 | if (!mailView->currentItem()) return; | 643 | if (!mailView->currentItem()) return; |
641 | 644 | ||
642 | ComposeMail compose( settings, this, 0, true ); | 645 | ComposeMail compose( settings, this, 0, true ); |
643 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 646 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
644 | compose.slotAdjustColumns(); | 647 | compose.slotAdjustColumns(); |
645 | #ifndef DESKTOP_VERSION | 648 | #ifndef DESKTOP_VERSION |
646 | compose.showMaximized(); | 649 | compose.showMaximized(); |
647 | #else | 650 | #else |
648 | compose.resize(640,480); | 651 | compose.resize(640,480); |
649 | #endif | 652 | #endif |
650 | mCurrentComposer = &compose; | 653 | mCurrentComposer = &compose; |
651 | compose.exec(); | 654 | compose.exec(); |
655 | folderView->refreshOutgoing(); | ||
652 | mCurrentComposer = 0; | 656 | mCurrentComposer = 0; |
653 | } | 657 | } |
654 | 658 | ||
655 | void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 659 | void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
656 | { | 660 | { |
657 | 661 | ||
658 | if ( mCurrentComposer ) { | 662 | if ( mCurrentComposer ) { |
659 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); | 663 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); |
660 | } else { | 664 | } else { |
661 | ComposeMail compose( settings, this, 0, true ); | 665 | ComposeMail compose( settings, this, 0, true ); |
662 | compose.slotAdjustColumns(); | 666 | compose.slotAdjustColumns(); |
663 | #ifndef DESKTOP_VERSION | 667 | #ifndef DESKTOP_VERSION |
664 | compose.showMaximized(); | 668 | compose.showMaximized(); |
665 | #endif | 669 | #endif |
666 | mCurrentComposer = &compose; | 670 | mCurrentComposer = &compose; |
667 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); | 671 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); |
668 | compose.exec(); | 672 | compose.exec(); |
669 | mCurrentComposer = 0; | 673 | mCurrentComposer = 0; |
674 | folderView->refreshOutgoing(); | ||
670 | raise(); | 675 | raise(); |
671 | } | 676 | } |
672 | } | 677 | } |