Commit 9e5315e2 authored by Christoph Cullmann's avatar Christoph Cullmann

start to port away from KApplication subclass

parent 9791b8e8
......@@ -47,12 +47,13 @@
#include <unistd.h>
#include "kateappadaptor.h"
KateApp::KateApp(int & argc, char ** argv)
: QApplication (argc, argv)
, m_shouldExit(false)
KateApp *KateApp::s_self = 0;
KateApp::KateApp()
: m_shouldExit(false)
, m_args (0)
{
setQuitOnLastWindowClosed (false);
s_self = this;
// application interface
m_application = new Kate::Application (this);
......@@ -100,7 +101,7 @@ KateApp::~KateApp ()
KateApp *KateApp::self ()
{
return static_cast<KateApp *>(QApplication::instance());
return s_self;
}
Kate::Application *KateApp::application ()
......@@ -125,7 +126,7 @@ void KateApp::initKate ()
::setenv( "KATE_PID", QString("%1").arg(getpid()).toLatin1().constData(), 1 );
// handle restore different
if (isSessionRestored())
if (false /* FIXME KF5 isSessionRestored() */)
{
restoreKate ();
}
......@@ -317,7 +318,7 @@ void KateApp::shutdownKate (KateMainWindow *win)
delete m_mainWindows[0];
}
quit ();
QApplication::quit ();
}
KatePluginManager *KateApp::pluginManager()
......@@ -431,7 +432,7 @@ KateMainWindow *KateApp::activeMainWindow ()
if (m_mainWindows.isEmpty())
return 0;
int n = m_mainWindows.indexOf (static_cast<KateMainWindow *>(activeWindow()));
int n = m_mainWindows.indexOf (static_cast<KateMainWindow *>((static_cast<QApplication *>(QCoreApplication::instance ())->activeWindow())));
if (n < 0)
n = 0;
......
......@@ -52,7 +52,7 @@ class KCmdLineArgs;
* Kate Application
* This class represents the core kate application object
*/
class KATEINTERFACES_EXPORT KateApp : public QApplication
class KATEINTERFACES_EXPORT KateApp : public QObject
{
Q_OBJECT
......@@ -63,7 +63,7 @@ class KATEINTERFACES_EXPORT KateApp : public QApplication
/**
* application constructor
*/
KateApp (int & argc, char ** argv);
KateApp ();
/**
* application destructor
......@@ -239,6 +239,9 @@ class KATEINTERFACES_EXPORT KateApp : public QApplication
private:
bool m_shouldExit;
static KateApp *s_self;
/**
* kate's command line args
*/
......
......@@ -75,10 +75,10 @@ class KateWaiter : public QObject {
extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
{
// here we go, construct the Kate version
QByteArray kateVersion = KateApp::kateVersion().toLatin1();
KAboutData aboutData ("kate", 0, i18n("Kate"), kateVersion,
/**
* construct about data for Kate
*/
KAboutData aboutData ("kate", 0, i18n("Kate"), KateApp::kateVersion().toLatin1(),
i18n( "Kate - Advanced Text Editor" ), KAboutData::License_LGPL_V2,
i18n( "(c) 2000-2013 The Kate Authors" ), QString(), "http://www.kate-editor.org");
aboutData.setOrganizationDomain("kde.org");
......@@ -115,7 +115,15 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
aboutData.addCredit (i18n("Cristi Dumitrescu"), i18n("PHP Keyword/Datatype list"));
aboutData.addCredit (i18n("Carsten Pfeiffer"), i18n("Very nice help"));
aboutData.addCredit (i18n("All people who have contributed and I have forgotten to mention"));
/**
* Create the QApplication with the right options set
* take component name and org. name from KAboutData
*/
QApplication app (argc, argv);
app.setApplicationName(aboutData.componentName());
app.setOrganizationDomain(aboutData.organizationDomain());
app.setQuitOnLastWindowClosed (false);
#ifdef TODO
......@@ -379,14 +387,19 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
}
#endif
// construct the real kate app object ;)
KateApp app (argc, argv);
if (app.shouldExit()) return 0;
/**
* construct the real kate app object ;)
* behaves like a singleton, one unique instance
*/
KateApp kateApp;
if (kateApp.shouldExit()) return 0;
// execute ourself ;)
/**
* start main event loop for our application
*/
return app.exec();
}
// kate: space-indent on; indent-width 2; replace-tabs on;
#include "katemain.moc"
// kate: space-indent on; indent-width 2; replace-tabs on;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment