1 | /* |
2 | Copyright (c) 2009 Andras Mantia <amantia@kde.org> |
3 | |
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. |
8 | |
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. |
13 | |
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 |
17 | 02110-1301, USA. |
18 | */ |
19 | |
20 | #include "renamejob.h" |
21 | |
22 | #include <KDE/KLocalizedString> |
23 | #include <KDE/KDebug> |
24 | |
25 | #include "job_p.h" |
26 | #include "message_p.h" |
27 | #include "session_p.h" |
28 | #include "rfccodecs.h" |
29 | |
30 | namespace KIMAP |
31 | { |
32 | class RenameJobPrivate : public JobPrivate |
33 | { |
34 | public: |
35 | RenameJobPrivate( Session *session, const QString& name ) : JobPrivate( session, name ) { } |
36 | ~RenameJobPrivate() { } |
37 | |
38 | QString sourceMailBox; |
39 | QString destinationMailBox; |
40 | }; |
41 | } |
42 | |
43 | using namespace KIMAP; |
44 | |
45 | RenameJob::RenameJob( Session *session ) |
46 | : Job( *new RenameJobPrivate( session, i18n( "Rename" ) ) ) |
47 | { |
48 | } |
49 | |
50 | RenameJob::~RenameJob() |
51 | { |
52 | } |
53 | |
54 | void RenameJob::doStart() |
55 | { |
56 | Q_D( RenameJob ); |
57 | d->tags << d->sessionInternal()->sendCommand( "RENAME" , '\"' + KIMAP::encodeImapFolderName( d->sourceMailBox.toUtf8() ) + |
58 | "\" \"" + KIMAP::encodeImapFolderName( d->destinationMailBox.toUtf8() ) + '\"' ); |
59 | } |
60 | |
61 | void RenameJob::setSourceMailBox( const QString &mailBox ) |
62 | { |
63 | Q_D( RenameJob ); |
64 | d->sourceMailBox = mailBox; |
65 | } |
66 | |
67 | QString RenameJob::sourceMailBox() const |
68 | { |
69 | Q_D( const RenameJob ); |
70 | return d->sourceMailBox; |
71 | } |
72 | |
73 | void RenameJob::setDestinationMailBox( const QString &mailBox ) |
74 | { |
75 | Q_D( RenameJob ); |
76 | d->destinationMailBox = mailBox; |
77 | } |
78 | |
79 | QString RenameJob::destinationMailBox() const |
80 | { |
81 | Q_D( const RenameJob ); |
82 | return d->destinationMailBox; |
83 | } |
84 | |