author | mickeyl <mickeyl> | 2003-10-29 18:18:19 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-29 18:18:19 (UTC) |
commit | 1af1f1d9f398d38a2bc666cd2edff5725da7a770 (patch) (unidiff) | |
tree | b3bb0d90cafc1e933b5b9297a7b2669ce3b184ea /noncore/unsupported/mailit | |
parent | 35615947e11575a61456c8483e7f6d67fe59d5ed (diff) | |
download | opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.zip opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.tar.gz opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.tar.bz2 |
mrege noncore/net/*
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 322 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emaillistitem.cpp | 73 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emaillistitem.h | 3 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailit.pro | 6 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/mailit/main.cpp | 10 |
6 files changed, 234 insertions, 181 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 | |||
@@ -44,6 +44,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
44 | : QMainWindow( parent, name, fl ) | 44 | : QMainWindow( parent, name, fl ) |
45 | { | 45 | { |
46 | emailHandler = new EmailHandler(); | 46 | emailHandler = new EmailHandler(); |
47 | addressList = new AddressList(); | 47 | addressList = new AddressList(); |
48 | 48 | ||
49 | sending = FALSE; | 49 | sending = FALSE; |
@@ -54,9 +54,9 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
54 | allAccounts = FALSE; | 54 | allAccounts = FALSE; |
55 | 55 | ||
56 | init(); | 56 | init(); |
57 | 57 | ||
58 | 58 | ||
59 | 59 | ||
60 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); | 60 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); |
61 | 61 | ||
62 | connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, | 62 | connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, |
@@ -65,6 +65,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
65 | SLOT(popError(int,const QString &)) ); | 65 | SLOT(popError(int,const QString &)) ); |
66 | 66 | ||
67 | connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); | 67 | connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); |
68 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); | 68 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); |
69 | 69 | ||
70 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); | 70 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); |
@@ -76,3 +76,3 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
76 | SLOT(allMailArrived(int)) ); | 76 | SLOT(allMailArrived(int)) ); |
77 | 77 | ||
78 | mailconf = new Config("mailit"); | 78 | mailconf = new Config("mailit"); |
@@ -81,5 +81,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
81 | readSettings(); | 81 | readSettings(); |
82 | 82 | ||
83 | updateAccounts(); | 83 | updateAccounts(); |
84 | 84 | ||
85 | lineShift = "\n"; | 85 | lineShift = "\n"; |
@@ -87,5 +87,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
87 | lineShift = "\r\n"; | 87 | lineShift = "\r\n"; |
88 | 88 | ||
89 | mailboxView->setCurrentTab(0); //ensure that inbox has focus | 89 | mailboxView->setCurrentTab(0); //ensure that inbox has focus |
90 | 90 | ||
91 | /*channel = new QCopChannel( "QPE/Application/mailit", this ); | 91 | /*channel = new QCopChannel( "QPE/Application/mailit", this ); |
@@ -106,6 +106,6 @@ EmailClient::~EmailClient() | |||
106 | saveSettings(); | 106 | saveSettings(); |
107 | 107 | ||
108 | mailconf->write(); | 108 | mailconf->write(); |
109 | delete mailconf; | 109 | delete mailconf; |
110 | 110 | ||
111 | } | 111 | } |
@@ -115,5 +115,5 @@ void EmailClient::init() | |||
115 | initStatusBar(this); | 115 | initStatusBar(this); |
116 | 116 | ||
117 | setToolBarsMovable(FALSE); | 117 | setToolBarsMovable(FALSE); |
118 | 118 | ||
119 | bar = new QToolBar(this); | 119 | bar = new QToolBar(this); |
@@ -129,3 +129,3 @@ void EmailClient::init() | |||
129 | mb->insertItem( tr( "Accounts" ), configure); | 129 | mb->insertItem( tr( "Accounts" ), configure); |
130 | 130 | ||
131 | selectAccountMenu = new QPopupMenu(mb); | 131 | selectAccountMenu = new QPopupMenu(mb); |
@@ -144,3 +144,3 @@ void EmailClient::init() | |||
144 | getMailButton->setPopup(selectAccountMenu); | 144 | getMailButton->setPopup(selectAccountMenu); |
145 | 145 | ||
146 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); | 146 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); |
@@ -150,3 +150,3 @@ void EmailClient::init() | |||
150 | sendMailButton->setWhatsThis("Send mail queued in the outbox"); | 150 | sendMailButton->setWhatsThis("Send mail queued in the outbox"); |
151 | 151 | ||
152 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); | 152 | composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); |
@@ -156,3 +156,3 @@ void EmailClient::init() | |||
156 | composeButton->setWhatsThis("Compose a new mail"); | 156 | composeButton->setWhatsThis("Compose a new mail"); |
157 | 157 | ||
158 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); | 158 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
@@ -163,4 +163,4 @@ void EmailClient::init() | |||
163 | cancelButton->setWhatsThis("Stop the currently active mail transfer"); | 163 | cancelButton->setWhatsThis("Stop the currently active mail transfer"); |
164 | 164 | ||
165 | 165 | ||
166 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 166 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
@@ -169,3 +169,3 @@ void EmailClient::init() | |||
169 | deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); | 169 | deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); |
170 | 170 | ||
171 | mailboxView = new OTabWidget( this, "mailboxView" ); | 171 | mailboxView = new OTabWidget( this, "mailboxView" ); |
@@ -207,5 +207,5 @@ void EmailClient::init() | |||
207 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); | 207 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
208 | 208 | ||
209 | setCentralWidget(mailboxView); | 209 | setCentralWidget(mailboxView); |
210 | 210 | ||
211 | } | 211 | } |
@@ -216,3 +216,3 @@ void EmailClient::initStatusBar(QWidget* parent) | |||
216 | statusBar->setSizeGripEnabled(FALSE); | 216 | statusBar->setSizeGripEnabled(FALSE); |
217 | 217 | ||
218 | status1Label = new QLabel( tr("Idle"), statusBar); | 218 | status1Label = new QLabel( tr("Idle"), statusBar); |
@@ -223,3 +223,3 @@ void EmailClient::initStatusBar(QWidget* parent) | |||
223 | status2Label, SLOT(setText(const QString &)) ); | 223 | status2Label, SLOT(setText(const QString &)) ); |
224 | 224 | ||
225 | progressBar = new QProgressBar(statusBar); | 225 | progressBar = new QProgressBar(statusBar); |
@@ -262,3 +262,3 @@ void EmailClient::enqueMail(const Email &mail) | |||
262 | } | 262 | } |
263 | 263 | ||
264 | if (accountList.count() > 0) { | 264 | if (accountList.count() > 0) { |
@@ -267,3 +267,3 @@ void EmailClient::enqueMail(const Email &mail) | |||
267 | } | 267 | } |
268 | 268 | ||
269 | Email addMail = mail; | 269 | Email addMail = mail; |
@@ -273,5 +273,5 @@ void EmailClient::enqueMail(const Email &mail) | |||
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 | } |
@@ -283,3 +283,3 @@ void EmailClient::sendQuedMail() | |||
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; |
@@ -315,3 +315,3 @@ void EmailClient::mailSent() | |||
315 | sendMailButton->setEnabled(TRUE); | 315 | sendMailButton->setEnabled(TRUE); |
316 | 316 | ||
317 | quedMessages.clear(); | 317 | quedMessages.clear(); |
@@ -321,11 +321,11 @@ void EmailClient::mailSent() | |||
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; |
@@ -335,6 +335,6 @@ void EmailClient::getNewMail() { | |||
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 |
@@ -350,5 +350,5 @@ void EmailClient::getNewMail() { | |||
350 | }*/ | 350 | }*/ |
351 | 351 | ||
352 | emailHandler->getMailHeaders(); | 352 | emailHandler->getMailHeaders(); |
353 | 353 | ||
354 | } | 354 | } |
@@ -359,3 +359,3 @@ void EmailClient::getAllNewMail() | |||
359 | currentAccount = accountList.first(); | 359 | currentAccount = accountList.first(); |
360 | getNewMail(); | 360 | getNewMail(); |
361 | } | 361 | } |
@@ -369,6 +369,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
369 | mailconf->setGroup(newMail.id); | 369 | mailconf->setGroup(newMail.id); |
370 | 370 | ||
371 | if (fromDisk) | 371 | if (fromDisk) |
372 | { | 372 | { |
373 | 373 | ||
374 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); | 374 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); |
@@ -377,6 +377,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
377 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); | 377 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); |
378 | } | 378 | } |
379 | else | 379 | else |
380 | { //mail arrived from server | 380 | { //mail arrived from server |
381 | 381 | ||
382 | newMail.serverId = mail.serverId; | 382 | newMail.serverId = mail.serverId; |
@@ -384,3 +384,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
384 | newMail.downloaded = mail.downloaded; | 384 | newMail.downloaded = mail.downloaded; |
385 | 385 | ||
386 | newMail.fromAccountId = emailHandler->getAccount()->id; | 386 | newMail.fromAccountId = emailHandler->getAccount()->id; |
@@ -388,6 +388,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
388 | } | 388 | } |
389 | 389 | ||
390 | //add if read or not | 390 | //add if read or not |
391 | newMail.read = mailconf->readBoolEntry("mailread"); | 391 | newMail.read = mailconf->readBoolEntry("mailread"); |
392 | 392 | ||
393 | //check if new mail | 393 | //check if new mail |
@@ -396,3 +396,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
396 | mailIdCount++; | 396 | mailIdCount++; |
397 | 397 | ||
398 | //set server count, so that if the user aborts, the new | 398 | //set server count, so that if the user aborts, the new |
@@ -401,3 +401,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
401 | currentAccount->lastServerMailCount++; | 401 | currentAccount->lastServerMailCount++; |
402 | 402 | ||
403 | mailconf->writeEntry("internalmailid", thisMailId); | 403 | mailconf->writeEntry("internalmailid", thisMailId); |
@@ -406,8 +406,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
406 | mailconf->writeEntry("serverid", newMail.serverId); | 406 | mailconf->writeEntry("serverid", newMail.serverId); |
407 | 407 | ||
408 | //addressList->addContact(newMail.fromMail, newMail.from); | 408 | //addressList->addContact(newMail.fromMail, newMail.from); |
409 | } | 409 | } |
410 | 410 | ||
411 | mailconf->writeEntry("downloaded", newMail.downloaded); | 411 | mailconf->writeEntry("downloaded", newMail.downloaded); |
412 | 412 | ||
413 | QString stringMailId; | 413 | QString stringMailId; |
@@ -415,3 +415,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
415 | //see if any attatchments needs to be stored | 415 | //see if any attatchments needs to be stored |
416 | 416 | ||
417 | for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { | 417 | for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { |
@@ -419,3 +419,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
419 | stringId.setNum(ePtr->id); | 419 | stringId.setNum(ePtr->id); |
420 | 420 | ||
421 | int id = mailconf->readNumEntry("enclosureid_" + stringId); | 421 | int id = mailconf->readNumEntry("enclosureid_" + stringId); |
@@ -428,3 +428,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
428 | mailconf->writeEntry("installed_" + stringId, FALSE); | 428 | mailconf->writeEntry("installed_" + stringId, FALSE); |
429 | 429 | ||
430 | ePtr->name = stringMailId + "_" + stringId; | 430 | ePtr->name = stringMailId + "_" + stringId; |
@@ -446,3 +446,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
446 | ePtr->path = mailconf->readEntry("path_" + stringId); | 446 | ePtr->path = mailconf->readEntry("path_" + stringId); |
447 | } | 447 | } |
448 | } | 448 | } |
@@ -451,9 +451,9 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
451 | bool found=false; | 451 | bool found=false; |
452 | 452 | ||
453 | if (!fromDisk) | 453 | if (!fromDisk) |
454 | { | 454 | { |
455 | 455 | ||
456 | Email *mailPtr; | 456 | Email *mailPtr; |
457 | item = (EmailListItem *) inboxView->firstChild(); | 457 | item = (EmailListItem *) inboxView->firstChild(); |
458 | while ((item != NULL)&&(!found)) | 458 | while ((item != NULL)&&(!found)) |
459 | { | 459 | { |
@@ -474,8 +474,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
474 | // item->setPixmap(0, Resource::loadPixmap("mailit/attach")); | 474 | // item->setPixmap(0, Resource::loadPixmap("mailit/attach")); |
475 | // } | 475 | // } |
476 | /*if (!newMail.downloaded) | 476 | /*if (!newMail.downloaded) |
477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ | 477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ |
478 | 478 | ||
479 | mailboxView->setCurrentTab(0); | 479 | mailboxView->setCurrentTab(0); |
480 | 480 | ||
481 | } | 481 | } |
@@ -497,3 +497,3 @@ void EmailClient::allMailArrived(int /*count*/) | |||
497 | status1Label->setText("Idle"); | 497 | status1Label->setText("Idle"); |
498 | 498 | ||
499 | progressBar->reset(); | 499 | progressBar->reset(); |
@@ -502,3 +502,3 @@ void EmailClient::allMailArrived(int /*count*/) | |||
502 | //} | 502 | //} |
503 | 503 | ||
504 | // all headers downloaded from server, start downloading remaining mails | 504 | // all headers downloaded from server, start downloading remaining mails |
@@ -508,3 +508,3 @@ void EmailClient::allMailArrived(int /*count*/) | |||
508 | 508 | ||
509 | 509 | ||
510 | mailboxView->setCurrentTab(0); | 510 | mailboxView->setCurrentTab(0); |
@@ -523,3 +523,3 @@ void EmailClient::smtpError(int code, const QString & Msg) | |||
523 | QString temp; | 523 | QString temp; |
524 | 524 | ||
525 | if (code == ErrUnknownResponse) { | 525 | if (code == ErrUnknownResponse) { |
@@ -535,3 +535,3 @@ void EmailClient::smtpError(int code, const QString & Msg) | |||
535 | } | 535 | } |
536 | 536 | ||
537 | if (code != ErrCancel) { | 537 | if (code != ErrCancel) { |
@@ -541,3 +541,3 @@ void EmailClient::smtpError(int code, const QString & Msg) | |||
541 | } | 541 | } |
542 | 542 | ||
543 | sending = FALSE; | 543 | sending = FALSE; |
@@ -551,3 +551,3 @@ void EmailClient::popError(int code, const QString & Msg) | |||
551 | QString temp; | 551 | QString temp; |
552 | 552 | ||
553 | if (code == ErrUnknownResponse) { | 553 | if (code == ErrUnknownResponse) { |
@@ -564,3 +564,3 @@ void EmailClient::popError(int code, const QString & Msg) | |||
564 | temp = tr("<qt>socket packet error</qt>"); | 564 | temp = tr("<qt>socket packet error</qt>"); |
565 | } | 565 | } |
566 | 566 | ||
@@ -572,3 +572,3 @@ void EmailClient::popError(int code, const QString & Msg) | |||
572 | } | 572 | } |
573 | 573 | ||
574 | receiving = FALSE; | 574 | receiving = FALSE; |
@@ -582,3 +582,3 @@ void EmailClient::inboxItemSelected() | |||
582 | //killTimer(timerID); | 582 | //killTimer(timerID); |
583 | 583 | ||
584 | item = (EmailListItem*) inboxView->selectedItem(); | 584 | item = (EmailListItem*) inboxView->selectedItem(); |
@@ -592,3 +592,3 @@ void EmailClient::outboxItemSelected() | |||
592 | //killTimer(timerID); | 592 | //killTimer(timerID); |
593 | 593 | ||
594 | item = (EmailListItem*) outboxView->selectedItem(); | 594 | item = (EmailListItem*) outboxView->selectedItem(); |
@@ -607,3 +607,3 @@ void EmailClient::readMail() | |||
607 | QFile f(getPath(FALSE) + "inbox.txt"); | 607 | QFile f(getPath(FALSE) + "inbox.txt"); |
608 | 608 | ||
609 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 609 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
@@ -612,3 +612,3 @@ void EmailClient::readMail() | |||
612 | f.close(); | 612 | f.close(); |
613 | 613 | ||
614 | start = 0; | 614 | start = 0; |
@@ -619,3 +619,3 @@ void EmailClient::readMail() | |||
619 | stop = s.length() - del.length(); | 619 | stop = s.length() - del.length(); |
620 | 620 | ||
621 | mail.rawMail = s.mid(start, stop + del.length() - start ); | 621 | mail.rawMail = s.mid(start, stop + del.length() - start ); |
@@ -625,3 +625,3 @@ void EmailClient::readMail() | |||
625 | } | 625 | } |
626 | 626 | ||
627 | QFile fo(getPath(FALSE) + "outbox.txt"); | 627 | QFile fo(getPath(FALSE) + "outbox.txt"); |
@@ -631,3 +631,3 @@ void EmailClient::readMail() | |||
631 | fo.close(); | 631 | fo.close(); |
632 | 632 | ||
633 | start = 0; | 633 | start = 0; |
@@ -638,3 +638,3 @@ void EmailClient::readMail() | |||
638 | stop = s.length() - del.length(); | 638 | stop = s.length() - del.length(); |
639 | 639 | ||
640 | mail.rawMail = s.mid(start, stop + del.length() - start ); | 640 | mail.rawMail = s.mid(start, stop + del.length() - start ); |
@@ -645,3 +645,3 @@ void EmailClient::readMail() | |||
645 | enqueMail(mail); | 645 | enqueMail(mail); |
646 | 646 | ||
647 | } | 647 | } |
@@ -654,3 +654,3 @@ void EmailClient::saveMail(const QString &fileName, QListView *view) | |||
654 | Email *mail; | 654 | Email *mail; |
655 | 655 | ||
656 | if (! f.open(IO_WriteOnly) ) { | 656 | if (! f.open(IO_WriteOnly) ) { |
@@ -664,6 +664,6 @@ void EmailClient::saveMail(const QString &fileName, QListView *view) | |||
664 | t << mail->rawMail; | 664 | t << mail->rawMail; |
665 | 665 | ||
666 | mailconf->setGroup(mail->id); | 666 | mailconf->setGroup(mail->id); |
667 | mailconf->writeEntry("mailread", mail->read); | 667 | mailconf->writeEntry("mailread", mail->read); |
668 | 668 | ||
669 | item = (EmailListItem *) item->nextSibling(); | 669 | item = (EmailListItem *) item->nextSibling(); |
@@ -678,3 +678,3 @@ QString EmailClient::getPath(bool enclosurePath) | |||
678 | QString enclosures = "enclosures"; | 678 | QString enclosures = "enclosures"; |
679 | 679 | ||
680 | QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath); | 680 | QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath); |
@@ -682,11 +682,11 @@ QString EmailClient::getPath(bool enclosurePath) | |||
682 | dir.mkdir( dir.path() ); | 682 | dir.mkdir( dir.path() ); |
683 | 683 | ||
684 | if (enclosurePath) { | 684 | if (enclosurePath) { |
685 | dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures); | 685 | dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures); |
686 | 686 | ||
687 | if ( !dir.exists() ) | 687 | if ( !dir.exists() ) |
688 | dir.mkdir( dir.path() ); | 688 | dir.mkdir( dir.path() ); |
689 | 689 | ||
690 | return (dir.path() + "/"); | 690 | return (dir.path() + "/"); |
691 | 691 | ||
692 | } | 692 | } |
@@ -698,9 +698,9 @@ void EmailClient::readSettings() | |||
698 | int y,acc_count; | 698 | int y,acc_count; |
699 | 699 | ||
700 | mailconf->setGroup("mailitglobal"); | 700 | mailconf->setGroup("mailitglobal"); |
701 | acc_count=mailconf->readNumEntry("Accounts",0); | 701 | acc_count=mailconf->readNumEntry("Accounts",0); |
702 | 702 | ||
703 | for (int accountPos = 0;accountPos<acc_count ; accountPos++) | 703 | for (int accountPos = 0;accountPos<acc_count ; accountPos++) |
704 | { | 704 | { |
705 | mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... | 705 | mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... |
706 | account.accountName = mailconf->readEntry("AccName",""); | 706 | account.accountName = mailconf->readEntry("AccName",""); |
@@ -716,3 +716,3 @@ void EmailClient::readSettings() | |||
716 | account.synchronize = FALSE; | 716 | account.synchronize = FALSE; |
717 | 717 | ||
718 | account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); | 718 | account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); |
@@ -720,11 +720,11 @@ void EmailClient::readSettings() | |||
720 | { | 720 | { |
721 | mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); | 721 | mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); |
722 | } | 722 | } |
723 | 723 | ||
724 | accountList.append(&account); | 724 | accountList.append(&account); |
725 | } | 725 | } |
726 | 726 | ||
727 | mailconf->setGroup("mailitglobal"); | 727 | mailconf->setGroup("mailitglobal"); |
728 | 728 | ||
729 | if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) | 729 | if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) |
730 | { | 730 | { |
@@ -732,3 +732,3 @@ void EmailClient::readSettings() | |||
732 | } | 732 | } |
733 | if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) | 733 | if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) |
734 | { | 734 | { |
@@ -743,4 +743,4 @@ void EmailClient::saveSettings() | |||
743 | 743 | ||
744 | 744 | ||
745 | if (!mailconf) | 745 | if (!mailconf) |
746 | { | 746 | { |
@@ -749,5 +749,5 @@ void EmailClient::saveSettings() | |||
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 | { |
@@ -762,3 +762,3 @@ void EmailClient::saveSettings() | |||
762 | mailconf->writeEntry("AccountId",accountPtr->id); | 762 | mailconf->writeEntry("AccountId",accountPtr->id); |
763 | if (accountPtr->synchronize) | 763 | if (accountPtr->synchronize) |
764 | { | 764 | { |
@@ -767,4 +767,4 @@ void EmailClient::saveSettings() | |||
767 | mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); | 767 | mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); |
768 | } | 768 | } |
769 | else | 769 | else |
770 | { | 770 | { |
@@ -773,3 +773,3 @@ void EmailClient::saveSettings() | |||
773 | } | 773 | } |
774 | 774 | ||
775 | mailconf->setGroup("mailitglobal"); | 775 | mailconf->setGroup("mailitglobal"); |
@@ -787,3 +787,3 @@ void EmailClient::selectAccount(int id) | |||
787 | } else { | 787 | } else { |
788 | emit newCaption("Mailit ! No account defined"); | 788 | emit newCaption( tr("Mailit ! No account defined") ); |
789 | } | 789 | } |
@@ -794,3 +794,3 @@ void EmailClient::editAccount(int id) | |||
794 | MailAccount *newAccount; | 794 | MailAccount *newAccount; |
795 | 795 | ||
796 | editAccountView = new EditAccount(this, "account", TRUE); | 796 | editAccountView = new EditAccount(this, "account", TRUE); |
@@ -803,6 +803,6 @@ void EmailClient::editAccount(int id) | |||
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) { |
@@ -817,3 +817,3 @@ void EmailClient::editAccount(int id) | |||
817 | } | 817 | } |
818 | 818 | ||
819 | delete editAccountView; | 819 | delete editAccountView; |
@@ -825,8 +825,8 @@ void EmailClient::deleteAccount(int id) | |||
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); |
@@ -842,3 +842,3 @@ void EmailClient::updateAccounts() | |||
842 | MailAccount *accountPtr; | 842 | MailAccount *accountPtr; |
843 | 843 | ||
844 | //rebuild menus, clear all first | 844 | //rebuild menus, clear all first |
@@ -848,6 +848,6 @@ void EmailClient::updateAccounts() | |||
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; |
@@ -855,3 +855,3 @@ void EmailClient::updateAccounts() | |||
855 | accountPtr = accountList.next()) { | 855 | accountPtr = accountList.next()) { |
856 | 856 | ||
857 | editAccountMenu->insertItem(accountPtr->accountName, | 857 | editAccountMenu->insertItem(accountPtr->accountName, |
@@ -870,7 +870,7 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
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 |
@@ -881,6 +881,6 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
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 |
@@ -892,4 +892,4 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
892 | inboxView->takeItem(mailItem); | 892 | inboxView->takeItem(mailItem); |
893 | } | 893 | } |
894 | else | 894 | else |
895 | { | 895 | { |
@@ -907,3 +907,3 @@ void EmailClient::setTotalSize(int /*size*/) | |||
907 | { | 907 | { |
908 | 908 | ||
909 | } | 909 | } |
@@ -925,10 +925,10 @@ void EmailClient::deleteItem() | |||
925 | QListView* box; | 925 | QListView* box; |
926 | 926 | ||
927 | EmailListItem* eli; | 927 | EmailListItem* eli; |
928 | // int pos; | 928 | // int pos; |
929 | 929 | ||
930 | inbox ? box=inboxView : box=outboxView; | 930 | inbox ? box=inboxView : box=outboxView; |
931 | 931 | ||
932 | eli=(EmailListItem*)box->selectedItem(); | 932 | eli=(EmailListItem*)box->selectedItem(); |
933 | 933 | ||
934 | if (eli) | 934 | if (eli) |
@@ -936,3 +936,3 @@ void EmailClient::deleteItem() | |||
936 | box->setSelected(eli->itemBelow(),true); //select the previous item | 936 | box->setSelected(eli->itemBelow(),true); //select the previous item |
937 | 937 | ||
938 | deleteMail(eli,(bool&)inbox); //remove mail entry | 938 | deleteMail(eli,(bool&)inbox); //remove mail entry |
@@ -954,8 +954,8 @@ void EmailClient::inboxItemReleased() | |||
954 | //killTimer(timerID); | 954 | //killTimer(timerID); |
955 | 955 | ||
956 | 956 | ||
957 | QPopupMenu *action = new QPopupMenu(this); | 957 | QPopupMenu *action = new QPopupMenu(this); |
958 | 958 | ||
959 | int reply=0; | 959 | int reply=0; |
960 | 960 | ||
961 | action->insertItem(tr( "Reply To" ),this,SLOT(reply())); | 961 | action->insertItem(tr( "Reply To" ),this,SLOT(reply())); |
@@ -964,7 +964,7 @@ void EmailClient::inboxItemReleased() | |||
964 | action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); | 964 | action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); |
965 | 965 | ||
966 | action->exec(QCursor::pos()); | 966 | action->exec(QCursor::pos()); |
967 | 967 | ||
968 | if (action) delete action; | 968 | if (action) delete action; |
969 | 969 | ||
970 | }*/ | 970 | }*/ |
@@ -979,3 +979,3 @@ Email* EmailClient::getCurrentMail() | |||
979 | } | 979 | } |
980 | 980 | ||
981 | void EmailClient::download(Email* mail) | 981 | void EmailClient::download(Email* mail) |
@@ -983,9 +983,9 @@ void EmailClient::download(Email* mail) | |||
983 | MailAccount* acc=0; | 983 | MailAccount* acc=0; |
984 | 984 | ||
985 | tempMailDownloadList.clear(); | 985 | tempMailDownloadList.clear(); |
986 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); | 986 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); |
987 | 987 | ||
988 | acc=accountList.at(mail->fromAccountId-1); | 988 | acc=accountList.at(mail->fromAccountId-1); |
989 | if (acc) | 989 | if (acc) |
990 | { | 990 | { |
991 | emailHandler->setAccount(*acc); | 991 | emailHandler->setAccount(*acc); |
@@ -993,3 +993,3 @@ void EmailClient::download(Email* mail) | |||
993 | } | 993 | } |
994 | else | 994 | else |
995 | QMessageBox::warning(qApp->activeWindow(), | 995 | QMessageBox::warning(qApp->activeWindow(), |
@@ -1004,5 +1004,5 @@ void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) | |||
1004 | QVBoxLayout *vbProg = new QVBoxLayout( &qd ); | 1004 | QVBoxLayout *vbProg = new QVBoxLayout( &qd ); |
1005 | 1005 | ||
1006 | initStatusBar(&qd); | 1006 | initStatusBar(&qd); |
1007 | 1007 | ||
1008 | if (statusBar==0) | 1008 | if (statusBar==0) |
@@ -1020,19 +1020,19 @@ void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) | |||
1020 | else if (msg=="compose()") | 1020 | else if (msg=="compose()") |
1021 | { | 1021 | { |
1022 | QDialog qd(qApp->activeWindow(),"Getting mail",true); | 1022 | QDialog qd(qApp->activeWindow(),"Getting mail",true); |
1023 | 1023 | ||
1024 | WriteMail wm(&qd,"write new mail"); | 1024 | WriteMail wm(&qd,"write new mail"); |
1025 | QVBoxLayout vbProg( &qd ); | 1025 | QVBoxLayout vbProg( &qd ); |
1026 | 1026 | ||
1027 | wm.showMaximized(); | 1027 | wm.showMaximized(); |
1028 | vbProg.addWidget(&wm); | 1028 | vbProg.addWidget(&wm); |
1029 | 1029 | ||
1030 | qd.showMaximized(); | 1030 | qd.showMaximized(); |
1031 | 1031 | ||
1032 | emit composeRequested(); | 1032 | emit composeRequested(); |
1033 | qd.exec(); | 1033 | qd.exec(); |
1034 | 1034 | ||
1035 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); | 1035 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | else if (msg=="dialog()") | 1038 | else if (msg=="dialog()") |
diff --git a/noncore/unsupported/mailit/emaillistitem.cpp b/noncore/unsupported/mailit/emaillistitem.cpp index fc9f766..a25f93a 100644 --- a/noncore/unsupported/mailit/emaillistitem.cpp +++ b/noncore/unsupported/mailit/emaillistitem.cpp | |||
@@ -27,5 +27,5 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) | |||
27 | QString temp; | 27 | QString temp; |
28 | 28 | ||
29 | mail = mailIn; | 29 | mail = mailIn; |
30 | 30 | ||
31 | if (inbox) { | 31 | if (inbox) { |
@@ -40,4 +40,5 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) | |||
40 | setText(1, mail.subject); | 40 | setText(1, mail.subject); |
41 | setText(2,mail.date); | 41 | // setText(2,mail.date); |
42 | 42 | setText(2,dateFromULCString(mail.date)); | |
43 | |||
43 | if (mailIn.files.count()>0) | 44 | if (mailIn.files.count()>0) |
@@ -46,3 +47,3 @@ EmailListItem::EmailListItem(QListView *parent, Email mailIn, bool inbox) | |||
46 | } | 47 | } |
47 | 48 | ||
48 | selected = FALSE; | 49 | selected = FALSE; |
@@ -84,3 +85,3 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, | |||
84 | _cg.setColor( QColorGroup::Text, Qt::red); | 85 | _cg.setColor( QColorGroup::Text, Qt::red); |
85 | 86 | ||
86 | /* if (selected) { | 87 | /* if (selected) { |
@@ -94,3 +95,3 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, | |||
94 | } | 95 | } |
95 | */ | 96 | */ |
96 | QListViewItem::paintCell( p, _cg, column, width, alignment ); | 97 | QListViewItem::paintCell( p, _cg, column, width, alignment ); |
@@ -99 +100,59 @@ void EmailListItem::paintCell( QPainter *p, const QColorGroup &cg, | |||
99 | } | 100 | } |
101 | |||
102 | /* | ||
103 | * Converts an E-Mail date (ULC) RFC 2822 conform to a QDateTime. | ||
104 | * Returning a QString with formatting of "YYYY-MM-DD HH:MM:SS" | ||
105 | * (zodiac: This method was tested with more than 300 inbox mails, | ||
106 | * it didn't slow down the loading of mail-it.) | ||
107 | */ | ||
108 | QString EmailListItem::dateFromULCString( QString ulcDate ) | ||
109 | { | ||
110 | QString sTemp, sTime; | ||
111 | int iPos, iDay, iMon=1, iYear; | ||
112 | |||
113 | iPos=ulcDate.find(','); | ||
114 | if (iPos) { // it has a day-of-week | ||
115 | ulcDate=ulcDate.remove(0,++iPos); //.stripWhiteSpace(); | ||
116 | } | ||
117 | |||
118 | QStringList dateEntries = QStringList::split(" ",ulcDate,FALSE); | ||
119 | QStringList::Iterator iter = dateEntries.begin(); | ||
120 | |||
121 | // Get day as DD | ||
122 | iDay = (*iter++).toInt(); | ||
123 | |||
124 | // Get month as string Mmm | ||
125 | sTemp = (*iter++); | ||
126 | if (sTemp =="Jan") {iMon=1;} else | ||
127 | if (sTemp =="Feb") {iMon=2;} else | ||
128 | if (sTemp =="Mar") {iMon=3;} else | ||
129 | if (sTemp =="Apr") {iMon=4;} else | ||
130 | if (sTemp =="May") {iMon=5;} else | ||
131 | if (sTemp =="Jun") {iMon=6;} else | ||
132 | if (sTemp =="Jul") {iMon=7;} else | ||
133 | if (sTemp =="Aug") {iMon=8;} else | ||
134 | if (sTemp =="Sep") {iMon=9;} else | ||
135 | if (sTemp =="Oct") {iMon=10;} else | ||
136 | if (sTemp =="Nov") {iMon=11;} else | ||
137 | if (sTemp =="Dec") {iMon=12;} | ||
138 | |||
139 | // Get year as YYYY or YY | ||
140 | iYear = (*iter++).toInt(); | ||
141 | |||
142 | QDate date = QDate(iYear, iMon, iDay); | ||
143 | |||
144 | // Convert timestring into a QTime | ||
145 | QStringList timeEntries = QStringList::split(":",(*iter++),FALSE); | ||
146 | QStringList::Iterator iterTime = timeEntries.begin(); | ||
147 | iYear=(*iterTime++).toInt(); // var reuse.. *cough* | ||
148 | iMon=(*iterTime++).toInt(); | ||
149 | iDay=(*iterTime++).toInt(); | ||
150 | QTime time = QTime(iYear,iMon,iDay); | ||
151 | |||
152 | return QString::number(date.year())+"-" | ||
153 | +QString::number(date.month()).rightJustify(2,'0')+"-" | ||
154 | +QString::number(date.day()).rightJustify(2,'0')+" " | ||
155 | +time.toString(); | ||
156 | } | ||
157 | |||
158 | |||
diff --git a/noncore/unsupported/mailit/emaillistitem.h b/noncore/unsupported/mailit/emaillistitem.h index 642932c..129a774 100644 --- a/noncore/unsupported/mailit/emaillistitem.h +++ b/noncore/unsupported/mailit/emaillistitem.h | |||
@@ -34,3 +34,3 @@ public: | |||
34 | bool itemSelected(); | 34 | bool itemSelected(); |
35 | 35 | ||
36 | protected: | 36 | protected: |
@@ -41,2 +41,3 @@ private: | |||
41 | bool selected; | 41 | bool selected; |
42 | QString dateFromULCString( QString ulc ); | ||
42 | }; | 43 | }; |
diff --git a/noncore/unsupported/mailit/mailit.pro b/noncore/unsupported/mailit/mailit.pro index 5e9a83a..0224886 100644 --- a/noncore/unsupported/mailit/mailit.pro +++ b/noncore/unsupported/mailit/mailit.pro | |||
@@ -1,4 +1,3 @@ | |||
1 | TEMPLATE = app | ||
2 | TARGET = mailit | 1 | TARGET = mailit |
3 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release quick-app |
4 | HEADERS = emailclient.h \ | 3 | HEADERS = emailclient.h \ |
@@ -39,5 +38,2 @@ LIBS += -lqpe -lopie | |||
39 | # -lssl | 38 | # -lssl |
40 | MOC_DIR=qpeobj | ||
41 | OBJECTS_DIR=qpeobj | ||
42 | DESTDIR=$(OPIEDIR)/bin | ||
43 | 39 | ||
diff --git a/noncore/unsupported/mailit/mailitwindow.h b/noncore/unsupported/mailit/mailitwindow.h index e818d32..11e56b9 100644 --- a/noncore/unsupported/mailit/mailitwindow.h +++ b/noncore/unsupported/mailit/mailitwindow.h | |||
@@ -35,2 +35,3 @@ class MailItWindow: public QMainWindow | |||
35 | public: | 35 | public: |
36 | static QString appName() { return QString::fromLatin1("mailit"); } | ||
36 | MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 37 | MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
diff --git a/noncore/unsupported/mailit/main.cpp b/noncore/unsupported/mailit/main.cpp index 3a3e1fc..71f8877 100644 --- a/noncore/unsupported/mailit/main.cpp +++ b/noncore/unsupported/mailit/main.cpp | |||
@@ -22,8 +22,4 @@ | |||
22 | 22 | ||
23 | int main(int argc, char* argv[]) | 23 | #include <opie/oapplicationfactory.h> |
24 | { | 24 | |
25 | QPEApplication a( argc, argv ); | 25 | OPIE_EXPORT_APP( OApplicationFactory<MailItWindow> ) \ No newline at end of file |
26 | MailItWindow mw(0, 0); | ||
27 | a.showMainDocumentWidget(&mw); | ||
28 | return a.exec(); | ||
29 | } | ||