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 KwZionworxFilter.cpp
22 * @brief Main Zionworx load and save filter.
23 * @author James Hogan <james@albanarts.com>
26 #include "KwZionworxFilter.h"
27 #include "KwDocument.h"
28 #include "KwArchive.h"
29 #include "KwPlaylistList.h"
32 #include <KMessageBox>
37 * Constructors + destructor
40 /// Primary constructor.
41 KwZionworxFilter::KwZionworxFilter()
44 m_importMimeTypes
+= "application/x-zionworx+xml";
45 m_exportMimeTypes
+= "application/x-zionworx+xml";
49 KwZionworxFilter::~KwZionworxFilter()
57 KwDocument
* KwZionworxFilter::load(const KUrl
& url
, const QString
& mimeType
)
59 /// @todo Handle non-local files
60 if (!url
.isLocalFile())
63 i18n("Non-local loads not yet supported"),
68 KwDocument
* doc
= new KwDocument(this, mimeType
, url
);
70 /// @todo Implement KwZionworxFilter::load
72 doc
->setModified(false);
77 bool KwZionworxFilter::save(KwDocument
* doc
, const KUrl
& url
, const QString
& mimeType
)
79 /// @todo Handle non-local files
80 if (!url
.isLocalFile())
83 i18n("Non-local loads not yet supported"),
88 file
.setFileName(url
.toLocalFile());
89 if (!file
.open(QFile::WriteOnly
))
92 i18n("Cannot write file %1:\n%2.")
94 .arg(file
.errorString()),
99 /// @todo Implement KwZionworxFilter::save
101 if (!file
.finalize())
103 KMessageBox::error(0,
104 i18n("Cannot finalize file %1:\n%2.")
105 .arg(file
.fileName())
106 .arg(file
.errorString()),
111 doc
->setModified(false);
120 void KwZionworxFilter::v_saveLimitations(KwDocument
* doc
, const QString
& mimeType
, Limitations
* o_limitations
)
122 /// @todo Implement KwZionworxFilter::v_saveLimitations