3
* Copyright (C) 2003 George Staikos <staikos@kde.org>
4
* 2004 Dirk Ziegelmeier <dziegel@gmx.de>
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public License
17
* along with this library; see the file COPYING.LIB. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
19
* Boston, MA 02110-1301, USA.
23
#include "kdetvchannelplugin.h"
24
#include "channelstore.h"
29
#include <kparts/componentfactory.h>
32
KdetvChannelPlugin::KdetvChannelPlugin(Kdetv *ktv, const QString& cfgkey, QObject *o, const char* n)
33
: KdetvPluginBase(ktv, cfgkey, o, n),
34
_flags(FormatReadWrite)
39
KdetvChannelPlugin::~KdetvChannelPlugin()
44
bool KdetvChannelPlugin::canRead(const QString& fmt) const
46
return (_flags & FormatRead) && (_fmtName == fmt);
50
bool KdetvChannelPlugin::canWrite(const QString& fmt) const
52
return (_flags & FormatWrite) && (_fmtName == fmt);
56
bool KdetvChannelPlugin::handlesFile(const QString& filename, int rflags) const
58
return ((_flags & rflags) == rflags) && filename.endsWith(_fmtName);
62
bool KdetvChannelPlugin::load(ChannelStore *store, KdetvChannelPlugin::ChannelFileMetaInfo *info,
63
const QString &filename, const QString& fmt)
66
if (!file.open(IO_ReadOnly)) {
70
if (!load(store, info, &file, fmt)) {
71
kdWarning() << "KdetvChannelPlugin::load(...) sub-class load method failed" << endl;
75
kdDebug() << "KdetvChannelPlugin::load(...) sub-class load ok" << endl;
80
bool KdetvChannelPlugin::save(ChannelStore *store, KdetvChannelPlugin::ChannelFileMetaInfo *info,
81
const QString &filename, const QString& fmt)
84
if (!file.open(IO_WriteOnly)) {
88
if (!save(store, info, &file, fmt)) {
89
kdWarning() << "KdetvChannelPlugin::save(...) sub-class save method failed" << endl;
93
kdDebug() << "KdetvChannelPlugin::save(...) sub-class save ok" << endl;
98
bool KdetvChannelPlugin::load(ChannelStore *, KdetvChannelPlugin::ChannelFileMetaInfo *,
99
QIODevice *, const QString&)
104
bool KdetvChannelPlugin::save(ChannelStore *, KdetvChannelPlugin::ChannelFileMetaInfo *,
105
QIODevice *, const QString&)
111
#include "kdetvchannelplugin.moc"