[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/libs/main
From: David Faure <faure () kde ! org>
Date: 2010-11-04 10:09:07
Message-ID: 20101104100907.7381BAC89B () svn ! kde ! org
[Download RAW message or body]
SVN commit 1193017 by dfaure:
Port to m_service->createInstance, should fix kspread startup
M +6 -23 KoDocumentEntry.cpp
--- trunk/koffice/libs/main/KoDocumentEntry.cpp #1193016:1193017
@@ -54,36 +54,19 @@
KoDocument* KoDocumentEntry::createDoc(QString* errorMsg, KoDocument* parent) const
{
- // TODO use m_service->createInstance() to get better error handling,
- // and use of non-deprecated API.
- KLibFactory* factory = \
KLibLoader::self()->factory(QFile::encodeName(m_service->library())); + QString \
error; + KoDocument* doc = m_service->createInstance<KoDocument>(parent, \
QVariantList(), &error);
- if (!factory) {
+ if (!doc) {
+ kWarning(30003) << error;
if (errorMsg)
- *errorMsg = KLibLoader::self()->lastErrorMessage();
- kWarning(30003) << KLibLoader::self()->lastErrorMessage();
+ *errorMsg = error;
return 0;
}
- QObject* obj;
- if (factory->inherits("KParts::Factory"))
- obj = static_cast<KParts::Factory*>(factory)->createPart(0, parent, \
"KoDocument");
- else {
- kWarning(30003) << "factory doesn't inherit KParts::Factory ! It is a " << \
factory->metaObject()->className(); // This shouldn't happen...
- obj = factory->create(parent, "KoDocument");
+ return doc;
}
- if (!obj || !obj->inherits("KoDocument")) {
- // TODO
- //if ( errorMsg )
- // *errorMsg = i18n( "Document could not be created" );
- delete obj;
- return 0;
- }
-
- return static_cast<KoDocument*>(obj);
-}
-
KoDocumentEntry KoDocumentEntry::queryByMimeType(const QString & mimetype)
{
QString constr = QString::fromLatin1("[X-KDE-NativeMimeType] == '%1' or '%2' in \
[X-KDE-ExtraNativeMimeTypes]").arg(mimetype).arg(mimetype);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic