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.cpp71
1 files changed, 38 insertions, 33 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index da1226c..749a4e9 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -50,28 +50,28 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
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(emailHandler, SIGNAL(smtpError(int,const QString &)), this,
+ SLOT(smtpError(int,const QString &)) );
+ connect(emailHandler, SIGNAL(popError(int,const QString &)), this,
+ 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()) );
connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
SLOT(mailArrived(const Email &, bool)) );
connect(emailHandler, SIGNAL(mailTransfered(int)), this,
SLOT(allMailArrived(int)) );
@@ -471,25 +471,25 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
}
// if (item->getMail()->files.count()>0)
// {
// item->setPixmap(0, Resource::loadPixmap("mailit/attach"));
// }
/*if (!newMail.downloaded)
mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/
mailboxView->setCurrentTab(0);
}
-void EmailClient::allMailArrived(int count)
+void EmailClient::allMailArrived(int /*count*/)
{
// not previewing means all mailtransfer has been done
/*if (!previewingMail) {*/
if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) {
emit newCaption("Mailit - " + currentAccount->accountName);
getNewMail();
return;
} else {
allAccounts = FALSE;
receiving = FALSE;
getMailButton->setEnabled(TRUE);
cancelButton->setEnabled(FALSE);
@@ -509,68 +509,73 @@ void EmailClient::allMailArrived(int count)
mailboxView->setCurrentTab(0);
}
void EmailClient::moveMailFront(Email *mailPtr)
{
if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
}
}
-void EmailClient::smtpError(int code)
+void EmailClient::smtpError(int code, const QString & Msg)
{
QString temp;
- if (code == ErrUnknownResponse)
- temp = "Unknown response from server";
-
- if (code == QSocket::ErrHostNotFound)
- temp = "host not found";
- if (code == QSocket::ErrConnectionRefused)
- temp = "connection refused";
- if (code == QSocket::ErrSocketRead)
- temp = "socket packet error";
+ if (code == ErrUnknownResponse) {
+ temp = tr("<qt>Unknown response from server</qt>");
+ if( ! Msg.isEmpty() )
+ temp += Msg;
+ } else if (code == QSocket::ErrHostNotFound) {
+ temp = tr("<qt>host not found</qt>");
+ } else if (code == QSocket::ErrConnectionRefused) {
+ temp = tr("<qt>connection refused</qt>");
+ } else if (code == QSocket::ErrSocketRead) {
+ temp = tr("<qt>socket packet error</qt>");
+ }
if (code != ErrCancel) {
QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n");
} else {
status2Label->setText("Aborted by user");
}
sending = FALSE;
sendMailButton->setEnabled(TRUE);
cancelButton->setEnabled(FALSE);
quedMessages.clear();
}
-void EmailClient::popError(int code)
+void EmailClient::popError(int code, const QString & Msg)
{
QString temp;
- if (code == ErrUnknownResponse)
- temp = "Unknown response from server";
- if (code == ErrLoginFailed)
- temp = "Login failed\nCheck user name and password";
-
- if (code == QSocket::ErrHostNotFound)
- temp = "host not found";
- if (code == QSocket::ErrConnectionRefused)
- temp = "connection refused";
- if (code == QSocket::ErrSocketRead)
- temp = "socket packet error";
+ if (code == ErrUnknownResponse) {
+ temp = tr("<qt>Unknown response from server</qt>");
+ if( ! Msg.isEmpty() )
+ temp += Msg;
+ } else if (code == ErrLoginFailed) {
+ temp = tr("<qt>Login failed\nCheck user name and password</qt>");
+ } else if (code == QSocket::ErrHostNotFound) {
+ temp = tr("<qt>host not found</qt>");
+ } else if (code == QSocket::ErrConnectionRefused) {
+ temp = tr("<qt>connection refused</qt>");
+ } else if (code == QSocket::ErrSocketRead) {
+ temp = tr("<qt>socket packet error</qt>");
+ }
if (code != ErrCancel) {
- QMessageBox::warning(qApp->activeWindow(), "Receiving error", temp, "OK\n");
+ QMessageBox::warning(qApp->activeWindow(), tr("Receiving error"), temp, tr("OK\n"));
+
} else {
status2Label->setText("Aborted by user");
}
receiving = FALSE;
getMailButton->setEnabled(TRUE);
cancelButton->setEnabled(FALSE);
selectAccountMenu->setEnabled(TRUE);
}
void EmailClient::inboxItemSelected()
{
@@ -889,47 +894,47 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
else
{
outboxView->takeItem(mailItem);
}
}
void EmailClient::setMailSize(int size)
{
progressBar->reset();
progressBar->setTotalSteps(size);
}
-void EmailClient::setTotalSize(int size)
+void EmailClient::setTotalSize(int /*size*/)
{
}
void EmailClient::setDownloadedSize(int size)
{
int total = progressBar->totalSteps();
if (size < total) {
progressBar->setProgress(size);
} else {
progressBar->setProgress(total);
}
}
void EmailClient::deleteItem()
{
bool inbox=mailboxView->currentTab()==0;
QListView* box;
EmailListItem* eli;
- int pos;
+ // int pos;
inbox ? box=inboxView : box=outboxView;
eli=(EmailListItem*)box->selectedItem();
if (eli)
{
box->setSelected(eli->itemBelow(),true); //select the previous item
deleteMail(eli,(bool&)inbox); //remove mail entry
}
}
@@ -937,25 +942,25 @@ void EmailClient::deleteItem()
void EmailClient::inboxItemPressed()
{
// timerID=startTimer(500);
}
void EmailClient::inboxItemReleased()
{
// killTimer(timerID);
}
/*void EmailClient::timerEvent(QTimerEvent *e)
{
- /*killTimer(timerID);
+ //killTimer(timerID);
QPopupMenu *action = new QPopupMenu(this);
int reply=0;
action->insertItem(tr( "Reply To" ),this,SLOT(reply()));
action->insertItem( tr( "Reply All" ),this,SLOT(replyAll()));
action->insertItem( tr( "Forward" ), this,SLOT(forward()));
action->insertItem( tr( "Remove Mail" ), this,SLOT(remove()));
action->exec(QCursor::pos());
@@ -982,29 +987,29 @@ void EmailClient::download(Email* mail)
acc=accountList.at(mail->fromAccountId-1);
if (acc)
{
emailHandler->setAccount(*acc);
emailHandler->getMailByList(&tempMailDownloadList);
}
else
QMessageBox::warning(qApp->activeWindow(),
tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n");
}
-void EmailClient::receive(const QCString& msg, const QByteArray& data)
+void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/)
{
/*if (msg=="getMail()")
{
- /*QDialog qd(qApp->activeWindow(),"Getting mail",true);
+ //QDialog qd(qApp->activeWindow(),"Getting mail",true);
QVBoxLayout *vbProg = new QVBoxLayout( &qd );
initStatusBar(&qd);
if (statusBar==0)
{
qDebug("No Bar ...");
//statusBar=new ProgressBar(&qd);
}
statusBar->show();
vbProg->addWidget(statusBar);
qd.showMaximized();