Warning, file /office/calligra/libs/main/KoApplication.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef __ko_app_h__
0021 #define __ko_app_h__
0022 
0023 #include <QApplication>
0024 
0025 #include "komain_export.h"
0026 #include "KoMainWindow.h"
0027 
0028 class KoPart;
0029 
0030 class KoApplicationPrivate;
0031 class KAboutData;
0032 
0033 class QWidget;
0034 class QStringList;
0035 
0036 #include <KoFilterManager.h>
0037 
0038 #define koApp KoApplication::koApplication()
0039 
0040 typedef KAboutData* (*AboutDataGenerator)();
0041 
0042 /**
0043  *  @brief Base class for all %Calligra apps
0044  *
0045  *  This class handles arguments given on the command line and
0046  *  shows a generic about dialog for all Calligra apps.
0047  *
0048  *  In addition it adds the standard directories where Calligra applications
0049  *  can find their images etc.
0050  *
0051  *  If the last mainwindow becomes closed, KoApplication automatically
0052  *  calls QApplication::quit.
0053  */
0054 class KOMAIN_EXPORT KoApplication : public QApplication
0055 {
0056     Q_OBJECT
0057 
0058 public:
0059     /**
0060      * Creates an application object, adds some standard directories and
0061      * initializes kimgio.
0062      *
0063      * @param nativeMimeType: the nativeMimeType of the Calligra application
0064      * @param windowIconName xdg-spec name of the icon to be set for windows
0065      * @param aboutDataGenerator method to create the KAboutData for the app
0066      * @param argc number of commandline argument strings in @c argv
0067      * @param argv array of commandline argument strings
0068      */
0069     explicit KoApplication(const QByteArray &nativeMimeType,
0070                            const QString &windowIconName,
0071                            AboutDataGenerator aboutDataGenerator,
0072                            int &argc, char **argv);
0073 
0074     /**
0075      *  Destructor.
0076      */
0077     ~KoApplication() override;
0078 
0079     /**
0080      * Call this to start the application.
0081      *
0082      * Parses command line arguments and creates the initial main windows and docs
0083      * from them (or an empty doc if no cmd-line argument is specified ).
0084      *
0085      * You must call this method directly before calling QApplication::exec.
0086      *
0087      * It is valid behaviour not to call this method at all. In this case you
0088      * have to process your command line parameters by yourself.
0089      */
0090     virtual bool start();
0091 
0092     /**
0093      * Tell KoApplication to show this splashscreen when you call start();
0094      * when start returns, the splashscreen is hidden. Use KSplashScreen
0095      * to have the splash show correctly on Xinerama displays. 
0096      */
0097     void setSplashScreen(QWidget *splash);
0098 
0099 
0100     QList<KoPart*> partList() const;
0101 
0102     /**
0103      * return a list of mimetypes this application supports.
0104      */
0105     QStringList mimeFilter(KoFilterManager::Direction direction) const;
0106 
0107     // Overridden to handle exceptions from event handlers.
0108     bool notify(QObject *receiver, QEvent *event) override;
0109 
0110     /**
0111      * Returns the current application object.
0112      *
0113      * This is similar to the global QApplication pointer qApp. It
0114      * allows access to the single global KoApplication object, since
0115      * more than one cannot be created in the same application. It
0116      * saves you the trouble of having to pass the pointer explicitly
0117      * to every function that may require it.
0118      * @return the current application object
0119      */
0120     static KoApplication* koApplication();
0121 
0122 Q_SIGNALS:
0123 
0124     /// KoPart needs to be able to emit document signals from here. These
0125     /// signals are used for the dbus interface of stage, see commit
0126     /// d102d9beef80cc93fc9c130b0ad5fe1caf238267
0127     friend class KoPart;
0128 
0129     /**
0130      * emitted when a new document is opened.
0131      */
0132     void documentOpened(const QString &ref);
0133 
0134     /**
0135      * emitted when an old document is closed.
0136      */
0137     void documentClosed(const QString &ref);
0138 
0139 private Q_SLOTS:
0140     void benchmarkLoadingFinished();
0141     void slotFilePrint(KoMainWindow *view);
0142     void slotExportToPdf(KoMainWindow *view);
0143 
0144 protected:
0145 
0146     // Current application object.
0147     static KoApplication *KoApp;
0148 
0149 private:
0150     bool initHack();
0151     KoApplicationPrivate * const d;
0152     class ResetStarting;
0153     friend class ResetStarting;
0154 };
0155 
0156 #endif