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

« back to all changes in this revision

Viewing changes to mailimporter/filter_sylpheed.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:
44
44
{
45
45
}
46
46
 
47
 
QString FilterSylpheed::defaultPath()
 
47
QString FilterSylpheed::defaultSettingsPath()
48
48
{
49
49
  return QDir::homePath() + QLatin1String( "/.sylpheed-2.0/" );
50
50
}
51
51
 
52
52
QString FilterSylpheed::localMailDirPath()
53
53
{
54
 
  QFile folderListFile( defaultPath() + QLatin1String( "/folderlist.xml" ) );
 
54
  QFile folderListFile( FilterSylpheed::defaultSettingsPath() + QLatin1String( "/folderlist.xml" ) );
55
55
  if ( folderListFile.exists() ) {
56
56
    QDomDocument doc;
57
57
    QString errorMsg;
162
162
  processDirectory( dirName );
163
163
}
164
164
 
 
165
bool FilterSylpheed::excludeFile(const QString& file)
 
166
{
 
167
    if(file.endsWith(QLatin1String(".sylpheed_cache")) ||
 
168
       file.endsWith(QLatin1String(".sylpheed_mark")) ||
 
169
       file.endsWith(QLatin1String(".mh_sequences")) ) {
 
170
        return true;
 
171
    }
 
172
    return false;
 
173
}
 
174
 
 
175
QString FilterSylpheed::defaultInstallFolder() const
 
176
{
 
177
  return i18nc("define folder name where we will import sylpheed mails", "Sylpheed-Import") + QLatin1Char('/');
 
178
}
 
179
 
 
180
QString FilterSylpheed::markFile() const
 
181
{
 
182
  return QString::fromLatin1(".sylpheed_mark");
 
183
}
165
184
 
166
185
/**
167
186
 * Import the files within a Folder.
177
196
  QHash<QString,unsigned long> msgflags;
178
197
 
179
198
  QDir importDir (dirName);
 
199
  const QString defaultInstallPath = defaultInstallFolder();
 
200
 
180
201
  const QStringList files = importDir.entryList(QStringList("[^\\.]*"), QDir::Files, QDir::Name);
181
202
  int currentFile = 1, numFiles = files.size();
182
203
 
183
 
  readMarkFile(dir.filePath(".sylpheed_mark"), msgflags);
 
204
  readMarkFile(dir.filePath(markFile()), msgflags);
184
205
 
185
206
  QStringList::ConstIterator end( files.constEnd() );
186
207
  for ( QStringList::ConstIterator mailFile = files.constBegin(); mailFile != end; ++mailFile, ++currentFile) {
187
208
    if(filterInfo()->shouldTerminate())
188
209
      return;
189
210
    QString _mfile = *mailFile;
190
 
    if (!(_mfile.endsWith(QLatin1String(".sylpheed_cache")) || _mfile.endsWith(QLatin1String(".sylpheed_mark"))
191
 
          || _mfile.endsWith(QLatin1String(".mh_sequences")) )) {
 
211
    if (!excludeFile(_mfile)) {
192
212
      if(!generatedPath) {
193
 
        //FIXME: Why recreate all the time _path ?
194
 
 
195
 
        _path = i18nc("define folder name where we will import sylpheed mails", "Sylpheed-Import") + QLatin1Char('/');
 
213
        _path = defaultInstallPath;
196
214
        QString _tmp = dir.filePath(*mailFile);
197
215
        _tmp = _tmp.remove(_tmp.length() - _mfile.length() -1, _mfile.length()+1);
198
216
        _path += _tmp.remove( mailDir(), Qt::CaseSensitive );