[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kpresenter/part
From: Johannes Simon <johannes.simon () gmail ! com>
Date: 2010-10-07 23:44:37
Message-ID: 20101007234437.7A105AC892 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1183580 by jsimon:
Show error and quit KPresenter if either the TextShape or PictureShape is not \
installed.
M +36 -0 KPrDocument.cpp
M +14 -0 KPrDocument.h
--- trunk/koffice/kpresenter/part/KPrDocument.cpp #1183579:1183580
@@ -50,7 +50,11 @@
#include <KConfigGroup>
#include <KGlobal>
#include <KStandardDirs>
+#include <KMessageBox>
+#include <QTimer>
+#include <QCoreApplication>
+
class InitOnce
{
public:
@@ -371,6 +375,38 @@
return m_declarations;
}
+void KPrDocument::showStartUpWidget( KoMainWindow * parent, bool alwaysShow )
+{
+ // Go through all (optional) plugins we require and quit if necessary
+ bool error = false;
+ KoShapeFactoryBase * factory;
+ // TODO: Uncomment i18n calls after release of 2.3
+ factory = KoShapeRegistry::instance()->value( "TextShapeID" );
+ if ( !factory ) {
+ m_errorMessage = /*i18n(*/ "Can not find needed text component, KPresenter \
will quit now." /*)*/; + error = true;
+ }
+ factory = KoShapeRegistry::instance()->value( "PictureShape" );
+ if ( !factory ) {
+ m_errorMessage = /*i18n(*/ "Can not find needed picture component, \
KPresenter will quit now." /*)*/; + error = true;
+ }
+
+ if ( error ) {
+ QTimer::singleShot( 0, this, SLOT( showErrorAndDie() ) );
+ } else {
+ KoDocument::showStartUpWidget( parent, alwaysShow );
+ }
+}
+
+void KPrDocument::showErrorAndDie()
+{
+ KMessageBox::error( widget(), m_errorMessage, i18n( "Installation Error" ) );
+ // This means "the environment is incorrect" on Windows
+ // FIXME: Is this uniform on all platforms?
+ QCoreApplication::exit( 10 );
+}
+
#include "KPrDocument.moc"
--- trunk/koffice/kpresenter/part/KPrDocument.h #1183579:1183580
@@ -139,6 +139,14 @@
*/
KPrDeclarations * declarations() const;
+ /**
+ * Creates and shows the start up widget. Reimplemented from KoDocument.
+ *
+ * @param parent the KoMainWindow used as parent for the widget.
+ * @param alwaysShow always show the widget even if the user has configured it \
to not show. + */
+ void showStartUpWidget( KoMainWindow * parent, bool alwaysShow );
+
public slots:
virtual void initEmpty();
@@ -195,10 +203,16 @@
KPrCustomSlideShows *m_customSlideShows;
+protected slots:
+ /// Quits KPresenter with error message from m_errorMessage.
+ void showErrorAndDie();
+
private:
int m_presentationMonitor;
bool m_presenterViewEnabled;
QString m_activeCustomSlideShow;
+ /// Message shown before KPresenter quits with an error if something is wrong
+ QString m_errorMessage;
KPrDeclarations *m_declarations;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic