[SCM] ktp-filetransfer-handler packaging branch, master, updated. debian/15.12.1-2-226-g825cd93
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:11:50 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-filetransfer-handler.git;a=commitdiff;h=5d84b26
The following commit has been merged in the master branch:
commit 5d84b26999677cd755b558b593ab902e45050148
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date: Thu Oct 13 18:40:37 2011 +0200
Use common submodule
---
.gitmodules | 3 +
CMakeLists.txt | 12 ++
common | 1 +
src/CMakeLists.txt | 6 +-
src/filetransfer-handler.cpp | 2 +-
src/main.cpp | 2 +-
src/telepathy-handler-application.cpp | 221 ----------------------------------
src/telepathy-handler-application.h | 72 -----------
8 files changed, 23 insertions(+), 296 deletions(-)
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..cc4154b
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "common"]
+ path = common
+ url = git://anongit.kde.org/telepathy-common-internals
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 934bce2..6db166b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,18 @@ add_definitions (${KDE4_DEFINITIONS}
include_directories (${KDE4_INCLUDES}
${TELEPATHY_QT4_INCLUDE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
)
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules)
+execute_process(COMMAND git submodule init
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+execute_process(COMMAND git submodule update
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+)
+endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules)
+
+
add_subdirectory(src)
diff --git a/common b/common
new file mode 160000
index 0000000..702f544
--- /dev/null
+++ b/common
@@ -0,0 +1 @@
+Subproject commit 702f544476ecc2b87f69eb0b4e4349259f791001
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ad3474e..aeeadde 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,10 +1,14 @@
+set (telepathy_kde_common_internals_SRCS
+ ../common/telepathy-handler-application.cpp
+)
+
set (telepathy_kde_filetransfer_handler_SRCS
main.cpp
- telepathy-handler-application.cpp
filetransfer-handler.cpp
telepathy-base-job.cpp
handle-incoming-file-transfer-channel-job.cpp
handle-outgoing-file-transfer-channel-job.cpp
+ ${telepathy_kde_common_internals_SRCS}
)
kde4_add_executable(telepathy-kde-filetransfer-handler ${telepathy_kde_filetransfer_handler_SRCS})
diff --git a/src/filetransfer-handler.cpp b/src/filetransfer-handler.cpp
index 69073d2..7dd3c43 100644
--- a/src/filetransfer-handler.cpp
+++ b/src/filetransfer-handler.cpp
@@ -16,7 +16,7 @@
*/
#include "filetransfer-handler.h"
-#include "telepathy-handler-application.h"
+#include "common/telepathy-handler-application.h"
#include "handle-incoming-file-transfer-channel-job.h"
#include "handle-outgoing-file-transfer-channel-job.h"
diff --git a/src/main.cpp b/src/main.cpp
index e3fd192..292bcb5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "telepathy-handler-application.h"
#include "filetransfer-handler.h"
+#include "common/telepathy-handler-application.h"
#include <KAboutData>
#include <KCmdLineArgs>
diff --git a/src/telepathy-handler-application.cpp b/src/telepathy-handler-application.cpp
deleted file mode 100644
index 3cd0bd8..0000000
--- a/src/telepathy-handler-application.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
-* Copyright (C) 2011 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
-* Copyright (C) 1999 Preston Brown <pbrown at kde.org>
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 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
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "telepathy-handler-application.h"
-
-#include <QTimer>
-#include <KCmdLineArgs>
-#include <KDebug>
-
-#include <TelepathyQt4/Types>
-#include <TelepathyQt4/Debug>
-
-
-extern bool kde_kdebug_enable_dbus_interface;
-
-namespace KTelepathy {
-
-
-namespace {
-int s_tpqt4DebugArea;
-
-static void tpDebugCallback(const QString &libraryName,
- const QString &libraryVersion,
- QtMsgType type,
- const QString &msg)
-{
- Q_UNUSED(libraryName)
- Q_UNUSED(libraryVersion)
- kDebugStream(type, s_tpqt4DebugArea, __FILE__, __LINE__, "Telepathy-Qt4") << qPrintable(msg);
-}
-}
-
-class TelepathyHandlerApplication::Private
-{
-public:
- Private(TelepathyHandlerApplication *q);
- ~Private();
-
- void _k_onInitialTimeout();
- void _k_onTimeout();
-
- static KComponentData initHack();
- void init(int initialTimeout, int timeout);
-
- TelepathyHandlerApplication *q;
-
- static bool s_persist;
- static bool s_debug;
-
- int initialTimeout;
- int timeout;
- QTimer *timer;
- bool firstJobStarted;
- QAtomicInt jobCount;
-};
-
-TelepathyHandlerApplication::Private::Private(TelepathyHandlerApplication *q)
- : q(q),
- firstJobStarted(false),
- jobCount(0)
-{
-}
-
-TelepathyHandlerApplication::Private::~Private()
-{
-}
-
-void TelepathyHandlerApplication::Private::_k_onInitialTimeout()
-{
- if (jobCount == 0 && jobCount.fetchAndAddOrdered(-1) == 0) {
- // m_jobCount is now -1
- kDebug() << "No job received. Exiting";
- QCoreApplication::quit();
- }
-}
-
-void TelepathyHandlerApplication::Private::_k_onTimeout()
-{
- if (jobCount == 0 && jobCount.fetchAndAddOrdered(-1) == 0) {
- // m_jobCount is now -1
- kDebug() << "Timeout. Exiting";
- QCoreApplication::quit();
- }
-}
-
-// this gets called before even entering QApplication::QApplication()
-KComponentData TelepathyHandlerApplication::Private::initHack()
-{
- KComponentData cData(KCmdLineArgs::aboutData());
- KCmdLineOptions handler_options;
- handler_options.add("persist", ki18n("Persistent mode (do not exit on timeout)"));
- handler_options.add("debug", ki18n("Show Telepathy debugging information"));
- KCmdLineArgs::addCmdLineOptions(handler_options, ki18n("KDE Telepathy"), "kde-telepathy", "kde");
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde-telepathy");
- Private::s_persist = args->isSet("persist");
- Private::s_debug = args->isSet("debug");
-
- s_tpqt4DebugArea = KDebug::registerArea("Telepathy-Qt4");
-
- return cData;
-}
-
-void TelepathyHandlerApplication::Private::init(int initialTimeout, int timeout)
-{
- this->initialTimeout = initialTimeout;
- this->timeout = timeout;
-
- // If timeout < 0 we let the application exit when the last window is closed,
- // Otherwise we handle it with the timeout
- if (timeout >= 0) {
- q->setQuitOnLastWindowClosed(false);
- }
-
- // Register TpQt4 types
- Tp::registerTypes();
-
- // Redirect Tp debug and warnings to KDebug output
- Tp::setDebugCallback(&tpDebugCallback);
-
- // Enable telepathy-Qt4 debug
- Tp::enableDebug(s_debug);
- Tp::enableWarnings(true);
-
- // Enable KDebug DBus interface
- // FIXME This must be enabled here because there is a bug in plasma
- // it should be removed when this is fixed
- kde_kdebug_enable_dbus_interface = s_debug;
-
- if (!Private::s_persist) {
- timer = new QTimer(q);
- if (initialTimeout >= 0) {
- q->connect(timer, SIGNAL(timeout()), q, SLOT(_k_onInitialTimeout()));
- timer->start(initialTimeout);
- }
- }
-}
-
-bool TelepathyHandlerApplication::Private::s_persist = false;
-bool TelepathyHandlerApplication::Private::s_debug = false;
-
-
-TelepathyHandlerApplication::TelepathyHandlerApplication(bool GUIenabled,
- int initialTimeout,
- int timeout)
- : KApplication(GUIenabled, Private::initHack()),
- d(new Private(this))
-{
- d->init(initialTimeout, timeout);
-}
-
-TelepathyHandlerApplication::TelepathyHandlerApplication(Display *display,
- Qt::HANDLE visual,
- Qt::HANDLE colormap,
- int initialTimeout,
- int timeout)
- : KApplication(display, visual, colormap, Private::initHack()),
- d(new Private(this))
-{
- d->init(initialTimeout, timeout);
-}
-
-TelepathyHandlerApplication::~TelepathyHandlerApplication()
-{
- delete d;
-}
-
-int TelepathyHandlerApplication::newJob()
-{
- TelepathyHandlerApplication *app = qobject_cast<TelepathyHandlerApplication*>(KApplication::kApplication());
- TelepathyHandlerApplication::Private *d = app->d;
-
- int ret = d->jobCount.fetchAndAddOrdered(1);
- if (!Private::s_persist) {
- if (d->timer->isActive()) {
- d->timer->stop();
- }
- if (!d->firstJobStarted) {
- if (d->initialTimeout) {
- disconnect(d->timer, SIGNAL(timeout()), app, SLOT(_k_onInitialTimeout()));
- }
- if (d->timeout >= 0) {
- connect(d->timer, SIGNAL(timeout()), app, SLOT(_k_onTimeout()));
- }
- d->firstJobStarted = true;
- }
- }
- return ret;
-}
-
-void TelepathyHandlerApplication::jobFinished()
-{
- TelepathyHandlerApplication *app = qobject_cast<TelepathyHandlerApplication*>(KApplication::kApplication());
- TelepathyHandlerApplication::Private *d = app->d;
-
- if (d->jobCount.fetchAndAddOrdered(-1) <= 1) {
- if (!Private::s_persist && d->timeout >= 0) {
- kDebug() << "No other jobs at the moment. Starting timer.";
- d->timer->start(d->timeout);
- }
- }
-}
-
-} // namespace KTelepathy
-
-#include "telepathy-handler-application.moc"
diff --git a/src/telepathy-handler-application.h b/src/telepathy-handler-application.h
deleted file mode 100644
index 455463d..0000000
--- a/src/telepathy-handler-application.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-* Copyright (C) 2011 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 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
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef TELEPATHY_HANDLER_APPLICATION_H
-#define TELEPATHY_HANDLER_APPLICATION_H
-
-#include <KApplication>
-
-
-namespace KTelepathy {
-
-/**
- * rief A KApplication that exits the application when there are no running jobs
- *
- * Morover it does automatically another few things required by every handler:
- * - It automatically register Telepathy-Qt Types
- * - setQuitOnLastWindowClosed(false)
- * - Adds the --persist option to inhibit automatic exit.
- * - Adds the --debug option to enable telepathy-qt4 debug
- * - Enables telepathy-qt4 warnings
- * - Use Tp-Qt4 callback for redirecting debug output into KDebug
- */
-class TelepathyHandlerApplication : public KApplication
-{
- Q_OBJECT
-
-public:
- /**
- * \p initialTimeout Initial timeout time (in msec) after which application exits if no jobs are received.
- * \p timeout Timeout time (in msec) after which application exits after the last job is finished.
- */
- explicit TelepathyHandlerApplication(bool GUIenabled = true,
- int initialTimeout = 15000,
- int timeout = 2000);
-
- explicit TelepathyHandlerApplication(Display *display,
- Qt::HANDLE visual = 0,
- Qt::HANDLE colormap = 0,
- int initialTimeout = 15000,
- int timeout = 2000);
-
- virtual ~TelepathyHandlerApplication();
-
- static int newJob();
- static void jobFinished();
-
-private:
- class Private;
- Private * const d;
-
- Q_PRIVATE_SLOT(d, void _k_onInitialTimeout())
- Q_PRIVATE_SLOT(d, void _k_onTimeout())
-};
-
-} // namespace KTelepathy
-
-#endif // TELEPATHY_HANDLER_APPLICATION_H
--
ktp-filetransfer-handler packaging
More information about the pkg-kde-commits
mailing list