• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

mailcommon

  • sources
  • kde-4.12
  • kdepim
  • mailcommon
  • job
backupjob.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License as
6  published by the Free Software Foundation; either version 2 of
7  the License or (at your option) version 3 or any later version
8  accepted by the membership of KDE e.V. (or its successor approved
9  by the membership of KDE e.V.), which shall act as a proxy
10  defined in Section 14 of version 3 of the license.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef MAILCOMMON_BACKUPJOB_H
22 #define MAILCOMMON_BACKUPJOB_H
23 
24 #include "mailcommon_export.h"
25 #include "progresswidget/progressmanager.h"
26 
27 #include <Akonadi/Collection>
28 #include <Akonadi/Item>
29 
30 #include <KUrl>
31 
32 #include <QList>
33 #include <QObject>
34 #include <QPointer>
35 
36 class KArchive;
37 class KJob;
38 
39 class QWidget;
40 
41 namespace Akonadi {
42 class ItemFetchJob;
43 }
44 
45 namespace MailCommon {
46 
54 class MAILCOMMON_EXPORT BackupJob : public QObject
55 {
56  Q_OBJECT
57 
58 public:
59  // These enum values have to stay in sync with the format combobox of ArchiveFolderDialog!
60  enum ArchiveType {
61  Zip = 0,
62  Tar = 1,
63  TarBz2 = 2,
64  TarGz = 3
65  };
66 
67  explicit BackupJob( QWidget *parent = 0 );
68  ~BackupJob();
69 
70  void setRootFolder( const Akonadi::Collection &rootFolder );
71  void setSaveLocation( const KUrl &savePath );
72  void setArchiveType( ArchiveType type );
73  void setDeleteFoldersAfterCompletion( bool deleteThem );
74  void setRecursive( bool recursive );
75  void setDisplayMessageBox(bool display);
76  void setRealPath(const QString &path);
77 
78 
79  void start();
80 signals:
81  void backupDone(const QString&);
82  void error(const QString&);
83 
84 private slots:
85  void itemFetchJobResult( KJob *job );
86  void cancelJob();
87  void archiveNextFolder();
88  void onArchiveNextFolderDone( KJob *job );
89  void archiveNextMessage();
90 
91 private:
92  bool queueFolders( const Akonadi::Collection &root );
93  void processMessage( const Akonadi::Item &item );
94  QString pathForCollection( const Akonadi::Collection &collection ) const;
95  QString subdirPathForCollection( const Akonadi::Collection &collection ) const;
96  bool hasChildren( const Akonadi::Collection &collection ) const;
97  void finish();
98  void abort( const QString &errorMessage );
99  bool writeDirHelper( const QString &directoryPath );
100 
101  // Helper function to return the name of the given collection.
102  // Some Collection's don't have the name fetched. However, in mAllFolders,
103  // we have a list of Collection's that have that information in them, so
104  // we can just look it up there.
105  QString collectionName( const Akonadi::Collection &collection ) const;
106 
107  QString mRealPath;
108  KUrl mMailArchivePath;
109  time_t mArchiveTime;
110  ArchiveType mArchiveType;
111  Akonadi::Collection mRootFolder;
112  KArchive *mArchive;
113  QWidget *mParentWidget;
114  int mArchivedMessages;
115  uint mArchivedSize;
116  QPointer<KPIM::ProgressItem> mProgressItem;
117  bool mAborted;
118  bool mDeleteFoldersAfterCompletion;
119  bool mRecursive;
120 
121  Akonadi::Collection::List mPendingFolders;
122  Akonadi::Collection::List mAllFolders;
123  Akonadi::Collection mCurrentFolder;
124  Akonadi::Item::List mPendingMessages;
125  Akonadi::ItemFetchJob *mCurrentJob;
126  bool mDisplayMessageBox;
127 };
128 
129 }
130 
131 #endif
QWidget
QObject
MailCommon::BackupJob::ArchiveType
ArchiveType
Definition: backupjob.h:60
mailcommon_export.h
MailCommon::BackupJob
Writes an entire folder structure to an archive file.
Definition: backupjob.h:54
MAILCOMMON_EXPORT
#define MAILCOMMON_EXPORT
Definition: mailcommon_export.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailcommon

Skip menu "mailcommon"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal