31 #include <QtGui/QPixmap>
32 #include <QtCore/QFile>
39 class KDataToolInfo::KDataToolInfoPrivate
42 KDataToolInfoPrivate()
51 : d(new KDataToolInfoPrivate)
56 : d(new KDataToolInfoPrivate)
61 if ( !d->service && !d->service->serviceTypes().contains(
"KDataTool" ) )
63 kDebug(30003) <<
"The service" << d->service->name()
64 <<
"does not feature the service type KDataTool";
70 : d(new KDataToolInfoPrivate)
93 return d->service->property(
"DataType" ).toString();
101 return d->service->property(
"DataMimeTypes" ).toStringList();
109 return d->service->property(
"ReadOnly" ).toBool();
112 #ifndef KDE_NO_DEPRECATED
120 QStringList::ConstIterator it = lst.begin();
121 while (!pix.load( *it +
'/' + d->service->icon() ) && it != lst.end() )
128 #ifndef KDE_NO_DEPRECATED
136 QStringList::ConstIterator it = lst.begin();
137 while (!pix.load( *it +
'/' + d->service->icon() ) && it != lst.end() )
148 return d->service->icon();
156 return d->service->property(
"Commands" ).toStringList();
164 return d->service->comment().split(
',', QString::SkipEmptyParts );
185 return d->componentData;
190 QList<KDataToolInfo> lst;
194 if ( !datatype.isEmpty() )
196 constr = QString::fromLatin1(
"DataType == '%1'" ).arg( datatype );
198 if ( !mimetype.isEmpty() )
200 QString tmp = QString::fromLatin1(
"'%1' in DataMimeTypes" ).arg( mimetype );
201 if ( constr.isEmpty() )
204 constr = constr +
" and " + tmp;
220 KService::List::ConstIterator it = offers.begin();
221 for( ; it != offers.end(); ++it )
224 if (!componentData.
isValid() || !(*it)->property(
"ExcludeFrom").toStringList()
228 kDebug() << (*it)->entryPath() <<
" excluded.";
237 return( !d->service.isNull() );
245 class KDataToolAction::KDataToolActionPrivate
248 KDataToolActionPrivate() {}
257 d(new KDataToolActionPrivate)
260 d->command = command;
276 QList<QAction*> actionList;
277 if ( tools.isEmpty() )
281 sep_action->setSeparator(
true);
282 actionList.append( sep_action );
283 QList<KDataToolInfo>::ConstIterator entry = tools.begin();
284 for( ; entry != tools.end(); ++entry )
286 const QStringList userCommands = (*entry).userCommands();
288 Q_ASSERT(!commands.isEmpty());
289 if ( commands.count() != userCommands.count() )
290 kWarning() <<
"KDataTool desktop file error (" << (*entry).service()->entryPath()
291 <<
")." << commands.count() <<
"commands and"
292 << userCommands.count() <<
" descriptions.";
293 QStringList::ConstIterator uit = userCommands.begin();
294 QStringList::ConstIterator cit = commands.begin();
295 for (; uit != userCommands.end() && cit != commands.end(); ++uit, ++cit )
298 const QString name = (*entry).service()->entryPath();
303 actionList.append( action );
315 class KDataTool::KDataToolPrivate
318 KDataToolPrivate() {}
324 :
QObject(parent), d(new KDataToolPrivate)
340 return d->componentData;
343 #include "kdatatool.moc"