[SCM] ktp-approver packaging branch, master, updated. debian/15.12.1-1-299-g62cbbd7
Maximiliano Curia
maxy at moszumanska.debian.org
Fri May 27 09:14:16 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-approver.git;a=commitdiff;h=f548510
The following commit has been merged in the master branch:
commit f5485101246214a49b2d2232e7e8189ed20f15a6
Author: Hrvoje Senjan <hrvoje.senjan at gmail.com>
Date: Mon Oct 27 03:23:56 2014 +0100
Initial port of ktp-approver to Frameworks
REVIEW: 120793
---
CMakeLists.txt | 20 ++++++--
src/CMakeLists.txt | 14 +++--
src/dispatchoperation.cpp | 10 ++--
src/filetransferchannelapprover.cpp | 15 +++---
src/filetransferchannelapprover.h | 2 +-
src/handlewithcaller.cpp | 11 ++--
src/ktp_approver_debug.cpp | 21 ++++++++
src/ktp_approver_debug.h | 26 ++++++++++
src/ktpapprovermodule.cpp | 20 ++++----
...esktop.Telepathy.Client.KTp.Approver.service.in | 2 +-
src/textchannelapprover.cpp | 13 ++---
src/textchannelapprover.h | 2 +-
src/tubechannelapprover.cpp | 60 +++++++++++-----------
src/tubechannelapprover.h | 6 ++-
14 files changed, 140 insertions(+), 82 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59e65f3..496d9ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,14 +2,24 @@ project(ktp-approver)
set(KTP_APPROVER_VERSION "0.8.80")
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+
cmake_policy(SET CMP0002 OLD)
-find_package(KDE4 REQUIRED)
-find_package(TelepathyQt4 0.8.9 REQUIRED)
+find_package(ECM 1.3.0 REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_MODULE_PATH})
+
+include(KDEInstallDirs)
+include(KDECMakeSettings)
+include(KDECompilerSettings)
+include(FeatureSummary)
+
+find_package (Qt5 REQUIRED COMPONENTS Widgets Network)
+find_package (KF5 REQUIRED COMPONENTS DBusAddons Config I18n Notifications Service)
+
+find_package(TelepathyQt5 REQUIRED)
-include_directories(${KDE4_INCLUDES} ${TELEPATHY_QT4_INCLUDE_DIR})
-add_definitions(${KDE4_DEFINITIONS})
+include_directories(${TELEPATHY_QT5_INCLUDE_DIR})
configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/version.h @ONLY)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 60609d8..4f4deb5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,5 @@
set(ktp_approver_SRCS
+ ktp_approver_debug.cpp
ktpapprovermodule.cpp
approverdaemon.cpp
dispatchoperation.cpp
@@ -11,9 +12,16 @@ set(ktp_approver_SRCS
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-kde4_add_plugin(kded_ktp_approver ${ktp_approver_SRCS})
-target_link_libraries(kded_ktp_approver ${KDE4_KDEUI_LIBS}
- ${TELEPATHY_QT4_LIBRARIES})
+add_library(kded_ktp_approver MODULE ${ktp_approver_SRCS})
+target_link_libraries(kded_ktp_approver Qt5::Widgets
+ Qt5::Network
+ ${TELEPATHY_QT5_LIBRARIES}
+ KF5::DBusAddons
+ KF5::ConfigGui
+ KF5::I18n
+ KF5::Notifications
+ KF5::Service
+)
install(TARGETS kded_ktp_approver DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES ktp_approver.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
diff --git a/src/dispatchoperation.cpp b/src/dispatchoperation.cpp
index 68ed8cc..79ac896 100644
--- a/src/dispatchoperation.cpp
+++ b/src/dispatchoperation.cpp
@@ -18,7 +18,7 @@
#include "dispatchoperation.h"
#include "channelapprover.h"
#include "handlewithcaller.h"
-#include <KDebug>
+#include "ktp_approver_debug.h"
#include <TelepathyQt/PendingOperation>
#include <TelepathyQt/TextChannel>
@@ -48,14 +48,14 @@ DispatchOperation::DispatchOperation(const Tp::ChannelDispatchOperationPtr & dis
DispatchOperation::~DispatchOperation()
{
- kDebug();
+ qCDebug(APPROVER);
}
void DispatchOperation::onChannelLost(const Tp::ChannelPtr & channel,
const QString & errorName,
const QString & errorMessage)
{
- kDebug() << "Channel lost:" << errorName << errorMessage;
+ qCDebug(APPROVER) << "Channel lost:" << errorName << errorMessage;
ChannelApprover *approver = m_channelApprovers.take(channel);
Q_ASSERT(approver);
@@ -67,7 +67,7 @@ void DispatchOperation::onDispatchOperationInvalidated(Tp::DBusProxy *proxy,
const QString & errorMessage)
{
Q_UNUSED(proxy);
- kDebug() << "Dispatch operation invalidated" << errorName << errorMessage;
+ qCDebug(APPROVER) << "Dispatch operation invalidated" << errorName << errorMessage;
deleteLater();
}
@@ -94,7 +94,7 @@ void DispatchOperation::onChannelRejected()
void DispatchOperation::onClaimFinished(Tp::PendingOperation *operation)
{
if (operation->isError()) {
- kDebug() << "Claim error:" << operation->errorName() << operation->errorMessage();
+ qCDebug(APPROVER) << "Claim error:" << operation->errorName() << operation->errorMessage();
return;
}
diff --git a/src/filetransferchannelapprover.cpp b/src/filetransferchannelapprover.cpp
index 43393c0..dd76919 100644
--- a/src/filetransferchannelapprover.cpp
+++ b/src/filetransferchannelapprover.cpp
@@ -16,13 +16,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "filetransferchannelapprover.h"
+#include "ktp_approver_debug.h"
+#include <QMenu>
#include <KNotification>
#include <KStatusNotifierItem>
-#include <KLocale>
-#include <KDebug>
-#include <KAboutData>
-#include <KActionCollection>
-#include <KMenu>
+#include <KLocalizedString>
#include <TelepathyQt/AvatarData>
#include <TelepathyQt/Contact>
@@ -31,12 +29,11 @@ FileTransferChannelApprover::FileTransferChannelApprover(
QObject *parent)
: ChannelApprover(parent)
{
- kDebug();
+ qCDebug(APPROVER);
//notification
m_notification = new KNotification("incoming_file_transfer", 0, KNotification::Persistent);
- KAboutData aboutData("ktelepathy",0,KLocalizedString(),0);
- m_notification.data()->setComponentData(KComponentData(aboutData));
+ m_notification.data()->setComponentName(QStringLiteral("ktelepathy"));
m_notification.data()->setTitle(i18n("Incoming file transfer"));
Tp::ContactPtr sender = channel->initiatorContact();
@@ -77,7 +74,7 @@ FileTransferChannelApprover::FileTransferChannelApprover(
FileTransferChannelApprover::~FileTransferChannelApprover()
{
- kDebug();
+ qCDebug(APPROVER);
//destroy the notification
if (m_notification) {
diff --git a/src/filetransferchannelapprover.h b/src/filetransferchannelapprover.h
index 8b5a1d4..a8c13d5 100644
--- a/src/filetransferchannelapprover.h
+++ b/src/filetransferchannelapprover.h
@@ -33,7 +33,7 @@ public:
virtual ~FileTransferChannelApprover();
private:
- QWeakPointer<KNotification> m_notification;
+ QPointer<KNotification> m_notification;
KStatusNotifierItem *m_notifierItem;
};
diff --git a/src/handlewithcaller.cpp b/src/handlewithcaller.cpp
index 15934a0..522bb83 100644
--- a/src/handlewithcaller.cpp
+++ b/src/handlewithcaller.cpp
@@ -16,10 +16,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "handlewithcaller.h"
-#include "ktpapproverfactory.h"
+#include "ktp_approver_debug.h"
#include <KSharedConfig>
#include <KConfigGroup>
-#include <KDebug>
#include <TelepathyQt/PendingOperation>
#include <TelepathyQt/Channel>
@@ -37,7 +36,7 @@ HandleWithCaller::HandleWithCaller(const Tp::ChannelDispatchOperationPtr & dispa
void HandleWithCaller::findHandlers()
{
- KSharedConfigPtr config = KSharedConfig::openConfig(KTpApproverFactory::componentData());
+ KSharedConfigPtr config = KSharedConfig::openConfig("ktelepathyrc");
KConfigGroup group = config->group("HandlerPreferences");
//realistically, dispatch operations only have one channel
@@ -48,8 +47,8 @@ void HandleWithCaller::findHandlers()
QStringList preferredHandlers = group.readEntry(channelType, QStringList());
QStringList possibleHandlers = m_dispatchOperation->possibleHandlers();
- kDebug() << "Preferred:" << preferredHandlers;
- kDebug() << "Possible:" << possibleHandlers;
+ qCDebug(APPROVER) << "Preferred:" << preferredHandlers;
+ qCDebug(APPROVER) << "Possible:" << possibleHandlers;
//intersect the two lists, while respecting the order
//of preference that was read from the config file
@@ -70,7 +69,7 @@ void HandleWithCaller::findHandlers()
preferredHandlers.append(possibleHandlers);
m_possibleHandlers = preferredHandlers;
- kDebug() << "Final:" << m_possibleHandlers;
+ qCDebug(APPROVER) << "Final:" << m_possibleHandlers;
}
void HandleWithCaller::callHandleWith()
diff --git a/src/ktp_approver_debug.cpp b/src/ktp_approver_debug.cpp
new file mode 100644
index 0000000..b4c8b48
--- /dev/null
+++ b/src/ktp_approver_debug.cpp
@@ -0,0 +1,21 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Hrvoje Senjan <hrvoje.senjan at gmail.com>
+
+ 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.
+*/
+
+#include "ktp_approver_debug.h"
+Q_LOGGING_CATEGORY(APPROVER, "ktp-approver")
\ No newline at end of file
diff --git a/src/ktp_approver_debug.h b/src/ktp_approver_debug.h
new file mode 100644
index 0000000..70769ba
--- /dev/null
+++ b/src/ktp_approver_debug.h
@@ -0,0 +1,26 @@
+/* This file is part of the KDE project
+ Copyright (C) 2014 Hrvoje Senjan <hrvoje.senjan at gmail.com>
+
+ 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 KTP_APPROVER_DEBUG_H
+#define KTP_APPROVER_DEBUG_H
+
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(APPROVER)
+
+#endif
\ No newline at end of file
diff --git a/src/ktpapprovermodule.cpp b/src/ktpapprovermodule.cpp
index 2ddd33e..956599c 100644
--- a/src/ktpapprovermodule.cpp
+++ b/src/ktpapprovermodule.cpp
@@ -16,13 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "approverdaemon.h"
-#include "ktpapproverfactory.h"
#include "version.h"
#include <KAboutData>
-#include <KLocale>
-#include <KComponentData>
+#include <KLocalizedString>
#include <KDEDModule>
+#include <KPluginFactory>
#include <TelepathyQt/Types>
#include <TelepathyQt/Debug>
@@ -79,12 +78,12 @@ public:
static inline KAboutData aboutData()
{
- KAboutData aboutData("ktp-approver", "kded_ktp_approver", KLocalizedString(),
+ KAboutData aboutData(QStringLiteral("ktp-approver"), 0,
KTP_APPROVER_VERSION,
- KLocalizedString(), KAboutData::License_LGPL,
- ki18nc("@info:credit", "(C) 2010, Collabora Ltd."));
- aboutData.addAuthor(ki18nc("@info:credit", "George Kiagiadakis"),
- KLocalizedString(), "george.kiagiadakis at collabora.co.uk");
+ 0, KAboutLicense::LGPL,
+ i18n("(C) 2010, Collabora Ltd."));
+ aboutData.addAuthor(i18n("George Kiagiadakis"),
+ QString(), QStringLiteral("george.kiagiadakis at collabora.co.uk"));
return aboutData;
}
@@ -92,5 +91,6 @@ private:
Tp::ClientRegistrarPtr m_registrar;
};
-K_PLUGIN_FACTORY_DEFINITION(KTpApproverFactory, registerPlugin<KTpApproverModule>();)
-K_EXPORT_PLUGIN(KTpApproverFactory(KTpApproverModule::aboutData()))
+K_PLUGIN_FACTORY(KTpApproverModuleFactory, registerPlugin<KTpApproverModule>();)
+
+#include "ktpapprovermodule.moc"
\ No newline at end of file
diff --git a/src/org.freedesktop.Telepathy.Client.KTp.Approver.service.in b/src/org.freedesktop.Telepathy.Client.KTp.Approver.service.in
index 02e92e2..37fb35c 100644
--- a/src/org.freedesktop.Telepathy.Client.KTp.Approver.service.in
+++ b/src/org.freedesktop.Telepathy.Client.KTp.Approver.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.freedesktop.Telepathy.Client.KTp.Approver
-Exec=@DBUS_SEND_PATH@ --session --type=method_call --dest=org.kde.kded /kded org.kde.kded.loadModule string:"ktp_approver"
+Exec=@DBUS_SEND_PATH@ --session --type=method_call --dest=org.kde.kded5 /kded org.kde.kded5.loadModule string:"ktp_approver"
diff --git a/src/textchannelapprover.cpp b/src/textchannelapprover.cpp
index 67c66ce..b28db46 100644
--- a/src/textchannelapprover.cpp
+++ b/src/textchannelapprover.cpp
@@ -16,14 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "textchannelapprover.h"
-#include "ktpapproverfactory.h"
+#include <QMenu>
#include <KNotification>
#include <KStatusNotifierItem>
-#include <KLocale>
-#include <KGlobal>
-#include <KDebug>
-#include <KAboutData>
-#include <KMenu>
+#include <KLocalizedString>
#include <TelepathyQt/ReceivedMessage>
#include <TelepathyQt/AvatarData>
@@ -62,8 +58,7 @@ void TextChannelApprover::onMessageReceived(const Tp::ReceivedMessage & msg)
if (!m_notification) {
m_notification = new KNotification("new_text_message", 0, KNotification::Persistent);
- KAboutData aboutData("ktelepathy",0,KLocalizedString(),0);
- m_notification.data()->setComponentData(KComponentData(aboutData));
+ m_notification.data()->setComponentName(QStringLiteral("ktelepathy"));
Tp::ContactPtr sender = msg.sender();
if (sender) {
@@ -89,7 +84,7 @@ void TextChannelApprover::onMessageReceived(const Tp::ReceivedMessage & msg)
m_notification.data()->sendEvent();
}
-K_GLOBAL_STATIC(QWeakPointer<KStatusNotifierItem>, s_notifierItem)
+Q_GLOBAL_STATIC(QWeakPointer<KStatusNotifierItem>, s_notifierItem)
//static
QSharedPointer<KStatusNotifierItem> TextChannelApprover::getNotifierItem()
diff --git a/src/textchannelapprover.h b/src/textchannelapprover.h
index b69e876..3cc302c 100644
--- a/src/textchannelapprover.h
+++ b/src/textchannelapprover.h
@@ -41,7 +41,7 @@ private:
static QSharedPointer<KStatusNotifierItem> getNotifierItem();
void updateNotifierItemTooltip();
- QWeakPointer<KNotification> m_notification;
+ QPointer<KNotification> m_notification;
QSharedPointer<KStatusNotifierItem> m_notifierItem;
};
diff --git a/src/tubechannelapprover.cpp b/src/tubechannelapprover.cpp
index 836ac23..10c2965 100644
--- a/src/tubechannelapprover.cpp
+++ b/src/tubechannelapprover.cpp
@@ -17,14 +17,15 @@
*/
#include "tubechannelapprover.h"
+#include "ktp_approver_debug.h"
+#include <QMenu>
+#include <QIcon>
+
+#include <KLocalizedString>
#include <KService>
#include <KServiceTypeTrader>
#include <KStatusNotifierItem>
-#include <KDebug>
-#include <KAboutData>
-#include <KIcon>
-#include <KMenu>
#include <TelepathyQt/TubeChannel>
#include <TelepathyQt/StreamTubeChannel>
@@ -39,22 +40,22 @@ TubeChannelApprover::TubeChannelApprover(const Tp::TubeChannelPtr& channel, QObj
{
Q_UNUSED(parent);
- kDebug() << "Incoming tube channel";
- kDebug() << " Tube Type:" << channel->channelType();
+ qCDebug(APPROVER) << "Incoming tube channel";
+ qCDebug(APPROVER) << " Tube Type:" << channel->channelType();
connect(m_channel.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)), SLOT(onChannelInvalidated()));
QString serviceName;
if (Tp::StreamTubeChannelPtr streamTube = Tp::StreamTubeChannelPtr::dynamicCast(channel)) {
- kDebug() << " Service:" << streamTube->service();
+ qCDebug(APPROVER) << " Service:" << streamTube->service();
serviceName = streamTube->service();
} else if (Tp::DBusTubeChannelPtr dbusTube = Tp::DBusTubeChannelPtr::dynamicCast(channel)) {
- kDebug() << " Service name:" << dbusTube->serviceName();
+ qCDebug(APPROVER) << " Service name:" << dbusTube->serviceName();
serviceName = dbusTube->serviceName();
}
KService::List services = KServiceTypeTrader::self()->query(QLatin1String("KTpApprover"));
- kDebug() << "Found" << services.count() << "KTpApprover services";
+ qCDebug(APPROVER) << "Found" << services.count() << "KTpApprover services";
if (!services.isEmpty()) {
Q_FOREACH(const KService::Ptr &service, services) {
if ((service->property(QLatin1String("X-KTp-ChannelType")) != channel->channelType()) ||
@@ -68,7 +69,7 @@ TubeChannelApprover::TubeChannelApprover(const Tp::TubeChannelPtr& channel, QObj
if (!m_service) {
- kDebug() << "No service to match" << channel->channelType() << "," << serviceName;
+ qCDebug(APPROVER) << "No service to match" << channel->channelType() << "," << serviceName;
showNotification(i18n("Unknown Incoming Connection"),
i18n("%1 wants to start an unknown service with you", channel->initiatorContact()->alias()),
QLatin1String("dialog-warning"),
@@ -82,7 +83,7 @@ TubeChannelApprover::TubeChannelApprover(const Tp::TubeChannelPtr& channel, QObj
TubeChannelApprover::~TubeChannelApprover()
{
- kDebug();
+ qCDebug(APPROVER);
//destroy the notification
if (m_notification) {
@@ -91,7 +92,7 @@ TubeChannelApprover::~TubeChannelApprover()
}
if (m_notifierItem) {
- m_notifierItem.data()->deleteLater();
+ m_notifierItem->deleteLater();
}
}
@@ -99,8 +100,7 @@ void TubeChannelApprover::showNotification(const QString& title, const QString&
{
// incoming_file_transfer = defines notification sound & user preferences
m_notification = new KNotification(QLatin1String("incoming_file_transfer"), 0, KNotification::Persistent);
- KAboutData aboutData("ktelepathy", 0, KLocalizedString(), 0);
- m_notification.data()->setComponentData(KComponentData(aboutData));
+ m_notification.data()->setComponentName(QStringLiteral("ktelepathy"));
m_notification.data()->setTitle(title);
if (comment.contains(QLatin1String("%1"))) {
Q_ASSERT(sender);
@@ -108,7 +108,7 @@ void TubeChannelApprover::showNotification(const QString& title, const QString&
} else {
m_notification.data()->setText(comment);
}
- m_notification.data()->setPixmap(KIcon(icon).pixmap(32, 32));
+ m_notification.data()->setPixmap(QIcon::fromTheme(icon).pixmap(32, 32));
m_notification.data()->setActions(QStringList() << i18n("Accept") << i18n("Reject"));
connect(m_notification.data(), SIGNAL(action1Activated()), SIGNAL(channelAccepted()));
connect(m_notification.data(), SIGNAL(action2Activated()), SIGNAL(channelRejected()));
@@ -117,18 +117,18 @@ void TubeChannelApprover::showNotification(const QString& title, const QString&
//tray icon
m_notifierItem = new KStatusNotifierItem;
- m_notifierItem.data()->setCategory(KStatusNotifierItem::Communications);
- m_notifierItem.data()->setStatus(KStatusNotifierItem::NeedsAttention);
- m_notifierItem.data()->setIconByName(icon);
- m_notifierItem.data()->setStandardActionsEnabled(false);
- m_notifierItem.data()->setTitle(title);
- m_notifierItem.data()->setToolTip(QLatin1String("document-save"),
+ m_notifierItem->setCategory(KStatusNotifierItem::Communications);
+ m_notifierItem->setStatus(KStatusNotifierItem::NeedsAttention);
+ m_notifierItem->setIconByName(icon);
+ m_notifierItem->setStandardActionsEnabled(false);
+ m_notifierItem->setTitle(title);
+ m_notifierItem->setToolTip(QLatin1String("document-save"),
i18n("Incoming %1 request from %2", title, sender->alias()),
QString());
- m_notifierItem.data()->contextMenu()->clear(); //calling clear removes the pointless title
- m_notifierItem.data()->contextMenu()->addAction(i18n("Accept"), this, SIGNAL(channelAccepted()));
- m_notifierItem.data()->contextMenu()->addAction(i18n("Reject"), this, SIGNAL(channelRejected()));
+ m_notifierItem->contextMenu()->clear(); //calling clear removes the pointless title
+ m_notifierItem->contextMenu()->addAction(i18n("Accept"), this, SIGNAL(channelAccepted()));
+ m_notifierItem->contextMenu()->addAction(i18n("Reject"), this, SIGNAL(channelRejected()));
connect(this, SIGNAL(channelAccepted()), SLOT(onChannelAccepted()));
}
@@ -140,15 +140,15 @@ void TubeChannelApprover::onChannelAccepted()
m_notification.data()->deleteLater();
}
- m_notifierItem.data()->setStatus(KStatusNotifierItem::Active);
- if (!m_service.isNull() && m_service->property(QLatin1String("X-KTp-Cancellable")).toBool()) {
- m_notifierItem.data()->setTitle(i18n("%1 share with %2", m_service->name(), m_channel->initiatorContact()->alias()));
+ m_notifierItem->setStatus(KStatusNotifierItem::Active);
+ if (m_service && m_service->property(QLatin1String("X-KTp-Cancellable")).toBool()) {
+ m_notifierItem->setTitle(i18n("%1 share with %2", m_service->name(), m_channel->initiatorContact()->alias()));
//set new menu to an entry to close the channel
- m_notifierItem.data()->contextMenu()->clear();
- m_notifierItem.data()->contextMenu()->addAction(KIcon("dialog-close"), i18n("Stop %1 Sharing", m_service->name()),
+ m_notifierItem->contextMenu()->clear();
+ m_notifierItem->contextMenu()->addAction(QIcon::fromTheme("dialog-close"), i18n("Stop %1 Sharing", m_service->name()),
this, SLOT(onChannelCloseRequested()));
} else {
- m_notifierItem.data()->deleteLater();
+ m_notifierItem->deleteLater();
}
}
diff --git a/src/tubechannelapprover.h b/src/tubechannelapprover.h
index a4dbab6..451a6cc 100644
--- a/src/tubechannelapprover.h
+++ b/src/tubechannelapprover.h
@@ -20,6 +20,8 @@
#include "channelapprover.h"
+#include <QSharedPointer>
+
#include <KNotification>
#include <KService>
#include <TelepathyQt/TubeChannel>
@@ -44,8 +46,8 @@ class TubeChannelApprover : public ChannelApprover
const Tp::ContactPtr &sender);
Tp::TubeChannelPtr m_channel;
- QWeakPointer<KNotification> m_notification;
- QWeakPointer<KStatusNotifierItem> m_notifierItem;
+ QPointer<KNotification> m_notification;
+ KStatusNotifierItem *m_notifierItem;
KService::Ptr m_service;
};
--
ktp-approver packaging
More information about the pkg-kde-commits
mailing list