summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/opiemail.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp
index d8b58b6..61e7dc4 100644
--- a/noncore/net/mail/opiemail.cpp
+++ b/noncore/net/mail/opiemail.cpp
@@ -83,172 +83,179 @@ void OpieMail::slotSendQueued()
83 for ( it = list.first(); it; it = list.next() ) 83 for ( it = list.first(); it; it = list.next() )
84 { 84 {
85 if ( it->getType() == MAILLIB::A_SMTP ) 85 if ( it->getType() == MAILLIB::A_SMTP )
86 { 86 {
87 smtp = static_cast<SMTPaccount *>(it); 87 smtp = static_cast<SMTPaccount *>(it);
88 smtpList.append(smtp); 88 smtpList.append(smtp);
89 } 89 }
90 } 90 }
91 if (smtpList.count()==0) 91 if (smtpList.count()==0)
92 { 92 {
93 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); 93 QMessageBox::information(0,tr("Info"),tr("Define a smtp account first"));
94 return; 94 return;
95 } 95 }
96 if (smtpList.count()==1) 96 if (smtpList.count()==1)
97 { 97 {
98 smtp = smtpList.at(0); 98 smtp = smtpList.at(0);
99 } 99 }
100 else 100 else
101 { 101 {
102 smtp = 0; 102 smtp = 0;
103 selectsmtp selsmtp; 103 selectsmtp selsmtp;
104 selsmtp.setSelectionlist(&smtpList); 104 selsmtp.setSelectionlist(&smtpList);
105 if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted ) 105 if ( QPEApplication::execDialog( &selsmtp ) == QDialog::Accepted )
106 { 106 {
107 smtp = selsmtp.selected_smtp(); 107 smtp = selsmtp.selected_smtp();
108 } 108 }
109 } 109 }
110 if (smtp) 110 if (smtp)
111 { 111 {
112 SMTPwrapper * wrap = new SMTPwrapper(smtp); 112 SMTPwrapper * wrap = new SMTPwrapper(smtp);
113 if ( wrap->flushOutbox() ) 113 if ( wrap->flushOutbox() )
114 { 114 {
115 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); 115 QMessageBox::information(0,tr("Info"),tr("Mail queue flushed"));
116 } 116 }
117 delete wrap; 117 delete wrap;
118 } 118 }
119} 119}
120 120
121void OpieMail::slotSearchMails() 121void OpieMail::slotSearchMails()
122{ 122{
123 qDebug( "Search Mails" ); 123 qDebug( "Search Mails" );
124} 124}
125 125
126void OpieMail::slotEditSettings() 126void OpieMail::slotEditSettings()
127{ 127{
128 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 128 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
129 QPEApplication::execDialog( &settingsDialog ); 129 QPEApplication::execDialog( &settingsDialog );
130} 130}
131 131
132void OpieMail::slotEditAccounts() 132void OpieMail::slotEditAccounts()
133{ 133{
134 qDebug( "Edit Accounts" ); 134 qDebug( "Edit Accounts" );
135 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); 135 EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp );
136 eaDialog.slotAdjustColumns(); 136 eaDialog.slotAdjustColumns();
137 QPEApplication::execDialog( &eaDialog ); 137 QPEApplication::execDialog( &eaDialog );
138 if ( settings ) delete settings; 138 if ( settings ) delete settings;
139 settings = new Settings(); 139 settings = new Settings();
140 140
141 folderView->populate( settings->getAccounts() ); 141 folderView->populate( settings->getAccounts() );
142} 142}
143 143
144void OpieMail::displayMail() 144void OpieMail::displayMail()
145{ 145{
146 QListViewItem*item = mailView->currentItem(); 146 QListViewItem*item = mailView->currentItem();
147 if (!item) return; 147 if (!item) return;
148 RecMail mail = ((MailListViewItem*)item)->data(); 148 RecMail mail = ((MailListViewItem*)item)->data();
149 RecBody body = folderView->fetchBody(mail); 149 RecBody body = folderView->fetchBody(mail);
150 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); 150 ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp );
151 readMail.setBody( body ); 151 readMail.setBody( body );
152 readMail.setMail( mail ); 152 readMail.setMail( mail );
153 readMail.showMaximized(); 153 readMail.showMaximized();
154 readMail.exec(); 154 readMail.exec();
155 155
156 if ( readMail.deleted ) 156 if ( readMail.deleted )
157 { 157 {
158 folderView->refreshCurrent(); 158 folderView->refreshCurrent();
159 } 159 }
160 else 160 else
161 { 161 {
162 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); 162 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) );
163 } 163 }
164} 164}
165 165
166void OpieMail::slotDeleteMail() 166void OpieMail::slotDeleteMail()
167{ 167{
168 if (!mailView->currentItem()) return; 168 if (!mailView->currentItem()) return;
169 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); 169 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
170 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 ) 170 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 )
171 { 171 {
172 mail.Wrapper()->deleteMail( mail ); 172 mail.Wrapper()->deleteMail( mail );
173 folderView->refreshCurrent(); 173 folderView->refreshCurrent();
174 } 174 }
175} 175}
176 176
177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 177void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
178{ 178{
179 if (!mailView->currentItem()) return;
180 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
179 /* just the RIGHT button - or hold on pda */ 181 /* just the RIGHT button - or hold on pda */
180 if (button!=2) {return;} 182 if (button!=2) {return;}
181 qDebug("Event right/hold"); 183 qDebug("Event right/hold");
182 if (!item) return; 184 if (!item) return;
183 QPopupMenu *m = new QPopupMenu(0); 185 QPopupMenu *m = new QPopupMenu(0);
184 if (m) 186 if (m)
185 { 187 {
186 m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); 188 if (mail.Wrapper()->getType()==MAILLIB::A_NNTP) {
187 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); 189 m->insertItem(tr("Read this posting"),this,SLOT(displayMail()));
188 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); 190// m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail()));
191 } else {
192 m->insertItem(tr("Read this mail"),this,SLOT(displayMail()));
193 m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail()));
194 m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail()));
195 }
189 m->setFocus(); 196 m->setFocus();
190 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 197 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
191 delete m; 198 delete m;
192 } 199 }
193} 200}
194 201
195void OpieMail::slotShowFolders( bool show ) 202void OpieMail::slotShowFolders( bool show )
196{ 203{
197 qDebug( "Show Folders" ); 204 qDebug( "Show Folders" );
198 if ( show && folderView->isHidden() ) 205 if ( show && folderView->isHidden() )
199 { 206 {
200 qDebug( "-> showing" ); 207 qDebug( "-> showing" );
201 folderView->show(); 208 folderView->show();
202 } 209 }
203 else if ( !show && !folderView->isHidden() ) 210 else if ( !show && !folderView->isHidden() )
204 { 211 {
205 qDebug( "-> hiding" ); 212 qDebug( "-> hiding" );
206 folderView->hide(); 213 folderView->hide();
207 } 214 }
208} 215}
209 216
210void OpieMail::refreshMailView(QList<RecMail>*list) 217void OpieMail::refreshMailView(QList<RecMail>*list)
211{ 218{
212 MailListViewItem*item = 0; 219 MailListViewItem*item = 0;
213 mailView->clear(); 220 mailView->clear();
214 for (unsigned int i = 0; i < list->count();++i) 221 for (unsigned int i = 0; i < list->count();++i)
215 { 222 {
216 item = new MailListViewItem(mailView,item); 223 item = new MailListViewItem(mailView,item);
217 item->storeData(*(list->at(i))); 224 item->storeData(*(list->at(i)));
218 item->showEntry(); 225 item->showEntry();
219 } 226 }
220} 227}
221 228
222void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) 229void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int )
223{ 230{
224 /* just LEFT button - or tap with stylus on pda */ 231 /* just LEFT button - or tap with stylus on pda */
225 if (button!=1) return; 232 if (button!=1) return;
226 if (!item) return; 233 if (!item) return;
227 displayMail(); 234 displayMail();
228} 235}
229 236
230void OpieMail::slotMoveCopyMail() 237void OpieMail::slotMoveCopyMail()
231{ 238{
232 if (!mailView->currentItem()) return; 239 if (!mailView->currentItem()) return;
233 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); 240 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
234 AbstractMail*targetMail = 0; 241 AbstractMail*targetMail = 0;
235 QString targetFolder = ""; 242 QString targetFolder = "";
236 Selectstore sels; 243 Selectstore sels;
237 folderView->setupFolderselect(&sels); 244 folderView->setupFolderselect(&sels);
238 if (!sels.exec()) return; 245 if (!sels.exec()) return;
239 targetMail = sels.currentMail(); 246 targetMail = sels.currentMail();
240 targetFolder = sels.currentFolder(); 247 targetFolder = sels.currentFolder();
241 if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || 248 if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) ||
242 targetFolder.isEmpty()) 249 targetFolder.isEmpty())
243 { 250 {
244 return; 251 return;
245 } 252 }
246 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 253 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
247 { 254 {
248 QMessageBox::critical(0,tr("Error creating new Folder"), 255 QMessageBox::critical(0,tr("Error creating new Folder"),
249 tr("<center>Error while creating<br>new folder - breaking.</center>")); 256 tr("<center>Error while creating<br>new folder - breaking.</center>"));
250 return; 257 return;
251 } 258 }
252 mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 259 mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
253 folderView->refreshCurrent(); 260 folderView->refreshCurrent();
254} 261}