libKipi
interface.cpp
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of kipi-plugins project
4 * http://www.kipi-plugins.org
5 *
6 * Date : 2004-02-01
7 * Description : interface for host application.
8 *
9 * Copyright (C) 2004-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * Copyright (C) 2004-2005 by Renchi Raju <renchi.raju at kdemail.net>
11 * Copyright (C) 2004-2005 by Jesper K. Pedersen <blackie at kde.org>
12 * Copyright (C) 2004-2005 by Aurelien Gateau <aurelien dot gateau at free.fr>
13 *
14 * This program is free software; you can redistribute it
15 * and/or modify it under the terms of the GNU General
16 * Public License as published by the Free Software Foundation;
17 * either version 2, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * ============================================================ */
25
27
28// KDE includes.
29
30#include <kdebug.h>
31#include <kimageio.h>
32
33// Local includes.
34
35#include "version.h"
36#include "pluginloader.h"
37#include "interface.h"
38#include "interface.moc"
39
51
56
61
66
72
79
84
89
94
101
102
103KIPI::Interface::Interface(QObject *parent, const char *name )
104 : QObject(parent, name)
105{
106}
107
111
114{
115 return QString(kipi_version);
116}
117
121void KIPI::Interface::refreshImages( const KURL::List& )
122{
123}
124
130{
131 return ( features() & feature ) != 0;
132}
133
134bool KIPI::Interface::hasFeature( const QString& feature )
135{
136 if ( feature == "AlbumsHaveComments" )
137 return hasFeature( KIPI::AlbumsHaveComments );
138 else if ( feature == "ImagesHasComments" )
139 return hasFeature( KIPI::ImagesHasComments );
140 else if ( feature == "ImagesHasTime" )
141 return hasFeature( KIPI::ImagesHasTime );
142 else if ( feature == "SupportsDateRanges" )
143 return hasFeature( KIPI::SupportsDateRanges );
144 else if ( feature == "AcceptNewImages" )
145 return hasFeature( KIPI::AcceptNewImages );
146 else if ( feature == "ImageTitlesWritable" )
147 return hasFeature( KIPI::ImageTitlesWritable );
148 else if ( feature == "AlbumsHaveCategory" )
149 return hasFeature( KIPI::AlbumsHaveCategory );
150 else if ( feature == "AlbumsHaveCreationDate" )
151 return hasFeature( KIPI::AlbumsHaveCreationDate );
152 else if ( feature == "AlbumsUseFirstImagePreview" )
153 return hasFeature( KIPI::AlbumsUseFirstImagePreview );
154 else if ( feature == "HostSupportsTags" )
155 return hasFeature( KIPI::HostSupportsTags );
156 else {
157 kdWarning( 51000 ) << "Unknown feature asked for in KIPI::Interface::hasFeature: " << feature << endl;
158 return false;
159 }
160}
161
167bool KIPI::Interface::addImage( const KURL&, QString& /*err*/ )
168{
169 kdWarning(51000) << "Interface::addImage should only be invoked if the host application supports the KIPI::Features\n"
170 "AcceptNewImages - if the host application do support that, then this function should\n"
171 "have been overridden in the host application.\n" << endl;
172 return false;
173}
174
175void KIPI::Interface::delImage( const KURL& )
176{
177}
178
185{
186 // This implementation is just to be able to write documentation above.
187 return KIPI::ImageCollection();
188}
189
196{
197 // This implementation is just to be able to write documentation above.
198 return KIPI::ImageCollection();
199}
200
204QValueList<KIPI::ImageCollection> KIPI::Interface::allAlbums()
205{
206 // This implementation is just to be able to write documentation above.
207 return QValueList<KIPI::ImageCollection>();
208}
209
210
215{
216 // This implementation is just to be able to write documentation above.
217 return 0;
218}
219
226{
227 QStringList KDEImagetypes = KImageIO::mimeTypes( KImageIO::Reading );
228 QString imagesFileFilter = KDEImagetypes.join(" ");
229 return ( imagesFileFilter.lower() + " " + imagesFileFilter.upper() );
230}
KDStream & endl(KDStream &stream)
Definition KDStream.cpp:264
Definition imagecollection.h:53
virtual ImageCollection currentAlbum()=0
Definition interface.cpp:184
virtual bool addImage(const KURL &, QString &err)
Definition interface.cpp:167
virtual ~Interface()
Definition interface.cpp:108
Interface(QObject *parent, const char *name=0)
Definition interface.cpp:103
virtual void delImage(const KURL &)
Definition interface.cpp:175
virtual void refreshImages(const KURL::List &)
Definition interface.cpp:121
virtual QString fileExtensions()
Definition interface.cpp:225
virtual QValueList< ImageCollection > allAlbums()=0
Definition interface.cpp:204
static QString version()
Definition interface.cpp:113
virtual ImageCollection currentSelection()=0
Definition interface.cpp:195
virtual int features() const =0
Definition interface.cpp:214
bool hasFeature(KIPI::Features feature)
Definition interface.cpp:129
Features
Definition interface.h:49
@ AlbumsHaveCategory
Definition interface.h:56
@ ImageTitlesWritable
Definition interface.h:55
@ AlbumsUseFirstImagePreview
Definition interface.h:58
@ ImagesHasTime
Definition interface.h:52
@ SupportsDateRanges
Definition interface.h:53
@ AlbumsHaveComments
Definition interface.h:50
@ ImagesHasComments
Definition interface.h:51
@ HostSupportsTags
Definition interface.h:59
@ AlbumsHaveCreationDate
Definition interface.h:57
@ AcceptNewImages
Definition interface.h:54