summaryrefslogtreecommitdiff
path: root/noncore/net/mailit/emailclient.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mailit/emailclient.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mailit/emailclient.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index 2943986..6612541 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -2,67 +2,67 @@
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qapplication.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qcheckbox.h>
#include <qmenubar.h>
#include <qaction.h>
-#include "resource.h"
+#include <qpe/resource.h>
#include "emailclient.h"
QCollection::Item AccountList::newItem(QCollection::Item d)
{
return dupl( (MailAccount *) d);
}
MailAccount* AccountList::dupl(MailAccount *in)
{
ac = new MailAccount(*in);
return ac;
}
EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
emailHandler = new EmailHandler();
- addressList = new AddressList( getPath(FALSE) + "mail_adr");
+ addressList = new AddressList();
sending = FALSE;
receiving = FALSE;
previewingMail = FALSE;
mailIdCount = 1;
accountIdCount = 1;
allAccounts = FALSE;
init();
connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
connect(emailHandler, SIGNAL(smtpError(int)), this,
SLOT(smtpError(int)) );
connect(emailHandler, SIGNAL(popError(int)), this,
SLOT(popError(int)) );
connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
SLOT(mailArrived(const Email &, bool)) );
connect(emailHandler, SIGNAL(mailTransfered(int)), this,
SLOT(allMailArrived(int)) );
@@ -650,93 +650,101 @@ void EmailClient::readSettings()
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();
}
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();
+ }
+
+
accountList.append(&account);
}
delete p;
}
mailconf->setGroup("mailitglobal");
if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) {
mailIdCount = y;
}
if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) {
accountIdCount = y;
}
}
void EmailClient::saveSettings()
{
QString temp;
QFile f( getPath(FALSE) + "settings.txt");
MailAccount *accountPtr;
if (! f.open(IO_WriteOnly) ) {
qWarning("could not save settings file");
return;
}
QTextStream t(&f);
t << "#Settings for QPE 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";
}
+ t << "SyncLimit: ";
+ t << accountPtr->syncLimit << "\n";
t << "accountEnd;\n";
}
f.close();
mailconf->setGroup("mailitglobal");
mailconf->writeEntry("mailidcount", mailIdCount);
mailconf->writeEntry("accountidcount", accountIdCount);
}
void EmailClient::selectAccount(int id)
{
if (accountList.count() > 0) {
currentAccount = accountList.at(id);
emit newCaption("Mailit - " + currentAccount->accountName);
getNewMail();
} else {
emit newCaption("Mailit ! No account defined");
}
}
void EmailClient::editAccount(int id)
{
MailAccount *newAccount;