Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e60f75c3 authored by Alexey Chernov's avatar Alexey Chernov Committed by Pali Rohár

Port Bonjour protocol to KF5

Apply several minor class and methods rename and port indentities
dependencies on KDE PIM to KF5 flavour.
parent 9e3dea26
......@@ -29,7 +29,7 @@ bonjouraccountpreferences.ui
add_library(kopete_bonjour MODULE ${kopete_bonjour_PART_SRCS})
target_link_libraries(kopete_bonjour KF5::KIOCore KF5::PimIdentities KF5::DNSSD kopete)
target_link_libraries(kopete_bonjour KF5::KIOCore KF5::IdentityManagement KF5::DNSSD kopete)
if(NOT DISABLE_VIDEOSUPPORT)
target_link_libraries(kopete_bonjour kopete_videodevice)
endif(NOT DISABLE_VIDEOSUPPORT)
......
......@@ -25,9 +25,6 @@
#include <kicon.h>
#include <kmessagebox.h>
#include <dnssd/publicservice.h>
#include <dnssd/servicebrowser.h>
#include "kopetemetacontact.h"
#include "kopetecontactlist.h"
#include "kopetedeletecontacttask.h"
......@@ -145,12 +142,12 @@ void BonjourAccount::startBrowse()
// Delete All Contacts Before we start looking for new ones
wipeOutAllContacts();
browser = new DNSSD::ServiceBrowser("_presence._tcp");
browser = new KDNSSD::ServiceBrowser("_presence._tcp");
QObject::connect(browser,SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)),
this,SLOT(comingOnline(DNSSD::RemoteService::Ptr)));
QObject::connect(browser,SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr)),
this,SLOT(goingOffline(DNSSD::RemoteService::Ptr)));
QObject::connect(browser,SIGNAL(serviceAdded(KDNSSD::RemoteService::Ptr)),
this,SLOT(comingOnline(KDNSSD::RemoteService::Ptr)));
QObject::connect(browser,SIGNAL(serviceRemoved(KDNSSD::RemoteService::Ptr)),
this,SLOT(goingOffline(KDNSSD::RemoteService::Ptr)));
kDebug()<<"Starting Browser";
browser->startBrowse();
......@@ -160,10 +157,10 @@ void BonjourAccount::startPublish()
{
if (! username.contains('@')) {
username.append("@");
username.append(DNSSD::ServiceBrowser::getLocalHostName().toUtf8());
username.append(KDNSSD::ServiceBrowser::getLocalHostName().toUtf8());
}
service = new DNSSD::PublicService(username, "_presence._tcp", listeningPort);
service = new KDNSSD::PublicService(username, "_presence._tcp", listeningPort);
QMap <QString, QByteArray> map;
map.insert("1st", firstName);
......@@ -191,7 +188,7 @@ void BonjourAccount::published(bool success)
} else {
kDebug()<<"Publish Failed";
disconnect();
KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget(), KMessageBox::Error,
KMessageBox::error(Kopete::UI::Global::mainWidget(),
i18n("Unable to publish Bonjour service. Currently the Bonjour plugin only works with Avahi."));
}
}
......@@ -201,8 +198,8 @@ void BonjourAccount::connect( const Kopete::OnlineStatus& /* initialStatus */ )
if (username.isEmpty())
username = accountId().toUtf8();
if (DNSSD::ServiceBrowser::isAvailable() != DNSSD::ServiceBrowser::Working) {
KMessageBox::queuedMessageBox(Kopete::UI::Global::mainWidget(), KMessageBox::Error,
if (KDNSSD::ServiceBrowser::isAvailable() != KDNSSD::ServiceBrowser::Working) {
KMessageBox::error(Kopete::UI::Global::mainWidget(),
i18n("Unable to connect to the local mDNS server. Please ensure the Avahi daemon is running."));
return;
}
......@@ -217,7 +214,7 @@ void BonjourAccount::connect( const Kopete::OnlineStatus& /* initialStatus */ )
startBrowse();
}
void BonjourAccount::comingOnline(DNSSD::RemoteService::Ptr pointer)
void BonjourAccount::comingOnline(KDNSSD::RemoteService::Ptr pointer)
{
if (! pointer->resolve()) {
kDebug()<<"Unable to Resolve! Dumping Contact";
......@@ -245,7 +242,7 @@ void BonjourAccount::comingOnline(DNSSD::RemoteService::Ptr pointer)
QString hostName = pointer->hostName();
kDebug()<<"Hostname is:"<<hostName;
if (! hostName.isEmpty()) {
QHostAddress hostAddress = DNSSD::ServiceBrowser::resolveHostName(hostName);
QHostAddress hostAddress = KDNSSD::ServiceBrowser::resolveHostName(hostName);
kDebug()<<"Host Address is:"<<hostAddress;
if (hostAddress != QHostAddress() ) {
......@@ -268,7 +265,7 @@ void BonjourAccount::comingOnline(DNSSD::RemoteService::Ptr pointer)
}
}
void BonjourAccount::goingOffline(DNSSD::RemoteService::Ptr pointer)
void BonjourAccount::goingOffline(KDNSSD::RemoteService::Ptr pointer)
{
pointer->resolve();
......
......@@ -24,8 +24,8 @@
#include <kopeteaccount.h>
#include <dnssd/publicservice.h>
#include <dnssd/servicebrowser.h>
#include <KDNSSD/DNSSD/PublicService>
#include <KDNSSD/DNSSD/ServiceBrowser>
#include "bonjourcontact.h"
#include "bonjourcontactconnection.h"
......@@ -174,7 +174,7 @@ public slots:
*
* @param pointer A RemoteService Pointer to the Service.
*/
void comingOnline(DNSSD::RemoteService::Ptr pointer);
void comingOnline(KDNSSD::RemoteService::Ptr pointer);
/**
* @brief Slots Called When a Contact Goes Offline
......@@ -184,7 +184,7 @@ public slots:
*
* @param pointer A RemoteService Pointer to the Service.
*/
void goingOffline(DNSSD::RemoteService::Ptr pointer);
void goingOffline(KDNSSD::RemoteService::Ptr pointer);
/**
* @brief A Slot Called when a connection discovers it's username
......@@ -230,7 +230,7 @@ private:
/**
* The Connection to Avahi Which Keeps Scanning For Contacts Coming Online Or Offline
*/
DNSSD::PublicService *service;
KDNSSD::PublicService *service;
/**
* The local Server which waits for people to talk to it :D
......@@ -251,7 +251,7 @@ private:
/**
* The Service Browser Which Keeps Scanning For New People
*/
DNSSD::ServiceBrowser *browser;
KDNSSD::ServiceBrowser *browser;
/*
* Big List of Open Connections, who we don't know is at the other end
......
......@@ -28,8 +28,8 @@
#include "bonjourprotocol.h"
#include <kconfigdialog.h>
#include <kuser.h>
#include <kpimidentities/identity.h>
#include <kpimidentities/identitymanager.h>
#include <KIdentityManagement/Identity>
#include <KIdentityManagement/IdentityManager>
BonjourEditAccountWidget::BonjourEditAccountWidget( QWidget* parent, Kopete::Account* account)
: QWidget( parent ), KopeteEditAccountWidget( account )
......@@ -64,8 +64,8 @@ BonjourEditAccountWidget::BonjourEditAccountWidget( QWidget* parent, Kopete::Acc
}
// Next try via the default identity
KPIMIdentities::IdentityManager manager(true);
const KPIMIdentities::Identity & ident = manager.defaultIdentity();
KIdentityManagement::IdentityManager manager(true);
const KIdentityManagement::Identity & ident = manager.defaultIdentity();
if (! ident.isNull()) {
// Get the full name from identity (only if not available via KUser)
......
......@@ -32,7 +32,7 @@ K_EXPORT_COMPONENT_FACTORY( kopete_bonjour, BonjourProtocolFactory( "kopete_bonj
BonjourProtocol *BonjourProtocol::s_protocol = 0L;
BonjourProtocol::BonjourProtocol( QObject* parent, const QStringList &/*args*/ )
: Kopete::Protocol( BonjourProtocolFactory::componentData(), parent ),
: Kopete::Protocol( parent ),
bonjourOnline( Kopete::OnlineStatus::Online, 25, this, 0, QStringList(QString()),
i18n( "Online" ), i18n( "O&nline" ), Kopete::OnlineStatusManager::Online ),
bonjourAway( Kopete::OnlineStatus::Away, 25, this, 1, QStringList(QLatin1String("msn_away")),
......
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