//$markus: -Added kmnewiostatus[wdg].*. Classes to visualize the download

and send process. I have  only implemented pop support for it.

svn path=/trunk/kdenetwork/kmail/; revision=5489
wilder-work
Markus Wuebben 28 years ago
parent e9c8f1d226
commit 36fd427b88
  1. 14
      Makefile.am
  2. 3
      kmaccount.h
  3. 2
      kmacctlocal.cpp
  4. 2
      kmacctlocal.h
  5. 15
      kmacctmgr.cpp
  6. 1
      kmacctmgr.h
  7. 42
      kmacctpop.cpp
  8. 5
      kmacctpop.h
  9. 2
      kmnewiostatus.cpp
  10. 2
      kmnewiostatus.h

@ -18,7 +18,8 @@ kmail_SOURCES = kmmainwin.cpp kmfolderdia.cpp kmfoldertree.cpp \
kmfolderseldlg.cpp kmfilter.cpp kmfilterdlg.cpp \
kmmsgbase.cpp kmmsglist.cpp kpgp.cpp \
kfileio.cpp kmaddrbook.cpp \
kmaddrbookdlg.cpp kmiostatusdlg.cpp
kmaddrbookdlg.cpp kmiostatusdlg.cpp \
kmnewiostatus.cpp kmnewiostatuswdg.cpp
BUILT_SOURCES = kmmainwin.moc kmfolderdia.moc kmfolder.moc \
kmfoldertree.moc kmsettings.moc kmheaders.moc \
@ -28,7 +29,8 @@ BUILT_SOURCES = kmmainwin.moc kmfolderdia.moc kmfolder.moc \
kmfoldernode.moc kmacctseldlg.moc kmmsgpartdlg.moc \
kmimemagic.moc kmacctpop.moc kmaccount.moc \
kmfolderseldlg.moc kmfilterdlg.moc kpgp.moc \
kmaddrbookdlg.moc kmiostatusdlg.moc
kmaddrbookdlg.moc kmiostatusdlg.moc \
kmnewiostatus.cpp kmnewiostatuswdg.cpp
CLEAN_FILES = $(BUILT_SOURCES)
@ -157,3 +159,11 @@ kmsender.moc: kmsender.h
kmiostatusdlg.cpp: kmiostatusdlg.moc
kmiostatusdlg.moc: kmiostatusdlg.h
$(MOC) kmiostatusdlg.h -o kmiostatusdlg.moc
kmnewiostatuswdg.cpp: kmnewiostatuswdg.moc
kmnewiostatuswdg.cpp: kmnewiostatuswdg.h
$(MOC) kmnewiostatuswdg.h -o kmnewiostatuswdg.moc
kmnewiostatus.cpp: kmnewiostatus.moc
kmnewiostatus.cpp: kmnewiostatus.h
$(MOC) kmnewiostatus.h -o kmnewiostatus.moc

@ -10,6 +10,7 @@
#include <qtimer.h>
#include <qsignal.h>
#include <kmsgbox.h>
#include "kmnewiostatuswdg.h"
class KMAcctMgr;
class KMFolder;
@ -43,7 +44,7 @@ public:
/** Process new mail for this account if one arrived. Returns TRUE if new
mail has been found. Whether the mail is automatically loaded to
an associated folder or not depends on the type of the account. */
virtual bool processNewMail(void) = 0;
virtual bool processNewMail(KMIOStatus *) = 0;
/** Read config file entries. This method is called by the account
manager when a new account is created. */

@ -46,7 +46,7 @@ void KMAcctLocal::init(void)
//-----------------------------------------------------------------------------
bool KMAcctLocal::processNewMail(void)
bool KMAcctLocal::processNewMail(KMIOStatus *)
{
KMFolder mailFolder(NULL, location());
long num = 0;

@ -25,7 +25,7 @@ public:
virtual void setLocation(const QString&);
virtual const char* type(void) const;
virtual bool processNewMail(void);
virtual bool processNewMail(KMIOStatus *);
virtual void readConfig(KConfig&);
virtual void writeConfig(KConfig&);

@ -104,12 +104,16 @@ bool KMAcctMgr::singleCheckMail(KMAccount *account)
{
bool hasNewMail = FALSE;
debug("singleCheckMail called!");
kbp->busy();
if (account->processNewMail())
//kbp->busy();
KMIOStatusWdg *wid = new KMIOStatusWdg(0L,0L,KMIOStatus::RETRIEVE);
wid->show();
if (account->processNewMail(wid))
{
hasNewMail = TRUE;
emit newMail(account);
}
delete wid;
kbp->idle();
return hasNewMail;
}
@ -189,14 +193,19 @@ bool KMAcctMgr::checkMail(void)
return FALSE;
}
KMIOStatusWdg *wid = new KMIOStatusWdg(0L,0L,KMIOStatus::RETRIEVE);
wid->show();
for (cur=mAcctList.first(); cur; cur=mAcctList.next())
{
if (cur->processNewMail())
if (cur->processNewMail(wid))
{
hasNewMail = TRUE;
emit newMail(cur);
}
}
delete wid;
return hasNewMail;
}

