summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/emailclient.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/mailit/emailclient.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 90664bb..8359acf 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -260,90 +260,90 @@ void EmailClient::enqueMail(const Email &mail)
260 tr("No account selected"), tr("You must create an account"), "OK\n"); 260 tr("No account selected"), tr("You must create an account"), "OK\n");
261 return; 261 return;
262 } 262 }
263 263
264 if (accountList.count() > 0) { 264 if (accountList.count() > 0) {
265 currentAccount = accountList.first(); 265 currentAccount = accountList.first();
266 qWarning("using account " + currentAccount->name); 266 qWarning("using account " + currentAccount->name);
267 } 267 }
268 268
269 Email addMail = mail; 269 Email addMail = mail;
270 addMail.from = currentAccount->name; 270 addMail.from = currentAccount->name;
271 addMail.fromMail = currentAccount->emailAddress; 271 addMail.fromMail = currentAccount->emailAddress;
272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n"); 272 addMail.rawMail.prepend("From: \"" + addMail.from + "\" <" + addMail.fromMail + ">\n");
273 item = new EmailListItem(outboxView, addMail, false); 273 item = new EmailListItem(outboxView, addMail, false);
274 274
275 mailboxView->setCurrentTab(1); 275 mailboxView->setCurrentTab(1);
276 276
277} 277}
278 278
279void EmailClient::sendQuedMail() 279void EmailClient::sendQuedMail()
280{ 280{
281 int count = 0; 281 int count = 0;
282 282
283 if (accountList.count() == 0) { 283 if (accountList.count() == 0) {
284 QMessageBox::warning(qApp->activeWindow(), "No account selected", "You must create an account", "OK\n"); 284 QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n");
285 return; 285 return;
286 } 286 }
287 //traverse listview, find messages to send 287 //traverse listview, find messages to send
288 if (! sending) { 288 if (! sending) {
289 item = (EmailListItem *) outboxView->firstChild(); 289 item = (EmailListItem *) outboxView->firstChild();
290 if (item != NULL) { 290 if (item != NULL) {
291 while (item != NULL) { 291 while (item != NULL) {
292 quedMessages.append(item->getMail()); 292 quedMessages.append(item->getMail());
293 item = (EmailListItem *) item->nextSibling(); 293 item = (EmailListItem *) item->nextSibling();
294 count++; 294 count++;
295 } 295 }
296 setMailAccount(); 296 setMailAccount();
297 emailHandler->sendMail(&quedMessages); 297 emailHandler->sendMail(&quedMessages);
298 sending = TRUE; 298 sending = TRUE;
299 sendMailButton->setEnabled(FALSE); 299 sendMailButton->setEnabled(FALSE);
300 cancelButton->setEnabled(TRUE); 300 cancelButton->setEnabled(TRUE);
301 } else { 301 } else {
302 qWarning("sendQuedMail(): no messages to send"); 302 qWarning("sendQuedMail(): no messages to send");
303 } 303 }
304 } 304 }
305} 305}
306 306
307void EmailClient::setMailAccount() 307void EmailClient::setMailAccount()
308{ 308{
309 emailHandler->setAccount(*currentAccount); 309 emailHandler->setAccount(*currentAccount);
310} 310}
311 311
312void EmailClient::mailSent() 312void EmailClient::mailSent()
313{ 313{
314 sending = FALSE; 314 sending = FALSE;
315 sendMailButton->setEnabled(TRUE); 315 sendMailButton->setEnabled(TRUE);
316 316
317 quedMessages.clear(); 317 quedMessages.clear();
318 outboxView->clear(); //should be moved to an sentBox 318 outboxView->clear(); //should be moved to an sentBox
319} 319}
320 320
321void EmailClient::getNewMail() { 321void EmailClient::getNewMail() {
322 322
323 if (accountList.count() == 0) { 323 if (accountList.count() == 0) {
324 QMessageBox::warning(qApp->activeWindow(),"No account selected", 324 QMessageBox::warning(qApp->activeWindow(),tr("No account selected"),
325 "You must create an account", "OK\n"); 325 tr("You must create an account"), "OK\n");
326 return; 326 return;
327 } 327 }
328 328
329 setMailAccount(); 329 setMailAccount();
330 330
331 receiving = TRUE; 331 receiving = TRUE;
332 previewingMail = TRUE; 332 previewingMail = TRUE;
333 getMailButton->setEnabled(FALSE); 333 getMailButton->setEnabled(FALSE);
334 cancelButton->setEnabled(TRUE); 334 cancelButton->setEnabled(TRUE);
335 selectAccountMenu->setEnabled(FALSE); 335 selectAccountMenu->setEnabled(FALSE);
336 336
337 status1Label->setText(currentAccount->accountName + " headers"); 337 status1Label->setText(currentAccount->accountName + " headers");
338 progressBar->reset(); 338 progressBar->reset();
339 339
340 //get any previous mails not downloaded and add to queue 340 //get any previous mails not downloaded and add to queue
341 /*mailDownloadList.clear(); 341 /*mailDownloadList.clear();
342 Email *mailPtr; 342 Email *mailPtr;
343 item = (EmailListItem *) inboxView->firstChild(); 343 item = (EmailListItem *) inboxView->firstChild();
344 while (item != NULL) { 344 while (item != NULL) {
345 mailPtr = item->getMail(); 345 mailPtr = item->getMail();
346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { 346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) {
347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); 347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size);
348 } 348 }
349 item = (EmailListItem *) item->nextSibling(); 349 item = (EmailListItem *) item->nextSibling();
@@ -764,110 +764,110 @@ void EmailClient::saveSettings()
764 { 764 {
765 mailconf->writeEntry("Synchronize","Yes"); 765 mailconf->writeEntry("Synchronize","Yes");
766 mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit); 766 mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit);
767 mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); 767 mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount);
768 } 768 }
769 else 769 else
770 { 770 {
771 mailconf->writeEntry("Synchronize", "No"); 771 mailconf->writeEntry("Synchronize", "No");
772 } 772 }
773 } 773 }
774 774
775 mailconf->setGroup("mailitglobal"); 775 mailconf->setGroup("mailitglobal");
776 mailconf->writeEntry("Accounts",acc_count); 776 mailconf->writeEntry("Accounts",acc_count);
777 mailconf->writeEntry("mailidcount", mailIdCount); 777 mailconf->writeEntry("mailidcount", mailIdCount);
778 mailconf->writeEntry("accountidcount", accountIdCount); 778 mailconf->writeEntry("accountidcount", accountIdCount);
779} 779}
780 780
781void EmailClient::selectAccount(int id) 781void EmailClient::selectAccount(int id)
782{ 782{
783 if (accountList.count() > 0) { 783 if (accountList.count() > 0) {
784 currentAccount = accountList.at(id); 784 currentAccount = accountList.at(id);
785 emit newCaption("Mailit - " + currentAccount->accountName); 785 emit newCaption("Mailit - " + currentAccount->accountName);
786 getNewMail(); 786 getNewMail();
787 } else { 787 } else {
788 emit newCaption("Mailit ! No account defined"); 788 emit newCaption( tr("Mailit ! No account defined") );
789 } 789 }
790} 790}
791 791
792void EmailClient::editAccount(int id) 792void EmailClient::editAccount(int id)
793{ 793{
794 MailAccount *newAccount; 794 MailAccount *newAccount;
795 795
796 editAccountView = new EditAccount(this, "account", TRUE); 796 editAccountView = new EditAccount(this, "account", TRUE);
797 if (id == newAccountId) { //new account 797 if (id == newAccountId) { //new account
798 newAccount = new MailAccount; 798 newAccount = new MailAccount;
799 editAccountView->setAccount(newAccount); 799 editAccountView->setAccount(newAccount);
800 } else { 800 } else {
801 newAccount = accountList.at(id); 801 newAccount = accountList.at(id);
802 editAccountView->setAccount(newAccount, FALSE); 802 editAccountView->setAccount(newAccount, FALSE);
803 } 803 }
804 804
805 editAccountView->showMaximized(); 805 editAccountView->showMaximized();
806 editAccountView->exec(); 806 editAccountView->exec();
807 807
808 if (editAccountView->result() == QDialog::Accepted) { 808 if (editAccountView->result() == QDialog::Accepted) {
809 if (id == newAccountId) { 809 if (id == newAccountId) {
810 newAccount->id = accountIdCount; 810 newAccount->id = accountIdCount;
811 accountIdCount++; 811 accountIdCount++;
812 accountList.append(newAccount); 812 accountList.append(newAccount);
813 updateAccounts(); 813 updateAccounts();
814 } else { 814 } else {
815 updateAccounts(); 815 updateAccounts();
816 } 816 }
817 } 817 }
818 818
819 delete editAccountView; 819 delete editAccountView;
820} 820}
821 821
822void EmailClient::deleteAccount(int id) 822void EmailClient::deleteAccount(int id)
823{ 823{
824 MailAccount *newAccount; 824 MailAccount *newAccount;
825 QString message; 825 QString message;
826 826
827 newAccount = accountList.at(id); 827 newAccount = accountList.at(id);
828 message = "Delete account:\n" + newAccount->accountName; 828 message = tr("Delete account:\n") + newAccount->accountName;
829 switch( QMessageBox::warning( this, "Mailit", message, 829 switch( QMessageBox::warning( this, "Mailit", message,
830 "Yes", "No", 0, 0, 1 ) ) { 830 "Yes", "No", 0, 0, 1 ) ) {
831 831
832 case 0: accountList.remove(id); 832 case 0: accountList.remove(id);
833 updateAccounts(); 833 updateAccounts();
834 break; 834 break;
835 case 1: 835 case 1:
836 break; 836 break;
837 } 837 }
838} 838}
839 839
840void EmailClient::updateAccounts() 840void EmailClient::updateAccounts()
841{ 841{
842 MailAccount *accountPtr; 842 MailAccount *accountPtr;
843 843
844 //rebuild menus, clear all first 844 //rebuild menus, clear all first
845 editAccountMenu->clear(); 845 editAccountMenu->clear();
846 selectAccountMenu->clear(); 846 selectAccountMenu->clear();
847 deleteAccountMenu->clear(); 847 deleteAccountMenu->clear();
848 848
849 newAccountId = editAccountMenu->insertItem("New", this, 849 newAccountId = editAccountMenu->insertItem( tr("New"), this,
850 SLOT(editAccount(int)) ); 850 SLOT(editAccount(int)) );
851 editAccountMenu->insertSeparator(); 851 editAccountMenu->insertSeparator();
852 852
853 idCount = 0; 853 idCount = 0;
854 for (accountPtr = accountList.first(); accountPtr != 0; 854 for (accountPtr = accountList.first(); accountPtr != 0;
855 accountPtr = accountList.next()) { 855 accountPtr = accountList.next()) {
856 856
857 editAccountMenu->insertItem(accountPtr->accountName, 857 editAccountMenu->insertItem(accountPtr->accountName,
858 this, SLOT(editAccount(int)), 0, idCount); 858 this, SLOT(editAccount(int)), 0, idCount);
859 selectAccountMenu->insertItem(accountPtr->accountName, 859 selectAccountMenu->insertItem(accountPtr->accountName,
860 this, SLOT(selectAccount(int)), 0, idCount); 860 this, SLOT(selectAccount(int)), 0, idCount);
861 deleteAccountMenu->insertItem(accountPtr->accountName, 861 deleteAccountMenu->insertItem(accountPtr->accountName,
862 this, SLOT(deleteAccount(int)), 0, idCount); 862 this, SLOT(deleteAccount(int)), 0, idCount);
863 idCount++; 863 idCount++;
864 } 864 }
865} 865}
866 866
867void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) 867void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
868{ 868{
869 Email *mPtr; 869 Email *mPtr;
870 Enclosure *ePtr; 870 Enclosure *ePtr;
871 871
872 if (inbox) 872 if (inbox)
873 { 873 {