Index: kmail/folderjob.h =================================================================== --- kmail/folderjob.h (revision 585471) +++ kmail/folderjob.h (working copy) @@ -32,6 +32,7 @@ #define FOLDERJOB_H #include "kmmessage.h" +#include "kmsafemsglist.h" #include #include @@ -169,7 +170,7 @@ protected: */ virtual void execute()=0; - QPtrList mMsgList; + KMSafeMsgList mMsgList; JobType mType; QString mSets; KMFolder* mSrcFolder; Index: kmail/kmsafemsglist.h =================================================================== --- kmail/kmsafemsglist.h (revision 0) +++ kmail/kmsafemsglist.h (revision 0) @@ -0,0 +1,58 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- + * + * This file is part of KMail, the KDE mail client. + * Copyright (c) 2006 Andreas Kling + * + * KMail is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * KMail is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of this program with any edition of + * the Qt library by Trolltech AS, Norway (or with modified versions + * of Qt that use the same license as Qt), and distribute linked + * combinations including the two. You must obey the GNU General + * Public License in all respects for all of the code used other than + * Qt. If you modify this file, you may extend this exception to + * your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from + * your version. + */ + +#ifndef __kmsafemsglist_h__ +#define __kmsafemsglist_h__ + +#include +#include +#include "kmmessage.h" + +class KMSafeMsgList +{ +public: + KMSafeMsgList(); + KMSafeMsgList(const QPtrList &); + ~KMSafeMsgList(); + + operator QPtrList() const; + + void append(const KMMessage *); + KMMessage *first(); + KMMessage *getLast() const; + bool removeFirst(); + virtual uint count() const; + bool isEmpty() const; + +private: + QValueList > m_list; +}; + +#endif // __kmsafemsglist_h__ Index: kmail/Makefile.am =================================================================== --- kmail/Makefile.am (revision 585471) +++ kmail/Makefile.am (working copy) @@ -124,7 +124,7 @@ libkmailprivate_la_SOURCES = kmmessage.c mailinglistpropertiesdialog.cpp newfolderdialog.cpp \ accountwizard.cpp textsource.cpp \ managesievescriptsdialog.cpp chiasmuskeyselector.cpp \ - util.cpp + util.cpp kmsafemsglist.cpp kmail_SOURCES = main.cpp Index: kmail/kmmsgbase.cpp =================================================================== --- kmail/kmmsgbase.cpp (revision 585471) +++ kmail/kmmsgbase.cpp (working copy) @@ -111,6 +111,7 @@ KMMsgBase& KMMsgBase::operator=(const KM //---------------------------------------------------------------------------- KMMsgBase::KMMsgBase( const KMMsgBase& other ) + : QObject(0L) { assign( &other ); } @@ -1422,3 +1423,5 @@ QString KMMsgBase::forwardSubject() cons QString KMMsgBase::replySubject() const { return cleanSubject( sReplySubjPrefixes, sReplaceSubjPrefix, "Re:" ); } + +#include "kmmsgbase.moc" Index: kmail/imapjob.cpp =================================================================== --- kmail/imapjob.cpp (revision 585471) +++ kmail/imapjob.cpp (working copy) @@ -69,7 +69,7 @@ ImapJob::ImapJob( QPtrList& m } void ImapJob::init( JobType jt, QString sets, KMFolderImap* folder, - QPtrList& msgList ) + QPtrList msgList ) { mJob = 0; Index: kmail/kmmsgbase.h =================================================================== --- kmail/kmmsgbase.h (revision 585471) +++ kmail/kmmsgbase.h (working copy) @@ -25,6 +25,7 @@ #include #include #include +#include class QCString; class QStringList; @@ -133,8 +134,9 @@ typedef enum } KMMsgAttachmentState; -class KMMsgBase +class KMMsgBase : public QObject { + Q_OBJECT public: KMMsgBase(KMFolder* p=0); virtual ~KMMsgBase(); Index: kmail/imapjob.h =================================================================== --- kmail/imapjob.h (revision 585471) +++ kmail/imapjob.h (working copy) @@ -83,7 +83,7 @@ private slots: private: void execute(); void init( JobType jt, QString sets, KMFolderImap *folder, - QPtrList& msgList ); + QPtrList msgList ); KIO::Job *mJob; QByteArray mData; const AttachmentStrategy *mAttachmentStrategy; Index: kmail/kmsafemsglist.cpp =================================================================== --- kmail/kmsafemsglist.cpp (revision 0) +++ kmail/kmsafemsglist.cpp (revision 0) @@ -0,0 +1,107 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- + * + * This file is part of KMail, the KDE mail client. + * Copyright (c) 2006 Andreas Kling + * + * KMail is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License, version 2, as + * published by the Free Software Foundation. + * + * KMail is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of this program with any edition of + * the Qt library by Trolltech AS, Norway (or with modified versions + * of Qt that use the same license as Qt), and distribute linked + * combinations including the two. You must obey the GNU General + * Public License in all respects for all of the code used other than + * Qt. If you modify this file, you may extend this exception to + * your version of the file, but you are not obligated to do so. If + * you do not wish to do so, delete this exception statement from + * your version. + */ + +#include +#include "kmsafemsglist.h" + +KMSafeMsgList::KMSafeMsgList() +{ + //kdDebug(5006) << "KMSafeMsgList()\n"; +} + +KMSafeMsgList::KMSafeMsgList(const QPtrList &list) +{ + //kdDebug(5006) << "KMSafeMsgList(QPtrList)\n"; + + QPtrList::const_iterator it = list.constBegin(); + QPtrList::const_iterator end = list.constEnd(); + + for (; it != end; ++it) + m_list.append(*it); +} + +KMSafeMsgList::~KMSafeMsgList() +{ + //kdDebug(5006) << "~KMSafeMsgList()\n"; +} + +KMSafeMsgList::operator QPtrList() const +{ + QValueList >::const_iterator it = m_list.constBegin(); + QValueList >::const_iterator end = m_list.constEnd(); + QPtrList list; + + for (; it != end; ++it) + list.append(*it); + + return list; +} + +void +KMSafeMsgList::append(const KMMessage *msg) +{ + //kdDebug(5006) << "KMSafeMsgList::append(" << msg << ")\n"; + m_list.append(const_cast(msg)); +} + +KMMessage * +KMSafeMsgList::first() +{ + return m_list.isEmpty() ? 0L : m_list.first(); +} + +KMMessage * +KMSafeMsgList::getLast() const +{ + return m_list.isEmpty() ? 0L : m_list.last(); +} + +bool +KMSafeMsgList::removeFirst() +{ + if (m_list.isEmpty()) + return false; + + m_list.remove(m_list.begin()); + + return true; +} + +uint +KMSafeMsgList::count() const +{ + return m_list.count(); +} + +bool +KMSafeMsgList::isEmpty() const +{ + return m_list.isEmpty(); +}