summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-21 10:53:45 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-21 10:53:45 (GMT)
commite81f4bd908ed4f60dd9eb0893e761d230d9e9c2a (patch)
treea2e8304132db891748c22d22292c453478b049ae
parentdbb52f2336f5f704a6aa46e6be079ecedf472935 (diff)
KateWaiter in own file
-rw-r--r--kate/CMakeLists.txt1
-rw-r--r--kate/app/katewaiter.h61
-rw-r--r--kate/app/main.cpp39
3 files changed, 63 insertions, 38 deletions
diff --git a/kate/CMakeLists.txt b/kate/CMakeLists.txt
index 8c57719..f8bf84c 100644
--- a/kate/CMakeLists.txt
+++ b/kate/CMakeLists.txt
@@ -44,6 +44,7 @@ set (KATE_APPLICATION_SRCS
app/katerunninginstanceinfo.cpp
app/kateappcommands.cpp
app/katequickopen.cpp
+ app/katewaiter.h
app/main.cpp)
# create kde init executable
diff --git a/kate/app/katewaiter.h b/kate/app/katewaiter.h
new file mode 100644
index 0000000..2f75930
--- /dev/null
+++ b/kate/app/katewaiter.h
@@ -0,0 +1,61 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2005 Christoph Cullmann <cullmann@kde.org>
+ Copyright (C) 2002, 2003 Joseph Wenninger <jowenn@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __KATE_WAITER_H__
+#define __KATE_WAITER_H__
+
+#include <QCoreApplication>
+#include <QObject>
+#include <QDBusConnection>
+#include <QDBusConnectionInterface>
+
+class KateWaiter : public QObject {
+ Q_OBJECT
+
+ private:
+ QCoreApplication *m_app;
+ QString m_service;
+ QStringList m_tokens;
+ public:
+ KateWaiter (QCoreApplication *app, const QString &service,const QStringList &tokens)
+ : QObject (app), m_app (app), m_service (service),m_tokens(tokens) {
+ connect ( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString))
+ , this, SLOT(serviceOwnerChanged(QString,QString,QString)) );
+ }
+
+ public Q_SLOTS:
+ void exiting () {
+ m_app->quit ();
+ }
+
+ void documentClosed(const QString& token) {
+ m_tokens.removeAll(token);
+ if (m_tokens.count()==0) m_app->quit();
+ }
+
+ void serviceOwnerChanged( const QString & name, const QString &, const QString &) {
+ if (name != m_service)
+ return;
+
+ m_app->quit ();
+ }
+};
+
+#endif
diff --git a/kate/app/main.cpp b/kate/app/main.cpp
index b75a9c2..f74eadc 100644
--- a/kate/app/main.cpp
+++ b/kate/app/main.cpp
@@ -21,6 +21,7 @@
#include "kateapp.h"
#include "katerunninginstanceinfo.h"
+#include "katewaiter.h"
#include <KAboutData>
#include <KLocalizedString>
@@ -28,52 +29,16 @@
#include <QByteArray>
#include <QCommandLineParser>
-#include <QCoreApplication>
#include <QLoggingCategory>
#include <QTextCodec>
#include <QUrl>
#include <QVariant>
-#include <QDBusConnection>
-#include <QDBusConnectionInterface>
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDBusReply>
#include <QApplication>
#include <QDir>
-class KateWaiter : public QObject {
- Q_OBJECT
-
- private:
- QCoreApplication *m_app;
- QString m_service;
- QStringList m_tokens;
- public:
- KateWaiter (QCoreApplication *app, const QString &service,const QStringList &tokens)
- : QObject (app), m_app (app), m_service (service),m_tokens(tokens) {
- connect ( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString))
- , this, SLOT(serviceOwnerChanged(QString,QString,QString)) );
- }
-
- public Q_SLOTS:
- void exiting () {
- m_app->quit ();
- }
-
- void documentClosed(const QString& token) {
- m_tokens.removeAll(token);
- if (m_tokens.count()==0) m_app->quit();
- }
-
- void serviceOwnerChanged( const QString & name, const QString &, const QString &) {
- if (name != m_service)
- return;
-
- m_app->quit ();
- }
-};
-
-
extern "C" Q_DECL_EXPORT int kdemain( int argc, char **argv )
{
QLoggingCategory::setFilterRules(QStringLiteral("kate = true"));
@@ -446,5 +411,3 @@ extern "C" Q_DECL_EXPORT int kdemain( int argc, char **argv )
*/
return app.exec();
}
-
-#include "main.moc"