@ -11,6 +11,7 @@
#include <qdir.h>
#include <qfile.h>
#include <qmsgbox.h>
#include "kmnewiostatuswdg.h"
#include "kmaccount.h"
#define KMAcctMgrInherited QObject

@ -66,7 +66,7 @@ void KMAcctPop::init(void)
//-----------------------------------------------------------------------------
bool KMAcctPop::processNewMail(void)
bool KMAcctPop::processNewMail(KMIOStatus *wid)
{
void (*oldHandler)(int);
void (*pipeHandler)(int);
@ -82,7 +82,7 @@ bool KMAcctPop::processNewMail(void)
// abort the app when received. SIGPIPE is send when e.g the client attempts
// to write to a TCP socket when the connection was shutdown by the server.
pipeHandler = signal(SIGPIPE, SIG_IGN);
result = doProcessNewMail();
result = doProcessNewMail(wid);
signal(SIGALRM, oldHandler);
signal(SIGPIPE, pipeHandler);
return result;
@ -90,7 +90,7 @@ bool KMAcctPop::processNewMail(void)
//-----------------------------------------------------------------------------
bool KMAcctPop::doProcessNewMail(void)
bool KMAcctPop::doProcessNewMail(KMIOStatus *wid)
{
DwPopClient client;
QString passwd;
@ -101,8 +101,9 @@ bool KMAcctPop::doProcessNewMail(void)
char dummyStr[32];
int replyCode; // ReplyCode need from User & Passwd call.
KMMessage* msg;
bool gotMsgs = FALSE;
gotMsgs = FALSE;
wid->setHost(host());
// is everything specified ?
if (mHost.isEmpty() || mPort<=0)
@ -168,17 +169,16 @@ bool KMAcctPop::doProcessNewMail(void)
mLogin, decryptStr(passwd));
if(!d->exec())
return FALSE;
else
{
else {
mPasswd = encryptStr(mPasswd);
passwd = decryptStr(mPasswd);
passwd = decryptStr(passwd);
}
}
}
else
return popError("PASS", client);
}
if (client.Stat() != '+') return popError("STAT", client);
response = client.SingleLineResponse().c_str();
sscanf(response.data(), "%3s %d %d", dummyStr, &num, &size);
@ -194,6 +194,11 @@ bool KMAcctPop::doProcessNewMail(void)
while (id <= num)
{
if(wid->abortRequested()) {
client.Quit();
return gotMsgs;
}
wid->updateProgressBar(id,num);
debug("processing message %d", id);
app->processEvents(1000);
if (client.List(id) != '+')
@ -264,9 +269,9 @@ bool KMAcctPop::popError(const QString aStage, DwPopClient& aClient) const
QString tmp;
tmp.sprintf(i18n("Account: %s\nIn %s:\n%s"), name().data(), aStage.data(),msg.data());
KMsgBox::message(0, caption, tmp);
kbp->busy();
//kbp->busy();
aClient.Quit();
return FALSE;
return gotMsgs;
}
@ -442,7 +447,7 @@ KMPasswdDialog::KMPasswdDialog(QWidget *parent, const char *name,
//-----------------------------------------------------------------------------
void KMPasswdDialog::slotOkPressed()
{
kbp->busy();
//kbp->busy();
act->setLogin(usernameLEdit->text());
act->setPasswd(passwdLEdit->text());
done(1);
@ -451,6 +456,19 @@ void KMPasswdDialog::slotOkPressed()
//-----------------------------------------------------------------------------
void KMPasswdDialog::slotCancelPressed()
{
kbp->busy();
//kbp->busy();
done(0);
}

@ -57,7 +57,7 @@ public:
virtual const char* type(void) const;
virtual void readConfig(KConfig&);
virtual void writeConfig(KConfig&);
virtual bool processNewMail(void);
virtual bool processNewMail(KMIOStatus *);
protected:
@ -71,7 +71,7 @@ protected:
const QString decryptStr(const QString inStr);
/** Mail processing main worker method. */
virtual bool doProcessNewMail(void);
virtual bool doProcessNewMail(KMIOStatus *);
/** Display POP error message. Always returns FALSE to simplify the
code in doProcessNewMail(). */
@ -84,6 +84,7 @@ protected:
bool mStorePasswd;
bool mLeaveOnServer;
bool mRetrieveAll;
bool gotMsgs;
};

@ -63,7 +63,7 @@ void KMIOStatus::updateProgressBar(int,int) {
bool KMIOStatus::abortRequested() {
return abortPressed;
return abortPressedBool;
}

@ -46,7 +46,7 @@ class KMIOStatus : public QWidget
/** Tell widget that the tranmission has been completed **/
virtual void transmissionCompleted();
/** Tell widget that new mail arrived / has to be sent or not
/** Tell widget that new mail arrived / has to be sent or not **/
virtual void newMail(bool);
private slots:

Loading…
Cancel
Save