Diffstat (limited to 'noncore/unsupported/mailit/emailclient.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 12 |
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 | |||
@@ -236,138 +236,138 @@ void EmailClient::initStatusBar(QWidget* parent) | |||
236 | statusBar->addWidget(status2Label); | 236 | statusBar->addWidget(status2Label); |
237 | 237 | ||
238 | } | 238 | } |
239 | 239 | ||
240 | void EmailClient::compose() | 240 | void EmailClient::compose() |
241 | { | 241 | { |
242 | emit composeRequested(); | 242 | emit composeRequested(); |
243 | } | 243 | } |
244 | 244 | ||
245 | void EmailClient::cancel() | 245 | void EmailClient::cancel() |
246 | { | 246 | { |
247 | emailHandler->cancel(); | 247 | emailHandler->cancel(); |
248 | } | 248 | } |
249 | 249 | ||
250 | AddressList* EmailClient::getAdrListRef() | 250 | AddressList* EmailClient::getAdrListRef() |
251 | { | 251 | { |
252 | return addressList; | 252 | return addressList; |
253 | } | 253 | } |
254 | 254 | ||
255 | //this needs to be rewritten to syncronize with outboxView | 255 | //this needs to be rewritten to syncronize with outboxView |
256 | void EmailClient::enqueMail(const Email &mail) | 256 | void EmailClient::enqueMail(const Email &mail) |
257 | { | 257 | { |
258 | if (accountList.count() == 0) { | 258 | if (accountList.count() == 0) { |
259 | QMessageBox::warning(qApp->activeWindow(), | 259 | QMessageBox::warning(qApp->activeWindow(), |
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 | ||
279 | void EmailClient::sendQuedMail() | 279 | void 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 | ||
307 | void EmailClient::setMailAccount() | 307 | void EmailClient::setMailAccount() |
308 | { | 308 | { |
309 | emailHandler->setAccount(*currentAccount); | 309 | emailHandler->setAccount(*currentAccount); |
310 | } | 310 | } |
311 | 311 | ||
312 | void EmailClient::mailSent() | 312 | void 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 | ||
321 | void EmailClient::getNewMail() { | 321 | void 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(); |
350 | }*/ | 350 | }*/ |
351 | 351 | ||
352 | emailHandler->getMailHeaders(); | 352 | emailHandler->getMailHeaders(); |
353 | 353 | ||
354 | } | 354 | } |
355 | 355 | ||
356 | void EmailClient::getAllNewMail() | 356 | void EmailClient::getAllNewMail() |
357 | { | 357 | { |
358 | allAccounts = TRUE; | 358 | allAccounts = TRUE; |
359 | currentAccount = accountList.first(); | 359 | currentAccount = accountList.first(); |
360 | getNewMail(); | 360 | getNewMail(); |
361 | } | 361 | } |
362 | 362 | ||
363 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) | 363 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) |
364 | { | 364 | { |
365 | Enclosure *ePtr; | 365 | Enclosure *ePtr; |
366 | Email newMail; | 366 | Email newMail; |
367 | int thisMailId; | 367 | int thisMailId; |
368 | emailHandler->parse( mail.rawMail, lineShift, &newMail); | 368 | emailHandler->parse( mail.rawMail, lineShift, &newMail); |
369 | mailconf->setGroup(newMail.id); | 369 | mailconf->setGroup(newMail.id); |
370 | 370 | ||
371 | if (fromDisk) | 371 | if (fromDisk) |
372 | { | 372 | { |
373 | 373 | ||
@@ -740,158 +740,158 @@ void EmailClient::saveSettings() | |||
740 | { | 740 | { |
741 | int acc_count=0; | 741 | int acc_count=0; |
742 | MailAccount *accountPtr; | 742 | MailAccount *accountPtr; |
743 | 743 | ||
744 | 744 | ||
745 | if (!mailconf) | 745 | if (!mailconf) |
746 | { | 746 | { |
747 | qWarning("could not save settings"); | 747 | qWarning("could not save settings"); |
748 | return; | 748 | return; |
749 | } | 749 | } |
750 | 750 | ||
751 | for (accountPtr = accountList.first(); accountPtr != 0; | 751 | for (accountPtr = accountList.first(); accountPtr != 0; |
752 | accountPtr = accountList.next()) | 752 | accountPtr = accountList.next()) |
753 | { | 753 | { |
754 | mailconf->setGroup("Account_"+QString::number(++acc_count)); | 754 | mailconf->setGroup("Account_"+QString::number(++acc_count)); |
755 | mailconf->writeEntry("AccName",accountPtr->accountName ); | 755 | mailconf->writeEntry("AccName",accountPtr->accountName ); |
756 | mailconf->writeEntry("UserName",accountPtr->name); | 756 | mailconf->writeEntry("UserName",accountPtr->name); |
757 | mailconf->writeEntry("Email",accountPtr->emailAddress); | 757 | mailconf->writeEntry("Email",accountPtr->emailAddress); |
758 | mailconf->writeEntry("POPUser",accountPtr->popUserName); | 758 | mailconf->writeEntry("POPUser",accountPtr->popUserName); |
759 | mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd); | 759 | mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd); |
760 | mailconf->writeEntry("POPServer",accountPtr->popServer); | 760 | mailconf->writeEntry("POPServer",accountPtr->popServer); |
761 | mailconf->writeEntry("SMTPServer",accountPtr->smtpServer); | 761 | mailconf->writeEntry("SMTPServer",accountPtr->smtpServer); |
762 | mailconf->writeEntry("AccountId",accountPtr->id); | 762 | mailconf->writeEntry("AccountId",accountPtr->id); |
763 | if (accountPtr->synchronize) | 763 | if (accountPtr->synchronize) |
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 | ||
781 | void EmailClient::selectAccount(int id) | 781 | void 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 | ||
792 | void EmailClient::editAccount(int id) | 792 | void 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 | ||
822 | void EmailClient::deleteAccount(int id) | 822 | void 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 | ||
840 | void EmailClient::updateAccounts() | 840 | void 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 | ||
867 | void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | 867 | void 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 | { |
874 | mPtr = mailItem->getMail(); | 874 | mPtr = mailItem->getMail(); |
875 | 875 | ||
876 | //if mail is in queue for download, remove it from | 876 | //if mail is in queue for download, remove it from |
877 | //queue if possible | 877 | //queue if possible |
878 | if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) { | 878 | if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) { |
879 | if ( !mPtr->downloaded ) | 879 | if ( !mPtr->downloaded ) |
880 | mailDownloadList.remove(mPtr->serverId, mPtr->size); | 880 | mailDownloadList.remove(mPtr->serverId, mPtr->size); |
881 | } | 881 | } |
882 | 882 | ||
883 | mailconf->setGroup(mPtr->id); | 883 | mailconf->setGroup(mPtr->id); |
884 | mailconf->clearGroup(); | 884 | mailconf->clearGroup(); |
885 | 885 | ||
886 | //delete any temporary attatchemnts storing | 886 | //delete any temporary attatchemnts storing |
887 | for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { | 887 | for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { |
888 | if (ePtr->saved) { | 888 | if (ePtr->saved) { |
889 | QFile::remove( (ePtr->path + ePtr->name) ); | 889 | QFile::remove( (ePtr->path + ePtr->name) ); |
890 | } | 890 | } |
891 | } | 891 | } |
892 | inboxView->takeItem(mailItem); | 892 | inboxView->takeItem(mailItem); |
893 | } | 893 | } |
894 | else | 894 | else |
895 | { | 895 | { |
896 | outboxView->takeItem(mailItem); | 896 | outboxView->takeItem(mailItem); |
897 | } | 897 | } |