Save the index files on exit without being killed by the session management

if it takes too long.

svn path=/trunk/kdenetwork/kmail/; revision=128258
wilder-work
Michael Haeckel 25 years ago
parent 4645ec9702
commit 86f702e78d
  1. 9
      kmfolder.h
  2. 3
      kmheaders.cpp
  3. 14
      kmkernel.cpp
  4. 5
      kmkernel.h
  5. 3
      main.cpp

@ -386,6 +386,10 @@ public:
void expireOldMessages();
/** Write index to index-file. Returns 0 on success and errno error on
failure. */
virtual int writeIndex();
/** Inserts messages into the message dictionary. Might be called
during kernel initialization. */
void fillMsgDict(KMMsgDict *dict);
@ -457,10 +461,7 @@ protected:
failure. */
virtual int createIndexFromContents() = 0;
/** Write index to index-file. Returns 0 on success and errno error on
failure. */
virtual int writeIndex();
bool updateIndexStreamPtr(bool just_close=FALSE);
bool updateIndexStreamPtr(bool just_close=FALSE);
/** Tests whether the contents (file) is newer than the index. Returns
TRUE if the contents has changed (and the index should be recreated),

@ -743,6 +743,9 @@ void KMHeaders::setFolder (KMFolder *aFolder, bool jumpToFirst)
mOwner, SLOT(statusMsg(const QString&)));
writeSortOrder();
mFolder->close();
// System folders remain open but we also should write the index from
// time to time
if (mFolder->dirty()) mFolder->writeIndex();
}
mSortInfo.removed = 0;

@ -46,6 +46,7 @@ KMKernel::KMKernel (QObject *parent, const char *name) :
//kdDebug(5006) << "KMKernel::KMKernel" << endl;
mySelf = this;
closed_by_user = true;
the_firstInstance = true;
the_msgDict = 0;
new KMpgpWrap();
// register our own (libkdenetwork) utf-7 codec as long as Qt
@ -815,7 +816,18 @@ KabAPI* KMKernel::KABaddrBook()
void KMKernel::notClosedByUser()
{
closed_by_user = false;
closed_by_user = false;
QStringList strList;
QValueList<QGuardedPtr<KMFolder> > folders;
KMFolder *folder;
the_folderMgr->createFolderList(&strList, &folders);
for (int i = 0; folders.at(i) != folders.end(); i++)
{
folder = *folders.at(i);
if (!folder || folder->isDir()) continue;
if (folder->isOpened() && folder->dirty()) folder->writeIndex();
}
}
void KMKernel::emergencyExit( const QString& reason )

@ -91,7 +91,9 @@ public:
void ungrabPtrKb(void);
void kmailMsgHandler(QtMsgType aType, const char* aMsg);
void dumpDeadLetters();
bool doSessionManagement ();
bool doSessionManagement();
bool firstInstance() { return the_firstInstance; }
void setFirstInstance(bool value) { the_firstInstance = value; }
void action (bool mailto, bool check, const QString &to, const QString &cc,
const QString &bcc, const QString &subj, const QString &body, const KURL &messageFile,
const KURL::List &attach);
@ -170,6 +172,7 @@ private:
/** true unles kmail is closed by session management */
bool closed_by_user;
bool allowedToExpire;
bool the_firstInstance;
static KMKernel *mySelf;
};

@ -183,8 +183,9 @@ int KMailApplication::newInstance()
args->clear();
if (!kapp->isRestored())
if (!kernel->firstInstance() || !kapp->isRestored())
kernel->action (mailto, checkMail, to, cc, bcc, subj, body, messageFile, attachURLs);
kernel->setFirstInstance(FALSE);
return 0;
}

Loading…
Cancel
Save