~ubuntu-branches/ubuntu/vivid/kdepim/vivid

« back to all changes in this revision

Viewing changes to importwizard/claws-mail/clawsmailimportdata.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Jonathan Riddell, Rohan Garg, Scott Kitterman
  • Date: 2012-11-21 13:12:36 UTC
  • mfrom: (0.2.33)
  • Revision ID: package-import@ubuntu.com-20121121131236-32ijw9a2txrar80k
Tags: 4:4.9.80-0ubuntu1
[ Jonathan Riddell ]
* New upstream beta release

[ Rohan Garg ]
* Add nepomuk-core-dev to build-deps

[ Scott Kitterman ]
* Add new package, libpimcommon4
  - Add libpimcommon4.install
  - Add to debian/control, including kdepim-dbg and kdepim-dev depends
  - Add to kdepim-dev.install
* Remove usr/bin/backupmail and related files from kmail.install as they are
  not provided by upstream anymore
* Add usr/bin/pimsettingexporter and related files to kmail.install
* Add libnepomukwidgets-dev to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (c) 2012 Montel Laurent <montel@kde.org>
 
3
 
 
4
  This program is free software; you can redistribute it and/or modify it
 
5
  under the terms of the GNU General Public License, version 2, as
 
6
  published by the Free Software Foundation.
 
7
 
 
8
  This program is distributed in the hope that it will be useful, but
 
9
  WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
  General Public License for more details.
 
12
 
 
13
  You should have received a copy of the GNU General Public License along
 
14
  with this program; if not, write to the Free Software Foundation, Inc.,
 
15
  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
16
*/
 
17
 
 
18
#include "claws-mail/clawsmailimportdata.h"
 
19
#include "claws-mail/clawsmailsettings.h"
 
20
#include "claws-mail/clawsmailaddressbook.h"
 
21
#include "mailimporter/filter_clawsmail.h"
 
22
#include "mailcommon/filter/filterimporter/filterimporterclawsmail_p.h"
 
23
#include "mailimporter/filterinfo.h"
 
24
#include "importfilterinfogui.h"
 
25
#include "importwizard.h"
 
26
 
 
27
#include <KLocale>
 
28
 
 
29
#include <QDir>
 
30
#include <QWidget>
 
31
 
 
32
 
 
33
ClawsMailImportData::ClawsMailImportData(ImportWizard*parent)
 
34
  :AbstractImporter(parent)
 
35
{
 
36
  mPath = MailImporter::FilterClawsMail::defaultSettingsPath();
 
37
}
 
38
 
 
39
ClawsMailImportData::~ClawsMailImportData()
 
40
{
 
41
}
 
42
 
 
43
 
 
44
bool ClawsMailImportData::foundMailer() const
 
45
{
 
46
  QDir directory( mPath );
 
47
  if ( directory.exists() )
 
48
    return true;
 
49
  return false;
 
50
}
 
51
 
 
52
QString ClawsMailImportData::name() const
 
53
{
 
54
  return QLatin1String("Claws Mails");
 
55
}
 
56
 
 
57
bool ClawsMailImportData::importMails()
 
58
{
 
59
  MailImporter::FilterInfo *info = initializeInfo();
 
60
 
 
61
  MailImporter::FilterClawsMail clawsMail;
 
62
  clawsMail.setFilterInfo( info );
 
63
  info->setStatusMessage(i18n("Import in progress"));
 
64
  const QString mailsPath = clawsMail.localMailDirPath();
 
65
  QDir directory(mailsPath);
 
66
  if(directory.exists())
 
67
    clawsMail.importMails(mailsPath);
 
68
  else
 
69
    clawsMail.import();
 
70
  info->setStatusMessage(i18n("Import finished"));
 
71
 
 
72
 
 
73
  delete info;
 
74
  return true;
 
75
}
 
76
 
 
77
bool ClawsMailImportData::importAddressBook()
 
78
{
 
79
  const QDir addressbookDir(mPath + QLatin1String("addrbook/"));
 
80
  ClawsMailAddressBook account( addressbookDir, mImportWizard );
 
81
  return true;
 
82
}
 
83
 
 
84
bool ClawsMailImportData::importSettings()
 
85
{
 
86
  const QString accountFile = mPath + QLatin1String("accountrc");
 
87
  if ( QFile( accountFile ).exists() ) {
 
88
    ClawsMailSettings account( mImportWizard );
 
89
    account.importSettings(accountFile, mPath);
 
90
  } else {
 
91
    addImportSettingsInfo(i18n("Claws Mail settings not found."));
 
92
  }
 
93
  return true;
 
94
}
 
95
 
 
96
bool ClawsMailImportData::importFilters()
 
97
{
 
98
  const QString filterPath(mPath + QLatin1String("matcherrc"));
 
99
  return addFilters( filterPath, MailCommon::FilterImporterExporter::ClawsMailFilter );
 
100
}
 
101
 
 
102
 
 
103
AbstractImporter::TypeSupportedOptions ClawsMailImportData::supportedOption()
 
104
{
 
105
  TypeSupportedOptions options;
 
106
  options |=AbstractImporter::Mails;
 
107
  options |=AbstractImporter::AddressBooks;
 
108
  options |=AbstractImporter::Settings;
 
109
  options |=AbstractImporter::Filters;
 
110
  return options;
 
111
}