author | mickeyl <mickeyl> | 2003-10-29 18:18:19 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-29 18:18:19 (UTC) |
commit | 1af1f1d9f398d38a2bc666cd2edff5725da7a770 (patch) (side-by-side diff) | |
tree | b3bb0d90cafc1e933b5b9297a7b2669ce3b184ea /noncore/net/mailit/emailclient.cpp | |
parent | 35615947e11575a61456c8483e7f6d67fe59d5ed (diff) | |
download | opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.zip opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.tar.gz opie-1af1f1d9f398d38a2bc666cd2edff5725da7a770.tar.bz2 |
mrege noncore/net/*
Diffstat (limited to 'noncore/net/mailit/emailclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 322 |
1 files changed, 161 insertions, 161 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index 90664bb..8359acf 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp @@ -44,6 +44,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) -{ +{ emailHandler = new EmailHandler(); addressList = new AddressList(); - + sending = FALSE; @@ -54,9 +54,9 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) allAccounts = FALSE; - + init(); - - - + + + connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); - + connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this, @@ -65,6 +65,6 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) SLOT(popError(int,const QString &)) ); - + connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); - + connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); @@ -76,3 +76,3 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) SLOT(allMailArrived(int)) ); - + mailconf = new Config("mailit"); @@ -81,5 +81,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) readSettings(); - + updateAccounts(); - + lineShift = "\n"; @@ -87,5 +87,5 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) lineShift = "\r\n"; - + mailboxView->setCurrentTab(0); //ensure that inbox has focus - + /*channel = new QCopChannel( "QPE/Application/mailit", this ); @@ -106,6 +106,6 @@ EmailClient::~EmailClient() saveSettings(); - + mailconf->write(); delete mailconf; - + } @@ -115,5 +115,5 @@ void EmailClient::init() initStatusBar(this); - + setToolBarsMovable(FALSE); - + bar = new QToolBar(this); @@ -129,3 +129,3 @@ void EmailClient::init() mb->insertItem( tr( "Accounts" ), configure); - + selectAccountMenu = new QPopupMenu(mb); @@ -144,3 +144,3 @@ void EmailClient::init() getMailButton->setPopup(selectAccountMenu); - + sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); @@ -150,3 +150,3 @@ void EmailClient::init() sendMailButton->setWhatsThis("Send mail queued in the outbox"); - + composeButton = new QAction(tr("Compose"), Resource::loadPixmap("new"), QString::null, 0, this, 0); @@ -156,3 +156,3 @@ void EmailClient::init() composeButton->setWhatsThis("Compose a new mail"); - + cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); @@ -163,4 +163,4 @@ void EmailClient::init() cancelButton->setWhatsThis("Stop the currently active mail transfer"); - - + + deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); @@ -169,3 +169,3 @@ void EmailClient::init() deleteButton->setWhatsThis("Remove the currently selected eMail(s)"); - + mailboxView = new OTabWidget( this, "mailboxView" ); @@ -207,5 +207,5 @@ void EmailClient::init() mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); - + setCentralWidget(mailboxView); - + } @@ -216,3 +216,3 @@ void EmailClient::initStatusBar(QWidget* parent) statusBar->setSizeGripEnabled(FALSE); - + status1Label = new QLabel( tr("Idle"), statusBar); @@ -223,3 +223,3 @@ void EmailClient::initStatusBar(QWidget* parent) status2Label, SLOT(setText(const QString &)) ); - + progressBar = new QProgressBar(statusBar); @@ -262,3 +262,3 @@ void EmailClient::enqueMail(const Email &mail) } - + if (accountList.count() > 0) { @@ -267,3 +267,3 @@ void EmailClient::enqueMail(const Email &mail) } - + Email addMail = mail; @@ -273,5 +273,5 @@ void EmailClient::enqueMail(const Email &mail) item = new EmailListItem(outboxView, addMail, false); - + mailboxView->setCurrentTab(1); - + } @@ -283,3 +283,3 @@ void EmailClient::sendQuedMail() if (accountList.count() == 0) { - QMessageBox::warning(qApp->activeWindow(), "No account selected", "You must create an account", "OK\n"); + QMessageBox::warning(qApp->activeWindow(), tr("No account selected"), tr("You must create an account"), "OK\n"); return; @@ -315,3 +315,3 @@ void EmailClient::mailSent() sendMailButton->setEnabled(TRUE); - + quedMessages.clear(); @@ -321,11 +321,11 @@ void EmailClient::mailSent() void EmailClient::getNewMail() { - + if (accountList.count() == 0) { - QMessageBox::warning(qApp->activeWindow(),"No account selected", - "You must create an account", "OK\n"); + QMessageBox::warning(qApp->activeWindow(),tr("No account selected"), + tr("You must create an account"), "OK\n"); return; } - + setMailAccount(); - + receiving = TRUE; @@ -335,6 +335,6 @@ void EmailClient::getNewMail() { selectAccountMenu->setEnabled(FALSE); - + status1Label->setText(currentAccount->accountName + " headers"); progressBar->reset(); - + //get any previous mails not downloaded and add to queue @@ -350,5 +350,5 @@ void EmailClient::getNewMail() { }*/ - + emailHandler->getMailHeaders(); - + } @@ -359,3 +359,3 @@ void EmailClient::getAllNewMail() currentAccount = accountList.first(); - getNewMail(); + getNewMail(); } @@ -369,6 +369,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->setGroup(newMail.id); - - if (fromDisk) + + if (fromDisk) { - + newMail.downloaded = mailconf->readBoolEntry("downloaded"); @@ -377,6 +377,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); - } - else + } + else { //mail arrived from server - + newMail.serverId = mail.serverId; @@ -384,3 +384,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) newMail.downloaded = mail.downloaded; - + newMail.fromAccountId = emailHandler->getAccount()->id; @@ -388,6 +388,6 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) } - + //add if read or not newMail.read = mailconf->readBoolEntry("mailread"); - + //check if new mail @@ -396,3 +396,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailIdCount++; - + //set server count, so that if the user aborts, the new @@ -401,3 +401,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) currentAccount->lastServerMailCount++; - + mailconf->writeEntry("internalmailid", thisMailId); @@ -406,8 +406,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->writeEntry("serverid", newMail.serverId); - + //addressList->addContact(newMail.fromMail, newMail.from); } - + mailconf->writeEntry("downloaded", newMail.downloaded); - + QString stringMailId; @@ -415,3 +415,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) //see if any attatchments needs to be stored - + for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { @@ -419,3 +419,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) stringId.setNum(ePtr->id); - + int id = mailconf->readNumEntry("enclosureid_" + stringId); @@ -428,3 +428,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) mailconf->writeEntry("installed_" + stringId, FALSE); - + ePtr->name = stringMailId + "_" + stringId; @@ -446,3 +446,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) ePtr->path = mailconf->readEntry("path_" + stringId); - } + } } @@ -451,9 +451,9 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) bool found=false; - - if (!fromDisk) + + if (!fromDisk) { - + Email *mailPtr; item = (EmailListItem *) inboxView->firstChild(); - while ((item != NULL)&&(!found)) + while ((item != NULL)&&(!found)) { @@ -474,8 +474,8 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) // item->setPixmap(0, Resource::loadPixmap("mailit/attach")); -// } +// } /*if (!newMail.downloaded) mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ - + mailboxView->setCurrentTab(0); - + } @@ -497,3 +497,3 @@ void EmailClient::allMailArrived(int /*count*/) status1Label->setText("Idle"); - + progressBar->reset(); @@ -502,3 +502,3 @@ void EmailClient::allMailArrived(int /*count*/) //} - + // all headers downloaded from server, start downloading remaining mails @@ -508,3 +508,3 @@ void EmailClient::allMailArrived(int /*count*/) - + mailboxView->setCurrentTab(0); @@ -523,3 +523,3 @@ void EmailClient::smtpError(int code, const QString & Msg) QString temp; - + if (code == ErrUnknownResponse) { @@ -535,3 +535,3 @@ void EmailClient::smtpError(int code, const QString & Msg) } - + if (code != ErrCancel) { @@ -541,3 +541,3 @@ void EmailClient::smtpError(int code, const QString & Msg) } - + sending = FALSE; @@ -551,3 +551,3 @@ void EmailClient::popError(int code, const QString & Msg) QString temp; - + if (code == ErrUnknownResponse) { @@ -564,3 +564,3 @@ void EmailClient::popError(int code, const QString & Msg) temp = tr("<qt>socket packet error</qt>"); - } + } @@ -572,3 +572,3 @@ void EmailClient::popError(int code, const QString & Msg) } - + receiving = FALSE; @@ -582,3 +582,3 @@ void EmailClient::inboxItemSelected() //killTimer(timerID); - + item = (EmailListItem*) inboxView->selectedItem(); @@ -592,3 +592,3 @@ void EmailClient::outboxItemSelected() //killTimer(timerID); - + item = (EmailListItem*) outboxView->selectedItem(); @@ -607,3 +607,3 @@ void EmailClient::readMail() QFile f(getPath(FALSE) + "inbox.txt"); - + if ( f.open(IO_ReadOnly) ) { // file opened successfully @@ -612,3 +612,3 @@ void EmailClient::readMail() f.close(); - + start = 0; @@ -619,3 +619,3 @@ void EmailClient::readMail() stop = s.length() - del.length(); - + mail.rawMail = s.mid(start, stop + del.length() - start ); @@ -625,3 +625,3 @@ void EmailClient::readMail() } - + QFile fo(getPath(FALSE) + "outbox.txt"); @@ -631,3 +631,3 @@ void EmailClient::readMail() fo.close(); - + start = 0; @@ -638,3 +638,3 @@ void EmailClient::readMail() stop = s.length() - del.length(); - + mail.rawMail = s.mid(start, stop + del.length() - start ); @@ -645,3 +645,3 @@ void EmailClient::readMail() enqueMail(mail); - + } @@ -654,3 +654,3 @@ void EmailClient::saveMail(const QString &fileName, QListView *view) Email *mail; - + if (! f.open(IO_WriteOnly) ) { @@ -664,6 +664,6 @@ void EmailClient::saveMail(const QString &fileName, QListView *view) t << mail->rawMail; - + mailconf->setGroup(mail->id); mailconf->writeEntry("mailread", mail->read); - + item = (EmailListItem *) item->nextSibling(); @@ -678,3 +678,3 @@ QString EmailClient::getPath(bool enclosurePath) QString enclosures = "enclosures"; - + QDir dir = (QString(getenv("HOME")) + "/Applications/" + basePath); @@ -682,11 +682,11 @@ QString EmailClient::getPath(bool enclosurePath) dir.mkdir( dir.path() ); - + if (enclosurePath) { dir = (QString(getenv("HOME")) + "/Applications/" + basePath + "/" + enclosures); - + if ( !dir.exists() ) dir.mkdir( dir.path() ); - + return (dir.path() + "/"); - + } @@ -698,9 +698,9 @@ void EmailClient::readSettings() int y,acc_count; - + mailconf->setGroup("mailitglobal"); acc_count=mailconf->readNumEntry("Accounts",0); - - for (int accountPos = 0;accountPos<acc_count ; accountPos++) + + for (int accountPos = 0;accountPos<acc_count ; accountPos++) { - mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... + mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... account.accountName = mailconf->readEntry("AccName",""); @@ -716,3 +716,3 @@ void EmailClient::readSettings() account.synchronize = FALSE; - + account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); @@ -720,11 +720,11 @@ void EmailClient::readSettings() { - mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); + mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); } - + accountList.append(&account); } - + mailconf->setGroup("mailitglobal"); - - if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) + + if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) { @@ -732,3 +732,3 @@ void EmailClient::readSettings() } - if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) + if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) { @@ -743,4 +743,4 @@ void EmailClient::saveSettings() - - if (!mailconf) + + if (!mailconf) { @@ -749,5 +749,5 @@ void EmailClient::saveSettings() } - + for (accountPtr = accountList.first(); accountPtr != 0; - accountPtr = accountList.next()) + accountPtr = accountList.next()) { @@ -762,3 +762,3 @@ void EmailClient::saveSettings() mailconf->writeEntry("AccountId",accountPtr->id); - if (accountPtr->synchronize) + if (accountPtr->synchronize) { @@ -767,4 +767,4 @@ void EmailClient::saveSettings() mailconf->writeEntry("LastServerMailCount",accountPtr->lastServerMailCount); - } - else + } + else { @@ -773,3 +773,3 @@ void EmailClient::saveSettings() } - + mailconf->setGroup("mailitglobal"); @@ -787,3 +787,3 @@ void EmailClient::selectAccount(int id) } else { - emit newCaption("Mailit ! No account defined"); + emit newCaption( tr("Mailit ! No account defined") ); } @@ -794,3 +794,3 @@ void EmailClient::editAccount(int id) MailAccount *newAccount; - + editAccountView = new EditAccount(this, "account", TRUE); @@ -803,6 +803,6 @@ void EmailClient::editAccount(int id) } - + editAccountView->showMaximized(); editAccountView->exec(); - + if (editAccountView->result() == QDialog::Accepted) { @@ -817,3 +817,3 @@ void EmailClient::editAccount(int id) } - + delete editAccountView; @@ -825,8 +825,8 @@ void EmailClient::deleteAccount(int id) QString message; - + newAccount = accountList.at(id); - message = "Delete account:\n" + newAccount->accountName; + message = tr("Delete account:\n") + newAccount->accountName; switch( QMessageBox::warning( this, "Mailit", message, "Yes", "No", 0, 0, 1 ) ) { - + case 0: accountList.remove(id); @@ -842,3 +842,3 @@ void EmailClient::updateAccounts() MailAccount *accountPtr; - + //rebuild menus, clear all first @@ -848,6 +848,6 @@ void EmailClient::updateAccounts() - newAccountId = editAccountMenu->insertItem("New", this, + newAccountId = editAccountMenu->insertItem( tr("New"), this, SLOT(editAccount(int)) ); editAccountMenu->insertSeparator(); - + idCount = 0; @@ -855,3 +855,3 @@ void EmailClient::updateAccounts() accountPtr = accountList.next()) { - + editAccountMenu->insertItem(accountPtr->accountName, @@ -870,7 +870,7 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) Enclosure *ePtr; - - if (inbox) + + if (inbox) { mPtr = mailItem->getMail(); - + //if mail is in queue for download, remove it from @@ -881,6 +881,6 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) } - + mailconf->setGroup(mPtr->id); mailconf->clearGroup(); - + //delete any temporary attatchemnts storing @@ -892,4 +892,4 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) inboxView->takeItem(mailItem); - } - else + } + else { @@ -907,3 +907,3 @@ void EmailClient::setTotalSize(int /*size*/) { - + } @@ -925,10 +925,10 @@ void EmailClient::deleteItem() QListView* box; - + EmailListItem* eli; // int pos; - + inbox ? box=inboxView : box=outboxView; - + eli=(EmailListItem*)box->selectedItem(); - + if (eli) @@ -936,3 +936,3 @@ void EmailClient::deleteItem() box->setSelected(eli->itemBelow(),true); //select the previous item - + deleteMail(eli,(bool&)inbox); //remove mail entry @@ -954,8 +954,8 @@ void EmailClient::inboxItemReleased() //killTimer(timerID); - - + + QPopupMenu *action = new QPopupMenu(this); - + int reply=0; - + action->insertItem(tr( "Reply To" ),this,SLOT(reply())); @@ -964,7 +964,7 @@ void EmailClient::inboxItemReleased() action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); - + action->exec(QCursor::pos()); - + if (action) delete action; - + }*/ @@ -979,3 +979,3 @@ Email* EmailClient::getCurrentMail() } - + void EmailClient::download(Email* mail) @@ -983,9 +983,9 @@ void EmailClient::download(Email* mail) MailAccount* acc=0; - + tempMailDownloadList.clear(); tempMailDownloadList.sizeInsert(mail->serverId, mail->size); - + acc=accountList.at(mail->fromAccountId-1); if (acc) - { + { emailHandler->setAccount(*acc); @@ -993,3 +993,3 @@ void EmailClient::download(Email* mail) } - else + else QMessageBox::warning(qApp->activeWindow(), @@ -1004,5 +1004,5 @@ void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) QVBoxLayout *vbProg = new QVBoxLayout( &qd ); - + initStatusBar(&qd); - + if (statusBar==0) @@ -1020,19 +1020,19 @@ void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/) else if (msg=="compose()") - { + { QDialog qd(qApp->activeWindow(),"Getting mail",true); - + WriteMail wm(&qd,"write new mail"); QVBoxLayout vbProg( &qd ); - + wm.showMaximized(); vbProg.addWidget(&wm); - + qd.showMaximized(); - + emit composeRequested(); qd.exec(); - + QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); } - + else if (msg=="dialog()") |