summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/emailclient.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mailit/emailclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/emailclient.cpp231
1 files changed, 104 insertions, 127 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index ad1e0b4..23059cf 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -25,2 +25,3 @@
#include <qaction.h>
+#include <qwhatsthis.h>
#include <qpe/resource.h>
@@ -84,2 +85,3 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
+ mailboxView->setCurrentTab(0); //ensure that inbox has focus
}
@@ -115,2 +117,3 @@ void EmailClient::init()
progressBar = new QProgressBar(statusBar);
+
connect(emailHandler, SIGNAL(mailboxSize(int)),
@@ -129,2 +132,3 @@ void EmailClient::init()
bar = new QToolBar(this);
+ QWhatsThis::add(bar,tr("Main operation toolbar"));
bar->setHorizontalStretchable( TRUE );
@@ -150,22 +154,6 @@ void EmailClient::init()
getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar);
- //connect(setAccountlButton, SIGNAL(activated()), this, SLOT(setCurrentAccount()) );
- // setAccountButton->addTo(bar);
- //setAccountButton->addTo(mail);
-
- /*idCount = 0;
-
- for (MailAccount* accountPtr = accountList.first(); accountPtr != 0;
- accountPtr = accountList.next()) {
-
- selectAccountMenu->insertItem(accountPtr->accountName,this, SLOT(selectAccount(int)), 0, idCount);
- idCount++;
- }*/
+ QWhatsThis::add(getMailButton,tr("Click to download mail via all available accounts.\n Press and hold to select the desired account."));
+
getMailButton->setPopup(selectAccountMenu);
-
-
- /*getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0);
- connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) );
- getMailButton->addTo(bar);*/
- //getMailButton->addTo(mail);
-
+
sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0);
@@ -174,2 +162,3 @@ void EmailClient::init()
sendMailButton->addTo(mail);
+ sendMailButton->setWhatsThis("Send mail queued in the outbox");
@@ -179,2 +168,3 @@ void EmailClient::init()
composeButton->addTo(mail);
+ composeButton->setWhatsThis("Compose a new mail");
@@ -185,2 +175,4 @@ void EmailClient::init()
cancelButton->setEnabled(FALSE);
+ cancelButton->setWhatsThis("Stop the currently active mail transfer");
+
@@ -189,2 +181,3 @@ void EmailClient::init()
deleteButton->addTo(bar);
+ deleteButton->setWhatsThis("Remove the currently selected eMail(s)");
@@ -203,2 +196,4 @@ void EmailClient::init()
inboxView->setAllColumnsShowFocus(TRUE);
+ QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n It keeps the fetched mail which can be viewed by double clicking the entry.\n"
+ " A blue attachment icon shows whether this mail has attachments."));
@@ -217,2 +212,3 @@ void EmailClient::init()
+ QWhatsThis::add(outboxView,QWidget::tr("This is the oubox view.\n It keeps the queued mails to send which can be reviewed by double clicking the entry."));
grid_3->addWidget( outboxView, 0, 0 );
@@ -222,3 +218,2 @@ void EmailClient::init()
- mailboxView->setCurrentTab(0);
}
@@ -326,3 +321,3 @@ void EmailClient::getNewMail() {
//get any previous mails not downloaded and add to queue
-/* mailDownloadList.clear();
+ mailDownloadList.clear();
Email *mailPtr;
@@ -335,5 +330,6 @@ void EmailClient::getNewMail() {
item = (EmailListItem *) item->nextSibling();
- }*/
+ }
emailHandler->getMailHeaders();
+
}
@@ -353,6 +349,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
emailHandler->parse(mail.rawMail, lineShift, &newMail);
-
mailconf->setGroup(newMail.id);
-
- if (fromDisk) {
+
+ if (fromDisk)
+ {
newMail.downloaded = mailconf->readBoolEntry("downloaded");
@@ -361,3 +357,5 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
newMail.fromAccountId = mailconf->readNumEntry("fromaccountid");
- } else { //mail arrived from server
+ }
+ else
+ { //mail arrived from server
newMail.serverId = mail.serverId;
@@ -380,3 +378,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
//header is not reloaded
- if (currentAccount->synchronize)
+ if ((currentAccount)&&(currentAccount->synchronize))
currentAccount->lastServerMailCount++;
@@ -388,9 +386,11 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
- addressList->addContact(newMail.fromMail, newMail.from);
- } else if (!fromDisk) { //body to header arrived
- mailconf->writeEntry("downloaded", TRUE);
+ //addressList->addContact(newMail.fromMail, newMail.from);
}
+
+ mailconf->writeEntry("downloaded", newMail.downloaded);
+
QString stringMailId;
stringMailId.setNum(thisMailId);
- //se if any attatchments needs to be stored
+ //see if any attatchments needs to be stored
+
for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) {
@@ -428,6 +428,12 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
}
- if (!previewingMail && !fromDisk) {
+
+ bool found=false;
+
+ if (!fromDisk)
+ {
+
Email *mailPtr;
item = (EmailListItem *) inboxView->firstChild();
- while (item != NULL) {
+ while ((item != NULL)&&(!found))
+ {
mailPtr = item->getMail();
@@ -436,2 +442,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
emit mailUpdated(item->getMail());
+ found = true;
}
@@ -439,7 +446,7 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
}
- } else {
- item = new EmailListItem(inboxView, newMail, TRUE);
- if (!newMail.downloaded)
- mailDownloadList.sizeInsert(newMail.serverId, newMail.size);
}
+ if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE);
+
+ /*if (!newMail.downloaded)
+ mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/
@@ -452,3 +459,3 @@ void EmailClient::allMailArrived(int count)
// not previewing means all mailtransfer has been done
- if (!previewingMail) {
+ /*if (!previewingMail) {*/
if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) {
@@ -468,3 +475,3 @@ void EmailClient::allMailArrived(int count)
}
- }
+ //}
@@ -475,3 +482,3 @@ void EmailClient::allMailArrived(int count)
- emailHandler->getMailByList(&mailDownloadList);
+ //emailHandler->getMailByList(&mailDownloadList);
@@ -543,3 +550,3 @@ void EmailClient::inboxItemSelected()
{
- killTimer(timerID);
+ //killTimer(timerID);
@@ -553,3 +560,3 @@ void EmailClient::outboxItemSelected()
{
- killTimer(timerID);
+ //killTimer(timerID);
@@ -569,5 +576,3 @@ void EmailClient::readMail()
QFile f(getPath(FALSE) + "inbox.txt");
-// QFileInfo fi(f);
- //qDebug( f.name());
-
+
if ( f.open(IO_ReadOnly) ) { // file opened successfully
@@ -624,3 +629,2 @@ void EmailClient::saveMail(QString fileName, QListView *view)
item = (EmailListItem *) view->firstChild();
- //qDebug (QString("Write : ") );
QTextStream t(&f);
@@ -628,4 +632,2 @@ void EmailClient::saveMail(QString fileName, QListView *view)
mail = item->getMail();
- //qDebug(mail->rawMail);
- //qDebug(mail->recipients.first());
t << mail->rawMail;
@@ -664,52 +666,27 @@ void EmailClient::readSettings()
{
- TextParser *p;
- QString s;
- int pos, accountPos, y;
- QFile f( getPath(FALSE) + "settings.txt");
-
- if ( f.open(IO_ReadOnly) ) { // file opened successfully
- QTextStream t( &f ); // use a text stream
- s = t.read();
- f.close();
+ int y,acc_count, accountPos=0;
- p = new TextParser(s, "\n");
-
- accountPos = 0;
- while ( (accountPos = p->find("ACCOUNTSTART",';', accountPos, TRUE)) != -1 ) {
- accountPos++;
- if ( (pos = p->find("ACCOUNTNAME",':', accountPos, TRUE)) != -1 )
- account.accountName = p->getString(& ++pos, 'z', TRUE);
- if ( (pos = p->find("NAME",':', accountPos, TRUE)) != -1)
- account.name = p->getString(& ++pos, 'z', TRUE);
- if ( (pos = p->find("EMAIL",':', accountPos, TRUE)) != -1)
- account.emailAddress = p->getString(& ++pos, 'z', TRUE);
- if ( (pos = p->find("POPUSER",':', accountPos, TRUE)) != -1)
- account.popUserName = p->getString(& ++pos, 'z', TRUE);
- if ( (pos = p->find("POPPASSWORD",':', accountPos, TRUE)) != -1)
- account.popPasswd = p->getString(& ++pos, 'z', TRUE);
- if ( (pos = p->find("POPSERVER",':', accountPos, TRUE)) != -1)
- account.popServer = p->getString(& ++pos, 'z', TRUE);
- if ( (pos = p->find("SMTPSERVER",':', accountPos, TRUE)) != -1)
- account.smtpServer = p->getString(& ++pos, 'z', TRUE);
- if ( (pos = p->find("ACCOUNTID",':', accountPos, TRUE)) != -1) {
- s = p->getString(& ++pos, 'z', TRUE);
- account.id = s.toInt();
- }
+ mailconf->setGroup("mailitglobal");
+ acc_count=mailconf->readNumEntry("Accounts",0);
+ for (int accountPos = 0;accountPos<acc_count ; accountPos++)
+ {
+ mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ...
+ account.accountName = mailconf->readEntry("AccName","");
+ account.name = mailconf->readEntry("UserName","");
+ account.emailAddress = mailconf->readEntry("Email","");
+ account.popUserName = mailconf->readEntry("POPUser","");
+ account.popPasswd = mailconf->readEntryCrypt("POPPassword","");
+ account.popServer = mailconf->readEntry("POPServer","");
+ account.smtpServer = mailconf->readEntry("SMTPServer","");
+ account.id = mailconf->readNumEntry("AccountId",0);
+ account.syncLimit = mailconf->readNumEntry("HeaderLimit",0);
account.lastServerMailCount = 0;
account.synchronize = FALSE;
- if ( (pos = p->find("SYNCHRONIZE",':', accountPos, TRUE)) != -1) {
- if (p->getString(& ++pos, 'z', TRUE).upper() == "YES") {
- account.synchronize = TRUE;
- if ( (pos = p->find("LASTSERVERMAILCOUNT",':', accountPos, TRUE)) != -1) {
- s = p->getString(& ++pos, 'z', TRUE);
- account.lastServerMailCount = s.toInt();
- }
- }
- }
-
- if ( (pos = p->find("SYNCLIMIT",':', accountPos, TRUE)) != -1) {
- account.syncLimit = p->getString(& ++pos, 'z', TRUE).toInt();
+
+ account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes");
+ if (account.synchronize)
+ {
+ mailconf->readNumEntry("LASTSERVERMAILCOUNT",0);
}
-
@@ -717,9 +694,11 @@ void EmailClient::readSettings()
}
- delete p;
- }
+
mailconf->setGroup("mailitglobal");
- if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) {
+
+ if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1)
+ {
mailIdCount = y;
}
- if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) {
+ if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1)
+ {
accountIdCount = y;
@@ -730,40 +709,38 @@ void EmailClient::saveSettings()
{
-
- QString temp;
- QFile f( getPath(FALSE) + "settings.txt");
+ int acc_count=0;
MailAccount *accountPtr;
-
- if (! f.open(IO_WriteOnly) ) {
- qWarning("could not save settings file");
+
+
+ if (!mailconf)
+ {
+ qWarning("could not save settings");
return;
}
- QTextStream t(&f);
- t << "#Settings for OPIE Mailit program\n";
for (accountPtr = accountList.first(); accountPtr != 0;
- accountPtr = accountList.next()) {
-
- t << "accountStart;\n";
- t << "AccountName: " + accountPtr->accountName + "\n";
- t << "Name: " + accountPtr->name + "\n";
- t << "Email: " + accountPtr->emailAddress + "\n";
- t << "POPUser: " + accountPtr->popUserName + "\n";
- t << "POPPAssword: " + accountPtr->popPasswd + "\n";
- t << "POPServer: " + accountPtr->popServer + "\n";
- t << "SMTPServer: " + accountPtr->smtpServer + "\n";
- t << "AccountId: " << accountPtr->id << "\n";
- if (accountPtr->synchronize) {
- t << "Synchronize: Yes\n";
- t << "LastServerMailCount: ";
- t << accountPtr->lastServerMailCount << "\n";
- } else {
- t << "Synchronize: No\n";
+ accountPtr = accountList.next())
+ {
+ mailconf->setGroup("Account_"+QString::number(++acc_count));
+ mailconf->writeEntry("AccName",accountPtr->accountName );
+ mailconf->writeEntry("UserName",accountPtr->name);
+ mailconf->writeEntry("Email",accountPtr->emailAddress);
+ mailconf->writeEntry("POPUser",accountPtr->popUserName);
+ mailconf->writeEntryCrypt("POPPassword",accountPtr->popPasswd);
+ mailconf->writeEntry("POPServer",accountPtr->popServer);
+ mailconf->writeEntry("SMTPServer",accountPtr->smtpServer);
+ mailconf->writeEntry("AccountId",accountPtr->id);
+ if (accountPtr->synchronize)
+ {
+ mailconf->writeEntry("Synchronize","Yes");
+ mailconf->writeEntry("HeaderLimit",accountPtr->syncLimit);
+ mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount);
+ }
+ else
+ {
+ mailconf->writeEntry("Synchronize", "No");
}
- t << "SyncLimit: ";
- t << accountPtr->syncLimit << "\n";
- t << "accountEnd;\n";
}
- f.close();
mailconf->setGroup("mailitglobal");
+ mailconf->writeEntry("Accounts",acc_count);
mailconf->writeEntry("mailidcount", mailIdCount);
@@ -1003,2 +980,2 @@ void EmailClient::remove()
}
-}*/ \ No newline at end of file
+}*/