本文整理汇总了C++中KLibFactory::inherits方法的典型用法代码示例。如果您正苦于以下问题:C++ KLibFactory::inherits方法的具体用法?C++ KLibFactory::inherits怎么用?C++ KLibFactory::inherits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLibFactory
的用法示例。
在下文中一共展示了KLibFactory::inherits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSyncPlugin
int SyncTaskListItem::createSyncPlugin(bool state)
{
int ret = 0;
if (syncPlugin != NULL) {
syncPlugin->unInit();
delete syncPlugin;
syncPlugin = NULL;
}
if (state) {
KTrader::OfferList offers;
QString library = getPreferedLibrary();
QString offer = getPreferedOffer();
if (library.isEmpty()) {
offers = getOffers();
if (offers.begin() != offers.end()) {
KService::Ptr service = *offers.begin();
library = service->library();
offer = service->name();
}
}
if (!library.isEmpty()) {
kdDebug(2120) << i18n("Name:") << " " << offer << "; "
<< i18n("Library:") << " " << library << endl;
KLibFactory *factory = KLibLoader::self()->factory(library.ascii());
if (!factory) {
QString errorMessage = KLibLoader::self()->lastErrorMessage();
kdDebug(2120) << i18n("There was an error:") << " " << offer << errorMessage <<
endl;
ret = ERROR_NOFACTORY;
} else {
if (factory->inherits("RakiSyncFactory")) {
RakiSyncFactory *syncFactory =
static_cast<RakiSyncFactory*> (factory);
syncPlugin = static_cast<RakiSyncPlugin*>
(syncFactory->create());
syncPlugin->init(rra, this, pdaName, this->listView(), offer);
syncFactory->callme(); // Fake call to link correct.
} else {
kdDebug(2120) << i18n("Library no Raki-Plugin") << endl;
ret = ERROR_WRONGLIBRARYTYPE;
}
}
} else {
ret = ERROR_NOSYNCHRONIZER;
}
}
switch(ret) {
case ERROR_NOSYNCHRONIZER:
KMessageBox::information(this->listView(), "<p>" + i18n("No Synchronizer found for") + " <b>" +
QString(rra->getTypeForId(objectType)->name2) + "</b></p>", QString(rra->getTypeForId(objectType)->name2) + pdaName);
this->setOn(false);
this->makePersistent();
break;
case ERROR_WRONGLIBRARYTYPE:
KMessageBox::error(this->listView(), "<p>" + i18n("Wrong library type for") +" <b>" +
QString(rra->getTypeForId(objectType)->name2) + "</b></p>", QString(rra->getTypeForId(objectType)->name2) + pdaName);
this->setOn(false);
this->makePersistent();
break;
case ERROR_NOFACTORY:
KMessageBox::error(this->listView(), "<p>" + i18n("Wrong library type for") + " <b>" +
QString(rra->getTypeForId(objectType)->name2) + "</b></p>", QString(rra->getTypeForId(objectType)->name2) + pdaName);
this->setOn(false);
this->makePersistent();
break;
}
return ret;
}