2 Copyright (c) 2007 Volker Krause <vkrause@kde.org>
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 #ifndef KMAIL_MESSAGECOPYHELPER_H
21 #define KMAIL_MESSAGECOPYHELPER_H
28 #include <maillistdrag.h>
37 Helper class to copy/move a set of messages defined by their serial
38 numbers from arbitrary folders into a common destination folder.
40 class MessageCopyHelper
: public QObject
46 Creates new MessageCopyHelper object to copy the given messages
47 to the specified destination folder.
48 @param msgs List of serial numbers.
49 @param dest Destination folder.
50 @param move If set to true, messages will be moved instead of copied
51 @param parent The parent object.
53 MessageCopyHelper( const QList
<quint32
> &msgs
, KMFolder
*dest
,
54 bool move
, QObject
*parent
= 0 );
57 Converts a MailList into a serial number list.
59 static QList
<quint32
> serNumListFromMailList( const KPIM::MailList
&list
);
62 Converts a KMMsgsBase* list into a serial number list.
64 static QList
<quint32
> serNumListFromMsgList( QList
<KMMsgBase
*> list
);
67 Checks of any of the given messages comes from a read-only source.
69 static bool inReadOnlyFolder( const QList
<quint32
> &sernums
);
72 * Returns the source folder for the first serial number found
73 * in the sernums list. This can be used as a quick and dirty "guess"
74 * in dnd operations for finding if the drag comes from the
75 * same folder as destination. It will catch 90% of the cases.
76 * The real drop operation should obviously use a more detailed check.
77 * This function may return zero if the list is empty or contains
78 * some kind of garbage.
80 static KMFolder
* firstSourceFolder( const QList
<quint32
> &sernums
);
83 void copyCompleted( KMCommand
*cmd
);
86 QMap
<QPointer
<KMFolder
>, int> mOpenFolders
;