1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * @file KwKWorshipFilter.cpp
22 * @brief Main KWorship archive load and save filter.
23 * @author James Hogan <james@albanarts.com>
26 #include "KwKWorshipFilter.h"
27 #include "KwDocument.h"
28 #include "KwArchive.h"
29 #include "KwPlaylistList.h"
32 #include <KMessageBox>
36 * Constructors + destructor
39 /// Primary constructor.
40 KwKWorshipFilter::KwKWorshipFilter()
43 m_importMimeTypes
+= "application/x-kworship+xml";
44 m_exportMimeTypes
+= "application/x-kworship+xml";
45 m_importMimeTypes
+= "application/x-kworship-archive";
46 m_exportMimeTypes
+= "application/x-kworship-archive";
50 KwKWorshipFilter::~KwKWorshipFilter()
58 KwDocument
* KwKWorshipFilter::load(const KUrl
& url
)
60 // Start off by opening the archive file
61 if (!url
.isLocalFile())
64 i18n("Non-local loads not yet supported"),
69 KwDocument
* doc
= new KwDocument(url
);
70 // Open archive object and fill it
71 KwArchive
* archive
= new KwArchive(url
.toLocalFile(), false);
72 Q_ASSERT(archive
->isReading());
74 KwPlaylistList
* playlist
= archive
->extractPlaylist("0");
77 doc
->setPlaylist(playlist
);
82 doc
->setModified(false);
87 bool KwKWorshipFilter::save(KwDocument
* doc
, const KUrl
& url
)
89 /// @todo Implement KwKWorshipFilter::save
97 void KwKWorshipFilter::v_saveLimitations(KwDocument
* doc
, Limitations
* o_limitations
)
99 /// @todo Implement KwKWorshipFilter::v_saveLimitations